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
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: a2f1810626e76250d2106f5561d908f325334100bb5f35d08a477ab5edfaa104
4
+ data.tar.gz: 001c87228d14339e3b9817d18d443451d12a6d2eaa4759a586fc09cf155fda72
5
+ SHA512:
6
+ metadata.gz: a0b04c12cf8b99c609a1d70653f69ca3cfbd16d7d26ad74b7990a20b69a8be706324efa55d2615507587e5f2142645b9f8f1077e342218534f36e12e25cb19a2
7
+ data.tar.gz: cde7c5e87510e8a2239c16baf02142455d7d857aec1976eed93d8f1d8ad0c3b86f0b1ea502ce5aa32946bafb32a1eb8fd41af1d116f60e11c47da87173c5ccf3
@@ -0,0 +1,250 @@
1
+ # ace-git-worktree configuration
2
+ #
3
+ # This file provides default configuration for task-aware git worktree management.
4
+ # Copy this file to .ace/git/worktree.yml and customize as needed.
5
+ #
6
+ # Configuration is loaded in this priority (highest to lowest):
7
+ # 1. .ace/git/worktree.yml (project-specific)
8
+ # 2. ~/.ace/git/worktree.yml (user-specific)
9
+ # 3. .ace-defaults/git/worktree.yml (these defaults)
10
+
11
+ git:
12
+ worktree:
13
+ # Root directory for all worktrees (relative to project root)
14
+ # This is where worktree directories will be created
15
+ root_path: ".ace-wt"
16
+
17
+ # Timeout settings (in seconds)
18
+ # These control timeout for various git and shell operations
19
+ timeouts:
20
+ default: 30 # Default timeout for general git operations
21
+ max: 300 # Maximum allowed timeout for any operation
22
+ hook: 30 # Timeout for after_create hook commands
23
+ list: 30 # Timeout for worktree list operations
24
+ commit: 30 # Timeout for git commit operations
25
+ remove: 30 # Timeout for worktree removal operations
26
+
27
+ # Automatically navigate to worktree after creation
28
+ # If true, provides enhanced navigation experience after worktree creation
29
+ auto_navigate: true
30
+
31
+ # Launch tmux session after worktree creation
32
+ # Requires ace-tmux to be installed. When enabled, replaces "cd ..." hint
33
+ # with automatic tmux session launch rooted at the new worktree.
34
+ # Values: true | false
35
+ tmux: false
36
+
37
+ # Task-based naming and behavior configuration
38
+ task:
39
+ # Directory naming format for task worktrees
40
+ # Available variables: {id}, {task_id}, {slug}
41
+ # Examples:
42
+ # "t.{task_id}" -> t.081
43
+ # "{id}" -> 081
44
+ # "{task_id}" -> t.081
45
+ directory_format: "t.{task_id}"
46
+
47
+ # Branch naming format for task worktrees
48
+ # Available variables: {id}, {task_id}, {slug}
49
+ # Examples:
50
+ # "{id}-{slug}" -> 081-fix-authentication-bug
51
+ # "task-{id}-{slug}" -> task-081-fix-authentication-bug
52
+ branch_format: "{id}-{slug}"
53
+
54
+ # Automatically mark tasks as in-progress when creating worktrees
55
+ # If true, updates task status to "in-progress" via ace-task
56
+ auto_mark_in_progress: true
57
+
58
+ # Automatically commit task changes before creating worktree
59
+ # If true, commits task status and metadata changes to main branch
60
+ auto_commit_task: true
61
+
62
+ # Commit message format for task updates
63
+ # Available variables: {id}, {task_id}, {slug}
64
+ commit_message_format: "chore({task_id}): mark as in-progress, creating worktree for {slug}"
65
+
66
+ # Add worktree metadata to task frontmatter
67
+ # If true, adds worktree info (branch, path, created_at) to task file
68
+ add_worktree_metadata: true
69
+
70
+ # Automatically push task changes after commit
71
+ # If true, pushes commits to remote after task status updates
72
+ auto_push_task: true
73
+
74
+ # Remote name for pushing task changes
75
+ push_remote: "origin"
76
+
77
+ # Automatically push new branch to remote with upstream tracking
78
+ # If true, runs 'git push -u origin <branch>' after worktree creation
79
+ # NOTE: Defaults to false - enable explicitly for automated workflows
80
+ auto_setup_upstream: false
81
+
82
+ # Automatically create draft PR after pushing branch
83
+ # If true, creates a draft PR via 'gh pr create --draft'
84
+ # Requires: gh CLI installed and authenticated
85
+ # NOTE: Defaults to false - enable explicitly for automated workflows
86
+ auto_create_pr: false
87
+
88
+ # PR title format when auto-creating PRs
89
+ # Available variables: {id}, {task_id}, {slug}
90
+ pr_title_format: "{id} - {slug}"
91
+
92
+ # Create _current symlink inside worktree pointing to task directory
93
+ # When you cd into the worktree, enables quick access: cat _current/*.s.md, ls _current/
94
+ # Symlink is created at worktree root (e.g., .ace-wt/t.145/_current)
95
+ # Uses relative paths for portability
96
+ create_current_symlink: true
97
+
98
+ # Name of the current task symlink
99
+ # Default: "_current"
100
+ current_symlink_name: "_current"
101
+
102
+ # Pull Request-based naming and behavior configuration
103
+ pr:
104
+ # Directory naming format for PR worktrees
105
+ # Available variables: {number}, {slug}, {title_slug}, {base_branch}
106
+ # Examples:
107
+ # "ace-pr-{number}" -> ace-pr-26
108
+ # "pr-{number}" -> pr-26
109
+ # "{number}-{slug}" -> 26-create-ace-git-package
110
+ directory_format: "ace-pr-{number}"
111
+
112
+ # Branch naming format for PR worktrees
113
+ # Available variables: {number}, {slug}, {title_slug}, {base_branch}
114
+ # Examples:
115
+ # "pr-{number}" -> pr-26
116
+ # "pr-{number}-{slug}" -> pr-26-create-ace-git-package
117
+ # "{number}/{slug}" -> 26/create-ace-git-package
118
+ # "pr-{number}-{base_branch}-{slug}" -> pr-26-main-create-ace-git-package
119
+ branch_format: "pr-{number}-{slug}"
120
+
121
+ # Remote name to use for fetching PR branches
122
+ remote_name: "origin"
123
+
124
+ # Fetch latest PR information before creating worktree
125
+ # If true, runs 'git fetch {remote_name} {pr_branch}' before worktree creation
126
+ fetch_before_create: true
127
+
128
+ # Branch-based naming and behavior configuration
129
+ branch:
130
+ # Fetch branch from remote if it exists locally
131
+ # If true, attempts to fetch from remote before creating local worktree
132
+ fetch_if_remote: true
133
+
134
+ # Automatically detect remote name
135
+ # If true, searches for remotes that contain the target branch
136
+ auto_detect_remote: true
137
+
138
+ # Cleanup policies for worktree management
139
+ cleanup:
140
+ # Automatically remove worktrees when their branches are merged
141
+ # If true, worktrees are cleaned up after branch merge
142
+ on_merge: false
143
+
144
+ # Automatically remove worktrees when their branches are deleted
145
+ # If true, worktrees are cleaned up after branch deletion
146
+ on_delete: true
147
+
148
+ # Hooks: Commands to run at specific lifecycle points
149
+ # Commands execute sequentially from the PROJECT ROOT by default
150
+ # Available variables: {worktree_path}, {task_id}, {task_title}, {worktree_dir}
151
+ # Environment variables: ACE_PROJECT_ROOT, ACE_WORKTREE_PATH, ACE_TASK_ID, ACE_TASK_TITLE
152
+ hooks:
153
+ # after_create: Commands to run after worktree creation
154
+ # Hook configuration:
155
+ # command: Shell command to execute (required)
156
+ # working_dir: Directory to run in (default: project root)
157
+ # - "." or empty: project root (default)
158
+ # - "worktree": the worktree directory
159
+ # - relative path: relative to project root
160
+ # - absolute path: as specified
161
+ # timeout: Maximum execution time in seconds (default: 30, max: 300)
162
+ # continue_on_error: Continue if this hook fails (default: false)
163
+ # env: Additional environment variables (key-value pairs)
164
+ after_create:
165
+ # Example 1: Trust all mise configuration files in the worktree
166
+ - command: "find {worktree_path} -maxdepth 1 -name 'mise*.toml' -exec mise trust {} \\;"
167
+ timeout: 30
168
+ continue_on_error: true
169
+
170
+ # Example 2: Same using environment variable
171
+ # - command: "find $ACE_WORKTREE_PATH -maxdepth 1 -name 'mise*.toml' -exec mise trust {} \\;"
172
+ # timeout: 30
173
+ # continue_on_error: true
174
+
175
+ # Example 3: Run command IN the worktree directory
176
+ # - command: "bundle install --quiet"
177
+ # working_dir: "worktree"
178
+ # timeout: 120
179
+ # continue_on_error: true
180
+
181
+ # Example 4: Run custom setup script from project root
182
+ # - command: "[ -f .ace/git/worktree/hooks/setup.sh ] && bash .ace/git/worktree/hooks/setup.sh || true"
183
+ # timeout: 60
184
+ # continue_on_error: false
185
+
186
+ # Example 5: With custom environment and variable interpolation
187
+ # - command: "echo 'Setup complete for task {task_id} at {worktree_path}'"
188
+ # env:
189
+ # CUSTOM_VAR: "value"
190
+ # continue_on_error: true
191
+
192
+ # Additional configuration examples:
193
+
194
+ # Example 1: Custom directory structure
195
+ # git:
196
+ # worktree:
197
+ # root_path: "~/worktrees"
198
+ # task:
199
+ # directory_format: "work/{task_id}"
200
+ # branch_format: "work/{id}-{slug}"
201
+
202
+ # Example 2: Minimal automation
203
+ # git:
204
+ # worktree:
205
+ # root_path: ".worktrees"
206
+ # task:
207
+ # auto_mark_in_progress: false
208
+ # auto_commit_task: false
209
+ # add_worktree_metadata: true
210
+ # hooks:
211
+ # after_create: [] # No hooks
212
+
213
+ # Example 3: Development-focused setup
214
+ # git:
215
+ # worktree:
216
+ # root_path: ".dev"
217
+ # task:
218
+ # directory_format: "{id}-dev"
219
+ # branch_format: "dev/{id}-{slug}"
220
+ # auto_mark_in_progress: true
221
+ # auto_commit_task: true
222
+ # add_worktree_metadata: true
223
+ # hooks:
224
+ # after_create:
225
+ # - command: "mise trust mise*.toml"
226
+ # - command: "bundle install --quiet"
227
+
228
+ # Example 4: Full automation with upstream push and PR creation
229
+ # Enables complete worktree-to-PR workflow in one command
230
+ # git:
231
+ # worktree:
232
+ # task:
233
+ # auto_mark_in_progress: true
234
+ # auto_commit_task: true
235
+ # auto_push_task: true
236
+ # auto_setup_upstream: true # Push branch with -u flag
237
+ # auto_create_pr: true # Create draft PR automatically
238
+ # pr_title_format: "{id} - {slug}"
239
+
240
+ # Template Variable Reference:
241
+ # {id} -> Numeric task ID (e.g., 081)
242
+ # {task_id} -> Full task ID (e.g., t.081)
243
+ # {slug} -> URL-safe slug from title (e.g., fix-authentication-bug)
244
+ # {number} -> PR number (e.g., 26)
245
+ # {title_slug}-> Alternative slug variable (same as {slug})
246
+ # {base_branch}-> PR base branch (e.g., main, develop)
247
+
248
+ # For more information, see:
249
+ # - ace-git-worktree create --help
250
+ # - ace-git-worktree config --help
@@ -0,0 +1,19 @@
1
+ ---
2
+ # WFI Sources Protocol Configuration for ace-git-worktree gem
3
+ # This enables workflow discovery from the installed ace-git-worktree gem
4
+
5
+ name: ace-git-worktree
6
+ type: gem
7
+ description: Git worktree workflow instructions from ace-git-worktree gem
8
+ priority: 10
9
+
10
+ # Configuration for workflow discovery within the gem
11
+ config:
12
+ # Relative path within the gem (default: handbook/workflow-instructions)
13
+ relative_path: handbook/workflow-instructions
14
+
15
+ # Pattern for finding workflow files (default: *.wf.md)
16
+ pattern: "*.wf.md"
17
+
18
+ # Enable discovery
19
+ enabled: true