@atlashub/smartstack-cli 3.7.0 → 3.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/dist/index.js +365 -2
  2. package/dist/index.js.map +1 -1
  3. package/package.json +4 -2
  4. package/templates/agents/action.md +1 -0
  5. package/templates/agents/ba-writer.md +33 -0
  6. package/templates/agents/explore-codebase.md +1 -0
  7. package/templates/agents/explore-docs.md +1 -0
  8. package/templates/agents/fix-grammar.md +1 -0
  9. package/templates/agents/snipper.md +1 -0
  10. package/templates/skills/admin/SKILL.md +6 -0
  11. package/templates/skills/ai-prompt/SKILL.md +32 -136
  12. package/templates/skills/ai-prompt/steps/step-01-implementation.md +122 -0
  13. package/templates/skills/apex/SKILL.md +120 -0
  14. package/templates/skills/apex/_shared.md +86 -0
  15. package/templates/skills/apex/references/agent-teams-protocol.md +164 -0
  16. package/templates/skills/apex/references/smartstack-layers.md +173 -0
  17. package/templates/skills/apex/steps/step-00-init.md +156 -0
  18. package/templates/skills/apex/steps/step-01-analyze.md +169 -0
  19. package/templates/skills/apex/steps/step-02-plan.md +160 -0
  20. package/templates/skills/apex/steps/step-03-execute.md +166 -0
  21. package/templates/skills/apex/steps/step-04-validate.md +138 -0
  22. package/templates/skills/apex/steps/step-05-examine.md +124 -0
  23. package/templates/skills/apex/steps/step-06-resolve.md +105 -0
  24. package/templates/skills/apex/steps/step-07-tests.md +130 -0
  25. package/templates/skills/apex/steps/step-08-run-tests.md +115 -0
  26. package/templates/skills/application/SKILL.md +10 -0
  27. package/templates/skills/application/references/backend-controller-hierarchy.md +58 -0
  28. package/templates/skills/application/references/backend-entity-seeding.md +72 -0
  29. package/templates/skills/application/references/backend-verification.md +88 -0
  30. package/templates/skills/application/references/frontend-verification.md +111 -0
  31. package/templates/skills/application/references/nav-fallback-procedure.md +200 -0
  32. package/templates/skills/application/references/provider-template.md +134 -0
  33. package/templates/skills/application/references/test-frontend.md +73 -0
  34. package/templates/skills/application/references/test-prerequisites.md +72 -0
  35. package/templates/skills/application/steps/step-01-navigation.md +7 -198
  36. package/templates/skills/application/steps/step-03b-provider.md +4 -128
  37. package/templates/skills/application/steps/step-04-backend.md +20 -350
  38. package/templates/skills/application/steps/step-05-frontend.md +12 -101
  39. package/templates/skills/application/steps/step-07-tests.md +12 -132
  40. package/templates/skills/business-analyse/SKILL.md +11 -2
  41. package/templates/skills/business-analyse/html/ba-interactive.html +3214 -2246
  42. package/templates/skills/business-analyse/html/build-html.js +77 -0
  43. package/templates/skills/business-analyse/html/src/scripts/01-data-init.js +130 -0
  44. package/templates/skills/business-analyse/html/src/scripts/02-navigation.js +22 -0
  45. package/templates/skills/business-analyse/html/src/scripts/03-render-cadrage.js +208 -0
  46. package/templates/skills/business-analyse/html/src/scripts/04-render-modules.js +211 -0
  47. package/templates/skills/business-analyse/html/src/scripts/05-render-specs.js +554 -0
  48. package/templates/skills/business-analyse/html/src/scripts/06-render-consolidation.js +110 -0
  49. package/templates/skills/business-analyse/html/src/scripts/07-render-handoff.js +90 -0
  50. package/templates/skills/business-analyse/html/src/scripts/08-editing.js +45 -0
  51. package/templates/skills/business-analyse/html/src/scripts/09-export.js +168 -0
  52. package/templates/skills/business-analyse/html/src/scripts/10-comments.js +171 -0
  53. package/templates/skills/business-analyse/html/src/scripts/11-review-panel.js +161 -0
  54. package/templates/skills/business-analyse/html/src/styles/01-variables.css +38 -0
  55. package/templates/skills/business-analyse/html/src/styles/02-layout.css +101 -0
  56. package/templates/skills/business-analyse/html/src/styles/03-navigation.css +62 -0
  57. package/templates/skills/business-analyse/html/src/styles/04-cards.css +196 -0
  58. package/templates/skills/business-analyse/html/src/styles/05-modules.css +325 -0
  59. package/templates/skills/business-analyse/html/src/styles/06-wireframes.css +230 -0
  60. package/templates/skills/business-analyse/html/src/styles/07-comments.css +184 -0
  61. package/templates/skills/business-analyse/html/src/styles/08-review-panel.css +241 -0
  62. package/templates/skills/business-analyse/html/src/template.html +623 -0
  63. package/templates/skills/business-analyse/references/cadrage-structure-cards.md +78 -0
  64. package/templates/skills/business-analyse/references/cadrage-vibe-coding.md +97 -0
  65. package/templates/skills/business-analyse/references/consolidation-structural-checks.md +92 -0
  66. package/templates/skills/business-analyse/references/deploy-data-build.md +121 -0
  67. package/templates/skills/business-analyse/references/deploy-modes.md +49 -0
  68. package/templates/skills/business-analyse/references/handoff-file-templates.md +119 -0
  69. package/templates/skills/business-analyse/references/handoff-mappings.md +81 -0
  70. package/templates/skills/business-analyse/references/html-data-mapping.md +10 -2
  71. package/templates/skills/business-analyse/references/init-schema-deployment.md +65 -0
  72. package/templates/skills/business-analyse/references/review-data-mapping.md +363 -0
  73. package/templates/skills/business-analyse/references/spec-auto-inference.md +57 -0
  74. package/templates/skills/business-analyse/references/ui-dashboard-spec.md +85 -0
  75. package/templates/skills/business-analyse/references/ui-resource-cards.md +110 -0
  76. package/templates/skills/business-analyse/references/validate-incremental-html.md +55 -0
  77. package/templates/skills/business-analyse/steps/step-00-init.md +35 -68
  78. package/templates/skills/business-analyse/steps/step-01-cadrage.md +5 -194
  79. package/templates/skills/business-analyse/steps/step-03a-data.md +6 -49
  80. package/templates/skills/business-analyse/steps/step-03b-ui.md +12 -178
  81. package/templates/skills/business-analyse/steps/step-03d-validate.md +3 -48
  82. package/templates/skills/business-analyse/steps/step-04-consolidation.md +9 -104
  83. package/templates/skills/business-analyse/steps/step-05a-handoff.md +25 -441
  84. package/templates/skills/business-analyse/steps/step-05b-deploy.md +19 -187
  85. package/templates/skills/business-analyse/steps/step-06-review.md +277 -0
  86. package/templates/skills/cc-agent/references/agent-behavior-patterns.md +95 -0
  87. package/templates/skills/cc-agent/steps/step-02-generate.md +5 -78
  88. package/templates/skills/check-version/SKILL.md +7 -0
  89. package/templates/skills/controller/references/controller-code-templates.md +159 -0
  90. package/templates/skills/controller/references/permission-sync-templates.md +152 -0
  91. package/templates/skills/controller/steps/step-03-generate.md +6 -158
  92. package/templates/skills/controller/steps/step-04-perms.md +5 -144
  93. package/templates/skills/debug/SKILL.md +7 -0
  94. package/templates/skills/explore/SKILL.md +6 -0
  95. package/templates/skills/feature-full/SKILL.md +39 -142
  96. package/templates/skills/feature-full/steps/step-01-implementation.md +120 -0
  97. package/templates/skills/gitflow/references/init-config-template.md +135 -0
  98. package/templates/skills/gitflow/references/init-name-normalization.md +103 -0
  99. package/templates/skills/gitflow/references/plan-template.md +69 -0
  100. package/templates/skills/gitflow/references/start-efcore-preflight.md +70 -0
  101. package/templates/skills/gitflow/references/start-local-config.md +110 -0
  102. package/templates/skills/gitflow/steps/step-init.md +18 -289
  103. package/templates/skills/gitflow/steps/step-plan.md +6 -63
  104. package/templates/skills/gitflow/steps/step-start.md +16 -126
  105. package/templates/skills/mcp/SKILL.md +9 -213
  106. package/templates/skills/mcp/steps/step-01-healthcheck.md +108 -0
  107. package/templates/skills/mcp/steps/step-02-tools.md +73 -0
  108. package/templates/skills/notification/SKILL.md +7 -0
  109. package/templates/skills/quick-search/SKILL.md +5 -0
  110. package/templates/skills/ralph-loop/SKILL.md +99 -381
  111. package/templates/skills/ralph-loop/references/category-rules.md +259 -0
  112. package/templates/skills/ralph-loop/references/compact-loop.md +182 -0
  113. package/templates/skills/ralph-loop/references/task-transform-legacy.md +259 -0
  114. package/templates/skills/ralph-loop/references/team-orchestration.md +189 -0
  115. package/templates/skills/ralph-loop/steps/step-00-init.md +111 -383
  116. package/templates/skills/ralph-loop/steps/step-01-task.md +79 -896
  117. package/templates/skills/ralph-loop/steps/step-02-execute.md +68 -680
  118. package/templates/skills/ralph-loop/steps/step-03-commit.md +47 -277
  119. package/templates/skills/ralph-loop/steps/step-04-check.md +124 -607
  120. package/templates/skills/ralph-loop/steps/step-05-report.md +68 -367
  121. package/templates/skills/refactor/SKILL.md +12 -176
  122. package/templates/skills/refactor/steps/step-01-discover.md +60 -0
  123. package/templates/skills/refactor/steps/step-02-execute.md +67 -0
  124. package/templates/skills/review-code/SKILL.md +19 -257
  125. package/templates/skills/review-code/steps/step-01-smartstack.md +96 -0
  126. package/templates/skills/review-code/steps/step-02-detailed-review.md +80 -0
  127. package/templates/skills/review-code/steps/step-03-react.md +44 -0
  128. package/templates/skills/ui-components/SKILL.md +7 -0
  129. package/templates/skills/utils/SKILL.md +6 -0
  130. package/templates/skills/validate/SKILL.md +6 -0
  131. package/templates/skills/validate-feature/SKILL.md +8 -0
  132. package/templates/skills/workflow/SKILL.md +40 -118
  133. package/templates/skills/workflow/steps/step-01-implementation.md +84 -0
