Skip to content

fix(cli): parse JSON --item strings in add-checklist CLI command#554

Merged
zbigniewsobiecki merged 1 commit intodevfrom
fix/cli-add-checklist-json-parsing
Feb 25, 2026
Merged

fix(cli): parse JSON --item strings in add-checklist CLI command#554
zbigniewsobiecki merged 1 commit intodevfrom
fix/cli-add-checklist-json-parsing

Conversation

@aaight
Copy link
Copy Markdown
Collaborator

@aaight aaight commented Feb 25, 2026

Summary

  • Root cause: cascade-tools pm add-checklist was passing --item flag values as raw strings to addChecklist(). When the Claude Code agent serialised checklist items as JSON (--item '{"name":"...","description":"..."}'), the entire JSON blob became the JIRA subtask title.
  • Fix: Added a parseItem() helper in src/cli/pm/add-checklist.ts that tries JSON.parse() on each --item string and, if the result is an object with a name string property, returns a ChecklistItemInput object. All other values (invalid JSON, JSON without name, plain strings) pass through unchanged.
  • Scope: Only affects the Claude Code backend path (CLI-based tool invocation). The llmist backend uses the gadget directly and is unaffected.

Card: https://trello.com/c/699f3cbe3124db0241b61aef

Test plan

  • parseItem unit tests: plain strings, JSON with name+description, JSON with name only, invalid JSON, JSON without name, JSON arrays, JSON primitives, non-string description
  • Integration tests via addChecklist(): plain strings, JSON objects, mixed items, unparseable JSON, JSON without name
  • All 17 new tests pass
  • Existing addChecklist gadget tests unaffected
  • Lint and typecheck pass

🤖 Generated with Claude Code

When the Claude Code backend passes checklist items as JSON objects
(e.g. --item '{"name":"...","description":"..."}'), the raw JSON string
was being used as the JIRA subtask title instead of the name field.

Add a parseItem() helper that tries JSON.parse on each --item value and
returns a ChecklistItemInput object when the result has a string `name`
property. Plain strings and unrecognised JSON fall back to the raw string,
preserving full backward compatibility.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@aaight
Copy link
Copy Markdown
Collaborator Author

aaight commented Feb 25, 2026

⚙️ On it — checking the CI failures for PR 554


Progress: [██░░░░░░░░] 20% (iteration 14/70)

🔧 CI Fix Update (1 min)

I've identified that the CI failure is not due to the PR's code changes but a transient npm ci error (403 from npm registry). I've re-run the failed CI job and confirmed the working tree is clean. I'm now locally verifying that all CI steps pass to ensure the fix is complete.

Last updated: iteration 14 · respond-to-ci

@aaight
Copy link
Copy Markdown
Collaborator Author

aaight commented Feb 25, 2026

⚙️ On it — checking the CI failures for PR 554


Progress: [██░░░░░░░░] 17% (iteration 12/70)

🔧 CI Fix Update (1 min)

I've started by investigating the CI failure for work item 699f3cbe3124db0241b61aef. I've identified that the failure is due to a transient npm ci issue, specifically a 403 Forbidden error from the npm registry for the adm-zip package, which is unrelated to the code changes in the PR. I'm currently verifying other CI checks to ensure there are no other underlying issues.

Last updated: iteration 12 · respond-to-ci

@nhopeatall
Copy link
Copy Markdown
Collaborator

✨ On it — checking the CLI checklist JSON parsing fix

Copy link
Copy Markdown
Collaborator

@nhopeatall nhopeatall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — clean, well-scoped fix. The parseItem() helper correctly parses JSON --item strings into ChecklistItemInput objects while preserving backward compatibility for plain strings. The type-narrowing logic is sound (null check, typeof === 'object', \!Array.isArray, typeof name === 'string'), and the fallback on JSON.parse failure is appropriate. Test coverage is thorough with both unit and integration tests. All CI checks pass.

@zbigniewsobiecki zbigniewsobiecki merged commit 079472f into dev Feb 25, 2026
14 of 16 checks passed
@zbigniewsobiecki zbigniewsobiecki deleted the fix/cli-add-checklist-json-parsing branch March 16, 2026 16:43
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.

3 participants