Add subtasks (checklist items) support - #89
Conversation
Add commands for managing checklist items (steps) within tasks via the Microsoft Graph checklistItems API: - new-step: create a checklist item on a task - list-steps: display checklist items for a task - complete-step: mark a checklist item as checked - rm-step: remove a checklist item from a task - lst --steps/-s: display steps inline when listing tasks Includes ChecklistItem model, wrapper functions, CLI handlers, and 26 new unit tests (80 total). Closes kiblee#83
1efbb62 to
7c9d4da
Compare
| items = wrapper.get_checklist_items( | ||
| list_name=args.list_name, task_name=task.title |
There was a problem hiding this comment.
lst --steps fetches checklist items by task.title, so if multiple tasks share the same title it will always show steps for the first match, not the specific task being listed. Should we use task’s id when calling get_checklist_items to avoid title collisions?
There was a problem hiding this comment.
Yeah, definitely should use task ID here — title matching breaks as soon as you have duplicates. The IDs are annoyingly long so not great for humans to type manually, but I think most people would use the interactive mode anyway, and non-interactive is more for scripts.
I actually ran into this and a bunch of other issues when trying to use the CLI in automation scripts. Like no --json output, no state returned after operations (so you have to call another command and parse it just to check if anything changed), and title-based lookups everywhere. Eventually it felt like too much to fix in PRs, so I forked it, stripped out the interactive mode, and rethought the whole non-interactive flow from scratch to make it work for scripting and AI agents: https://github.com/underwear/microsoft-todo-cli
Feel free to grab any ideas from there if useful!
Summary
--steps/-sflag tolstcommand to display steps inlineNew commands
new-steptodocli new-step "list/task" "step text"list-stepstodocli list-steps "list/task"complete-steptodocli complete-step "list/task" "step or index"rm-steptodocli rm-step "list/task" "step or index"The
lstcommand now accepts-s/--stepsto show steps inline:All commands support the
-l/--listflag for explicit list specification.Changes
todocli/models/checklistitem.py(new) —ChecklistItemdata model with flexible datetime parsing for the checklistItems API formattodocli/graphapi/wrapper.py— addStepNotFoundByName/StepNotFoundByIndexexceptions and 5 new API functions (get_checklist_items,create_checklist_item,complete_checklist_item,delete_checklist_item,get_step_id)todocli/cli.py— add 4 handler functions, 4 subparsers,--stepsflag onlst, and exception handlerstodocli/help_msg.py/README.md— document new commandstests/test_checklist_*.py(3 new files) — 26 new unit tests for model, wrapper, and CLI parsingTest plan
black --checkpasses on all filesnew-step,list-steps,complete-step(by name and index),rm-step— all verified against live APIlst "list" -s— displays steps inline with[x]/[ ]statusCloses #83
Co-Authored-By: Claude Opus 4.5 noreply@anthropic.com