@@ -80,7 +80,7 @@ prd.json generated for module {moduleCode}:
80
80
  **Key guarantees:**
81
81
  - Source MUST reference feature.json path (traceability)
82
82
  - All data is EXACT COPY from feature.json (no transformation, no invention)
83
- - prd.json version: "2.0.0"
83
+ - prd.json $version: "3.0.0" (unified format with pre-computed tasks)
84
84
  - source.type: "ba-handoff-programmatic"
85
85
 
86
86
  **POST-CHECK (BLOCKING — DO NOT SKIP):**
@@ -221,148 +221,20 @@ IF ANY category shows FAIL → **STOP AND RE-RUN `ss derive-prd`**. DO NOT proce
221
221
 
222
222
  ---
223
223
 
224
- ### 5. Build FEATURE_DATA Object
224
+ ### 5-7. Build FEATURE_DATA, EMBEDDED_ARTIFACTS & Replace Placeholders
225
225
 
226
- Reference `references/html-data-mapping.md` EXACTLY. The FEATURE_DATA object must contain:
226
+ See [references/deploy-data-build.md](../references/deploy-data-build.md) for:
227
+ - Complete FEATURE_DATA object structure (metadata, cadrage, modules, moduleSpecs, consolidation, handoff)
228
+ - Complete EMBEDDED_ARTIFACTS object structure (wireframes, e2eFlows, dependencyGraph)
229
+ - 7-step build process for FEATURE_DATA
230
+ - 4-step artifact gathering for EMBEDDED_ARTIFACTS
231
+ - Placeholder replacement rules (8 placeholders)
227
232
 
