zcf 3.1.3 → 3.1.4
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.
- package/README.md +2 -3
- package/dist/chunks/simple-config.mjs +230 -42
- package/dist/cli.mjs +74 -19
- package/dist/i18n/locales/en/cli.json +2 -0
- package/dist/i18n/locales/en/errors.json +1 -0
- package/dist/i18n/locales/zh-CN/cli.json +2 -0
- package/dist/i18n/locales/zh-CN/errors.json +1 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/package.json +1 -1
- package/templates/codex/en/workflow/git/prompts/git-cleanBranches.md +102 -0
- package/templates/codex/en/workflow/git/prompts/git-commit.md +157 -0
- package/templates/codex/en/workflow/git/prompts/git-rollback.md +90 -0
- package/templates/codex/en/workflow/git/prompts/git-worktree.md +276 -0
- package/templates/codex/en/workflow/sixStep/prompts/workflow.md +140 -121
- package/templates/codex/zh-CN/workflow/git/prompts/git-cleanBranches.md +102 -0
- package/templates/codex/zh-CN/workflow/git/prompts/git-commit.md +157 -0
- package/templates/codex/zh-CN/workflow/git/prompts/git-rollback.md +90 -0
- package/templates/codex/zh-CN/workflow/git/prompts/git-worktree.md +276 -0
- package/templates/codex/zh-CN/workflow/sixStep/prompts/workflow.md +16 -33
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Manage Git worktrees in project-level ../.zcf/project-name/ directory with smart defaults, IDE integration and content migration
|
|
3
|
+
allowed-tools: Read(**), Exec(git worktree add, git worktree list, git worktree remove, git worktree prune, git branch, git checkout, git rev-parse, git stash, git cp, detect-ide, open-ide, which, command, basename, dirname)
|
|
4
|
+
argument-hint: <add|list|remove|prune|migrate> [path] [-b <branch>] [-o|--open] [--track] [--guess-remote] [--detach] [--checkout] [--lock] [--migrate-from <source-path>] [--migrate-stash]
|
|
5
|
+
# examples:
|
|
6
|
+
# - /git-worktree add feature-ui # create new branch 'feature-ui' from main/master
|
|
7
|
+
# - /git-worktree add feature-ui -o # create worktree and open directly in IDE
|
|
8
|
+
# - /git-worktree add hotfix -b fix/login -o # create new branch 'fix/login' with path 'hotfix'
|
|
9
|
+
# - /git-worktree migrate feature-ui --from main # migrate uncommitted content from main to feature-ui
|
|
10
|
+
# - /git-worktree migrate feature-ui --stash # migrate current stash to feature-ui
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Claude Command: Git Worktree
|
|
14
|
+
|
|
15
|
+
Manage Git worktrees with smart defaults, IDE integration and content migration in structured `../.zcf/project-name/` paths.
|
|
16
|
+
|
|
17
|
+
Execute commands directly and provide concise results.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
# Basic operations
|
|
25
|
+
/git-worktree add <path> # create new branch named <path> from main/master
|
|
26
|
+
/git-worktree add <path> -b <branch> # create new branch with specified name
|
|
27
|
+
/git-worktree add <path> -o # create and open directly in IDE
|
|
28
|
+
/git-worktree list # show all worktree status
|
|
29
|
+
/git-worktree remove <path> # remove specified worktree
|
|
30
|
+
/git-worktree prune # clean invalid worktree references
|
|
31
|
+
|
|
32
|
+
# Content migration
|
|
33
|
+
/git-worktree migrate <target> --from <source> # migrate uncommitted content
|
|
34
|
+
/git-worktree migrate <target> --stash # migrate stash content
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Options
|
|
38
|
+
|
|
39
|
+
| Option | Description |
|
|
40
|
+
| ------------------ | ------------------------------------------------------ |
|
|
41
|
+
| `add [<path>]` | Add new worktree in `../.zcf/project-name/<path>` |
|
|
42
|
+
| `migrate <target>` | Migrate content to specified worktree |
|
|
43
|
+
| `list` | List all worktrees and their status |
|
|
44
|
+
| `remove <path>` | Remove worktree at specified path |
|
|
45
|
+
| `prune` | Clean invalid worktree references |
|
|
46
|
+
| `-b <branch>` | Create new branch and checkout to worktree |
|
|
47
|
+
| `-o, --open` | Open directly in IDE after creation (skip prompt) |
|
|
48
|
+
| `--from <source>` | Specify migration source path (migrate only) |
|
|
49
|
+
| `--stash` | Migrate current stash content (migrate only) |
|
|
50
|
+
| `--track` | Set new branch to track corresponding remote branch |
|
|
51
|
+
| `--guess-remote` | Auto guess remote branch for tracking |
|
|
52
|
+
| `--detach` | Create detached HEAD worktree |
|
|
53
|
+
| `--checkout` | Checkout immediately after creation (default behavior) |
|
|
54
|
+
| `--lock` | Lock worktree after creation |
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## What This Command Does
|
|
59
|
+
|
|
60
|
+
1. **Environment Check**
|
|
61
|
+
- Verify Git repository using `git rev-parse --is-inside-work-tree`
|
|
62
|
+
- Detect whether in main repo or existing worktree for smart path calculation
|
|
63
|
+
|
|
64
|
+
2. **Smart Path Management**
|
|
65
|
+
- Auto-calculate project name from main repository path using worktree detection
|
|
66
|
+
- Create worktrees in structured `../.zcf/project-name/<path>` directory
|
|
67
|
+
- Handle both main repo and worktree execution contexts correctly
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
# Core path calculation logic for worktree detection
|
|
71
|
+
get_main_repo_path() {
|
|
72
|
+
local git_common_dir=$(git rev-parse --git-common-dir 2>/dev/null)
|
|
73
|
+
local current_toplevel=$(git rev-parse --show-toplevel 2>/dev/null)
|
|
74
|
+
|
|
75
|
+
# Check if in worktree
|
|
76
|
+
if [[ "$git_common_dir" != "$current_toplevel/.git" ]]; then
|
|
77
|
+
# In worktree, derive main repo path from git-common-dir
|
|
78
|
+
dirname "$git_common_dir"
|
|
79
|
+
else
|
|
80
|
+
# In main repository
|
|
81
|
+
echo "$current_toplevel"
|
|
82
|
+
fi
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
MAIN_REPO_PATH=$(get_main_repo_path)
|
|
86
|
+
PROJECT_NAME=$(basename "$MAIN_REPO_PATH")
|
|
87
|
+
WORKTREE_BASE="$MAIN_REPO_PATH/../.zcf/$PROJECT_NAME"
|
|
88
|
+
|
|
89
|
+
# Always use absolute path to prevent nesting issues
|
|
90
|
+
ABSOLUTE_WORKTREE_PATH="$WORKTREE_BASE/<path>"
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
**Critical Fix**: Always use absolute paths when creating worktrees from within existing worktrees to prevent path nesting issues like `../.zcf/project/.zcf/project/path`.
|
|
94
|
+
|
|
95
|
+
3. **Worktree Operations**
|
|
96
|
+
- **add**: Create new worktree with smart branch/path defaults
|
|
97
|
+
- **list**: Display all worktrees with branches and status
|
|
98
|
+
- **remove**: Safely remove worktree and clean references
|
|
99
|
+
- **prune**: Clean orphaned worktree records
|
|
100
|
+
|
|
101
|
+
4. **Smart Defaults**
|
|
102
|
+
- **Branch creation**: When no `-b` specified, create new branch using path name
|
|
103
|
+
- **Base branch**: New branches created from main/master branch
|
|
104
|
+
- **Path resolution**: Use branch name as path when unspecified
|
|
105
|
+
- **IDE integration**: Auto-detect and prompt for IDE opening
|
|
106
|
+
|
|
107
|
+
5. **Content Migration**
|
|
108
|
+
- Migrate uncommitted changes between worktrees
|
|
109
|
+
- Apply stash content to target worktree
|
|
110
|
+
- Safety checks to prevent conflicts
|
|
111
|
+
|
|
112
|
+
6. **Safety Features**
|
|
113
|
+
- **Path conflict prevention**: Check for existing directories before creation
|
|
114
|
+
- **Branch checkout validation**: Ensure branches aren't already in use
|
|
115
|
+
- **Absolute path enforcement**: Prevent nested `.zcf` directories when in worktree
|
|
116
|
+
- **Auto-cleanup on removal**: Clean both directory and git references
|
|
117
|
+
- **Clear status reporting**: Display worktree locations and branch status
|
|
118
|
+
|
|
119
|
+
7. **Environment File Handling**
|
|
120
|
+
- **Auto-detection**: Scan `.gitignore` for environment variable file patterns
|
|
121
|
+
- **Smart copying**: Copy `.env` and `.env.*` files that are listed in `.gitignore`
|
|
122
|
+
- **Exclusion logic**: Skip `.env.example` and other template files
|
|
123
|
+
- **Permission preservation**: Maintain original file permissions and timestamps
|
|
124
|
+
- **User feedback**: Provide clear status on copied environment files
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
# Environment file copying implementation
|
|
128
|
+
copy_environment_files() {
|
|
129
|
+
local main_repo="$MAIN_REPO_PATH"
|
|
130
|
+
local target_worktree="$ABSOLUTE_WORKTREE_PATH"
|
|
131
|
+
local gitignore_file="$main_repo/.gitignore"
|
|
132
|
+
|
|
133
|
+
# Check if .gitignore exists
|
|
134
|
+
if [[ ! -f "$gitignore_file" ]]; then
|
|
135
|
+
return 0
|
|
136
|
+
fi
|
|
137
|
+
|
|
138
|
+
local copied_count=0
|
|
139
|
+
|
|
140
|
+
# Detect .env file
|
|
141
|
+
if [[ -f "$main_repo/.env" ]] && grep -q "^\.env$" "$gitignore_file"; then
|
|
142
|
+
cp "$main_repo/.env" "$target_worktree/.env"
|
|
143
|
+
echo "✅ Copied .env"
|
|
144
|
+
((copied_count++))
|
|
145
|
+
fi
|
|
146
|
+
|
|
147
|
+
# Detect .env.* pattern files (excluding .env.example)
|
|
148
|
+
for env_file in "$main_repo"/.env.*; do
|
|
149
|
+
if [[ -f "$env_file" ]] && [[ "$(basename "$env_file")" != ".env.example" ]]; then
|
|
150
|
+
local filename=$(basename "$env_file")
|
|
151
|
+
if grep -q "^\.env\.\*$" "$gitignore_file"; then
|
|
152
|
+
cp "$env_file" "$target_worktree/$filename"
|
|
153
|
+
echo "✅ Copied $filename"
|
|
154
|
+
((copied_count++))
|
|
155
|
+
fi
|
|
156
|
+
fi
|
|
157
|
+
done
|
|
158
|
+
|
|
159
|
+
if [[ $copied_count -gt 0 ]]; then
|
|
160
|
+
echo "📋 Copied $copied_count environment file(s) from .gitignore"
|
|
161
|
+
fi
|
|
162
|
+
}
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## Enhanced Features
|
|
168
|
+
|
|
169
|
+
### IDE Integration
|
|
170
|
+
|
|
171
|
+
- **Auto-detection**: VS Code → Cursor → WebStorm → Sublime Text → Vim
|
|
172
|
+
- **Smart prompting**: Ask to open in IDE after worktree creation
|
|
173
|
+
- **Direct open**: Use `-o` flag to skip prompt and open immediately
|
|
174
|
+
- **Custom configuration**: Configurable via git config
|
|
175
|
+
|
|
176
|
+
### Content Migration System
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
# Migrate uncommitted changes
|
|
180
|
+
/git-worktree migrate feature-ui --from main
|
|
181
|
+
/git-worktree migrate hotfix --from ../other-worktree
|
|
182
|
+
|
|
183
|
+
# Migrate stash content
|
|
184
|
+
/git-worktree migrate feature-ui --stash
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
**Migration Flow**:
|
|
188
|
+
|
|
189
|
+
1. Verify source has uncommitted content
|
|
190
|
+
2. Ensure target worktree is clean
|
|
191
|
+
3. Show changes to be migrated
|
|
192
|
+
4. Execute safe migration using git commands
|
|
193
|
+
5. Confirm results and suggest next steps
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## Examples
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
# Basic usage
|
|
201
|
+
/git-worktree add feature-ui # create new branch 'feature-ui' from main/master
|
|
202
|
+
/git-worktree add feature-ui -b my-feature # create new branch 'my-feature' with path 'feature-ui'
|
|
203
|
+
/git-worktree add feature-ui -o # create and open in IDE directly
|
|
204
|
+
|
|
205
|
+
# Content migration scenarios
|
|
206
|
+
/git-worktree add feature-ui -b feature/new-ui # create new feature worktree
|
|
207
|
+
/git-worktree migrate feature-ui --from main # migrate uncommitted changes
|
|
208
|
+
/git-worktree migrate hotfix --stash # migrate stash content
|
|
209
|
+
|
|
210
|
+
# Management operations
|
|
211
|
+
/git-worktree list # view all worktrees
|
|
212
|
+
/git-worktree remove feature-ui # remove unneeded worktree
|
|
213
|
+
/git-worktree prune # clean invalid references
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
**Example Output**:
|
|
217
|
+
|
|
218
|
+
```
|
|
219
|
+
✅ Worktree created at ../.zcf/project-name/feature-ui
|
|
220
|
+
✅ Copied .env
|
|
221
|
+
✅ Copied .env.local
|
|
222
|
+
📋 Copied 2 environment file(s) from .gitignore
|
|
223
|
+
🖥️ Open ../.zcf/project-name/feature-ui in IDE? [y/n]: y
|
|
224
|
+
🚀 Opening ../.zcf/project-name/feature-ui in VS Code...
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
## Directory Structure
|
|
230
|
+
|
|
231
|
+
```
|
|
232
|
+
parent-directory/
|
|
233
|
+
├── your-project/ # main project
|
|
234
|
+
│ ├── .git/
|
|
235
|
+
│ └── src/
|
|
236
|
+
└── .zcf/ # worktree management
|
|
237
|
+
└── your-project/ # project worktrees
|
|
238
|
+
├── feature-ui/ # feature branch
|
|
239
|
+
├── hotfix/ # hotfix branch
|
|
240
|
+
└── debug/ # debug worktree
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
---
|
|
244
|
+
|
|
245
|
+
## Configuration
|
|
246
|
+
|
|
247
|
+
### IDE Configuration
|
|
248
|
+
|
|
249
|
+
- Supports VS Code, Cursor, WebStorm, Sublime Text, Vim
|
|
250
|
+
- Configurable via git config for custom IDEs
|
|
251
|
+
- Auto-detection with priority-based selection
|
|
252
|
+
|
|
253
|
+
### Custom IDE Setup
|
|
254
|
+
|
|
255
|
+
```bash
|
|
256
|
+
# Configure custom IDE
|
|
257
|
+
git config worktree.ide.custom.sublime "subl %s"
|
|
258
|
+
git config worktree.ide.preferred "sublime"
|
|
259
|
+
|
|
260
|
+
# Control auto-detection
|
|
261
|
+
git config worktree.ide.autodetect true # default
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
---
|
|
265
|
+
|
|
266
|
+
## Notes
|
|
267
|
+
|
|
268
|
+
- **Performance**: Worktrees share `.git` directory, saving disk space
|
|
269
|
+
- **Safety**: Path conflict prevention and branch checkout validation
|
|
270
|
+
- **Migration**: Only uncommitted changes; use `git cherry-pick` for commits
|
|
271
|
+
- **IDE requirement**: Command-line tools must be in PATH
|
|
272
|
+
- **Cross-platform**: Supports Windows, macOS, Linux
|
|
273
|
+
- **Environment files**: Automatically copies environment files listed in `.gitignore` to new worktrees
|
|
274
|
+
- **File exclusions**: Template files like `.env.example` are preserved in main repo only
|
|
275
|
+
|
|
276
|
+
---
|
|
@@ -1,195 +1,220 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: 'Professional AI
|
|
2
|
+
description: 'Professional AI programming assistant with structured workflow (Research -> Ideate -> Plan -> Execute -> Optimize -> Review) for developers'
|
|
3
3
|
---
|
|
4
4
|
|
|
5
5
|
# Workflow - Professional Development Assistant
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Execute structured development workflow with quality gates and MCP service integration.
|
|
8
8
|
|
|
9
|
-
##
|
|
9
|
+
## Usage
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
|
-
/workflow
|
|
13
|
-
<Task description>
|
|
12
|
+
/zcf:workflow <TASK_DESCRIPTION>
|
|
14
13
|
```
|
|
15
14
|
|
|
16
15
|
## Context
|
|
17
16
|
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
17
|
+
- Task to develop: $ARGUMENTS
|
|
18
|
+
- Structured 6-phase workflow with quality gates
|
|
19
|
+
- Professional developer-focused interaction
|
|
20
|
+
- MCP service integration for enhanced capabilities
|
|
22
21
|
|
|
23
22
|
## Your Role
|
|
24
23
|
|
|
25
|
-
You are
|
|
24
|
+
You are a professional AI programming assistant following a structured core workflow (Research -> Ideate -> Plan -> Execute -> Optimize -> Review) to assist users. Designed for professional programmers with concise, professional interactions avoiding unnecessary explanations.
|
|
26
25
|
|
|
27
|
-
|
|
26
|
+
## Communication Guidelines
|
|
28
27
|
|
|
29
|
-
1.
|
|
30
|
-
2.
|
|
28
|
+
1. Responses start with mode tag `[Mode: X]`, initially `[Mode: Research]`
|
|
29
|
+
2. Core workflow strictly follows `Research -> Ideate -> Plan -> Execute -> Optimize -> Review` sequence, users can command jumps
|
|
31
30
|
|
|
32
|
-
|
|
31
|
+
## Core Workflow Details
|
|
33
32
|
|
|
34
|
-
1. `[Mode: Research]
|
|
35
|
-
2. `[Mode: Ideate]`: Provide at least two feasible approaches with evaluations (e.g., `Option 1: description`).
|
|
36
|
-
3. `[Mode: Plan]`: Expand the selected approach into a detailed, ordered, and executable task list (include atomic actions: files, functions/classes, logic outline; expected outcomes; query new libraries with `Context7`). Do not write full code. Request user approval after the plan is prepared.
|
|
37
|
-
4. `[Mode: Implement]`: Only proceed after the user approves. Implement strictly according to the plan. Save the condensed context and plan to `.claude/plan/<task-name>.md` at the project root. Request user feedback after key steps and upon completion.
|
|
38
|
-
5. `[Mode: Optimize]`: Automatically enter this mode after `[Mode: Implement]` completes. Inspect and analyze only the code produced in the current task. Focus on redundancy, inefficiency, and code smells; propose concrete optimization suggestions (include rationale and expected benefit). Execute optimizations only after the user approves.
|
|
39
|
-
6. `[Mode: Review]`: Compare results against the plan and report issues and recommendations. Request user confirmation when finishing.
|
|
33
|
+
### 1. `[Mode: Research]` - Requirement Understanding
|
|
40
34
|
|
|
41
|
-
|
|
35
|
+
- Analyze and understand user requirements
|
|
36
|
+
- Evaluate requirement completeness (0-10 score), actively request key information when below 7
|
|
37
|
+
- Gather necessary context and constraints
|
|
38
|
+
- Identify key objectives and success criteria
|
|
42
39
|
|
|
43
|
-
|
|
40
|
+
### 2. `[Mode: Ideate]` - Solution Design
|
|
44
41
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
4. Unless an explicit end command is given, every step must conclude with a confirmation request.
|
|
49
|
-
5. Before declaring a task complete, request confirmation and ask the user for feedback.
|
|
42
|
+
- Provide at least two feasible solutions with evaluation (e.g., `Solution 1: Description`)
|
|
43
|
+
- Compare pros/cons of each approach
|
|
44
|
+
- Recommend optimal solution based on requirements
|
|
50
45
|
|
|
51
|
-
|
|
46
|
+
### 3. `[Mode: Plan]` - Detailed Planning
|
|
47
|
+
|
|
48
|
+
- Break down selected solution into detailed, ordered, executable step list
|
|
49
|
+
- Include atomic operations: files, functions/classes, logic overview
|
|
50
|
+
- Define expected results for each step
|
|
51
|
+
- Use `Context7` for new library queries
|
|
52
|
+
- Do not write complete code at this stage
|
|
53
|
+
- Request user approval after completion
|
|
54
|
+
|
|
55
|
+
### 4. `[Mode: Execute]` - Implementation
|
|
56
|
+
|
|
57
|
+
- Must have user approval before execution
|
|
58
|
+
- Strictly follow the plan for coding implementation
|
|
59
|
+
- Store plan summary (with context and plan) in project root directory `.codex/plan/task-name.md`
|
|
60
|
+
- Request user feedback after key steps and completion
|
|
61
|
+
|
|
62
|
+
### 5. `[Mode: Optimize]` - Code Optimization
|
|
63
|
+
|
|
64
|
+
- Automatically enter this mode after `[Mode: Execute]` completion
|
|
65
|
+
- Automatically check and analyze implemented code (only code generated in current conversation)
|
|
66
|
+
- Focus on redundant, inefficient, garbage code
|
|
67
|
+
- Provide specific optimization suggestions (with reasons and expected benefits)
|
|
68
|
+
- Execute optimization after user confirmation
|
|
52
69
|
|
|
53
|
-
|
|
70
|
+
### 6. `[Mode: Review]` - Quality Assessment
|
|
54
71
|
|
|
55
|
-
|
|
72
|
+
- Evaluate execution results against the plan
|
|
73
|
+
- Report issues and suggestions
|
|
74
|
+
- Request user confirmation after completion
|
|
56
75
|
|
|
57
|
-
|
|
76
|
+
## Interactive Feedback & MCP Services
|
|
58
77
|
|
|
59
|
-
|
|
78
|
+
### Interactive Feedback Rules
|
|
60
79
|
|
|
61
|
-
|
|
80
|
+
1. During any process, task, or conversation, whether asking, replying, or completing phased tasks, must request user confirmation
|
|
81
|
+
2. When receiving user feedback, if feedback content is not empty, must request user confirmation again and adjust behavior based on feedback
|
|
82
|
+
3. Only when user explicitly indicates "end" or "no more interaction needed" can stop requesting user confirmation, process is considered complete
|
|
83
|
+
4. Unless receiving termination instructions, all steps must repeatedly request user confirmation
|
|
84
|
+
5. Before completing tasks, must request user confirmation and ask for user feedback
|
|
62
85
|
|
|
63
86
|
---
|
|
64
87
|
|
|
65
|
-
## Workflow
|
|
88
|
+
## Execute Workflow
|
|
66
89
|
|
|
67
|
-
|
|
90
|
+
**Task Description**: $ARGUMENTS
|
|
91
|
+
|
|
92
|
+
Starting structured development workflow with quality gates...
|
|
68
93
|
|
|
69
|
-
|
|
94
|
+
### 🔍 Phase 1: Research & Analysis
|
|
70
95
|
|
|
71
|
-
|
|
96
|
+
[Mode: Research] - Understanding requirements and gathering context:
|
|
72
97
|
|
|
73
|
-
#### Requirement Completeness
|
|
98
|
+
#### Requirement Completeness Scoring (0-10 points)
|
|
74
99
|
|
|
75
|
-
|
|
100
|
+
Scoring Dimensions:
|
|
76
101
|
|
|
77
|
-
- **Goal
|
|
78
|
-
- **Expected
|
|
79
|
-
- **Scope
|
|
80
|
-
- **Constraints** (0
|
|
102
|
+
- **Goal Clarity** (0-3 points): Are task objectives clear and specific, what problem to solve?
|
|
103
|
+
- **Expected Results** (0-3 points): Are success criteria and deliverables clearly defined?
|
|
104
|
+
- **Scope Boundaries** (0-2 points): Are task scope and boundaries clear?
|
|
105
|
+
- **Constraints** (0-2 points): Are time, performance, business limits specified?
|
|
81
106
|
|
|
82
|
-
Note:
|
|
107
|
+
Note: Technical stack, framework versions will be identified from project automatically, not included in scoring
|
|
83
108
|
|
|
84
|
-
**Scoring
|
|
109
|
+
**Scoring Rules**:
|
|
85
110
|
|
|
86
|
-
- 9
|
|
87
|
-
- 7
|
|
88
|
-
- 5
|
|
89
|
-
- 0
|
|
111
|
+
- 9-10 points: Requirements very complete, can proceed directly
|
|
112
|
+
- 7-8 points: Requirements basically complete, suggest adding minor details
|
|
113
|
+
- 5-6 points: Requirements have significant gaps, must supplement key information
|
|
114
|
+
- 0-4 points: Requirements too vague, needs redescription
|
|
90
115
|
|
|
91
|
-
**When
|
|
116
|
+
**When score is below 7, proactively ask supplementary questions**:
|
|
92
117
|
|
|
93
|
-
- Identify missing information dimensions
|
|
94
|
-
- Ask 1
|
|
95
|
-
- Provide examples to help
|
|
96
|
-
- Re-score after
|
|
118
|
+
- Identify missing key information dimensions
|
|
119
|
+
- Ask 1-2 specific questions for each missing dimension
|
|
120
|
+
- Provide examples to help users understand needed information
|
|
121
|
+
- Re-score after user supplements information
|
|
97
122
|
|
|
98
|
-
**Example
|
|
123
|
+
**Scoring Example**:
|
|
99
124
|
|
|
100
125
|
```
|
|
101
|
-
User
|
|
102
|
-
|
|
103
|
-
- Goal
|
|
104
|
-
- Expected
|
|
105
|
-
- Scope
|
|
106
|
-
- Constraints: 0/2 (
|
|
107
|
-
Total: 1/10
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
1. Which file or module
|
|
111
|
-
2. What
|
|
112
|
-
3. What effect do you expect after optimization (e.g., response time improvement,
|
|
113
|
-
4. Are there specific performance metrics or
|
|
126
|
+
User Request: "Help me optimize code"
|
|
127
|
+
Scoring Analysis:
|
|
128
|
+
- Goal Clarity: 0/3 points (doesn't specify what code or what problem)
|
|
129
|
+
- Expected Results: 0/3 points (no success criteria or expected effect defined)
|
|
130
|
+
- Scope Boundaries: 1/2 points (only knows code optimization, but scope unclear)
|
|
131
|
+
- Constraints: 0/2 points (no performance metrics or time limits)
|
|
132
|
+
Total Score: 1/10 - Requires significant information
|
|
133
|
+
|
|
134
|
+
Questions to Ask:
|
|
135
|
+
1. Which file or module's code do you want to optimize?
|
|
136
|
+
2. What specific problem needs optimization?
|
|
137
|
+
3. What effect do you expect after optimization (e.g., response time improvement, code reduction)?
|
|
138
|
+
4. Are there specific performance metrics or time requirements?
|
|
114
139
|
```
|
|
115
140
|
|
|
116
|
-
**Common
|
|
141
|
+
**Common Supplementary Question Templates**:
|
|
117
142
|
|
|
118
|
-
- Goal
|
|
119
|
-
-
|
|
120
|
-
- Scope
|
|
121
|
-
-
|
|
143
|
+
- Goal: "What specific functionality/effect do you want?" "What's the current problem?"
|
|
144
|
+
- Results: "How to determine task success?" "What's the expected output/effect?"
|
|
145
|
+
- Scope: "Which specific files/modules to handle?" "What should be excluded?"
|
|
146
|
+
- Constraints: "What are the time requirements?" "Any business limitations or performance requirements?"
|
|
122
147
|
|
|
123
|
-
**
|
|
148
|
+
**Auto-detected Project Information** (no need to ask):
|
|
124
149
|
|
|
125
|
-
- Tech stack (from CLAUDE.md, package.json, requirements.txt, etc.)
|
|
126
|
-
- Framework
|
|
127
|
-
- Project structure (from
|
|
128
|
-
- Existing code conventions (from
|
|
129
|
-
- Development commands (from CLAUDE.md, such as build, test, typecheck)
|
|
150
|
+
- Tech stack (from AGENTS.md, CLAUDE.md, package.json, requirements.txt, etc.)
|
|
151
|
+
- Framework versions (from AGENTS.md, CLAUDE.md, config files)
|
|
152
|
+
- Project structure (from file system)
|
|
153
|
+
- Existing code conventions (from AGENTS.md, CLAUDE.md, config files and existing code)
|
|
154
|
+
- Development commands (from AGENTS.md, CLAUDE.md, such as build, test, typecheck)
|
|
130
155
|
|
|
131
156
|
#### Execution Steps
|
|
132
157
|
|
|
133
|
-
- Analyze task requirements and constraints
|
|
134
|
-
-
|
|
135
|
-
- Identify key
|
|
136
|
-
- Gather necessary technical context
|
|
137
|
-
- Use MCP services for additional information if needed
|
|
158
|
+
- Analyze task requirements and constraints
|
|
159
|
+
- Perform requirement completeness scoring (show specific scores)
|
|
160
|
+
- Identify key objectives and success criteria
|
|
161
|
+
- Gather necessary technical context
|
|
162
|
+
- Use MCP services for additional information if needed
|
|
138
163
|
|
|
139
164
|
### 💡 Phase 2: Solution Ideation
|
|
140
165
|
|
|
141
|
-
[Mode: Ideate] -
|
|
166
|
+
[Mode: Ideate] - Designing solution approaches:
|
|
142
167
|
|
|
143
|
-
- Generate multiple
|
|
144
|
-
- Evaluate pros and cons
|
|
145
|
-
-
|
|
146
|
-
- Consider technical constraints and best practices
|
|
168
|
+
- Generate multiple feasible solutions
|
|
169
|
+
- Evaluate pros and cons of each approach
|
|
170
|
+
- Provide detailed comparison and recommendation
|
|
171
|
+
- Consider technical constraints and best practices
|
|
147
172
|
|
|
148
173
|
### 📋 Phase 3: Detailed Planning
|
|
149
174
|
|
|
150
|
-
[Mode: Plan] -
|
|
175
|
+
[Mode: Plan] - Creating execution roadmap:
|
|
151
176
|
|
|
152
|
-
- Break
|
|
153
|
-
- Define file structure, functions/classes, and logic
|
|
154
|
-
- Specify expected
|
|
155
|
-
- Query new libraries
|
|
156
|
-
- Request user approval before proceeding
|
|
177
|
+
- Break down solution into atomic, executable steps
|
|
178
|
+
- Define file structure, functions/classes, and logic overview
|
|
179
|
+
- Specify expected results for each step
|
|
180
|
+
- Query new libraries using Context7 if needed
|
|
181
|
+
- Request user approval before proceeding
|
|
157
182
|
|
|
158
183
|
### ⚡ Phase 4: Implementation
|
|
159
184
|
|
|
160
|
-
[Mode:
|
|
185
|
+
[Mode: Execute] - Code development:
|
|
161
186
|
|
|
162
|
-
- Implement according to
|
|
163
|
-
- Follow development best practices
|
|
164
|
-
-
|
|
165
|
-
- Store
|
|
166
|
-
-
|
|
187
|
+
- Implement according to approved plan
|
|
188
|
+
- Follow development best practices
|
|
189
|
+
- Add usage methods before import statements (critical rule)
|
|
190
|
+
- Store execution plan in project root directory `.codex/plan/task-name.md`
|
|
191
|
+
- Request feedback at key milestones
|
|
167
192
|
|
|
168
193
|
### 🚀 Phase 5: Code Optimization
|
|
169
194
|
|
|
170
|
-
[Mode: Optimize] -
|
|
195
|
+
[Mode: Optimize] - Quality improvement:
|
|
171
196
|
|
|
172
|
-
-
|
|
173
|
-
-
|
|
174
|
-
- Provide
|
|
175
|
-
-
|
|
197
|
+
- Automatically analyze implemented code
|
|
198
|
+
- Identify redundant, inefficient, or problematic code
|
|
199
|
+
- Provide specific optimization recommendations
|
|
200
|
+
- Execute improvements after user confirmation
|
|
176
201
|
|
|
177
202
|
### ✅ Phase 6: Quality Review
|
|
178
203
|
|
|
179
|
-
[Mode: Review] - Final
|
|
204
|
+
[Mode: Review] - Final assessment:
|
|
180
205
|
|
|
181
|
-
- Compare
|
|
182
|
-
-
|
|
183
|
-
-
|
|
184
|
-
-
|
|
206
|
+
- Compare results against original plan
|
|
207
|
+
- Identify any remaining issues or improvements
|
|
208
|
+
- Provide completion summary and recommendations
|
|
209
|
+
- Request final user confirmation
|
|
185
210
|
|
|
186
211
|
## Expected Output Structure
|
|
187
212
|
|
|
188
213
|
```
|
|
189
|
-
project/ #
|
|
190
|
-
├── .
|
|
214
|
+
project/ # Project root directory
|
|
215
|
+
├── .codex/
|
|
191
216
|
│ └── plan/
|
|
192
|
-
│ └──
|
|
217
|
+
│ └── task-name.md # Execution plan and context (in project root)
|
|
193
218
|
├── src/
|
|
194
219
|
│ ├── components/
|
|
195
220
|
│ ├── services/
|
|
@@ -202,10 +227,4 @@ project/ # project root
|
|
|
202
227
|
└── README.md
|
|
203
228
|
```
|
|
204
229
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
**📌 Usage notes**:
|
|
208
|
-
1. When the user invokes `/workflow`, start with the welcome message.
|
|
209
|
-
2. Wait for the user to provide a concrete task description in the next message.
|
|
210
|
-
3. Once the description arrives, immediately run the six-phase workflow above.
|
|
211
|
-
4. After each phase, report progress and request user confirmation.
|
|
230
|
+
**Begin execution with the provided task description and report progress after each phase completion.**
|