prizmkit 1.0.45 → 1.0.66
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/bundled/VERSION.json +3 -3
- package/bundled/adapters/claude/agent-adapter.js +2 -1
- package/bundled/adapters/claude/command-adapter.js +3 -3
- package/bundled/agents/prizm-dev-team-dev.md +1 -1
- package/bundled/dev-pipeline/README.md +6 -8
- package/bundled/dev-pipeline/assets/prizm-dev-team-integration.md +24 -19
- package/bundled/dev-pipeline/launch-bugfix-daemon.sh +2 -2
- package/bundled/dev-pipeline/launch-daemon.sh +2 -2
- package/bundled/dev-pipeline/lib/branch.sh +76 -0
- package/bundled/dev-pipeline/run-bugfix.sh +58 -149
- package/bundled/dev-pipeline/run.sh +60 -153
- package/bundled/dev-pipeline/scripts/generate-bootstrap-prompt.py +17 -4
- package/bundled/dev-pipeline/scripts/parse-stream-progress.py +2 -2
- package/bundled/dev-pipeline/templates/bootstrap-tier1.md +16 -27
- package/bundled/dev-pipeline/templates/bootstrap-tier2.md +20 -32
- package/bundled/dev-pipeline/templates/bootstrap-tier3.md +32 -53
- package/bundled/dev-pipeline/templates/bugfix-bootstrap-prompt.md +29 -41
- package/bundled/dev-pipeline/templates/session-status-schema.json +1 -1
- package/bundled/dev-pipeline/tests/conftest.py +19 -126
- package/bundled/dev-pipeline/tests/test_generate_bootstrap_prompt.py +207 -0
- package/bundled/dev-pipeline/tests/test_generate_bugfix_prompt.py +128 -141
- package/bundled/dev-pipeline/tests/test_utils.py +51 -110
- package/bundled/rules/prizm/prizm-commit-workflow.md +3 -3
- package/bundled/skills/_metadata.json +15 -16
- package/bundled/skills/app-planner/SKILL.md +8 -7
- package/bundled/skills/bug-fix-workflow/SKILL.md +171 -0
- package/bundled/skills/bug-planner/SKILL.md +25 -33
- package/bundled/skills/bug-planner/scripts/validate-bug-list.py +156 -0
- package/bundled/skills/bugfix-pipeline-launcher/SKILL.md +5 -7
- package/bundled/skills/dev-pipeline-launcher/SKILL.md +4 -6
- package/bundled/skills/feature-workflow/SKILL.md +25 -42
- package/bundled/skills/prizm-kit/SKILL.md +61 -23
- package/bundled/skills/prizm-kit/assets/{claude-md-template.md → project-memory-template.md} +3 -3
- package/bundled/skills/prizmkit-analyze/SKILL.md +44 -33
- package/bundled/skills/prizmkit-clarify/SKILL.md +40 -30
- package/bundled/skills/prizmkit-code-review/SKILL.md +58 -45
- package/bundled/skills/prizmkit-committer/SKILL.md +30 -68
- package/bundled/skills/prizmkit-implement/SKILL.md +60 -28
- package/bundled/skills/prizmkit-init/SKILL.md +57 -66
- package/bundled/skills/prizmkit-plan/SKILL.md +60 -23
- package/bundled/skills/prizmkit-prizm-docs/SKILL.md +74 -19
- package/bundled/skills/prizmkit-prizm-docs/assets/PRIZM-SPEC.md +23 -23
- package/bundled/skills/prizmkit-retrospective/SKILL.md +142 -65
- package/bundled/skills/prizmkit-retrospective/assets/retrospective-template.md +13 -0
- package/bundled/skills/prizmkit-specify/SKILL.md +69 -15
- package/bundled/skills/refactor-workflow/SKILL.md +116 -52
- package/bundled/team/prizm-dev-team.json +2 -2
- package/package.json +1 -1
- package/src/scaffold.js +4 -4
- package/bundled/dev-pipeline/lib/worktree.sh +0 -164
- package/bundled/dev-pipeline/tests/__init__.py +0 -0
- package/bundled/dev-pipeline/tests/test_check_session.py +0 -131
- package/bundled/dev-pipeline/tests/test_cleanup_logs.py +0 -119
- package/bundled/dev-pipeline/tests/test_detect_stuck.py +0 -207
- package/bundled/dev-pipeline/tests/test_generate_prompt.py +0 -190
- package/bundled/dev-pipeline/tests/test_init_bugfix_pipeline.py +0 -153
- package/bundled/dev-pipeline/tests/test_init_pipeline.py +0 -241
- package/bundled/dev-pipeline/tests/test_update_bug_status.py +0 -142
- package/bundled/dev-pipeline/tests/test_update_feature_status.py +0 -338
- package/bundled/dev-pipeline/tests/test_worktree.py +0 -236
- package/bundled/dev-pipeline/tests/test_worktree_integration.py +0 -796
- package/bundled/skills/prizm-kit/assets/codebuddy-md-template.md +0 -35
- package/bundled/skills/prizm-kit/assets/hooks/prizm-commit-hook.json +0 -15
- package/bundled/skills/prizmkit-summarize/SKILL.md +0 -51
- package/bundled/skills/prizmkit-summarize/assets/registry-template.md +0 -18
- package/bundled/templates/hooks/commit-intent-claude.json +0 -26
- /package/bundled/templates/hooks/{commit-intent-codebuddy.json → commit-intent.json} +0 -0
|
@@ -1,21 +1,28 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: "refactor-workflow"
|
|
3
3
|
tier: 1
|
|
4
|
-
description: "
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
refactor-workflow-SKILL.md
|
|
8
|
-
refactor-workflow/SKILL.md
|
|
4
|
+
description: "End-to-end refactor workflow: analyze → plan → implement → review → commit. 5-phase behavior-preserving pipeline with mandatory test gates. Use this skill whenever the user wants to restructure, clean up, or optimize code without changing behavior. Trigger on: 'refactor', 'clean up code', 'restructure', 'optimize code structure', 'extract module', '重构', '优化代码结构', '代码重构'. (project)"
|
|
9
5
|
---
|
|
10
6
|
|
|
11
7
|
# PrizmKit Refactor Workflow
|
|
12
8
|
|
|
13
|
-
End-to-end orchestration skill for code refactoring and optimization. Chains existing PrizmKit skills
|
|
9
|
+
End-to-end orchestration skill for code refactoring and optimization. Chains existing PrizmKit skills into a 5-phase behavior-preserving pipeline with mandatory test gates after each task.
|
|
10
|
+
|
|
11
|
+
### When to Use
|
|
12
|
+
- User says "refactor", "clean up code", "restructure", "extract module", "重构", "优化代码结构"
|
|
13
|
+
- Code has accumulated tech debt that needs structural improvement
|
|
14
|
+
- Module needs to be split, merged, or reorganized
|
|
15
|
+
- When behavior must remain unchanged but internal quality needs improvement
|
|
16
|
+
|
|
17
|
+
**Do NOT use when:**
|
|
18
|
+
- User wants to add new features (use `feature-workflow`)
|
|
19
|
+
- User wants to fix bugs (use `bug-planner` + `bugfix-pipeline-launcher`)
|
|
20
|
+
- Change is trivial (single rename, <5 lines) — just do it directly
|
|
14
21
|
|
|
15
22
|
## Overview
|
|
16
23
|
|
|
17
24
|
```
|
|
18
|
-
|
|
25
|
+
refactor-workflow
|
|
19
26
|
→ Phase 1: Analyze → refactor-analysis.md
|
|
20
27
|
→ Phase 2: Plan → plan.md (including Tasks section)
|
|
21
28
|
→ Phase 3: Implement → (code)
|
|
@@ -27,45 +34,49 @@ prizmkit.refactor <目标模块或描述>
|
|
|
27
34
|
|
|
28
35
|
| Phase | Name | Skill Used | Artifact |
|
|
29
36
|
|-------|------|-----------|----------|
|
|
30
|
-
| 1 | Analyze 代码分析 |
|
|
31
|
-
| 2 | Plan 重构方案与任务 |
|
|
32
|
-
| 3 | Implement 实现 |
|
|
33
|
-
| 4 | Code Review |
|
|
34
|
-
| 5 | Commit |
|
|
37
|
+
| 1 | Analyze 代码分析 | Built-in code analysis + code reading | → `refactor-analysis.md` |
|
|
38
|
+
| 2 | Plan 重构方案与任务 | `/prizmkit-plan` | → `plan.md` (含 Tasks section) |
|
|
39
|
+
| 3 | Implement 实现 | `/prizmkit-implement` | (code changes) |
|
|
40
|
+
| 4 | Code Review | `/prizmkit-code-review` | (review report) |
|
|
41
|
+
| 5 | Commit | `/prizmkit-committer` | git commit |
|
|
35
42
|
|
|
36
43
|
### Key Principles
|
|
44
|
+
|
|
37
45
|
| Principle | Description |
|
|
38
46
|
|-----------|-------------|
|
|
39
|
-
| **Behavior preservation** | Refactoring
|
|
40
|
-
| **Test gates** | Full test suite
|
|
41
|
-
| **
|
|
42
|
-
| **Incremental safety** | Each task preserves all tests
|
|
47
|
+
| **Behavior preservation** | Refactoring changes structure, not behavior. If tests pass before and after, behavior is preserved. Acceptance criteria = "behavior unchanged + structure improved". |
|
|
48
|
+
| **Test gates** | Full test suite runs after every task — not just at checkpoints. A refactoring that breaks tests mid-way is much harder to debug than catching it immediately. |
|
|
49
|
+
| **Structural sync only** | Refactoring triggers `/prizmkit-retrospective` Job 1 (structural sync) — update `.prizm-docs/` to reflect file/interface changes. Skip knowledge injection unless a genuinely new pitfall was discovered during refactoring. |
|
|
50
|
+
| **Incremental safety** | Each task preserves all tests (green → green). If tests fail → stop and revert, because later tasks build on the assumption that previous ones are clean. |
|
|
43
51
|
|
|
44
52
|
### Artifacts
|
|
45
53
|
Refactor artifacts stored at `.prizmkit/refactor/<refactor-slug>/`:
|
|
46
54
|
- **`refactor-analysis.md`** — Code analysis (Phase 1)
|
|
47
55
|
- **`plan.md`** — Refactoring plan with Tasks section (Phase 2)
|
|
48
56
|
|
|
49
|
-
## Commands
|
|
50
|
-
### prizmkit.refactor \<目标模块或描述\>
|
|
51
|
-
Execute the full refactor pipeline for a module or code area.
|
|
52
57
|
**INPUT**: Target description. Can be:
|
|
53
58
|
- Module or file path (e.g., "src/auth/")
|
|
54
59
|
- Natural language description (e.g., "重构认证模块,提取公共逻辑")
|
|
55
60
|
- Specific refactoring goal (e.g., "extract payment processing into separate service")
|
|
61
|
+
|
|
56
62
|
---
|
|
57
63
|
|
|
58
64
|
## Phase 1: Analyze — 代码分析
|
|
65
|
+
|
|
59
66
|
**Goal**: Assess current code state, identify refactoring targets, establish baseline.
|
|
67
|
+
|
|
60
68
|
**STEPS:**
|
|
69
|
+
|
|
61
70
|
1. **Read target code**: Thoroughly read and understand the target module/files:
|
|
62
71
|
- Code structure and architecture
|
|
63
72
|
- Dependencies (incoming and outgoing)
|
|
64
73
|
- Current test coverage
|
|
65
74
|
- Known tech debt (from `.prizm-docs/` TRAPS)
|
|
66
|
-
2. **
|
|
67
|
-
-
|
|
75
|
+
2. **Perform code analysis** on target area:
|
|
76
|
+
- Identify code smells: long functions, deep nesting, duplicated logic, excessive coupling
|
|
77
|
+
- Assess complexity metrics: function length, parameter count, cyclomatic complexity
|
|
68
78
|
- Identify highest-impact refactoring opportunities
|
|
79
|
+
- Check for TODO/FIXME/HACK comments indicating known debt
|
|
69
80
|
3. **Establish baseline**:
|
|
70
81
|
- Run full test suite — record pass/fail counts
|
|
71
82
|
- Note any pre-existing test failures (isolate from refactor impact)
|
|
@@ -77,15 +88,21 @@ Execute the full refactor pipeline for a module or code area.
|
|
|
77
88
|
- **Risk Assessment**: what could break, cross-module impact, data migration needs
|
|
78
89
|
- **Baseline Tests**: test suite status (total, passing, failing), coverage estimate, behavior contracts to preserve
|
|
79
90
|
- **Scope Boundary**: what IS in scope, what is explicitly OUT of scope
|
|
91
|
+
|
|
80
92
|
**CHECKPOINT CP-RW-1**: `refactor-analysis.md` exists with baseline test results.
|
|
93
|
+
|
|
81
94
|
---
|
|
95
|
+
|
|
82
96
|
## Phase 2: Plan — 重构方案与任务
|
|
97
|
+
|
|
83
98
|
**Goal**: Generate technical refactoring plan that preserves behavior, including task breakdown.
|
|
99
|
+
|
|
84
100
|
**STEPS:**
|
|
101
|
+
|
|
85
102
|
1. **Read context**: refactor-analysis.md, `.prizm-docs/` (PATTERNS, RULES, TRAPS)
|
|
86
|
-
2. **Invoke
|
|
87
|
-
- Plan
|
|
88
|
-
- plan.md Tasks section: each task
|
|
103
|
+
2. **Invoke `/prizmkit-plan`** with refactor-analysis.md as input (in place of spec.md):
|
|
104
|
+
- Plan specifies: what changes, what stays the same, how behavior is preserved
|
|
105
|
+
- plan.md Tasks section: each task is independently testable and preserves all tests (green → green) — this ensures any failure is immediately traceable to the task that caused it
|
|
89
106
|
- Artifact path: `.prizmkit/refactor/<refactor-slug>/plan.md`
|
|
90
107
|
3. **Verify plan constraints**:
|
|
91
108
|
- All public API contracts preserved
|
|
@@ -93,77 +110,115 @@ Execute the full refactor pipeline for a module or code area.
|
|
|
93
110
|
- Rollback strategy: how to revert if behavior breaks
|
|
94
111
|
- Tasks ordered to minimize risk (safe renames first, structural changes later)
|
|
95
112
|
- Every task ends with "run full test suite"
|
|
113
|
+
|
|
96
114
|
**CHECKPOINT CP-RW-2**: `plan.md` exists with behavior preservation strategy and Tasks section.
|
|
115
|
+
|
|
97
116
|
---
|
|
117
|
+
|
|
98
118
|
## Phase 3: Implement — 实现
|
|
119
|
+
|
|
99
120
|
**Goal**: Execute refactoring tasks with mandatory test verification after each task.
|
|
121
|
+
|
|
100
122
|
**STEPS:**
|
|
123
|
+
|
|
101
124
|
1. **For EACH task in plan.md Tasks section**:
|
|
102
125
|
a. Implement the refactoring change
|
|
103
|
-
b. **Run FULL test suite** (not just affected tests)
|
|
126
|
+
b. **Run FULL test suite** (not just affected tests) — refactoring can have surprising cross-module effects that targeted tests miss
|
|
104
127
|
c. Verify: all previously-passing tests still pass
|
|
105
|
-
d. If any test fails →
|
|
128
|
+
d. If any test fails → stop, revert task, investigate
|
|
106
129
|
2. **Progress tracking**:
|
|
107
130
|
- Mark tasks complete in plan.md Tasks section as they finish
|
|
108
131
|
- Record test results after each task
|
|
132
|
+
|
|
109
133
|
**CHECKPOINT CP-RW-3**: All tasks complete, full test suite green.
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
-
|
|
134
|
+
|
|
135
|
+
**Important constraints for Phase 3:**
|
|
136
|
+
- Never skip the test gate between tasks — a broken intermediate state compounds into much harder debugging later
|
|
137
|
+
- Never allow temporary test failures ("we'll fix it in the next task") — this assumption is almost always wrong in refactoring
|
|
113
138
|
- If a task cannot be completed without breaking tests → split it into smaller tasks
|
|
114
139
|
- Max 3 attempts per task before escalating to user
|
|
140
|
+
|
|
115
141
|
---
|
|
142
|
+
|
|
116
143
|
## Phase 4: Code Review — 代码审查
|
|
144
|
+
|
|
117
145
|
**Goal**: Verify refactoring quality and behavior preservation.
|
|
146
|
+
|
|
118
147
|
**STEPS:**
|
|
119
|
-
|
|
148
|
+
|
|
149
|
+
1. **Invoke `/prizmkit-code-review`** (scoped to changed files):
|
|
120
150
|
- Review dimensions for refactoring:
|
|
121
151
|
- **Behavior preservation**: Does observable behavior remain identical?
|
|
122
152
|
- **Structural improvement**: Is the code measurably better? (complexity, coupling, readability)
|
|
123
153
|
- **Test integrity**: Are all tests still meaningful and passing?
|
|
124
154
|
- **Code quality**: Does refactored code follow project conventions?
|
|
125
155
|
- Verdict: PASS / PASS_WITH_WARNINGS / NEEDS_FIXES
|
|
126
|
-
2. **Run full test suite one final time**: All tests
|
|
156
|
+
2. **Run full test suite one final time**: All tests must pass
|
|
127
157
|
3. **Handle review results**:
|
|
128
|
-
- **PASS / PASS_WITH_WARNINGS**: Proceed to Phase
|
|
158
|
+
- **PASS / PASS_WITH_WARNINGS**: Proceed to Phase 5
|
|
129
159
|
- **NEEDS_FIXES**: Return to Phase 3 (max 2 review rounds)
|
|
160
|
+
|
|
130
161
|
**CHECKPOINT CP-RW-4**: Code review passes, all tests green.
|
|
162
|
+
|
|
131
163
|
---
|
|
164
|
+
|
|
132
165
|
## Phase 5: Commit — 提交
|
|
166
|
+
|
|
133
167
|
**Goal**: Commit with refactor convention.
|
|
168
|
+
|
|
134
169
|
**STEPS:**
|
|
135
|
-
|
|
170
|
+
|
|
171
|
+
1. **Invoke `/prizmkit-retrospective`** (Job 1: structural sync only):
|
|
172
|
+
- Update KEY_FILES/INTERFACES/DEPENDENCIES in affected `.prizm-docs/` files
|
|
173
|
+
- Skip knowledge injection unless refactoring revealed a genuinely new pitfall (e.g. a non-obvious coupling)
|
|
174
|
+
- If structural changes are significant (module split/merge), update L1 doc
|
|
175
|
+
- Stage doc changes: `git add .prizm-docs/`
|
|
176
|
+
2. **Invoke `/prizmkit-committer`**:
|
|
136
177
|
- Commit message: `refactor(<scope>): <description>`
|
|
137
178
|
- Include all refactored code + any test updates
|
|
138
179
|
- Do NOT push
|
|
139
|
-
|
|
140
|
-
2. **Update `.prizm-docs/`** if needed:
|
|
141
|
-
- Updated module structure documentation
|
|
142
|
-
- New PATTERNS discovered
|
|
143
|
-
- Resolved TRAPS (remove if debt is paid)
|
|
180
|
+
|
|
144
181
|
**CHECKPOINT CP-RW-5**: Commit recorded with `refactor()` prefix.
|
|
182
|
+
|
|
145
183
|
---
|
|
184
|
+
|
|
146
185
|
## Fast Path — 快速路径
|
|
186
|
+
|
|
147
187
|
For single-file refactoring (rename, extract method, <30 lines changed):
|
|
188
|
+
|
|
148
189
|
```
|
|
149
|
-
Phase 1 (Analyze) → Phase 3 (Implement) → Phase 4 (Review) → Phase 5 (Commit)
|
|
190
|
+
Phase 1 (Analyze) → Phase 2 (Simplified Plan) → Phase 3 (Implement) → Phase 4 (Review) → Phase 5 (Commit)
|
|
150
191
|
```
|
|
151
|
-
|
|
192
|
+
|
|
193
|
+
Skip Phase 2's detailed planning process, but still generate a lightweight `plan.md` with a simplified Tasks section (typically 1-2 tasks).
|
|
194
|
+
|
|
152
195
|
**CRITERIA** (ALL must be true):
|
|
153
196
|
- Single file change
|
|
154
197
|
- Estimated change < 30 lines
|
|
155
198
|
- Well-known refactoring pattern (rename, extract method/class, inline, move)
|
|
156
199
|
- No cross-module impact
|
|
157
200
|
- No dependency changes
|
|
201
|
+
|
|
202
|
+
**Fast Path implementation differs from full path:**
|
|
203
|
+
- Phase 2 is simplified: generate a lightweight plan.md with 1-2 tasks directly from refactor-analysis.md, without deep architecture research
|
|
204
|
+
- Phase 3 still reads plan.md Tasks as normal, marks tasks `[x]` on completion
|
|
205
|
+
- Single-task refactors typically have just one task in plan.md
|
|
206
|
+
|
|
158
207
|
**Fast Path still requires:**
|
|
159
208
|
- refactor-analysis.md (lightweight version with baseline)
|
|
209
|
+
- plan.md (simplified, 1-2 tasks)
|
|
160
210
|
- Full test suite run after implementation
|
|
161
211
|
- Code review
|
|
162
212
|
- `refactor(<scope>):` commit convention
|
|
213
|
+
|
|
163
214
|
---
|
|
215
|
+
|
|
164
216
|
## Resume — 中断恢复
|
|
217
|
+
|
|
165
218
|
The pipeline supports resuming from the last completed phase by detecting existing artifacts.
|
|
219
|
+
|
|
166
220
|
**Detection logic**: Check `.prizmkit/refactor/<slug>/` for:
|
|
221
|
+
|
|
167
222
|
| Artifact Found | Resume From |
|
|
168
223
|
|---------------|------------|
|
|
169
224
|
| (nothing) | Phase 1: Analyze |
|
|
@@ -171,9 +226,13 @@ The pipeline supports resuming from the last completed phase by detecting existi
|
|
|
171
226
|
| `refactor-analysis.md` + `plan.md` | Phase 3: Implement |
|
|
172
227
|
| All docs + code changes exist | Phase 4: Review |
|
|
173
228
|
| All docs + review passed | Phase 5: Commit |
|
|
174
|
-
|
|
229
|
+
|
|
230
|
+
**Resume**: If `<slug>` matches an existing `.prizmkit/refactor/<slug>/` directory, resume instead of starting fresh.
|
|
231
|
+
|
|
175
232
|
---
|
|
233
|
+
|
|
176
234
|
## Error Handling
|
|
235
|
+
|
|
177
236
|
| Scenario | Action |
|
|
178
237
|
|----------|--------|
|
|
179
238
|
| Cannot identify target module | Ask user for clarification |
|
|
@@ -184,22 +243,27 @@ The pipeline supports resuming from the last completed phase by detecting existi
|
|
|
184
243
|
| Review fails after 2 rounds | Escalate with review findings |
|
|
185
244
|
| Refactoring creates circular dependency | STOP, revise plan |
|
|
186
245
|
| Performance regression detected | STOP, investigate, revise approach |
|
|
246
|
+
|
|
187
247
|
---
|
|
248
|
+
|
|
188
249
|
## Relationship to Other Skills
|
|
250
|
+
|
|
189
251
|
| Skill | Role in Refactor Workflow |
|
|
190
252
|
|-------|--------------------------|
|
|
191
|
-
|
|
|
192
|
-
|
|
|
193
|
-
|
|
|
194
|
-
|
|
|
195
|
-
|
|
|
253
|
+
| (built-in code analysis) | Phase 1: identify debt and complexity |
|
|
254
|
+
| `/prizmkit-plan` | Phase 2: refactoring plan + task generation |
|
|
255
|
+
| `/prizmkit-implement` | Phase 3: execute refactoring tasks |
|
|
256
|
+
| `/prizmkit-code-review` | Phase 4: review quality and behavior preservation |
|
|
257
|
+
| `/prizmkit-committer` | Phase 5: commit with `refactor()` convention |
|
|
258
|
+
| `/prizmkit-retrospective` | Phase 5: structural sync before commit (Job 1 only, skip knowledge injection unless new pitfall) |
|
|
196
259
|
| `feature-workflow` | Handoff target when new behavior is needed |
|
|
197
|
-
|
|
|
198
|
-
|
|
|
199
|
-
|
|
200
|
-
| `prizmkit-retrospective` | Optional: post-refactor lessons learned |
|
|
260
|
+
| `/prizmkit-specify` | NOT used (no user stories for refactoring) |
|
|
261
|
+
| `/prizmkit-analyze` | NOT used (no spec ↔ plan consistency needed) |
|
|
262
|
+
|
|
201
263
|
---
|
|
264
|
+
|
|
202
265
|
## Comparison with Feature and Bug Fix Pipelines
|
|
266
|
+
|
|
203
267
|
| Dimension | Feature Workflow | Refactor Workflow | Bug Fix Pipeline |
|
|
204
268
|
|-----------|-----------------|-------------------|------------------|
|
|
205
269
|
| Input | Natural language requirement | Module/code target | Bug description |
|
|
@@ -211,9 +275,9 @@ The pipeline supports resuming from the last completed phase by detecting existi
|
|
|
211
275
|
| Test Strategy | TDD per task | Full suite after EVERY task | Reproduction test |
|
|
212
276
|
| Scope Guard | N/A | ✅ (enforced) | N/A |
|
|
213
277
|
| Behavior Change | ✅ Expected | ❌ Forbidden | ✅ Fix behavior |
|
|
214
|
-
|
|
215
|
-
All internal asset paths MUST use `${SKILL_DIR}` placeholder for cross-IDE compatibility.
|
|
278
|
+
|
|
216
279
|
## Output
|
|
280
|
+
|
|
217
281
|
- `refactor-analysis.md` (Phase 1 artifact)
|
|
218
282
|
- `plan.md` with Tasks section (Phase 2 artifact)
|
|
219
283
|
- Refactored implementation code (Phase 3)
|
|
@@ -19,14 +19,14 @@
|
|
|
19
19
|
"name": "dev",
|
|
20
20
|
"role": "developer",
|
|
21
21
|
"agentDefinition": "prizm-dev-team-dev",
|
|
22
|
-
"prompt": "You are a Dev Agent of the prizm-dev-team. Follow prizmkit
|
|
22
|
+
"prompt": "You are a Dev Agent of the prizm-dev-team. Follow /prizmkit-implement workflow with TDD. Read plan.md/spec.md, implement task-by-task, mark completed tasks [x]. Check .prizm-docs/ TRAPS before implementing.",
|
|
23
23
|
"subscriptions": ["*"]
|
|
24
24
|
},
|
|
25
25
|
{
|
|
26
26
|
"name": "reviewer",
|
|
27
27
|
"role": "reviewer",
|
|
28
28
|
"agentDefinition": "prizm-dev-team-reviewer",
|
|
29
|
-
"prompt": "You are the Reviewer Agent of the prizm-dev-team. In Phase 4: run prizmkit
|
|
29
|
+
"prompt": "You are the Reviewer Agent of the prizm-dev-team. In Phase 4: run /prizmkit-analyze for cross-document consistency. In Phase 6: run /prizmkit-code-review for spec compliance and code quality, write and execute integration tests.",
|
|
30
30
|
"subscriptions": ["*"]
|
|
31
31
|
}
|
|
32
32
|
]
|
package/package.json
CHANGED
package/src/scaffold.js
CHANGED
|
@@ -367,7 +367,7 @@ export async function installSettings(platform, projectRoot, options, dryRun) {
|
|
|
367
367
|
|
|
368
368
|
// Read hook definition from unified template
|
|
369
369
|
const templatesDir = getTemplatesDir();
|
|
370
|
-
const hookTemplate = await fs.readJSON(path.join(templatesDir, 'hooks', 'commit-intent
|
|
370
|
+
const hookTemplate = await fs.readJSON(path.join(templatesDir, 'hooks', 'commit-intent.json'));
|
|
371
371
|
|
|
372
372
|
await fs.writeFile(settingsPath, JSON.stringify(hookTemplate, null, 2));
|
|
373
373
|
console.log(chalk.green(` ✓ .codebuddy/settings.json`));
|
|
@@ -392,7 +392,7 @@ export async function installSettings(platform, projectRoot, options, dryRun) {
|
|
|
392
392
|
|
|
393
393
|
// Read hook definition from unified template
|
|
394
394
|
const templatesDir = getTemplatesDir();
|
|
395
|
-
const hookTemplate = await fs.readJSON(path.join(templatesDir, 'hooks', 'commit-intent
|
|
395
|
+
const hookTemplate = await fs.readJSON(path.join(templatesDir, 'hooks', 'commit-intent.json'));
|
|
396
396
|
|
|
397
397
|
// Settings
|
|
398
398
|
const permissions = [
|
|
@@ -508,7 +508,7 @@ export async function installPrizmkitScripts(projectRoot, dryRun) {
|
|
|
508
508
|
async function installProjectMemory(platform, projectRoot, dryRun) {
|
|
509
509
|
const templatesDir = getTemplatesDir();
|
|
510
510
|
const skillsDir = getSkillsDir();
|
|
511
|
-
const templateName =
|
|
511
|
+
const templateName = 'project-memory-template.md';
|
|
512
512
|
const targetName = platform === 'claude' ? 'CLAUDE.md' : 'CODEBUDDY.md';
|
|
513
513
|
const targetPath = path.join(projectRoot, targetName);
|
|
514
514
|
|
|
@@ -850,7 +850,7 @@ export async function scaffold(config) {
|
|
|
850
850
|
console.log(' 下一步:');
|
|
851
851
|
console.log(` 1. ${chalk.cyan('cd ' + projectRoot)}`);
|
|
852
852
|
console.log(` 2. ${chalk.cyan(cli)} ${chalk.gray('# 启动 AI 对话')}`);
|
|
853
|
-
console.log(` 3. ${chalk.cyan('说 "prizmkit
|
|
853
|
+
console.log(` 3. ${chalk.cyan('说 "/prizmkit-init"')} ${chalk.gray('# 初始化项目上下文')}`);
|
|
854
854
|
|
|
855
855
|
if (pipeline) {
|
|
856
856
|
console.log(` 4. ${chalk.cyan('说 "规划一个应用"')} ${chalk.gray('# 生成 feature-list.json')}`);
|
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# ============================================================
|
|
3
|
-
# dev-pipeline/lib/worktree.sh - Git Worktree Lifecycle Library
|
|
4
|
-
#
|
|
5
|
-
# Shared by run.sh and run-bugfix.sh to isolate AI CLI sessions
|
|
6
|
-
# in separate git worktrees. Each session runs on its own branch
|
|
7
|
-
# inside a worktree directory, enabling parallel-safe execution
|
|
8
|
-
# and clean main branch history.
|
|
9
|
-
#
|
|
10
|
-
# Functions:
|
|
11
|
-
# worktree_create — Create worktree + branch before session
|
|
12
|
-
# worktree_merge — Merge worktree branch into target after success
|
|
13
|
-
# worktree_cleanup — Remove worktree directory and branch
|
|
14
|
-
# worktree_prune_stale — Prune stale worktree references
|
|
15
|
-
#
|
|
16
|
-
# Environment:
|
|
17
|
-
# USE_WORKTREE — Set to 1 to enable (default), 0 to disable
|
|
18
|
-
# AUTO_PUSH — Set to 1 to auto-push after successful merge
|
|
19
|
-
# ============================================================
|
|
20
|
-
|
|
21
|
-
# worktree_create <project_root> <worktree_base_dir> <session_id> <source_branch>
|
|
22
|
-
#
|
|
23
|
-
# Creates a git worktree and sets global vars:
|
|
24
|
-
# _WORKTREE_PATH — absolute path to the worktree directory
|
|
25
|
-
# _WORKTREE_BRANCH — branch name (worktree/<session_id>)
|
|
26
|
-
#
|
|
27
|
-
# Returns 0 on success, 1 on failure.
|
|
28
|
-
worktree_create() {
|
|
29
|
-
local project_root="$1"
|
|
30
|
-
local worktree_base_dir="$2"
|
|
31
|
-
local session_id="$3"
|
|
32
|
-
local source_branch="$4"
|
|
33
|
-
|
|
34
|
-
_WORKTREE_PATH=""
|
|
35
|
-
_WORKTREE_BRANCH=""
|
|
36
|
-
|
|
37
|
-
local branch_name="worktree/${session_id}"
|
|
38
|
-
local worktree_path="${worktree_base_dir}/${session_id}"
|
|
39
|
-
|
|
40
|
-
# Ensure base directory exists
|
|
41
|
-
mkdir -p "$worktree_base_dir"
|
|
42
|
-
|
|
43
|
-
# Check if worktree path already exists
|
|
44
|
-
if [[ -d "$worktree_path" ]]; then
|
|
45
|
-
log_warn "Worktree path already exists: $worktree_path"
|
|
46
|
-
return 1
|
|
47
|
-
fi
|
|
48
|
-
|
|
49
|
-
# Check if branch already exists
|
|
50
|
-
if git -C "$project_root" rev-parse --verify "$branch_name" >/dev/null 2>&1; then
|
|
51
|
-
log_warn "Branch already exists: $branch_name"
|
|
52
|
-
return 1
|
|
53
|
-
fi
|
|
54
|
-
|
|
55
|
-
# Create worktree with new branch
|
|
56
|
-
if ! git -C "$project_root" worktree add -b "$branch_name" "$worktree_path" "$source_branch" 2>/dev/null; then
|
|
57
|
-
log_error "Failed to create worktree at $worktree_path"
|
|
58
|
-
return 1
|
|
59
|
-
fi
|
|
60
|
-
|
|
61
|
-
_WORKTREE_PATH="$worktree_path"
|
|
62
|
-
_WORKTREE_BRANCH="$branch_name"
|
|
63
|
-
|
|
64
|
-
log_info "Created worktree: $worktree_path (branch: $branch_name)"
|
|
65
|
-
return 0
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
# worktree_merge <project_root> <worktree_branch> <target_branch> <item_id> <session_id>
|
|
69
|
-
#
|
|
70
|
-
# Merges worktree branch into target branch (no fast-forward).
|
|
71
|
-
# Sets global var:
|
|
72
|
-
# _MERGE_RESULT — "success", "conflict", or "error"
|
|
73
|
-
#
|
|
74
|
-
# Returns 0 on success, 1 on conflict, 2 on other error.
|
|
75
|
-
worktree_merge() {
|
|
76
|
-
local project_root="$1"
|
|
77
|
-
local worktree_branch="$2"
|
|
78
|
-
local target_branch="$3"
|
|
79
|
-
local item_id="$4"
|
|
80
|
-
local session_id="$5"
|
|
81
|
-
|
|
82
|
-
_MERGE_RESULT=""
|
|
83
|
-
|
|
84
|
-
# Switch to target branch in the main working tree
|
|
85
|
-
local current_branch
|
|
86
|
-
current_branch=$(git -C "$project_root" rev-parse --abbrev-ref HEAD 2>/dev/null) || {
|
|
87
|
-
log_error "Failed to determine current branch"
|
|
88
|
-
_MERGE_RESULT="error"
|
|
89
|
-
return 2
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
if [[ "$current_branch" != "$target_branch" ]]; then
|
|
93
|
-
if ! git -C "$project_root" checkout "$target_branch" 2>/dev/null; then
|
|
94
|
-
log_error "Failed to checkout target branch: $target_branch"
|
|
95
|
-
_MERGE_RESULT="error"
|
|
96
|
-
return 2
|
|
97
|
-
fi
|
|
98
|
-
fi
|
|
99
|
-
|
|
100
|
-
# Attempt merge (no fast-forward to preserve history)
|
|
101
|
-
local merge_msg="Merge ${worktree_branch} for ${item_id} (session: ${session_id})"
|
|
102
|
-
if git -C "$project_root" merge --no-ff -m "$merge_msg" "$worktree_branch" 2>/dev/null; then
|
|
103
|
-
_MERGE_RESULT="success"
|
|
104
|
-
log_success "Merged $worktree_branch into $target_branch"
|
|
105
|
-
return 0
|
|
106
|
-
else
|
|
107
|
-
# Check if it's a merge conflict
|
|
108
|
-
if git -C "$project_root" diff --name-only --diff-filter=U 2>/dev/null | head -1 | read -r _; then
|
|
109
|
-
# Abort the merge to leave working tree clean
|
|
110
|
-
git -C "$project_root" merge --abort 2>/dev/null || true
|
|
111
|
-
_MERGE_RESULT="conflict"
|
|
112
|
-
log_warn "Merge conflict detected for $worktree_branch"
|
|
113
|
-
return 1
|
|
114
|
-
else
|
|
115
|
-
git -C "$project_root" merge --abort 2>/dev/null || true
|
|
116
|
-
_MERGE_RESULT="error"
|
|
117
|
-
log_error "Merge failed for $worktree_branch"
|
|
118
|
-
return 2
|
|
119
|
-
fi
|
|
120
|
-
fi
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
# worktree_cleanup <project_root> <worktree_path> <worktree_branch>
|
|
124
|
-
#
|
|
125
|
-
# Removes worktree directory and deletes the branch.
|
|
126
|
-
# Idempotent — safe to call even if worktree/branch don't exist.
|
|
127
|
-
#
|
|
128
|
-
# Returns 0 always.
|
|
129
|
-
worktree_cleanup() {
|
|
130
|
-
local project_root="$1"
|
|
131
|
-
local worktree_path="$2"
|
|
132
|
-
local worktree_branch="$3"
|
|
133
|
-
|
|
134
|
-
# Remove the worktree (if it exists)
|
|
135
|
-
if [[ -n "$worktree_path" && -d "$worktree_path" ]]; then
|
|
136
|
-
git -C "$project_root" worktree remove --force "$worktree_path" 2>/dev/null || {
|
|
137
|
-
# Fallback: manual removal
|
|
138
|
-
rm -rf "$worktree_path" 2>/dev/null || true
|
|
139
|
-
}
|
|
140
|
-
log_info "Removed worktree: $worktree_path"
|
|
141
|
-
fi
|
|
142
|
-
|
|
143
|
-
# Delete the branch (if it exists)
|
|
144
|
-
if [[ -n "$worktree_branch" ]]; then
|
|
145
|
-
git -C "$project_root" branch -D "$worktree_branch" 2>/dev/null || true
|
|
146
|
-
fi
|
|
147
|
-
|
|
148
|
-
# Prune stale worktree entries
|
|
149
|
-
git -C "$project_root" worktree prune 2>/dev/null || true
|
|
150
|
-
|
|
151
|
-
return 0
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
# worktree_prune_stale <project_root>
|
|
155
|
-
#
|
|
156
|
-
# Runs `git worktree prune` to clean up stale worktree references.
|
|
157
|
-
#
|
|
158
|
-
# Returns 0 always.
|
|
159
|
-
worktree_prune_stale() {
|
|
160
|
-
local project_root="$1"
|
|
161
|
-
|
|
162
|
-
git -C "$project_root" worktree prune 2>/dev/null || true
|
|
163
|
-
return 0
|
|
164
|
-
}
|
|
File without changes
|