228
- **Structure:**
229
- ```javascript
230
- const FEATURE_DATA = {
231
- metadata: {
232
- applicationName: master.application_name,
233
- applicationId: master.feature_id,
234
- version: master.version,
235
- createdAt: ISO_TIMESTAMP,
236
- vibeCoding: master.metadata.vibeCoding // "enabled" or "disabled" — controls UI section visibility
237
- },
238
- cadrage: {
239
- goal: master.cadrage.goal,
240
- vision: master.cadrage.vision,
241
- success_criteria: master.cadrage.success_criteria,
242
- scope: {
243
- // CONVERT feature.json keys to HTML keys:
244
- // mustHave → vital
245
- // shouldHave → important
246
- // couldHave → optional
247
- // outOfScope → excluded
248
- vital: master.globalScope.mustHave || [],
249
- important: master.globalScope.shouldHave || [],
250
- optional: master.globalScope.couldHave || [],
251
- excluded: master.globalScope.outOfScope || []
252
- },
253
- constraints: master.cadrage.constraints || [],
254
- risks: master.cadrage.risks || [],
255
- stakeholders: master.stakeholders || []
256
- },
257
- modules: [
258
- {
259
- moduleCode: module.code,
260
- moduleName: module.name,
261
- moduleDescription: module.description || "",
262
- // ... per-module fields from feature.json
263
- }
264
- ],
265
- moduleSpecs: {
266
- // CRITICAL: Must have ONE entry per module with ALL module data
267
- // Each entry keyed by moduleCode:
268
- "{moduleCode}": {
269
- useCases: module.specification.useCases || [],
270
- businessRules: module.analysis.businessRules || [],
271
- entities: module.analysis.entities || [],
272
- permissions: module.specification.permissions || [],
273
- apiEndpoints: module.specification.apiEndpoints || []
274
- }
275
- },
276
- consolidation: {
277
- // Cross-module analysis
278
- integrations: master.consolidation.integrations || [],
279
- sharedEntities: master.consolidation.sharedEntities || [],
280
- sequenceDiagrams: master.consolidation.e2eFlows || []
281
- },
282
- handoff: {
283
- // From feature.json handoff section
284
- complexity: master.handoff.complexity,
285
- implementationStrategy: master.handoff.implementationStrategy,
286
- moduleOrder: master.handoff.moduleOrder,
287
- filesToCreate: master.handoff.filesToCreate,
288
- brToCodeMapping: master.handoff.brToCodeMapping,
289
- apiEndpointSummary: master.handoff.apiEndpointSummary
290
- }
291
- };
292
- ```
293
-
294
- **Build process:**
295
- 1. Extract metadata from master feature.json
296
- 2. Extract cadrage from master feature.json (CONVERT scope keys)
297
- 3. Extract stakeholders from master.stakeholders
298
- 4. Iterate ALL modules and populate moduleSpecs (THIS IS CRITICAL — empty moduleSpecs = BUG)
299
- 5. For EACH module, extract:
300
- - Use cases from specification.useCases
301
- - Business rules from analysis.businessRules
302
- - Entities from analysis.entities
303
- - Permissions from specification.permissions
304
- - API endpoints from specification.apiEndpoints
305
- 6. Extract consolidation data (integrations, shared entities, E2E flows)
306
- 7. Extract handoff section (complexity, strategy, module order, file counts)
307
-
308
- ---
309
-
310
- ### 6. Build EMBEDDED_ARTIFACTS Object
311
-
312
- Extract visual artifacts and diagrams from the analysis:
313
-
314
- ```javascript
315
- const EMBEDDED_ARTIFACTS = {
316
- wireframes: [
317
- // Extract from each module's specification.uiWireframes
318
- {
319
- moduleCode: "{moduleCode}",
320
- screen: wireframe.screen,
321
- description: wireframe.description,
322
- layout: wireframe.layout || "responsive",
323
- components: wireframe.components || []
324
- }
325
- ],
326
- e2eFlows: [
327
- // Extract from master consolidation.e2eFlows
328
- {
329
- flowName: flow.name,
330
- description: flow.description,
331
- sequence: flow.sequence || [],
332
- modules: flow.modules || []
333
- }
334
- ],
335
- dependencyGraph: {
336
- // From master consolidation.dependencyGraph
337
- nodes: master.consolidation.dependencyGraph?.nodes || [],
338
- edges: master.consolidation.dependencyGraph?.edges || []
339
- }
340
- };
341
- ```
342
-
343
- **Artifact gathering:**
344
- 1. Read each module's `specification.uiWireframes[]` and add to wireframes array
345
- 2. Read master's `consolidation.e2eFlows[]` and add to e2eFlows array
346
- 3. Read master's `consolidation.dependencyGraph` and include as-is
347
- 4. Serialize as JSON with 2-space indentation
348
-
349
- ---
350
-
351
- ### 7. Replace Placeholders in Template
352
-
353
- 1. Serialize the FEATURE_DATA object as JSON (with 2-space indentation)
354
- 2. Serialize the EMBEDDED_ARTIFACTS object as JSON (with 2-space indentation)
355
- 3. Replace `{{FEATURE_DATA}}` with the serialized FEATURE_DATA JSON
356
- 4. Replace `{{EMBEDDED_ARTIFACTS}}` with the serialized EMBEDDED_ARTIFACTS JSON
357
- 5. Replace `{{APPLICATION_NAME}}` with `{application_name}`
358
- 6. Replace `{{APPLICATION_ID}}` with `{feature_id}`
359
- 7. Replace `{{VERSION}}` with `{version}`
360
- 8. Replace `{{CREATED_AT}}` with `{ISO timestamp}`
361
-
362
- **Verification during replacement:**
363
- - Ensure FEATURE_DATA JSON is valid (no trailing commas, proper nesting)
364
- - Ensure EMBEDDED_ARTIFACTS JSON is valid
365
- - Verify placeholders are completely replaced (grep for `{{` to confirm)
233
+ **Critical reminders:**
234
+ - FEATURE_DATA.**moduleSpecs** MUST have ONE entry per module (empty = BUG)
235
+ - FEATURE_DATA.**cadrage.scope** converts `mustHave→vital`, `shouldHave→important`, `couldHave→optional`, `outOfScope→excluded`
236
+ - FEATURE_DATA.**metadata.vibeCoding** from `master.metadata.vibeCoding`
237
+ - Also reference `references/html-data-mapping.md` for the full mapping spec
366
238
 
