@atlashub/smartstack-cli 2.9.0 → 3.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.
- package/.documentation/agents.html +1 -371
- package/.documentation/business-analyse.html +81 -17
- package/.documentation/cli-commands.html +1 -1
- package/.documentation/commands.html +1 -1
- package/.documentation/efcore.html +1 -1
- package/.documentation/gitflow.html +1 -1
- package/.documentation/hooks.html +27 -66
- package/.documentation/index.html +166 -166
- package/.documentation/init.html +6 -7
- package/.documentation/installation.html +1 -1
- package/.documentation/ralph-loop.html +1 -9
- package/.documentation/test-web.html +15 -39
- package/dist/index.js +23 -16
- 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 +115 -33
- package/templates/agents/gitflow/pr.md +151 -46
- 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/appsettings.json.template +8 -2
- 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/application/SKILL.md +12 -3
- package/templates/skills/application/steps/step-04-backend.md +21 -0
- 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 +2596 -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 +58 -0
- package/templates/skills/business-analyse/steps/step-05-handoff.md +301 -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/steps/step-pr.md +17 -5
- package/templates/skills/gitflow/templates/config.json +10 -1
- package/templates/skills/ralph-loop/SKILL.md +22 -15
- package/templates/skills/ralph-loop/steps/step-01-task.md +89 -4
- package/templates/skills/ralph-loop/steps/step-02-execute.md +408 -23
- package/templates/skills/ralph-loop/steps/step-03-commit.md +84 -2
- package/templates/skills/ralph-loop/steps/step-04-check.md +235 -6
- package/templates/skills/ralph-loop/steps/step-05-report.md +115 -0
- 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
|
@@ -8,17 +8,17 @@ tools: Bash, Read, Glob
|
|
|
8
8
|
|
|
9
9
|
# GitFlow Status Agent
|
|
10
10
|
|
|
11
|
-
Expert GitFlow.
|
|
11
|
+
Expert GitFlow. Display COMPLETE repository state with accessible vocabulary.
|
|
12
12
|
|
|
13
13
|
## Workflow
|
|
14
14
|
|
|
15
|
-
1. **Branches**:
|
|
16
|
-
2. **Tags**:
|
|
17
|
-
3. **
|
|
18
|
-
4. **EF Core**:
|
|
19
|
-
5. **Output**:
|
|
15
|
+
1. **Branches**: List ALL branches (local + remote) with last commit
|
|
16
|
+
2. **Tags**: List ALL tags with dates
|
|
17
|
+
3. **Comparisons**: Analyze differences between develop, main and releases
|
|
18
|
+
4. **EF Core**: Detect pending migrations
|
|
19
|
+
5. **Output**: Complete and understandable display
|
|
20
20
|
|
|
21
|
-
##
|
|
21
|
+
## Commands to Execute
|
|
22
22
|
|
|
23
23
|
```bash
|
|
24
24
|
# 1. BRANCHES
|
|
@@ -32,88 +32,58 @@ git for-each-ref --sort=-v:refname --format='%(refname:short)|%(creatordate:shor
|
|
|
32
32
|
git describe --tags --abbrev=0 main 2>/dev/null
|
|
33
33
|
git describe --tags --abbrev=0 develop 2>/dev/null
|
|
34
34
|
|
|
35
|
-
# 3.
|
|
36
|
-
git rev-list --count main..develop 2>/dev/null
|
|
37
|
-
git rev-list --count develop..main 2>/dev/null
|
|
38
|
-
git log develop..main --oneline 2>/dev/null # si main > 0
|
|
39
|
-
|
|
40
|
-
# Pour chaque release/*
|
|
41
|
-
git branch -a | grep release/
|
|
42
|
-
# Pour chaque: ahead/behind vs develop et main
|
|
35
|
+
# 3. COMPARISONS
|
|
36
|
+
git rev-list --count main..develop 2>/dev/null
|
|
37
|
+
git rev-list --count develop..main 2>/dev/null
|
|
43
38
|
|
|
44
39
|
# 4. STATUS
|
|
45
40
|
git status --porcelain
|
|
46
41
|
```
|
|
47
42
|
|
|
48
|
-
##
|
|
49
|
-
|
|
50
|
-
Utiliser ces termes au lieu du jargon Git:
|
|
51
|
-
- "ahead" → "a publier" ou "prets pour production"
|
|
52
|
-
- "behind" → "a recuperer" ou "manquants"
|
|
53
|
-
- "diverged" → "desynchronise"
|
|
54
|
-
- "merge" → "fusionner" ou "integrer"
|
|
55
|
-
- "branch" → "branche" (garder)
|
|
56
|
-
- "commit" → "changement" ou "modification"
|
|
57
|
-
- "tag" → "version" ou "etiquette de version"
|
|
58
|
-
|
|
59
|
-
## Output Format
|
|
60
|
-
|
|
61
|
-
Suivre le format defini dans la commande 2-status.md avec:
|
|
62
|
-
- Tableaux clairs avec bordures
|
|
63
|
-
- Legendes explicatives
|
|
64
|
-
- Actions concretes a faire
|
|
65
|
-
- Pas de jargon technique sans explication
|
|
66
|
-
|
|
67
|
-
## Generation des ACTIONS A FAIRE (CRITIQUE)
|
|
43
|
+
## Simplified Vocabulary (IMPORTANT)
|
|
68
44
|
|
|
69
|
-
|
|
45
|
+
Use these terms instead of Git jargon:
|
|
46
|
+
- "ahead" -> "to publish" / "ready for production"
|
|
47
|
+
- "behind" -> "to retrieve" / "missing"
|
|
48
|
+
- "diverged" -> "desynchronized"
|
|
49
|
+
- "merge" -> "integrate"
|
|
50
|
+
- "commit" -> "change" / "modification"
|
|
51
|
+
- "tag" -> "version"
|
|
70
52
|
|
|
71
|
-
|
|
53
|
+
## ACTIONS TO DO Generation (CRITICAL)
|
|
72
54
|
|
|
73
|
-
|
|
74
|
-
2. **Inclure le nom exact** de la branche/feature/release dans la commande
|
|
75
|
-
3. **Format obligatoire** - UNE commande par ligne, facilement copiable:
|
|
55
|
+
At the end, ALWAYS generate an "ACTIONS TO DO" section with READY-TO-COPY commands.
|
|
76
56
|
|
|
77
|
-
|
|
78
|
-
{emoji} {Description claire avec contexte}
|
|
79
|
-
{commande complete prete a copier}
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
**IMPORTANT**: La commande doit etre sur SA PROPRE LIGNE, sans prefixe, pour etre copiable en un clic.
|
|
57
|
+
### Detection Logic:
|
|
83
58
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
| Condition detectee | Action a proposer |
|
|
59
|
+
| Detected Condition | Action to Propose |
|
|
87
60
|
|--------------------|-------------------|
|
|
88
|
-
| `main
|
|
89
|
-
| `develop
|
|
90
|
-
| `feature/* ahead > 0 && behind == 0` | `/gitflow
|
|
91
|
-
| `feature/* behind > 5` |
|
|
92
|
-
| `release/* ahead == 0` | `/gitflow
|
|
93
|
-
| `git status dirty` | `/gitflow
|
|
94
|
-
| `local ahead of remote` |
|
|
95
|
-
| `local behind remote` |
|
|
96
|
-
| `migrations pending` |
|
|
97
|
-
|
|
98
|
-
###
|
|
61
|
+
| `main -> develop > 0` | `git merge main` |
|
|
62
|
+
| `develop -> main > 0` | `/gitflow -r v{next_version}` |
|
|
63
|
+
| `feature/* ahead > 0 && behind == 0` | `/gitflow finish` |
|
|
64
|
+
| `feature/* behind > 5` | Rebase recommended |
|
|
65
|
+
| `release/* ahead == 0` | `/gitflow cleanup` |
|
|
66
|
+
| `git status dirty` | `/gitflow commit` |
|
|
67
|
+
| `local ahead of remote` | Push recommended |
|
|
68
|
+
| `local behind remote` | Pull recommended |
|
|
69
|
+
| `migrations pending` | Database deploy recommended |
|
|
70
|
+
|
|
71
|
+
### Example Output:
|
|
99
72
|
|
|
100
73
|
```
|
|
101
|
-
|
|
102
|
-
ACTIONS
|
|
103
|
-
|
|
74
|
+
==============================================================================
|
|
75
|
+
ACTIONS TO DO
|
|
76
|
+
==============================================================================
|
|
104
77
|
|
|
105
|
-
|
|
78
|
+
Retrieve 3 commits from main into develop
|
|
106
79
|
git merge main
|
|
107
80
|
|
|
108
|
-
|
|
109
|
-
/gitflow
|
|
110
|
-
|
|
111
|
-
🗑️ Nettoyer release/v1.4.2 (terminee, 0 commits uniques)
|
|
112
|
-
/gitflow:cleanup release/v1.4.2
|
|
81
|
+
Clean up release/v1.5.1 (finished, 0 unique commits)
|
|
82
|
+
/gitflow cleanup
|
|
113
83
|
|
|
114
|
-
|
|
84
|
+
==============================================================================
|
|
115
85
|
```
|
|
116
86
|
|
|
117
87
|
## Priority
|
|
118
88
|
|
|
119
|
-
|
|
89
|
+
Completeness + Clarity > Speed. User must understand the FULL repo state AND know exactly what to do next.
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Appsettings Guard - PreToolUse Hook
|
|
4
|
+
# Blocks Write operations that would remove top-level sections from appsettings*.json
|
|
5
|
+
# Uses node -e for JSON parsing (no jq dependency)
|
|
6
|
+
|
|
7
|
+
set -euo pipefail
|
|
8
|
+
|
|
9
|
+
# Read hook input from stdin
|
|
10
|
+
HOOK_INPUT=$(cat)
|
|
11
|
+
|
|
12
|
+
# Quick exit: only care about appsettings*.json files (~2ms for non-matching calls)
|
|
13
|
+
case "$HOOK_INPUT" in
|
|
14
|
+
*appsettings*) ;; # proceed to full check
|
|
15
|
+
*) exit 0 ;; # fast exit - not an appsettings file
|
|
16
|
+
esac
|
|
17
|
+
|
|
18
|
+
# Full check using node (guaranteed available in SmartStack projects)
|
|
19
|
+
RESULT=$(echo "$HOOK_INPUT" | node -e "
|
|
20
|
+
const fs = require('fs');
|
|
21
|
+
const input = JSON.parse(fs.readFileSync(0, 'utf8'));
|
|
22
|
+
|
|
23
|
+
const toolName = input.tool_name || '';
|
|
24
|
+
const filePath = (input.tool_input && input.tool_input.file_path) || '';
|
|
25
|
+
const basename = require('path').basename(filePath);
|
|
26
|
+
|
|
27
|
+
// Only guard appsettings*.json files
|
|
28
|
+
if (!/^appsettings.*\.json$/i.test(basename)) {
|
|
29
|
+
process.exit(0);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Allow creation of new files (e.g. appsettings.Local.json from /gitflow start)
|
|
33
|
+
if (!fs.existsSync(filePath)) {
|
|
34
|
+
process.exit(0);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Only guard Write tool (Edit is safe by design - targeted replacement)
|
|
38
|
+
if (toolName !== 'Write') {
|
|
39
|
+
process.exit(0);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const newContent = (input.tool_input && input.tool_input.content) || '';
|
|
43
|
+
|
|
44
|
+
try {
|
|
45
|
+
const currentContent = fs.readFileSync(filePath, 'utf8');
|
|
46
|
+
const currentObj = JSON.parse(currentContent);
|
|
47
|
+
const newObj = JSON.parse(newContent);
|
|
48
|
+
|
|
49
|
+
const currentKeys = Object.keys(currentObj);
|
|
50
|
+
const newKeys = new Set(Object.keys(newObj));
|
|
51
|
+
const missing = currentKeys.filter(k => !newKeys.has(k));
|
|
52
|
+
|
|
53
|
+
if (missing.length > 0) {
|
|
54
|
+
const output = {
|
|
55
|
+
continue: true,
|
|
56
|
+
hookSpecificOutput: {
|
|
57
|
+
hookEventName: 'PreToolUse',
|
|
58
|
+
permissionDecision: 'block',
|
|
59
|
+
permissionDecisionReason: 'APPSETTINGS GUARD: Write supprimerait ' + missing.length + ' section(s) top-level: ' + missing.join(', ') + '. Utilise le tool Edit pour modifier des valeurs specifiques au lieu de reecrire le fichier entier. Si tu dois ajouter une section, utilise Edit pour inserer avant le } fermant.'
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
process.stdout.write(JSON.stringify(output));
|
|
63
|
+
process.exit(2);
|
|
64
|
+
}
|
|
65
|
+
} catch (e) {
|
|
66
|
+
// JSON parse error on current or new content - allow (tool will handle the error)
|
|
67
|
+
process.exit(0);
|
|
68
|
+
}
|
|
69
|
+
" 2>/dev/null) || true
|
|
70
|
+
|
|
71
|
+
if [ -n "$RESULT" ]; then
|
|
72
|
+
echo "$RESULT"
|
|
73
|
+
exit 2
|
|
74
|
+
fi
|
|
75
|
+
|
|
76
|
+
exit 0
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
"EnableDevSeeding": false
|
|
9
9
|
},
|
|
10
10
|
"Jwt": {
|
|
11
|
-
"Secret": "{{GenerateRandomSecret}}",
|
|
12
11
|
"Issuer": "{{ProjectName}}",
|
|
13
12
|
"Audience": "{{ProjectName}}",
|
|
14
13
|
"AccessTokenExpirationMinutes": 60,
|
|
@@ -132,6 +131,10 @@
|
|
|
132
131
|
"SenderAddress": ""
|
|
133
132
|
}
|
|
134
133
|
},
|
|
134
|
+
"Zefix": {
|
|
135
|
+
"Username": "",
|
|
136
|
+
"Password": ""
|
|
137
|
+
},
|
|
135
138
|
"Entra": {
|
|
136
139
|
"TenantId": "",
|
|
137
140
|
"ClientId": "",
|
|
@@ -140,10 +143,13 @@
|
|
|
140
143
|
"SyncIntervalMinutes": 60,
|
|
141
144
|
"UseDeltaSync": true,
|
|
142
145
|
"DefaultConflictResolution": "ManualReview",
|
|
143
|
-
"AutoCreateReferences": true
|
|
146
|
+
"AutoCreateReferences": true,
|
|
147
|
+
"BackgroundSyncEnabled": false,
|
|
148
|
+
"BackgroundSyncIntervalMinutes": 60
|
|
144
149
|
},
|
|
145
150
|
"MultiTenant": {
|
|
146
151
|
"Enabled": true,
|
|
152
|
+
"EnableB2B": true,
|
|
147
153
|
"EnableB2C": true,
|
|
148
154
|
"SystemTenantSlug": "default",
|
|
149
155
|
"SystemTenantName": "Default Workspace",
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { http, HttpResponse } from 'msw';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Default MSW handlers for SmartStack API endpoints.
|
|
5
|
+
* These handlers mock common API calls used across the application.
|
|
6
|
+
*
|
|
7
|
+
* Override these in individual tests using server.use().
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* // In a test file:
|
|
11
|
+
* server.use(
|
|
12
|
+
* http.get('/api/products', () =>
|
|
13
|
+
* HttpResponse.json({
|
|
14
|
+
* items: [{ id: '1', code: 'P-01', name: 'Test Product' }],
|
|
15
|
+
* totalCount: 1,
|
|
16
|
+
* pageNumber: 1,
|
|
17
|
+
* pageSize: 10,
|
|
18
|
+
* })
|
|
19
|
+
* )
|
|
20
|
+
* );
|
|
21
|
+
*/
|
|
22
|
+
export const handlers = [
|
|
23
|
+
// Auth endpoints
|
|
24
|
+
http.get('/api/auth/me', () =>
|
|
25
|
+
HttpResponse.json({
|
|
26
|
+
id: 'test-user-id',
|
|
27
|
+
email: 'test-admin@smartstack.io',
|
|
28
|
+
name: 'Test Admin',
|
|
29
|
+
role: 'Administrator',
|
|
30
|
+
permissions: ['*'],
|
|
31
|
+
})
|
|
32
|
+
),
|
|
33
|
+
|
|
34
|
+
http.post('/api/auth/login', () =>
|
|
35
|
+
HttpResponse.json({
|
|
36
|
+
token: 'test-jwt-token',
|
|
37
|
+
user: {
|
|
38
|
+
id: 'test-user-id',
|
|
39
|
+
email: 'test-admin@smartstack.io',
|
|
40
|
+
name: 'Test Admin',
|
|
41
|
+
},
|
|
42
|
+
})
|
|
43
|
+
),
|
|
44
|
+
|
|
45
|
+
// Navigation endpoints
|
|
46
|
+
http.get('/api/navigation', () =>
|
|
47
|
+
HttpResponse.json([])
|
|
48
|
+
),
|
|
49
|
+
|
|
50
|
+
// User preferences
|
|
51
|
+
http.get('/api/users/preferences', () =>
|
|
52
|
+
HttpResponse.json({})
|
|
53
|
+
),
|
|
54
|
+
|
|
55
|
+
http.put('/api/users/preferences', () =>
|
|
56
|
+
HttpResponse.json({ success: true })
|
|
57
|
+
),
|
|
58
|
+
];
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { setupServer } from 'msw/node';
|
|
2
|
+
import { handlers } from './handlers';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* MSW (Mock Service Worker) server for intercepting API calls in tests.
|
|
6
|
+
* Configured with default handlers that mock common SmartStack API endpoints.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* - Default handlers are loaded from ./handlers.ts
|
|
10
|
+
* - Override handlers per-test using server.use()
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* import { server } from '@/test/msw/server';
|
|
14
|
+
* import { http, HttpResponse } from 'msw';
|
|
15
|
+
*
|
|
16
|
+
* test('custom handler', () => {
|
|
17
|
+
* server.use(
|
|
18
|
+
* http.get('/api/products', () =>
|
|
19
|
+
* HttpResponse.json({ items: [], totalCount: 0 })
|
|
20
|
+
* )
|
|
21
|
+
* );
|
|
22
|
+
* // ... test code
|
|
23
|
+
* });
|
|
24
|
+
*/
|
|
25
|
+
export const server = setupServer(...handlers);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import '@testing-library/jest-dom/vitest';
|
|
2
|
+
import { cleanup } from '@testing-library/react';
|
|
3
|
+
import { afterEach, beforeAll, afterAll } from 'vitest';
|
|
4
|
+
import { server } from './msw/server';
|
|
5
|
+
|
|
6
|
+
// Start MSW server before all tests
|
|
7
|
+
beforeAll(() => server.listen({ onUnhandledRequest: 'warn' }));
|
|
8
|
+
|
|
9
|
+
// Reset handlers after each test (to not leak state between tests)
|
|
10
|
+
afterEach(() => {
|
|
11
|
+
cleanup();
|
|
12
|
+
server.resetHandlers();
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
// Close MSW server after all tests
|
|
16
|
+
afterAll(() => server.close());
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import React, { type ReactElement } from 'react';
|
|
2
|
+
import { render, type RenderOptions } from '@testing-library/react';
|
|
3
|
+
import { BrowserRouter } from 'react-router-dom';
|
|
4
|
+
import { I18nextProvider } from 'react-i18next';
|
|
5
|
+
import i18n from '../i18n'; // Adjust path to your i18n config
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* AuthContext mock for tests.
|
|
9
|
+
* Provides a default authenticated user with admin permissions.
|
|
10
|
+
*/
|
|
11
|
+
const mockAuthContext = {
|
|
12
|
+
user: {
|
|
13
|
+
id: 'test-user-id',
|
|
14
|
+
email: 'test-admin@smartstack.io',
|
|
15
|
+
name: 'Test Admin',
|
|
16
|
+
role: 'Administrator',
|
|
17
|
+
},
|
|
18
|
+
isAuthenticated: true,
|
|
19
|
+
isLoading: false,
|
|
20
|
+
login: async () => {},
|
|
21
|
+
logout: async () => {},
|
|
22
|
+
hasPermission: () => true,
|
|
23
|
+
refreshPermissions: async () => {},
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Wraps components with all necessary providers for testing.
|
|
28
|
+
* Includes: Router, i18n, Auth context.
|
|
29
|
+
*/
|
|
30
|
+
function AllProviders({ children }: { children: React.ReactNode }) {
|
|
31
|
+
return (
|
|
32
|
+
<BrowserRouter>
|
|
33
|
+
<I18nextProvider i18n={i18n}>
|
|
34
|
+
{children}
|
|
35
|
+
</I18nextProvider>
|
|
36
|
+
</BrowserRouter>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Custom render function that wraps components with test providers.
|
|
42
|
+
* Use this instead of @testing-library/react's render.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* import { renderWithProviders, screen } from '@/test/test-utils';
|
|
46
|
+
* renderWithProviders(<MyComponent />);
|
|
47
|
+
* expect(screen.getByText('Hello')).toBeInTheDocument();
|
|
48
|
+
*/
|
|
49
|
+
function renderWithProviders(
|
|
50
|
+
ui: ReactElement,
|
|
51
|
+
options?: Omit<RenderOptions, 'wrapper'>
|
|
52
|
+
) {
|
|
53
|
+
return render(ui, { wrapper: AllProviders, ...options });
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Re-export everything from testing-library
|
|
57
|
+
export * from '@testing-library/react';
|
|
58
|
+
export { renderWithProviders };
|
|
59
|
+
export { mockAuthContext };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/// <reference types="vitest/config" />
|
|
2
|
+
import { defineConfig } from 'vite';
|
|
3
|
+
import react from '@vitejs/plugin-react';
|
|
4
|
+
import path from 'path';
|
|
5
|
+
|
|
6
|
+
export default defineConfig({
|
|
7
|
+
plugins: [react()],
|
|
8
|
+
test: {
|
|
9
|
+
globals: true,
|
|
10
|
+
environment: 'jsdom',
|
|
11
|
+
setupFiles: ['./src/test/setup.ts'],
|
|
12
|
+
css: false,
|
|
13
|
+
include: ['src/**/*.{test,spec}.{ts,tsx}'],
|
|
14
|
+
coverage: {
|
|
15
|
+
provider: 'v8',
|
|
16
|
+
reporter: ['text', 'json', 'html'],
|
|
17
|
+
include: ['src/**/*.{ts,tsx}'],
|
|
18
|
+
exclude: [
|
|
19
|
+
'src/test/**',
|
|
20
|
+
'src/**/*.d.ts',
|
|
21
|
+
'src/main.tsx',
|
|
22
|
+
'src/vite-env.d.ts',
|
|
23
|
+
],
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
resolve: {
|
|
27
|
+
alias: {
|
|
28
|
+
'@': path.resolve(__dirname, './src'),
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
});
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Configuration File Safety Rules
|
|
2
|
+
|
|
3
|
+
## appsettings*.json Protection
|
|
4
|
+
|
|
5
|
+
### MANDATORY Rules
|
|
6
|
+
|
|
7
|
+
1. **NEVER use Write tool on `appsettings*.json`** — ALWAYS use Edit for targeted changes
|
|
8
|
+
2. **NEVER remove existing top-level sections** — only add or modify values within existing structure
|
|
9
|
+
3. **NEVER delete configuration keys** — replace secret VALUES with `<CONFIGURE_HERE>` placeholder
|
|
10
|
+
4. **When adding a new section**, use Edit to insert at the correct location (before the closing `}`)
|
|
11
|
+
|
|
12
|
+
### WHY
|
|
13
|
+
|
|
14
|
+
Claude's Write tool replaces the entire file. If you read a 200-line appsettings.json but only reproduce 150 lines in the Write, 50 lines of configuration are permanently lost. This has caused production incidents where entire authentication, logging, or integration sections disappeared.
|
|
15
|
+
|
|
16
|
+
### Correct Patterns
|
|
17
|
+
|
|
18
|
+
| Action | Tool | Approach |
|
|
19
|
+
|--------|------|----------|
|
|
20
|
+
| Add new section | Edit | Find closing `}`, replace with new section + `}` |
|
|
21
|
+
| Modify a value | Edit | Target the specific key-value pair |
|
|
22
|
+
| Add a key to section | Edit | Find the section's closing `}`, add key before it |
|
|
23
|
+
| Replace secrets | Edit | Replace the VALUE only, keep the key |
|
|
24
|
+
|
|
25
|
+
### Example: Adding a New Section
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
// Use Edit tool with:
|
|
29
|
+
// old_string: "Serilog": { ... }\n}
|
|
30
|
+
// new_string: "Serilog": { ... },\n "NewSection": { "Key": "<CONFIGURE_HERE>" }\n}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Secret Value Handling
|
|
34
|
+
|
|
35
|
+
```json
|
|
36
|
+
// WRONG - removing the key entirely
|
|
37
|
+
"Jwt": { }
|
|
38
|
+
|
|
39
|
+
// WRONG - deleting the section
|
|
40
|
+
// (section missing from file)
|
|
41
|
+
|
|
42
|
+
// CORRECT - placeholder value preserving structure
|
|
43
|
+
"Jwt": {
|
|
44
|
+
"SecretKey": "<CONFIGURE_HERE>",
|
|
45
|
+
"Issuer": "<CONFIGURE_HERE>",
|
|
46
|
+
"Audience": "<CONFIGURE_HERE>",
|
|
47
|
+
"ExpirationMinutes": 60
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Exception: New File Creation
|
|
52
|
+
|
|
53
|
+
Write is acceptable ONLY when creating a NEW `appsettings.*.json` file that does not yet exist on disk (e.g., `appsettings.Local.json` during `/gitflow start`). The PreToolUse hook automatically allows this case.
|
|
54
|
+
|
|
55
|
+
### Protection Layers
|
|
56
|
+
|
|
57
|
+
| Layer | Mechanism | When |
|
|
58
|
+
|-------|-----------|------|
|
|
59
|
+
| Hook `appsettings-guard.sh` | PreToolUse on Write | Blocks Write if top-level sections would be lost |
|
|
60
|
+
| Commit agent step 2b | During `/gitflow commit` | Detects section removal vs HEAD before staging |
|
|
61
|
+
| These instructions | During development | Prevents the issue from occurring |
|
|
@@ -46,7 +46,7 @@ Always in simple code block:
|
|
|
46
46
|
|
|
47
47
|
```markdown
|
|
48
48
|
```
|
|
49
|
-
/gitflow
|
|
49
|
+
/gitflow init --exec
|
|
50
50
|
```
|
|
51
51
|
```
|
|
52
52
|
|
|
@@ -77,7 +77,7 @@ npm test
|
|
|
77
77
|
|
|
78
78
|
```markdown
|
|
79
79
|
<!-- INCORRECT -->
|
|
80
|
-
Execute `/gitflow
|
|
80
|
+
Execute `/gitflow init`
|
|
81
81
|
Run the command `npm run build`
|
|
82
82
|
```
|
|
83
83
|
|
|
@@ -48,7 +48,10 @@ This skill uses progressive step loading. Each step calls MCP tools for generati
|
|
|
48
48
|
| `mcp__smartstack__scaffold_api_client` | TypeScript API client |
|
|
49
49
|
| `mcp__smartstack__scaffold_routes` | React Router configuration |
|
|
50
50
|
| `mcp__smartstack__suggest_migration` | Migration name suggestion |
|
|
51
|
-
| `mcp__smartstack__scaffold_tests` | Test suite generation |
|
|
51
|
+
| `mcp__smartstack__scaffold_tests` | Test suite generation (backend) |
|
|
52
|
+
| `mcp__smartstack__scaffold_frontend_tests` | Test suite generation (frontend React) |
|
|
53
|
+
| `mcp__smartstack__validate_conventions` | Post-generation convention check |
|
|
54
|
+
| `mcp__smartstack__review_code` | Code quality audit |
|
|
52
55
|
|
|
53
56
|
## WHEN THIS SKILL ACTIVATES
|
|
54
57
|
|
|
@@ -88,14 +91,17 @@ WEB (React) → API (.NET) → Application → Infrastructure → Database
|
|
|
88
91
|
3. ROLES (RolePermission mappings)
|
|
89
92
|
3b. CLIENT SEED PROVIDER (client projects only - IClientSeedDataProvider)
|
|
90
93
|
4. API (Controller + DTOs via /controller:create)
|
|
94
|
+
4b. VALIDATE (/validate - convention check on generated backend)
|
|
91
95
|
5. SERVICES (Interface + Implementation)
|
|
92
96
|
6. FRONTEND (Page + Components + Hooks)
|
|
93
97
|
7. I18N (fr, en, it, de)
|
|
94
98
|
8. ROUTES (nested routes mandatory)
|
|
95
99
|
9. PREFERENCES (Hook pattern)
|
|
96
100
|
10. MIGRATION (/efcore:migration)
|
|
97
|
-
11. TESTS (scaffold_tests -
|
|
98
|
-
12.
|
|
101
|
+
11. TESTS - Backend (scaffold_tests - 7 categories including real integration)
|
|
102
|
+
12. TESTS - Frontend (scaffold_frontend_tests - Vitest + Testing Library + MSW)
|
|
103
|
+
13. REVIEW (/review-code - security + architecture + quality audit)
|
|
104
|
+
14. DOCUMENTATION (in-app user doc via /documentation - if userDocRequired)
|
|
99
105
|
```
|
|
100
106
|
|
|
101
107
|
### 3b. Client Seed Provider (client projects only)
|
|
@@ -151,6 +157,9 @@ export function use{Module}Preferences() {
|
|
|
151
157
|
| `/workflow` | Automated emails | IWorkflowService.TriggerAsync |
|
|
152
158
|
| `/ai-prompt` | AI assistance | IAiCompletionService |
|
|
153
159
|
| `/feature-full` | Complete feature | Orchestration all skills |
|
|
160
|
+
| `/validate` | After step-04 (backend) | MCP `validate_conventions` on generated code |
|
|
161
|
+
| `/review-code` | After step-07 (tests) | Security (OWASP), architecture, SOLID, performance audit |
|
|
162
|
+
| `/validate-feature` | After step-07 (tests) | Compile + test + API smoke test |
|
|
154
163
|
| `/documentation` | In-app user doc | Documentation page via doc-data.ts + DocRenderer |
|
|
155
164
|
|
|
156
165
|
### Notification Integration Pattern
|
|
@@ -13,6 +13,8 @@ next_step: steps/step-05-frontend.md
|
|
|
13
13
|
- ALWAYS generate Entity + Service + Controller as a unit
|
|
14
14
|
- NEVER skip controller generation - API is required
|
|
15
15
|
- YOU ARE AN ORCHESTRATOR calling MCP, not a generator
|
|
16
|
+
- **NEVER use Write on appsettings*.json** - ALWAYS use Edit (see _resources/config-safety.md)
|
|
17
|
+
- **Replace secret VALUES with `<CONFIGURE_HERE>`** - NEVER delete keys or sections
|
|
16
18
|
|
|
17
19
|
## YOUR TASK
|
|
18
20
|
|
|
@@ -531,6 +533,25 @@ Scaffold the SQL objects infrastructure:
|
|
|
531
533
|
|
|
532
534
|
**If SqlObjectHelper already exists:** Skip this check.
|
|
533
535
|
|
|
536
|
+
### Check 6: Convention Validation (RECOMMENDED)
|
|
537
|
+
|
|
538
|
+
Run MCP convention validation on the generated backend code:
|
|
539
|
+
|
|
540
|
+
```
|
|
541
|
+
Tool: mcp__smartstack__validate_conventions
|
|
542
|
+
Args:
|
|
543
|
+
target: "backend"
|
|
544
|
+
scope: "{entity_name}"
|
|
545
|
+
```
|
|
546
|
+
|
|
547
|
+
This verifies:
|
|
548
|
+
- Naming conventions (PascalCase entities, correct prefixes)
|
|
549
|
+
- Architecture layers respected (no cross-layer violations)
|
|
550
|
+
- Required attributes present (NavRoute, RequirePermission)
|
|
551
|
+
- DTO patterns followed
|
|
552
|
+
|
|
553
|
+
IF violations found: Fix them before proceeding to step-05.
|
|
554
|
+
|
|
534
555
|
---
|
|
535
556
|
|
|
536
557
|
## SUCCESS METRICS
|