prizmkit 1.0.108 → 1.0.109

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.
@@ -1,5 +1,5 @@
1
1
  {
2
- "frameworkVersion": "1.0.108",
3
- "bundledAt": "2026-03-26T01:27:22.624Z",
4
- "bundledFrom": "90a9f59"
2
+ "frameworkVersion": "1.0.109",
3
+ "bundledAt": "2026-03-26T02:14:25.170Z",
4
+ "bundledFrom": "d4369e9"
5
5
  }
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.0.108",
2
+ "version": "1.0.109",
3
3
  "skills": {
4
4
  "prizm-kit": {
5
5
  "description": "Full-lifecycle dev toolkit. Covers spec-driven development, Prizm context docs, code quality, debugging, deployment, and knowledge management.",
@@ -29,8 +29,51 @@ The bug can come from:
29
29
  - **A description**: "the login page crashes when I click submit"
30
30
  - **A failed test**: "this test is failing: src/auth/__tests__/login.test.ts"
31
31
 
32
+ ## Fast Path
33
+
34
+ For trivial bugs with clear root cause and minimal scope:
35
+
36
+ ### Eligibility Criteria (ALL must be true)
37
+ - Root cause is immediately obvious (typo, missing null check, wrong variable name, off-by-one)
38
+ - Fix is ≤10 lines of code in a single file
39
+ - No cross-module impact
40
+ - Existing tests cover the affected path (or bug is in untested utility)
41
+ - No data model or API changes
42
+
43
+ ### Fast Path Workflow
44
+ 1. Branch Setup → `fix/<BUG_ID>-<short-desc>`
45
+ 2. Write reproduction test → confirm failing
46
+ 3. Apply fix → confirm test passes + full suite green
47
+ 4. Ask user: "Quick fix applied. Verify before commit? (Y/skip)"
48
+ 5. Commit with `fix(<scope>):` prefix
49
+ 6. Ask merge preference
50
+
51
+ **Fast Path still requires**: fix branch, reproduction test, full test suite pass, user merge decision.
52
+
53
+ ---
54
+
32
55
  ## Execution
33
56
 
57
+ ### Phase 0: Branch Setup
58
+
59
+ **Goal**: Create an isolated working branch to keep main clean.
60
+
61
+ 1. **Check current branch**:
62
+ ```bash
63
+ git branch --show-current
64
+ ```
65
+ 2. **If on `main` or a shared branch**: Create and switch to fix branch:
66
+ ```bash
67
+ git checkout -b fix/<BUG_ID>-<short-description>
68
+ ```
69
+ Example: `git checkout -b fix/B-001-login-null-crash`
70
+ 3. **If already on a fix branch**: Confirm with user: "Continue on current branch `<branch-name>`, or create a new one?"
71
+ 4. **Record the original branch name** for later merge.
72
+
73
+ **CHECKPOINT CP-BFW-0**: On a dedicated fix branch, not main/shared branch.
74
+
75
+ ---
76
+
34
77
  ### Phase 1: Triage
35
78
 
36
79
  **Goal**: Understand the bug, locate affected code, classify severity.
@@ -108,23 +151,75 @@ If the fix causes test regressions:
108
151
  Ready to commit.
109
152
  ```
110
153
 
111
- ### Phase 5: Commit
154
+ ### Phase 5: User Verification
155
+
156
+ **Goal**: Let the user verify the fix works as expected before committing.
112
157
 
113
- **Goal**: Commit the fix with proper conventions.
158
+ 1. **Ask user**: "Fix passes all tests. Would you like to verify before committing?"
159
+ - **(a) Run the app** — Start the dev server so you can manually test the fix scenario
160
+ - **(b) Run a specific command** — Specify a test or script to run
161
+ - **(c) Skip verification** — Proceed directly to commit (automated tests already pass)
162
+ 2. **If (a)**: Detect and suggest dev server command (e.g. `npm run dev`, `python manage.py runserver`), start it, wait for user confirmation: "Fix verified? (yes/no)"
163
+ 3. **If (b)**: Run the specified command, show results, ask confirmation
164
+ 4. **If (c)**: Proceed to Phase 6
165
+
166
+ If user reports the fix is NOT working:
167
+ - Return to Phase 3 (max 2 more attempts)
168
+ - If still failing: escalate with analysis
169
+
170
+ ---
171
+
172
+ ### Phase 6: Commit & Merge
173
+
174
+ **Goal**: Commit the fix and offer to merge back to the original branch.
114
175
 
115
176
  1. **Run `/prizmkit-committer`**:
116
177
  - Commit message: `fix(<scope>): <description>`
117
178
  - Include both fix code and reproduction test
118
179
  - Do NOT push (user decides when to push)
119
- - Do NOT run `/prizmkit-retrospective` — bug fixes do not update `.prizm-docs/` (per project rules: "bugs are incomplete features, recording bug details causes doc bloat with no AI value")
180
+ - Do NOT run `/prizmkit-retrospective` — bug fixes do not update `.prizm-docs/`
120
181
  - `/prizmkit-committer` is a pure commit tool — it does NOT modify `.prizm-docs/` or any project files
121
- 2. **If bug came from bug-fix-list.json**: inform user to update bug status
182
+ 2. **Ask merge preference**:
183
+ ```
184
+ Fix committed on branch `fix/<BUG_ID>-<short-desc>`.
185
+ What would you like to do?
186
+ (a) Merge to <original-branch> and delete fix branch
187
+ (b) Keep fix branch (for PR review workflow)
188
+ (c) Decide later
189
+ ```
190
+ 3. **If (a)**:
191
+ ```bash
192
+ git checkout <original-branch>
193
+ git merge fix/<BUG_ID>-<short-description>
194
+ git branch -d fix/<BUG_ID>-<short-description>
195
+ ```
196
+ 4. **If (b)**: Inform user: "Branch `fix/<BUG_ID>-<short-desc>` retained. Create a PR when ready."
197
+ 5. **If bug came from bug-fix-list.json**: inform user to update bug status
122
198
  ```
123
199
  Bug B-001 fixed and committed.
124
200
  To update the bug list: manually set B-001 status to "fixed" in bug-fix-list.json
125
201
  Or retry the pipeline to pick up remaining bugs.
126
202
  ```
127
203
 
204
+ ## Resume — Interruption Recovery
205
+
206
+ The workflow supports resuming from the last completed phase by detecting existing artifacts.
207
+
208
+ **Detection logic**: Check `.prizmkit/bugfix/<BUG_ID>/` and git branch state:
209
+
210
+ | Artifact Found | Resume From |
211
+ |---------------|------------|
212
+ | (nothing) | Phase 0: Branch Setup |
213
+ | On `fix/<BUG_ID>-*` branch, no artifacts | Phase 1: Triage |
214
+ | `fix-plan.md` only | Phase 3: Fix |
215
+ | `fix-plan.md` + code changes exist | Phase 4: Review |
216
+ | All docs + review passed | Phase 5: User Verification |
217
+ | All docs + committed | Phase 6: Merge decision |
218
+
219
+ **Resume**: If `<BUG_ID>` matches an existing `.prizmkit/bugfix/<BUG_ID>/` directory, resume instead of starting fresh.
220
+
221
+ ---
222
+
128
223
  ## Artifacts
129
224
 
130
225
  Bug fix artifacts are stored at `.prizmkit/bugfix/<BUG_ID>/`:
@@ -138,8 +233,10 @@ Only 2 artifact files per bug, consistent with the pipeline convention.
138
233
  | Dimension | bug-fix-workflow (this skill) | bugfix-pipeline-launcher |
139
234
  |-----------|-------------------------------|--------------------------|
140
235
  | Scope | One bug at a time | All bugs in batch |
141
- | Execution | Interactive, in-session | Background daemon |
236
+ | Execution | Interactive, in-session | Foreground or background daemon |
237
+ | Branch | Creates `fix/<BUG_ID>-*` branch | Pipeline manages branches |
142
238
  | Visibility | Full user interaction at each phase | Async, check status periodically |
239
+ | User verification | Yes (Phase 5) | No (automated) |
143
240
  | Best for | Complex bugs needing user input | Batch of well-defined bugs |
144
241
  | Artifacts | Same (fix-plan.md + fix-report.md) | Same |
145
242
  | Commit prefix | `fix(<scope>):` | `fix(<scope>):` |
@@ -153,6 +250,7 @@ Only 2 artifact files per bug, consistent with the pipeline convention.
153
250
  | Fix causes regressions | Revert, analyze, retry (max 3 rounds) |
154
251
  | Root cause unclear after investigation | Present findings, ask user for guidance |
155
252
  | Affected files are in unfamiliar module | Read `.prizm-docs/` L1/L2 for that module first |
253
+ | Branch conflict during merge | Show conflict, ask user to resolve or keep branch |
156
254
 
157
255
  ## HANDOFF
158
256
 
@@ -161,11 +259,11 @@ Only 2 artifact files per bug, consistent with the pipeline convention.
161
259
  | `bug-planner` | **this skill** | User picks one bug to fix interactively |
162
260
  | `bugfix-pipeline-launcher` | **this skill** | User wants to fix a stuck/complex bug manually |
163
261
  | **this skill** | `bugfix-pipeline-launcher` | After fixing, user wants to continue with remaining bugs |
164
- | **this skill** | `prizmkit-committer` | Built into Phase 5 (pure commit, no doc sync) |
262
+ | **this skill** | `prizmkit-committer` | Built into Phase 6 (pure commit, no doc sync) |
165
263
 
166
264
  ## Output
167
265
 
168
266
  - Fixed code with reproduction test
169
267
  - `.prizmkit/bugfix/<BUG_ID>/fix-plan.md`
170
268
  - `.prizmkit/bugfix/<BUG_ID>/fix-report.md`
171
- - Git commit with `fix(<scope>):` prefix
269
+ - Git commit with `fix(<scope>):` prefix on dedicated fix branch
@@ -5,11 +5,25 @@ description: "Launch and manage the bugfix pipeline from within an AI CLI sessio
5
5
 
6
6
  # Bugfix-Pipeline Launcher
7
7
 
8
- Launch the autonomous bug fix pipeline from within an AI CLI conversation. The pipeline runs as a fully detached background process -- closing the AI CLI session does NOT stop the pipeline.
8
+ Launch the autonomous bug fix pipeline from within an AI CLI conversation. Supports foreground and background execution modes.
9
9
 
10
10
  ### Execution Mode
11
11
 
12
- Always use daemon mode via `dev-pipeline/launch-bugfix-daemon.sh` for start/stop/status/log actions. Foreground `run-bugfix.sh` can be terminated by AI CLI command timeout, while daemon mode survives session timeout — this prevents half-finished bug fixes that leave the codebase in an inconsistent state.
12
+ **Default: Foreground mode** via `dev-pipeline/run-bugfix.sh run` this provides visible output and direct error feedback. Use `launch-bugfix-daemon.sh` only when the user explicitly requests background execution.
13
+
14
+ Foreground `run-bugfix.sh` is preferred because:
15
+ - Immediate visibility of errors and progress
16
+ - No orphaned processes if something goes wrong
17
+ - Session summary artifacts are written reliably
18
+
19
+ Use daemon mode (`launch-bugfix-daemon.sh`) only when:
20
+ - User explicitly requests background/detached execution
21
+ - Pipeline must survive AI CLI session closure
22
+
23
+ **Background mode documentation**: When the user chooses background/daemon mode, record the choice and PID in `.prizmkit/bugfix-pipeline-run.log` (append-only) with timestamp, so the decision is traceable:
24
+ ```
25
+ [2026-03-26T10:30:00] MODE=daemon PID=12345 BUG_LIST=bug-fix-list.json BUGS=3
26
+ ```
13
27
 
14
28
  ### When to Use
15
29
 
@@ -41,7 +55,7 @@ Always use daemon mode via `dev-pipeline/launch-bugfix-daemon.sh` for start/stop
41
55
 
42
56
  Before any action, validate:
43
57
 
44
- 1. **bugfix pipeline exists**: Confirm `dev-pipeline/launch-bugfix-daemon.sh` is present and executable
58
+ 1. **bugfix pipeline exists**: Confirm `dev-pipeline/launch-bugfix-daemon.sh` and `dev-pipeline/run-bugfix.sh` are present and executable
45
59
  2. **For start**: `bug-fix-list.json` must exist in project root (or user-specified path)
46
60
  3. **Dependencies**: `jq`, `python3`, AI CLI (`cbc` or `claude`) must be in PATH
47
61
 
@@ -100,33 +114,61 @@ Detect user intent from their message, then follow the corresponding workflow:
100
114
  --action status 2>/dev/null
101
115
  ```
102
116
 
103
- 4. **Ask user to confirm**: "Ready to launch the bugfix pipeline? It will process N bugs (by severity order) in the background."
117
+ 4. **Ask execution mode**: Present the user with a choice before launching:
118
+ - **(1) Foreground in session (recommended)**: Pipeline runs in the current session via `run-bugfix.sh run`. Visible output and direct error feedback.
119
+ - **(2) Background daemon**: Pipeline runs fully detached via `launch-bugfix-daemon.sh`. Survives session closure. Use only when user explicitly requests background execution.
120
+ - **(3) Manual — show commands**: Display the exact commands the user can run themselves. No execution.
121
+
122
+ Default to option 1 if user says "just run it" or doesn't specify. Default to option 2 only if user explicitly says "background", "detached", or "run in background".
123
+
124
+ **If option 1 (foreground)**:
125
+ ```bash
126
+ dev-pipeline/run-bugfix.sh run bug-fix-list.json
127
+ ```
104
128
 
105
- 5. **Launch**:
129
+ **If option 2 (background)**:
106
130
  ```bash
107
131
  dev-pipeline/launch-bugfix-daemon.sh start bug-fix-list.json
108
132
  ```
109
- If user specified environment overrides (e.g. timeout, retries, verbose):
133
+ After launch, **record the decision** for traceability:
110
134
  ```bash
111
- dev-pipeline/launch-bugfix-daemon.sh start bug-fix-list.json --env "SESSION_TIMEOUT=7200 MAX_RETRIES=5"
135
+ echo "[$(date -u +%Y-%m-%dT%H:%M:%S)] MODE=daemon PID=$(cat dev-pipeline/bugfix-state/daemon.pid 2>/dev/null) BUG_LIST=bug-fix-list.json BUGS=$(python3 -c "import json; print(len(json.load(open('bug-fix-list.json')).get('bugs',[])))")" >> .prizmkit/bugfix-pipeline-run.log
112
136
  ```
137
+ Note: Pipeline runs fully detached. Survives session closure.
138
+
139
+ **If option 3 (manual)**: Print commands and stop. Do not execute anything.
140
+ ```
141
+ # To run in foreground (recommended):
142
+ dev-pipeline/run-bugfix.sh run bug-fix-list.json
143
+
144
+ # To run in background (detached):
145
+ dev-pipeline/launch-bugfix-daemon.sh start bug-fix-list.json
146
+
147
+ # To check status:
148
+ dev-pipeline/run-bugfix.sh status bug-fix-list.json
149
+ ```
150
+
151
+ 5. **Ask user to confirm**: "Ready to launch the bugfix pipeline? It will process N bugs (by severity order)."
152
+
153
+ 6. **Launch** (based on chosen mode — see step 4).
113
154
 
114
- 6. **Verify launch**:
155
+ 7. **Verify launch**:
115
156
  ```bash
116
157
  dev-pipeline/launch-bugfix-daemon.sh status
117
158
  ```
118
159
 
119
- 7. **Start log monitoring** -- Use the Bash tool with `run_in_background: true`:
160
+ 8. **Start log monitoring** (daemon mode only) -- Use the Bash tool with `run_in_background: true`:
120
161
  ```bash
121
162
  tail -f dev-pipeline/bugfix-state/pipeline-daemon.log
122
163
  ```
123
164
  This runs in background so you can continue interacting with the user.
124
165
 
125
- 8. **Report to user**:
126
- - Pipeline PID
166
+ 9. **Report to user**:
167
+ - Execution mode chosen
168
+ - Pipeline PID (daemon mode) or session status (foreground)
127
169
  - Log file location
128
170
  - "You can ask me 'bugfix status' or 'show fix logs' at any time"
129
- - "Closing this session will NOT stop the pipeline"
171
+ - (daemon mode only) "Closing this session will NOT stop the pipeline"
130
172
 
131
173
  ---
132
174
 
@@ -246,9 +288,10 @@ SESSION_TIMEOUT=3600 dev-pipeline/retry-bug.sh B-001 bug-fix-list.json
246
288
  ### Integration Notes
247
289
 
248
290
  - **After bug-planner**: This is the natural next step. When user finishes bug planning and has `bug-fix-list.json`, suggest launching the bugfix pipeline.
249
- - **Session independence**: The bugfix pipeline runs completely detached. User can close the AI CLI, open a new session later, and use this skill to check progress or stop the pipeline.
291
+ - **Session independence**: In daemon mode, the bugfix pipeline runs completely detached. User can close the AI CLI, open a new session later, and use this skill to check progress or stop the pipeline.
250
292
  - **Single instance**: Only one bugfix pipeline can run at a time. The PID file prevents duplicates.
251
293
  - **Feature pipeline coexistence**: Bugfix and feature pipelines use separate state directories (`bugfix-state/` vs `state/`), so they can run simultaneously without conflict.
252
294
  - **State preservation**: Stopping and restarting the bugfix pipeline resumes from where it left off -- completed bugs are not re-fixed.
253
295
  - **Bug ordering**: Bugs are processed by severity (critical → high → medium → low), then by priority number within the same severity.
296
+ - **Background mode traceability**: When daemon mode is chosen, the decision is logged to `.prizmkit/bugfix-pipeline-run.log` with timestamp, PID, and bug count for auditability.
254
297
  - **HANDOFF**: After pipeline completes all bugs, suggest running `prizmkit-retrospective` to capture lessons learned, or checking the fix reports in `.prizmkit/bugfix/`.
@@ -32,7 +32,7 @@ feature-workflow <requirements description>
32
32
 
33
33
  ├── Phase 1: Plan → app-planner → feature-list.json
34
34
 
35
- ├── Phase 2: Launch → dev-pipeline-launcher → background pipeline
35
+ ├── Phase 2: Launch → dev-pipeline-launcher → pipeline execution
36
36
 
37
37
  └── Phase 3: Monitor → track progress → report results
38
38
  ```
@@ -42,7 +42,7 @@ feature-workflow <requirements description>
42
42
  | Phase | Action | Result |
43
43
  |-------|--------|--------|
44
44
  | 1 | Call `app-planner` | `feature-list.json` with N features |
45
- | 2 | Call `dev-pipeline-launcher` | Background pipeline started |
45
+ | 2 | Call `dev-pipeline-launcher` | Pipeline started (execution mode chosen by user via launcher) |
46
46
  | 3 | Monitor progress | Status updates, completion report |
47
47
 
48
48
  ### Why This Skill Exists
@@ -56,6 +56,13 @@ With this skill, users can:
56
56
  1. Say "Build a task management App" and walk away
57
57
  2. All planning + execution happens automatically
58
58
 
59
+ ### Branch Management
60
+
61
+ The dev-pipeline handles branch management per-feature automatically:
62
+ - Each feature is implemented on its own branch by the pipeline
63
+ - Branches are created, committed, and managed by the pipeline session
64
+ - This workflow does NOT create a top-level branch — the pipeline manages granular per-feature branches
65
+
59
66
  ---
60
67
 
61
68
  ## Input Modes
@@ -112,7 +119,7 @@ When user says "add features to existing project" or the project already has fea
112
119
 
113
120
  ## Phase 2: Launch
114
121
 
115
- **Goal**: Start the background development pipeline.
122
+ **Goal**: Start the development pipeline.
116
123
 
117
124
  **STEPS**:
118
125
 
@@ -123,27 +130,20 @@ When user says "add features to existing project" or the project already has fea
123
130
  F-002: Task CRUD (medium complexity)
124
131
  F-003: Task categories (low complexity)
125
132
 
126
- Pipeline will run in background. Close this session will NOT stop it.
127
133
  Proceed? (Y/n)
128
134
  ```
129
135
 
130
- 2. **Ask execution mode**: Before invoking the launcher, present the choice:
131
- - **(1) Background daemon (recommended)**: Runs detached, survives session closure.
132
- - **(2) Foreground in session**: Runs in current session with visible output. Stops if session times out.
133
- - **(3) Manual — show commands**: Display commands only, no execution.
134
-
135
- Pass the chosen mode to `dev-pipeline-launcher`.
136
-
137
- 3. **Invoke `dev-pipeline-launcher` skill**:
136
+ 2. **Invoke `dev-pipeline-launcher` skill**:
138
137
  - The launcher handles all prerequisites checks
139
- - Starts `launch-daemon.sh` in background
140
- - Returns PID and log file location
138
+ - The launcher presents execution mode choices to the user (foreground/background/manual)
139
+ - Do NOT duplicate execution mode selection here — let the launcher handle it
140
+ - Returns PID/status and log file location
141
141
 
142
- 4. **Verify launch success**:
142
+ 3. **Verify launch success**:
143
143
  - Confirm pipeline is running
144
144
  - Record PID and log path for Phase 3
145
145
 
146
- **CHECKPOINT CP-FW-2**: Pipeline launched successfully in background.
146
+ **CHECKPOINT CP-FW-2**: Pipeline launched successfully.
147
147
 
148
148
  ---
149
149
 
@@ -173,7 +173,7 @@ When user says "add features to existing project" or the project already has fea
173
173
 
174
174
  4. **Completion report** (when pipeline finishes all features):
175
175
  ```
176
- Pipeline completed: 3/3 features
176
+ Pipeline completed: 3/3 features
177
177
 
178
178
  Summary:
179
179
  - F-001: User authentication → COMMITTED (feat: user auth)
@@ -190,9 +190,24 @@ When user says "add features to existing project" or the project already has fea
190
190
 
191
191
  ---
192
192
 
193
+ ## Resume — Interruption Recovery
194
+
195
+ The workflow supports resuming by detecting existing state:
196
+
197
+ | State Found | Resume From |
198
+ |-------------|------------|
199
+ | No `feature-list.json` | Phase 1: Plan |
200
+ | `feature-list.json` exists, no pipeline state | Phase 2: Launch |
201
+ | `feature-list.json` + pipeline state exists | Phase 3: Monitor (check status) |
202
+ | All features completed | Report completion, suggest next steps |
203
+
204
+ **Resume**: If `feature-list.json` exists, ask user: "Existing feature plan found with N features. Resume pipeline or re-plan?"
205
+
206
+ ---
207
+
193
208
  ## Interaction During Pipeline
194
209
 
195
- While the pipeline runs in background, the user can continue the conversation:
210
+ While the pipeline runs, the user can continue the conversation:
196
211
 
197
212
  | User says | Action |
198
213
  |-----------|--------|
@@ -220,7 +235,7 @@ While the pipeline runs in background, the user can continue the conversation:
220
235
  | Skill | Relationship |
221
236
  |-------|-------------|
222
237
  | `app-planner` | **Called by Phase 1** — generates feature-list.json |
223
- | `dev-pipeline-launcher` | **Called by Phase 2** — starts background pipeline |
238
+ | `dev-pipeline-launcher` | **Called by Phase 2** — starts pipeline (handles execution mode selection) |
224
239
  | `bug-planner` | **Alternative** — for bug fix workflows |
225
240
  | `bugfix-pipeline-launcher` | **Alternative** — for bug fix pipelines |
226
241
  | `refactor-workflow` | **Alternative** — for code restructuring |
@@ -233,9 +248,11 @@ While the pipeline runs in background, the user can continue the conversation:
233
248
  |-----------|-----------------|------------------|-------------------|
234
249
  | **Purpose** | New features (batch) | Single bug fix (interactive) | Code restructuring |
235
250
  | **Planning Skill** | `app-planner` | None (triage built-in) | None (analysis built-in) |
236
- | **Execution** | Background daemon | In-session, interactive | In-session |
251
+ | **Branch** | Pipeline manages per-feature | `fix/<BUG_ID>-*` | `refactor/<slug>` |
252
+ | **Execution** | Foreground or background daemon | In-session, interactive | In-session |
237
253
  | **Input** | Requirements description | Bug report / stack trace | Module / code target |
238
254
  | **Output** | Multiple `feat()` commits | Single `fix()` commit | Single `refactor()` commit |
255
+ | **User verification** | No (pipeline automated) | Yes (Phase 5) | Yes (Phase 5) |
239
256
  | **Batch alternative** | (this is the batch flow) | `bug-planner` + `bugfix-pipeline-launcher` | N/A |
240
257
 
241
258
  ---
@@ -247,7 +264,7 @@ All internal asset paths use `${SKILL_DIR}` placeholder for cross-IDE compatibil
247
264
  ## Output
248
265
 
249
266
  - `feature-list.json` (Phase 1 artifact)
250
- - Background pipeline running (Phase 2)
267
+ - Pipeline execution (Phase 2)
251
268
  - Progress updates (Phase 3)
252
269
  - Multiple git commits with `feat(<scope>):` prefix
253
270
  - Updated `.prizm-docs/` (via prizmkit-retrospective per feature)
@@ -1,12 +1,12 @@
1
1
  ---
2
2
  name: "refactor-workflow"
3
3
  tier: 1
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', 'code refactoring'. (project)"
4
+ description: "End-to-end refactor workflow: analyze → plan → 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 5-phase behavior-preserving pipeline with mandatory test gates after each task.
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,22 +23,24 @@ End-to-end orchestration skill for code refactoring and optimization. Chains exi
23
23
 
24
24
  ```
25
25
  refactor-workflow
26
+ → Phase 0: Branch → refactor/<slug> branch
26
27
  → Phase 1: Analyze → refactor-analysis.md
27
28
  → Phase 2: Plan → plan.md (including Tasks section)
28
29
  → Phase 3: Implement → (code)
29
30
  → Phase 4: Review → (review report)
30
- → Phase 5: Commit → git commit
31
+ → Phase 5: Verify & Commit → git commit + merge decision
31
32
  ```
32
33
 
33
34
  ### Pipeline Phases
34
35
 
35
36
  | Phase | Name | Skill Used | Artifact |
36
37
  |-------|------|-----------|----------|
38
+ | 0 | Branch Setup | git | → `refactor/<slug>` branch |
37
39
  | 1 | Analyze (Code Analysis) | Built-in code analysis + code reading | → `refactor-analysis.md` |
38
40
  | 2 | Plan (Refactor Plan & Tasks) | `/prizmkit-plan` | → `plan.md` (with Tasks section) |
39
41
  | 3 | Implement | `/prizmkit-implement` | (code changes) |
40
42
  | 4 | Code Review | `/prizmkit-code-review` | (review report) |
41
- | 5 | Commit | `/prizmkit-committer` | git commit |
43
+ | 5 | Verify & Commit | `/prizmkit-committer` | git commit + merge |
42
44
 
43
45
  ### Key Principles
44
46
 
@@ -61,6 +63,26 @@ Refactor artifacts stored at `.prizmkit/refactor/<refactor-slug>/`:
61
63
 
62
64
  ---
63
65
 
66
+ ## Phase 0: Branch Setup
67
+
68
+ **Goal**: Create an isolated working branch to keep main clean.
69
+
70
+ 1. **Check current branch**:
71
+ ```bash
72
+ git branch --show-current
73
+ ```
74
+ 2. **If on `main` or a shared branch**: Create and switch to refactor branch:
75
+ ```bash
76
+ git checkout -b refactor/<refactor-slug>
77
+ ```
78
+ Example: `git checkout -b refactor/extract-auth-middleware`
79
+ 3. **If already on a refactor branch**: Confirm with user: "Continue on current branch `<branch-name>`, or create a new one?"
80
+ 4. **Record the original branch name** for later merge.
81
+
82
+ **CHECKPOINT CP-RW-0**: On a dedicated refactor branch, not main/shared branch.
83
+
84
+ ---
85
+
64
86
  ## Phase 1: Analyze — Code Analysis
65
87
 
66
88
  **Goal**: Assess current code state, identify refactoring targets, establish baseline.
@@ -163,23 +185,44 @@ Refactor artifacts stored at `.prizmkit/refactor/<refactor-slug>/`:
163
185
 
164
186
  ---
165
187
 
166
- ## Phase 5: Commit
188
+ ## Phase 5: Verify, Commit & Merge
167
189
 
168
- **Goal**: Commit with refactor convention.
190
+ **Goal**: Let user verify, commit with refactor convention, and merge back.
169
191
 
170
192
  **STEPS:**
171
193
 
172
- 1. **Invoke `/prizmkit-retrospective`** (Job 1: structural sync only):
194
+ 1. **User verification** (optional):
195
+ - Ask user: "Refactoring complete and all tests pass. Would you like to verify before committing?"
196
+ - **(a) Run the app** — Start dev server for manual verification
197
+ - **(b) Run a specific command** — Specify a test or script
198
+ - **(c) Skip** — Proceed to commit (tests already pass)
199
+ - If user reports issues: return to Phase 3
200
+ 2. **Invoke `/prizmkit-retrospective`** (Job 1: structural sync only):
173
201
  - Update KEY_FILES/INTERFACES/DEPENDENCIES in affected `.prizm-docs/` files
174
202
  - Skip knowledge injection unless refactoring revealed a genuinely new pitfall (e.g. a non-obvious coupling)
175
203
  - If structural changes are significant (module split/merge), update L1 doc
176
204
  - Stage doc changes: `git add .prizm-docs/`
177
- 2. **Invoke `/prizmkit-committer`**:
205
+ 3. **Invoke `/prizmkit-committer`**:
178
206
  - Commit message: `refactor(<scope>): <description>`
179
207
  - Include all refactored code + any test updates
180
208
  - Do NOT push
181
-
182
- **CHECKPOINT CP-RW-5**: Commit recorded with `refactor()` prefix.
209
+ 4. **Ask merge preference**:
210
+ ```
211
+ Refactoring committed on branch `refactor/<slug>`.
212
+ What would you like to do?
213
+ (a) Merge to <original-branch> and delete refactor branch
214
+ (b) Keep refactor branch (for PR review workflow)
215
+ (c) Decide later
216
+ ```
217
+ 5. **If (a)**:
218
+ ```bash
219
+ git checkout <original-branch>
220
+ git merge refactor/<slug>
221
+ git branch -d refactor/<slug>
222
+ ```
223
+ 6. **If (b)**: Inform user: "Branch `refactor/<slug>` retained. Create a PR when ready."
224
+
225
+ **CHECKPOINT CP-RW-5**: Commit recorded with `refactor()` prefix. Merge decision made.
183
226
 
184
227
  ---
185
228
 
@@ -188,7 +231,7 @@ Refactor artifacts stored at `.prizmkit/refactor/<refactor-slug>/`:
188
231
  For single-file refactoring (rename, extract method, <30 lines changed):
189
232
 
190
233
  ```
191
- Phase 1 (Analyze) → Phase 2 (Simplified Plan) → Phase 3 (Implement) → Phase 4 (Review) → Phase 5 (Commit)
234
+ Phase 0 (Branch) → Phase 1 (Analyze) → Phase 2 (Simplified Plan) → Phase 3 (Implement) → Phase 4 (Review) → Phase 5 (Commit & Merge)
192
235
  ```
193
236
 
194
237
  Skip Phase 2's detailed planning process, but still generate a lightweight `plan.md` with a simplified Tasks section (typically 1-2 tasks).
@@ -206,11 +249,13 @@ Skip Phase 2's detailed planning process, but still generate a lightweight `plan
206
249
  - Single-task refactors typically have just one task in plan.md
207
250
 
208
251
  **Fast Path still requires:**
252
+ - Refactor branch (Phase 0)
209
253
  - refactor-analysis.md (lightweight version with baseline)
210
254
  - plan.md (simplified, 1-2 tasks)
211
255
  - Full test suite run after implementation
212
256
  - Code review
213
257
  - `refactor(<scope>):` commit convention
258
+ - Merge decision
214
259
 
215
260
  ---
216
261
 
@@ -218,15 +263,16 @@ Skip Phase 2's detailed planning process, but still generate a lightweight `plan
218
263
 
219
264
  The pipeline supports resuming from the last completed phase by detecting existing artifacts.
220
265
 
221
- **Detection logic**: Check `.prizmkit/refactor/<slug>/` for:
266
+ **Detection logic**: Check `.prizmkit/refactor/<slug>/` and git branch state:
222
267
 
223
268
  | Artifact Found | Resume From |
224
269
  |---------------|------------|
225
- | (nothing) | Phase 1: Analyze |
270
+ | (nothing) | Phase 0: Branch Setup |
271
+ | On `refactor/<slug>` branch, no artifacts | Phase 1: Analyze |
226
272
  | `refactor-analysis.md` only | Phase 2: Plan |
227
273
  | `refactor-analysis.md` + `plan.md` | Phase 3: Implement |
228
274
  | All docs + code changes exist | Phase 4: Review |
229
- | All docs + review passed | Phase 5: Commit |
275
+ | All docs + review passed | Phase 5: Verify & Commit |
230
276
 
231
277
  **Resume**: If `<slug>` matches an existing `.prizmkit/refactor/<slug>/` directory, resume instead of starting fresh.
232
278
 
@@ -244,6 +290,7 @@ The pipeline supports resuming from the last completed phase by detecting existi
244
290
  | Review fails after 2 rounds | Escalate with review findings |
245
291
  | Refactoring creates circular dependency | STOP, revise plan |
246
292
  | Performance regression detected | STOP, investigate, revise approach |
293
+ | Branch conflict during merge | Show conflict, ask user to resolve or keep branch |
247
294
 
248
295
  ---
249
296
 
@@ -259,23 +306,24 @@ The pipeline supports resuming from the last completed phase by detecting existi
259
306
  | `/prizmkit-retrospective` | Phase 5: structural sync before commit (Job 1 only, skip knowledge injection unless new pitfall) |
260
307
  | `feature-workflow` | Handoff target when new behavior is needed |
261
308
  | `/prizmkit-specify` | NOT used (no user stories for refactoring) |
262
- | `/prizmkit-analyze` | NOT used (no spec plan consistency needed) |
309
+ | `/prizmkit-analyze` | NOT used (no spec <-> plan consistency needed) |
263
310
 
264
311
  ---
265
312
 
266
313
  ## Comparison with Feature and Bug Fix Pipelines
267
314
 
268
- | Dimension | Feature Workflow | Refactor Workflow | Bug Fix Pipeline |
315
+ | Dimension | Feature Workflow | Refactor Workflow | Bug Fix Workflow |
269
316
  |-----------|-----------------|-------------------|------------------|
270
317
  | Input | Natural language requirement | Module/code target | Bug description |
271
- | Pipeline Phases | 6 (Fast: 4) | 5 (Fast: 3) | 5 (Fast: 3) |
272
- | Phase 1 | Specify (spec.md) | Analyze (refactor-analysis.md) | Triage (fix-plan.md) |
318
+ | Branch | Pipeline manages per-feature | `refactor/<slug>` | `fix/<BUG_ID>-*` |
319
+ | Pipeline Phases | 3 (plan → launch → monitor) | 6 (branch → analyze → plan → implement → review → commit) | 7 (branch → triage → reproduce → fix → review → verify → commit) |
320
+ | Phase 1 | Plan (app-planner) | Analyze (refactor-analysis.md) | Triage (fix-plan.md) |
273
321
  | Artifact Path | `.prizmkit/specs/<slug>/` | `.prizmkit/refactor/<slug>/` | `.prizmkit/bugfix/<id>/` |
274
322
  | Commit Prefix | `feat(<scope>):` | `refactor(<scope>):` | `fix(<scope>):` |
275
- | REGISTRY Update | ✅ | ❌ | ❌ |
276
323
  | Test Strategy | TDD per task | Full suite after EVERY task | Reproduction test |
277
- | Scope Guard | N/A | (enforced) | N/A |
278
- | Behavior Change | Expected | Forbidden | Fix behavior |
324
+ | Scope Guard | N/A | Enforced | N/A |
325
+ | Behavior Change | Expected | Forbidden | Fix behavior |
326
+ | User Verification | No (pipeline) | Yes (Phase 5) | Yes (Phase 5) |
279
327
 
280
328
  ## Output
281
329
 
@@ -283,5 +331,5 @@ The pipeline supports resuming from the last completed phase by detecting existi
283
331
  - `plan.md` with Tasks section (Phase 2 artifact)
284
332
  - Refactored implementation code (Phase 3)
285
333
  - Code review report (Phase 4, conversation only)
286
- - Git commit with `refactor(<scope>):` prefix (Phase 5)
334
+ - Git commit with `refactor(<scope>):` prefix on dedicated refactor branch (Phase 5)
287
335
  - Updated `.prizm-docs/` (if applicable)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prizmkit",
3
- "version": "1.0.108",
3
+ "version": "1.0.109",
4
4
  "description": "Create a new PrizmKit-powered project with clean initialization — no framework dev files, just what you need.",
5
5
  "type": "module",
6
6
  "bin": {