367
239
  ---
368
240
 
@@ -476,50 +348,10 @@ Effort: {total_days} days ({total_hours} hours)
476
348
 
477
349
  ---
478
350
 
479
- ## MODE SUPPORT
480
-
481
- ### Standard Mode
482
-
483
- Full handoff with all implementation details:
484
- - All 7 file categories
485
- - Complete BR-to-code mapping
486
- - Full API endpoint summary
487
- - Detailed prd.json
488
- - Comprehensive progress tracker
489
-
490
- ### Micro Mode (use_case = micro)
491
-
492
- Simplified handoff with minimal scope:
493
- - Only essential CRUD entity + controller
494
- - 3 core SeedData entries (omit some optional ones)
495
- - Basic prd.json with simplified sections
496
- - Lightweight progress.txt
497
- - Display `/ralph-loop -r` command for later use
498
-
499
- ### Delta Mode (use_case = refactoring)
500
-
501
- Focused handoff for changes:
502
- - Only affected modules listed
503
- - Reuse existing implementation patterns
504
- - Highlight what changed vs baseline
505
- - Update only affected prd.json sections
506
- - Progress tracker shows only delta tasks
507
-
508
- ---
351
+ ## MODE SUPPORT & TROUBLESHOOTING
509
352
 
510
- ## TROUBLESHOOTING
511
-
512
- | Issue | Resolution |
513
- |-------|-----------|
514
- | All modules missing handoff data | Return to step-05a-handoff.md. Handoff MUST be written to each module feature.json. |
515
- | prd.json generation failed | Verify ss derive-prd command is installed and feature.json path is correct. |
516
- | progress.txt incomplete | Ensure all 5 CORE SeedData entries are present per module. Check topological order. |
517
- | BA manifest not found | Create docs/business/index.json if missing. Use schema provided in section 3. |
518
- | Manifest entries incorrect | Verify appCode, moduleCode, and version match feature.json metadata exactly. |
519
- | ba-interactive.html is too small (< 100KB) | FEATURE_DATA not serialized correctly. Verify JSON structure. Re-run FEATURE_DATA build. |
520
- | moduleSpecs missing from HTML | FEATURE_DATA.moduleSpecs is empty or not included in JSON. Verify each module is iterated and populated. |
521
- | Scope keys still show "mustHave" instead of "vital" | Conversion from feature.json keys to HTML keys failed. Check cadrage.scope conversion logic. |
522
- | Wireframes array is empty | Verify each module has specification.uiWireframes. If missing, add wireframe stubs. |
523
- | dependencyGraph missing | Verify master feature.json has consolidation.dependencyGraph. If missing, create empty nodes/edges arrays. |
524
- | HTML opens but data blank (localStorage issue) | Clear browser localStorage. HTML will load pre-populated FEATURE_DATA on first load. |
525
- | Export/re-import fails | Verify exported JSON matches original feature.json schema. Validate with `/business-analyse -x --validate`. |
353
+ See [references/deploy-modes.md](../references/deploy-modes.md) for:
354
+ - **Standard Mode** — full handoff (all 7 categories, complete mapping)
355
+ - **Micro Mode** simplified CRUD (3 core SeedData, lightweight)
356
+ - **Delta Mode** — refactoring focus (affected modules only)
357
+ - **Troubleshooting** 12 common issues with resolutions
@@ -0,0 +1,277 @@
1
+ ---
2
+ name: step-06-review
3
+ description: Apply review corrections from ba-review.json, create new version, regenerate all artifacts
4
+ model: opus
5
+ ---
6
+
7
+ > **Context files:** `_shared.md`, `references/review-data-mapping.md`, `references/html-data-mapping.md`
8
+
9
+ # Step 06: Apply Review Corrections
10
+
11
+ Apply corrections exported from the interactive HTML review (`ba-review.json`) to create a new version of the business analysis with all downstream artifacts regenerated.
12
+
13
+ ## Prerequisites
14
+
15
+ - `workflow_type = "review"` (set by step-00)
16
+ - `review_json_path` points to a valid `ba-review.json` file
17
+ - `application_name` and `docs_dir` are set
18
+
19
+ ## Flow
20
+
21
+ 1. Read and validate ba-review.json
22
+ 2. Read existing master feature.json
23
+ 3. Create new version
24
+ 4. Apply cadrage corrections (reverse mapping)
25
+ 5. Apply module corrections
26
+ 6. Apply consolidation corrections
27
+ 7. Preserve review comments
28
+ 8. Regenerate PRD
29
+ 9. Regenerate progress.txt
30
+ 10. Update manifest
31
+ 11. Regenerate HTML
32
+ 12. Display completion summary
33
+
34
+ ---
35
+
36
+ ## Step 1: Read and Validate ba-review.json
37
+
38
+ ```
39
+ 1. Read file at {review_json_path}
40
+ 2. Parse JSON
41
+ 3. Validate required structure:
42
+ - _reviewMeta: { sourceVersion, sourceApplicationId, exportedAt }
43
+ - metadata: { applicationId, version }
44
+ - cadrage: { ... }
45
+ - modules: [ ... ]
46
+ - moduleSpecifications: { ... }
47
+ 4. If validation fails → display error with missing fields, STOP
48
+ 5. Display: "Review file valid: {_reviewMeta.changeSummary}"
49
+ ```
50
+
51
+ **Store:**
52
+ ```yaml
53
+ review_data: parsed ba-review.json object
54
+ source_version: _reviewMeta.sourceVersion
55
+ change_summary: _reviewMeta.changeSummary
56
+ ```
57
+
58
+ ## Step 2: Read Existing Master Feature.json
59
+
60
+ ```
61
+ 1. Locate master feature.json from docs_dir
62
+ 2. Read and parse
63
+ 3. Verify metadata.application matches _reviewMeta.sourceApplicationId
64
+ 4. Store as existing_master
65
+ ```
66
+
67
+ ## Step 3: Create New Version
68
+
69
+ Determine version bump based on changes:
70
+
71
+ ```
72
+ IF change_summary.modulesAdded.length > 0 OR change_summary.modulesRemoved.length > 0:
73
+ version_type = "major" (v1.0 → v2.0)
74
+ ELSE:
75
+ version_type = "minor" (v1.0 → v1.1)
76
+
77
+ Call ba-writer.createVersion(existing_master.id, "Review corrections applied from v{source_version}")
78
+ ```
79
+
80
+ **Store:**
81
+ ```yaml
82
+ new_version: string (e.g., "1.1" or "2.0")
83
+ new_docs_dir: path to new version directory
84
+ new_master_path: path to new master feature.json
85
+ ```
86
+
87
+ ## Step 4: Apply Cadrage Corrections
88
+
89
+ > **Reference:** `references/review-data-mapping.md` for exact field mapping
90
+
91
+ Read the new master feature.json and apply reverse mapping from review data:
92
+
93
+ ```
94
+ 1. Scope mapping (review → feature.json):
95
+ - cadrage.scope.vital[] → cadrage.globalScope.mustHave[]
96
+ - cadrage.scope.important[] → cadrage.globalScope.shouldHave[]
97
+ - cadrage.scope.optional[] → cadrage.globalScope.couldHave[]
98
+ - cadrage.scope.excluded[] → cadrage.globalScope.outOfScope[]
99
+ (Extract name from {name, description} objects)
100
+
101
+ 2. Stakeholders mapping:
102
+ - For each review stakeholder:
103
+ - role → role (preserved)
104
+ - function → function
105
+ - tasks → tasks
106
+ - access → involvement (reverse: admin→decision-maker, manager→consulted, contributor→end-user, viewer→informed)
107
+ - frequency → frequency (reverse: daily→Quotidien, weekly→Hebdomadaire, monthly→Mensuel, occasional→Occasionnel)
108
+ - frustrations → painPoints (split by newline)
109
+
110
+ 3. Problem/Vision mapping:
111
+ - cadrage.problem.description → cadrage.problem
112
+ - cadrage.problem.trigger → cadrage.trigger
113
+ - cadrage.vision.changes → cadrage.toBe
114
+ - cadrage.current.tools → cadrage.asIs
115
+
116
+ 4. Risks mapping:
117
+ - For each review risk → cadrage.risks[] (direct mapping, generate RISK-NNN IDs if missing)
118
+
119
+ 5. Acceptance criteria:
120
+ - cadrage.success.definition → cadrage.acceptanceCriteria[] (split by newline, generate AC-NNN IDs)
121
+
122
+ Call ba-writer.enrichSection(new_master.id, "cadrage", updated_cadrage)
123
+ ```
124
+
125
+ ## Step 5: Apply Module Corrections
126
+
127
+ ```
128
+ FOR EACH moduleCode in review_data.moduleSpecifications:
129
+ 1. Check if module exists in current master.modules[]
130
+ - If NEW module (in change_summary.modulesAdded):
131
+ a. Add to master.modules[] with metadata from review
132
+ b. Create module directory and feature.json via ba-writer.create(scope:"module")
133
+ - If REMOVED module (in change_summary.modulesRemoved):
134
+ a. Mark module status as "removed" in master (do NOT delete files)
135
+ - If EXISTING module:
136
+ a. Read module feature.json
137
+
138
+ 2. Reverse-map module specification data:
139
+ - review.useCases[] → specification.useCases[]
140
+ (name→name, actor→primaryActor, steps→mainScenario (split by \n), alternative→alternativeScenarios)
141
+ - review.businessRules[] → analysis.businessRules[]
142
+ (name→name, category→category, statement→statement, example→examples[])
143
+ - review.entities[] → analysis.entities[]
144
+ (name→name, description→description, attributes→attributes, relationships→relationships)
145
+ - review.permissions[] → specification.permissionMatrix
146
+ (reverse "Role|Action" format → {permissions[], roleAssignments[]})
147
+
148
+ 3. Write updated module feature.json via ba-writer.enrichSection()
149
+ ```
150
+
151
+ ## Step 6: Apply Consolidation Corrections
152
+
153
+ ```
154
+ IF review_data.consolidation exists:
155
+ 1. Reverse-map interactions:
156
+ - consolidation.interactions[] → consolidation.crossModuleInteractions[]
157
+ (from→fromModule, to→toModule, description→description)
158
+
159
+ 2. Reverse-map E2E flows:
160
+ - consolidation.e2eFlows[] → consolidation.e2eFlows[]
161
+ (name→name, steps→steps, actors preserved)
162
+
163
+ Call ba-writer.enrichSection(new_master.id, "consolidation", updated_consolidation)
164
+ ```
165
+
166
+ ## Step 7: Preserve Review Comments
167
+
168
+ Store all review feedback in a new `review` section of the master feature.json:
169
+
170
+ ```
171
+ review_section = {
172
+ appliedAt: new Date().toISOString(),
173
+ sourceVersion: source_version,
174
+ comments: review_data.comments || [], // inline structured comments
175
+ specComments: review_data.specComments || {}, // textarea comments per spec item
176
+ wireframeComments: review_data.wireframeComments || {}, // wireframe feedback
177
+ changeSummary: change_summary
178
+ }
179
+
180
+ Call ba-writer.enrichSection(new_master.id, "review", review_section)
181
+ ```
182
+
183
+ ## Step 8: Regenerate PRD
184
+
185
+ ```
186
+ FOR EACH module in master.modules[] WHERE status != "removed":
187
+ Run: ss derive-prd --application {new_master_path} --module {moduleCode}
188
+ Verify: .ralph/prd-{moduleCode}.json exists and has filesToCreate
189
+ ```
190
+
191
+ > `ss derive-prd` is a deterministic CLI command (no LLM), safe for regeneration.
192
+
193
+ ## Step 9: Regenerate progress.txt
194
+
195
+ ```
196
+ Write .ralph/progress.txt with:
197
+ - Link to new master feature.json
198
+ - Link to each module feature.json
199
+ - Link to ba-interactive.html (new version)
200
+ - Summary of review changes applied
201
+ ```
202
+
203
+ ## Step 10: Update Manifest
204
+
205
+ ```
206
+ 1. Read docs/business/index.json
207
+ 2. Find entry for this application
208
+ 3. Update version, lastModified, status
209
+ 4. If entry doesn't exist, create it
210
+ 5. Write docs/business/index.json
211
+ ```
212
+
213
+ ## Step 11: Regenerate Interactive HTML
214
+
215
+ > **Reference:** `references/html-data-mapping.md` for FEATURE_DATA and EMBEDDED_ARTIFACTS mapping
216
+
217
+ ```
218
+ 1. Read ba-interactive.html template from skill templates
219
+ 2. Build FEATURE_DATA from NEW master + module feature.json files
220
+ (follow exact mapping from html-data-mapping.md)
221
+ 3. Build EMBEDDED_ARTIFACTS from NEW module feature.json files
222
+ (wireframes, e2eFlows, dependencyGraph)
223
+ 4. Replace placeholders:
224
+ - {{FEATURE_DATA}} → serialized FEATURE_DATA JSON
225
+ - {{EMBEDDED_ARTIFACTS}} → serialized EMBEDDED_ARTIFACTS JSON
226
+ - {{APPLICATION_NAME}} → application_name
227
+ - {{APPLICATION_ID}} → feature_id
228
+ 5. Write to new version directory: {new_docs_dir}/ba-interactive.html
229
+ ```
230
+
231
+ ## Step 12: Display Completion Summary
232
+
233
+ ```
234
+ ═══════════════════════════════════════════════════════════════
235
+ REVIEW CORRECTIONS APPLIED SUCCESSFULLY
236
+ ═══════════════════════════════════════════════════════════════
237
+
238
+ | Field | Value |
239
+ |----------------------|--------------------------------------|
240
+ | Application | {application_name} |
241
+ | Previous version | v{source_version} |
242
+ | New version | v{new_version} |
243
+ | Version type | {major/minor} |
244
+
245
+ Changes applied:
246
+ | Change | Count |
247
+ |----------------------|--------------------------------------|
248
+ | Cadrage modified | {yes/no} |
249
+ | Modules added | {count} ({list}) |
250
+ | Modules removed | {count} ({list}) |
251
+ | Modules modified | {count} ({list}) |
252
+ | Comments preserved | {count} |
253
+
254
+ Artifacts regenerated:
255
+ | Artifact | Path |
256
+ |----------------------|--------------------------------------|
257
+ | Master feature.json | {new_master_path} |
258
+ | ba-interactive.html | {new_docs_dir}/ba-interactive.html |
259
+ | PRD files | .ralph/prd-*.json |
260
+ | progress.txt | .ralph/progress.txt |
261
+ | Manifest | docs/business/index.json |
262
+
263
+ NEXT STEPS:
264
+ 1. Open the new ba-interactive.html to verify corrections
265
+ 2. Run /ralph-loop -r to start development from the updated analysis
266
+ ═══════════════════════════════════════════════════════════════
267
+ ```
268
+
269
+ ## Error Handling
270
+
271
+ | Error | Action |
272
+ |-------|--------|
273
+ | ba-review.json malformed | Display structure errors, STOP |
274
+ | Source version mismatch | Warn but continue (corrections may still apply) |
275
+ | Module not found for update | Skip module, warn user |
276
+ | PRD generation fails | Warn but continue (can be re-run manually) |
277
+ | Manifest update fails | Warn but continue |
@@ -0,0 +1,95 @@
1
+ # Agent Behavior Pattern Templates
2
+
3
+ > Referenced from `steps/step-02-generate.md` — System prompt templates for each agent behavior pattern.
4
+
5
+ ---
6
+
7
+ ## Explorer Pattern
8
+
9
+ ```markdown
10
+ You are a specialized exploration agent for {purpose}.
11
+
12
+ ## Workflow
13
+
14
+ 1. **Search**: Use Grep and Glob to find relevant files
15
+ 2. **Read**: Load and analyze discovered files
16
+ 3. **Analyze**: Identify patterns, dependencies, and relationships
17
+ 4. **Report**: Present findings in structured format
18
+
19
+ ## Execution Rules
20
+
21
+ - Run independent searches in parallel
22
+ - Always cite file paths and line numbers
23
+ - Focus only on what's relevant to the request
24
+ - Present findings as tables or structured lists
25
+
26
+ ## Output Format
27
+
28
+ List findings with file references:
29
+ ```
30
+ - path/to/file.ext:line - Description of finding
31
+ ```
32
+ ```
33
+
34
+ ---
35
+
36
+ ## Modifier Pattern
37
+
38
+ ```markdown
39
+ You are a code modification specialist for {purpose}.
40
+
41
+ ## Workflow
42
+
43
+ 1. **Read**: Load all specified files with Read tool
44
+ 2. **Analyze**: Understand current structure and patterns
45
+ 3. **Edit**: Apply requested changes using Edit tool
46
+ 4. **Validate**: Verify changes are correct
47
+ 5. **Report**: List what was modified
48
+
49
+ ## Execution Rules
50
+
51
+ - Follow existing code style exactly
52
+ - Preserve all formatting and indentation
53
+ - Make minimal changes to achieve the goal
54
+ - Never add comments unless requested
55
+
56
+ ## Output Format
57
+
58
+ ```
59
+ - path/to/file.ext: [Description of change]
60
+ ```
61
+ ```
62
+
63
+ ---
64
+
65
+ ## Validator Pattern
66
+
67
+ ```markdown
68
+ You are a validation specialist for {purpose}.
69
+
70
+ ## Workflow
71
+
72
+ 1. **Scan**: Find all files to validate
73
+ 2. **Check**: Apply validation rules to each file
74
+ 3. **Report**: Present issues with severity and recommendations
75
+
76
+ ## Execution Rules
77
+
78
+ - Check ALL files in scope, not just a sample
79
+ - Every issue must have a clear recommendation
80
+ - Use severity levels: ERROR, WARN, INFO
81
+ - Present results as tables
82
+
83
+ ## Output Format
84
+
85
+ | File | Severity | Issue | Recommendation |
86
+ |------|----------|-------|----------------|
87
+ | path | ERROR | ... | ... |
88
+ ```
89
+
90
+ ---
91
+
92
+ ## Custom Pattern
93
+
94
+ Use the user's description from Step 1 to generate appropriate sections.
95
+ Include Workflow, Execution Rules, and Output Format sections tailored to the specific purpose.
@@ -79,84 +79,11 @@ Close frontmatter:
79
79
 
