@atlashub/smartstack-cli 3.8.0 → 3.10.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 (130) hide show
  1. package/dist/index.js +365 -2
  2. package/dist/index.js.map +1 -1
  3. package/package.json +2 -1
  4. package/templates/agents/action.md +1 -0
  5. package/templates/agents/ba-writer.md +211 -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/application-roles-template.md +227 -0
  28. package/templates/skills/application/references/backend-controller-hierarchy.md +58 -0
  29. package/templates/skills/application/references/backend-entity-seeding.md +72 -0
  30. package/templates/skills/application/references/backend-verification.md +88 -0
  31. package/templates/skills/application/references/frontend-verification.md +111 -0
  32. package/templates/skills/application/references/nav-fallback-procedure.md +200 -0
  33. package/templates/skills/application/references/provider-template.md +158 -0
  34. package/templates/skills/application/references/test-frontend.md +73 -0
  35. package/templates/skills/application/references/test-prerequisites.md +72 -0
  36. package/templates/skills/application/steps/step-01-navigation.md +7 -198
  37. package/templates/skills/application/steps/step-03-roles.md +45 -7
  38. package/templates/skills/application/steps/step-03b-provider.md +15 -132
  39. package/templates/skills/application/steps/step-04-backend.md +20 -350
  40. package/templates/skills/application/steps/step-05-frontend.md +12 -101
  41. package/templates/skills/application/steps/step-07-tests.md +12 -132
  42. package/templates/skills/business-analyse/SKILL.md +67 -6
  43. package/templates/skills/business-analyse/html/ba-interactive.html +176 -14
  44. package/templates/skills/business-analyse/html/src/scripts/01-data-init.js +1 -0
  45. package/templates/skills/business-analyse/html/src/scripts/05-render-specs.js +16 -4
  46. package/templates/skills/business-analyse/html/src/scripts/06-render-consolidation.js +7 -2
  47. package/templates/skills/business-analyse/html/src/scripts/09-export.js +103 -0
  48. package/templates/skills/business-analyse/html/src/scripts/10-comments.js +12 -6
  49. package/templates/skills/business-analyse/html/src/scripts/11-review-panel.js +24 -2
  50. package/templates/skills/business-analyse/html/src/styles/08-review-panel.css +12 -0
  51. package/templates/skills/business-analyse/html/src/template.html +1 -0
  52. package/templates/skills/business-analyse/references/agent-pooling-best-practices.md +477 -0
  53. package/templates/skills/business-analyse/references/cache-warming-strategy.md +578 -0
  54. package/templates/skills/business-analyse/references/cadrage-structure-cards.md +78 -0
  55. package/templates/skills/business-analyse/references/cadrage-vibe-coding.md +97 -0
  56. package/templates/skills/business-analyse/references/consolidation-structural-checks.md +92 -0
  57. package/templates/skills/business-analyse/references/deploy-data-build.md +121 -0
  58. package/templates/skills/business-analyse/references/deploy-modes.md +49 -0
  59. package/templates/skills/business-analyse/references/handoff-file-templates.md +119 -0
  60. package/templates/skills/business-analyse/references/handoff-mappings.md +81 -0
  61. package/templates/skills/business-analyse/references/html-data-mapping.md +10 -2
  62. package/templates/skills/business-analyse/references/init-schema-deployment.md +65 -0
  63. package/templates/skills/business-analyse/references/review-data-mapping.md +363 -0
  64. package/templates/skills/business-analyse/references/robustness-checks.md +538 -0
  65. package/templates/skills/business-analyse/references/spec-auto-inference.md +57 -0
  66. package/templates/skills/business-analyse/references/ui-dashboard-spec.md +85 -0
  67. package/templates/skills/business-analyse/references/ui-resource-cards.md +110 -0
  68. package/templates/skills/business-analyse/references/validate-incremental-html.md +55 -0
  69. package/templates/skills/business-analyse/schemas/sections/specification-schema.json +33 -1
  70. package/templates/skills/business-analyse/steps/step-00-init.md +186 -53
  71. package/templates/skills/business-analyse/steps/step-01-cadrage.md +5 -194
  72. package/templates/skills/business-analyse/steps/step-03a-data.md +42 -49
  73. package/templates/skills/business-analyse/steps/step-03b-ui.md +12 -178
  74. package/templates/skills/business-analyse/steps/step-03c-compile.md +71 -2
  75. package/templates/skills/business-analyse/steps/step-03d-validate.md +277 -48
  76. package/templates/skills/business-analyse/steps/step-04-consolidation.md +175 -104
  77. package/templates/skills/business-analyse/steps/step-05a-handoff.md +66 -438
  78. package/templates/skills/business-analyse/steps/step-05b-deploy.md +35 -184
  79. package/templates/skills/business-analyse/steps/step-05c-ralph-readiness.md +526 -0
  80. package/templates/skills/business-analyse/steps/step-06-review.md +277 -0
  81. package/templates/skills/cc-agent/references/agent-behavior-patterns.md +95 -0
  82. package/templates/skills/cc-agent/steps/step-02-generate.md +5 -78
  83. package/templates/skills/check-version/SKILL.md +7 -0
  84. package/templates/skills/controller/references/controller-code-templates.md +159 -0
  85. package/templates/skills/controller/references/permission-sync-templates.md +152 -0
  86. package/templates/skills/controller/steps/step-03-generate.md +166 -158
  87. package/templates/skills/controller/steps/step-04-perms.md +5 -144
  88. package/templates/skills/controller/templates.md +11 -2
  89. package/templates/skills/debug/SKILL.md +7 -0
  90. package/templates/skills/explore/SKILL.md +6 -0
  91. package/templates/skills/feature-full/SKILL.md +39 -142
  92. package/templates/skills/feature-full/steps/step-01-implementation.md +120 -0
  93. package/templates/skills/gitflow/references/init-config-template.md +135 -0
  94. package/templates/skills/gitflow/references/init-name-normalization.md +103 -0
  95. package/templates/skills/gitflow/references/plan-template.md +69 -0
  96. package/templates/skills/gitflow/references/start-efcore-preflight.md +70 -0
  97. package/templates/skills/gitflow/references/start-local-config.md +110 -0
  98. package/templates/skills/gitflow/steps/step-init.md +18 -289
  99. package/templates/skills/gitflow/steps/step-plan.md +6 -63
  100. package/templates/skills/gitflow/steps/step-start.md +16 -126
  101. package/templates/skills/mcp/SKILL.md +9 -213
  102. package/templates/skills/mcp/steps/step-01-healthcheck.md +108 -0
  103. package/templates/skills/mcp/steps/step-02-tools.md +73 -0
  104. package/templates/skills/notification/SKILL.md +7 -0
  105. package/templates/skills/quick-search/SKILL.md +5 -0
  106. package/templates/skills/ralph-loop/SKILL.md +99 -381
  107. package/templates/skills/ralph-loop/references/category-rules.md +259 -0
  108. package/templates/skills/ralph-loop/references/compact-loop.md +182 -0
  109. package/templates/skills/ralph-loop/references/core-seed-data.md +173 -21
  110. package/templates/skills/ralph-loop/references/task-transform-legacy.md +259 -0
  111. package/templates/skills/ralph-loop/references/team-orchestration.md +189 -0
  112. package/templates/skills/ralph-loop/steps/step-00-init.md +111 -383
  113. package/templates/skills/ralph-loop/steps/step-01-task.md +79 -896
  114. package/templates/skills/ralph-loop/steps/step-02-execute.md +68 -680
  115. package/templates/skills/ralph-loop/steps/step-03-commit.md +47 -277
  116. package/templates/skills/ralph-loop/steps/step-04-check.md +124 -607
  117. package/templates/skills/ralph-loop/steps/step-05-report.md +68 -367
  118. package/templates/skills/refactor/SKILL.md +12 -176
  119. package/templates/skills/refactor/steps/step-01-discover.md +60 -0
  120. package/templates/skills/refactor/steps/step-02-execute.md +67 -0
  121. package/templates/skills/review-code/SKILL.md +19 -257
  122. package/templates/skills/review-code/steps/step-01-smartstack.md +96 -0
  123. package/templates/skills/review-code/steps/step-02-detailed-review.md +80 -0
  124. package/templates/skills/review-code/steps/step-03-react.md +44 -0
  125. package/templates/skills/ui-components/SKILL.md +7 -0
  126. package/templates/skills/utils/SKILL.md +6 -0
  127. package/templates/skills/validate/SKILL.md +6 -0
  128. package/templates/skills/validate-feature/SKILL.md +8 -0
  129. package/templates/skills/workflow/SKILL.md +40 -118
  130. package/templates/skills/workflow/steps/step-01-implementation.md +84 -0
