@atlashub/smartstack-cli 3.8.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 (120) 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 +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 +176 -14
  42. package/templates/skills/business-analyse/html/src/scripts/01-data-init.js +1 -0
  43. package/templates/skills/business-analyse/html/src/scripts/05-render-specs.js +16 -4
  44. package/templates/skills/business-analyse/html/src/scripts/06-render-consolidation.js +7 -2
  45. package/templates/skills/business-analyse/html/src/scripts/09-export.js +103 -0
  46. package/templates/skills/business-analyse/html/src/scripts/10-comments.js +12 -6
  47. package/templates/skills/business-analyse/html/src/scripts/11-review-panel.js +24 -2
  48. package/templates/skills/business-analyse/html/src/styles/08-review-panel.css +12 -0
  49. package/templates/skills/business-analyse/html/src/template.html +1 -0
  50. package/templates/skills/business-analyse/references/cadrage-structure-cards.md +78 -0
  51. package/templates/skills/business-analyse/references/cadrage-vibe-coding.md +97 -0
  52. package/templates/skills/business-analyse/references/consolidation-structural-checks.md +92 -0
  53. package/templates/skills/business-analyse/references/deploy-data-build.md +121 -0
  54. package/templates/skills/business-analyse/references/deploy-modes.md +49 -0
  55. package/templates/skills/business-analyse/references/handoff-file-templates.md +119 -0
  56. package/templates/skills/business-analyse/references/handoff-mappings.md +81 -0
  57. package/templates/skills/business-analyse/references/html-data-mapping.md +10 -2
  58. package/templates/skills/business-analyse/references/init-schema-deployment.md +65 -0
  59. package/templates/skills/business-analyse/references/review-data-mapping.md +363 -0
  60. package/templates/skills/business-analyse/references/spec-auto-inference.md +57 -0
  61. package/templates/skills/business-analyse/references/ui-dashboard-spec.md +85 -0
  62. package/templates/skills/business-analyse/references/ui-resource-cards.md +110 -0
  63. package/templates/skills/business-analyse/references/validate-incremental-html.md +55 -0
  64. package/templates/skills/business-analyse/steps/step-00-init.md +35 -68
  65. package/templates/skills/business-analyse/steps/step-01-cadrage.md +5 -194
  66. package/templates/skills/business-analyse/steps/step-03a-data.md +6 -49
  67. package/templates/skills/business-analyse/steps/step-03b-ui.md +12 -178
  68. package/templates/skills/business-analyse/steps/step-03d-validate.md +3 -48
  69. package/templates/skills/business-analyse/steps/step-04-consolidation.md +9 -104
  70. package/templates/skills/business-analyse/steps/step-05a-handoff.md +25 -441
  71. package/templates/skills/business-analyse/steps/step-05b-deploy.md +19 -187
  72. package/templates/skills/business-analyse/steps/step-06-review.md +277 -0
  73. package/templates/skills/cc-agent/references/agent-behavior-patterns.md +95 -0
  74. package/templates/skills/cc-agent/steps/step-02-generate.md +5 -78
  75. package/templates/skills/check-version/SKILL.md +7 -0
  76. package/templates/skills/controller/references/controller-code-templates.md +159 -0
  77. package/templates/skills/controller/references/permission-sync-templates.md +152 -0
  78. package/templates/skills/controller/steps/step-03-generate.md +6 -158
  79. package/templates/skills/controller/steps/step-04-perms.md +5 -144
  80. package/templates/skills/debug/SKILL.md +7 -0
  81. package/templates/skills/explore/SKILL.md +6 -0
  82. package/templates/skills/feature-full/SKILL.md +39 -142
  83. package/templates/skills/feature-full/steps/step-01-implementation.md +120 -0
  84. package/templates/skills/gitflow/references/init-config-template.md +135 -0
  85. package/templates/skills/gitflow/references/init-name-normalization.md +103 -0
  86. package/templates/skills/gitflow/references/plan-template.md +69 -0
  87. package/templates/skills/gitflow/references/start-efcore-preflight.md +70 -0
  88. package/templates/skills/gitflow/references/start-local-config.md +110 -0
  89. package/templates/skills/gitflow/steps/step-init.md +18 -289
  90. package/templates/skills/gitflow/steps/step-plan.md +6 -63
  91. package/templates/skills/gitflow/steps/step-start.md +16 -126
  92. package/templates/skills/mcp/SKILL.md +9 -213
  93. package/templates/skills/mcp/steps/step-01-healthcheck.md +108 -0
  94. package/templates/skills/mcp/steps/step-02-tools.md +73 -0
  95. package/templates/skills/notification/SKILL.md +7 -0
  96. package/templates/skills/quick-search/SKILL.md +5 -0
  97. package/templates/skills/ralph-loop/SKILL.md +99 -381
  98. package/templates/skills/ralph-loop/references/category-rules.md +259 -0
  99. package/templates/skills/ralph-loop/references/compact-loop.md +182 -0
  100. package/templates/skills/ralph-loop/references/task-transform-legacy.md +259 -0
  101. package/templates/skills/ralph-loop/references/team-orchestration.md +189 -0
  102. package/templates/skills/ralph-loop/steps/step-00-init.md +111 -383
  103. package/templates/skills/ralph-loop/steps/step-01-task.md +79 -896
  104. package/templates/skills/ralph-loop/steps/step-02-execute.md +68 -680
  105. package/templates/skills/ralph-loop/steps/step-03-commit.md +47 -277
  106. package/templates/skills/ralph-loop/steps/step-04-check.md +124 -607
  107. package/templates/skills/ralph-loop/steps/step-05-report.md +68 -367
  108. package/templates/skills/refactor/SKILL.md +12 -176
  109. package/templates/skills/refactor/steps/step-01-discover.md +60 -0
  110. package/templates/skills/refactor/steps/step-02-execute.md +67 -0
  111. package/templates/skills/review-code/SKILL.md +19 -257
  112. package/templates/skills/review-code/steps/step-01-smartstack.md +96 -0
  113. package/templates/skills/review-code/steps/step-02-detailed-review.md +80 -0
  114. package/templates/skills/review-code/steps/step-03-react.md +44 -0
  115. package/templates/skills/ui-components/SKILL.md +7 -0
  116. package/templates/skills/utils/SKILL.md +6 -0
  117. package/templates/skills/validate/SKILL.md +6 -0
  118. package/templates/skills/validate-feature/SKILL.md +8 -0
  119. package/templates/skills/workflow/SKILL.md +40 -118
  120. package/templates/skills/workflow/steps/step-01-implementation.md +84 -0
