feat: lenient CLI ergonomics (raw IDs, implicit view, flag aliases)#60
feat: lenient CLI ergonomics (raw IDs, implicit view, flag aliases)#60
Conversation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…rkspace) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
This PR significantly enhances CLI ergonomics by introducing lenient ID handling, implicit view subcommands, and named flag aliases, leading to a more intuitive and efficient user experience. While these changes are a great step forward in improving usability, there are a few areas that could be refined to ensure consistent behavior, specifically regarding error handling for non-existent raw IDs, the proper resolution of section names containing digits, and the organization of certain unit tests.
…eLabelRef Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…-project provided Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR improves td CLI ergonomics by making references more forgiving (raw IDs), making view the default subcommand for several resources, and adding named flag aliases for positional “context” arguments.
Changes:
- Add
lenientIdRef()and update ref resolution to accept raw ID-like strings (and retry raw IDs as direct lookups). - Make
viewthe default subcommand for project/task/workspace/comment/notification commands. - Add named flag aliases (
--project,--task,--workspace) alongside positional context args, with conflict detection; update docs and tests accordingly.
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/lib/skills/content.ts | Updates CLI examples to reflect new flag-alias ergonomics. |
| src/lib/refs.ts | Introduces lenientIdRef() and raw-ID retry behavior in resolveRef(). |
| src/commands/workspace.ts | Makes view default and adds --workspace alias for projects/users. |
| src/commands/task.ts | Uses lenientIdRef() and improves --section handling; sets view default. |
| src/commands/section.ts | Replaces strict ID parsing with lenientIdRef() and adds --project alias. |
| src/commands/reminder.ts | Replaces strict ID parsing with lenientIdRef() and adds --task alias. |
| src/commands/project.ts | Makes view the default subcommand. |
| src/commands/notification.ts | Makes view the default subcommand. |
| src/commands/label.ts | Refactors label update/delete to use shared resolver; adds raw-ID-like lookup. |
| src/commands/comment.ts | Uses lenientIdRef() and makes view default. |
| src/tests/workspace.test.ts | Adds coverage for implicit view and --workspace alias behavior. |
| src/tests/task.test.ts | Adds coverage for implicit view and updated --section semantics. |
| src/tests/section.test.ts | Adds coverage for --project alias and updated ref validation wording. |
| src/tests/reminder.test.ts | Adds coverage for --task alias and updated ref validation wording. |
| src/tests/refs.test.ts | Updates tests for lenientIdRef() and raw-ID retry behavior. |
| src/tests/project.test.ts | Adds coverage for implicit view behavior. |
| src/tests/notification.test.ts | Adds coverage for implicit view behavior. |
| src/tests/label.test.ts | Adjusts expectations after label resolver refactor. |
| src/tests/comment.test.ts | Adds coverage for implicit view and updated ref validation wording. |
| docs/decisions/001-lenient-cli-ergonomics.md | Adds ADR documenting the ergonomics decisions and tradeoffs. |
| AGENTS.md | Documents new ref parsing, implicit view defaults, and flag aliases for agents/devs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…thers Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
| td section update id:123 --name "Done" | ||
| td section delete id:123 --yes |
There was a problem hiding this comment.
Just highlighting this as an example, given what this PR is for, should we have something to show that it can be done without the id: in here.
Comment applies to all affected commands.
There was a problem hiding this comment.
The way I see it is, the skill is focused in showing how things can be done. Not necessarily in showing ALL the ways that are supported. The id: prefix is preferred for the edge case in which a task name looks like an ID (unlikely, but still).
Summary
Three backward-compatible ergonomic improvements to reduce CLI friction for both humans and AI agents:
6QwcgwGW2H73WrVJ) everywhere without requiringid:prefix.requireIdRef()removed entirely, replaced bylenientIdRef().resolveRef()auto-retries raw-ID-looking strings as direct lookups before failing.td project <ref>defaults totd project view <ref>via Commander's{ isDefault: true }. Applied to project, task, workspace, comment, notification.--project(section list),--task(reminder list/add),--workspace(workspace projects/users). Error if both positional and flag are provided.Also adds first ADR at
docs/decisions/001-lenient-cli-ergonomics.md.Smoke tests (live account)
project view <raw-id>project <raw-id>viewneeded)workspace <numeric-id>task <raw-id>--projectsection list --project "<name>"--workspaceworkspace projects --workspace <name> --limit 3Test plan
id:prefix usage still works (backward compatible)