prizmkit 1.1.111 → 1.1.112
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/agents/prizm-dev-team-reviewer.md +12 -1
- package/bundled/dev-pipeline/prizmkit_runtime/interoperability.py +1 -0
- package/bundled/dev-pipeline/scripts/generate-bootstrap-prompt.py +19 -73
- package/bundled/dev-pipeline/scripts/generate-bugfix-prompt.py +283 -421
- package/bundled/dev-pipeline/scripts/generate-recovery-prompt.py +1 -1
- package/bundled/dev-pipeline/scripts/generate-refactor-prompt.py +259 -481
- package/bundled/dev-pipeline/scripts/init-bugfix-pipeline.py +34 -0
- package/bundled/dev-pipeline/scripts/init-pipeline.py +12 -0
- package/bundled/dev-pipeline/scripts/init-refactor-pipeline.py +24 -1
- package/bundled/dev-pipeline/scripts/prompt_framework.py +312 -0
- package/bundled/dev-pipeline/scripts/update-bug-status.py +87 -20
- package/bundled/dev-pipeline/scripts/update-feature-status.py +82 -16
- package/bundled/dev-pipeline/scripts/update-refactor-status.py +68 -28
- package/bundled/dev-pipeline/scripts/utils.py +171 -0
- package/bundled/dev-pipeline/templates/bootstrap-prompt.md +1 -1
- package/bundled/dev-pipeline/templates/bootstrap-tier2.md +10 -18
- package/bundled/dev-pipeline/templates/bootstrap-tier3.md +14 -25
- package/bundled/dev-pipeline/templates/bug-fix-list-schema.json +9 -1
- package/bundled/dev-pipeline/templates/bugfix-bootstrap-prompt.md +11 -8
- package/bundled/dev-pipeline/templates/refactor-bootstrap-prompt.md +122 -182
- package/bundled/dev-pipeline/templates/sections/bugfix-artifacts.md +16 -0
- package/bundled/dev-pipeline/templates/sections/bugfix-critical-paths.md +12 -0
- package/bundled/dev-pipeline/templates/sections/bugfix-mission.md +9 -0
- package/bundled/dev-pipeline/templates/sections/bugfix-phase-commit-report.md +31 -0
- package/bundled/dev-pipeline/templates/sections/bugfix-phase-critic.md +22 -0
- package/bundled/dev-pipeline/templates/sections/bugfix-phase-diagnose-plan.md +23 -0
- package/bundled/dev-pipeline/templates/sections/bugfix-phase-implement.md +20 -0
- package/bundled/dev-pipeline/templates/sections/bugfix-phase-init.md +9 -0
- package/bundled/dev-pipeline/templates/sections/bugfix-phase-manual-verification.md +15 -0
- package/bundled/dev-pipeline/templates/sections/bugfix-phase-review.md +29 -0
- package/bundled/dev-pipeline/templates/sections/bugfix-reminders.md +11 -0
- package/bundled/dev-pipeline/templates/sections/bugfix-session-context.md +7 -0
- package/bundled/dev-pipeline/templates/sections/bugfix-session-status.md +31 -0
- package/bundled/dev-pipeline/templates/sections/bugfix-task-contract.md +40 -0
- package/bundled/dev-pipeline/templates/sections/failure-capture.md +2 -2
- package/bundled/dev-pipeline/templates/sections/phase-browser-verification-auto.md +1 -1
- package/bundled/dev-pipeline/templates/sections/refactor-artifacts.md +17 -0
- package/bundled/dev-pipeline/templates/sections/refactor-critical-paths.md +13 -0
- package/bundled/dev-pipeline/templates/sections/refactor-mission.md +9 -0
- package/bundled/dev-pipeline/templates/sections/refactor-phase-commit-report.md +37 -0
- package/bundled/dev-pipeline/templates/sections/refactor-phase-critic.md +22 -0
- package/bundled/dev-pipeline/templates/sections/refactor-phase-implement.md +16 -0
- package/bundled/dev-pipeline/templates/sections/refactor-phase-init.md +9 -0
- package/bundled/dev-pipeline/templates/sections/refactor-phase-plan.md +22 -0
- package/bundled/dev-pipeline/templates/sections/refactor-phase-review.md +19 -0
- package/bundled/dev-pipeline/templates/sections/refactor-reminders.md +11 -0
- package/bundled/dev-pipeline/templates/sections/refactor-session-context.md +7 -0
- package/bundled/dev-pipeline/templates/sections/refactor-session-status.md +28 -0
- package/bundled/dev-pipeline/templates/sections/refactor-task-contract.md +52 -0
- package/bundled/dev-pipeline/tests/test_generate_bootstrap_prompt.py +17 -5
- package/bundled/dev-pipeline/tests/test_python_runner_parity.py +197 -0
- package/bundled/dev-pipeline/tests/test_unified_cli.py +6 -2
- package/bundled/dev-pipeline/tests/test_utils.py +66 -1
- package/bundled/skills/_metadata.json +1 -1
- package/bundled/skills/app-planner/SKILL.md +8 -7
- package/bundled/skills/app-planner/references/project-brief-guide.md +2 -2
- package/bundled/skills/app-planner/references/rules/backend/derivation-rules.md +1 -1
- package/bundled/skills/app-planner/references/rules/frontend/derivation-rules.md +1 -1
- package/bundled/skills/app-planner/references/rules-configuration.md +53 -26
- package/bundled/skills/bug-fix-workflow/SKILL.md +191 -336
- package/bundled/skills/bug-planner/SKILL.md +6 -5
- package/bundled/skills/bug-planner/references/critic-and-verification.md +3 -3
- package/bundled/skills/bug-planner/references/schema-validation.md +2 -1
- package/bundled/skills/bug-planner/scripts/validate-bug-list.py +30 -1
- package/bundled/skills/bugfix-pipeline-launcher/SKILL.md +16 -16
- package/bundled/skills/bugfix-pipeline-launcher/references/configuration.md +2 -2
- package/bundled/skills/feature-pipeline-launcher/SKILL.md +19 -11
- package/bundled/skills/feature-planner/SKILL.md +9 -11
- package/bundled/skills/feature-planner/assets/planning-guide.md +1 -1
- package/bundled/skills/feature-planner/references/decomposition-patterns.md +1 -1
- package/bundled/skills/feature-planner/references/error-recovery.md +2 -1
- package/bundled/skills/feature-planner/references/incremental-feature-planning.md +2 -2
- package/bundled/skills/feature-planner/references/new-project-planning.md +35 -39
- package/bundled/skills/feature-planner/scripts/validate-and-generate.py +1 -1
- package/bundled/skills/feature-workflow/SKILL.md +169 -298
- package/bundled/skills/prizmkit/SKILL.md +103 -57
- package/bundled/skills/prizmkit-code-review/SKILL.md +97 -116
- package/bundled/skills/prizmkit-code-review/references/review-report-template.md +1 -0
- package/bundled/skills/prizmkit-code-review/references/reviewer-agent-prompt.md +12 -1
- package/bundled/skills/prizmkit-committer/SKILL.md +59 -47
- package/bundled/skills/prizmkit-deploy/SKILL.md +162 -381
- package/bundled/skills/prizmkit-deploy/references/ssh-adapter-flow.md +220 -0
- package/bundled/skills/prizmkit-implement/SKILL.md +51 -40
- package/bundled/skills/prizmkit-init/SKILL.md +4 -3
- package/bundled/skills/prizmkit-plan/SKILL.md +85 -70
- package/bundled/skills/prizmkit-prizm-docs/SKILL.md +94 -73
- package/bundled/skills/prizmkit-prizm-docs/assets/prizm-docs-format.md +20 -18
- package/bundled/skills/prizmkit-prizm-docs/references/op-update.md +18 -14
- package/bundled/skills/prizmkit-retrospective/SKILL.md +56 -48
- package/bundled/skills/prizmkit-retrospective/references/structural-sync-steps.md +79 -27
- package/bundled/skills/prizmkit-test/SKILL.md +138 -141
- package/bundled/skills/prizmkit-test/references/examples.md +10 -8
- package/bundled/skills/prizmkit-test/references/test-generation-steps.md +1 -1
- package/bundled/skills/prizmkit-test/references/test-report-template.md +2 -2
- package/bundled/skills/recovery-workflow/SKILL.md +195 -256
- package/bundled/skills/recovery-workflow/evals/evals.json +21 -13
- package/bundled/skills/recovery-workflow/references/detection.md +48 -39
- package/bundled/skills/recovery-workflow/scripts/detect-recovery-state.py +258 -322
- package/bundled/skills/refactor-pipeline-launcher/SKILL.md +29 -11
- package/bundled/skills/refactor-planner/SKILL.md +2 -2
- package/bundled/skills/refactor-planner/references/behavior-preservation.md +24 -19
- package/bundled/skills/refactor-planner/references/fast-path.md +2 -4
- package/bundled/skills/refactor-planner/references/planning-phases.md +2 -2
- package/bundled/skills/refactor-workflow/SKILL.md +173 -307
- package/package.json +1 -1
- package/src/scaffold.js +5 -0
- package/bundled/dev-pipeline/templates/agent-prompts/reviewer-review.md +0 -6
- package/bundled/skills/feature-workflow/references/brainstorm-guide.md +0 -137
- package/bundled/skills/refactor-workflow/references/brainstorm-guide.md +0 -116
|
@@ -1,379 +1,245 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: "refactor-workflow"
|
|
3
|
-
description: "
|
|
3
|
+
description: "Thin L3 refactor workflow router for behavior-preserving code restructuring. Clarifies enough to choose Fast Path, Pipeline Path, or existing-list launch; routes deep code analysis and item decomposition to refactor-planner and execution configuration to refactor-pipeline-launcher. Use when the user wants to refactor, clean up, restructure, decouple, simplify, migrate internal structure, extract modules, or run an existing refactor list without changing product behavior. Trigger on: 'refactor', 'clean up code', 'restructure', 'optimize code structure', 'extract module', 'decouple', 'code migration', 'batch refactor', 'run refactor list'."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Refactor Workflow
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Thin L3 entry point for behavior-preserving refactoring. This workflow routes the user to the right path, prepares a concise handoff brief, and avoids duplicating `refactor-planner` or `refactor-pipeline-launcher` internals.
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
- **Pipeline Path** — complex or batch refactors are planned with `refactor-planner`, launched with `refactor-pipeline-launcher`, then monitored.
|
|
10
|
+
## Responsibility Boundary
|
|
12
11
|
|
|
13
|
-
This
|
|
12
|
+
This workflow owns:
|
|
13
|
+
- Scenario recognition: Fast Path, Pipeline Path, existing-list launch, or behavior-change reroute.
|
|
14
|
+
- Lightweight behavior-risk triage.
|
|
15
|
+
- User path selection through `AskUserQuestion`.
|
|
16
|
+
- Prompt brief handoff to Fast Path L1 skills, `refactor-planner`, or `refactor-pipeline-launcher`.
|
|
17
|
+
- Continuation after `refactor-planner` when the user entered through this workflow.
|
|
14
18
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
-
|
|
19
|
-
- "Extract shared logic into a separate module", "Optimize code structure"
|
|
20
|
-
- "Do this small behavior-preserving cleanup now"
|
|
21
|
-
- "Batch refactor these modules", "Code refactoring across multiple files"
|
|
22
|
-
- Code has accumulated tech debt that needs structural improvement
|
|
23
|
-
- Module needs to be split, merged, or reorganized
|
|
24
|
-
|
|
25
|
-
**Do NOT use this skill when:**
|
|
26
|
-
- User only wants to plan refactoring without execution → use `refactor-planner` directly
|
|
27
|
-
- User only wants to launch an existing `.prizmkit/plans/refactor-list.json` → use `refactor-pipeline-launcher`
|
|
28
|
-
- User wants to add features → use `feature-workflow`
|
|
29
|
-
- User wants to fix bugs → use `bug-fix-workflow` or `bug-planner` + `bugfix-pipeline-launcher`
|
|
30
|
-
|
|
31
|
-
---
|
|
32
|
-
|
|
33
|
-
## Overview
|
|
34
|
-
|
|
35
|
-
The shared contract is:
|
|
36
|
-
|
|
37
|
-
1. **Brainstorm** — clarify refactoring type, collect reference materials, read relevant code/docs/tests, and confirm behavior-preservation requirements.
|
|
38
|
-
2. **Assess difficulty and behavior risk** — decide whether the request is a simple behavior-preserving Fast Path candidate or a complex/batch Pipeline Path candidate.
|
|
39
|
-
3. **AskUserQuestion approach selection** — present selectable options; never silently choose the path.
|
|
40
|
-
4. **Execute selected path**:
|
|
41
|
-
- **Fast Path**: `/prizmkit-plan` → `/prizmkit-implement` with behavior-preservation tests/checks → `/prizmkit-code-review` → `/prizmkit-retrospective` → `/prizmkit-committer` in the current workspace.
|
|
42
|
-
- **Pipeline Path**: `refactor-planner` → `refactor-pipeline-launcher` → monitoring.
|
|
43
|
-
|
|
44
|
-
### Terminology
|
|
45
|
-
|
|
46
|
-
| Term | Meaning |
|
|
47
|
-
|------|---------|
|
|
48
|
-
| **Fast Path** | Current-session/current-workspace implementation for simple, behavior-preserving refactors. It does not create or consume `.prizmkit/plans/refactor-list.json` and does not start the refactor pipeline. |
|
|
49
|
-
| **Pipeline Path** | Complex or batch refactor execution. Planner handoff goes to `refactor-planner`; launcher handoff goes to `refactor-pipeline-launcher`; monitoring follows only after launch. |
|
|
50
|
-
| **Current session** | The interactive AI CLI session that is already discussing the refactor with the user. |
|
|
51
|
-
| **Current workspace** | The current git checkout and working tree, not a background pipeline worktree/session. |
|
|
52
|
-
| **Behavior preservation** | External behavior, public contracts, tests, and user-visible outcomes remain unchanged unless the user explicitly approves a behavior change as a feature. |
|
|
53
|
-
| **Monitoring** | Status/log follow-up for a launched refactor pipeline; it is not part of the Fast Path. |
|
|
54
|
-
|
|
55
|
-
### Workspace and Branch Model
|
|
56
|
-
|
|
57
|
-
- **Fast Path**: work happens in the current workspace and current interactive session. Use the current branch unless the project policy or user explicitly asks to create a branch.
|
|
58
|
-
- **Pipeline Path**: `refactor-pipeline-launcher` and the dev-pipeline manage per-refactor branches/worktrees. This workflow does not create a top-level branch before handing off to the launcher.
|
|
59
|
-
|
|
60
|
-
---
|
|
61
|
-
|
|
62
|
-
## Input Modes
|
|
63
|
-
|
|
64
|
-
**Mode A: Natural language refactoring goal** (default)
|
|
65
|
-
|
|
66
|
-
Natural language description of the refactoring goals. Can be:
|
|
67
|
-
- A simple behavior-preserving refactor: "Extract this helper function and keep behavior unchanged"
|
|
68
|
-
- A module target: "Refactor the auth module — extract shared middleware, simplify the token flow"
|
|
69
|
-
- A batch of refactors: "Clean up the payment service, decouple the notification module, and extract common utilities"
|
|
70
|
-
- An incremental request: "Also refactor the logging layer to use structured logging"
|
|
71
|
-
|
|
72
|
-
Flow: brainstorm → complexity/behavior-risk assessment → AskUserQuestion → Fast Path or Pipeline Path.
|
|
73
|
-
|
|
74
|
-
**Mode B: Existing `.prizmkit/plans/refactor-list.json`**
|
|
75
|
-
|
|
76
|
-
When the user says "run pipeline from existing file" or `.prizmkit/plans/refactor-list.json` already exists and should be executed:
|
|
77
|
-
- Skip brainstorm and `refactor-planner`
|
|
78
|
-
- Invoke `refactor-pipeline-launcher` directly
|
|
79
|
-
- Monitor and report progress
|
|
80
|
-
|
|
81
|
-
**Mode C: Incremental refactor request**
|
|
82
|
-
|
|
83
|
-
When user says "add more refactors":
|
|
84
|
-
- Brainstorm only the new refactoring goals
|
|
85
|
-
- Assess whether the new scope is simple and behavior-preserving enough for Fast Path
|
|
86
|
-
- For simple work: use Fast Path in the current workspace
|
|
87
|
-
- For complex or batch work: invoke `refactor-planner` in incremental mode, then `refactor-pipeline-launcher`
|
|
88
|
-
|
|
89
|
-
---
|
|
90
|
-
|
|
91
|
-
## Phase 1: Brainstorm — Deep Refactoring Goal Clarification
|
|
92
|
-
|
|
93
|
-
**Goal**: Through interactive Q&A and deep code reading, transform the user's rough refactoring idea into fully clarified, implementation-ready refactoring goals. This phase is the foundation for safe, behavior-preserving code changes — vague goals produce risky refactors.
|
|
94
|
-
|
|
95
|
-
**CRITICAL RULE**: The number of questions is **unlimited**. Do NOT rush through this phase. Ask as many rounds as needed until every aspect is clear. Refactoring is inherently risky — thorough understanding prevents broken behavior.
|
|
96
|
-
|
|
97
|
-
### Step 1.1: Clarify Refactoring Type
|
|
98
|
-
|
|
99
|
-
**First question** — ask the user to classify the refactoring approach:
|
|
100
|
-
|
|
101
|
-
| Type | Description | Example |
|
|
102
|
-
|------|-------------|---------|
|
|
103
|
-
| **Incremental** | Piece-by-piece restructuring, each step independently safe | "Gradually extract shared utilities over several PRs" |
|
|
104
|
-
| **Comprehensive** | Full rewrite of a module/area in one pass | "Rewrite the auth module with new architecture" |
|
|
105
|
-
| **Targeted** | Specific, focused change to a particular part | "Extract the validation logic from the controller" |
|
|
106
|
-
|
|
107
|
-
Then ask:
|
|
108
|
-
- **What** code needs restructuring (modules, files, patterns)
|
|
109
|
-
- **Why** it needs refactoring (tech debt, coupling, complexity, readability, performance structure)
|
|
110
|
-
- **What outcome** they want (target architecture, desired structure, quality goals)
|
|
111
|
-
- **What behavior must remain unchanged** (public APIs, outputs, workflows, tests, performance-sensitive paths)
|
|
112
|
-
|
|
113
|
-
### Step 1.2: Collect Reference Materials
|
|
19
|
+
This workflow does not own:
|
|
20
|
+
- Deep code analysis, item decomposition, dependency ordering, behavior-preservation strategy selection, schema validation, or plan review gates — those belong to `refactor-planner`.
|
|
21
|
+
- Execution mode, runtime configuration, preflight, command assembly, status/log/stop/retry details — those belong to `refactor-pipeline-launcher`.
|
|
22
|
+
- Product behavior changes — those should route to feature work unless explicitly framed as a behavior-preserving migration.
|
|
114
23
|
|
|
115
|
-
|
|
116
|
-
1. Acknowledge what was received: "I received the following materials: [list]"
|
|
117
|
-
2. Read/fetch all provided materials immediately
|
|
118
|
-
3. You MUST still ask: "Are there any additional materials you'd like to provide?"
|
|
119
|
-
4. NEVER skip this collection step just because the user already provided some materials
|
|
24
|
+
## Behavior-Preservation Boundary
|
|
120
25
|
|
|
121
|
-
|
|
26
|
+
Refactoring means external behavior remains unchanged:
|
|
27
|
+
- Public product behavior stays the same.
|
|
28
|
+
- User-visible outcomes stay the same.
|
|
29
|
+
- Public contracts stay stable unless the user explicitly confirms a compatibility-preserving migration.
|
|
30
|
+
- Tests and behavior checks are used to prove the change is structural.
|
|
122
31
|
|
|
123
|
-
|
|
124
|
-
1. **Code paths** — "Which files or directories are the main targets? Any specific files I should look at?"
|
|
125
|
-
2. **Design documents** — "Do you have any design docs, architecture diagrams, or refactoring proposals I should read?"
|
|
126
|
-
3. **Knowledge docs** — "Are there related `.prizmkit/prizm-docs/`, README files, or internal wiki pages for the target area?"
|
|
127
|
-
4. **Related issues/PRs** — "Any related issues, PRs, or previous refactoring attempts I should be aware of?"
|
|
128
|
-
5. **Behavior checks** — "Which tests, commands, or manual scenarios prove behavior must stay the same?"
|
|
32
|
+
If the request requires changed product behavior, new user-facing functionality, or a breaking public API change, route to `feature-workflow`. Internal API, import path, or module boundary changes can still be refactoring when external behavior remains unchanged and the planner can define a safe migration strategy.
|
|
129
33
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
### Step 1.3: Parallel Deep Reading
|
|
133
|
-
|
|
134
|
-
Read `${SKILL_DIR}/references/brainstorm-guide.md` §Step 1.3 for the parallel agent dispatch procedure — spawn 4 agents (A: code paths, B: documents, C: prizm-docs, D: test files) to build comprehensive understanding before discussion. Synthesize findings before proceeding.
|
|
135
|
-
|
|
136
|
-
### Step 1.4: Discuss Refactoring Plan
|
|
34
|
+
## When to Use
|
|
137
35
|
|
|
138
|
-
|
|
36
|
+
Use this workflow when the user wants a guided refactoring entry point:
|
|
37
|
+
- Clean up or restructure existing code.
|
|
38
|
+
- Extract modules, helpers, middleware, or shared logic.
|
|
39
|
+
- Decouple modules or simplify structure.
|
|
40
|
+
- Plan or execute behavior-preserving migrations.
|
|
41
|
+
- Decide whether a refactor is small enough for current-session Fast Path or should use the refactor pipeline.
|
|
42
|
+
- Continue from an existing `.prizmkit/plans/refactor-list.json`.
|
|
139
43
|
|
|
140
|
-
|
|
44
|
+
Do not use this workflow when the user only wants:
|
|
45
|
+
- Refactor planning without execution intent -> use `refactor-planner`.
|
|
46
|
+
- Launch/status/logs/retry for an existing refactor list -> use `refactor-pipeline-launcher`.
|
|
47
|
+
- New functionality or changed product behavior -> use `feature-workflow`.
|
|
48
|
+
- Bug repair -> use `bug-fix-workflow` or the bug pipeline skills.
|
|
141
49
|
|
|
142
|
-
|
|
50
|
+
## Route Overview
|
|
143
51
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
52
|
+
| User situation | Route |
|
|
53
|
+
|---|---|
|
|
54
|
+
| Simple local behavior-preserving refactor | Fast Path in current workspace |
|
|
55
|
+
| Batch, cross-module, high-risk, weak-test, or multi-step refactor | `refactor-planner` -> return here -> `refactor-pipeline-launcher` |
|
|
56
|
+
| Product behavior change or breaking public API change | Route to `feature-workflow` |
|
|
57
|
+
| User explicitly says to run an existing refactor list | `refactor-pipeline-launcher` |
|
|
58
|
+
| Refactor list exists but the user did not explicitly ask to run it | Ask launch / inspect / update |
|
|
148
59
|
|
|
149
|
-
|
|
60
|
+
## Route Selection
|
|
150
61
|
|
|
151
|
-
### Step 1
|
|
62
|
+
### Step 1: Detect the entry mode
|
|
152
63
|
|
|
153
|
-
|
|
64
|
+
Classify the request before asking detailed refactoring questions:
|
|
154
65
|
|
|
155
|
-
|
|
66
|
+
- **Behavior-preserving refactor**: the user asks to clean up, restructure, simplify, extract, decouple, or migrate implementation structure.
|
|
67
|
+
- **Behavior change**: the user asks to change what the product does, add functionality, or break a public contract.
|
|
68
|
+
- **Existing list launch**: the user explicitly asks to run, start, resume, check, retry, or stop `.prizmkit/plans/refactor-list.json`.
|
|
69
|
+
- **Unclear**: the request mixes cleanup with behavior changes.
|
|
156
70
|
|
|
157
|
-
|
|
71
|
+
If behavior preservation is unclear, ask one concise clarification question before route selection.
|
|
158
72
|
|
|
159
|
-
|
|
73
|
+
### Step 2: Lightweight triage for behavior-preserving work
|
|
160
74
|
|
|
161
|
-
|
|
75
|
+
Use lightweight criteria only. Do not perform full code analysis or item decomposition here.
|
|
162
76
|
|
|
163
|
-
|
|
77
|
+
Fast Path candidate when all are true:
|
|
78
|
+
- One focused refactor or a small tightly related cleanup.
|
|
79
|
+
- Expected work is localized and follows existing patterns.
|
|
80
|
+
- Behavior-preservation checks are obvious or already available.
|
|
81
|
+
- No broad dependency ordering, public behavior change, or risky migration is needed.
|
|
164
82
|
|
|
165
|
-
|
|
166
|
-
-
|
|
167
|
-
-
|
|
168
|
-
-
|
|
169
|
-
-
|
|
170
|
-
-
|
|
171
|
-
-
|
|
83
|
+
Pipeline Path candidate when any are true:
|
|
84
|
+
- Multiple refactor items or batch refactoring request.
|
|
85
|
+
- Cross-module or multi-layer impact.
|
|
86
|
+
- Import-path, internal API, or module-boundary migration needs ordering.
|
|
87
|
+
- Weak test coverage creates behavior-preservation risk.
|
|
88
|
+
- The user wants autonomous/background execution.
|
|
89
|
+
- The request needs `refactor-planner` to analyze code, split items, validate ordering, and review entries.
|
|
172
90
|
|
|
173
|
-
|
|
174
|
-
- Multiple refactor items or batch refactoring request
|
|
175
|
-
- Cross-module impact (>2 modules affected)
|
|
176
|
-
- Public API or interface changes required
|
|
177
|
-
- Multiple interrelated refactoring steps with dependency ordering
|
|
178
|
-
- Comprehensive rewrite of a module
|
|
179
|
-
- Insufficient test coverage in target area (risk of hidden behavior changes)
|
|
180
|
-
- Requires coordination with other ongoing work
|
|
91
|
+
### Step 3: Ask for path selection
|
|
181
92
|
|
|
182
|
-
|
|
93
|
+
Use `AskUserQuestion`; do not render path options as plain text.
|
|
183
94
|
|
|
95
|
+
```text
|
|
96
|
+
Question: How would you like to proceed?
|
|
97
|
+
Header: Approach
|
|
98
|
+
Options:
|
|
99
|
+
- Refactor now (Fast Path) — current session/current workspace via /prizmkit-plan -> /prizmkit-implement with behavior checks
|
|
100
|
+
- Use Pipeline Path — refactor-planner creates/reviews refactor-list.json, then refactor-pipeline-launcher configures execution
|
|
101
|
+
- Continue clarifying — ask a few more route-level questions before choosing
|
|
184
102
|
```
|
|
185
|
-
AskUserQuestion:
|
|
186
|
-
question: "How would you like to proceed?"
|
|
187
|
-
header: "Approach"
|
|
188
|
-
options:
|
|
189
|
-
- label: "Refactor now (Fast Path — current session/current workspace)"
|
|
190
|
-
description: "Run /prizmkit-plan → /prizmkit-implement → /prizmkit-code-review → /prizmkit-retrospective → /prizmkit-committer directly in this workspace with behavior-preservation checks"
|
|
191
|
-
- label: "Use Pipeline Path (refactor-planner → refactor-pipeline-launcher)"
|
|
192
|
-
description: "Generate .prizmkit/plans/refactor-list.json with refactor-planner, then launch autonomous execution with refactor-pipeline-launcher"
|
|
193
|
-
```
|
|
194
|
-
|
|
195
|
-
- **Refactor now (Fast Path)**:
|
|
196
|
-
1. Invoke `/prizmkit-plan` with the goals summary → generates `spec.md` + `plan.md` including behavior-preservation strategy
|
|
197
|
-
2. Invoke `/prizmkit-implement` to execute the plan in the current workspace and verify behavior stays unchanged
|
|
198
|
-
3. Run `/prizmkit-code-review` for quality and behavior-preservation review
|
|
199
|
-
4. Run `/prizmkit-retrospective` to sync `.prizmkit/prizm-docs/`
|
|
200
|
-
5. Commit via `/prizmkit-committer` with `refactor(<scope>):` prefix
|
|
201
|
-
6. End workflow — do not call `refactor-planner`, do not call `refactor-pipeline-launcher`, and do not enter monitoring
|
|
202
|
-
- **Use Pipeline Path** → Continue to Phase 2 (Planner handoff)
|
|
203
|
-
|
|
204
|
-
**NEVER proceed without explicit user confirmation via `AskUserQuestion`. Do NOT render options as plain text — the user must be able to click/select.**
|
|
205
|
-
|
|
206
|
-
**CHECKPOINT CP-RW-0.5**: Approach selected by user (Fast Path or Pipeline Path).
|
|
207
|
-
|
|
208
|
-
---
|
|
209
|
-
|
|
210
|
-
## Phase 2: Plan — Pipeline Path Only
|
|
211
|
-
|
|
212
|
-
**Goal**: Generate structured `.prizmkit/plans/refactor-list.json` from the clarified refactoring goals.
|
|
213
|
-
|
|
214
|
-
Run this phase only when the user selected Pipeline Path or provided a batch/complex refactor request that they chose to send through the pipeline.
|
|
215
|
-
|
|
216
|
-
**STEPS**:
|
|
217
|
-
|
|
218
|
-
1. **Planner handoff — invoke `refactor-planner`** with the full goals summary from Phase 1:
|
|
219
|
-
- Pass the structured goals summary as input — NOT the raw user conversation
|
|
220
|
-
- For new refactoring: standard planning mode
|
|
221
|
-
- For existing projects with `--incremental`: incremental planning mode
|
|
222
|
-
- **Input**: Markdown goals summary (refactor targets, scope, behavior preservation strategy)
|
|
223
|
-
- **Output**: `.prizmkit/plans/refactor-list.json` (schema: `dev-pipeline-refactor-list-v1`) containing `project_name`, `refactors[]` with id (R-NNN), title, description, scope, type, priority, complexity, behavior_preservation, acceptance_criteria, dependencies, status
|
|
224
103
|
|
|
225
|
-
|
|
226
|
-
- Because Phase 1 was thorough, `refactor-planner` should need minimal clarification
|
|
227
|
-
- If questions arise, answer from the Phase 1 context or pass through to user
|
|
104
|
+
If the request appears to change product behavior:
|
|
228
105
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
106
|
+
```text
|
|
107
|
+
Question: This appears to change behavior rather than only restructure code. What should we do?
|
|
108
|
+
Header: Boundary
|
|
109
|
+
Options:
|
|
110
|
+
- Route to feature-workflow (Recommended) — treat behavior change as feature work
|
|
111
|
+
- Keep as refactor — only if behavior remains externally unchanged or this is a compatibility-preserving migration
|
|
112
|
+
- Continue clarifying — define which behavior must stay unchanged
|
|
113
|
+
```
|
|
234
114
|
|
|
235
|
-
|
|
115
|
+
For an auto-discovered existing refactor list:
|
|
236
116
|
|
|
237
|
-
|
|
117
|
+
```text
|
|
118
|
+
Question: Existing refactor-list.json found. What should we do with it?
|
|
119
|
+
Header: Refactor list
|
|
120
|
+
Options:
|
|
121
|
+
- Launch existing list — hand off to refactor-pipeline-launcher
|
|
122
|
+
- Inspect summary first — show refactor count/status, then ask again
|
|
123
|
+
- Update/re-plan — hand off to refactor-planner in incremental mode
|
|
124
|
+
- Ignore and start fresh — continue route selection from the new request
|
|
125
|
+
```
|
|
238
126
|
|
|
239
|
-
|
|
127
|
+
If the user explicitly asked to run an existing list, that explicit request counts as path selection; hand off directly to `refactor-pipeline-launcher`.
|
|
240
128
|
|
|
241
|
-
|
|
129
|
+
## Workflow Handoff Brief
|
|
242
130
|
|
|
243
|
-
|
|
131
|
+
When handing off, include this prompt brief in the next skill invocation. Do not write the brief to disk.
|
|
244
132
|
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
Ready to launch Pipeline Path with N refactor items:
|
|
248
|
-
R-001: Extract auth middleware (medium complexity)
|
|
249
|
-
R-002: Decouple notification service (high complexity)
|
|
250
|
-
R-003: Simplify token flow (low complexity)
|
|
133
|
+
```markdown
|
|
134
|
+
## Workflow Handoff Brief
|
|
251
135
|
|
|
252
|
-
|
|
253
|
-
|
|
136
|
+
### Source
|
|
137
|
+
- workflow: refactor-workflow
|
|
138
|
+
- selected_path: fast_path | pipeline_path | existing_list_launch | behavior_change_reroute
|
|
254
139
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
- The launcher presents execution mode choices to the user (foreground/background/manual)
|
|
259
|
-
- The launcher preserves strict behavior-check defaults
|
|
260
|
-
- Do NOT duplicate execution mode selection here — let the launcher handle it
|
|
261
|
-
- **Output**: PID/status, log file path, execution mode selected
|
|
262
|
-
- Returns PID/status and log file location
|
|
140
|
+
### User Goal
|
|
141
|
+
- original_request: <preserve the user's wording>
|
|
142
|
+
- normalized_goal: <lightly normalized refactoring goal>
|
|
263
143
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
144
|
+
### Scope
|
|
145
|
+
- included: <explicitly in scope>
|
|
146
|
+
- excluded: <explicitly out of scope or unknown>
|
|
267
147
|
|
|
268
|
-
|
|
148
|
+
### Behavior Preservation
|
|
149
|
+
- must_remain_unchanged: <public behavior, user-visible outcomes, APIs, workflows, tests>
|
|
150
|
+
- suspected_behavior_changes: <items that may need feature-workflow>
|
|
269
151
|
|
|
270
|
-
|
|
152
|
+
### Materials
|
|
153
|
+
- provided_paths: <paths/directories supplied by the user>
|
|
154
|
+
- provided_docs_or_urls: <docs, links, screenshots, or specs supplied by the user>
|
|
155
|
+
- notes: <rules, constraints, or emphasis from the user>
|
|
271
156
|
|
|
272
|
-
|
|
157
|
+
### Decision
|
|
158
|
+
- route_reason: <why this path was selected>
|
|
159
|
+
- user_confirmed: yes
|
|
273
160
|
|
|
274
|
-
|
|
161
|
+
### Next Skill Instruction
|
|
162
|
+
- For planner: Use this brief as input; perform your own required code analysis, behavior-preservation planning, validation, generation, and review gate.
|
|
163
|
+
- For Fast Path: Use this brief to create spec.md/plan.md and implement only this behavior-preserving scope.
|
|
164
|
+
```
|
|
275
165
|
|
|
276
|
-
|
|
166
|
+
## Selected Path Execution
|
|
277
167
|
|
|
278
|
-
|
|
279
|
-
```bash
|
|
280
|
-
python3 ./.prizmkit/dev-pipeline/cli.py daemon refactor status
|
|
281
|
-
```
|
|
168
|
+
### Fast Path
|
|
282
169
|
|
|
283
|
-
|
|
284
|
-
- "I'll check progress periodically. Say 'status' anytime for an update."
|
|
285
|
-
- "Say 'logs' to see recent activity."
|
|
286
|
-
- "Say 'stop' to pause the pipeline."
|
|
170
|
+
Use Fast Path only after explicit user selection.
|
|
287
171
|
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
172
|
+
1. Invoke `/prizmkit-plan` with the handoff brief and behavior-preservation expectations.
|
|
173
|
+
2. Invoke `/prizmkit-implement` after the plan is ready.
|
|
174
|
+
3. Run behavior-preservation checks identified in the plan.
|
|
175
|
+
4. Run `/prizmkit-code-review` as the quality and behavior-preservation gate.
|
|
176
|
+
5. Run `/prizmkit-retrospective` before commit because refactors often change durable structure.
|
|
177
|
+
6. Run `/prizmkit-committer` with a `refactor(<scope>):` message.
|
|
178
|
+
7. End the workflow after commit; do not call `refactor-planner`, `refactor-pipeline-launcher`, or monitoring.
|
|
292
179
|
|
|
293
|
-
|
|
294
|
-
```
|
|
295
|
-
Pipeline completed: 3/3 refactor items
|
|
180
|
+
If the refactor starts changing behavior or grows beyond Fast Path criteria, pause and ask whether to switch to `feature-workflow` or Pipeline Path.
|
|
296
181
|
|
|
297
|
-
|
|
298
|
-
- R-001: Extract auth middleware → COMMITTED (refactor(auth): extract shared middleware)
|
|
299
|
-
- R-002: Decouple notification service → COMMITTED (refactor(notifications): decouple from core)
|
|
300
|
-
- R-003: Simplify token flow → COMMITTED (refactor(auth): simplify token refresh)
|
|
182
|
+
### Pipeline Path
|
|
301
183
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
184
|
+
1. Invoke `refactor-planner` with the handoff brief.
|
|
185
|
+
2. `refactor-planner` performs code analysis, item decomposition, behavior-preservation planning, validation, and plan review.
|
|
186
|
+
3. After `refactor-planner` reports a validated `.prizmkit/plans/refactor-list.json`, show a concise summary: item count, ordering highlights, preservation strategy summary, and review/validation outcome.
|
|
187
|
+
4. Ask whether to proceed to launch.
|
|
188
|
+
5. If yes, invoke `refactor-pipeline-launcher`.
|
|
307
189
|
|
|
308
|
-
|
|
190
|
+
Do not duplicate launcher execution-mode, strict-behavior-check, or runtime configuration questions in this workflow; the launcher owns them.
|
|
309
191
|
|
|
310
|
-
|
|
192
|
+
### Existing list launch
|
|
311
193
|
|
|
312
|
-
|
|
194
|
+
If the user explicitly requested launch/status/logs/retry/stop for an existing refactor list, invoke `refactor-pipeline-launcher` with the user's intent and list path.
|
|
313
195
|
|
|
314
|
-
|
|
196
|
+
If this workflow discovered the list on its own, use the `Existing refactor-list.json found` question in §Route Selection before invoking the launcher.
|
|
315
197
|
|
|
316
|
-
|
|
317
|
-
|-------------|-------------|
|
|
318
|
-
| Fast Path `spec.md` + `plan.md` exist, code not committed | Resume `/prizmkit-implement` / review / retrospective / commit based on current state |
|
|
319
|
-
| No `.prizmkit/plans/refactor-list.json` and no Fast Path artifacts | Phase 1: Brainstorm |
|
|
320
|
-
| `.prizmkit/plans/refactor-list.json` exists, no pipeline state | Phase 3: Launch |
|
|
321
|
-
| `.prizmkit/plans/refactor-list.json` + pipeline state exists | Phase 4: Monitor (check status) |
|
|
322
|
-
| All refactors completed | Report completion, suggest next steps |
|
|
198
|
+
## Resume Guidance
|
|
323
199
|
|
|
324
|
-
|
|
200
|
+
| State found | Action |
|
|
201
|
+
|---|---|
|
|
202
|
+
| Fast Path `spec.md` / `plan.md` exists | Ask whether to continue current-workspace refactor or re-plan |
|
|
203
|
+
| Valid `.prizmkit/plans/refactor-list.json` exists and user wants execution | Invoke `refactor-pipeline-launcher` |
|
|
204
|
+
| Valid refactor list exists but intent is unclear | Ask launch / inspect / update |
|
|
205
|
+
| No plan/list artifacts | Start route selection |
|
|
325
206
|
|
|
326
|
-
|
|
207
|
+
For interrupted autonomous pipeline sessions, prefer `refactor-pipeline-launcher` status/retry operations or `recovery-workflow` when the user explicitly asks to recover a broken AI session.
|
|
327
208
|
|
|
328
|
-
##
|
|
209
|
+
## Runtime Status Reference
|
|
329
210
|
|
|
330
|
-
|
|
211
|
+
This workflow does not assemble runtime commands, but it may show lightweight status before handoff or recovery. Use the canonical Python runtime forms:
|
|
331
212
|
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
| "stop" | Stop the pipeline (state preserved) |
|
|
337
|
-
| "show R-002 logs" | Show specific refactor item's session log |
|
|
213
|
+
```bash
|
|
214
|
+
python3 ./.prizmkit/dev-pipeline/cli.py daemon refactor status
|
|
215
|
+
python3 ./.prizmkit/dev-pipeline/cli.py refactor status .prizmkit/plans/refactor-list.json
|
|
216
|
+
```
|
|
338
217
|
|
|
339
|
-
|
|
218
|
+
For start/stop/logs/retry execution, hand off to `refactor-pipeline-launcher`; do not duplicate launcher configuration here.
|
|
340
219
|
|
|
341
220
|
## Error Handling
|
|
342
221
|
|
|
343
|
-
|
|
|
344
|
-
|
|
345
|
-
|
|
|
346
|
-
|
|
|
347
|
-
|
|
|
348
|
-
|
|
|
349
|
-
|
|
|
350
|
-
|
|
|
351
|
-
|
|
|
352
|
-
| All refactor items blocked/failed | Show status, suggest retrying specific items |
|
|
353
|
-
| User wants to cancel mid-brainstorming | Save conversation context, offer to resume later |
|
|
354
|
-
| Behavior regression detected during Fast Path | Revert or fix immediately before commit; refactoring cannot ship with behavior regression |
|
|
355
|
-
| Behavior regression detected during pipeline | Pipeline handles per-item retries/failures; report failed items and behavior checks |
|
|
356
|
-
|
|
357
|
-
---
|
|
222
|
+
| Situation | Action |
|
|
223
|
+
|---|---|
|
|
224
|
+
| Behavior change is required | Route to `feature-workflow` unless user confirms a behavior-preserving migration |
|
|
225
|
+
| User wants planning only | Route to `refactor-planner` and stop after planner summary |
|
|
226
|
+
| User wants execution only | Route to `refactor-pipeline-launcher` |
|
|
227
|
+
| No behavior checks exist | Warn user; recommend Pipeline Path unless scope is very small |
|
|
228
|
+
| Fast Path reveals broader risk | Pause and ask whether to switch to Pipeline Path |
|
|
229
|
+
| Planner needs more detail | Let `refactor-planner` ask its own clarification questions |
|
|
230
|
+
| Launcher finds baseline/config issues | Let `refactor-pipeline-launcher` handle confirmation and configuration |
|
|
358
231
|
|
|
359
|
-
##
|
|
232
|
+
## Handoff Map
|
|
360
233
|
|
|
361
234
|
| From | To | Condition |
|
|
362
|
-
|
|
363
|
-
|
|
|
364
|
-
|
|
|
365
|
-
|
|
|
366
|
-
|
|
|
367
|
-
|
|
|
368
|
-
| **this skill** | `refactor-planner` | User selects Pipeline Path for complex or batch refactors |
|
|
369
|
-
| `refactor-planner` | `refactor-pipeline-launcher` | Planner handoff produced validated `.prizmkit/plans/refactor-list.json` |
|
|
370
|
-
| `refactor-pipeline-launcher` | **this skill** | Launcher handoff completed and monitoring/status follow-up is needed |
|
|
371
|
-
|
|
372
|
-
---
|
|
235
|
+
|---|---|---|
|
|
236
|
+
| `refactor-workflow` | `feature-workflow` | Request requires product behavior change |
|
|
237
|
+
| `refactor-workflow` | `/prizmkit-plan` | User selects Fast Path |
|
|
238
|
+
| `refactor-workflow` | `refactor-planner` | User selects Pipeline Path |
|
|
239
|
+
| `refactor-planner` | `refactor-workflow` | Planner completed from workflow-origin Pipeline Path |
|
|
240
|
+
| `refactor-workflow` | `refactor-pipeline-launcher` | User confirms launch after planner completion or explicitly requests existing-list execution |
|
|
373
241
|
|
|
374
242
|
## Output
|
|
375
243
|
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
- **Fast Path**: `spec.md` + `plan.md`, behavior-preserving current-workspace code changes, behavior test/check evidence, `/prizmkit-code-review` result, updated `.prizmkit/prizm-docs/`, and one `refactor(<scope>):` commit from `/prizmkit-committer`.
|
|
379
|
-
- **Pipeline Path**: structured refactoring goals summary, `.prizmkit/plans/refactor-list.json`, pipeline execution via `refactor-pipeline-launcher`, monitoring updates, and per-refactor commits managed by the dev-pipeline.
|
|
244
|
+
- Fast Path: `spec.md`, `plan.md`, behavior-preserving code changes, behavior-check evidence, review result, Prizm docs sync, and one refactor commit.
|
|
245
|
+
- Pipeline Path: handoff brief, validated `.prizmkit/plans/refactor-list.json` from `refactor-planner`, and pipeline launch/status handled by `refactor-pipeline-launcher`.
|
package/package.json
CHANGED
package/src/scaffold.js
CHANGED
|
@@ -1130,6 +1130,11 @@ export async function installPipeline(projectRoot, dryRun, options = {}) {
|
|
|
1130
1130
|
const src = path.join(pipelineSource, relativeFile);
|
|
1131
1131
|
const tgt = path.join(pipelineTarget, relativeFile);
|
|
1132
1132
|
|
|
1133
|
+
if (!await fs.pathExists(src)) {
|
|
1134
|
+
skippedCount++;
|
|
1135
|
+
continue;
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1133
1138
|
if (await fs.pathExists(tgt) && !overwriteExisting) {
|
|
1134
1139
|
skippedCount++;
|
|
1135
1140
|
continue;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"Read {{REVIEWER_SUBAGENT_PATH}}. For feature {{FEATURE_ID}} (slug: {{FEATURE_SLUG}}):
|
|
2
|
-
1. Read `.prizmkit/specs/{{FEATURE_SLUG}}/spec.md` (if it exists) for goals and Verification Gates; if spec.md does not exist, read `.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md` Section 1 Task Contract instead.
|
|
3
|
-
2. Read `.prizmkit/specs/{{FEATURE_SLUG}}/plan.md` for architecture decisions and completed tasks.
|
|
4
|
-
3. Review the current workspace changes and return structured findings only. Do not run `/prizmkit-code-review`, do not apply fixes, do not run test suites, and do not spawn other agents.
|
|
5
|
-
4. The main orchestrator owns the review-fix loop: Reviewer Agent → filter → orchestrator fix.
|
|
6
|
-
Report: PASS/NEEDS_FIXES, findings with severity/location/problem/suggestion/verification, and a concise summary."
|