Skip to content

fix(cli): infer tasks for custom worktree paths and honor raw fallback fields#24

Merged
dev-pi2pie merged 7 commits intomainfrom
dev
Feb 21, 2026
Merged

fix(cli): infer tasks for custom worktree paths and honor raw fallback fields#24
dev-pi2pie merged 7 commits intomainfrom
dev

Conversation

@dev-pi2pie
Copy link
Copy Markdown
Member

Closes #23

Problem

gwtt list <task> -o raw could incorrectly fall back to the main worktree when the worktree path did not follow <repo>_<task> (for example, .claude/worktrees/<task>).
Root cause: classic-mode task matching relied only on TaskFromPath, so custom path layouts produced task "-" and no row match.

What Changed

  • Added deriveClassicTask in cli/common.go:
    • First tries path-based extraction (TaskFromPath).
    • Falls back to branch-based task inference (SlugifyTask(branch)) for non-main, non-detached worktrees.
    • Avoids inferring a task for the main worktree.
  • Updated classic-mode task resolution in:
    • cli/list.go
    • cli/status.go
  • Fixed raw fallback output in list to respect --field:
    • path -> main worktree path
    • branch -> fallback branch
    • task -> -
  • Added/expanded tests:
    • Unit tests for deriveClassicTask in cli/common_test.go
    • Integration coverage for custom path inference and raw fallback field behavior in cli/integration_test.go
  • Updated docs:
    • README.md
    • docs/schemas/config-gwtt.md
    • Related plan/research/job docs for traceability

Verification

  • go test ./... -count=1
  • Added integration assertions for:
    • list and status task lookup with custom worktree paths
    • list -o raw fallback behavior with different --field values

Notes

  • --branch remains the explicit/authoritative branch filter.
  • Classic-mode task lookup is now path-first, then branch-backed fallback for eligible rows.

@dev-pi2pie dev-pi2pie self-assigned this Feb 21, 2026
@dev-pi2pie dev-pi2pie merged commit 3058080 into main Feb 21, 2026
2 checks passed
@dev-pi2pie dev-pi2pie deleted the dev branch February 21, 2026 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

list <task> -o raw falls back to main worktree when worktree path doesn't match <repo>_<task> (e.g. .claude/worktrees/*)

1 participant