@atlashub/smartstack-cli 1.13.1 → 1.14.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 -1
- package/.documentation/apex.html +1 -1
- package/.documentation/business-analyse.html +1 -1
- package/.documentation/cli-commands.html +3 -3
- package/.documentation/commands.html +1 -1
- package/.documentation/efcore.html +1 -1
- package/.documentation/gitflow.html +1 -1
- package/.documentation/hooks.html +1 -1
- package/.documentation/index.html +1 -1
- package/.documentation/init.html +3 -3
- package/.documentation/installation.html +1001 -352
- package/.documentation/ralph-loop.html +1 -1
- package/.documentation/test-web.html +1 -1
- package/README.md +88 -20
- package/dist/index.js +276 -85
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/templates/agents/code-reviewer.md +163 -0
- package/templates/agents/efcore/db-deploy.md +25 -7
- package/templates/agents/efcore/db-reset.md +31 -10
- package/templates/agents/efcore/db-status.md +22 -5
- package/templates/agents/efcore/migration.md +69 -19
- package/templates/agents/gitflow/cleanup.md +8 -1
- package/templates/agents/gitflow/commit.md +7 -5
- package/templates/agents/gitflow/finish.md +6 -4
- package/templates/agents/gitflow/pr.md +8 -1
- package/templates/agents/gitflow/start.md +1 -1
- package/templates/commands/check-version.md +267 -0
- package/templates/commands/efcore/_shared.md +30 -1
- package/templates/commands/efcore/db-reset.md +18 -6
- package/templates/commands/gitflow/OPTIMIZATIONS.md +206 -0
- package/templates/commands/refactor.md +164 -0
- package/templates/project/DependencyInjection.Application.cs.template +25 -0
- package/templates/project/DependencyInjection.Infrastructure.cs.template +61 -0
- package/templates/project/DesignTimeExtensionsDbContextFactory.cs.template +70 -0
- package/templates/project/ExampleEntity.cs.template +116 -0
- package/templates/project/ExampleEntityConfiguration.cs.template +64 -0
- package/templates/project/ExampleService.cs.template +146 -0
- package/templates/project/ExtensionsDbContext.cs.template +41 -0
- package/templates/project/IExtensionsDbContext.cs.template +22 -0
- package/templates/project/Program.cs.template +47 -0
- package/templates/project/README.md +79 -0
- package/templates/ralph/README.md +10 -8
- package/templates/ralph/ralph.config.yaml +2 -2
- package/templates/skills/_shared.md +44 -44
- package/templates/skills/ai-prompt/SKILL.md +55 -55
- package/templates/skills/apex/SKILL.md +235 -0
- package/templates/skills/apex/steps/step-00-init.md +203 -0
- package/templates/skills/apex/steps/step-01-analyze.md +210 -0
- package/templates/skills/apex/steps/step-02-plan.md +217 -0
- package/templates/skills/apex/steps/step-03-execute.md +178 -0
- package/templates/skills/apex/steps/step-04-validate.md +217 -0
- package/templates/skills/apex/steps/step-05-examine.md +207 -0
- package/templates/skills/apex/steps/step-06-resolve.md +181 -0
- package/templates/skills/apex/steps/step-07-tests.md +206 -0
- package/templates/skills/apex/steps/step-08-run-tests.md +207 -0
- package/templates/skills/apex/templates/00-context.md +46 -0
- package/templates/skills/apex/templates/01-analyze.md +63 -0
- package/templates/skills/apex/templates/02-plan.md +63 -0
- package/templates/skills/apex/templates/03-execute.md +34 -0
- package/templates/skills/apex/templates/04-validate.md +61 -0
- package/templates/skills/apex/templates/05-examine.md +58 -0
- package/templates/skills/apex/templates/06-resolve.md +39 -0
- package/templates/skills/apex/templates/07-tests.md +56 -0
- package/templates/skills/apex/templates/08-run-tests.md +41 -0
- package/templates/skills/apex/templates/README.md +69 -0
- package/templates/skills/application/SKILL.md +50 -50
- package/templates/skills/application/templates-backend.md +25 -25
- package/templates/skills/application/templates-frontend.md +43 -43
- package/templates/skills/application/templates-i18n.md +29 -29
- package/templates/skills/application/templates-seed.md +77 -77
- package/templates/skills/business-analyse/SKILL.md +223 -0
- package/templates/skills/business-analyse/_shared.md +258 -0
- package/templates/skills/business-analyse/questionnaire/01-context.md +33 -0
- package/templates/skills/business-analyse/questionnaire/02-stakeholders.md +35 -0
- package/templates/skills/business-analyse/questionnaire/03-scope.md +35 -0
- package/templates/skills/business-analyse/questionnaire/04-data.md +36 -0
- package/templates/skills/business-analyse/questionnaire/05-integrations.md +36 -0
- package/templates/skills/business-analyse/questionnaire/06-security.md +40 -0
- package/templates/skills/business-analyse/questionnaire/07-ui.md +36 -0
- package/templates/skills/business-analyse/questionnaire/08-performance.md +35 -0
- package/templates/skills/business-analyse/questionnaire/09-constraints.md +35 -0
- package/templates/skills/business-analyse/questionnaire/10-documentation.md +35 -0
- package/templates/skills/business-analyse/questionnaire.md +177 -177
- package/templates/skills/business-analyse/react/components.md +340 -0
- package/templates/skills/business-analyse/react/i18n-template.md +245 -0
- package/templates/skills/business-analyse/react/schema.md +151 -0
- package/templates/skills/business-analyse/steps/step-00-init.md +293 -0
- package/templates/skills/business-analyse/steps/step-01-discover.md +267 -0
- package/templates/skills/business-analyse/steps/step-02-analyse.md +243 -0
- package/templates/skills/business-analyse/steps/step-03-specify.md +317 -0
- package/templates/skills/business-analyse/steps/step-04-validate.md +239 -0
- package/templates/skills/business-analyse/steps/step-05-handoff.md +336 -0
- package/templates/skills/business-analyse/steps/step-06-doc-html.md +261 -0
- package/templates/skills/business-analyse/templates/00-context.md +105 -0
- package/templates/skills/business-analyse/templates/frd-brd.md +97 -0
- package/templates/skills/business-analyse/templates/frd-discovery.md +78 -0
- package/templates/skills/business-analyse/templates/frd-handoff.md +118 -0
- package/templates/skills/business-analyse/templates/frd-spec.md +168 -0
- package/templates/skills/business-analyse/templates-frd.md +217 -217
- package/templates/skills/business-analyse/templates-react.md +26 -26
- package/templates/skills/controller/SKILL.md +141 -92
- package/templates/skills/controller/postman-templates.md +15 -15
- package/templates/skills/controller/steps/step-00-init.md +191 -0
- package/templates/skills/controller/steps/step-01-analyze.md +146 -0
- package/templates/skills/controller/steps/step-02-plan.md +176 -0
- package/templates/skills/controller/steps/step-03-generate.md +219 -0
- package/templates/skills/controller/steps/step-04-perms.md +219 -0
- package/templates/skills/controller/steps/step-05-validate.md +107 -0
- package/templates/skills/controller/templates.md +77 -77
- package/templates/skills/documentation/SKILL.md +79 -79
- package/templates/skills/feature-full/SKILL.md +38 -38
- package/templates/skills/gitflow/SKILL.md +277 -0
- package/templates/{commands → skills}/gitflow/_shared.md +20 -20
- package/templates/skills/gitflow/phases/abort.md +173 -0
- package/templates/skills/gitflow/phases/cleanup.md +226 -0
- package/templates/skills/gitflow/phases/status.md +178 -0
- package/templates/skills/gitflow/steps/step-commit.md +255 -0
- package/templates/skills/gitflow/steps/step-finish.md +255 -0
- package/templates/skills/gitflow/steps/step-init.md +209 -0
- package/templates/skills/gitflow/steps/step-merge.md +225 -0
- package/templates/skills/gitflow/steps/step-plan.md +208 -0
- package/templates/skills/gitflow/steps/step-pr.md +235 -0
- package/templates/skills/gitflow/steps/step-start.md +234 -0
- package/templates/skills/gitflow/steps/step-sync.md +200 -0
- package/templates/skills/gitflow/templates/config.json +53 -0
- package/templates/skills/notification/SKILL.md +51 -51
- package/templates/skills/ralph-loop/SKILL.md +228 -0
- package/templates/skills/ralph-loop/steps/step-00-init.md +201 -0
- package/templates/skills/ralph-loop/steps/step-01-task.md +169 -0
- package/templates/skills/ralph-loop/steps/step-02-execute.md +173 -0
- package/templates/skills/ralph-loop/steps/step-03-commit.md +170 -0
- package/templates/skills/ralph-loop/steps/step-04-check.md +162 -0
- package/templates/skills/ralph-loop/steps/step-05-report.md +181 -0
- package/templates/skills/review-code/SKILL.md +219 -0
- package/templates/skills/review-code/references/clean-code-principles.md +140 -0
- package/templates/skills/review-code/references/code-quality-metrics.md +174 -0
- package/templates/skills/review-code/references/feedback-patterns.md +149 -0
- package/templates/skills/review-code/references/security-checklist.md +127 -0
- package/templates/skills/ui-components/SKILL.md +54 -54
- package/templates/skills/workflow/SKILL.md +46 -46
- package/templates/commands/ai-prompt.md +0 -315
- package/templates/commands/apex/1-analyze.md +0 -100
- package/templates/commands/apex/2-plan.md +0 -145
- package/templates/commands/apex/3-execute.md +0 -171
- package/templates/commands/apex/4-examine.md +0 -116
- package/templates/commands/apex/5-tasks.md +0 -209
- package/templates/commands/apex.md +0 -76
- package/templates/commands/application/create.md +0 -362
- package/templates/commands/application/templates-backend.md +0 -463
- package/templates/commands/application/templates-frontend.md +0 -517
- package/templates/commands/application/templates-i18n.md +0 -478
- package/templates/commands/application/templates-seed.md +0 -362
- package/templates/commands/application.md +0 -303
- package/templates/commands/business-analyse/0-orchestrate.md +0 -156
- package/templates/commands/business-analyse/1-init.md +0 -99
- package/templates/commands/business-analyse/2-discover.md +0 -143
- package/templates/commands/business-analyse/3-analyse.md +0 -106
- package/templates/commands/business-analyse/4-specify.md +0 -133
- package/templates/commands/business-analyse/5-validate.md +0 -132
- package/templates/commands/business-analyse/6-handoff.md +0 -157
- package/templates/commands/business-analyse/7-doc-html.md +0 -103
- package/templates/commands/business-analyse/_shared.md +0 -176
- package/templates/commands/business-analyse/bug.md +0 -118
- package/templates/commands/business-analyse/change-request.md +0 -144
- package/templates/commands/business-analyse/hotfix.md +0 -116
- package/templates/commands/business-analyse.md +0 -121
- package/templates/commands/controller/create.md +0 -216
- package/templates/commands/controller/postman-templates.md +0 -528
- package/templates/commands/controller/templates.md +0 -600
- package/templates/commands/controller.md +0 -337
- package/templates/commands/create/agent.md +0 -138
- package/templates/commands/create/command.md +0 -166
- package/templates/commands/create/hook.md +0 -234
- package/templates/commands/create/plugin.md +0 -329
- package/templates/commands/create/project.md +0 -508
- package/templates/commands/create/skill.md +0 -199
- package/templates/commands/create.md +0 -220
- package/templates/commands/documentation/module.md +0 -202
- package/templates/commands/documentation/templates.md +0 -432
- package/templates/commands/documentation.md +0 -190
- package/templates/commands/epct.md +0 -69
- package/templates/commands/explain.md +0 -186
- package/templates/commands/feature-full.md +0 -267
- package/templates/commands/gitflow/1-init.md +0 -188
- package/templates/commands/gitflow/10-start.md +0 -190
- package/templates/commands/gitflow/11-finish.md +0 -382
- package/templates/commands/gitflow/12-cleanup.md +0 -103
- package/templates/commands/gitflow/13-sync.md +0 -216
- package/templates/commands/gitflow/14-rebase.md +0 -251
- package/templates/commands/gitflow/2-status.md +0 -122
- package/templates/commands/gitflow/3-commit.md +0 -209
- package/templates/commands/gitflow/4-plan.md +0 -174
- package/templates/commands/gitflow/5-exec.md +0 -202
- package/templates/commands/gitflow/6-abort.md +0 -121
- package/templates/commands/gitflow/7-pull-request.md +0 -176
- package/templates/commands/gitflow/8-review.md +0 -113
- package/templates/commands/gitflow/9-merge.md +0 -157
- package/templates/commands/gitflow.md +0 -128
- package/templates/commands/implement.md +0 -663
- package/templates/commands/init.md +0 -567
- package/templates/commands/mcp-integration.md +0 -330
- package/templates/commands/notification.md +0 -129
- package/templates/commands/oneshot.md +0 -57
- package/templates/commands/quickstart.md +0 -154
- package/templates/commands/ralph-loop/cancel-ralph.md +0 -18
- package/templates/commands/ralph-loop/help.md +0 -126
- package/templates/commands/ralph-loop/ralph-loop.md +0 -120
- package/templates/commands/review.md +0 -106
- package/templates/commands/workflow.md +0 -193
|
@@ -1,337 +0,0 @@
|
|
|
1
|
-
# /controller - Skill Controller SmartStack
|
|
2
|
-
|
|
3
|
-
> **Synergie Skill/Commande:**
|
|
4
|
-
> - **Skill** (`.claude/skills/controller/`) → Invocation automatique par Claude
|
|
5
|
-
> - **Commande** (`/controller:create`) → Invocation manuelle par l'utilisateur
|
|
6
|
-
> - Templates partagés dans `.claude/skills/controller/templates.md`
|
|
7
|
-
|
|
8
|
-
> **MCP INTEGRATION:** This command can use `mcp__smartstack__scaffold_extension` for code generation.
|
|
9
|
-
|
|
10
|
-
---
|
|
11
|
-
|
|
12
|
-
## MCP SCAFFOLDING (Recommended)
|
|
13
|
-
|
|
14
|
-
> **NEW:** Use SmartStack MCP for consistent code generation across all projects.
|
|
15
|
-
|
|
16
|
-
### When to Use MCP
|
|
17
|
-
|
|
18
|
-
| Scenario | Use MCP | Use Templates |
|
|
19
|
-
|----------|---------|---------------|
|
|
20
|
-
| Standard CRUD controller | Yes | - |
|
|
21
|
-
| Controller with custom logic | - | Yes |
|
|
22
|
-
| Need validation before | Yes | - |
|
|
23
|
-
| Offline mode | - | Yes |
|
|
24
|
-
|
|
25
|
-
### MCP Invocation
|
|
26
|
-
|
|
27
|
-
**Claude instruction:** For standard controller generation, invoke MCP first:
|
|
28
|
-
|
|
29
|
-
```json
|
|
30
|
-
{
|
|
31
|
-
"tool": "mcp__smartstack__scaffold_extension",
|
|
32
|
-
"parameters": {
|
|
33
|
-
"type": "controller",
|
|
34
|
-
"name": "{MODULE}",
|
|
35
|
-
"options": {
|
|
36
|
-
"namespace": "SmartStack.Api.Controllers.{AREA}",
|
|
37
|
-
"methods": ["GetAll", "GetById", "Create", "Update", "Delete"]
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
The MCP returns a `ScaffoldResult`:
|
|
44
|
-
|
|
45
|
-
```typescript
|
|
46
|
-
interface ScaffoldResult {
|
|
47
|
-
success: boolean;
|
|
48
|
-
files: GeneratedFile[];
|
|
49
|
-
instructions: string[];
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
interface GeneratedFile {
|
|
53
|
-
path: string;
|
|
54
|
-
content: string;
|
|
55
|
-
type: 'created' | 'modified';
|
|
56
|
-
}
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
### Post-MCP Steps
|
|
60
|
-
|
|
61
|
-
After MCP generates the controller:
|
|
62
|
-
1. Review generated code
|
|
63
|
-
2. Add to `Permissions.cs` (STEP 6 below)
|
|
64
|
-
3. Add to `PermissionConfiguration.cs`
|
|
65
|
-
4. Create migration if needed
|
|
66
|
-
|
|
67
|
-
---
|
|
68
|
-
|
|
69
|
-
## ARGUMENTS
|
|
70
|
-
|
|
71
|
-
```
|
|
72
|
-
/controller:create <area> <module> [entity]
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
| Variable | Extraction | Valeurs |
|
|
76
|
-
|----------|------------|---------|
|
|
77
|
-
| `$AREA` | Premier mot | `Admin`, `Support`, `Business`, `User`, `Auth` |
|
|
78
|
-
| `$MODULE` | Deuxième mot | Nom du module (PascalCase) |
|
|
79
|
-
| `$ENTITY` | Troisième mot (optionnel) | Nom de l'entité Domain (défaut = singulier de $MODULE) |
|
|
80
|
-
|
|
81
|
-
**Exemples:**
|
|
82
|
-
```
|
|
83
|
-
/controller:create Admin Users
|
|
84
|
-
/controller:create Support Tickets Ticket
|
|
85
|
-
/controller:create Business Leads Lead
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
---
|
|
89
|
-
|
|
90
|
-
## VALIDATION CONTEXTES (CRITIQUE)
|
|
91
|
-
|
|
92
|
-
> **RAPPEL:** Les controllers client doivent être dans l'Area `Business`.
|
|
93
|
-
|
|
94
|
-
### Mapping Area → Context
|
|
95
|
-
|
|
96
|
-
| Area | Route Prefix | Permission Context | Autorisé Client |
|
|
97
|
-
|------|--------------|-------------------|-----------------|
|
|
98
|
-
| `Admin` | `api/admin/` | `platform.administration.*` | ❌ NON |
|
|
99
|
-
| `Support` | `api/support/` | `platform.support.*` | ❌ NON |
|
|
100
|
-
| `Business` | `api/business/` | `business.*` | ✅ OUI |
|
|
101
|
-
| `User` | `api/user/` | `personal.myspace.*` | ❌ NON |
|
|
102
|
-
| `Auth` | `api/auth/` | (AllowAnonymous) | ❌ NON |
|
|
103
|
-
|
|
104
|
-
### Validation Automatique
|
|
105
|
-
|
|
106
|
-
```
|
|
107
|
-
AVANT génération:
|
|
108
|
-
|
|
109
|
-
SI $AREA NOT IN ["Admin", "Support", "Business", "User", "Auth"]:
|
|
110
|
-
❌ ERREUR: "Area '$AREA' non reconnue"
|
|
111
|
-
SUGGÉRER: "Utilisez 'Business' pour les modules client"
|
|
112
|
-
ABORT
|
|
113
|
-
|
|
114
|
-
SI création par client ET $AREA IN ["Admin", "Support", "User", "Auth"]:
|
|
115
|
-
⚠️ WARNING: "L'area '$AREA' est réservée au core SmartStack"
|
|
116
|
-
SUGGÉRER: "Utilisez '/controller:create Business $MODULE $ENTITY'"
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
---
|
|
120
|
-
|
|
121
|
-
## RÈGLES ABSOLUES
|
|
122
|
-
|
|
123
|
-
1. **TOUJOURS** utiliser `[RequirePermission(Permissions.*)]` - jamais de strings
|
|
124
|
-
2. **TOUJOURS** ajouter `[ProducesResponseType]` pour chaque status possible
|
|
125
|
-
3. **TOUJOURS** logger les opérations (Info pour CRUD, Warning pour Delete/Sensitive)
|
|
126
|
-
4. **TOUJOURS** protéger les comptes système (UserType.System/LocalAdmin)
|
|
127
|
-
5. **JAMAIS** de SQL direct - utiliser EF Core
|
|
128
|
-
6. **JAMAIS** d'endpoint sans permission (sauf [AllowAnonymous] pour auth)
|
|
129
|
-
|
|
130
|
-
---
|
|
131
|
-
|
|
132
|
-
## WORKFLOW
|
|
133
|
-
|
|
134
|
-
### ÉTAPE 1: PARSING DES ARGUMENTS
|
|
135
|
-
|
|
136
|
-
```
|
|
137
|
-
EXTRAIRE $AREA = premier mot des arguments (PascalCase)
|
|
138
|
-
EXTRAIRE $MODULE = deuxième mot des arguments (PascalCase)
|
|
139
|
-
EXTRAIRE $ENTITY = troisième mot OU singulier de $MODULE
|
|
140
|
-
|
|
141
|
-
SI $AREA absent → AskUserQuestion (options: Admin, Support, Business, User, Auth)
|
|
142
|
-
SI $MODULE absent → AskUserQuestion (texte libre)
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
### ÉTAPE 2: ANALYSE EXISTANTE
|
|
146
|
-
|
|
147
|
-
| Action | Commande |
|
|
148
|
-
|--------|----------|
|
|
149
|
-
| Entity Domain | `Glob "Domain/**/{Entity}.cs"` |
|
|
150
|
-
| Permissions existantes | `Read Permissions.cs` |
|
|
151
|
-
| DbContext DbSet | `Grep "{Entity}s" ApplicationDbContext.cs` |
|
|
152
|
-
| Controller existant | `Glob "Controllers/{Area}/{Module}Controller.cs"` |
|
|
153
|
-
|
|
154
|
-
### ÉTAPE 3: CONFIRMATION UTILISATEUR
|
|
155
|
-
|
|
156
|
-
```typescript
|
|
157
|
-
AskUserQuestion({
|
|
158
|
-
questions: [
|
|
159
|
-
{
|
|
160
|
-
header: "Type",
|
|
161
|
-
question: "Quel type de controller ?",
|
|
162
|
-
options: [
|
|
163
|
-
{ label: "CRUD Complet (Recommended)", description: "GET list, GET by ID, POST, PUT, PATCH, DELETE" },
|
|
164
|
-
{ label: "Read-Only", description: "GET list, GET by ID uniquement" },
|
|
165
|
-
{ label: "Custom", description: "Actions spécifiques à définir" }
|
|
166
|
-
]
|
|
167
|
-
},
|
|
168
|
-
{
|
|
169
|
-
header: "Postman",
|
|
170
|
-
question: "Générer les tests Postman ?",
|
|
171
|
-
options: [
|
|
172
|
-
{ label: "Oui (Recommended)", description: "Ajoute tests dans SmartStack.Security.postman_collection.json" },
|
|
173
|
-
{ label: "Non", description: "Controller uniquement" }
|
|
174
|
-
]
|
|
175
|
-
}
|
|
176
|
-
]
|
|
177
|
-
})
|
|
178
|
-
```
|
|
179
|
-
|
|
180
|
-
### ÉTAPE 4: VALIDATION SÉCURITÉ
|
|
181
|
-
|
|
182
|
-
**Vérifications obligatoires avant génération:**
|
|
183
|
-
|
|
184
|
-
1. ✅ Permission path existe ou sera créée
|
|
185
|
-
2. ✅ Format permission: `context.application.module.action`
|
|
186
|
-
3. ✅ DbSet existe dans ApplicationDbContext
|
|
187
|
-
4. ✅ Entity a les méthodes Create/Update nécessaires
|
|
188
|
-
|
|
189
|
-
### ÉTAPE 5: GÉNÉRATION
|
|
190
|
-
|
|
191
|
-
| Fichier | Chemin | Action |
|
|
192
|
-
|---------|--------|--------|
|
|
193
|
-
| Controller | `src/SmartStack.Api/Controllers/{Area}/{Module}Controller.cs` | CREATE |
|
|
194
|
-
| Permissions | `src/SmartStack.Application/Common/Authorization/Permissions.cs` | UPDATE |
|
|
195
|
-
| Tests Postman | `tests/SmartStack.Security.postman_collection.json` | UPDATE (si choisi) |
|
|
196
|
-
|
|
197
|
-
**Utiliser templates de** → `.claude/skills/controller/templates.md`
|
|
198
|
-
|
|
199
|
-
### ÉTAPE 6: SYNCHRONISATION BASE DE DONNÉES (OBLIGATOIRE)
|
|
200
|
-
|
|
201
|
-
> **CRITIQUE:** Un controller avec `[RequirePermission]` retournera **403 Forbidden** pour TOUS les utilisateurs si la permission n'existe pas dans la base de données.
|
|
202
|
-
|
|
203
|
-
#### Workflow obligatoire
|
|
204
|
-
|
|
205
|
-
```
|
|
206
|
-
┌──────────────────────────────────────────────────────────────────────────────┐
|
|
207
|
-
│ WORKFLOW SYNCHRONISATION PERMISSIONS │
|
|
208
|
-
├──────────────────────────────────────────────────────────────────────────────┤
|
|
209
|
-
│ │
|
|
210
|
-
│ 1. GÉNÉRER CONTROLLER │
|
|
211
|
-
│ └─→ [RequirePermission(Permissions.{Module}.View)] │
|
|
212
|
-
│ │
|
|
213
|
-
│ 2. AJOUTER À Permissions.cs (Application layer) │
|
|
214
|
-
│ └─→ public static class {Module} { ... } │
|
|
215
|
-
│ │
|
|
216
|
-
│ 3. AJOUTER À PermissionConfiguration.cs (Infrastructure layer) │
|
|
217
|
-
│ └─→ HasData(new { Path = "...", ModuleId = ..., ... }) │
|
|
218
|
-
│ │
|
|
219
|
-
│ 4. CRÉER MIGRATION EF CORE │
|
|
220
|
-
│ └─→ /efcore:migration Add{Module}Permissions │
|
|
221
|
-
│ │
|
|
222
|
-
│ 5. VALIDER COHÉRENCE │
|
|
223
|
-
│ └─→ Vérifier que TOUS les paths dans Permissions.cs │
|
|
224
|
-
│ existent dans PermissionConfiguration.cs │
|
|
225
|
-
│ │
|
|
226
|
-
└──────────────────────────────────────────────────────────────────────────────┘
|
|
227
|
-
```
|
|
228
|
-
|
|
229
|
-
### ÉTAPE 7: LOGS CRITIQUES - VÉRIFICATION
|
|
230
|
-
|
|
231
|
-
Après génération, **VÉRIFIER** que le controller contient :
|
|
232
|
-
|
|
233
|
-
| Événement | Niveau Requis | Présent ? |
|
|
234
|
-
|-----------|---------------|-----------|
|
|
235
|
-
| Login échoué (si auth) | `LogCritical` | ☐ |
|
|
236
|
-
| Compte verrouillé (si auth) | `LogCritical` | ☐ |
|
|
237
|
-
| Password change | `LogWarning` | ☐ |
|
|
238
|
-
| Création | `LogInformation` | ☐ |
|
|
239
|
-
| Modification | `LogInformation` | ☐ |
|
|
240
|
-
| Suppression | `LogWarning` | ☐ |
|
|
241
|
-
| Désactivation | `LogWarning` | ☐ |
|
|
242
|
-
|
|
243
|
-
### ÉTAPE 8: RÉSUMÉ FINAL
|
|
244
|
-
|
|
245
|
-
Afficher:
|
|
246
|
-
- ✅ Fichiers créés (chemins cliquables)
|
|
247
|
-
- 🔐 Permissions ajoutées
|
|
248
|
-
- 🧪 Tests Postman générés (si applicable)
|
|
249
|
-
- 📝 Prochaines étapes:
|
|
250
|
-
- Vérifier les DTOs
|
|
251
|
-
- Ajouter validation métier si nécessaire
|
|
252
|
-
- Tester avec Swagger/Postman
|
|
253
|
-
|
|
254
|
-
---
|
|
255
|
-
|
|
256
|
-
## SOURCES DE DONNÉES
|
|
257
|
-
|
|
258
|
-
| Donnée | Source |
|
|
259
|
-
|--------|--------|
|
|
260
|
-
| Entity Domain | `src/SmartStack.Domain/**/{Entity}.cs` |
|
|
261
|
-
| DbContext | `src/SmartStack.Application/Common/Interfaces/IApplicationDbContext.cs` |
|
|
262
|
-
| Permissions | `src/SmartStack.Application/Common/Authorization/Permissions.cs` |
|
|
263
|
-
| Controllers existants | `src/SmartStack.Api/Controllers/**/*.cs` |
|
|
264
|
-
| Tests Postman | `tests/SmartStack.Security.postman_collection.json` |
|
|
265
|
-
|
|
266
|
-
---
|
|
267
|
-
|
|
268
|
-
## RÈGLES SÉCURITÉ - LOGS CRITIQUES (OBLIGATOIRE)
|
|
269
|
-
|
|
270
|
-
| Événement | Niveau | Pattern |
|
|
271
|
-
|-----------|--------|---------|
|
|
272
|
-
| Login échoué | `Critical` | `LogCritical("Login attempt on locked account...")` |
|
|
273
|
-
| Permission refusée | `Critical` | Auto via `SecurityAuditMiddleware` |
|
|
274
|
-
| Compte verrouillé | `Critical` | `LogCritical("Account locked...")` |
|
|
275
|
-
| Password change | `Warning` | `LogWarning("Password changed...")` |
|
|
276
|
-
| Création/MAJ | `Information` | `LogInformation("User {User} creating...")` |
|
|
277
|
-
| Suppression | `Warning` | `LogWarning("User {User} deleting...")` |
|
|
278
|
-
|
|
279
|
-
---
|
|
280
|
-
|
|
281
|
-
## CONTRAINTES TECHNIQUES
|
|
282
|
-
|
|
283
|
-
### Injection de Dépendances (Obligatoire)
|
|
284
|
-
|
|
285
|
-
```csharp
|
|
286
|
-
public {Module}Controller(
|
|
287
|
-
IApplicationDbContext context, // TOUJOURS
|
|
288
|
-
ICurrentUserService currentUser, // TOUJOURS
|
|
289
|
-
ILogger<{Module}Controller> logger // TOUJOURS
|
|
290
|
-
// + services spécifiques au module
|
|
291
|
-
)
|
|
292
|
-
```
|
|
293
|
-
|
|
294
|
-
### ProducesResponseType (Obligatoire)
|
|
295
|
-
|
|
296
|
-
```csharp
|
|
297
|
-
[ProducesResponseType(typeof(PagedResult<T>), StatusCodes.Status200OK)]
|
|
298
|
-
[ProducesResponseType(StatusCodes.Status401Unauthorized)] // Si [Authorize]
|
|
299
|
-
[ProducesResponseType(StatusCodes.Status403Forbidden)] // Si [RequirePermission]
|
|
300
|
-
[ProducesResponseType(StatusCodes.Status404NotFound)] // Si GET/PUT/DELETE by ID
|
|
301
|
-
```
|
|
302
|
-
|
|
303
|
-
### Logging Pattern (Obligatoire)
|
|
304
|
-
|
|
305
|
-
```csharp
|
|
306
|
-
// Information - opérations standard
|
|
307
|
-
_logger.LogInformation("User {User} created {Entity} {Id}",
|
|
308
|
-
_currentUser.Email, entity.Id);
|
|
309
|
-
|
|
310
|
-
// Warning - opérations sensibles
|
|
311
|
-
_logger.LogWarning("User {User} deleted {Entity} {Id} ({Name})",
|
|
312
|
-
_currentUser.Email, id, entity.Name);
|
|
313
|
-
|
|
314
|
-
// Critical - sécurité (automatique via middleware pour 401/403)
|
|
315
|
-
_logger.LogCritical("SECURITY: Login attempt on locked account - {Email} from {IP}",
|
|
316
|
-
email, ipAddress);
|
|
317
|
-
```
|
|
318
|
-
|
|
319
|
-
---
|
|
320
|
-
|
|
321
|
-
## TEMPLATES
|
|
322
|
-
|
|
323
|
-
→ **Voir `.claude/skills/controller/templates.md`**
|
|
324
|
-
|
|
325
|
-
Templates disponibles:
|
|
326
|
-
- CRUD Controller (standard)
|
|
327
|
-
- Auth Controller (login/logout/change-password)
|
|
328
|
-
- Controller avec Relations (nested resources)
|
|
329
|
-
- Patterns réutilisables (pagination, error responses)
|
|
330
|
-
|
|
331
|
-
→ **Voir `.claude/skills/controller/postman-templates.md`**
|
|
332
|
-
|
|
333
|
-
Templates tests:
|
|
334
|
-
- GET list (200, 403, 401)
|
|
335
|
-
- POST create (201, 403)
|
|
336
|
-
- DELETE (403)
|
|
337
|
-
- Auth (login success/fail, invalid token)
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Create a SmartStack agent extension project
|
|
3
|
-
argument-hint: <name> [description]
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Create Agent Extension
|
|
7
|
-
|
|
8
|
-
Scaffold a complete SmartStack **agent** extension project.
|
|
9
|
-
|
|
10
|
-
## What is an Agent?
|
|
11
|
-
|
|
12
|
-
An agent is a specialized execution unit:
|
|
13
|
-
- Launched by commands for parallel execution
|
|
14
|
-
- Focused on specific tasks (search, analysis, etc.)
|
|
15
|
-
- Defined in markdown with YAML frontmatter
|
|
16
|
-
- Optimized with model selection (haiku/sonnet/opus)
|
|
17
|
-
|
|
18
|
-
## Arguments
|
|
19
|
-
|
|
20
|
-
Parse from `$ARGUMENTS`:
|
|
21
|
-
- **name** (required): Agent name in kebab-case
|
|
22
|
-
- **description** (optional): What the agent does
|
|
23
|
-
|
|
24
|
-
## Project Structure
|
|
25
|
-
|
|
26
|
-
```
|
|
27
|
-
smartstack-{name}/
|
|
28
|
-
├── package.json
|
|
29
|
-
├── tsconfig.json
|
|
30
|
-
├── tsup.config.ts
|
|
31
|
-
├── README.md
|
|
32
|
-
├── .gitignore
|
|
33
|
-
├── src/
|
|
34
|
-
│ └── index.ts
|
|
35
|
-
└── templates/
|
|
36
|
-
└── agents/
|
|
37
|
-
└── {name}.md # Agent template
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
## Generated Agent Template
|
|
41
|
-
|
|
42
|
-
Create `templates/agents/{name}.md`:
|
|
43
|
-
|
|
44
|
-
```markdown
|
|
45
|
-
---
|
|
46
|
-
name: {name}
|
|
47
|
-
description: {description}
|
|
48
|
-
color: yellow
|
|
49
|
-
model: haiku
|
|
50
|
-
---
|
|
51
|
-
|
|
52
|
-
# {PascalCaseName} Agent
|
|
53
|
-
|
|
54
|
-
{description}
|
|
55
|
-
|
|
56
|
-
## Purpose
|
|
57
|
-
|
|
58
|
-
This agent specializes in:
|
|
59
|
-
- [Primary capability 1]
|
|
60
|
-
- [Primary capability 2]
|
|
61
|
-
- [Primary capability 3]
|
|
62
|
-
|
|
63
|
-
## Search Strategy
|
|
64
|
-
|
|
65
|
-
### 1. Initial Discovery
|
|
66
|
-
- Use `Glob` to find files matching patterns
|
|
67
|
-
- Focus on: `**/*.{relevant-extensions}`
|
|
68
|
-
|
|
69
|
-
### 2. Deep Analysis
|
|
70
|
-
- Use `Grep` for specific code patterns
|
|
71
|
-
- Look for: `pattern1`, `pattern2`
|
|
72
|
-
|
|
73
|
-
### 3. Context Building
|
|
74
|
-
- Use `Read` to examine key files
|
|
75
|
-
- Extract: imports, exports, dependencies
|
|
76
|
-
|
|
77
|
-
### 4. Synthesis
|
|
78
|
-
- Compile findings
|
|
79
|
-
- Identify patterns
|
|
80
|
-
- Generate recommendations
|
|
81
|
-
|
|
82
|
-
## Output Format
|
|
83
|
-
|
|
84
|
-
**CRITICAL**: Output findings directly in response. NEVER create files.
|
|
85
|
-
|
|
86
|
-
### Findings Report
|
|
87
|
-
|
|
88
|
-
#### Relevant Files
|
|
89
|
-
| File | Purpose | Key Patterns |
|
|
90
|
-
|------|---------|--------------|
|
|
91
|
-
| path/to/file | description | patterns found |
|
|
92
|
-
|
|
93
|
-
#### Analysis
|
|
94
|
-
[Detailed analysis of findings]
|
|
95
|
-
|
|
96
|
-
#### Recommendations
|
|
97
|
-
1. [First recommendation]
|
|
98
|
-
2. [Second recommendation]
|
|
99
|
-
3. [Third recommendation]
|
|
100
|
-
|
|
101
|
-
## Tool Usage
|
|
102
|
-
|
|
103
|
-
Preferred tools for this agent:
|
|
104
|
-
- `Glob` - File discovery
|
|
105
|
-
- `Grep` - Pattern search
|
|
106
|
-
- `Read` - File content
|
|
107
|
-
|
|
108
|
-
## Anti-Patterns
|
|
109
|
-
|
|
110
|
-
- **NEVER** create markdown files
|
|
111
|
-
- **NEVER** guess without evidence
|
|
112
|
-
- **NEVER** skip verification
|
|
113
|
-
- **ALWAYS** cite specific file paths
|
|
114
|
-
|
|
115
|
-
## Priority
|
|
116
|
-
|
|
117
|
-
Accuracy > Completeness > Speed
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
## Model Selection Guide
|
|
121
|
-
|
|
122
|
-
| Use Case | Model | Reason |
|
|
123
|
-
|----------|-------|--------|
|
|
124
|
-
| Simple search | haiku | Fast, cheap |
|
|
125
|
-
| Analysis | sonnet | Good balance |
|
|
126
|
-
| Complex reasoning | opus | Best quality |
|
|
127
|
-
|
|
128
|
-
## Workflow
|
|
129
|
-
|
|
130
|
-
1. Parse name and description from `$ARGUMENTS`
|
|
131
|
-
2. Validate name is kebab-case
|
|
132
|
-
3. Create project directory
|
|
133
|
-
4. Generate all files using Write tool
|
|
134
|
-
5. Display success message
|
|
135
|
-
|
|
136
|
-
---
|
|
137
|
-
|
|
138
|
-
User: $ARGUMENTS
|
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Create a SmartStack command extension project
|
|
3
|
-
argument-hint: <name> [description]
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Create Command Extension
|
|
7
|
-
|
|
8
|
-
Scaffold a complete SmartStack **command** extension project.
|
|
9
|
-
|
|
10
|
-
## What is a Command?
|
|
11
|
-
|
|
12
|
-
A command is a slash command that users invoke in Claude Code:
|
|
13
|
-
- `/my-command <args>` - Executes the command with arguments
|
|
14
|
-
- Defined in markdown with YAML frontmatter
|
|
15
|
-
- Contains workflow, rules, and execution logic
|
|
16
|
-
|
|
17
|
-
## Arguments
|
|
18
|
-
|
|
19
|
-
Parse from `$ARGUMENTS`:
|
|
20
|
-
- **name** (required): Command name in kebab-case
|
|
21
|
-
- **description** (optional): What the command does
|
|
22
|
-
|
|
23
|
-
## Project Structure
|
|
24
|
-
|
|
25
|
-
```
|
|
26
|
-
smartstack-{name}/
|
|
27
|
-
├── package.json
|
|
28
|
-
├── tsconfig.json
|
|
29
|
-
├── tsup.config.ts
|
|
30
|
-
├── README.md
|
|
31
|
-
├── .gitignore
|
|
32
|
-
├── src/
|
|
33
|
-
│ └── index.ts
|
|
34
|
-
└── templates/
|
|
35
|
-
└── commands/
|
|
36
|
-
└── {name}.md # Main command template
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
## Generated Command Template
|
|
40
|
-
|
|
41
|
-
Create `templates/commands/{name}.md`:
|
|
42
|
-
|
|
43
|
-
```markdown
|
|
44
|
-
---
|
|
45
|
-
description: {description}
|
|
46
|
-
argument-hint: <task-description>
|
|
47
|
-
---
|
|
48
|
-
|
|
49
|
-
# {PascalCaseName}
|
|
50
|
-
|
|
51
|
-
{description}
|
|
52
|
-
|
|
53
|
-
## Workflow
|
|
54
|
-
|
|
55
|
-
### 1. UNDERSTAND
|
|
56
|
-
- Parse user arguments: `$ARGUMENTS`
|
|
57
|
-
- Identify the task scope
|
|
58
|
-
- Gather necessary context
|
|
59
|
-
|
|
60
|
-
### 2. ANALYZE
|
|
61
|
-
- Explore relevant codebase areas
|
|
62
|
-
- Identify patterns and constraints
|
|
63
|
-
- Document findings
|
|
64
|
-
|
|
65
|
-
### 3. PLAN
|
|
66
|
-
- Design the approach
|
|
67
|
-
- Consider edge cases
|
|
68
|
-
- Validate against requirements
|
|
69
|
-
|
|
70
|
-
### 4. EXECUTE
|
|
71
|
-
- Implement step by step
|
|
72
|
-
- Follow existing patterns
|
|
73
|
-
- Write clean code
|
|
74
|
-
|
|
75
|
-
### 5. VERIFY
|
|
76
|
-
- Test the implementation
|
|
77
|
-
- Ensure no regressions
|
|
78
|
-
- Validate completeness
|
|
79
|
-
|
|
80
|
-
## Execution Rules
|
|
81
|
-
|
|
82
|
-
1. **ULTRA THINK** before each phase
|
|
83
|
-
2. Use parallel agents when beneficial
|
|
84
|
-
3. Document all decisions
|
|
85
|
-
4. **MINIMAL CHANGES**: Only what's needed
|
|
86
|
-
5. Test before declaring complete
|
|
87
|
-
|
|
88
|
-
## Agent Usage
|
|
89
|
-
|
|
90
|
-
For exploration, launch agents:
|
|
91
|
-
- `explore-codebase` - Find relevant files
|
|
92
|
-
- `websearch` - Research solutions
|
|
93
|
-
|
|
94
|
-
## Priority
|
|
95
|
-
|
|
96
|
-
Understanding > Correctness > Speed
|
|
97
|
-
|
|
98
|
-
---
|
|
99
|
-
|
|
100
|
-
User: $ARGUMENTS
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
## Generated Files
|
|
104
|
-
|
|
105
|
-
### package.json
|
|
106
|
-
|
|
107
|
-
```json
|
|
108
|
-
{
|
|
109
|
-
"name": "@smartstack/{name}",
|
|
110
|
-
"version": "1.0.0",
|
|
111
|
-
"description": "{description}",
|
|
112
|
-
"private": false,
|
|
113
|
-
"type": "module",
|
|
114
|
-
"main": "./dist/index.js",
|
|
115
|
-
"files": ["dist", "templates"],
|
|
116
|
-
"scripts": {
|
|
117
|
-
"build": "tsup",
|
|
118
|
-
"dev": "tsup --watch"
|
|
119
|
-
},
|
|
120
|
-
"peerDependencies": {
|
|
121
|
-
"@atlashub/smartstack-cli": ">=1.0.0"
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
### src/index.ts
|
|
127
|
-
|
|
128
|
-
```typescript
|
|
129
|
-
import * as path from 'path';
|
|
130
|
-
import * as fs from 'fs';
|
|
131
|
-
|
|
132
|
-
export function getTemplatesPath(): string {
|
|
133
|
-
return path.join(__dirname, '..', 'templates');
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
export async function install(targetDir: string): Promise<void> {
|
|
137
|
-
const src = path.join(getTemplatesPath(), 'commands');
|
|
138
|
-
const dest = path.join(targetDir, 'commands');
|
|
139
|
-
// Copy command templates
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
export const metadata = {
|
|
143
|
-
name: '{name}',
|
|
144
|
-
version: '1.0.0',
|
|
145
|
-
description: '{description}',
|
|
146
|
-
type: 'command'
|
|
147
|
-
};
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
## Workflow
|
|
151
|
-
|
|
152
|
-
1. Parse name and description from `$ARGUMENTS`
|
|
153
|
-
2. Validate name is kebab-case
|
|
154
|
-
3. Create project directory
|
|
155
|
-
4. Generate all files using Write tool
|
|
156
|
-
5. Display success message with next steps
|
|
157
|
-
|
|
158
|
-
## Validation
|
|
159
|
-
|
|
160
|
-
- Name must match: `^[a-z][a-z0-9-]*$`
|
|
161
|
-
- Directory must not exist
|
|
162
|
-
- Description should be meaningful
|
|
163
|
-
|
|
164
|
-
---
|
|
165
|
-
|
|
166
|
-
User: $ARGUMENTS
|