@@ -0,0 +1,160 @@
1
+ ---
2
+ name: step-02-plan
3
+ description: Create layer-by-layer execution plan with skill/MCP mapping per file
4
+ model: opus
5
+ prev_step: steps/step-01-analyze.md
6
+ next_step: steps/step-03-execute.md
7
+ ---
8
+
9
+ # Step 2: Plan
10
+
11
+ **Goal:** Create a precise, file-by-file plan. Each file mapped to a SKILL or MCP tool.
12
+
13
+ ## LOAD CONDITIONALLY
14
+
15
+ Read `references/smartstack-layers.md` for layer execution rules and skill/MCP mapping.
16
+
17
+ ---
18
+
19
+ ## 1. Map Changes to Layers
20
+
21
+ For each element identified in step-01 (create or modify), assign to a SmartStack layer:
22
+
23
+ | Layer | Category | Order |
24
+ |-------|----------|-------|
25
+ | 0 | Domain (entities, enums, exceptions) | Sequential |
26
+ | 0 | Infrastructure - EF Configs | Sequential |
27
+ | 0 | Infrastructure - Migration (BLOCKING) | Sequential |
28
+ | 1 | Application (services, DTOs, validators) | Parallel |
29
+ | 1 | API (controllers) | Parallel |
30
+ | 1 | Infrastructure - Seed Data | Parallel |
31
+ | 2 | Frontend (pages, components) | Parallel |
32
+ | 2 | I18n (translations) | Parallel |
33
+ | 3 | Tests | Sequential |
34
+
35
+ ---
36
+
37
+ ## 2. Assign Skill/MCP per File
38
+
39
+ For EACH file in the plan, specify HOW it will be created/modified:
40
+
41
+ ```markdown
42
+ ### Layer 0 — Domain + Infrastructure (sequential)
43
+
44
+ | # | File | Action | Tool |
45
+ |---|------|--------|------|
46
+ | 1 | Domain/Entities/.../MyEntity.cs | create | MCP scaffold_extension |
47
+ | 2 | Infrastructure/.../MyEntityConfiguration.cs | create | MCP scaffold_extension |
48
+ | 3 | Migration | create | MCP suggest_migration + dotnet ef |
49
+
50
+ ### Layer 1 — Application + API (parallel)
51
+
52
+ | # | File | Action | Tool |
53
+ |---|------|--------|------|
54
+ | 4 | Application/Services/.../MyService.cs | create | MCP scaffold_extension |
55
+ | 5 | Application/DTOs/.../MyDto.cs | create | MCP scaffold_extension |
56
+ | 6 | Api/Controllers/.../MyController.cs | create | /controller skill |
57
+ | 7 | Seeding/Data/.../NavigationModuleSeedData.cs | create | MCP generate_permissions |
58
+ | 8 | Seeding/Data/.../PermissionsSeedData.cs | create | MCP generate_permissions |
59
+ | 9 | Seeding/Data/.../RolesSeedData.cs | create | ref smartstack-layers.md |
60
+
61
+ ### Layer 2 — Frontend + I18n (parallel)
62
+
63
+ | # | File | Action | Tool |
64
+ |---|------|--------|------|
65
+ | 10 | src/pages/{Ctx}/{App}/{Mod}/ListPage.tsx | create | /ui-components skill |
66
+ | 11 | src/services/api/{module}Api.ts | create | MCP scaffold_api_client |
67
+ | 12 | src/routes/{module}.tsx | create | MCP scaffold_routes |
68
+ | 13 | src/locales/fr/{module}.json | create | manual (4 languages) |
69
+
70
+ ### Layer 3 — Tests (sequential, if -t)
71
+
72
+ | # | File | Action | Tool |
73
+ |---|------|--------|------|
74
+ | 14 | tests/.../MyEntityTests.cs | create | MCP scaffold_tests |
75
+ | 15 | tests/.../MyServiceTests.cs | create | MCP scaffold_tests |
76
+ ```
77
+
78
+ ---
79
+
80
+ ## 3. Identify Parallelization (Agent Teams)
81
+
82
+ If NOT economy_mode AND Layer 1 has both backend and frontend work:
83
+
84
+ ```
85
+ Layer 0: SEQUENTIAL (agent principal)
86
+ → domain + infra + migration
87
+ → dotnet build --no-restore (BLOCKING)
88
+
89
+ Layer 1: PARALLEL (Agent Teams)
90
+ → exec-backend: application + api + seed data
91
+ → exec-frontend: frontend + i18n
92
+
93
+ Layer 2: SEQUENTIAL (agent principal)
94
+ → final validation + tests
95
+ ```
96
+
97
+ If economy_mode: ALL layers sequential, agent principal only.
98
+
99
+ ---
100
+
101
+ ## 4. Dependency Validation
102
+
103
+ Verify the plan respects dependencies:
104
+
105
+ ```
106
+ - Migration AFTER EF configs (always)
107
+ - Application services AFTER domain entities (always)
108
+ - Controllers AFTER application services (always)
109
+ - Frontend AFTER API controllers (API contract needed)
110
+ - Seed data AFTER navigation module exists
111
+ - Tests AFTER all code layers complete
112
+ - Build check between Layer 0 and Layer 1 (BLOCKING)
113
+ ```
114
+
115
+ ---
116
+
117
+ ## 5. Estimated Commits
118
+
119
+ ```
120
+ feat({module}): [domain+infra] {description}
121
+ feat({module}): [app+api] {description}
122
+ feat({module}): [frontend] {description}
123
+ feat({module}): [seed] {description}
124
+ feat({module}): [tests] {description} # if -t
125
+ ```
126
+
127
+ ---
128
+
129
+ ## 6. User Checkpoint (if NOT auto_mode)
130
+
131
+ Present the plan and ask for validation:
132
+
133
+ ```yaml
134
+ questions:
135
+ - header: "Plan"
136
+ question: "Does this execution plan look correct?"
137
+ options:
138
+ - label: "Approve and execute (Recommended)"
139
+ description: "Proceed with the plan as described"
140
+ - label: "Modify plan"
141
+ description: "I want to adjust some items"
142
+ - label: "Cancel"
143
+ description: "Abort the workflow"
144
+ multiSelect: false
145
+ ```
146
+
147
+ If "Modify plan": ask what to change, update plan, re-present.
148
+ If "Cancel": abort workflow.
149
+
150
+ ---
151
+
152
+ ## 7. Save Output (if save_mode)
153
+
154
+ Write to `{output_dir}/02-plan.md` with the complete plan.
155
+
156
+ ---
157
+
158
+ ## NEXT STEP
159
+
160
+ Load `steps/step-03-execute.md`
@@ -0,0 +1,166 @@
1
+ ---
2
+ name: step-03-execute
3
+ description: Orchestrate code creation via existing skills and MCP tools
4
+ model: opus
5
+ prev_step: steps/step-02-plan.md
6
+ next_step: steps/step-04-validate.md
7
+ ---
8
+
9
+ # Step 3: Execute
10
+
11
+ **CRITICAL PRINCIPLE: /apex ORCHESTRATES. It NEVER writes SmartStack code directly.**
12
+ All code goes through skills (/controller, /application, /ui-components, /efcore) or MCP tools.
13
+
14
+ ## LOAD CONDITIONALLY
15
+
16
+ - Read `references/smartstack-layers.md` for execution rules per layer
17
+ - If NOT `{economy_mode}` AND Layer 1 has parallel work: read `references/agent-teams-protocol.md`
18
+
19
+ ---
20
+
21
+ ## Layer 0 — Domain + Infrastructure (sequential, agent principal)
22
+
23
+ ### Domain Entities
24
+
25
+ ```
26
+ For each entity to create/modify:
27
+ → MCP scaffold_extension (type: "entity", target: entity_name)
28
+ → Verify: inherits AuditableEntity, has IHasData if multi-tenant
29
+ ```
30
+
31
+ ### EF Core Configurations
32
+
33
+ ```
34
+ For each entity:
35
+ → MCP scaffold_extension (type: "configuration", target: entity_name)
36
+ → Verify: table name, relationships, indexes
37
+ → Register DbSet in ExtensionsDbContext if new entity
38
+ ```
39
+
40
+ ### Migration (BLOCKING)
41
+
42
+ ```
43
+ 1. MCP suggest_migration → get standardized name
44
+ 2. dotnet ef migrations add {Name} --project src/{Infra}.csproj --startup-project src/{Api}.csproj -o Persistence/Migrations
45
+ 3. dotnet ef database update (if local DB)
46
+ 4. dotnet build --no-restore → MUST PASS
47
+ ```
48
+
49
+ **BLOCKING:** If build fails after migration, fix EF configs before proceeding.
50
+
51
+ ### Post-Layer 0 Build Gate
52
+
53
+ ```bash
54
+ dotnet build --no-restore
55
+ ```
56
+
57
+ **MUST PASS before Layer 1. If failure, fix and retry.**
58
+
59
+ ---
60
+
61
+ ## Layer 1 — Application + API + Seed Data
62
+
63
+ ### If economy_mode: Sequential execution
64
+
65
+ Execute each item from the plan sequentially using skills and MCP.
66
+
67
+ ### If NOT economy_mode: Agent Teams (parallel)
68
+
69
+ > **Protocol:** See `references/agent-teams-protocol.md`
70
+
71
+ ```
72
+ TeamCreate("apex-exec", description: "Execute Layer 1 in parallel")
73
+
74
+ Spawn 2 teammates (Opus, full tools):
75
+
76
+ 1. exec-backend (team_name: "apex-exec", name: "exec-backend"):
77
+ "Execute these Layer 1 backend tasks for module {module_code}:
78
+ {list of application + api + seed data tasks from plan}
79
+
80
+ For each task:
81
+ - Application services/DTOs: MCP scaffold_extension
82
+ - Controllers: use /controller skill for complex, MCP scaffold_extension for simple
83
+ - Seed data: MCP generate_permissions, then follow smartstack-layers.md templates
84
+
85
+ After ALL tasks done:
86
+ SendMessage(type:'message', recipient:'team-lead', content:'BACKEND_COMPLETE', summary:'Backend layer done')"
87
+
88
+ 2. exec-frontend (team_name: "apex-exec", name: "exec-frontend"):
89
+ "Execute these Layer 1 frontend tasks for module {module_code}:
90
+ {list of frontend + i18n tasks from plan}
91
+
92
+ For each task:
93
+ - API client: MCP scaffold_api_client
94
+ - Routes: MCP scaffold_routes
95
+ - Pages: use /ui-components skill
96
+ - I18n: 4 languages (fr, en, it, de)
97
+ - MUST use src/pages/{Context}/{App}/{Module}/ hierarchy (NOT flat)
98
+
99
+ After ALL tasks done:
100
+ SendMessage(type:'message', recipient:'team-lead', content:'FRONTEND_COMPLETE', summary:'Frontend layer done')"
101
+
102
+ Wait for both teammates to report completion.
103
+
104
+ Build verification:
105
+ dotnet build --no-restore (backend)
106
+ npm run typecheck (frontend, if applicable)
107
+
108
+ shutdown_request → shutdown_response → TeamDelete("apex-exec")
109
+ ```
110
+
111
+ ---
112
+
113
+ ## Layer 1 — Skill Delegation
114
+
115
+ | Skill | When | Context to provide |
116
+ |-------|------|--------------------|
117
+ | /controller | Custom routes, complex auth, file upload | entity, CRUD actions, permissions, routes |
118
+ | /application | Full context/app/module from scratch | context, app, module names |
119
+ | /ui-components | Complex pages (tables, grids, dashboards) | entity, fields, page type |
120
+ | /efcore | Complex EF configs, inheritance | relationships, indexes |
121
+ | /notification | In-app or email notifications | trigger, recipients, template |
122
+ | /workflow | Automated workflows | trigger, steps, conditions |
123
+
124
+ ---
125
+
126
+ ## Layer 2 — Final Seed Data + Validation (sequential)
127
+
128
+ After Layer 1 completes:
129
+
130
+ ```
131
+ 1. Verify seed data completeness:
132
+ - NavigationModuleSeedData.cs with 4 languages
133
+ - PermissionsSeedData.cs with deterministic GUIDs
134
+ - RolesSeedData.cs with context-based role mapping
135
+ - IClientSeedDataProvider updated
136
+ - DI registration added
137
+
138
+ 2. Build gate:
139
+ dotnet build --no-restore → MUST PASS
140
+ npm run typecheck → MUST PASS (if frontend)
141
+ ```
142
+
143
+ ---
144
+
145
+ ## Commits Per Layer
146
+
147
+ After each layer completes and builds pass:
148
+
149
+ ```
150
+ Layer 0: feat({module}): [domain+infra] {short description}
151
+ Layer 1: feat({module}): [app+api] {short description}
152
+ Layer 1: feat({module}): [frontend] {short description} # if applicable
153
+ Layer 2: feat({module}): [seed] {short description} # if applicable
154
+ ```
155
+
156
+ ---
157
+
158
+ ## Save Output (if save_mode)
159
+
160
+ Write to `{output_dir}/03-execute.md` with execution log per layer.
161
+
162
+ ---
163
+
164
+ ## NEXT STEP
165
+
166
+ Load `steps/step-04-validate.md`
@@ -0,0 +1,138 @@
1
+ ---
2
+ name: step-04-validate
3
+ description: MCP validation, build verification, seed data check, acceptance criteria
4
+ model: opus
5
+ prev_step: steps/step-03-execute.md
6
+ next_step: steps/step-05-examine.md
7
+ ---
8
+
9
+ # Step 4: Validate
10
+
11
+ **Goal:** Verify everything works. MCP conventions, build, seed data, acceptance criteria.
12
+
13
+ ---
14
+
15
+ ## 1. MCP Convention Validation
16
+
17
+ ```
18
+ Call: mcp__smartstack__validate_conventions
19
+
20
+ Expected: 0 errors
21
+ If errors found:
22
+ → Fix each error (use appropriate skill/MCP)
23
+ → Re-validate until 0 errors
24
+ ```
25
+
26
+ ---
27
+
28
+ ## 2. EF Core Migration Check (if needs_migration)
29
+
30
+ ```
31
+ Call: mcp__smartstack__check_migrations
32
+
33
+ Verify:
34
+ - Migration exists and is applied
35
+ - No pending model changes
36
+ - ModelSnapshot matches
37
+ ```
38
+
39
+ ---
40
+
41
+ ## 3. Frontend Route Validation (if frontend modified)
42
+
43
+ ```
44
+ Call: mcp__smartstack__validate_frontend_routes
45
+
46
+ Verify:
47
+ - Routes nested inside correct Layout wrapper
48
+ - Route paths match controller patterns
49
+ - No orphan routes
50
+ ```
51
+
52
+ ---
53
+
54
+ ## 4. Build Verification
55
+
56
+ ```bash
57
+ # Backend
58
+ dotnet clean && dotnet restore && dotnet build
59
+
60
+ # Frontend (if applicable)
61
+ npm run typecheck
62
+ ```
63
+
64
+ **BLOCKING:** Both must pass. If failure, fix and retry.
65
+
66
+ ---
67
+
68
+ ## 5. Seed Data Completeness Check (if needs_seed_data)
69
+
70
+ | File | Checks |
71
+ |------|--------|
72
+ | NavigationModuleSeedData | Deterministic GUIDs (SHA256), 4 languages, GetModuleEntry + GetTranslationEntries |
73
+ | PermissionsSeedData | MCP generate_permissions used, paths match Permissions.cs, wildcard + CRUD |
74
+ | RolesSeedData | Admin=wildcard, Manager=CRU, Contributor=CR, Viewer=R |
75
+ | IClientSeedDataProvider | 3 Seed methods, idempotent, factory methods, SaveChanges per group |
76
+ | DI Registration | `services.AddScoped<IClientSeedDataProvider, {App}SeedDataProvider>()` |
77
+
78
+ ---
79
+
80
+ ## 6. Acceptance Criteria POST-CHECK
81
+
82
+ For each AC inferred in step-01:
83
+
84
+ ```
85
+ AC1: {criterion} → PASS / FAIL (evidence: {file:line or test})
86
+ AC2: {criterion} → PASS / FAIL (evidence: {file:line or test})
87
+ ...
88
+ ```
89
+
90
+ **All ACs must PASS. If any FAIL, go back to step-03 to fix.**
91
+
92
+ ---
93
+
94
+ ## 7. Validation Summary
95
+
96
+ ```
97
+ **APEX SmartStack - Validation Complete**
98
+
99
+ | Check | Status |
100
+ |-------|--------|
101
+ | MCP validate_conventions | PASS (0 errors) |
102
+ | EF Core migrations | PASS / N/A |
103
+ | Frontend routes | PASS / N/A |
104
+ | dotnet build | PASS |
105
+ | npm typecheck | PASS / N/A |
106
+ | Seed data | PASS / N/A |
107
+ | Acceptance criteria | {X}/{Y} PASS |
108
+ ```
109
+
110
+ ---
111
+
112
+ ## 8. Save Output (if save_mode)
113
+
114
+ Write to `{output_dir}/04-validate.md` with validation results.
115
+
116
+ ---
117
+
118
+ ## 9. Route to Next Step
119
+
120
+ ```
121
+ IF examine_mode = true:
122
+ → Load steps/step-05-examine.md
123
+
124
+ ELSE IF test_mode = true:
125
+ → Load steps/step-07-tests.md
126
+
127
+ ELSE IF pr_mode = true:
128
+ → Create PR and show final summary
129
+
130
+ ELSE:
131
+ → Show final summary and exit
132
+ ```
133
+
134
+ ---
135
+
136
+ ## FINAL SUMMARY (if no more steps)
137
+
138
+ Display: task, context, files created/modified, validation status, commits count, next steps (git diff, dotnet test, deploy).
@@ -0,0 +1,124 @@
1
+ ---
2
+ name: step-05-examine
3
+ description: Adversarial code review of changes — find issues before they reach production
4
+ model: opus
5
+ prev_step: steps/step-04-validate.md
6
+ next_step: steps/step-06-resolve.md
7
+ ---
8
+
9
+ # Step 5: Examine (if -x)
10
+
11
+ **Goal:** Review the code as an adversarial external reviewer. Find bugs, security issues, and convention violations that automated checks missed.
12
+
13
+ ---
14
+
15
+ ## 1. Gather Changed Files
16
+
17
+ ```bash
18
+ git diff --name-only HEAD~{commit_count}
19
+ ```
20
+
21
+ List all files modified during this APEX session.
22
+
23
+ ---
24
+
25
+ ## 2. MCP Code Review
26
+
27
+ ```
28
+ Call: mcp__smartstack__review_code
29
+ scope: "changed" # Only review files changed in this session
30
+
31
+ Call: mcp__smartstack__analyze_code_quality
32
+ scope: "changed"
33
+ ```
34
+
35
+ ---
36
+
37
+ ## 3. Manual Adversarial Review
38
+
39
+ For each changed file, check:
40
+
41
+ **Security (OWASP):**
42
+ - [ ] `[RequirePermission]` on every endpoint (not `[Authorize]`)
43
+ - [ ] No SQL injection (parameterized queries, EF Core only)
44
+ - [ ] No XSS (React auto-escapes, but check dangerouslySetInnerHTML)
45
+ - [ ] Multi-tenant isolation (IHasData filter applied)
46
+ - [ ] No secrets in code
47
+
48
+ **Architecture:**
49
+ - [ ] Entities in correct Domain folder
50
+ - [ ] Configs in correct Infrastructure folder
51
+ - [ ] Services follow CQRS pattern
52
+ - [ ] DTOs separate from domain entities
53
+ - [ ] Controllers return DTOs, not entities
54
+ - [ ] Frontend in correct hierarchy (Context/App/Module)
55
+
56
+ **SmartStack conventions:**
57
+ - [ ] Deterministic GUIDs in seed data (not Guid.NewGuid())
58
+ - [ ] 4 languages in translations
59
+ - [ ] CSS variables (not hardcoded colors)
60
+ - [ ] SmartTable/SmartForm (not raw HTML tables/forms)
61
+ - [ ] Correct Layout wrapper per context
62
+
63
+ ---
64
+
65
+ ## 4. Produce Findings
66
+
67
+ For each issue found, classify:
68
+
69
+ ```
70
+ [BLOCKING] — Must fix before completion
71
+ [SUGGESTION] — Should fix, quality improvement
72
+ [NIT] — Minor style/preference issue
73
+ ```
74
+
75
+ **Findings format:**
76
+
77
+ ```markdown
78
+ ### Finding F01 [BLOCKING]
79
+ **File:** {path}:{line}
80
+ **Issue:** {description}
81
+ **Fix:** {recommended fix}
82
+
83
+ ### Finding F02 [SUGGESTION]
84
+ **File:** {path}:{line}
85
+ **Issue:** {description}
86
+ **Fix:** {recommended fix}
87
+ ```
88
+
89
+ ---
90
+
91
+ ## 5. Summary
92
+
93
+ ```
94
+ **APEX SmartStack - Examine Complete**
95
+
96
+ **Files reviewed:** {count}
97
+ **Findings:** {blocking} BLOCKING, {suggestions} SUGGESTION, {nits} NIT
98
+
99
+ {findings table}
100
+ ```
101
+
102
+ ---
103
+
104
+ ## 6. Save Output (if save_mode)
105
+
106
+ Write to `{output_dir}/05-examine.md` with all findings.
107
+
108
+ ---
109
+
110
+ ## 7. Route to Next Step
111
+
112
+ ```
113
+ IF BLOCKING findings exist:
114
+ → Load steps/step-06-resolve.md
115
+
116
+ ELSE IF test_mode = true:
117
+ → Load steps/step-07-tests.md
118
+
119
+ ELSE IF pr_mode = true:
120
+ → Create PR and show final summary
121
+
122
+ ELSE:
123
+ → Show final summary and exit
124
+ ```
@@ -0,0 +1,105 @@
1
+ ---
2
+ name: step-06-resolve
3
+ description: Fix BLOCKING findings from adversarial review
4
+ model: opus
5
+ prev_step: steps/step-05-examine.md
6
+ next_step: steps/step-07-tests.md
7
+ ---
8
+
9
+ # Step 6: Resolve (if BLOCKING findings)
10
+
11
+ **Goal:** Fix all BLOCKING findings from step-05. Re-validate after fixes.
12
+
13
+ ---
14
+
15
+ ## 1. Process BLOCKING Findings
16
+
17
+ For each BLOCKING finding from step-05:
18
+
19
+ ```
20
+ Finding: {F01, F02, ...}
21
+ File: {path}
22
+ Issue: {description}
23
+ Fix approach: {use appropriate skill/MCP tool}
24
+ ```
25
+
26
+ **Fixing rules:**
27
+ - Use the SAME skill/MCP that created the original code
28
+ - If the finding is in a controller → use /controller or MCP scaffold_extension
29
+ - If the finding is in seed data → use MCP generate_permissions
30
+ - If the finding is in frontend → use /ui-components or MCP scaffold_routes
31
+ - NEVER fix by writing raw SmartStack code
32
+
33
+ ---
34
+
35
+ ## 2. Apply Fixes
36
+
37
+ For each finding:
38
+
39
+ ```
40
+ 1. Read the file to understand current state
41
+ 2. Apply fix via appropriate skill/MCP
42
+ 3. Verify fix addresses the finding
43
+ 4. Mark finding as RESOLVED
44
+ ```
45
+
46
+ ---
47
+
48
+ ## 3. Re-Validate
49
+
50
+ After all BLOCKING findings are fixed:
51
+
52
+ ```
53
+ 1. MCP validate_conventions → 0 errors
54
+ 2. dotnet build --no-restore → PASS
55
+ 3. npm run typecheck → PASS (if frontend)
56
+ ```
57
+
58
+ ---
59
+
60
+ ## 4. Commit Fixes
61
+
62
+ ```
63
+ fix({module}): resolve review findings {F01, F02, ...}
64
+ ```
65
+
66
+ ---
67
+
68
+ ## 5. Resolution Summary
69
+
70
+ ```
71
+ **APEX SmartStack - Resolve Complete**
72
+
73
+ **BLOCKING findings:** {count}
74
+ **Resolved:** {count}
75
+ **Remaining:** {count} (should be 0)
76
+
77
+ | Finding | Status | Fix Applied |
78
+ |---------|--------|-------------|
79
+ | F01 | RESOLVED | {description} |
80
+ | F02 | RESOLVED | {description} |
81
+ ```
82
+
83
+ ---
84
+
85
+ ## 6. Save Output (if save_mode)
86
+
87
+ Write to `{output_dir}/06-resolve.md` with resolution log.
88
+
89
+ ---
90
+
91
+ ## 7. Route to Next Step
92
+
93
+ ```
94
+ IF remaining BLOCKING > 0:
95
+ → Loop: fix remaining, re-validate
96
+
97
+ IF test_mode = true:
98
+ → Load steps/step-07-tests.md
99
+
100
+ ELSE IF pr_mode = true:
101
+ → Create PR and show final summary
102
+
103
+ ELSE:
104
+ → Show final summary and exit
105
+ ```