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.
- checksums.yaml +7 -0
- data/.ace-defaults/git/worktree.yml +250 -0
- data/.ace-defaults/nav/protocols/wfi-sources/ace-git-worktree.yml +19 -0
- data/CHANGELOG.md +957 -0
- data/LICENSE +21 -0
- data/README.md +40 -0
- data/Rakefile +14 -0
- data/docs/demo/ace-git-worktree-getting-started.gif +0 -0
- data/docs/demo/ace-git-worktree-getting-started.tape.yml +28 -0
- data/docs/demo/fixtures/README.md +3 -0
- data/docs/demo/fixtures/sample.txt +1 -0
- data/docs/getting-started.md +114 -0
- data/docs/handbook.md +38 -0
- data/docs/usage.md +334 -0
- data/exe/ace-git-worktree +24 -0
- data/handbook/agents/worktree.ag.md +189 -0
- data/handbook/skills/as-git-worktree/SKILL.md +27 -0
- data/handbook/skills/as-git-worktree-create/SKILL.md +21 -0
- data/handbook/skills/as-git-worktree-manage/SKILL.md +20 -0
- data/handbook/workflow-instructions/git/worktree-create.wf.md +262 -0
- data/handbook/workflow-instructions/git/worktree-manage.wf.md +384 -0
- data/handbook/workflow-instructions/git/worktree.wf.md +224 -0
- data/lib/ace/git/worktree/atoms/git_command.rb +121 -0
- data/lib/ace/git/worktree/atoms/path_expander.rb +189 -0
- data/lib/ace/git/worktree/atoms/slug_generator.rb +235 -0
- data/lib/ace/git/worktree/atoms/task_id_extractor.rb +91 -0
- data/lib/ace/git/worktree/cli/commands/config.rb +50 -0
- data/lib/ace/git/worktree/cli/commands/create.rb +80 -0
- data/lib/ace/git/worktree/cli/commands/list.rb +76 -0
- data/lib/ace/git/worktree/cli/commands/prune.rb +43 -0
- data/lib/ace/git/worktree/cli/commands/remove.rb +48 -0
- data/lib/ace/git/worktree/cli/commands/shared_helpers.rb +66 -0
- data/lib/ace/git/worktree/cli/commands/switch.rb +44 -0
- data/lib/ace/git/worktree/cli.rb +103 -0
- data/lib/ace/git/worktree/commands/config_command.rb +351 -0
- data/lib/ace/git/worktree/commands/create_command.rb +961 -0
- data/lib/ace/git/worktree/commands/list_command.rb +247 -0
- data/lib/ace/git/worktree/commands/prune_command.rb +260 -0
- data/lib/ace/git/worktree/commands/remove_command.rb +522 -0
- data/lib/ace/git/worktree/commands/switch_command.rb +249 -0
- data/lib/ace/git/worktree/configuration.rb +167 -0
- data/lib/ace/git/worktree/models/worktree_config.rb +502 -0
- data/lib/ace/git/worktree/models/worktree_info.rb +303 -0
- data/lib/ace/git/worktree/models/worktree_metadata.rb +294 -0
- data/lib/ace/git/worktree/molecules/config_loader.rb +125 -0
- data/lib/ace/git/worktree/molecules/current_task_linker.rb +136 -0
- data/lib/ace/git/worktree/molecules/hook_executor.rb +361 -0
- data/lib/ace/git/worktree/molecules/parent_task_resolver.rb +186 -0
- data/lib/ace/git/worktree/molecules/pr_creator.rb +253 -0
- data/lib/ace/git/worktree/molecules/task_committer.rb +329 -0
- data/lib/ace/git/worktree/molecules/task_fetcher.rb +244 -0
- data/lib/ace/git/worktree/molecules/task_pusher.rb +183 -0
- data/lib/ace/git/worktree/molecules/task_status_updater.rb +447 -0
- data/lib/ace/git/worktree/molecules/worktree_creator.rb +832 -0
- data/lib/ace/git/worktree/molecules/worktree_lister.rb +337 -0
- data/lib/ace/git/worktree/molecules/worktree_remover.rb +416 -0
- data/lib/ace/git/worktree/organisms/task_worktree_orchestrator.rb +906 -0
- data/lib/ace/git/worktree/organisms/worktree_manager.rb +714 -0
- data/lib/ace/git/worktree/version.rb +9 -0
- data/lib/ace/git/worktree.rb +215 -0
- metadata +218 -0
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
---
|
|
2
|
+
doc-type: agent
|
|
3
|
+
title: Worktree Agent
|
|
4
|
+
purpose: Documentation for ace-git-worktree/handbook/agents/worktree.ag.md
|
|
5
|
+
ace-docs:
|
|
6
|
+
last-updated: 2025-12-27
|
|
7
|
+
last-checked: 2026-03-21
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Worktree Agent
|
|
11
|
+
|
|
12
|
+
A specialized agent for managing git worktrees with task-aware automation. Handles creation, listing, switching, removal, and cleanup of worktrees integrated with ACE's task management system.
|
|
13
|
+
|
|
14
|
+
## Capabilities
|
|
15
|
+
|
|
16
|
+
### Task-Aware Operations
|
|
17
|
+
- Create worktrees for specific tasks with automatic metadata integration
|
|
18
|
+
- Fetch task information from ace-taskflow
|
|
19
|
+
- Update task status and add worktree metadata
|
|
20
|
+
- Commit task changes before worktree creation
|
|
21
|
+
|
|
22
|
+
### Traditional Worktree Operations
|
|
23
|
+
- Create worktrees for traditional branch-based development
|
|
24
|
+
- List all worktrees with filtering and formatting options
|
|
25
|
+
- Switch between worktrees using various identifiers
|
|
26
|
+
- Remove worktrees with safety checks and cleanup
|
|
27
|
+
- Prune deleted worktrees and orphaned directories
|
|
28
|
+
|
|
29
|
+
### Configuration Management
|
|
30
|
+
- Show and validate worktree configuration
|
|
31
|
+
- Display configuration file locations and settings
|
|
32
|
+
- Support for custom naming conventions and behaviors
|
|
33
|
+
|
|
34
|
+
## Usage Examples
|
|
35
|
+
|
|
36
|
+
### Task-Aware Workflow
|
|
37
|
+
```bash
|
|
38
|
+
# Create worktree for task 081
|
|
39
|
+
@worktree create --task 081
|
|
40
|
+
|
|
41
|
+
# Switch to task worktree
|
|
42
|
+
@worktree switch 081
|
|
43
|
+
|
|
44
|
+
# Remove task worktree
|
|
45
|
+
@worktree remove --task 081
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Traditional Workflow
|
|
49
|
+
```bash
|
|
50
|
+
# Create worktree for feature branch
|
|
51
|
+
@worktree create feature-branch
|
|
52
|
+
|
|
53
|
+
# List all worktrees
|
|
54
|
+
@worktree list --show-tasks
|
|
55
|
+
|
|
56
|
+
# Switch to worktree
|
|
57
|
+
@worktree switch feature-branch
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Management Operations
|
|
61
|
+
```bash
|
|
62
|
+
# List with filtering
|
|
63
|
+
@worktree list --task-associated --format json
|
|
64
|
+
|
|
65
|
+
# Clean up deleted worktrees
|
|
66
|
+
@worktree prune --cleanup-directories
|
|
67
|
+
|
|
68
|
+
# Show configuration
|
|
69
|
+
@worktree config --validate
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Configuration
|
|
73
|
+
|
|
74
|
+
The worktree agent uses configuration from `.ace/git/worktree.yml`:
|
|
75
|
+
|
|
76
|
+
```yaml
|
|
77
|
+
git:
|
|
78
|
+
worktree:
|
|
79
|
+
root_path: ".ace-wt"
|
|
80
|
+
mise_trust_auto: true
|
|
81
|
+
task:
|
|
82
|
+
directory_format: "task.{id}"
|
|
83
|
+
branch_format: "{id}-{slug}"
|
|
84
|
+
auto_mark_in_progress: true
|
|
85
|
+
auto_commit_task: true
|
|
86
|
+
add_worktree_metadata: true
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Integration Points
|
|
90
|
+
|
|
91
|
+
- **ace-taskflow**: Task metadata fetching and status updates
|
|
92
|
+
- **ace-git-commit**: Consistent commit message generation
|
|
93
|
+
- **ace-git**: Safe git command execution
|
|
94
|
+
- **ace-core**: Configuration cascade management
|
|
95
|
+
|
|
96
|
+
## Expected Parameters
|
|
97
|
+
|
|
98
|
+
The worktree agent accepts standard CLI parameters:
|
|
99
|
+
|
|
100
|
+
### create
|
|
101
|
+
- `--task <task-id>`: Create worktree for specific task
|
|
102
|
+
- `--path <path>`: Custom worktree path
|
|
103
|
+
- `--dry-run`: Preview without creating
|
|
104
|
+
- `--no-mise-trust`: Skip automatic mise trust
|
|
105
|
+
- `--no-status-update`: Skip task status update
|
|
106
|
+
- `--no-commit`: Skip committing task changes
|
|
107
|
+
|
|
108
|
+
### list
|
|
109
|
+
- `--format <format>`: Output format (table, json, simple)
|
|
110
|
+
- `--show-tasks`: Include task associations
|
|
111
|
+
- `--task-associated`: Filter by task association
|
|
112
|
+
- `--search <pattern>`: Filter by search pattern
|
|
113
|
+
|
|
114
|
+
### switch
|
|
115
|
+
- `identifier`: Worktree identifier (task ID, branch name, directory, path)
|
|
116
|
+
- `--verbose`: Show detailed information
|
|
117
|
+
|
|
118
|
+
### remove
|
|
119
|
+
- `--task <task-id>`: Remove task worktree
|
|
120
|
+
- `--force`: Force removal with uncommitted changes
|
|
121
|
+
- `--keep-directory`: Keep worktree directory
|
|
122
|
+
- `--dry-run`: Preview without removing
|
|
123
|
+
|
|
124
|
+
### prune
|
|
125
|
+
- `--cleanup-directories`: Remove orphaned directories
|
|
126
|
+
- `--dry-run`: Preview changes
|
|
127
|
+
- `--verbose`: Detailed output
|
|
128
|
+
|
|
129
|
+
### config
|
|
130
|
+
- `--show`: Show current configuration
|
|
131
|
+
- `--validate`: Validate configuration
|
|
132
|
+
- `--files`: Show configuration file locations
|
|
133
|
+
|
|
134
|
+
## Error Handling
|
|
135
|
+
|
|
136
|
+
The worktree agent handles common error conditions:
|
|
137
|
+
|
|
138
|
+
- **Task not found**: Validates task ID existence before creation
|
|
139
|
+
- **Not in git repository**: Checks git repository status
|
|
140
|
+
- **Configuration invalid**: Validates configuration before operations
|
|
141
|
+
- **Worktree conflicts**: Detects existing worktrees and provides alternatives
|
|
142
|
+
- **Permission issues**: Validates directory permissions and access
|
|
143
|
+
- **Uncommitted changes**: Warns about changes before removal
|
|
144
|
+
|
|
145
|
+
## Output Formats
|
|
146
|
+
|
|
147
|
+
### Table Format
|
|
148
|
+
Human-readable table with columns for Task, Branch, Path, and Status.
|
|
149
|
+
|
|
150
|
+
### JSON Format
|
|
151
|
+
Machine-readable JSON with complete worktree metadata for scripting and automation.
|
|
152
|
+
|
|
153
|
+
### Simple Format
|
|
154
|
+
Concise format for quick overviews and scripting.
|
|
155
|
+
|
|
156
|
+
## Response Template
|
|
157
|
+
|
|
158
|
+
**Operation:** [create/list/switch/remove/prune/config]
|
|
159
|
+
**Worktree(s):** [Worktree information]
|
|
160
|
+
**Status:** [Success/Failure with details]
|
|
161
|
+
**Location(s):** [Relevant paths]
|
|
162
|
+
**Next Steps:** [Recommended follow-up actions]
|
|
163
|
+
|
|
164
|
+
## Best Practices
|
|
165
|
+
|
|
166
|
+
1. **Use task-aware creation** for ACE workflow integration
|
|
167
|
+
2. **Validate configuration** before operations
|
|
168
|
+
3. **Use dry-run** to preview changes
|
|
169
|
+
4. **Clean up worktrees** when tasks are complete
|
|
170
|
+
5. **Prune regularly** to maintain clean repository state
|
|
171
|
+
6. **Check git status** before removing worktrees with changes
|
|
172
|
+
|
|
173
|
+
## Integration with AI Agents
|
|
174
|
+
|
|
175
|
+
The worktree agent provides deterministic output suitable for AI automation:
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
# Get worktree path for task
|
|
179
|
+
WORKTREE_PATH=$(ace-git-worktree switch 081)
|
|
180
|
+
|
|
181
|
+
# Get worktree status as JSON
|
|
182
|
+
STATUS=$(ace-git-worktree list --format json --show-tasks)
|
|
183
|
+
|
|
184
|
+
# Create worktree and verify creation
|
|
185
|
+
RESULT=$(ace-git-worktree create --task 081 --dry-run --format json)
|
|
186
|
+
if echo "$RESULT" | jq -e '.success'; then
|
|
187
|
+
echo "Worktree creation would succeed"
|
|
188
|
+
fi
|
|
189
|
+
```
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: as-git-worktree
|
|
3
|
+
description: Manage git worktrees with task-aware automation
|
|
4
|
+
# bundle: wfi://git/worktree
|
|
5
|
+
# agent: Bash
|
|
6
|
+
user-invocable: true
|
|
7
|
+
allowed-tools:
|
|
8
|
+
- Bash(ace-git-worktree:*)
|
|
9
|
+
- Bash(ace-bundle:*)
|
|
10
|
+
- Read
|
|
11
|
+
argument-hint: "[create|list|switch|remove|prune|config] [options]"
|
|
12
|
+
last_modified: 2026-01-09
|
|
13
|
+
source: ace-git-worktree
|
|
14
|
+
integration:
|
|
15
|
+
targets:
|
|
16
|
+
- claude
|
|
17
|
+
- codex
|
|
18
|
+
- gemini
|
|
19
|
+
- opencode
|
|
20
|
+
- pi
|
|
21
|
+
skill:
|
|
22
|
+
kind: workflow
|
|
23
|
+
execution:
|
|
24
|
+
workflow: wfi://git/worktree
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
Load and run `ace-bundle wfi://git/worktree` in the current project, then follow the loaded workflow as the source of truth and execute it end-to-end instead of only summarizing it.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: as-git-worktree-create
|
|
3
|
+
description: Create task-aware or branch-based git worktrees with guided automation
|
|
4
|
+
# bundle: wfi://git/worktree-create
|
|
5
|
+
# context: no-fork
|
|
6
|
+
# agent: Bash
|
|
7
|
+
user-invocable: true
|
|
8
|
+
allowed-tools:
|
|
9
|
+
- Bash(ace-git-worktree:*)
|
|
10
|
+
- Bash(ace-bundle:*)
|
|
11
|
+
- Read
|
|
12
|
+
argument-hint: [--task TASK_ID|--branch BRANCH]
|
|
13
|
+
last_modified: 2026-03-12
|
|
14
|
+
source: ace-git-worktree
|
|
15
|
+
skill:
|
|
16
|
+
kind: workflow
|
|
17
|
+
execution:
|
|
18
|
+
workflow: wfi://git/worktree-create
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
Load and run `ace-bundle wfi://git/worktree-create` in the current project, then follow the loaded workflow as the source of truth and execute it end-to-end instead of only summarizing it.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: as-git-worktree-manage
|
|
3
|
+
description: Manage existing git worktrees for listing, switching, cleanup, and removal
|
|
4
|
+
# bundle: wfi://git/worktree-manage
|
|
5
|
+
# agent: Bash
|
|
6
|
+
user-invocable: true
|
|
7
|
+
allowed-tools:
|
|
8
|
+
- Bash(ace-git-worktree:*)
|
|
9
|
+
- Bash(ace-bundle:*)
|
|
10
|
+
- Read
|
|
11
|
+
argument-hint: [list|switch|remove|prune|config]
|
|
12
|
+
last_modified: 2026-03-12
|
|
13
|
+
source: ace-git-worktree
|
|
14
|
+
skill:
|
|
15
|
+
kind: workflow
|
|
16
|
+
execution:
|
|
17
|
+
workflow: wfi://git/worktree-manage
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
Load and run `ace-bundle wfi://git/worktree-manage` in the current project, then follow the loaded workflow as the source of truth and execute it end-to-end instead of only summarizing it.
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
---
|
|
2
|
+
doc-type: workflow
|
|
3
|
+
title: Create Worktree Workflow Instruction
|
|
4
|
+
purpose: Documentation for ace-git-worktree/handbook/workflow-instructions/git/worktree-create.wf.md
|
|
5
|
+
ace-docs:
|
|
6
|
+
last-updated: 2026-02-22
|
|
7
|
+
last-checked: 2026-03-21
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Create Worktree Workflow Instruction
|
|
11
|
+
|
|
12
|
+
## Purpose
|
|
13
|
+
|
|
14
|
+
Create git worktrees with task-aware automation or traditional branch-based creation. This workflow provides isolated development environments integrated with ACE's task management system.
|
|
15
|
+
|
|
16
|
+
## Prerequisites
|
|
17
|
+
|
|
18
|
+
- Git repository initialized and accessible
|
|
19
|
+
- ace-taskflow available (for task-aware creation)
|
|
20
|
+
- Configuration available in `.ace/git/worktree.yml`
|
|
21
|
+
- Write permissions for worktree root directory
|
|
22
|
+
|
|
23
|
+
## Variables
|
|
24
|
+
|
|
25
|
+
$task_id: Task identifier (optional, for task-aware creation)
|
|
26
|
+
$branch_name: Branch name (for traditional creation)
|
|
27
|
+
$path: Custom worktree path (optional)
|
|
28
|
+
|
|
29
|
+
## Instructions
|
|
30
|
+
|
|
31
|
+
### 1. Preparation
|
|
32
|
+
|
|
33
|
+
Load and validate worktree configuration:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
# Show current configuration
|
|
37
|
+
ace-git-worktree config
|
|
38
|
+
|
|
39
|
+
# Validate configuration
|
|
40
|
+
ace-git-worktree config --validate
|
|
41
|
+
|
|
42
|
+
# Check available worktrees
|
|
43
|
+
ace-git-worktree list
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### 2. Choose Creation Method
|
|
47
|
+
|
|
48
|
+
**Task-Aware Creation (Recommended for ACE workflow):**
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
ace-git-worktree create --task <task-id>
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
**Traditional Creation (For non-task work):**
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
ace-git-worktree create <branch-name>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### 3. Execute Creation
|
|
61
|
+
|
|
62
|
+
**Task-Aware Creation:**
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
# Create worktree for task
|
|
66
|
+
ace-git-worktree create --task 081
|
|
67
|
+
|
|
68
|
+
# With dry-run to preview
|
|
69
|
+
ace-git-worktree create --task 081 --dry-run
|
|
70
|
+
|
|
71
|
+
# With custom path
|
|
72
|
+
ace-git-worktree create --task 081 --path ~/worktrees
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
**Traditional Creation:**
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
# Create worktree for branch
|
|
79
|
+
ace-git-worktree create feature-branch
|
|
80
|
+
|
|
81
|
+
# With custom path
|
|
82
|
+
ace-git-worktree create feature-branch --path ~/dev-work
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### 4. Verify Creation
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
# List all worktrees
|
|
89
|
+
ace-git-worktree list --show-tasks
|
|
90
|
+
|
|
91
|
+
# Switch to the worktree
|
|
92
|
+
cd $(ace-git-worktree switch 081)
|
|
93
|
+
# or
|
|
94
|
+
cd $(ace-git-worktree switch feature-branch)
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### 5. Work in Isolated Environment
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
# Verify you're in the correct worktree
|
|
101
|
+
git status
|
|
102
|
+
git branch
|
|
103
|
+
|
|
104
|
+
# Work on your task/feature...
|
|
105
|
+
git add .
|
|
106
|
+
git commit -m "Your commit message"
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### 6. Cleanup When Done
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
# Return to main directory
|
|
113
|
+
cd ..
|
|
114
|
+
|
|
115
|
+
# Remove worktree (optional)
|
|
116
|
+
ace-git-worktree remove --task 081
|
|
117
|
+
# or
|
|
118
|
+
ace-git-worktree remove feature-branch
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Advanced Options
|
|
122
|
+
|
|
123
|
+
### Custom Configuration
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
# Skip automatic mise trust
|
|
127
|
+
ace-git-worktree create --task 081 --no-mise-trust
|
|
128
|
+
|
|
129
|
+
# Skip task status update
|
|
130
|
+
ace-git-worktree create --task 081 --no-status-update
|
|
131
|
+
|
|
132
|
+
# Skip automatic commit
|
|
133
|
+
ace-git-worktree create --task 081 --no-commit
|
|
134
|
+
|
|
135
|
+
# Custom commit message
|
|
136
|
+
ace-git-worktree create --task 081 --commit-message "Custom message"
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Configuration Templates
|
|
140
|
+
|
|
141
|
+
Customize worktree behavior in `.ace/git/worktree.yml`:
|
|
142
|
+
|
|
143
|
+
```yaml
|
|
144
|
+
git:
|
|
145
|
+
worktree:
|
|
146
|
+
root_path: ".ace-wt"
|
|
147
|
+
mise_trust_auto: true
|
|
148
|
+
|
|
149
|
+
task:
|
|
150
|
+
directory_format: "task.{id}" # task.081
|
|
151
|
+
branch_format: "{id}-{slug}" # 081-fix-authentication-bug
|
|
152
|
+
auto_mark_in_progress: true # Mark task as in-progress
|
|
153
|
+
auto_commit_task: true # Commit task changes
|
|
154
|
+
add_worktree_metadata: true # Add metadata to task
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Template Variables
|
|
158
|
+
|
|
159
|
+
Available for directory and branch naming:
|
|
160
|
+
- `{id}` - Task numeric ID (e.g., `081`)
|
|
161
|
+
- `{task_id}` - Full task ID (e.g., `task.081`)
|
|
162
|
+
- `{slug}` - URL-safe slug from task title
|
|
163
|
+
|
|
164
|
+
## Examples
|
|
165
|
+
|
|
166
|
+
### Task-Aware Development Workflow
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
# 1. Create worktree for task 081
|
|
170
|
+
ace-git-worktree create --task 081
|
|
171
|
+
# Output: Worktree created at .ace-wt/task.081 with branch 081-fix-auth-bug
|
|
172
|
+
|
|
173
|
+
# 2. Switch to worktree
|
|
174
|
+
cd $(ace-git-worktree switch 081)
|
|
175
|
+
|
|
176
|
+
# 3. Work on task
|
|
177
|
+
git add .
|
|
178
|
+
git commit -m "Implement authentication fix"
|
|
179
|
+
|
|
180
|
+
# 4. When complete, return and cleanup
|
|
181
|
+
cd ..
|
|
182
|
+
ace-git-worktree remove --task 081
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### Feature Branch Workflow
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
# 1. Create traditional worktree
|
|
189
|
+
ace-git-worktree create feature-authentication
|
|
190
|
+
# Output: Worktree created at .ace-wt/feature-authentication
|
|
191
|
+
|
|
192
|
+
# 2. Switch to worktree
|
|
193
|
+
cd $(ace-git-worktree switch feature-authentication)
|
|
194
|
+
|
|
195
|
+
# 3. Work on feature
|
|
196
|
+
git add .
|
|
197
|
+
git commit -m "Add authentication feature"
|
|
198
|
+
|
|
199
|
+
# 4. Merge and cleanup
|
|
200
|
+
git checkout main
|
|
201
|
+
git merge feature-authentication
|
|
202
|
+
ace-git-worktree remove feature-authentication
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### Bulk Operations
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
# List all task worktrees
|
|
209
|
+
ace-git-worktree list --task-associated
|
|
210
|
+
|
|
211
|
+
# Clean up orphaned worktrees
|
|
212
|
+
ace-git-worktree prune --cleanup-directories
|
|
213
|
+
|
|
214
|
+
# Get status in JSON for scripts
|
|
215
|
+
ace-git-worktree list --format json --show-tasks
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
## Error Handling
|
|
219
|
+
|
|
220
|
+
| Error | Check | Fix |
|
|
221
|
+
|-------|-------|-----|
|
|
222
|
+
| Task not found | `ace-task show <id>` | Verify task ID exists |
|
|
223
|
+
| Not in git repo | `git status` | Run from git repository |
|
|
224
|
+
| Invalid config | `ace-git-worktree config --validate` | Fix configuration errors |
|
|
225
|
+
| Permission denied | `ls -la <worktree-root>` | Fix directory permissions |
|
|
226
|
+
| Worktree exists | `ace-git-worktree list` | Use different name or remove existing |
|
|
227
|
+
|
|
228
|
+
## Integration with AI Agents
|
|
229
|
+
|
|
230
|
+
AI agents can programmatically create and manage worktrees:
|
|
231
|
+
|
|
232
|
+
```bash
|
|
233
|
+
# Find worktree path for task
|
|
234
|
+
WORKTREE_PATH=$(ace-git-worktree switch --task 081)
|
|
235
|
+
|
|
236
|
+
# Create worktree and get details
|
|
237
|
+
RESULT=$(ace-git-worktree create --task 081 --dry-run --format json)
|
|
238
|
+
echo "$RESULT" | jq '.worktree_path'
|
|
239
|
+
|
|
240
|
+
# List worktrees with task associations
|
|
241
|
+
STATUS=$(ace-git-worktree list --format json --show-tasks)
|
|
242
|
+
echo "$STATUS" | jq '.worktrees[] | select(.task_associated == true)'
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
## Success Criteria
|
|
246
|
+
|
|
247
|
+
- Worktree created successfully with correct naming
|
|
248
|
+
- Task status updated (if task-aware creation)
|
|
249
|
+
- Worktree metadata added to task (if configured)
|
|
250
|
+
- mise configuration trusted (if present and configured)
|
|
251
|
+
- Worktree is accessible and functional
|
|
252
|
+
- Git branch created correctly
|
|
253
|
+
- All automated steps completed successfully
|
|
254
|
+
|
|
255
|
+
## Response Template
|
|
256
|
+
|
|
257
|
+
**Worktree Type:** [Task-aware/Traditional]
|
|
258
|
+
**Location:** [Worktree path]
|
|
259
|
+
**Branch:** [Branch name]
|
|
260
|
+
**Task ID:** [Task ID if applicable]
|
|
261
|
+
**Configuration:** [Key settings applied]
|
|
262
|
+
**Automation Steps:** [Completed automated actions]
|