@atlashub/smartstack-cli 3.54.0 → 4.1.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.
@@ -1,23 +1,26 @@
1
1
  ---
2
2
  name: step-07-tests
3
- description: Scaffold tests via MCP for all modified layers
3
+ description: Final Test Sweep security tests, coverage analysis, remaining failures
4
4
  model: opus
5
5
  prev_step: steps/step-06-resolve.md
6
6
  next_step: steps/step-08-run-tests.md
7
7
  ---
8
8
 
9
- # Step 7: Tests
9
+ # Step 7: Final Test Sweep
10
10
 
11
- > **MANDATORY STEP — This is NOT optional.** APEX requires tests for completion.
12
- > If you reached this step, you MUST scaffold and run tests before finishing.
11
+ > **MANDATORY STEP — This is NOT optional.** APEX requires a final test sweep for completion.
12
+ > Backend and frontend tests were already scaffolded and run inline (Layer 2 and Layer 3).
13
+ > This step focuses on: security tests, coverage gaps, cross-layer scenarios, and remaining failures.
13
14
 
14
- **Goal:** Scaffold comprehensive tests using MCP tools. Target: >= 80% coverage.
15
+ **Goal:** Ensure comprehensive test coverage. Target: >= 80% coverage, 100% pass rate.
15
16
 
16
17
  ---
17
18
 
18
- ## 0. Ensure Frontend Test Tooling Exists (if frontend was generated)
19
+ ## 0. Ensure Test Infrastructure Exists
19
20
 
20
- > **Before scaffolding frontend tests, the test infrastructure must be in place.**
21
+ ### 0a. Frontend Test Tooling (if frontend was generated)
22
+
23
+ > **Before scaffolding additional frontend tests, the test infrastructure must be in place.**
21
24
 
22
25
  ```bash
23
26
  # Check if Vitest is installed
@@ -75,11 +78,7 @@ SETUP_EOF
75
78
  fi
76
79
  ```
77
80
 
78
- ---
79
-
80
- ## 1. Ensure Test Projects Exist
81
-
82
- ### 1a. Unit Test Project
81
+ ### 0b. Backend Test Projects
83
82
 
84
83
  ```bash
85
84
  # Check for existing unit test project
@@ -97,7 +96,7 @@ if [ -z "$UNIT_PROJECT" ]; then
97
96
  fi
98
97
  ```
99
98
 
100
- ### 1b. Integration Test Project (for step-04 DB validation)
99
+ ### 0c. Integration Test Project (for DB validation)
101
100
 
102
101
  ```bash
103
102
  # Check for existing integration test project
@@ -122,11 +121,41 @@ fi
122
121
 
123
122
  ---
124
123
 
125
- ## 2. Scaffold Tests via MCP
124
+ ## 1. Conditional Skip — Inline Tests Already Scaffolded
126
125
 
127
- For each layer that was modified:
126
+ > **Backend and frontend tests were already scaffolded inline in step-03 (Layer 2 and Layer 3).**
127
+ > Do NOT re-scaffold tests that already exist. Only scaffold NEW test types here.
128
+
129
+ ```
130
+ Check existing tests:
131
+ → If domain tests exist (from Layer 2 inline): SKIP domain scaffold
132
+ → If application tests exist (from Layer 2 inline): SKIP application scaffold
133
+ → If API integration tests exist (from Layer 2 inline): SKIP API scaffold
134
+ → If frontend form tests exist (from Layer 3 inline): SKIP frontend form scaffold
135
+ ```
136
+
137
+ ---
138
+
139
+ ## 2. Security Tests (PRIMARY focus of this step)
128
140
 
129
- ### Domain Tests
141
+ ```
142
+ Call: mcp__smartstack__scaffold_tests
143
+ module: "{module_code}"
144
+ test_type: "security"
145
+
146
+ Tests: RequirePermission enforcement, multi-tenant isolation, tenant boundary violations
147
+ ```
148
+
149
+ > **Security tests are the main value-add of step-07.** Inline tests cover CRUD functionality;
150
+ > security tests verify authorization and isolation — these require cross-layer awareness.
151
+
152
+ ---
153
+
154
+ ## 3. Scaffold Missing Tests (if any layers skipped inline)
155
+
156
+ For each layer that was NOT tested inline:
157
+
158
+ ### Domain Tests (if not already scaffolded)
130
159
  ```
131
160
  Call: mcp__smartstack__scaffold_tests
132
161
  target_layer: "domain"
@@ -136,7 +165,7 @@ Call: mcp__smartstack__scaffold_tests
136
165
  Tests: entity creation, validation, domain events, value objects
137
166
  ```
138
167
 
139
- ### Application Tests
168
+ ### Application Tests (if not already scaffolded)
140
169
  ```
141
170
  Call: mcp__smartstack__scaffold_tests
