Skip to content

Make /define worktree-aware: write tasks to main repo#10

Merged
gering merged 2 commits into
mainfrom
task/make-define-worktree-aware
Jun 16, 2026
Merged

Make /define worktree-aware: write tasks to main repo#10
gering merged 2 commits into
mainfrom
task/make-define-worktree-aware

Conversation

@gering

@gering gering commented Jun 15, 2026

Copy link
Copy Markdown
Owner

Summary

  • /define now writes the task file to the main repo's tasks/, even when invoked from inside a linked worktree
  • Keeps the task backlog centralized and visible to /kickoff and /list, and prevents loss when /close removes the worktree
  • Patch bugfix to existing behavior — main-worktree invocation unchanged

Changes

  • define/SKILL.md: new step 1 resolves <main-repo> via git worktree list --porcelain and detects linked-worktree invocation via git rev-parse --show-toplevel; threads the absolute <main-repo>/tasks/ path through the duplicate check, write step, and confirmation output (no persistent cd); steps renumbered 1–9
  • work-system version bump 1.2.4 → 1.2.5 (plugin.json + marketplace.json)
  • work-system/README.md: documents the centralized backlog behavior

Readiness

  • ✅ README updated
  • ✅ Version bumped 1.2.4 → 1.2.5 (in sync)
  • ➖ Changelog N/A
  • ✅ No new patterns to capture
  • ✅ check-structure.py: 0 errors

Test plan

  • From a linked worktree, /define writes to <main-repo>/tasks/<name>.md
  • From the main worktree, paths are identical (no regression)
  • python3 scripts/check-structure.py stays green

🤖 Generated with Claude Code

gering and others added 2 commits June 15, 2026 22:23
When invoked from a linked worktree, /define now resolves the main
repo path and writes the task file there, so the backlog stays
centralized and survives /close removing the worktree.

- Resolve <main-repo> via `git worktree list --porcelain`; detect
  linked-worktree invocation via `git rev-parse --show-toplevel`
- Thread the absolute <main-repo>/tasks/ path through the duplicate
  check, write step, and confirmation output (no persistent cd)
- Main-worktree invocation: paths identical, behavior unchanged
- Bump work-system 1.2.4 -> 1.2.5; document centralized backlog in README

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Address code-review findings on the worktree-aware /define change:

- Add scripts/main-repo-path.sh as the canonical resolver:
  - `path` strips the porcelain prefix via parameter expansion, so it
    survives repo paths containing spaces (the inline `awk '{print $2}'`
    truncated at the first space)
  - `linked` compares --git-common-dir vs --git-dir, immune to symlinked
    paths (the prior --show-toplevel string compare could false-positive)
- Route /define step 1 through the helper instead of an inline command,
  removing a divergent copy of the worktree-resolution logic

Sibling skills (kickoff/close/adopt/list/continue) still inline their own
copy; migrating them to this helper is tracked as a separate task.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@gering

gering commented Jun 16, 2026

Copy link
Copy Markdown
Owner Author

@claude review

@gering gering merged commit 73bd3da into main Jun 16, 2026
1 check passed
@gering gering deleted the task/make-define-worktree-aware branch June 16, 2026 13:25
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.

1 participant