prizmkit 1.0.153 → 1.1.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.
- package/bin/create-prizmkit.js +27 -2
- package/bundled/VERSION.json +3 -3
- package/bundled/adapters/claude/paths.js +1 -1
- package/bundled/dev-pipeline/scripts/generate-bootstrap-prompt.py +482 -57
- package/bundled/dev-pipeline/scripts/parse-stream-progress.py +2 -6
- package/bundled/dev-pipeline/templates/bootstrap-tier1.md +6 -0
- package/bundled/dev-pipeline/templates/bootstrap-tier2.md +6 -0
- package/bundled/dev-pipeline/templates/bootstrap-tier3.md +7 -1
- package/bundled/dev-pipeline/templates/sections/context-budget-rules.md +11 -0
- package/bundled/dev-pipeline/templates/sections/critical-paths-agent.md +9 -0
- package/bundled/dev-pipeline/templates/sections/critical-paths-full.md +12 -0
- package/bundled/dev-pipeline/templates/sections/critical-paths-lite.md +7 -0
- package/bundled/dev-pipeline/templates/sections/directory-convention-agent.md +8 -0
- package/bundled/dev-pipeline/templates/sections/directory-convention-full.md +9 -0
- package/bundled/dev-pipeline/templates/sections/directory-convention-lite.md +6 -0
- package/bundled/dev-pipeline/templates/sections/failure-capture.md +21 -0
- package/bundled/dev-pipeline/templates/sections/failure-log-check.md +8 -0
- package/bundled/dev-pipeline/templates/sections/feature-context.md +23 -0
- package/bundled/dev-pipeline/templates/sections/phase-analyze-agent.md +15 -0
- package/bundled/dev-pipeline/templates/sections/phase-analyze-full.md +15 -0
- package/bundled/dev-pipeline/templates/sections/phase-browser-verification.md +31 -0
- package/bundled/dev-pipeline/templates/sections/phase-commit-full.md +36 -0
- package/bundled/dev-pipeline/templates/sections/phase-commit.md +26 -0
- package/bundled/dev-pipeline/templates/sections/phase-context-snapshot-agent-suffix.md +14 -0
- package/bundled/dev-pipeline/templates/sections/phase-context-snapshot-base.md +20 -0
- package/bundled/dev-pipeline/templates/sections/phase-context-snapshot-lite-suffix.md +3 -0
- package/bundled/dev-pipeline/templates/sections/phase-critic-code.md +24 -0
- package/bundled/dev-pipeline/templates/sections/phase-critic-plan-full.md +45 -0
- package/bundled/dev-pipeline/templates/sections/phase-critic-plan.md +24 -0
- package/bundled/dev-pipeline/templates/sections/phase-deploy-verification.md +36 -0
- package/bundled/dev-pipeline/templates/sections/phase-implement-agent.md +24 -0
- package/bundled/dev-pipeline/templates/sections/phase-implement-full.md +41 -0
- package/bundled/dev-pipeline/templates/sections/phase-implement-lite.md +32 -0
- package/bundled/dev-pipeline/templates/sections/phase-plan-agent.md +17 -0
- package/bundled/dev-pipeline/templates/sections/phase-plan-lite.md +16 -0
- package/bundled/dev-pipeline/templates/sections/phase-review-agent.md +28 -0
- package/bundled/dev-pipeline/templates/sections/phase-review-full.md +36 -0
- package/bundled/dev-pipeline/templates/sections/phase-specify-plan-full.md +82 -0
- package/bundled/dev-pipeline/templates/sections/phase0-init.md +4 -0
- package/bundled/dev-pipeline/templates/sections/phase0-test-baseline.md +12 -0
- package/bundled/dev-pipeline/templates/sections/resume-header.md +2 -0
- package/bundled/dev-pipeline/templates/sections/session-context.md +6 -0
- package/bundled/dev-pipeline/templates/sections/subagent-timeout-recovery.md +6 -0
- package/bundled/skills/_metadata.json +21 -177
- package/bundled/skills/app-planner/SKILL.md +22 -3
- package/bundled/skills/app-planner/references/project-brief-guide.md +110 -0
- package/bundled/skills/bug-fix-workflow/SKILL.md +4 -0
- package/bundled/skills/bug-planner/SKILL.md +2 -2
- package/bundled/skills/dev-pipeline-launcher/SKILL.md +1 -1
- package/bundled/skills/prizm-kit/SKILL.md +18 -47
- package/bundled/skills/prizm-kit/assets/project-memory-template.md +1 -1
- package/bundled/skills/prizmkit-analyze/SKILL.md +4 -4
- package/bundled/skills/prizmkit-init/SKILL.md +4 -4
- package/bundled/skills/prizmkit-plan/SKILL.md +126 -108
- package/bundled/skills/prizmkit-plan/assets/plan-template.md +1 -2
- package/bundled/skills/refactor-workflow/SKILL.md +142 -124
- package/bundled/team/prizm-dev-team.json +2 -8
- package/package.json +1 -1
- package/src/clean.js +8 -0
- package/src/gitignore-template.js +12 -0
- package/src/index.js +3 -22
- package/src/scaffold.js +20 -11
- package/src/upgrade.js +6 -31
- package/bundled/skills/prizmkit-clarify/SKILL.md +0 -93
- package/bundled/skills/prizmkit-specify/SKILL.md +0 -118
- package/bundled/skills/prizmkit-specify/assets/spec-template.md +0 -56
- package/bundled/skills/prizmkit-tool-adr-manager/SKILL.md +0 -67
- package/bundled/skills/prizmkit-tool-adr-manager/assets/adr-template.md +0 -26
- package/bundled/skills/prizmkit-tool-api-doc-generator/SKILL.md +0 -55
- package/bundled/skills/prizmkit-tool-bug-reproducer/SKILL.md +0 -61
- package/bundled/skills/prizmkit-tool-ci-cd-generator/SKILL.md +0 -53
- package/bundled/skills/prizmkit-tool-db-migration/SKILL.md +0 -64
- package/bundled/skills/prizmkit-tool-dependency-health/SKILL.md +0 -122
- package/bundled/skills/prizmkit-tool-deployment-strategy/SKILL.md +0 -57
- package/bundled/skills/prizmkit-tool-error-triage/SKILL.md +0 -54
- package/bundled/skills/prizmkit-tool-log-analyzer/SKILL.md +0 -54
- package/bundled/skills/prizmkit-tool-monitoring-setup/SKILL.md +0 -74
- package/bundled/skills/prizmkit-tool-onboarding-generator/SKILL.md +0 -69
- package/bundled/skills/prizmkit-tool-perf-profiler/SKILL.md +0 -54
- package/bundled/skills/prizmkit-tool-security-audit/SKILL.md +0 -129
- package/bundled/skills/prizmkit-tool-tech-debt-tracker/SKILL.md +0 -138
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: "refactor-workflow"
|
|
3
3
|
tier: 1
|
|
4
|
-
description: "End-to-end refactor workflow:
|
|
4
|
+
description: "End-to-end refactor workflow: structured scoping → parallel code & doc analysis → collaborative planning → implement → review → commit. 6-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', 'code refactoring'. (project)"
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# PrizmKit Refactor Workflow
|
|
8
8
|
|
|
9
|
-
End-to-end orchestration skill for code refactoring and optimization. Chains existing PrizmKit skills into a
|
|
9
|
+
End-to-end orchestration skill for code refactoring and optimization. Chains existing PrizmKit skills into a 6-phase behavior-preserving pipeline with mandatory test gates after each task.
|
|
10
10
|
|
|
11
11
|
### When to Use
|
|
12
12
|
- User says "refactor", "clean up code", "restructure", "extract module", "code refactoring", "optimize code structure"
|
|
@@ -23,13 +23,12 @@ End-to-end orchestration skill for code refactoring and optimization. Chains exi
|
|
|
23
23
|
|
|
24
24
|
```
|
|
25
25
|
refactor-workflow
|
|
26
|
-
→ Phase 0: Branch
|
|
27
|
-
→ Phase 1: Understand →
|
|
28
|
-
→ Phase 2:
|
|
29
|
-
→ Phase 3:
|
|
30
|
-
→ Phase 4:
|
|
31
|
-
→ Phase 5:
|
|
32
|
-
→ Phase 6: Verify & Commit → git commit + merge decision
|
|
26
|
+
→ Phase 0: Branch → refactor/<slug> branch
|
|
27
|
+
→ Phase 1: Understand & Analyze → structured scoping + parallel Agent reading + collaborative planning
|
|
28
|
+
→ Phase 2: Plan → plan.md (including Tasks section)
|
|
29
|
+
→ Phase 3: Implement → (code)
|
|
30
|
+
→ Phase 4: Review → (review report)
|
|
31
|
+
→ Phase 5: Verify & Commit → git commit + merge decision
|
|
33
32
|
```
|
|
34
33
|
|
|
35
34
|
### Pipeline Phases
|
|
@@ -37,27 +36,28 @@ refactor-workflow
|
|
|
37
36
|
| Phase | Name | Skill Used | Artifact |
|
|
38
37
|
|-------|------|-----------|----------|
|
|
39
38
|
| 0 | Branch Setup | git | → `refactor/<slug>` branch |
|
|
40
|
-
| 1 | Understand
|
|
41
|
-
| 2 |
|
|
42
|
-
| 3 |
|
|
43
|
-
| 4 |
|
|
44
|
-
| 5 |
|
|
45
|
-
| 6 | Verify & Commit | `/prizmkit-committer` | git commit + merge |
|
|
39
|
+
| 1 | Understand & Analyze | Interactive scoping + parallel Agent reading + code analysis | → Refactoring scope confirmed + `refactor-analysis.md` |
|
|
40
|
+
| 2 | Plan (Refactor Plan & Tasks) | `/prizmkit-plan` | → `plan.md` (with Tasks section) |
|
|
41
|
+
| 3 | Implement | `/prizmkit-implement` | (code changes) |
|
|
42
|
+
| 4 | Code Review | `/prizmkit-code-review` | (review report) |
|
|
43
|
+
| 5 | Verify & Commit | `/prizmkit-committer` | git commit + merge |
|
|
46
44
|
|
|
47
45
|
### Key Principles
|
|
48
46
|
|
|
49
47
|
| Principle | Description |
|
|
50
48
|
|-----------|-------------|
|
|
51
|
-
| **
|
|
52
|
-
| **
|
|
53
|
-
| **
|
|
54
|
-
| **
|
|
55
|
-
| **
|
|
49
|
+
| **Structured scoping first** | Use structured choices (not open-ended Q&A) to quickly establish refactoring type, scope, and reference materials. |
|
|
50
|
+
| **Parallel understanding** | Dispatch multiple Agents concurrently to read code, docs, and knowledge files — don't read sequentially. |
|
|
51
|
+
| **Show findings, then collaborate** | Present what the Agents discovered, then work with the user to shape the refactoring plan — don't just ask questions without context. |
|
|
52
|
+
| **Behavior preservation** | Refactoring changes structure, not behavior. If tests pass before and after, behavior is preserved. |
|
|
53
|
+
| **Test gates** | Full test suite runs after every task — not just at checkpoints. |
|
|
54
|
+
| **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. |
|
|
55
|
+
| **Incremental safety** | Each task preserves all tests (green → green). If tests fail → stop and revert. |
|
|
56
56
|
|
|
57
57
|
### Artifacts
|
|
58
58
|
Refactor artifacts stored at `.prizmkit/refactor/<refactor-slug>/`:
|
|
59
|
-
- **`refactor-analysis.md`** —
|
|
60
|
-
- **`plan.md`** — Refactoring plan with Tasks section (Phase
|
|
59
|
+
- **`refactor-analysis.md`** — Scoping + code analysis (Phase 1)
|
|
60
|
+
- **`plan.md`** — Refactoring plan with Tasks section (Phase 2)
|
|
61
61
|
|
|
62
62
|
**PRECONDITION:**
|
|
63
63
|
|
|
@@ -94,94 +94,110 @@ Refactor artifacts stored at `.prizmkit/refactor/<refactor-slug>/`:
|
|
|
94
94
|
|
|
95
95
|
---
|
|
96
96
|
|
|
97
|
-
## Phase 1: Understand
|
|
97
|
+
## Phase 1: Understand & Analyze
|
|
98
98
|
|
|
99
|
-
**Goal**:
|
|
99
|
+
**Goal**: Through structured choices, parallel Agent reading, and collaborative discussion, fully understand the refactoring scope and produce a code analysis — all in one integrated phase.
|
|
100
100
|
|
|
101
|
-
**CRITICAL RULE**:
|
|
101
|
+
**CRITICAL RULE**: This phase has 5 steps executed in order. Do NOT skip to planning without completing all steps, especially the parallel reading and collaborative discussion.
|
|
102
102
|
|
|
103
|
-
### Step 1.1:
|
|
103
|
+
### Step 1.1: Refactoring Type Selection
|
|
104
104
|
|
|
105
|
-
|
|
105
|
+
Present the user with a structured choice to establish the refactoring approach:
|
|
106
106
|
|
|
107
|
-
|
|
108
|
-
- **
|
|
109
|
-
- **
|
|
107
|
+
Ask the user to choose:
|
|
108
|
+
- **(a) Incremental refactoring** — Gradual, low-risk improvements. Refactor piece by piece, each step independently deployable.
|
|
109
|
+
- **(b) Full refactoring** — Comprehensive restructuring of the entire target area. Higher risk, bigger payoff.
|
|
110
|
+
- **(c) Targeted refactoring** — Focus on a specific part or concern (e.g., extract one module, decouple one dependency, simplify one flow).
|
|
110
111
|
|
|
111
|
-
|
|
112
|
+
Follow up based on choice:
|
|
113
|
+
- If **(a)**: Ask which area to start with, and what the incremental milestones should be
|
|
114
|
+
- If **(b)**: Confirm the full scope boundary — what's included and what's explicitly excluded
|
|
115
|
+
- If **(c)**: Confirm the specific target and the expected outcome
|
|
112
116
|
|
|
113
|
-
|
|
117
|
+
### Step 1.2: Reference Materials Collection
|
|
114
118
|
|
|
115
|
-
|
|
116
|
-
- **What is explicitly OUT of scope?** (e.g., "don't touch the API layer", "leave the database schema as-is")
|
|
117
|
-
- **Are there any behavior changes allowed?** (Usually no for refactoring, but sometimes the user wants to combine refactoring with a minor behavior change — clarify this upfront)
|
|
118
|
-
- **Should the public API/interface stay the same?** (Or is renaming/restructuring the API acceptable?)
|
|
119
|
+
Ask the user if they have supplementary materials that can inform the refactoring:
|
|
119
120
|
|
|
120
|
-
|
|
121
|
+
Present as a multi-select checklist:
|
|
122
|
+
- **Code paths** — Specific files or directories to focus on (e.g., `src/auth/`, `lib/payment.js`)
|
|
123
|
+
- **Refactoring-related documents** — Design docs, RFCs, architecture proposals, migration guides
|
|
124
|
+
- **Existing knowledge docs** — `.prizm-docs/`, ADRs, inline documentation, wiki pages, or team notes about the target area
|
|
125
|
+
- **None** — No additional materials, rely on code reading
|
|
121
126
|
|
|
122
|
-
|
|
127
|
+
For each item the user provides, record the path or description for the next step.
|
|
123
128
|
|
|
124
|
-
|
|
125
|
-
- **Are there performance requirements?** (e.g., "the refactored code must not be slower")
|
|
126
|
-
- **Are there any code areas that are particularly fragile?** (known tricky sections, undocumented behavior)
|
|
127
|
-
- **Is there a deadline or time constraint?** (affects how aggressive the refactoring can be)
|
|
128
|
-
- **If database/schema changes are involved**: read existing schema files first and confirm scope with user
|
|
129
|
-
```bash
|
|
130
|
-
find . -maxdepth 4 -type f \( -name "*.prisma" -o -name "*.sql" -o -path "*/migrations/*" -o -path "*/models/*" -o -name "schema.*" -o -name "*.entity.*" \) -not -path '*/node_modules/*' -not -path '*/.git/*' | head -20
|
|
131
|
-
```
|
|
129
|
+
### Step 1.3: Parallel Agent Reading
|
|
132
130
|
|
|
133
|
-
|
|
131
|
+
Based on the user's selections in Steps 1.1 and 1.2, dispatch **multiple Agents in parallel** to read and analyze:
|
|
134
132
|
|
|
135
|
-
|
|
133
|
+
**Agent allocation strategy:**
|
|
134
|
+
- **Agent A (Code Structure)**: Read the target code files — understand architecture, dependencies (incoming/outgoing), module boundaries, public API surface
|
|
135
|
+
- **Agent B (Documentation)**: Read any user-provided docs + relevant `.prizm-docs/` (TRAPS, PATTERNS, RULES) + TODO/FIXME/HACK comments in target code
|
|
136
|
+
- **Agent C (Test Baseline)**: Locate and run test suites for the target area — record pass/fail counts, identify pre-existing failures, assess coverage
|
|
137
|
+
|
|
138
|
+
If the user provided no docs (chose "None" in Step 1.2), Agent B focuses entirely on `.prizm-docs/` and inline code comments.
|
|
139
|
+
|
|
140
|
+
**Each Agent produces a structured summary:**
|
|
141
|
+
- Agent A: file inventory, dependency graph, complexity hotspots, code smells
|
|
142
|
+
- Agent B: known traps, architectural decisions, existing knowledge about the target
|
|
143
|
+
- Agent C: test suite status (total/passing/failing), coverage estimate, behavior contracts
|
|
144
|
+
|
|
145
|
+
### Step 1.4: Present Findings & Collaborative Planning
|
|
146
|
+
|
|
147
|
+
After all Agents complete, **present a consolidated findings report** to the user:
|
|
136
148
|
|
|
137
149
|
```
|
|
138
|
-
Refactoring
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
-
|
|
142
|
-
-
|
|
143
|
-
|
|
150
|
+
## Refactoring Findings
|
|
151
|
+
|
|
152
|
+
### Code Structure (Agent A)
|
|
153
|
+
- [file inventory, dependency graph, complexity metrics]
|
|
154
|
+
- [identified code smells: long functions, deep nesting, duplication, coupling]
|
|
155
|
+
|
|
156
|
+
### Existing Knowledge (Agent B)
|
|
157
|
+
- [known traps and risks from docs]
|
|
158
|
+
- [relevant architectural decisions]
|
|
159
|
+
- [user-provided doc insights]
|
|
160
|
+
|
|
161
|
+
### Test Baseline (Agent C)
|
|
162
|
+
- [test suite status: X total, Y passing, Z failing]
|
|
163
|
+
- [coverage estimate]
|
|
164
|
+
- [behavior contracts to preserve]
|
|
165
|
+
|
|
166
|
+
### Recommended Refactoring Approach
|
|
167
|
+
- [based on findings, propose concrete refactoring strategy]
|
|
168
|
+
- [identify highest-impact opportunities]
|
|
169
|
+
- [flag risks and cross-module impacts]
|
|
144
170
|
```
|
|
145
171
|
|
|
146
|
-
|
|
172
|
+
Then engage the user in **collaborative discussion**:
|
|
173
|
+
- "Based on these findings, here's what I recommend for the refactoring approach. What do you think?"
|
|
174
|
+
- Discuss priorities: which improvements matter most?
|
|
175
|
+
- Discuss constraints: any areas that are off-limits?
|
|
176
|
+
- Discuss risks: how to handle fragile or undocumented areas?
|
|
177
|
+
- If the scope needs adjustment based on findings, negotiate with the user
|
|
147
178
|
|
|
148
|
-
|
|
179
|
+
### Step 1.5: Confirm & Generate Analysis
|
|
149
180
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
## Phase 2: Analyze — Code Analysis
|
|
181
|
+
After the collaborative discussion concludes:
|
|
153
182
|
|
|
154
|
-
**
|
|
183
|
+
1. **Ask the user**: "Is there anything else you'd like to add or adjust before we finalize the refactoring scope?"
|
|
184
|
+
2. **If yes**: Incorporate feedback, revisit relevant points
|
|
185
|
+
3. **If no**: Generate `refactor-analysis.md` at `.prizmkit/refactor/<refactor-slug>/refactor-analysis.md`
|
|
155
186
|
|
|
156
|
-
|
|
187
|
+
**`refactor-analysis.md` required sections:**
|
|
188
|
+
- **Refactoring Type**: Incremental / Full / Targeted (from Step 1.1)
|
|
189
|
+
- **Current State**: module overview, file inventory, dependency graph, complexity metrics (from Agent A)
|
|
190
|
+
- **Refactoring Goals**: what structural improvements are targeted, why — aligned with collaborative discussion
|
|
191
|
+
- **Risk Assessment**: what could break, cross-module impact, fragile areas (from Agent B + discussion)
|
|
192
|
+
- **Baseline Tests**: test suite status, coverage estimate, behavior contracts to preserve (from Agent C)
|
|
193
|
+
- **Scope Boundary**: what IS in scope, what is explicitly OUT of scope — confirmed with user
|
|
194
|
+
- **Reference Materials**: list of docs/paths the user provided and key insights from each
|
|
157
195
|
|
|
158
|
-
1.
|
|
159
|
-
- Code structure and architecture
|
|
160
|
-
- Dependencies (incoming and outgoing)
|
|
161
|
-
- Current test coverage
|
|
162
|
-
- Known tech debt (from `.prizm-docs/` TRAPS)
|
|
163
|
-
2. **Perform code analysis** on target area:
|
|
164
|
-
- Identify code smells: long functions, deep nesting, duplicated logic, excessive coupling
|
|
165
|
-
- Assess complexity metrics: function length, parameter count, cyclomatic complexity
|
|
166
|
-
- Identify highest-impact refactoring opportunities
|
|
167
|
-
- Check for TODO/FIXME/HACK comments indicating known debt
|
|
168
|
-
3. **Establish baseline**:
|
|
169
|
-
- Run full test suite — record pass/fail counts
|
|
170
|
-
- Note any pre-existing test failures (isolate from refactor impact)
|
|
171
|
-
- Document current behavior contracts (public API, interfaces)
|
|
172
|
-
4. **Generate `refactor-analysis.md`** at `.prizmkit/refactor/<refactor-slug>/refactor-analysis.md`:
|
|
173
|
-
Required sections:
|
|
174
|
-
- **Current State**: module overview, file inventory, dependency graph, complexity metrics
|
|
175
|
-
- **Refactoring Goals**: what structural improvements are targeted, why (debt items, complexity, maintainability) — aligned with user's confirmed goals from Phase 1
|
|
176
|
-
- **Risk Assessment**: what could break, cross-module impact, data migration needs
|
|
177
|
-
- **Baseline Tests**: test suite status (total, passing, failing), coverage estimate, behavior contracts to preserve
|
|
178
|
-
- **Scope Boundary**: what IS in scope, what is explicitly OUT of scope — carried from Phase 1 confirmation
|
|
179
|
-
|
|
180
|
-
**CHECKPOINT CP-RW-2**: `refactor-analysis.md` exists with baseline test results.
|
|
196
|
+
**CHECKPOINT CP-RW-1**: `refactor-analysis.md` exists with confirmed scope, baseline test results, and user agreement.
|
|
181
197
|
|
|
182
198
|
---
|
|
183
199
|
|
|
184
|
-
## Phase
|
|
200
|
+
## Phase 2: Plan — Refactor Plan & Tasks
|
|
185
201
|
|
|
186
202
|
**Goal**: Generate technical refactoring plan that preserves behavior, including task breakdown.
|
|
187
203
|
|
|
@@ -199,11 +215,11 @@ Ask the user: "Is this scope accurate? Anything to adjust?"
|
|
|
199
215
|
- Tasks ordered to minimize risk (safe renames first, structural changes later)
|
|
200
216
|
- Every task ends with "run full test suite"
|
|
201
217
|
|
|
202
|
-
**CHECKPOINT CP-RW-
|
|
218
|
+
**CHECKPOINT CP-RW-2**: `plan.md` exists with behavior preservation strategy and Tasks section.
|
|
203
219
|
|
|
204
220
|
---
|
|
205
221
|
|
|
206
|
-
## Phase
|
|
222
|
+
## Phase 3: Implement
|
|
207
223
|
|
|
208
224
|
**Goal**: Execute refactoring tasks with mandatory test verification after each task.
|
|
209
225
|
|
|
@@ -218,9 +234,9 @@ Ask the user: "Is this scope accurate? Anything to adjust?"
|
|
|
218
234
|
- Mark tasks complete in plan.md Tasks section as they finish
|
|
219
235
|
- Record test results after each task
|
|
220
236
|
|
|
221
|
-
**CHECKPOINT CP-RW-
|
|
237
|
+
**CHECKPOINT CP-RW-3**: All tasks complete, full test suite green.
|
|
222
238
|
|
|
223
|
-
**Important constraints for Phase
|
|
239
|
+
**Important constraints for Phase 3:**
|
|
224
240
|
- Never skip the test gate between tasks — a broken intermediate state compounds into much harder debugging later
|
|
225
241
|
- Never allow temporary test failures ("we'll fix it in the next task") — this assumption is almost always wrong in refactoring
|
|
226
242
|
- If a task cannot be completed without breaking tests → split it into smaller tasks
|
|
@@ -228,7 +244,7 @@ Ask the user: "Is this scope accurate? Anything to adjust?"
|
|
|
228
244
|
|
|
229
245
|
---
|
|
230
246
|
|
|
231
|
-
## Phase
|
|
247
|
+
## Phase 4: Code Review
|
|
232
248
|
|
|
233
249
|
**Goal**: Verify refactoring quality and behavior preservation.
|
|
234
250
|
|
|
@@ -244,14 +260,14 @@ Ask the user: "Is this scope accurate? Anything to adjust?"
|
|
|
244
260
|
- Verdict: PASS / PASS_WITH_WARNINGS / NEEDS_FIXES
|
|
245
261
|
2. **Run full test suite one final time**: All tests must pass
|
|
246
262
|
3. **Handle review results**:
|
|
247
|
-
- **PASS / PASS_WITH_WARNINGS**: Proceed to Phase
|
|
248
|
-
- **NEEDS_FIXES**: Return to Phase
|
|
263
|
+
- **PASS / PASS_WITH_WARNINGS**: Proceed to Phase 5
|
|
264
|
+
- **NEEDS_FIXES**: Return to Phase 3 following Fix Instructions (max 2 review rounds)
|
|
249
265
|
|
|
250
|
-
**CHECKPOINT CP-RW-
|
|
266
|
+
**CHECKPOINT CP-RW-4**: Code review passes, all tests green.
|
|
251
267
|
|
|
252
268
|
---
|
|
253
269
|
|
|
254
|
-
## Phase
|
|
270
|
+
## Phase 5: Verify, Commit & Merge
|
|
255
271
|
|
|
256
272
|
**Goal**: Let user verify, commit with refactor convention, and merge back.
|
|
257
273
|
|
|
@@ -262,7 +278,7 @@ Ask the user: "Is this scope accurate? Anything to adjust?"
|
|
|
262
278
|
- **(a) Run the app** — Start dev server for manual verification
|
|
263
279
|
- **(b) Run a specific command** — Specify a test or script
|
|
264
280
|
- **(c) Skip** — Proceed to commit (tests already pass)
|
|
265
|
-
- If user reports issues: return to Phase
|
|
281
|
+
- If user reports issues: return to Phase 3
|
|
266
282
|
2. **Invoke `/prizmkit-retrospective`** (Job 1: structural sync only):
|
|
267
283
|
- Update KEY_FILES/INTERFACES/DEPENDENCIES in affected `.prizm-docs/` files
|
|
268
284
|
- Skip knowledge injection unless refactoring revealed a genuinely new pitfall (e.g. a non-obvious coupling)
|
|
@@ -288,7 +304,7 @@ Ask the user: "Is this scope accurate? Anything to adjust?"
|
|
|
288
304
|
```
|
|
289
305
|
6. **If (b)**: Inform user: "Branch `refactor/<slug>` retained. Create a PR when ready."
|
|
290
306
|
|
|
291
|
-
**CHECKPOINT CP-RW-
|
|
307
|
+
**CHECKPOINT CP-RW-5**: Commit recorded with `refactor()` prefix. Merge decision made.
|
|
292
308
|
|
|
293
309
|
---
|
|
294
310
|
|
|
@@ -297,10 +313,10 @@ Ask the user: "Is this scope accurate? Anything to adjust?"
|
|
|
297
313
|
For single-file refactoring (rename, extract method, <30 lines changed):
|
|
298
314
|
|
|
299
315
|
```
|
|
300
|
-
Phase 0 (Branch) → Phase 1 (Simplified
|
|
316
|
+
Phase 0 (Branch) → Phase 1 (Simplified) → Phase 2 (Simplified Plan) → Phase 3 (Implement) → Phase 4 (Review) → Phase 5 (Commit & Merge)
|
|
301
317
|
```
|
|
302
318
|
|
|
303
|
-
Phase 1 is simplified
|
|
319
|
+
Phase 1 is simplified: skip parallel Agents, use a quick 2-3 question confirmation instead. Skip detailed doc collection. Still generate a lightweight `refactor-analysis.md`.
|
|
304
320
|
|
|
305
321
|
**CRITERIA** (ALL must be true):
|
|
306
322
|
- Single file change
|
|
@@ -310,9 +326,11 @@ Phase 1 is simplified to 2-3 quick confirmation questions instead of deep dive.
|
|
|
310
326
|
- No dependency changes
|
|
311
327
|
|
|
312
328
|
**Fast Path implementation differs from full path:**
|
|
313
|
-
- Phase 1
|
|
314
|
-
-
|
|
315
|
-
-
|
|
329
|
+
- Phase 1 Steps 1.2-1.3 are skipped (no doc collection, no parallel Agents)
|
|
330
|
+
- Step 1.1 simplified to quick confirmation of refactoring goal
|
|
331
|
+
- Step 1.4 simplified to brief scope confirmation
|
|
332
|
+
- Phase 2 is simplified: generate a lightweight plan.md with 1-2 tasks directly from refactor-analysis.md
|
|
333
|
+
- Phase 3 still reads plan.md Tasks as normal, marks tasks `[x]` on completion
|
|
316
334
|
- Single-task refactors typically have just one task in plan.md
|
|
317
335
|
|
|
318
336
|
**Fast Path still requires:**
|
|
@@ -336,12 +354,11 @@ The pipeline supports resuming from the last completed phase by detecting existi
|
|
|
336
354
|
| Artifact Found | Resume From |
|
|
337
355
|
|---------------|------------|
|
|
338
356
|
| (nothing) | Phase 0: Branch Setup |
|
|
339
|
-
| On `refactor/<slug>` branch, no artifacts | Phase 1: Understand |
|
|
340
|
-
|
|
|
341
|
-
| `refactor-analysis.md`
|
|
342
|
-
|
|
|
343
|
-
| All docs +
|
|
344
|
-
| All docs + review passed | Phase 6: Verify & Commit |
|
|
357
|
+
| On `refactor/<slug>` branch, no artifacts | Phase 1: Understand & Analyze |
|
|
358
|
+
| `refactor-analysis.md` only | Phase 2: Plan |
|
|
359
|
+
| `refactor-analysis.md` + `plan.md` | Phase 3: Implement |
|
|
360
|
+
| All docs + code changes exist | Phase 4: Review |
|
|
361
|
+
| All docs + review passed | Phase 5: Verify & Commit |
|
|
345
362
|
|
|
346
363
|
**Resume**: If `<slug>` matches an existing `.prizmkit/refactor/<slug>/` directory, resume instead of starting fresh.
|
|
347
364
|
|
|
@@ -352,9 +369,10 @@ The pipeline supports resuming from the last completed phase by detecting existi
|
|
|
352
369
|
| Scenario | Action |
|
|
353
370
|
|----------|--------|
|
|
354
371
|
| Cannot identify target module | Ask user for clarification |
|
|
355
|
-
| User's refactoring goal is unclear |
|
|
372
|
+
| User's refactoring goal is unclear | Use Step 1.1 structured choices to narrow down |
|
|
356
373
|
| No tests exist for target module | WARN user, recommend writing tests first |
|
|
357
374
|
| Baseline tests already failing | Isolate failures, document, proceed with caution |
|
|
375
|
+
| Parallel Agent fails to read a file | Log warning, continue with available results, notify user |
|
|
358
376
|
| Test fails after a refactoring task | Revert task, investigate, retry or split |
|
|
359
377
|
| Implementation fails after 3 rounds | Escalate to user with analysis |
|
|
360
378
|
| Review fails after 2 rounds | Escalate with review findings |
|
|
@@ -368,14 +386,14 @@ The pipeline supports resuming from the last completed phase by detecting existi
|
|
|
368
386
|
|
|
369
387
|
| Skill | Role in Refactor Workflow |
|
|
370
388
|
|-------|-----------------------------|
|
|
371
|
-
| (
|
|
372
|
-
| `/prizmkit-plan` | Phase
|
|
373
|
-
| `/prizmkit-implement` | Phase
|
|
374
|
-
| `/prizmkit-code-review` | Phase
|
|
375
|
-
| `/prizmkit-committer` | Phase
|
|
376
|
-
| `/prizmkit-retrospective` | Phase
|
|
389
|
+
| (parallel Agents) | Phase 1: concurrent code & doc reading |
|
|
390
|
+
| `/prizmkit-plan` | Phase 2: refactoring plan + task generation |
|
|
391
|
+
| `/prizmkit-implement` | Phase 3: execute refactoring tasks |
|
|
392
|
+
| `/prizmkit-code-review` | Phase 4: review quality and behavior preservation |
|
|
393
|
+
| `/prizmkit-committer` | Phase 5: commit with `refactor()` convention |
|
|
394
|
+
| `/prizmkit-retrospective` | Phase 5: structural sync before commit (Job 1 only, skip knowledge injection unless new pitfall) |
|
|
377
395
|
| `feature-workflow` | Handoff target when new behavior is needed |
|
|
378
|
-
| `/prizmkit-
|
|
396
|
+
| `/prizmkit-plan` | NOT used (no user stories for refactoring) |
|
|
379
397
|
| `/prizmkit-analyze` | NOT used (no spec <-> plan consistency needed) |
|
|
380
398
|
|
|
381
399
|
---
|
|
@@ -385,22 +403,22 @@ The pipeline supports resuming from the last completed phase by detecting existi
|
|
|
385
403
|
| Dimension | Feature Workflow | Refactor Workflow | Bug Fix Workflow |
|
|
386
404
|
|-----------|-----------------|-------------------|------------------|
|
|
387
405
|
| Input | Natural language requirement | Module/code target | Bug description |
|
|
388
|
-
| Deep Q&A | Yes (brainstorm) | Yes (
|
|
406
|
+
| Deep Q&A | Yes (brainstorm) | Yes (structured scoping + parallel analysis) | Yes (diagnosis) |
|
|
389
407
|
| Branch | Pipeline manages per-feature | `refactor/<slug>` | `fix/<BUG_ID>-*` |
|
|
390
|
-
| Pipeline Phases | 4 (brainstorm → plan → launch → monitor) |
|
|
391
|
-
| Phase 1 | Brainstorm (requirements Q&A) | Understand (
|
|
408
|
+
| Pipeline Phases | 4 (brainstorm → plan → launch → monitor) | 6 (branch → understand & analyze → plan → implement → review → commit) | 8 (branch → diagnose → triage → reproduce → fix → review → verify → commit) |
|
|
409
|
+
| Phase 1 | Brainstorm (requirements Q&A) | Understand & Analyze (structured scoping + parallel reading + collaborative planning) | Deep Bug Diagnosis (symptom Q&A) |
|
|
392
410
|
| Artifact Path | `.prizmkit/specs/<slug>/` | `.prizmkit/refactor/<slug>/` | `.prizmkit/bugfix/<id>/` |
|
|
393
411
|
| Commit Prefix | `feat(<scope>):` | `refactor(<scope>):` | `fix(<scope>):` |
|
|
394
412
|
| Test Strategy | TDD per task | Full suite after EVERY task | Reproduction test |
|
|
395
413
|
| Scope Guard | N/A | Enforced | N/A |
|
|
396
414
|
| Behavior Change | Expected | Forbidden | Fix behavior |
|
|
397
|
-
| User Verification | Yes (brainstorm confirmation) | Yes (Phase
|
|
415
|
+
| User Verification | Yes (brainstorm confirmation) | Yes (Phase 5) | Yes (Phase 6) |
|
|
398
416
|
|
|
399
417
|
## Output
|
|
400
418
|
|
|
401
|
-
- `refactor-analysis.md` (Phase
|
|
402
|
-
- `plan.md` with Tasks section (Phase
|
|
403
|
-
- Refactored implementation code (Phase
|
|
404
|
-
- Code review report (Phase
|
|
405
|
-
- Git commit with `refactor(<scope>):` prefix on dedicated refactor branch (Phase
|
|
419
|
+
- `refactor-analysis.md` (Phase 1 artifact)
|
|
420
|
+
- `plan.md` with Tasks section (Phase 2 artifact)
|
|
421
|
+
- Refactored implementation code (Phase 3)
|
|
422
|
+
- Code review report (Phase 4, conversation only)
|
|
423
|
+
- Git commit with `refactor(<scope>):` prefix on dedicated refactor branch (Phase 5)
|
|
406
424
|
- Updated `.prizm-docs/` (if applicable)
|
|
@@ -2,19 +2,13 @@
|
|
|
2
2
|
"name": "prizm-dev-team",
|
|
3
3
|
"team_name": "prizm-dev-team",
|
|
4
4
|
"description": "PrizmKit-integrated Multi-Agent software development team. 3 specialized agents (Dev, Reviewer, Critic) following PrizmKit spec-driven workflow with pipeline and checkpoints.",
|
|
5
|
-
"lead": "
|
|
5
|
+
"lead": "orchestrator",
|
|
6
6
|
"communication": {
|
|
7
7
|
"protocol": "SendMessage",
|
|
8
8
|
"routing": "mesh",
|
|
9
|
-
"note": "Teammates communicate directly via SendMessage; key messages must also be sent to Orchestrator"
|
|
9
|
+
"note": "Teammates communicate directly via SendMessage; key messages must also be sent to Orchestrator (the main agent session)"
|
|
10
10
|
},
|
|
11
11
|
"members": [
|
|
12
|
-
{
|
|
13
|
-
"name": "team-lead",
|
|
14
|
-
"role": "lead",
|
|
15
|
-
"agentDefinition": "prizm-dev-team-dev",
|
|
16
|
-
"subscriptions": []
|
|
17
|
-
},
|
|
18
12
|
{
|
|
19
13
|
"name": "dev",
|
|
20
14
|
"role": "developer",
|
package/package.json
CHANGED
package/src/clean.js
CHANGED
|
@@ -119,6 +119,10 @@ export async function runClean(directory, options = {}) {
|
|
|
119
119
|
'.prizm-docs', // AI-generated project context docs
|
|
120
120
|
'CODEBUDDY.md',
|
|
121
121
|
'CLAUDE.md',
|
|
122
|
+
'feature-list.json', // app-planner output
|
|
123
|
+
'bug-fix-list.json', // bug-planner output
|
|
124
|
+
'project-brief.md', // app-planner project brief
|
|
125
|
+
'project-conventions.json', // app-planner coding conventions
|
|
122
126
|
path.join('.codebuddy', 'settings.json'),
|
|
123
127
|
path.join('.claude', 'settings.json'),
|
|
124
128
|
path.join('.claude', 'team-info.json'),
|
|
@@ -136,6 +140,10 @@ export async function runClean(directory, options = {}) {
|
|
|
136
140
|
const claudeCommandEntries = allSkillNames.flatMap(name => [name, `${name}.md`]);
|
|
137
141
|
results.push(...await removeKnownEntries(claudeCommandsDir, claudeCommandEntries, dryRun));
|
|
138
142
|
|
|
143
|
+
// .claude/command-assets/ — skill assets installed by adapter
|
|
144
|
+
const claudeCommandAssetsDir = path.join(projectRoot, '.claude', 'command-assets');
|
|
145
|
+
results.push(...await removeKnownEntries(claudeCommandAssetsDir, allSkillNames, dryRun));
|
|
146
|
+
|
|
139
147
|
// .codebuddy/skills/ — skills installed as subdirectories
|
|
140
148
|
const cbSkillsDir = path.join(projectRoot, '.codebuddy', 'skills');
|
|
141
149
|
results.push(...await removeKnownEntries(cbSkillsDir, allSkillNames, dryRun));
|
|
@@ -14,9 +14,21 @@ export function generateGitignore(options = {}) {
|
|
|
14
14
|
'# PrizmKit Runtime Artifacts',
|
|
15
15
|
'# ===========================',
|
|
16
16
|
'',
|
|
17
|
+
'# PrizmKit 运行时配置与产物',
|
|
18
|
+
'.prizmkit/',
|
|
19
|
+
'',
|
|
20
|
+
'# 多 Agent 协作临时工作区',
|
|
21
|
+
'.dev-team/',
|
|
22
|
+
'',
|
|
17
23
|
'# Prizm 文档(按需决定是否提交)',
|
|
18
24
|
'# .prizm-docs/',
|
|
19
25
|
'',
|
|
26
|
+
'# 规划产物(按需决定是否提交)',
|
|
27
|
+
'# feature-list.json',
|
|
28
|
+
'# bug-fix-list.json',
|
|
29
|
+
'# project-brief.md',
|
|
30
|
+
'# project-conventions.json',
|
|
31
|
+
'',
|
|
20
32
|
];
|
|
21
33
|
|
|
22
34
|
if (options.pipeline) {
|
package/src/index.js
CHANGED
|
@@ -64,7 +64,7 @@ export async function runScaffold(directory, options) {
|
|
|
64
64
|
}
|
|
65
65
|
const config = {
|
|
66
66
|
platform: options.platform,
|
|
67
|
-
skills: options.skills || '
|
|
67
|
+
skills: options.skills || 'core',
|
|
68
68
|
team: options.team !== false,
|
|
69
69
|
pipeline: options.pipeline !== false,
|
|
70
70
|
playwrightCli: options.playwrightCli !== false,
|
|
@@ -144,10 +144,6 @@ export async function runScaffold(directory, options) {
|
|
|
144
144
|
const skillSuiteChoice = await select({
|
|
145
145
|
message: '选择技能套件:',
|
|
146
146
|
choices: [
|
|
147
|
-
{
|
|
148
|
-
name: `Full — 全部 ${totalSkills} 个技能`,
|
|
149
|
-
value: 'full',
|
|
150
|
-
},
|
|
151
147
|
{
|
|
152
148
|
name: `Core — 核心工作流 (${metadata.suites.core.skills.length} 个技能)`,
|
|
153
149
|
value: 'core',
|
|
@@ -156,25 +152,11 @@ export async function runScaffold(directory, options) {
|
|
|
156
152
|
name: `Minimal — 最小可用 (${metadata.suites.minimal.skills.length} 个技能)`,
|
|
157
153
|
value: 'minimal',
|
|
158
154
|
},
|
|
159
|
-
{
|
|
160
|
-
name: 'Recommended — 按项目类型推荐 ▸',
|
|
161
|
-
value: 'recommended',
|
|
162
|
-
},
|
|
163
155
|
],
|
|
164
|
-
default: '
|
|
156
|
+
default: 'core',
|
|
165
157
|
});
|
|
166
158
|
|
|
167
159
|
let skillSuite = skillSuiteChoice;
|
|
168
|
-
if (skillSuiteChoice === 'recommended') {
|
|
169
|
-
const projectType = await select({
|
|
170
|
-
message: '选择项目类型:',
|
|
171
|
-
choices: Object.entries(metadata.recommendations || {}).map(([key, val]) => ({
|
|
172
|
-
name: val.label,
|
|
173
|
-
value: `recommended:${key}`,
|
|
174
|
-
})),
|
|
175
|
-
});
|
|
176
|
-
skillSuite = projectType;
|
|
177
|
-
}
|
|
178
160
|
|
|
179
161
|
// 2.5. 外部 Skill 选择(可选)
|
|
180
162
|
let selectedExternalSkills = [];
|
|
@@ -223,8 +205,7 @@ export async function runScaffold(directory, options) {
|
|
|
223
205
|
// 显示安装摘要
|
|
224
206
|
const platformLabel = platform === 'both' ? 'CodeBuddy + Claude Code'
|
|
225
207
|
: platform === 'codebuddy' ? 'CodeBuddy' : 'Claude Code';
|
|
226
|
-
const suiteLabel = skillSuite === '
|
|
227
|
-
: skillSuite === 'core' ? `Core (${metadata.suites.core.skills.length} 个)`
|
|
208
|
+
const suiteLabel = skillSuite === 'core' ? `Core (${metadata.suites.core.skills.length} 个)`
|
|
228
209
|
: skillSuite === 'minimal' ? `Minimal (${metadata.suites.minimal.skills.length} 个)`
|
|
229
210
|
: `Recommended (${skillSuite})`;
|
|
230
211
|
|