@@ -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>
@@ -0,0 +1,159 @@
1
+ # Controller & DTO Code Templates
2
+
3
+ > Referenced from `steps/step-03-generate.md` — C# templates for controller, DTOs, and security patterns.
4
+
5
+ ---
6
+
7
+ ## Controller Template
8
+
9
+ **Target path:** `src/SmartStack.Api/Controllers/{ContextShort}/{Application}/{entity}Controller.cs`
10
+
11
+ > Context mapping: `business` → `Business`, `platform` → `Admin`, `personal` → `User`
12
+
13
+ ```csharp
14
+ using Microsoft.AspNetCore.Mvc;
15
+ using Microsoft.AspNetCore.Http;
16
+ using SmartStack.Application.Common.Authorization;
17
+ using SmartStack.Application.Common.Interfaces;
18
+ using SmartStack.Domain.Entities;
19
+
20
+ namespace SmartStack.Api.Controllers.{area};
21
+
22
+ [ApiController]
23
+ [Route("api/{area_lowercase}/[controller]")]
24
+ [Authorize]
25
+ public class {module}Controller : ControllerBase
26
+ {
27
+ private readonly IApplicationDbContext _context;
28
+ private readonly ICurrentUserService _currentUser;
29
+ private readonly ILogger<{module}Controller> _logger;
30
+
31
+ public {module}Controller(
32
+ IApplicationDbContext context,
33
+ ICurrentUserService currentUser,
34
+ ILogger<{module}Controller> logger)
35
+ {
36
+ _context = context;
37
+ _currentUser = currentUser;
38
+ _logger = logger;
39
+ }
40
+
41
+ // Endpoints generated based on plan...
42
+ }
43
+ ```
44
+
45
+ ---
46
+
47
+ ## GET Endpoint Example
48
+
49
+ ```csharp
50
+ [HttpGet]
51
+ [RequirePermission(Permissions.{module}.View)]
52
+ [ProducesResponseType(typeof(PagedResult<{entity}ResponseDto>), StatusCodes.Status200OK)]
53
+ [ProducesResponseType(StatusCodes.Status401Unauthorized)]
54
+ [ProducesResponseType(StatusCodes.Status403Forbidden)]
55
+ public async Task<IActionResult> GetAll(
56
+ [FromQuery] int page = 1,
57
+ [FromQuery] int pageSize = 20,
58
+ CancellationToken ct = default)
59
+ {
60
+ var query = _context.{module}
61
+ .AsNoTracking()
62
+ .OrderByDescending(x => x.CreatedAt);
63
+
64
+ var total = await query.CountAsync(ct);
65
+ var items = await query
66
+ .Skip((page - 1) * pageSize)
67
+ .Take(pageSize)
68
+ .Select(x => new {entity}ResponseDto(x))
69
+ .ToListAsync(ct);
70
+
71
+ return Ok(new PagedResult<{entity}ResponseDto>(items, total, page, pageSize));
72
+ }
73
+ ```
74
+
75
+ **Endpoint attributes to include:**
76
+ 1. `[HttpGet]`, `[HttpPost]`, etc.
77
+ 2. `[RequirePermission(Permissions.{module}.View)]`
78
+ 3. `[ProducesResponseType(typeof(...), StatusCodes.Status200OK)]`
79
+ 4. `[ProducesResponseType(StatusCodes.Status401Unauthorized)]`
80
+ 5. `[ProducesResponseType(StatusCodes.Status403Forbidden)]`
81
+
82
+ ---
83
+
84
+ ## DTO Templates
85
+
86
+ **Target paths:**
87
+ ```
88
+ src/SmartStack.Application/DTOs/{module}/{entity}CreateDto.cs
89
+ src/SmartStack.Application/DTOs/{module}/{entity}UpdateDto.cs
90
+ src/SmartStack.Application/DTOs/{module}/{entity}ResponseDto.cs
91
+ ```
92
+
93
+ **CreateDto:**
94
+ ```csharp
95
+ public record {entity}CreateDto(
96
+ string Name,
97
+ // ... required properties
98
+ );
99
+ ```
100
+
101
+ **UpdateDto:**
102
+ ```csharp
103
+ public record {entity}UpdateDto(
104
+ string? Name,
105
+ // ... optional properties
106
+ );
107
+ ```
108
+
109
+ **ResponseDto:**
110
+ ```csharp
111
+ public record {entity}ResponseDto(
112
+ Guid Id,
113
+ string Name,
114
+ // ... all public properties
115
+ DateTime CreatedAt,
116
+ DateTime? UpdatedAt
117
+ )
118
+ {
119
+ public {entity}ResponseDto({entity} entity) : this(
120
+ entity.Id,
121
+ entity.Name,
122
+ // ... mapping
123
+ entity.CreatedAt,
124
+ entity.UpdatedAt
125
+ ) { }
126
+ }
127
+ ```
128
+
129
+ ---
130
+
131
+ ## Security Logging Templates
132
+
133
+ ```csharp
134
+ // Create
135
+ _logger.LogInformation("User {User} created {entity} {Id}",
136
+ _currentUser.Email, entity.Id);
137
+
138
+ // Update
139
+ _logger.LogInformation("User {User} updated {entity} {Id}",
140
+ _currentUser.Email, entity.Id);
141
+
142
+ // Delete (Warning level)
143
+ _logger.LogWarning("User {User} deleted {entity} {Id} ({Name})",
144
+ _currentUser.Email, id, entity.Name);
145
+ ```
146
+
147
+ ---
148
+
149
+ ## System Account Protection
150
+
151
+ ```csharp
152
+ // Before modify/delete operations
153
+ if (entity.UserType == UserType.System || entity.UserType == UserType.LocalAdmin)
154
+ {
155
+ _logger.LogWarning("Attempt to modify system account {Id} by {User}",
156
+ entity.Id, _currentUser.Email);
157
+ return BadRequest(new { message = "Cannot modify system accounts" });
158
+ }
159
+ ```