142
171
  target_layer: "application"
@@ -146,7 +175,7 @@ Call: mcp__smartstack__scaffold_tests
146
175
  Tests: service logic, CQRS handlers, FluentValidation
147
176
  ```
148
177
 
149
- ### API Tests
178
+ ### API Tests (if not already scaffolded)
150
179
  ```
151
180
  Call: mcp__smartstack__scaffold_tests
152
181
  target_layer: "api"
@@ -156,16 +185,7 @@ Call: mcp__smartstack__scaffold_tests
156
185
  Tests: controller endpoints, authorization, response DTOs
157
186
  ```
158
187
 
159
- ### Security Tests
160
- ```
161
- Call: mcp__smartstack__scaffold_tests
162
- module: "{module_code}"
163
- test_type: "security"
164
-
165
- Tests: RequirePermission enforcement, multi-tenant isolation
166
- ```
167
-
168
- ### Frontend Form Tests
188
+ ### Frontend Form Tests (if not already scaffolded)
169
189
  ```
170
190
  For each module with create/edit pages:
171
191
  → Generate EntityCreatePage.test.tsx and EntityEditPage.test.tsx
@@ -185,7 +205,7 @@ Mock API: vi.mock() or MSW — NEVER real API calls
185
205
 
186
206
  ---
187
207
 
188
- ## 3. Suggest Additional Scenarios
208
+ ## 4. Suggest Additional Scenarios
189
209
 
190
210
  ```
191
211
  Call: mcp__smartstack__suggest_test_scenarios
@@ -196,7 +216,7 @@ Review suggestions and add relevant test cases.
196
216
 
197
217
  ---
198
218
 
199
- ## 4. Analyze Coverage
219
+ ## 5. Analyze Coverage
200
220
 
201
221
  ```
202
222
  Call: mcp__smartstack__analyze_test_coverage
@@ -208,18 +228,18 @@ If under 80%: identify uncovered paths, scaffold additional tests
208
228
 
209
229
  ---
210
230
 
211
- ## 5. Test Summary
231
+ ## 6. Test Summary
212
232
 
213
233
  ```
214
- **APEX SmartStack - Tests Scaffolded**
234
+ **APEX SmartStack - Final Test Sweep**
215
235
 
216
- | Layer | Tests Created | Coverage |
217
- |-------|--------------|----------|
218
- | Domain | {count} | {%} |
219
- | Application | {count} | {%} |
220
- | API | {count} | {%} |
221
- | Security | {count} | {%} |
222
- | Frontend Forms | {count} | {%} |
236
+ | Layer | Inline Tests | Final Sweep | Total |
237
+ |-------|-------------|-------------|-------|
238
+ | Domain | {count} (Layer 2) | {count} | {total} |
239
+ | Application | {count} (Layer 2) | {count} | {total} |
240
+ | API | {count} (Layer 2) | {count} | {total} |
241
+ | Security | — | {count} | {count} |
242
+ | Frontend Forms | {count} (Layer 3) | {count} | {total} |
223
243
 
224
244
  **Total tests:** {count}
225
245
  **Estimated coverage:** {%}
@@ -227,7 +247,7 @@ If under 80%: identify uncovered paths, scaffold additional tests
227
247
 
228
248
  ---
229
249
 
230
- ## 6. Save Output (if save_mode)
250
+ ## 7. Save Output (if save_mode)
231
251
 
232
252
  Write to `{output_dir}/07-tests.md` with test scaffolding results.
233
253
 
@@ -1,12 +1,12 @@
1
1
  ---
2
2
  name: step-08-run-tests
3
- description: Run tests until 100% pass — fix CODE not tests
3
+ description: Run Final Test Sweep until 100% pass — fix CODE not tests
4
4
  model: opus
5
5
  prev_step: steps/step-07-tests.md
6
6
  next_step: COMPLETE
7
7
  ---
8
8
 
9
- # Step 8: Run Tests
9
+ # Step 8: Run Final Test Sweep
10
10
 
11
11
  **CRITICAL:** Fix the CODE, not the tests. Tests represent expected behavior.
12
12
  100% pass required for Sonar quality gate.
@@ -68,6 +68,8 @@ fi
68
68
 
69
69
  ## 4. Fix Loop (max 5 iterations)
70
70
 
71
+ > **Max 5 iterations (vs max 3 inline).** This catches cross-layer problems that inline tests missed.
72
+
71
73
  ```
72
74
  WHILE tests failing AND iteration < 5:
73
75
  1. Identify root cause (ALWAYS code bug, not test bug)
@@ -116,7 +118,7 @@ npm run typecheck
116
118
  ## 6. Commit Tests
117
119
 
118
120
  ```
119
- test({module}): add unit and integration tests
121
+ test({module}): security tests and coverage sweep
120
122
  ```
121
123
 
122
124
  ---