Skip to content

feat(workspace): add td workspace use <ref> to persist a default workspace#294

Merged
scottlovegrove merged 2 commits intomainfrom
scottl/workspace-use
Apr 23, 2026
Merged

feat(workspace): add td workspace use <ref> to persist a default workspace#294
scottlovegrove merged 2 commits intomainfrom
scottl/workspace-use

Conversation

@scottlovegrove
Copy link
Copy Markdown
Collaborator

Summary

  • Adds td workspace use <ref> to store a default workspace id under workspace.defaultWorkspace in the user config, and td workspace use --clear to remove it.
  • When a workspace ref is omitted from td workspace view/update/delete/projects/users/user-tasks/activity/insights and td folder list/create, the command falls back to the stored default. resolveWorkspaceRef absorbs the fallback behind its existing signature, widened to string | undefined.
  • Commands where "no workspace" has distinct semantics (td template create, td project move --to-workspace, td project archived-count --workspace) are deliberately unchanged.
  • td config view now shows the configured default under a Workspace section, and td doctor's validator understands the new nested config block.

Test plan

  • npm run type-check
  • npm test (7 new tests cover: set, id: refs, --clear, --clear no-op, default fallback, explicit ref overrides default, WORKSPACE_REQUIRED error when neither is set)
  • npm run check (oxlint + oxfmt)
  • npm run sync:skill — committed regenerated skills/todoist-cli/SKILL.md
  • Manual smoke: td workspace use "My WS"td workspace projects (uses default) → td workspace use --clear

🤖 Generated with Claude Code

…rkspace

Workspace commands that take a ref fall back to `workspace.defaultWorkspace`
in the config when none is passed, so users working primarily in one
workspace don't have to name it on every invocation. `--clear` removes
the stored default. Covers all workspace subcommands plus `folder list`
and `folder create`; commands where "no workspace" has distinct semantics
(template create, project move, project archived-count) are left alone.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@doistbot doistbot requested a review from rmartins90 April 23, 2026 21:12
@scottlovegrove scottlovegrove self-assigned this Apr 23, 2026
@scottlovegrove scottlovegrove added the 👀 Show PR PR must be reviewed before or after merging label Apr 23, 2026
Copy link
Copy Markdown
Member

@doistbot doistbot left a comment

Choose a reason for hiding this comment

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

This PR introduces the ability to set and clear a default workspace via td workspace use, seamlessly integrating it as a fallback for workspace and folder commands while updating configuration tools. The implementation thoughtfully handles the fallback for most commands and preserves explicit "no workspace" semantics where needed, which will make the CLI experience much smoother for users. A few minor adjustments are noted regarding the command validation logic, specifically around handling conflicting arguments, ensuring custom error messages aren't masked by early exits, and deduplicating the configuration lookup for folder commands.

Share FeedbackReview Logs

Comment thread src/commands/workspace/index.ts Outdated
Comment thread src/commands/workspace/use.ts
Comment thread src/commands/folder/helpers.ts Outdated
- Drop the `useCmd.help()` short-circuit so the handler's CliError (with
  actionable hints) is what surfaces when the user runs `td workspace use`
  with no args.
- Error explicitly when a ref is passed together with `--clear` instead of
  silently ignoring the ref.
- Export `readDefaultWorkspaceRef` from refs.ts and reuse it in the folder
  helper rather than re-reading/normalising the config inline.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@scottlovegrove scottlovegrove merged commit 579a4c8 into main Apr 23, 2026
4 checks passed
@scottlovegrove scottlovegrove deleted the scottl/workspace-use branch April 23, 2026 21:20
doist-release-bot Bot added a commit that referenced this pull request Apr 23, 2026
## [1.57.0](v1.56.1...v1.57.0) (2026-04-23)

### Features

* **workspace:** add `td workspace use <ref>` to persist a default workspace ([#294](#294)) ([579a4c8](579a4c8))
@doist-release-bot
Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 1.57.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Copy link
Copy Markdown
Contributor

@rmartins90 rmartins90 left a comment

Choose a reason for hiding this comment

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

🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released 👀 Show PR PR must be reviewed before or after merging

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants