Skip to content

feature: adds timer to CLI#40

Merged
marlonmarcello merged 7 commits into
mainfrom
feature/teamwork/timers-cli
Jun 25, 2026
Merged

feature: adds timer to CLI#40
marlonmarcello merged 7 commits into
mainfrom
feature/teamwork/timers-cli

Conversation

@marlonmarcello

@marlonmarcello marlonmarcello commented Jun 25, 2026

Copy link
Copy Markdown
Member

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

  • Feature
  • Bug fix
  • Refactor
  • Documentation
  • Tooling / CI / release

Local Verification

  • bun run fmt
  • bun run lint
  • bun run check
  • bun test
  • bun run build

Release Impact

  • No release impact
  • Changeset added in .changeset/
  • Updates CLI behavior
  • Updates install/update behavior
  • Updates build/release packaging
  • Breaking change

@marlonmarcello marlonmarcello requested a review from Copilot June 25, 2026 01:10
@marlonmarcello marlonmarcello requested a review from a team as a code owner June 25, 2026 01:10
@changeset-bot

changeset-bot Bot commented Jun 25, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 3519c58

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
wtc Patch

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 timer subcommands (list/start/stop/submit/discard) plus wtc teamwork timesheet.
  • Adds a small Teamwork API helper (getTeamworkTaskById) to resolve task names for timer start.
  • Refactors runCli() to register commands via modular *-command.ts files; 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.

Comment thread src/cli/commands/upgrade-command.ts
Comment thread src/cli/commands/timers.ts
Comment thread tests/cli/commands/timers.test.ts Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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” via stopLocalTimer() when the provided timer is running, but it doesn’t verify that the running timer is the same timer instance (by id). If the cache ever contains multiple running timers or the caller passes a stale running timer, this can stop/submit the wrong timer.

Comment thread src/cli/commands/teamwork-command.ts Outdated
Comment thread src/cli/commands/teamwork-command.ts Outdated
Comment thread src/cli/commands/teamwork-command.ts Outdated
Comment thread src/cli/commands/teamwork-command.ts Outdated
Comment thread src/cli/commands/teamwork-command.ts Outdated
Comment thread src/cli/commands/config-command.ts Outdated
Comment thread src/cli/commands/config-command.ts Outdated
Comment thread src/cli/commands/settings-command.ts Outdated
Comment thread src/cli/commands/cache-command.ts Outdated
Comment thread src/cli/commands/upgrade-command.ts Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 the timer argument. If local timers drift (concurrent CLI/TUI sessions, corrupted file, etc.), this can submit/remove the wrong timer entry.

Comment thread .changeset/salty-seals-wonder.md
@marlonmarcello marlonmarcello merged commit 15519b7 into main Jun 25, 2026
6 checks passed
@marlonmarcello marlonmarcello deleted the feature/teamwork/timers-cli branch June 25, 2026 21:48
@github-actions github-actions Bot mentioned this pull request Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants