Skip to content

fix(update-tasks): Improve AI response parsing for 'update' command#377

Merged
eyaltoledano merged 1 commit intonextfrom
fix-update-tasks-parsing
May 2, 2025
Merged

fix(update-tasks): Improve AI response parsing for 'update' command#377
eyaltoledano merged 1 commit intonextfrom
fix-update-tasks-parsing

Conversation

@eyaltoledano
Copy link
Owner

Refactors the JSON array parsing logic within
in .

The previous logic primarily relied on extracting content from markdown code blocks (json or javascript), which proved brittle when the AI response included comments or non-JSON text within the block, leading to parsing errors for the command.

This change modifies the parsing strategy to first attempt extracting content directly between the outermost '[' and ']' brackets. This is more robust as it targets the expected array structure directly. If bracket extraction fails, it falls back to looking for a strict json code block, then prefix stripping, before attempting a raw parse.

This approach aligns with the successful parsing strategy used for single-object responses in and resolves the
parsing errors previously observed with the command.

Refactors the JSON array parsing logic within
in .

The previous logic primarily relied on extracting content from markdown
code blocks (json or javascript), which proved brittle when the AI
response included comments or non-JSON text within the block, leading to
parsing errors for the  command.

This change modifies the parsing strategy to first attempt extracting
content directly between the outermost '[' and ']' brackets. This is
more robust as it targets the expected array structure directly. If
bracket extraction fails, it falls back to looking for a strict json
code block, then prefix stripping, before attempting a raw parse.

This approach aligns with the successful parsing strategy used for
single-object responses in  and resolves the
parsing errors previously observed with the  command.
@changeset-bot
Copy link

changeset-bot bot commented May 2, 2025

⚠️ No Changeset found

Latest commit: c9e4558

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@eyaltoledano eyaltoledano merged commit 70c5097 into next May 2, 2025
3 checks passed
mustafamagdy pushed a commit to mustafamagdy/task-master-ai that referenced this pull request May 24, 2025
…s-parsing

fix(update-tasks): Improve AI response parsing for 'update' command
delorenj pushed a commit to delorenj/taskmaster that referenced this pull request Jun 1, 2025
…s-parsing

fix(update-tasks): Improve AI response parsing for 'update' command
stephanschielke pushed a commit to stephanschielke/cursor-task-master that referenced this pull request Aug 22, 2025
…s-parsing

fix(update-tasks): Improve AI response parsing for 'update' command
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant