@zigrivers/scaffold 2.38.1 → 2.44.3

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.
Files changed (201) hide show
  1. package/README.md +10 -7
  2. package/dist/cli/commands/build.js +4 -4
  3. package/dist/cli/commands/build.js.map +1 -1
  4. package/dist/cli/commands/check.test.js +11 -8
  5. package/dist/cli/commands/check.test.js.map +1 -1
  6. package/dist/cli/commands/complete.d.ts.map +1 -1
  7. package/dist/cli/commands/complete.js +2 -1
  8. package/dist/cli/commands/complete.js.map +1 -1
  9. package/dist/cli/commands/complete.test.js +4 -1
  10. package/dist/cli/commands/complete.test.js.map +1 -1
  11. package/dist/cli/commands/dashboard.js +4 -4
  12. package/dist/cli/commands/dashboard.js.map +1 -1
  13. package/dist/cli/commands/knowledge.js +2 -2
  14. package/dist/cli/commands/knowledge.js.map +1 -1
  15. package/dist/cli/commands/knowledge.test.js +5 -12
  16. package/dist/cli/commands/knowledge.test.js.map +1 -1
  17. package/dist/cli/commands/list.d.ts +1 -1
  18. package/dist/cli/commands/list.d.ts.map +1 -1
  19. package/dist/cli/commands/list.js +84 -3
  20. package/dist/cli/commands/list.js.map +1 -1
  21. package/dist/cli/commands/list.test.js +82 -0
  22. package/dist/cli/commands/list.test.js.map +1 -1
  23. package/dist/cli/commands/next.test.js +4 -1
  24. package/dist/cli/commands/next.test.js.map +1 -1
  25. package/dist/cli/commands/reset.d.ts.map +1 -1
  26. package/dist/cli/commands/reset.js +5 -2
  27. package/dist/cli/commands/reset.js.map +1 -1
  28. package/dist/cli/commands/reset.test.js +4 -1
  29. package/dist/cli/commands/reset.test.js.map +1 -1
  30. package/dist/cli/commands/rework.d.ts.map +1 -1
  31. package/dist/cli/commands/rework.js +3 -2
  32. package/dist/cli/commands/rework.js.map +1 -1
  33. package/dist/cli/commands/run.d.ts.map +1 -1
  34. package/dist/cli/commands/run.js +28 -13
  35. package/dist/cli/commands/run.js.map +1 -1
  36. package/dist/cli/commands/run.test.js +1 -1
  37. package/dist/cli/commands/run.test.js.map +1 -1
  38. package/dist/cli/commands/skip.d.ts.map +1 -1
  39. package/dist/cli/commands/skip.js +2 -1
  40. package/dist/cli/commands/skip.js.map +1 -1
  41. package/dist/cli/commands/skip.test.js +4 -1
  42. package/dist/cli/commands/skip.test.js.map +1 -1
  43. package/dist/cli/commands/status.d.ts.map +1 -1
  44. package/dist/cli/commands/status.js +88 -4
  45. package/dist/cli/commands/status.js.map +1 -1
  46. package/dist/cli/commands/version.d.ts.map +1 -1
  47. package/dist/cli/commands/version.js +22 -3
  48. package/dist/cli/commands/version.js.map +1 -1
  49. package/dist/cli/commands/version.test.js +42 -0
  50. package/dist/cli/commands/version.test.js.map +1 -1
  51. package/dist/cli/output/context.test.js +14 -13
  52. package/dist/cli/output/context.test.js.map +1 -1
  53. package/dist/cli/output/interactive.js +4 -4
  54. package/dist/cli/output/json.d.ts +1 -0
  55. package/dist/cli/output/json.d.ts.map +1 -1
  56. package/dist/cli/output/json.js +14 -1
  57. package/dist/cli/output/json.js.map +1 -1
  58. package/dist/config/loader.d.ts.map +1 -1
  59. package/dist/config/loader.js +10 -3
  60. package/dist/config/loader.js.map +1 -1
  61. package/dist/config/loader.test.js +28 -0
  62. package/dist/config/loader.test.js.map +1 -1
  63. package/dist/core/assembly/engine.d.ts.map +1 -1
  64. package/dist/core/assembly/engine.js +6 -1
  65. package/dist/core/assembly/engine.js.map +1 -1
  66. package/dist/e2e/init.test.js +3 -0
  67. package/dist/e2e/init.test.js.map +1 -1
  68. package/dist/index.js +2 -1
  69. package/dist/index.js.map +1 -1
  70. package/dist/project/adopt.test.js +3 -0
  71. package/dist/project/adopt.test.js.map +1 -1
  72. package/dist/project/claude-md.d.ts.map +1 -1
  73. package/dist/project/claude-md.js +2 -1
  74. package/dist/project/claude-md.js.map +1 -1
  75. package/dist/project/detector.js +3 -3
  76. package/dist/project/detector.js.map +1 -1
  77. package/dist/project/signals.d.ts +1 -0
  78. package/dist/project/signals.d.ts.map +1 -1
  79. package/dist/state/decision-logger.d.ts.map +1 -1
  80. package/dist/state/decision-logger.js +7 -4
  81. package/dist/state/decision-logger.js.map +1 -1
  82. package/dist/state/lock-manager.js +1 -1
  83. package/dist/state/lock-manager.js.map +1 -1
  84. package/dist/state/lock-manager.test.js +27 -3
  85. package/dist/state/lock-manager.test.js.map +1 -1
  86. package/dist/state/state-manager.d.ts.map +1 -1
  87. package/dist/state/state-manager.js +6 -0
  88. package/dist/state/state-manager.js.map +1 -1
  89. package/dist/state/state-manager.test.js +7 -0
  90. package/dist/state/state-manager.test.js.map +1 -1
  91. package/dist/types/assembly.d.ts +2 -0
  92. package/dist/types/assembly.d.ts.map +1 -1
  93. package/dist/utils/eligible.d.ts +8 -0
  94. package/dist/utils/eligible.d.ts.map +1 -0
  95. package/dist/utils/eligible.js +36 -0
  96. package/dist/utils/eligible.js.map +1 -0
  97. package/dist/validation/config-validator.test.js +15 -13
  98. package/dist/validation/config-validator.test.js.map +1 -1
  99. package/dist/validation/index.test.js +1 -1
  100. package/dist/wizard/wizard.d.ts.map +1 -1
  101. package/dist/wizard/wizard.js +1 -0
  102. package/dist/wizard/wizard.js.map +1 -1
  103. package/dist/wizard/wizard.test.js +2 -0
  104. package/dist/wizard/wizard.test.js.map +1 -1
  105. package/knowledge/core/automated-review-tooling.md +4 -4
  106. package/knowledge/core/eval-craft.md +44 -0
  107. package/knowledge/core/multi-model-review-dispatch.md +8 -0
  108. package/knowledge/core/system-architecture.md +39 -0
  109. package/knowledge/core/task-decomposition.md +53 -0
  110. package/knowledge/core/testing-strategy.md +160 -0
  111. package/knowledge/finalization/implementation-playbook.md +24 -7
  112. package/knowledge/product/prd-craft.md +41 -0
  113. package/knowledge/review/review-adr.md +1 -1
  114. package/knowledge/review/review-api-design.md +1 -1
  115. package/knowledge/review/review-database-design.md +1 -1
  116. package/knowledge/review/review-domain-modeling.md +1 -1
  117. package/knowledge/review/review-implementation-tasks.md +1 -1
  118. package/knowledge/review/review-methodology.md +1 -1
  119. package/knowledge/review/review-operations.md +1 -1
  120. package/knowledge/review/review-prd.md +1 -1
  121. package/knowledge/review/review-security.md +1 -1
  122. package/knowledge/review/review-system-architecture.md +1 -1
  123. package/knowledge/review/review-testing-strategy.md +1 -1
  124. package/knowledge/review/review-user-stories.md +1 -1
  125. package/knowledge/review/review-ux-specification.md +1 -1
  126. package/knowledge/review/review-vision.md +1 -1
  127. package/knowledge/tools/post-implementation-review-methodology.md +107 -0
  128. package/knowledge/validation/critical-path-analysis.md +13 -0
  129. package/knowledge/validation/implementability-review.md +14 -0
  130. package/package.json +2 -1
  131. package/pipeline/architecture/review-architecture.md +8 -5
  132. package/pipeline/architecture/system-architecture.md +9 -3
  133. package/pipeline/build/multi-agent-resume.md +21 -7
  134. package/pipeline/build/multi-agent-start.md +22 -7
  135. package/pipeline/build/new-enhancement.md +20 -12
  136. package/pipeline/build/quick-task.md +18 -11
  137. package/pipeline/build/single-agent-resume.md +20 -6
  138. package/pipeline/build/single-agent-start.md +24 -8
  139. package/pipeline/consolidation/claude-md-optimization.md +8 -4
  140. package/pipeline/consolidation/workflow-audit.md +9 -5
  141. package/pipeline/decisions/adrs.md +7 -3
  142. package/pipeline/decisions/review-adrs.md +8 -5
  143. package/pipeline/environment/ai-memory-setup.md +6 -2
  144. package/pipeline/environment/automated-pr-review.md +79 -12
  145. package/pipeline/environment/design-system.md +9 -6
  146. package/pipeline/environment/dev-env-setup.md +8 -5
  147. package/pipeline/environment/git-workflow.md +16 -13
  148. package/pipeline/finalization/apply-fixes-and-freeze.md +10 -5
  149. package/pipeline/finalization/developer-onboarding-guide.md +10 -3
  150. package/pipeline/finalization/implementation-playbook.md +13 -4
  151. package/pipeline/foundation/beads.md +8 -5
  152. package/pipeline/foundation/coding-standards.md +13 -10
  153. package/pipeline/foundation/project-structure.md +16 -13
  154. package/pipeline/foundation/tdd.md +9 -4
  155. package/pipeline/foundation/tech-stack.md +7 -5
  156. package/pipeline/integration/add-e2e-testing.md +12 -8
  157. package/pipeline/modeling/domain-modeling.md +9 -7
  158. package/pipeline/modeling/review-domain-modeling.md +8 -6
  159. package/pipeline/parity/platform-parity-review.md +9 -6
  160. package/pipeline/planning/implementation-plan-review.md +10 -7
  161. package/pipeline/planning/implementation-plan.md +41 -9
  162. package/pipeline/pre/create-prd.md +7 -4
  163. package/pipeline/pre/innovate-prd.md +12 -8
  164. package/pipeline/pre/innovate-user-stories.md +10 -7
  165. package/pipeline/pre/review-prd.md +12 -10
  166. package/pipeline/pre/review-user-stories.md +12 -9
  167. package/pipeline/pre/user-stories.md +7 -4
  168. package/pipeline/quality/create-evals.md +6 -3
  169. package/pipeline/quality/operations.md +7 -3
  170. package/pipeline/quality/review-operations.md +12 -5
  171. package/pipeline/quality/review-security.md +11 -6
  172. package/pipeline/quality/review-testing.md +11 -6
  173. package/pipeline/quality/security.md +6 -2
  174. package/pipeline/quality/story-tests.md +14 -9
  175. package/pipeline/specification/api-contracts.md +9 -3
  176. package/pipeline/specification/database-schema.md +8 -2
  177. package/pipeline/specification/review-api.md +10 -4
  178. package/pipeline/specification/review-database.md +8 -3
  179. package/pipeline/specification/review-ux.md +9 -3
  180. package/pipeline/specification/ux-spec.md +9 -4
  181. package/pipeline/validation/critical-path-walkthrough.md +10 -5
  182. package/pipeline/validation/cross-phase-consistency.md +9 -4
  183. package/pipeline/validation/decision-completeness.md +8 -3
  184. package/pipeline/validation/dependency-graph-validation.md +8 -3
  185. package/pipeline/validation/implementability-dry-run.md +9 -5
  186. package/pipeline/validation/scope-creep-check.md +11 -6
  187. package/pipeline/validation/traceability-matrix.md +10 -5
  188. package/pipeline/vision/create-vision.md +7 -4
  189. package/pipeline/vision/innovate-vision.md +11 -8
  190. package/pipeline/vision/review-vision.md +15 -12
  191. package/skills/multi-model-dispatch/SKILL.md +6 -5
  192. package/skills/scaffold-runner/SKILL.md +47 -3
  193. package/tools/dashboard.md +53 -0
  194. package/tools/post-implementation-review.md +655 -0
  195. package/tools/prompt-pipeline.md +160 -0
  196. package/tools/release.md +440 -0
  197. package/tools/review-pr.md +229 -0
  198. package/tools/session-analyzer.md +299 -0
  199. package/tools/update.md +113 -0
  200. package/tools/version-bump.md +290 -0
  201. package/tools/version.md +82 -0
@@ -0,0 +1,160 @@
1
+ ---
2
+ name: prompt-pipeline
3
+ description: Display full pipeline reference
4
+ phase: null
5
+ order: null
6
+ dependencies: []
7
+ outputs: []
8
+ conditional: null
9
+ stateless: true
10
+ category: tool
11
+ knowledge-base: []
12
+ ---
13
+
14
+ ## Purpose
15
+
16
+ Display the prompt pipeline order as a quick reference. This is a pure
17
+ information display — no files are read or commands run.
18
+
19
+ ## Instructions
20
+
21
+ Print the following reference directly. Do not read any files or run any commands.
22
+
23
+ > **Note:** If installed via `scripts/install.sh`, use `/user:command-name` instead of `/scaffold:command-name`.
24
+
25
+ ---
26
+
27
+ ### Phase 0 — Prerequisites (one-time)
28
+ | Action | Command |
29
+ |--------|---------|
30
+ | Install Beads | `npm install -g @beads/bd` or `brew install beads` **(optional)** |
31
+ | Install Playwright MCP | `claude mcp add playwright npx @playwright/mcp@latest` **(optional — web apps only)** |
32
+
33
+ ### Phase 1 — Product Definition (`pre`)
34
+ | # | Prompt | Command | Notes |
35
+ |---|--------|---------|-------|
36
+ | 1 | **PRD Creation** | `/scaffold:create-prd <idea or @files>` | Interactive — requires user input |
37
+ | 2 | **Review PRD** | `/scaffold:review-prd` | Multi-pass PRD review |
38
+ | 2.5 | **Innovate PRD** | `/scaffold:innovate-prd` | **(optional)** Feature-level innovation |
39
+ | 3 | **User Stories** | `/scaffold:user-stories` | Covers every PRD feature |
40
+ | 4 | **Review User Stories** | `/scaffold:review-user-stories` | Multi-pass story review; depth 4+ adds requirements index |
41
+ | 4.5 | **Innovate User Stories** | `/scaffold:innovate-user-stories` | **(optional)** UX-level enhancements |
42
+
43
+ ### Phase 2 — Project Foundation (`foundation`)
44
+ | # | Prompt | Command | Notes |
45
+ |---|--------|---------|-------|
46
+ | 5 | **Beads Setup** | `/scaffold:beads` | **(optional)** Creates CLAUDE.md + task tracking |
47
+ | 6 | **Tech Stack** | `/scaffold:tech-stack` | Drives all technical decisions |
48
+ | 7 | **Coding Standards** | `/scaffold:coding-standards` | References tech-stack.md |
49
+ | 8 | **TDD Standards** | `/scaffold:tdd` | References tech-stack.md + coding-standards.md |
50
+ | 9 | **Project Structure** | `/scaffold:project-structure` | References all Phase 2 docs |
51
+
52
+ ### Phase 3 — Development Environment (`environment`)
53
+ | # | Prompt | Command | Notes |
54
+ |---|--------|---------|-------|
55
+ | 10 | **Dev Environment Setup** | `/scaffold:dev-env-setup` | Creates lint/test/install commands |
56
+ | 11 | **Design System** | `/scaffold:design-system` | **(optional)** Frontend projects only |
57
+ | 12 | **Git Workflow** | `/scaffold:git-workflow` | Branching, CI, worktrees, permissions |
58
+ | 12.5 | **Automated PR Review** | `/scaffold:automated-pr-review` | **(optional)** Local CLI or external reviewer |
59
+ | 13 | **AI Memory Setup** | `/scaffold:ai-memory-setup` | Modular rules, optional MCP memory + external docs |
60
+
61
+ ### Phase 4 — Testing Integration (`integration`)
62
+ | # | Prompt | Command | Notes |
63
+ |---|--------|---------|-------|
64
+ | 14 | **E2E Testing** | `/scaffold:add-e2e-testing` | **(optional)** Playwright (web) and/or Maestro (mobile) |
65
+
66
+ ### Phase 5 — Domain Modeling (`modeling`)
67
+ | # | Prompt | Command | Notes |
68
+ |---|--------|---------|-------|
69
+ | 15 | **Domain Modeling** | `/scaffold:domain-modeling` | Entities, aggregates, events, bounded contexts |
70
+ | 16 | **Review Domain Modeling** | `/scaffold:review-domain-modeling` | 10-pass domain model review |
71
+
72
+ ### Phase 6 — Architecture Decisions (`decisions`)
73
+ | # | Prompt | Command | Notes |
74
+ |---|--------|---------|-------|
75
+ | 17 | **ADRs** | `/scaffold:adrs` | Architecture Decision Records |
76
+ | 18 | **Review ADRs** | `/scaffold:review-adrs` | Review for contradictions, missing decisions |
77
+
78
+ ### Phase 7 — System Architecture (`architecture`)
79
+ | # | Prompt | Command | Notes |
80
+ |---|--------|---------|-------|
81
+ | 19 | **System Architecture** | `/scaffold:system-architecture` | Components, data flows, module structure |
82
+ | 20 | **Review Architecture** | `/scaffold:review-architecture` | Coverage gaps, constraint violations |
83
+
84
+ ### Phase 8 — Specifications (`specification`)
85
+ | # | Prompt | Command | Notes |
86
+ |---|--------|---------|-------|
87
+ | 21 | **Database Schema** | `/scaffold:database-schema` | **(optional)** Tables, indexes, constraints |
88
+ | 22 | **Review Database** | `/scaffold:review-database` | **(optional)** Schema review |
89
+ | 23 | **API Contracts** | `/scaffold:api-contracts` | **(optional)** Endpoints, error codes, auth |
90
+ | 24 | **Review API** | `/scaffold:review-api` | **(optional)** API contracts review |
91
+ | 25 | **UX Spec** | `/scaffold:ux-spec` | **(optional)** Flows, states, accessibility |
92
+ | 26 | **Review UX** | `/scaffold:review-ux` | **(optional)** UX spec review |
93
+
94
+ ### Phase 9 — Quality Gates (`quality`)
95
+ | # | Prompt | Command | Notes |
96
+ |---|--------|---------|-------|
97
+ | 27 | **Review Testing** | `/scaffold:review-testing` | Reviews TDD strategy |
98
+ | 27.5 | **Story Tests** | `/scaffold:story-tests` | Generates tagged test skeletons from user story ACs |
99
+ | 28 | **Create Evals** | `/scaffold:create-evals` | Generates eval checks from standards docs |
100
+ | 29 | **Operations** | `/scaffold:operations` | Deployment, monitoring, incident response |
101
+ | 30 | **Review Operations** | `/scaffold:review-operations` | Reviews operations runbook |
102
+ | 31 | **Security** | `/scaffold:security` | Threat model, auth, data protection |
103
+ | 32 | **Review Security** | `/scaffold:review-security` | Reviews security posture |
104
+
105
+ ### Phase 10 — Platform Parity (`parity`)
106
+ | # | Prompt | Command | Notes |
107
+ |---|--------|---------|-------|
108
+ | 33 | **Platform Parity Review** | `/scaffold:platform-parity-review` | **(optional)** Multi-platform projects |
109
+
110
+ ### Phase 11 — Consolidation (`consolidation`)
111
+ | # | Prompt | Command | Notes |
112
+ |---|--------|---------|-------|
113
+ | 34 | **Claude.md Optimization** | `/scaffold:claude-md-optimization` | Run BEFORE Workflow Audit |
114
+ | 35 | **Workflow Audit** | `/scaffold:workflow-audit` | Run AFTER Claude.md Optimization |
115
+
116
+ ### Phase 12 — Planning (`planning`)
117
+ | # | Prompt | Command | Notes |
118
+ |---|--------|---------|-------|
119
+ | 36 | **Implementation Plan** | `/scaffold:implementation-plan` | Creates full task graph |
120
+ | 37 | **Implementation Plan Review** | `/scaffold:implementation-plan-review` | Second pass for quality + multi-model validation (depth 4+) |
121
+
122
+ ### Phase 13 — Validation (`validation`)
123
+ | # | Prompt | Command | Notes |
124
+ |---|--------|---------|-------|
125
+ | 38 | **Cross-Phase Consistency** | `/scaffold:cross-phase-consistency` | Naming, assumptions, interfaces |
126
+ | 39 | **Traceability Matrix** | `/scaffold:traceability-matrix` | PRD to Stories to Architecture to Tasks |
127
+ | 40 | **Decision Completeness** | `/scaffold:decision-completeness` | All decisions recorded and justified |
128
+ | 41 | **Critical Path Walkthrough** | `/scaffold:critical-path-walkthrough` | End-to-end critical journey trace |
129
+ | 42 | **Implementability Dry Run** | `/scaffold:implementability-dry-run` | Simulate agent picking up tasks |
130
+ | 43 | **Dependency Graph Validation** | `/scaffold:dependency-graph-validation` | Verify task DAG is acyclic |
131
+ | 44 | **Scope Creep Check** | `/scaffold:scope-creep-check` | Specs stay within PRD boundaries |
132
+
133
+ ### Phase 14 — Finalization (`finalization`)
134
+ | # | Prompt | Command | Notes |
135
+ |---|--------|---------|-------|
136
+ | 45 | **Apply Fixes & Freeze** | `/scaffold:apply-fixes-and-freeze` | Apply findings, freeze docs |
137
+ | 46 | **Developer Onboarding Guide** | `/scaffold:developer-onboarding-guide` | "Start here" for new devs/agents |
138
+ | 47 | **Implementation Playbook** | `/scaffold:implementation-playbook` | Operational guide for agent execution |
139
+
140
+ ### Execution (post-pipeline)
141
+ | # | Prompt | Command | Notes |
142
+ |---|--------|---------|-------|
143
+ | — | **Single Agent Start** | `/scaffold:single-agent-start` | TDD execution loop |
144
+ | — | **Multi Agent Start** | `/scaffold:multi-agent-start <agent-name>` | One per worktree |
145
+
146
+ ### Standalone / Ongoing
147
+ | Prompt | Command | When |
148
+ |--------|---------|------|
149
+ | **New Enhancement** | `/scaffold:new-enhancement` | Adding features to existing project |
150
+ | **Quick Task** | `/scaffold:quick-task` | Bug fixes, refactors, perf improvements |
151
+ | **Resume (single)** | `/scaffold:single-agent-resume` | Resuming single-agent after a break |
152
+ | **Resume (multi)** | `/scaffold:multi-agent-resume <agent-name>` | Resuming a worktree agent after a break |
153
+ | **Version Bump** | `/scaffold:version-bump` | Bump version + changelog (no tag/release) |
154
+ | **Release** | `/scaffold:release` | Full release with tag + GitHub release |
155
+ | **Visual Dashboard** | `/scaffold:dashboard` | HTML pipeline overview in browser |
156
+
157
+ ## Process Rules
158
+
159
+ 1. **Read-only** — this is a pure display command. Do not read any files or run any commands.
160
+ 2. Print the reference above exactly as shown.
@@ -0,0 +1,440 @@
1
+ ---
2
+ name: release
3
+ description: Create a versioned release with changelog and GitHub release
4
+ phase: null
5
+ order: null
6
+ dependencies: []
7
+ outputs: []
8
+ conditional: null
9
+ stateless: true
10
+ category: tool
11
+ knowledge-base: [release-management, version-strategy]
12
+ argument-hint: "<version or --dry-run or rollback>"
13
+ ---
14
+
15
+ ## Purpose
16
+
17
+ Create a versioned release with changelog and GitHub release. Analyzes
18
+ conventional commits to suggest version bumps, generates changelogs from commit
19
+ history and Beads tasks, runs quality gates, and publishes a GitHub release.
20
+ Supports dry-run mode and rollback.
21
+
22
+ ## Inputs
23
+
24
+ $ARGUMENTS — parsed as:
25
+
26
+ | Argument | Mode |
27
+ |----------|------|
28
+ | _(empty)_ | **Standard** — auto-suggest bump, confirm, execute |
29
+ | `major`, `minor`, or `patch` | **Explicit** — use specified bump, skip suggestion |
30
+ | `current` | **Current** — tag and release the version already in files, no bump |
31
+ | `--dry-run` | **Dry Run** — all analysis, zero mutations |
32
+ | `rollback` | **Rollback** — jump directly to the Rollback section |
33
+
34
+ Combine flags freely (e.g., `minor --dry-run`).
35
+
36
+ ## Expected Outputs
37
+
38
+ - Version files updated to new version
39
+ - `CHANGELOG.md` updated with grouped commit entries
40
+ - Annotated git tag `vX.Y.Z`
41
+ - GitHub release (if `gh` CLI is available)
42
+ - Single commit with message `chore(release): vX.Y.Z`
43
+
44
+ ## Instructions
45
+
46
+ ### Phase 0: Project Detection
47
+
48
+ Gather project context before proceeding. Check each item and record findings:
49
+
50
+ #### 0.1 Git State
51
+
52
+ 1. Confirm the working tree is clean (`git status --porcelain`). If there are uncommitted changes, **stop** and tell the user: "Working tree has uncommitted changes. Commit or stash them before releasing."
53
+ 2. Record the current branch name (`git branch --show-current`).
54
+ 3. Check if `gh` CLI is available (`which gh`). If not available, warn: "GitHub CLI (`gh`) not found. Will create tag only — no GitHub release. Install with `brew install gh` for full functionality."
55
+ 4. Fetch tags: `git fetch --tags`.
56
+
57
+ #### 0.2 Version File Detection
58
+
59
+ Scan the project root for version files. For each found file, record the current version:
60
+
61
+ | File | How to Read Version |
62
+ |------|-------------------|
63
+ | `package.json` | `.version` field |
64
+ | `pyproject.toml` | `[project].version` or `[tool.poetry].version` |
65
+ | `Cargo.toml` | `[package].version` |
66
+ | `.claude-plugin/plugin.json` | `.version` field |
67
+ | `pubspec.yaml` | `version:` field |
68
+ | `setup.cfg` | `[metadata].version` |
69
+ | `version.txt` | Entire file contents (trimmed) |
70
+
71
+ If **no** version files are found, note this — a tag-only release will be created.
72
+
73
+ #### 0.3 Project Context
74
+
75
+ - Check for `.beads/` directory — enables Beads integration in release notes.
76
+ - Check for existing `CHANGELOG.md`.
77
+ - List existing `v*` tags: `git tag -l 'v*' --sort=-v:refname | head -5`.
78
+
79
+ #### 0.4 Mode Selection
80
+
81
+ Parse `$ARGUMENTS` to determine the mode:
82
+
83
+ | Argument | Mode |
84
+ |----------|------|
85
+ | _(empty)_ | **Standard** — auto-suggest bump, confirm, execute |
86
+ | `major`, `minor`, or `patch` | **Explicit** — use specified bump, skip suggestion |
87
+ | `current` | **Current** — tag and release the version already in files, no bump |
88
+ | `--dry-run` | **Dry Run** — all analysis, zero mutations |
89
+ | `rollback` | **Rollback** — jump directly to the Rollback section |
90
+
91
+ If `--dry-run` is combined with a bump type (e.g., `minor --dry-run`), use both: explicit bump + dry-run mode.
92
+
93
+ If the mode is **Rollback**, skip to the **Rollback** section below.
94
+
95
+ #### 0.5 First-Release Detection
96
+
97
+ If **no** `v*` tags exist:
98
+
99
+ 1. Tell the user: "No previous releases found. This will be your first release."
100
+ 2. Ask: "What should the initial version be?" Suggest `0.1.0` (pre-release) or `1.0.0` (stable).
101
+ 3. Record the chosen version. Skip Phase 1 (version analysis) — go directly to Phase 2.
102
+
103
+ #### 0.6 Version Mismatch Detection
104
+
105
+ **Skip if:** First-release mode (Phase 0.5) or `current` mode.
106
+
107
+ If `current` mode was specified: use the version from files as the release version, skip Phase 1 and Phase 4 (version bump) — proceed directly to Phase 2 (quality gates).
108
+
109
+ Otherwise, compare the version in files against the last tag:
110
+
111
+ - If the version in files **is greater than** the version from the last tag (e.g., files say `0.2.0`, last tag is `v0.1.0`):
112
+ 1. Ask: "Version files show `<file-version>` but the last tag is `<last-tag>`. It looks like the version was already bumped (perhaps via `/scaffold:version-bump`). Release `<file-version>` as-is, or analyze commits for a further bump?"
113
+ 2. **"Release as-is"**: Use `<file-version>` as the release version. Skip Phase 1 and Phase 4 — proceed to Phase 2.
114
+ 3. **"Bump further"**: Proceed normally through Phase 1, bumping from the current file version.
115
+
116
+ - If the versions match or files are less than/equal to the last tag: proceed normally.
117
+
118
+ ---
119
+
120
+ ### Phase 1: Version Analysis
121
+
122
+ **Skip this phase if:** First-release mode (Phase 0.5) or Explicit mode.
123
+
124
+ #### 1.1 Collect Commits
125
+
126
+ Get commits since the last tag:
127
+
128
+ ```
129
+ git log <last-tag>..HEAD --oneline --no-merges
130
+ ```
131
+
132
+ #### 1.2 Parse Conventional Commits
133
+
134
+ Categorize each commit:
135
+
136
+ | Pattern | Bump |
137
+ |---------|------|
138
+ | `feat:` or `feat(scope):` | minor |
139
+ | `fix:` or `fix(scope):` | patch |
140
+ | `BREAKING CHANGE:` in body or `!:` suffix | major |
141
+ | `perf:`, `refactor:`, `docs:`, `chore:`, `style:`, `test:`, `build:`, `ci:` | patch (non-feature change) |
142
+
143
+ Apply the **highest-wins** rule: if any commit triggers major, the suggestion is major; otherwise if any triggers minor, the suggestion is minor; otherwise patch.
144
+
145
+ #### 1.3 Present Analysis
146
+
147
+ Show the user:
148
+
149
+ ```
150
+ Commits since <last-tag>: <count>
151
+ feat: <count> commits
152
+ fix: <count> commits
153
+ other: <count> commits
154
+ BREAKING: <yes/no>
155
+
156
+ Suggested bump: <major|minor|patch>
157
+ <current-version> → <new-version>
158
+ ```
159
+
160
+ Ask: "Confirm this bump, or override? (major / minor / patch / confirm)"
161
+
162
+ If **no conventional commits** were found, fall back: "No conventional commits found. What type of bump? (major / minor / patch)"
163
+
164
+ Record the confirmed version.
165
+
166
+ ---
167
+
168
+ ### Phase 2: Pre-Release Validation
169
+
170
+ #### 2.1 Detect Quality Gates
171
+
172
+ Look for quality gate commands in this order (use the first match):
173
+
174
+ 1. `Makefile` with `check` target — `make check`
175
+ 2. `Makefile` with `test` target — `make test`
176
+ 3. `package.json` with `test` script — `npm test`
177
+ 4. `Cargo.toml` exists — `cargo test`
178
+ 5. `pyproject.toml` or `setup.cfg` — `pytest`
179
+ 6. None found — warn and skip
180
+
181
+ #### 2.2 Run Quality Gates
182
+
183
+ **In dry-run mode:** Show which command would run but do not execute. Skip to Phase 3.
184
+
185
+ Run the detected quality gate command. Report the result.
186
+
187
+ - **If it passes:** "Quality gates passed. Proceeding."
188
+ - **If it fails:** "Quality gates failed. Fix the issues and re-run `/scaffold:release`. To force release despite failures, re-run with the `--force` flag." **Stop here** unless `--force` was passed.
189
+
190
+ ---
191
+
192
+ ### Phase 3: Changelog & Release Notes
193
+
194
+ #### 3.1 Group Commits
195
+
196
+ Group commits since the last tag (or all commits for first release) by type:
197
+
198
+ ```markdown
199
+ ## [vX.Y.Z] - YYYY-MM-DD
200
+
201
+ ### Added
202
+ - feat: description (commit-hash)
203
+
204
+ ### Fixed
205
+ - fix: description (commit-hash)
206
+
207
+ ### Changed
208
+ - refactor: description (commit-hash)
209
+ - perf: description (commit-hash)
210
+
211
+ ### Other
212
+ - chore: description (commit-hash)
213
+ ```
214
+
215
+ Omit empty sections. Use the commit's first line (without the type prefix) as the description.
216
+
217
+ #### 3.2 Beads Integration (conditional)
218
+
219
+ If `.beads/` exists:
220
+
221
+ 1. Run `bd list --status closed` (or parse `.beads/issues.jsonl` for closed issues).
222
+ 2. Cross-reference closed tasks with the commit range (match task IDs like `BD-xxx` or `scaffold-xxx` in commit messages).
223
+ 3. If matches found, append a section:
224
+
225
+ ```markdown
226
+ ### Completed Tasks
227
+ - [BD-xxx] Task title
228
+ - [BD-yyy] Task title
229
+ ```
230
+
231
+ If `.beads/` does not exist or no tasks match, silently skip this section.
232
+
233
+ #### 3.3 Write Changelog
234
+
235
+ **In dry-run mode:** Display the changelog preview but do not write to disk. Skip to Phase 6.
236
+
237
+ - If `CHANGELOG.md` exists: prepend the new entry after the `# Changelog` heading (or after any header block).
238
+ - If `CHANGELOG.md` does not exist: create it with:
239
+
240
+ ```markdown
241
+ # Changelog
242
+
243
+ All notable changes to this project will be documented in this file.
244
+
245
+ The format is based on [Keep a Changelog](https://keepachangelog.com/).
246
+
247
+ ## [vX.Y.Z] - YYYY-MM-DD
248
+ ...
249
+ ```
250
+
251
+ #### 3.4 Save Release Notes
252
+
253
+ Store the generated changelog entry (without the file header) for use as the GitHub release body in Phase 5.
254
+
255
+ ---
256
+
257
+ ### Phase 4: Version Bump & Commit
258
+
259
+ **In dry-run mode:** Show which files would change and the commit message. Skip to Phase 6.
260
+
261
+ #### 4.1 Update Version Files
262
+
263
+ For each version file detected in Phase 0.2, update the version to the new value.
264
+
265
+ #### 4.2 Sync Lock Files
266
+
267
+ If applicable:
268
+ - `package-lock.json` exists — run `npm install --package-lock-only`
269
+ - `Cargo.lock` exists — run `cargo update -w`
270
+
271
+ #### 4.3 Commit
272
+
273
+ Stage all changed files and commit:
274
+
275
+ ```
276
+ git add <changed-files>
277
+ git commit -m "chore(release): vX.Y.Z"
278
+ ```
279
+
280
+ If Beads is configured (`.beads/` exists) and a task is active, include the task ID: `[BD-xxx] chore(release): vX.Y.Z`.
281
+
282
+ ---
283
+
284
+ ### Phase 5: Tag & Publish
285
+
286
+ **In dry-run mode:** Show what would happen. Skip to Phase 6.
287
+
288
+ #### 5.1 Determine Flow
289
+
290
+ Check the current branch:
291
+
292
+ - **`main` or `master`**: Direct flow (tag — push — release).
293
+ - **Any other branch**: PR flow (push — create PR — instructions).
294
+
295
+ #### 5.2 Direct Flow (main/master)
296
+
297
+ 1. Create annotated tag: `git tag -a vX.Y.Z -m "Release vX.Y.Z"`
298
+ 2. Push commit and tag: `git push origin HEAD --follow-tags`
299
+ 3. If push fails (e.g., branch protection), fall back to PR flow (5.3).
300
+ 4. If `gh` is available: create GitHub release:
301
+ ```
302
+ gh release create vX.Y.Z --title "vX.Y.Z" --notes "<release-notes-from-3.4>"
303
+ ```
304
+ 5. Publish to npm:
305
+ ```
306
+ npm publish
307
+ ```
308
+ The `prepublishOnly` script runs `build` and `test` automatically. If it fails, report the error but do not roll back the git tag — tell the user to fix and re-run `npm publish` manually.
309
+
310
+ #### 5.3 PR Flow (feature branch)
311
+
312
+ 1. Push branch: `git push -u origin HEAD`
313
+ 2. If `gh` is available: create PR:
314
+ ```
315
+ gh pr create --title "chore(release): vX.Y.Z" --body "<release-notes-from-3.4>"
316
+ ```
317
+ 3. Tell the user: "Release PR created. After merging to main, run these commands to create the tag and GitHub release:"
318
+ ```
319
+ git checkout main && git pull
320
+ git tag -a vX.Y.Z -m "Release vX.Y.Z"
321
+ git push origin vX.Y.Z
322
+ gh release create vX.Y.Z --title "vX.Y.Z" --notes-file CHANGELOG.md
323
+ ```
324
+
325
+ ---
326
+
327
+ ### Phase 6: Post-Release Summary
328
+
329
+ Show the final summary:
330
+
331
+ ```
332
+ Release vX.Y.Z complete!
333
+
334
+ Version files updated: <list>
335
+ Changelog: CHANGELOG.md updated
336
+ Tag: vX.Y.Z created
337
+ GitHub Release: <URL> (or "PR created: <URL>")
338
+
339
+ To undo this release: /scaffold:release rollback
340
+ ```
341
+
342
+ In dry-run mode:
343
+
344
+ ```
345
+ Dry-run complete — no changes were made.
346
+
347
+ Would bump: <current> → <new>
348
+ Would update: <version-files>
349
+ Would create: CHANGELOG.md entry
350
+ Would tag: vX.Y.Z
351
+ Would create: GitHub release
352
+
353
+ Run /scaffold:release to execute.
354
+ ```
355
+
356
+ ---
357
+
358
+ ### Rollback
359
+
360
+ Undo the most recent release. This is a **destructive operation** with safety guards.
361
+
362
+ #### R.1 Identify Latest Release
363
+
364
+ 1. Find the most recent tag: `git tag -l 'v*' --sort=-v:refname | head -1`
365
+ 2. If no tags exist: "No releases found. Nothing to roll back." **Stop.**
366
+
367
+ #### R.2 Safety Confirmation
368
+
369
+ Tell the user: "To confirm rollback of `<tag>`, type the exact tag name (e.g., `v1.3.0`):"
370
+
371
+ - If the user types the correct tag name — proceed.
372
+ - If the user types anything else — "Tag name does not match. Rollback cancelled." **Stop.**
373
+
374
+ #### R.3 Execute Rollback
375
+
376
+ Perform each step. If any step fails, continue with remaining steps and report all results at the end.
377
+
378
+ 1. **Delete GitHub release** (if `gh` is available):
379
+ ```
380
+ gh release delete <tag> --yes
381
+ ```
382
+
383
+ 2. **Delete remote tag:**
384
+ ```
385
+ git push origin :refs/tags/<tag>
386
+ ```
387
+
388
+ 3. **Delete local tag:**
389
+ ```
390
+ git tag -d <tag>
391
+ ```
392
+
393
+ 4. **Revert version bump commit** (if the most recent commit message matches `chore(release): <tag>`):
394
+ ```
395
+ git revert HEAD --no-edit
396
+ git push origin HEAD
397
+ ```
398
+
399
+ #### R.4 Report Results
400
+
401
+ Show what succeeded and what failed:
402
+
403
+ ```
404
+ Rollback of <tag>:
405
+ GitHub release: deleted (or failed: <error>)
406
+ Remote tag: deleted
407
+ Local tag: deleted
408
+ Version bump commit: reverted
409
+
410
+ Rollback complete.
411
+ ```
412
+
413
+ If any step failed, include manual cleanup instructions for that step.
414
+
415
+ ---
416
+
417
+ ## Process Rules
418
+
419
+ 1. **Never skip quality gates** without explicit user `--force`.
420
+ 2. **Dry-run: zero mutations** — no file writes, no git operations, no GitHub API calls.
421
+ 3. **Beads integration is optional** — silently skip if `.beads/` doesn't exist.
422
+ 4. **Tag format is always `vX.Y.Z`** — no other formats.
423
+ 5. **Every confirmation must be explicit** — don't assume "yes" from silence.
424
+ 6. **Rollback requires exact tag name** — not just "yes" or "confirm".
425
+
426
+ ## After This Step
427
+
428
+ When this step is complete, tell the user:
429
+
430
+ ---
431
+ **Release complete** — version bumped, changelog updated, tag created, GitHub release published.
432
+
433
+ **Next (if applicable):**
434
+ - If follow-up tasks are needed: Run `/scaffold:quick-task` — Create a focused task for post-release work.
435
+ - If the release needs undoing: Run `/scaffold:release rollback` — Undo the most recent release.
436
+ - For development milestone checkpoints without releasing: Run `/scaffold:version-bump` — Bump version and changelog only.
437
+
438
+ **Pipeline reference:** `/scaffold:prompt-pipeline`
439
+
440
+ ---