80
80
  Based on the behavior pattern chosen in Step 1:
81
81
 
82
- **Explorer pattern:**
83
- ```markdown
84
- You are a specialized exploration agent for {purpose}.
85
-
86
- ## Workflow
87
-
88
- 1. **Search**: Use Grep and Glob to find relevant files
89
- 2. **Read**: Load and analyze discovered files
90
- 3. **Analyze**: Identify patterns, dependencies, and relationships
91
- 4. **Report**: Present findings in structured format
92
-
93
- ## Execution Rules
94
-
95
- - Run independent searches in parallel
96
- - Always cite file paths and line numbers
97
- - Focus only on what's relevant to the request
98
- - Present findings as tables or structured lists
99
-
100
- ## Output Format
101
-
102
- List findings with file references:
103
- ```
104
- - path/to/file.ext:line - Description of finding
105
- ```
106
- ```
107
-
108
- **Modifier pattern:**
109
- ```markdown
110
- You are a code modification specialist for {purpose}.
111
-
112
- ## Workflow
113
-
114
- 1. **Read**: Load all specified files with Read tool
115
- 2. **Analyze**: Understand current structure and patterns
116
- 3. **Edit**: Apply requested changes using Edit tool
117
- 4. **Validate**: Verify changes are correct
118
- 5. **Report**: List what was modified
119
-
120
- ## Execution Rules
121
-
122
- - Follow existing code style exactly
123
- - Preserve all formatting and indentation
124
- - Make minimal changes to achieve the goal
125
- - Never add comments unless requested
126
-
127
- ## Output Format
128
-
129
- ```
130
- - path/to/file.ext: [Description of change]
131
- ```
132
- ```
133
-
134
- **Validator pattern:**
135
- ```markdown
136
- You are a validation specialist for {purpose}.
137
-
138
- ## Workflow
139
-
140
- 1. **Scan**: Find all files to validate
141
- 2. **Check**: Apply validation rules to each file
142
- 3. **Report**: Present issues with severity and recommendations
143
-
144
- ## Execution Rules
145
-
146
- - Check ALL files in scope, not just a sample
147
- - Every issue must have a clear recommendation
148
- - Use severity levels: ERROR, WARN, INFO
149
- - Present results as tables
150
-
151
- ## Output Format
152
-
153
- | File | Severity | Issue | Recommendation |
154
- |------|----------|-------|----------------|
155
- | path | ERROR | ... | ... |
156
- ```
157
-
158
- **Custom pattern:**
159
- Use the user's description from Step 1 to generate appropriate sections.
82
+ See [references/agent-behavior-patterns.md](../references/agent-behavior-patterns.md) for the 4 behavior pattern templates:
83
+ - **Explorer**: Search → Read → Analyze → Report (with file references)
84
+ - **Modifier**: Read Analyze Edit → Validate → Report
85
+ - **Validator**: Scan → Check → Report (with severity table: ERROR/WARN/INFO)
86
+ - **Custom**: User-driven from Step 1 description
160
87
 
161
88
  ### 5. Write Agent File
162
89
 
@@ -187,3 +187,10 @@ If mismatches detected during release finish:
187
187
  | 1 | Mismatches detected (blocking for releases) |
188
188
 
189
189
  </exit_codes>
190
+
191
+ <success_criteria>
192
+ - All version references compared against package.json version
193
+ - Mismatches clearly listed with file path and current vs expected values
194
+ - Exit code 0 when aligned, exit code 1 when mismatched
195
+ - Fix subcommand updates all references successfully
196
+ </success_criteria>