fix(cli): parse JSON --item strings in add-checklist CLI command#554
fix(cli): parse JSON --item strings in add-checklist CLI command#554zbigniewsobiecki merged 1 commit intodevfrom
Conversation
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>
|
⚙️ 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 Last updated: iteration 14 · respond-to-ci |
|
⚙️ 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 Last updated: iteration 12 · respond-to-ci |
|
✨ On it — checking the CLI checklist JSON parsing fix |
nhopeatall
left a comment
There was a problem hiding this comment.
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.
Summary
cascade-tools pm add-checklistwas passing--itemflag values as raw strings toaddChecklist(). When the Claude Code agent serialised checklist items as JSON (--item '{"name":"...","description":"..."}'), the entire JSON blob became the JIRA subtask title.parseItem()helper insrc/cli/pm/add-checklist.tsthat triesJSON.parse()on each--itemstring and, if the result is an object with anamestring property, returns aChecklistItemInputobject. All other values (invalid JSON, JSON withoutname, plain strings) pass through unchanged.Card: https://trello.com/c/699f3cbe3124db0241b61aef
Test plan
parseItemunit tests: plain strings, JSON with name+description, JSON with name only, invalid JSON, JSON withoutname, JSON arrays, JSON primitives, non-string descriptionaddChecklist(): plain strings, JSON objects, mixed items, unparseable JSON, JSON withoutnameaddChecklistgadget tests unaffected🤖 Generated with Claude Code