@atlashub/smartstack-cli 2.8.0 → 3.0.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.
- package/.documentation/business-analyse.html +81 -17
- package/dist/index.js +94 -21
- package/dist/index.js.map +1 -1
- package/dist/mcp-entry.mjs +1302 -223
- package/dist/mcp-entry.mjs.map +1 -1
- package/package.json +1 -1
- package/templates/agents/efcore/db-deploy.md +1 -1
- package/templates/agents/efcore/migration.md +26 -10
- package/templates/agents/efcore/rebase-snapshot.md +24 -7
- package/templates/agents/efcore/squash.md +73 -57
- package/templates/agents/gitflow/commit.md +138 -18
- package/templates/agents/gitflow/exec.md +1 -1
- package/templates/agents/gitflow/finish.md +79 -62
- package/templates/agents/gitflow/init-clone.md +186 -0
- package/templates/agents/gitflow/init-detect.md +137 -0
- package/templates/agents/gitflow/init-validate.md +210 -0
- package/templates/agents/gitflow/init.md +231 -74
- package/templates/agents/gitflow/merge.md +65 -33
- package/templates/agents/gitflow/pr.md +93 -49
- package/templates/agents/gitflow/start.md +76 -33
- package/templates/agents/gitflow/status.md +41 -71
- package/templates/hooks/appsettings-guard.sh +76 -0
- package/templates/hooks/ef-migration-check.md +1 -1
- package/templates/hooks/hooks.json +9 -0
- package/templates/project/test-frontend/msw/handlers.ts +58 -0
- package/templates/project/test-frontend/msw/server.ts +25 -0
- package/templates/project/test-frontend/setup.ts +16 -0
- package/templates/project/test-frontend/test-utils.tsx +59 -0
- package/templates/project/test-frontend/vitest.config.ts +31 -0
- package/templates/skills/_resources/config-safety.md +61 -0
- package/templates/skills/_resources/formatting-guide.md +2 -2
- package/templates/skills/_shared.md +21 -0
- package/templates/skills/application/SKILL.md +32 -3
- package/templates/skills/application/steps/step-04-backend.md +21 -0
- package/templates/skills/application/steps/step-05-frontend.md +20 -36
- package/templates/skills/application/steps/step-07-tests.md +259 -120
- package/templates/skills/business-analyse/SKILL.md +57 -28
- package/templates/skills/business-analyse/_shared.md +70 -39
- package/templates/skills/business-analyse/html/ba-interactive.html +2622 -0
- package/templates/skills/business-analyse/questionnaire/00-application.md +123 -131
- package/templates/skills/business-analyse/questionnaire/01-context.md +173 -24
- package/templates/skills/business-analyse/questionnaire/02-stakeholders.md +170 -50
- package/templates/skills/business-analyse/questionnaire/03-scope.md +154 -48
- package/templates/skills/business-analyse/questionnaire/10-documentation.md +1 -1
- package/templates/skills/business-analyse/questionnaire/14-risk-assumptions.md +135 -0
- package/templates/skills/business-analyse/questionnaire/15-success-metrics.md +136 -0
- package/templates/skills/business-analyse/questionnaire.md +55 -46
- package/templates/skills/business-analyse/steps/step-00-init.md +24 -2
- package/templates/skills/business-analyse/steps/step-01-cadrage.md +31 -20
- package/templates/skills/business-analyse/steps/step-03-specify.md +1 -0
- package/templates/skills/business-analyse/steps/step-05-handoff.md +103 -1
- package/templates/skills/business-analyse/steps/step-06-extract.md +518 -0
- package/templates/skills/check-version/SKILL.md +1 -1
- package/templates/skills/efcore/steps/db/step-deploy.md +22 -3
- package/templates/skills/efcore/steps/db/step-reset.md +27 -4
- package/templates/skills/efcore/steps/db/step-seed.md +46 -2
- package/templates/skills/efcore/steps/db/step-status.md +14 -0
- package/templates/skills/efcore/steps/migration/step-01-check.md +31 -5
- package/templates/skills/efcore/steps/migration/step-02-create.md +20 -4
- package/templates/skills/efcore/steps/rebase-snapshot/step-03-create.md +60 -0
- package/templates/skills/efcore/steps/shared/step-00-init.md +47 -8
- package/templates/skills/efcore/steps/squash/step-03-create.md +27 -5
- package/templates/skills/gitflow/SKILL.md +91 -29
- package/templates/skills/gitflow/_shared.md +144 -2
- package/templates/skills/gitflow/phases/status.md +11 -1
- package/templates/skills/gitflow/steps/step-commit.md +1 -1
- package/templates/skills/gitflow/steps/step-init.md +202 -39
- package/templates/skills/gitflow/templates/config.json +10 -1
- package/templates/skills/ralph-loop/steps/step-03-commit.md +2 -2
- package/templates/skills/validate-feature/SKILL.md +83 -0
- package/templates/skills/validate-feature/steps/step-01-compile.md +38 -0
- package/templates/skills/validate-feature/steps/step-02-unit-tests.md +45 -0
- package/templates/skills/validate-feature/steps/step-03-integration-tests.md +53 -0
- package/templates/skills/validate-feature/steps/step-04-api-smoke.md +157 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: step-01-compile
|
|
3
|
+
description: Build the full solution to verify compilation
|
|
4
|
+
next_step: steps/step-02-unit-tests.md
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Step 1: Compilation Check
|
|
8
|
+
|
|
9
|
+
## BLOCKING - Must pass before proceeding
|
|
10
|
+
|
|
11
|
+
### 1. Locate the solution file
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# Find the .sln file
|
|
15
|
+
ls *.sln 2>/dev/null || find . -maxdepth 2 -name "*.sln" -type f
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### 2. Build the entire solution
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
dotnet build {SolutionFile} --verbosity minimal
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### 3. Evaluate result
|
|
25
|
+
|
|
26
|
+
- **Build succeeded** -> Proceed to step 2
|
|
27
|
+
- **Build failed** -> Read the error output, identify the issue:
|
|
28
|
+
- Missing using statement -> Add it
|
|
29
|
+
- Type not found -> Check project references
|
|
30
|
+
- Method signature mismatch -> Fix the code
|
|
31
|
+
- **Re-build until it succeeds**
|
|
32
|
+
|
|
33
|
+
### 4. Store state
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
{solution_file} = path to .sln file
|
|
37
|
+
{build_result} = PASS or FAIL
|
|
38
|
+
```
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: step-02-unit-tests
|
|
3
|
+
description: Run unit tests to verify business logic
|
|
4
|
+
prev_step: steps/step-01-compile.md
|
|
5
|
+
next_step: steps/step-03-integration-tests.md
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Step 2: Unit Tests
|
|
9
|
+
|
|
10
|
+
## BLOCKING - All unit tests must pass
|
|
11
|
+
|
|
12
|
+
### 1. Locate the test project
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
# Find test project
|
|
16
|
+
ls tests/*/*.csproj 2>/dev/null || ls *Tests*/*.csproj 2>/dev/null
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### 2. Run unit tests only
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
dotnet test {TestProject} --no-build --filter "FullyQualifiedName~Unit" --verbosity normal
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
If the filter doesn't match, try:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
dotnet test {TestProject} --no-build --filter "Category!=Integration" --verbosity normal
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### 3. Evaluate result
|
|
32
|
+
|
|
33
|
+
- **All tests passed** -> Proceed to step 3
|
|
34
|
+
- **Tests failed** -> Read the failure output:
|
|
35
|
+
- Assertion failure -> Check if the test expectation matches the implementation
|
|
36
|
+
- Exception thrown -> Check if the service/entity code is correct
|
|
37
|
+
- Compilation error -> Should not happen (step 1 passed), but fix if it does
|
|
38
|
+
- **Fix and re-run until all pass**
|
|
39
|
+
|
|
40
|
+
### 4. Store state
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
{unit_test_count} = number of tests that passed
|
|
44
|
+
{unit_test_result} = PASS or FAIL
|
|
45
|
+
```
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: step-03-integration-tests
|
|
3
|
+
description: Run integration tests to verify real DB operations
|
|
4
|
+
prev_step: steps/step-02-unit-tests.md
|
|
5
|
+
next_step: steps/step-04-api-smoke.md
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Step 3: Integration Tests
|
|
9
|
+
|
|
10
|
+
## BLOCKING - All integration tests must pass
|
|
11
|
+
|
|
12
|
+
### 1. Run integration tests
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
dotnet test {TestProject} --no-build --filter "FullyQualifiedName~Integration" --verbosity normal
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
If the filter doesn't match, try:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
dotnet test {TestProject} --no-build --filter "FullyQualifiedName~ControllerIntegrationTests|FullyQualifiedName~RepositoryTests" --verbosity normal
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### 2. What these tests verify
|
|
25
|
+
|
|
26
|
+
Integration tests use `SmartStackTestFactory` (WebApplicationFactory with SQLite) to run the REAL application pipeline:
|
|
27
|
+
|
|
28
|
+
| What | How |
|
|
29
|
+
|------|-----|
|
|
30
|
+
| Controller routing | HTTP requests hit actual controller endpoints |
|
|
31
|
+
| DI pipeline | Real services and repositories are injected |
|
|
32
|
+
| Database operations | SQLite in-memory stores and retrieves data |
|
|
33
|
+
| Auth middleware | TestAuthHandler provides fake authenticated user |
|
|
34
|
+
| Tenant isolation | Requests with different tenant IDs see different data |
|
|
35
|
+
| Data persistence | POST creates data, GET retrieves it from DB |
|
|
36
|
+
|
|
37
|
+
### 3. Evaluate result
|
|
38
|
+
|
|
39
|
+
- **All tests passed** -> Proceed to step 4
|
|
40
|
+
- **Tests failed** -> Common issues:
|
|
41
|
+
- `Program` not accessible -> Add `public partial class Program { }` to Program.cs
|
|
42
|
+
- DbContext configuration error -> Check that SQLite provider is properly configured
|
|
43
|
+
- Service not registered -> Check DI registration in `Program.cs` or startup
|
|
44
|
+
- Migration issue -> Ensure `EnsureCreatedAsync()` works with SQLite
|
|
45
|
+
- Tenant filter issue -> Check global query filters work with test tenant
|
|
46
|
+
- **Fix and re-run until all pass**
|
|
47
|
+
|
|
48
|
+
### 4. Store state
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
{integration_test_count} = number of tests that passed
|
|
52
|
+
{integration_test_result} = PASS or FAIL
|
|
53
|
+
```
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: step-04-api-smoke
|
|
3
|
+
description: Start the API and test CRUD endpoints with real HTTP requests
|
|
4
|
+
prev_step: steps/step-03-integration-tests.md
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Step 4: API Smoke Test
|
|
8
|
+
|
|
9
|
+
## BLOCKING - All CRUD endpoints must respond correctly
|
|
10
|
+
|
|
11
|
+
### 1. Find the API project
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# Find the API project
|
|
15
|
+
ls src/*Api*/*.csproj 2>/dev/null || ls *Api*/*.csproj 2>/dev/null
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### 2. Start the API in the background
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
# Start the API on a test port
|
|
22
|
+
dotnet run --project {ApiProject} --urls "http://localhost:5099" &
|
|
23
|
+
API_PID=$!
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### 3. Wait for the API to be ready
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
# Poll the health endpoint (or root) until it responds
|
|
30
|
+
for i in $(seq 1 30); do
|
|
31
|
+
curl -s -o /dev/null -w "%{http_code}" http://localhost:5099/health 2>/dev/null
|
|
32
|
+
if [ $? -eq 0 ]; then
|
|
33
|
+
echo "API is ready"
|
|
34
|
+
break
|
|
35
|
+
fi
|
|
36
|
+
sleep 1
|
|
37
|
+
done
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
If no `/health` endpoint exists, try:
|
|
41
|
+
```bash
|
|
42
|
+
curl -s -o /dev/null -w "%{http_code}" http://localhost:5099/api/{entity_code}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### 4. Authenticate (if required)
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
# Try to login with default test credentials
|
|
49
|
+
TOKEN=$(curl -s -X POST http://localhost:5099/api/auth/login \
|
|
50
|
+
-H "Content-Type: application/json" \
|
|
51
|
+
-d '{"email":"admin@smartstack.io","password":"Admin123!"}' \
|
|
52
|
+
| jq -r '.token // .accessToken // empty')
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
If auth is not configured yet, tests may work without a token (depending on configuration).
|
|
56
|
+
|
|
57
|
+
### 5. Test CRUD endpoints
|
|
58
|
+
|
|
59
|
+
**Set common headers:**
|
|
60
|
+
```bash
|
|
61
|
+
AUTH_HEADER="Authorization: Bearer $TOKEN"
|
|
62
|
+
TENANT_HEADER="X-Tenant-Id: 11111111-1111-1111-1111-111111111111"
|
|
63
|
+
CONTENT_TYPE="Content-Type: application/json"
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
#### 5.1 GET all (expect 200)
|
|
67
|
+
```bash
|
|
68
|
+
curl -s -w "\n%{http_code}" \
|
|
69
|
+
-H "$AUTH_HEADER" -H "$TENANT_HEADER" \
|
|
70
|
+
http://localhost:5099/api/{entity_code}
|
|
71
|
+
```
|
|
72
|
+
Expected: HTTP 200
|
|
73
|
+
|
|
74
|
+
#### 5.2 POST create (expect 201 or 200)
|
|
75
|
+
```bash
|
|
76
|
+
CREATED=$(curl -s -w "\n%{http_code}" \
|
|
77
|
+
-X POST \
|
|
78
|
+
-H "$AUTH_HEADER" -H "$TENANT_HEADER" -H "$CONTENT_TYPE" \
|
|
79
|
+
-d '{"code":"smoke-test-01","name":"Smoke Test Entity"}' \
|
|
80
|
+
http://localhost:5099/api/{entity_code})
|
|
81
|
+
```
|
|
82
|
+
Expected: HTTP 201 or 200
|
|
83
|
+
Extract the created entity ID from the response.
|
|
84
|
+
|
|
85
|
+
#### 5.3 GET by ID (expect 200)
|
|
86
|
+
```bash
|
|
87
|
+
curl -s -w "\n%{http_code}" \
|
|
88
|
+
-H "$AUTH_HEADER" -H "$TENANT_HEADER" \
|
|
89
|
+
http://localhost:5099/api/{entity_code}/{created_id}
|
|
90
|
+
```
|
|
91
|
+
Expected: HTTP 200 with the entity data
|
|
92
|
+
|
|
93
|
+
#### 5.4 PUT update (expect 200)
|
|
94
|
+
```bash
|
|
95
|
+
curl -s -w "\n%{http_code}" \
|
|
96
|
+
-X PUT \
|
|
97
|
+
-H "$AUTH_HEADER" -H "$TENANT_HEADER" -H "$CONTENT_TYPE" \
|
|
98
|
+
-d '{"code":"smoke-test-01","name":"Updated Smoke Test"}' \
|
|
99
|
+
http://localhost:5099/api/{entity_code}/{created_id}
|
|
100
|
+
```
|
|
101
|
+
Expected: HTTP 200
|
|
102
|
+
|
|
103
|
+
#### 5.5 DELETE (expect 204)
|
|
104
|
+
```bash
|
|
105
|
+
curl -s -w "\n%{http_code}" \
|
|
106
|
+
-X DELETE \
|
|
107
|
+
-H "$AUTH_HEADER" -H "$TENANT_HEADER" \
|
|
108
|
+
http://localhost:5099/api/{entity_code}/{created_id}
|
|
109
|
+
```
|
|
110
|
+
Expected: HTTP 204
|
|
111
|
+
|
|
112
|
+
#### 5.6 GET deleted (expect 404)
|
|
113
|
+
```bash
|
|
114
|
+
curl -s -w "\n%{http_code}" \
|
|
115
|
+
-H "$AUTH_HEADER" -H "$TENANT_HEADER" \
|
|
116
|
+
http://localhost:5099/api/{entity_code}/{created_id}
|
|
117
|
+
```
|
|
118
|
+
Expected: HTTP 404 (confirms deletion)
|
|
119
|
+
|
|
120
|
+
### 6. Stop the API
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
kill $API_PID 2>/dev/null
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### 7. Evaluate results
|
|
127
|
+
|
|
128
|
+
Build a report:
|
|
129
|
+
|
|
130
|
+
```markdown
|
|
131
|
+
## Feature Validation: {entity_name}
|
|
132
|
+
|
|
133
|
+
| Check | Result | Details |
|
|
134
|
+
|-------|--------|---------|
|
|
135
|
+
| Solution build | {build_result} | |
|
|
136
|
+
| Unit tests | {unit_test_result} | {unit_test_count} passed |
|
|
137
|
+
| Integration tests | {integration_test_result} | {integration_test_count} passed |
|
|
138
|
+
| GET /api/{entity_code} | {status} | |
|
|
139
|
+
| POST /api/{entity_code} | {status} | |
|
|
140
|
+
| GET /api/{entity_code}/{id} | {status} | |
|
|
141
|
+
| PUT /api/{entity_code}/{id} | {status} | |
|
|
142
|
+
| DELETE /api/{entity_code}/{id} | {status} | |
|
|
143
|
+
| GET deleted entity | {status} | |
|
|
144
|
+
|
|
145
|
+
### Overall: {ALL_PASS or FAILURES_DETECTED}
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### 8. Handle failures
|
|
149
|
+
|
|
150
|
+
If any smoke test fails:
|
|
151
|
+
- **401 Unauthorized** -> Auth not configured, check JWT setup
|
|
152
|
+
- **403 Forbidden** -> Permissions not seeded, check PermissionConfiguration
|
|
153
|
+
- **404 Not Found** -> Route not registered, check controller NavRoute
|
|
154
|
+
- **500 Internal Server Error** -> Check API logs for exception details
|
|
155
|
+
- **Connection refused** -> API didn't start, check startup configuration
|
|
156
|
+
|
|
157
|
+
Report all findings to the user with actionable next steps.
|