Checklist Item Add/Update/Position/Delete Commands#233
Conversation
Remove unused stdoutSpy variables in delete-checklist and delete-checklist-item tests. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…t-item Add tests for: first-item down (midpoint between 2 items below), skip-fetch optimisation with raw IDs, and invalid --pos error handling in both commands. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
mheap
left a comment
There was a problem hiding this comment.
Changes Requested
1. Duplicated parsePos method
Both add-checklist-item.ts:35-39 and update-checklist-item.ts:117-122 have identical parsePos implementations. Extract this to BaseCommand to follow DRY.
2. Duplicated item resolution logic
delete-checklist-item.ts:31-55 reimplements checklist + item resolution inline instead of reusing resolveChecklistId from BaseCommand. The item resolution could also be a shared helper.
3. computeRelativePos edge case - floating point precision
The midpoint calculation ((a + b) / 2) can lose precision after repeated moves. Consider using a wider gap (e.g., halving the distance to the far neighbor) or inserting with a fixed buffer.
Suggestions (non-blocking)
4. Missing --state flag on update-checklist-item
The Trello API supports state (complete/incomplete) on updateCardCheckItem, but the command doesn't expose it. Worth considering for a follow-up.
5. Heavy use of as any casts
BaseCommand.ts:207-210, add-checklist-item.ts:24, update-checklist-item.ts:48 all use as any[] or as any to bypass type checking. Reduces the value of TypeScript.
Positives
- Test coverage is thorough — happy paths, error cases, edge cases, optimization paths, and relative positioning logic are all well tested.
- Commands follow existing repo conventions (oclif patterns, flag naming, output shape).
- The
resolveChecklistIdoptimization to skip API calls when a raw 24-char hex ID is passed is a nice touch. - Changeset is properly formatted.
- Error messages are clear and actionable.
Add checklist item commands
Add checklist item CRUD commands:
card:add-checklist-item,card:delete-checklist-item,card:update-checklist-item,card:delete-checklist. IncludesresolveChecklistIdhelper onBaseCommand.Commands added
card:delete-checklist— delete a checklist from a card by namecard:add-checklist-item— add an item to a checklistcard:delete-checklist-item— delete an item from a checklist by namecard:update-checklist-item— rename or reposition a checklist item (supportstop,bottom,up,down, or a numeric position)Changes
BaseCommand— newresolveChecklistIdhelper used by the new checklistcommands
src/commands/card/Test plan
pnpm build && pnpm test— 327 unit tests pass across all packages