feature: adds timer to CLI#40
Conversation
🦋 Changeset detectedLatest commit: 3519c58 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Pull request overview
Adds Teamwork timer support to the non-interactive CLI, reusing the existing local-timer and Teamwork API layers, and refactors CLI command registration into dedicated yargs CommandModules.
Changes:
- Introduces
wtc teamwork timersubcommands (list/start/stop/submit/discard) pluswtc teamwork timesheet. - Adds a small Teamwork API helper (
getTeamworkTaskById) to resolve task names for timer start. - Refactors
runCli()to register commands via modular*-command.tsfiles; adds tests for the new timer/task behaviors.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/teamwork/task.test.ts | Adds tests for fetching a task name (including fallbacks). |
| tests/cli/commands/timers.test.ts | Adds CLI-level unit tests for timer command behaviors and output formatting. |
| src/teamwork/task.ts | Implements getTeamworkTaskById() with Zod validation and name fallback logic. |
| src/cli/parser.ts | Refactors CLI parser to register modular yargs command modules. |
| src/cli/commands/upgrade.ts | Adds dependency-injection actions for testability. |
| src/cli/commands/upgrade-command.ts | New yargs upgrade command module wrapper. |
| src/cli/commands/timers.ts | Implements timer CLI commands and shared formatting helpers. |
| src/cli/commands/teamwork-command.ts | Adds teamwork timer and teamwork timesheet subcommands under teamwork. |
| src/cli/commands/settings.ts | Adds dependency-injection actions for testability. |
| src/cli/commands/settings-command.ts | New yargs settings command module wrapper. |
| src/cli/commands/config-command.ts | New yargs config command module wrapper (init/auth subcommands). |
| src/cli/commands/cache.ts | Adds dependency-injection actions for testability. |
| src/cli/commands/cache-command.ts | New yargs cache command module wrapper. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 57 out of 68 changed files in this pull request and generated 17 comments.
Comments suppressed due to low confidence (1)
src/api/teamwork/timers/local.ts:153
submitLocalTimer()stops “the currently running timer” viastopLocalTimer()when the providedtimeris running, but it doesn’t verify that the running timer is the same timer instance (byid). If the cache ever contains multiple running timers or the caller passes a stale running timer, this can stop/submit the wrong timer.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 57 out of 68 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
src/api/teamwork/timers/local.ts:153
- When submitting a running timer, this stops whatever timer is currently running (
stopLocalTimer()), without verifying it matches thetimerargument. If local timers drift (concurrent CLI/TUI sessions, corrupted file, etc.), this can submit/remove the wrong timer entry.
Summary
Adds the timers features to the CLI version based on the TUI logic we already have in place.
Refactors the domains to a shared
api/directory so both TUI and CLI can share logic.Type of Change
Local Verification
bun run fmtbun run lintbun run checkbun testbun run buildRelease Impact
.changeset/