ace-git-worktree 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. checksums.yaml +7 -0
  2. data/.ace-defaults/git/worktree.yml +250 -0
  3. data/.ace-defaults/nav/protocols/wfi-sources/ace-git-worktree.yml +19 -0
  4. data/CHANGELOG.md +957 -0
  5. data/LICENSE +21 -0
  6. data/README.md +40 -0
  7. data/Rakefile +14 -0
  8. data/docs/demo/ace-git-worktree-getting-started.gif +0 -0
  9. data/docs/demo/ace-git-worktree-getting-started.tape.yml +28 -0
  10. data/docs/demo/fixtures/README.md +3 -0
  11. data/docs/demo/fixtures/sample.txt +1 -0
  12. data/docs/getting-started.md +114 -0
  13. data/docs/handbook.md +38 -0
  14. data/docs/usage.md +334 -0
  15. data/exe/ace-git-worktree +24 -0
  16. data/handbook/agents/worktree.ag.md +189 -0
  17. data/handbook/skills/as-git-worktree/SKILL.md +27 -0
  18. data/handbook/skills/as-git-worktree-create/SKILL.md +21 -0
  19. data/handbook/skills/as-git-worktree-manage/SKILL.md +20 -0
  20. data/handbook/workflow-instructions/git/worktree-create.wf.md +262 -0
  21. data/handbook/workflow-instructions/git/worktree-manage.wf.md +384 -0
  22. data/handbook/workflow-instructions/git/worktree.wf.md +224 -0
  23. data/lib/ace/git/worktree/atoms/git_command.rb +121 -0
  24. data/lib/ace/git/worktree/atoms/path_expander.rb +189 -0
  25. data/lib/ace/git/worktree/atoms/slug_generator.rb +235 -0
  26. data/lib/ace/git/worktree/atoms/task_id_extractor.rb +91 -0
  27. data/lib/ace/git/worktree/cli/commands/config.rb +50 -0
  28. data/lib/ace/git/worktree/cli/commands/create.rb +80 -0
  29. data/lib/ace/git/worktree/cli/commands/list.rb +76 -0
  30. data/lib/ace/git/worktree/cli/commands/prune.rb +43 -0
  31. data/lib/ace/git/worktree/cli/commands/remove.rb +48 -0
  32. data/lib/ace/git/worktree/cli/commands/shared_helpers.rb +66 -0
  33. data/lib/ace/git/worktree/cli/commands/switch.rb +44 -0
  34. data/lib/ace/git/worktree/cli.rb +103 -0
  35. data/lib/ace/git/worktree/commands/config_command.rb +351 -0
  36. data/lib/ace/git/worktree/commands/create_command.rb +961 -0
  37. data/lib/ace/git/worktree/commands/list_command.rb +247 -0
  38. data/lib/ace/git/worktree/commands/prune_command.rb +260 -0
  39. data/lib/ace/git/worktree/commands/remove_command.rb +522 -0
  40. data/lib/ace/git/worktree/commands/switch_command.rb +249 -0
  41. data/lib/ace/git/worktree/configuration.rb +167 -0
  42. data/lib/ace/git/worktree/models/worktree_config.rb +502 -0
  43. data/lib/ace/git/worktree/models/worktree_info.rb +303 -0
  44. data/lib/ace/git/worktree/models/worktree_metadata.rb +294 -0
  45. data/lib/ace/git/worktree/molecules/config_loader.rb +125 -0
  46. data/lib/ace/git/worktree/molecules/current_task_linker.rb +136 -0
  47. data/lib/ace/git/worktree/molecules/hook_executor.rb +361 -0
  48. data/lib/ace/git/worktree/molecules/parent_task_resolver.rb +186 -0
  49. data/lib/ace/git/worktree/molecules/pr_creator.rb +253 -0
  50. data/lib/ace/git/worktree/molecules/task_committer.rb +329 -0
  51. data/lib/ace/git/worktree/molecules/task_fetcher.rb +244 -0
  52. data/lib/ace/git/worktree/molecules/task_pusher.rb +183 -0
  53. data/lib/ace/git/worktree/molecules/task_status_updater.rb +447 -0
  54. data/lib/ace/git/worktree/molecules/worktree_creator.rb +832 -0
  55. data/lib/ace/git/worktree/molecules/worktree_lister.rb +337 -0
  56. data/lib/ace/git/worktree/molecules/worktree_remover.rb +416 -0
  57. data/lib/ace/git/worktree/organisms/task_worktree_orchestrator.rb +906 -0
  58. data/lib/ace/git/worktree/organisms/worktree_manager.rb +714 -0
  59. data/lib/ace/git/worktree/version.rb +9 -0
  60. data/lib/ace/git/worktree.rb +215 -0
  61. metadata +218 -0
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 ACE Development Team
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,40 @@
1
+ <div align="center">
2
+ <h1> ACE - Git Worktree </h1>
3
+
4
+ Task-aware git worktree management for isolated environments in one command.
5
+
6
+ <img src="https://raw.githubusercontent.com/cs3b/ace/main/docs/brand/AgenticCodingEnvironment.Logo.XS.jpg" alt="ACE Logo" width="480">
7
+ <br><br>
8
+
9
+ <a href="https://rubygems.org/gems/ace-git-worktree"><img alt="Gem Version" src="https://img.shields.io/gem/v/ace-git-worktree.svg" /></a>
10
+ <a href="https://www.ruby-lang.org"><img alt="Ruby" src="https://img.shields.io/badge/Ruby-3.2+-CC342D?logo=ruby" /></a>
11
+ <a href="https://opensource.org/licenses/MIT"><img alt="License: MIT" src="https://img.shields.io/badge/License-MIT-blue.svg" /></a>
12
+
13
+ </div>
14
+
15
+ > Works with: Claude Code, Codex CLI, OpenCode, Gemini CLI, pi-agent, and more.
16
+
17
+ [Getting Started](docs/getting-started.md) | [Usage Guide](docs/usage.md) | [Handbook - Skills, Agents, Templates](docs/handbook.md)
18
+
19
+ ![ace-git-worktree demo](docs/demo/ace-git-worktree-getting-started.gif)
20
+
21
+ `ace-git-worktree` gives each task, PR, or branch its own workspace so you can move faster without carrying local state between changes. It handles naming, post-create hooks (commands run after worktree creation), cleanup, and navigation with configurable conventions across the team.
22
+
23
+ ## How It Works
24
+
25
+ 1. Create an isolated worktree from a task ID, PR number, or branch name with one command.
26
+ 2. Work inside the worktree with task metadata and status kept in sync automatically.
27
+ 3. Clean up stale worktrees when done, with path resolution for seamless `cd` navigation.
28
+
29
+ ## Use Cases
30
+
31
+ **Start task work in an isolated environment** - run [`ace-git-worktree`](docs/usage.md) with a task ID to create a linked worktree, update task status, and set up the branch. Use the `as-git-worktree-create` agent workflow for guided setup.
32
+
33
+ **Review pull requests in dedicated directories** - create a worktree from a PR number instead of switching branches in your main checkout, keeping review work cleanly separated.
34
+
35
+ **Manage worktree lifecycle across a team** - use the `as-git-worktree-manage` workflow with configurable naming, hooks, upstream push, and draft-PR automation to standardize workflows across the team.
36
+
37
+ **Orchestrate parallel task work with ace-overseer** - pair with [ace-overseer](../ace-overseer) to spin up worktrees per task, drive agents in parallel, and prune finished worktrees automatically.
38
+
39
+ ---
40
+ [Getting Started](docs/getting-started.md) | [Usage Guide](docs/usage.md) | [Handbook - Skills, Agents, Templates](docs/handbook.md) | Part of [ACE](https://github.com/cs3b/ace)
data/Rakefile ADDED
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "minitest/test_task"
5
+
6
+ desc "Run tests using ace-test"
7
+ task :test do
8
+ sh "ace-test"
9
+ end
10
+
11
+ desc "Run tests directly (CI mode)"
12
+ Minitest::TestTask.create(:ci)
13
+
14
+ task default: :test
@@ -0,0 +1,28 @@
1
+ ---
2
+ description: Preview task-aware worktree creation and listing
3
+ tags:
4
+ - docs
5
+ - worktree
6
+ settings:
7
+ font_size: 16
8
+ width: 960
9
+ height: 480
10
+ format: gif
11
+ setup:
12
+ - sandbox
13
+ - git-init
14
+ - copy-fixtures
15
+ - run: git add -A && git commit -qm "initial commit"
16
+ scenes:
17
+ - name: Create a worktree from a branch
18
+ commands:
19
+ - type: ace-git-worktree create feature/demo
20
+ sleep: 4s
21
+ - name: List worktrees
22
+ commands:
23
+ - type: clear
24
+ sleep: 1s
25
+ - type: ace-git-worktree list
26
+ sleep: 3s
27
+ teardown:
28
+ - cleanup
@@ -0,0 +1,3 @@
1
+ # Demo fixtures for ace-git-worktree
2
+
3
+ Seed data used by YAML demo setup.
@@ -0,0 +1 @@
1
+ sample fixture content
@@ -0,0 +1,114 @@
1
+ ---
2
+ doc-type: user
3
+ title: ace-git-worktree Getting Started
4
+ purpose: Tutorial for first-run ace-git-worktree workflows
5
+ ace-docs:
6
+ last-updated: 2026-03-22
7
+ last-checked: 2026-03-22
8
+ ---
9
+
10
+ # Getting Started with ace-git-worktree
11
+
12
+ This walkthrough shows the core `ace-git-worktree` loop: create an isolated task workspace, jump into it, inspect what
13
+ exists, and clean it up when the work is done.
14
+
15
+ ## Prerequisites
16
+
17
+ * Ruby 3.2+
18
+ * Git 2.0+ or any modern Git with `git worktree` support
19
+ * `ace-git-worktree` installed
20
+ * Optional: `ace-task` for task metadata and status updates
21
+ * Optional: `mise` when your projects use `mise.toml` files that should be trusted automatically
22
+ * Optional: GitHub CLI (`gh`) for PR-based worktrees
23
+
24
+ ## Installation
25
+
26
+ ```bash
27
+ gem install ace-git-worktree
28
+ ```
29
+
30
+ ## 1. Create Your First Task Worktree
31
+
32
+ Start with a task-aware worktree:
33
+
34
+ ```bash
35
+ ace-git-worktree create --task 081
36
+ ```
37
+
38
+ This creates a separate worktree directory, derives a branch name from the task, and can update task metadata based on
39
+ your current worktree configuration.
40
+
41
+ ## 2. Switch Into the Worktree
42
+
43
+ Resolve the path and enter it:
44
+
45
+ ```bash
46
+ cd "$(ace-git-worktree switch 081)"
47
+ ```
48
+
49
+ This keeps your shell history simple while avoiding hard-coded worktree paths.
50
+
51
+ ## 3. Inspect Active Worktrees
52
+
53
+ List worktrees with task context when you want a quick overview:
54
+
55
+ ```bash
56
+ ace-git-worktree list --show-tasks
57
+ ```
58
+
59
+ Use `--search auth` or `--format json` later when you want filtering or machine-readable output.
60
+
61
+ ## 4. Create a PR Worktree
62
+
63
+ Open a pull request in its own workspace:
64
+
65
+ ```bash
66
+ ace-git-worktree create --pr 26
67
+ ```
68
+
69
+ This is useful for review work, branch comparisons, or patching an existing PR without touching your current checkout.
70
+
71
+ ## 5. Clean Up When You Finish
72
+
73
+ Remove the task worktree:
74
+
75
+ ```bash
76
+ ace-git-worktree remove --task 081
77
+ ```
78
+
79
+ Use `ace-git-worktree prune --dry-run` first when you want to preview stale-reference cleanup.
80
+
81
+ ## Configuration Basics
82
+
83
+ Project overrides live in `.ace/git/worktree.yml`. User overrides live in `~/.ace/git/worktree.yml`. Start small:
84
+
85
+ ```yaml
86
+ git:
87
+ worktree:
88
+ root_path: ".ace-wt"
89
+ task:
90
+ directory_format: "task.{task_id}"
91
+ branch_format: "{id}-{slug}"
92
+ cleanup:
93
+ on_delete: true
94
+ ```
95
+
96
+ Add hooks, auto-push, tmux launch, or PR automation only after the basic create/switch/remove loop feels right.
97
+
98
+ ## Common Commands
99
+
100
+ | Goal | Command |
101
+ |------|---------|
102
+ | Create a task worktree | `ace-git-worktree create --task 081` |
103
+ | Create a PR worktree | `ace-git-worktree create --pr 26` |
104
+ | Switch into a worktree | `cd "$(ace-git-worktree switch 081)"` |
105
+ | List worktrees with task info | `ace-git-worktree list --show-tasks` |
106
+ | Remove a task worktree | `ace-git-worktree remove --task 081` |
107
+ | Preview stale cleanup | `ace-git-worktree prune --dry-run` |
108
+
109
+ ## Next Steps
110
+
111
+ * Run `ace-git-worktree config --files` to see which config files are active
112
+ * Add `hooks.after_create` commands to trust `mise` or bootstrap dependencies
113
+ * Use `ace-git-worktree create --from origin/feature/name` for branch-based work
114
+ * Run `ace-git-worktree --help` to browse subcommand examples
data/docs/handbook.md ADDED
@@ -0,0 +1,38 @@
1
+ ---
2
+ doc-type: user
3
+ title: ace-git-worktree Handbook Catalog
4
+ purpose: Catalog of ace-git-worktree workflows, skills, and agents
5
+ ace-docs:
6
+ last-updated: 2026-03-22
7
+ last-checked: 2026-03-22
8
+ ---
9
+
10
+ # ace-git-worktree Handbook Catalog
11
+
12
+ Reference for package-owned handbook resources in `ace-git-worktree/handbook/`.
13
+
14
+ ## Skills
15
+
16
+ | Skill | What it does |
17
+ |-------|--------------|
18
+ | `as-git-worktree` | Run the top-level task-aware worktree workflow |
19
+ | `as-git-worktree-create` | Create task-aware, PR-aware, or branch-based worktrees |
20
+ | `as-git-worktree-manage` | List, switch, prune, and remove existing worktrees |
21
+
22
+ ## Workflow Instructions
23
+
24
+ | Protocol Path | Purpose | Invoked by |
25
+ |---------------|---------|------------|
26
+ | `wfi://git/worktree` | Load the main worktree workflow entry point | `as-git-worktree` |
27
+ | `wfi://git/worktree-create` | Guide task-aware or branch-based creation flows | `as-git-worktree-create` |
28
+ | `wfi://git/worktree-manage` | Guide list, switch, remove, prune, and config flows | `as-git-worktree-manage` |
29
+
30
+ ## Agents
31
+
32
+ * `handbook/agents/worktree.ag.md` for focused worktree command execution
33
+
34
+ ## Related Docs
35
+
36
+ * [Getting Started](getting-started.md)
37
+ * [CLI Usage Reference](usage.md)
38
+ * Load workflows directly with `ace-bundle`, for example `ace-bundle wfi://git/worktree`
data/docs/usage.md ADDED
@@ -0,0 +1,334 @@
1
+ ---
2
+ doc-type: user
3
+ title: ace-git-worktree CLI Usage Reference
4
+ purpose: Command reference for ace-git-worktree
5
+ ace-docs:
6
+ last-updated: 2026-03-22
7
+ last-checked: 2026-03-22
8
+ ---
9
+
10
+ # ace-git-worktree CLI Usage Reference
11
+
12
+ Reference for `ace-git-worktree` commands, options, and configuration.
13
+
14
+ ## Installation
15
+
16
+ ```bash
17
+ gem install ace-git-worktree
18
+ ```
19
+
20
+ ## Command Overview
21
+
22
+ `ace-git-worktree` ships six commands:
23
+
24
+ * `create` for task-aware, PR-aware, and branch-based worktree creation
25
+ * `list` for active worktree inventory and filtering
26
+ * `switch` for resolving a worktree path you can `cd` into
27
+ * `remove` for safe worktree removal
28
+ * `prune` for stale-reference cleanup
29
+ * `config` for configuration inspection and validation
30
+
31
+ Run `ace-git-worktree --help` for the top-level summary and examples.
32
+
33
+ ## Quick Start (5 Minutes)
34
+
35
+ Create a task worktree, list active worktrees, and resolve the path for shell navigation:
36
+
37
+ ```bash
38
+ ace-git-worktree create --task 081
39
+ ace-git-worktree list --show-tasks
40
+ ace-git-worktree switch 081
41
+ ```
42
+
43
+ **Expected output:**
44
+
45
+ ```text
46
+ Created worktree for task 081
47
+ ... task-associated worktree appears in list output ...
48
+ /path/to/project/.ace-wt/task.081
49
+ ```
50
+
51
+ Success looks like a new worktree directory exists and `switch` returns a path you can `cd` into.
52
+
53
+ ## Common Scenarios
54
+
55
+ ### Scenario 1: Start Isolated Work on a Task
56
+
57
+ **Goal:** Create a task-specific workspace without touching your current checkout.
58
+
59
+ **Commands:**
60
+
61
+ ```bash
62
+ ace-git-worktree create --task 081
63
+ ace-git-worktree list --show-tasks
64
+ ```
65
+
66
+ **Expected output:**
67
+
68
+ ```text
69
+ Created task worktree and branch for 081
70
+ ... task.081 appears in the worktree list ...
71
+ ```
72
+
73
+ **Next steps:** Run `cd "$(ace-git-worktree switch 081)"` to move into the new worktree.
74
+
75
+ ### Scenario 2: Review a Pull Request in Its Own Worktree
76
+
77
+ **Goal:** Create a dedicated workspace for PR review or patching.
78
+
79
+ **Commands:**
80
+
81
+ ```bash
82
+ ace-git-worktree create --pr 26
83
+ ace-git-worktree list
84
+ ```
85
+
86
+ **Expected output:**
87
+
88
+ ```text
89
+ Created PR worktree for #26
90
+ ... ace-pr-26 appears in the worktree list ...
91
+ ```
92
+
93
+ **Next steps:** Enter the PR worktree or remove it later with `ace-git-worktree remove pr-26`.
94
+
95
+ ### Scenario 3: Clean Up Stale Worktrees Safely
96
+
97
+ **Goal:** See what cleanup would do before removing anything.
98
+
99
+ **Commands:**
100
+
101
+ ```bash
102
+ ace-git-worktree prune --dry-run
103
+ ace-git-worktree remove --task 081 --dry-run
104
+ ```
105
+
106
+ **Expected output:**
107
+
108
+ ```text
109
+ Would prune stale references
110
+ Would remove task.081
111
+ ```
112
+
113
+ **Next steps:** Re-run either command without `--dry-run` once the preview looks correct.
114
+
115
+ ## Commands
116
+
117
+ ### `ace-git-worktree create [BRANCH]`
118
+
119
+ Create a new worktree from a task, PR, explicit branch, or positional branch argument.
120
+
121
+ ```bash
122
+ ace-git-worktree create --task 081
123
+ ace-git-worktree create --pr 123
124
+ ace-git-worktree create --from origin/feature/auth
125
+ ace-git-worktree create feature/new-auth
126
+ ace-git-worktree create --task 081 --dry-run
127
+ ```
128
+
129
+ **Options:**
130
+
131
+ * `--task` - Task ID for a task-aware worktree
132
+ * `--pr`, `--pull-request` - PR number for a PR-aware worktree
133
+ * `--from`, `-b` - Create from a specific local or remote branch
134
+ * `--path` - Override the destination worktree path
135
+ * `--source` - Override the git ref used as the start point
136
+ * `--dry-run` - Show what would be created
137
+ * `--no-status-update` - Skip marking the task in progress
138
+ * `--no-commit` - Skip committing task metadata changes
139
+ * `--no-push` - Skip pushing task changes
140
+ * `--no-upstream` - Skip pushing the new branch with upstream tracking
141
+ * `--no-pr` - Skip automatic draft-PR creation when enabled
142
+ * `--push-remote` - Override the remote used for task-related pushes
143
+ * `--no-auto-navigate` - Stay in the current directory after creation
144
+ * `--commit-message` - Use a custom commit message for task metadata updates
145
+ * `--target-branch` - Override the PR target branch
146
+ * `--force` - Create even when the worktree already exists
147
+ * `-q`, `--quiet` - Suppress non-essential output
148
+ * `-v`, `--verbose` - Show verbose output
149
+ * `-d`, `--debug` - Show debug output
150
+
151
+ ### `ace-git-worktree list`
152
+
153
+ List active worktrees with optional task metadata and filters.
154
+
155
+ ```bash
156
+ ace-git-worktree list
157
+ ace-git-worktree list --show-tasks
158
+ ace-git-worktree list --format json
159
+ ace-git-worktree list --search auth
160
+ ```
161
+
162
+ **Options:**
163
+
164
+ * `--format` - Output format: `table`, `json`, or `simple`
165
+ * `--show-tasks` - Include task associations
166
+ * `--task-associated` - Show only task-associated worktrees
167
+ * `--usable` - Show only usable worktrees
168
+ * `--search` - Filter by branch-name pattern
169
+ * `-q`, `--quiet` - Suppress non-essential output
170
+ * `-v`, `--verbose` - Show verbose output
171
+ * `-d`, `--debug` - Show debug output
172
+
173
+ ### `ace-git-worktree switch [IDENTIFIER]`
174
+
175
+ Resolve a worktree path for shell navigation.
176
+
177
+ ```bash
178
+ ace-git-worktree switch 081
179
+ ace-git-worktree switch feature-branch
180
+ ace-git-worktree switch --list
181
+ ```
182
+
183
+ `IDENTIFIER` can be a task ID, branch name, directory name, or explicit path.
184
+
185
+ **Options:**
186
+
187
+ * `--list`, `-l` - List available worktrees instead of returning one path
188
+ * `-q`, `--quiet` - Suppress non-essential output
189
+ * `-v`, `--verbose` - Show verbose output
190
+ * `-d`, `--debug` - Show debug output
191
+
192
+ ### `ace-git-worktree remove [IDENTIFIER]`
193
+
194
+ Remove a worktree by task, branch, directory, or path.
195
+
196
+ ```bash
197
+ ace-git-worktree remove --task 081
198
+ ace-git-worktree remove feature-branch
199
+ ace-git-worktree remove --task 081 --force
200
+ ace-git-worktree remove --task 081 --dry-run
201
+ ```
202
+
203
+ **Options:**
204
+
205
+ * `--task` - Remove the worktree for a specific task
206
+ * `--force` - Remove even with uncommitted changes
207
+ * `--keep-directory` - Keep the worktree directory after removal
208
+ * `--delete-branch`, `-D` - Also delete the associated branch
209
+ * `--dry-run` - Show what would be removed
210
+ * `-q`, `--quiet` - Suppress non-essential output
211
+ * `-v`, `--verbose` - Show verbose output
212
+ * `-d`, `--debug` - Show debug output
213
+
214
+ ### `ace-git-worktree prune`
215
+
216
+ Prune deleted worktrees from git metadata and optionally remove orphaned directories.
217
+
218
+ ```bash
219
+ ace-git-worktree prune
220
+ ace-git-worktree prune --dry-run
221
+ ace-git-worktree prune --cleanup-directories
222
+ ```
223
+
224
+ **Options:**
225
+
226
+ * `--dry-run` - Preview what would be pruned
227
+ * `--cleanup-directories` - Remove orphaned worktree directories
228
+ * `--force` - Force cleanup
229
+ * `-q`, `--quiet` - Suppress non-essential output
230
+ * `-v`, `--verbose` - Show verbose output
231
+ * `-d`, `--debug` - Show debug output
232
+
233
+ ### `ace-git-worktree config [SUBCOMMAND]`
234
+
235
+ Show current configuration, validate it, or list the config files in play.
236
+
237
+ ```bash
238
+ ace-git-worktree config
239
+ ace-git-worktree config --show
240
+ ace-git-worktree config --validate
241
+ ace-git-worktree config --files
242
+ ace-git-worktree config validate
243
+ ```
244
+
245
+ **Options:**
246
+
247
+ * `--show` - Show current configuration
248
+ * `--validate` - Validate configuration
249
+ * `--files` - Show configuration file locations
250
+ * `-q`, `--quiet` - Suppress non-essential output
251
+ * `-v`, `--verbose` - Show verbose output
252
+ * `-d`, `--debug` - Show debug output
253
+
254
+ ## Configuration
255
+
256
+ `ace-git-worktree` uses the ACE configuration cascade:
257
+
258
+ * Project config: `.ace/git/worktree.yml`
259
+ * User config: `~/.ace/git/worktree.yml`
260
+ * Package defaults: `ace-git-worktree/.ace-defaults/git/worktree.yml`
261
+
262
+ ### Common Settings
263
+
264
+ ```yaml
265
+ git:
266
+ worktree:
267
+ root_path: ".ace-wt"
268
+ auto_navigate: true
269
+ tmux: false
270
+ task:
271
+ directory_format: "task.{task_id}"
272
+ branch_format: "{id}-{slug}"
273
+ auto_mark_in_progress: true
274
+ auto_commit_task: true
275
+ auto_push_task: true
276
+ auto_setup_upstream: false
277
+ auto_create_pr: false
278
+ pr:
279
+ directory_format: "ace-pr-{number}"
280
+ branch_format: "pr-{number}-{slug}"
281
+ fetch_before_create: true
282
+ cleanup:
283
+ on_delete: true
284
+ ```
285
+
286
+ The defaults file also documents timeout controls, hook execution, current-task symlink creation, push remotes, and PR
287
+ title formatting.
288
+
289
+ ## Troubleshooting
290
+
291
+ ### Problem: `create --task` cannot find the task
292
+
293
+ **Symptom:** The command reports that the task does not exist.
294
+
295
+ **Solution:**
296
+
297
+ ```bash
298
+ ace-task show 081
299
+ ```
300
+
301
+ Use a task reference that exists in the current repository, or run the command from the project root where the ACE task
302
+ data is available.
303
+
304
+ ### Problem: PR worktree creation fails
305
+
306
+ **Symptom:** `create --pr` reports a GitHub or authentication error.
307
+
308
+ **Solution:**
309
+
310
+ ```bash
311
+ gh auth status
312
+ gh auth login
313
+ ```
314
+
315
+ PR-based creation depends on `gh` being installed and authenticated.
316
+
317
+ ### Problem: `switch` returns nothing useful
318
+
319
+ **Symptom:** The identifier does not resolve to a worktree path.
320
+
321
+ **Solution:**
322
+
323
+ ```bash
324
+ ace-git-worktree list --show-tasks
325
+ ```
326
+
327
+ Confirm the identifier matches a task ID, branch name, directory name, or path shown in the current worktree list.
328
+
329
+ ## Related Tools
330
+
331
+ * [ace-task](../ace-task) for task metadata and status updates
332
+ * [ace-git](../ace-git) for repository and PR context
333
+ * [ace-git-commit](../ace-git-commit) for commits inside worktrees
334
+ * [ace-bundle](../ace-bundle) for loading worktree workflow instructions directly
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ # Add lib directory to load path
5
+ $LOAD_PATH.unshift File.expand_path("../lib", __dir__)
6
+
7
+ # Load the ace-git-worktree gem
8
+ require "ace/git/worktree"
9
+ require "ace/support/cli"
10
+
11
+ args = ARGV.empty? ? ["--help"] : ARGV
12
+
13
+ # Start ace-support-cli with exception-based exit code handling (per ADR-023)
14
+ begin
15
+ exit(Ace::Git::Worktree::CLI.start(args))
16
+ rescue SystemExit => e
17
+ exit(e.status)
18
+ rescue Ace::Support::Cli::Error => e
19
+ warn e.message
20
+ exit(e.exit_code)
21
+ rescue Ace::Support::Cli::CommandNotFoundError => e
22
+ warn "unknown command: #{e.message}"
23
+ exit(1)
24
+ end