@atlashub/smartstack-cli 1.13.2 → 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.
Files changed (210) hide show
  1. package/.documentation/agents.html +1 -1
  2. package/.documentation/apex.html +1 -1
  3. package/.documentation/business-analyse.html +1 -1
  4. package/.documentation/cli-commands.html +3 -3
  5. package/.documentation/commands.html +1 -1
  6. package/.documentation/efcore.html +1 -1
  7. package/.documentation/gitflow.html +1 -1
  8. package/.documentation/hooks.html +1 -1
  9. package/.documentation/index.html +1 -1
  10. package/.documentation/init.html +3 -3
  11. package/.documentation/installation.html +1001 -352
  12. package/.documentation/ralph-loop.html +1 -1
  13. package/.documentation/test-web.html +1 -1
  14. package/README.md +88 -20
  15. package/dist/index.js +276 -85
  16. package/dist/index.js.map +1 -1
  17. package/package.json +1 -1
  18. package/templates/agents/code-reviewer.md +163 -0
  19. package/templates/agents/efcore/db-deploy.md +25 -7
  20. package/templates/agents/efcore/db-reset.md +31 -10
  21. package/templates/agents/efcore/db-status.md +22 -5
  22. package/templates/agents/efcore/migration.md +69 -19
  23. package/templates/agents/gitflow/cleanup.md +8 -1
  24. package/templates/agents/gitflow/commit.md +7 -5
  25. package/templates/agents/gitflow/finish.md +6 -4
  26. package/templates/agents/gitflow/pr.md +8 -1
  27. package/templates/agents/gitflow/start.md +1 -1
  28. package/templates/commands/check-version.md +267 -0
  29. package/templates/commands/efcore/_shared.md +30 -1
  30. package/templates/commands/efcore/db-reset.md +18 -6
  31. package/templates/commands/gitflow/OPTIMIZATIONS.md +206 -0
  32. package/templates/commands/refactor.md +164 -0
  33. package/templates/project/DependencyInjection.Application.cs.template +25 -0
  34. package/templates/project/DependencyInjection.Infrastructure.cs.template +61 -0
  35. package/templates/project/DesignTimeExtensionsDbContextFactory.cs.template +70 -0
  36. package/templates/project/ExampleEntity.cs.template +116 -0
  37. package/templates/project/ExampleEntityConfiguration.cs.template +64 -0
  38. package/templates/project/ExampleService.cs.template +146 -0
  39. package/templates/project/ExtensionsDbContext.cs.template +41 -0
  40. package/templates/project/IExtensionsDbContext.cs.template +22 -0
  41. package/templates/project/Program.cs.template +47 -0
  42. package/templates/project/README.md +79 -0
  43. package/templates/ralph/README.md +10 -8
  44. package/templates/ralph/ralph.config.yaml +2 -2
  45. package/templates/skills/_shared.md +44 -44
  46. package/templates/skills/ai-prompt/SKILL.md +55 -55
  47. package/templates/skills/apex/SKILL.md +235 -0
  48. package/templates/skills/apex/steps/step-00-init.md +203 -0
  49. package/templates/skills/apex/steps/step-01-analyze.md +210 -0
  50. package/templates/skills/apex/steps/step-02-plan.md +217 -0
  51. package/templates/skills/apex/steps/step-03-execute.md +178 -0
  52. package/templates/skills/apex/steps/step-04-validate.md +217 -0
  53. package/templates/skills/apex/steps/step-05-examine.md +207 -0
  54. package/templates/skills/apex/steps/step-06-resolve.md +181 -0
  55. package/templates/skills/apex/steps/step-07-tests.md +206 -0
  56. package/templates/skills/apex/steps/step-08-run-tests.md +207 -0
  57. package/templates/skills/apex/templates/00-context.md +46 -0
  58. package/templates/skills/apex/templates/01-analyze.md +63 -0
  59. package/templates/skills/apex/templates/02-plan.md +63 -0
  60. package/templates/skills/apex/templates/03-execute.md +34 -0
  61. package/templates/skills/apex/templates/04-validate.md +61 -0
  62. package/templates/skills/apex/templates/05-examine.md +58 -0
  63. package/templates/skills/apex/templates/06-resolve.md +39 -0
  64. package/templates/skills/apex/templates/07-tests.md +56 -0
  65. package/templates/skills/apex/templates/08-run-tests.md +41 -0
  66. package/templates/skills/apex/templates/README.md +69 -0
  67. package/templates/skills/application/SKILL.md +50 -50
  68. package/templates/skills/application/templates-backend.md +25 -25
  69. package/templates/skills/application/templates-frontend.md +43 -43
  70. package/templates/skills/application/templates-i18n.md +29 -29
  71. package/templates/skills/application/templates-seed.md +77 -77
  72. package/templates/skills/business-analyse/SKILL.md +223 -0
  73. package/templates/skills/business-analyse/_shared.md +258 -0
  74. package/templates/skills/business-analyse/questionnaire/01-context.md +33 -0
  75. package/templates/skills/business-analyse/questionnaire/02-stakeholders.md +35 -0
  76. package/templates/skills/business-analyse/questionnaire/03-scope.md +35 -0
  77. package/templates/skills/business-analyse/questionnaire/04-data.md +36 -0
  78. package/templates/skills/business-analyse/questionnaire/05-integrations.md +36 -0
  79. package/templates/skills/business-analyse/questionnaire/06-security.md +40 -0
  80. package/templates/skills/business-analyse/questionnaire/07-ui.md +36 -0
  81. package/templates/skills/business-analyse/questionnaire/08-performance.md +35 -0
  82. package/templates/skills/business-analyse/questionnaire/09-constraints.md +35 -0
  83. package/templates/skills/business-analyse/questionnaire/10-documentation.md +35 -0
  84. package/templates/skills/business-analyse/questionnaire.md +177 -177
  85. package/templates/skills/business-analyse/react/components.md +340 -0
  86. package/templates/skills/business-analyse/react/i18n-template.md +245 -0
  87. package/templates/skills/business-analyse/react/schema.md +151 -0
  88. package/templates/skills/business-analyse/steps/step-00-init.md +293 -0
  89. package/templates/skills/business-analyse/steps/step-01-discover.md +267 -0
  90. package/templates/skills/business-analyse/steps/step-02-analyse.md +243 -0
  91. package/templates/skills/business-analyse/steps/step-03-specify.md +317 -0
  92. package/templates/skills/business-analyse/steps/step-04-validate.md +239 -0
  93. package/templates/skills/business-analyse/steps/step-05-handoff.md +336 -0
  94. package/templates/skills/business-analyse/steps/step-06-doc-html.md +261 -0
  95. package/templates/skills/business-analyse/templates/00-context.md +105 -0
  96. package/templates/skills/business-analyse/templates/frd-brd.md +97 -0
  97. package/templates/skills/business-analyse/templates/frd-discovery.md +78 -0
  98. package/templates/skills/business-analyse/templates/frd-handoff.md +118 -0
  99. package/templates/skills/business-analyse/templates/frd-spec.md +168 -0
  100. package/templates/skills/business-analyse/templates-frd.md +217 -217
  101. package/templates/skills/business-analyse/templates-react.md +26 -26
  102. package/templates/skills/controller/SKILL.md +141 -92
  103. package/templates/skills/controller/postman-templates.md +15 -15
  104. package/templates/skills/controller/steps/step-00-init.md +191 -0
  105. package/templates/skills/controller/steps/step-01-analyze.md +146 -0
  106. package/templates/skills/controller/steps/step-02-plan.md +176 -0
  107. package/templates/skills/controller/steps/step-03-generate.md +219 -0
  108. package/templates/skills/controller/steps/step-04-perms.md +219 -0
  109. package/templates/skills/controller/steps/step-05-validate.md +107 -0
  110. package/templates/skills/controller/templates.md +77 -77
  111. package/templates/skills/documentation/SKILL.md +79 -79
  112. package/templates/skills/feature-full/SKILL.md +38 -38
  113. package/templates/skills/gitflow/SKILL.md +277 -0
  114. package/templates/{commands → skills}/gitflow/_shared.md +20 -20
  115. package/templates/skills/gitflow/phases/abort.md +173 -0
  116. package/templates/skills/gitflow/phases/cleanup.md +226 -0
  117. package/templates/skills/gitflow/phases/status.md +178 -0
  118. package/templates/skills/gitflow/steps/step-commit.md +255 -0
  119. package/templates/skills/gitflow/steps/step-finish.md +255 -0
  120. package/templates/skills/gitflow/steps/step-init.md +209 -0
  121. package/templates/skills/gitflow/steps/step-merge.md +225 -0
  122. package/templates/skills/gitflow/steps/step-plan.md +208 -0
  123. package/templates/skills/gitflow/steps/step-pr.md +235 -0
  124. package/templates/skills/gitflow/steps/step-start.md +234 -0
  125. package/templates/skills/gitflow/steps/step-sync.md +200 -0
  126. package/templates/skills/gitflow/templates/config.json +53 -0
  127. package/templates/skills/notification/SKILL.md +51 -51
  128. package/templates/skills/ralph-loop/SKILL.md +228 -0
  129. package/templates/skills/ralph-loop/steps/step-00-init.md +201 -0
  130. package/templates/skills/ralph-loop/steps/step-01-task.md +169 -0
  131. package/templates/skills/ralph-loop/steps/step-02-execute.md +173 -0
  132. package/templates/skills/ralph-loop/steps/step-03-commit.md +170 -0
  133. package/templates/skills/ralph-loop/steps/step-04-check.md +162 -0
  134. package/templates/skills/ralph-loop/steps/step-05-report.md +181 -0
  135. package/templates/skills/review-code/SKILL.md +219 -0
  136. package/templates/skills/review-code/references/clean-code-principles.md +140 -0
  137. package/templates/skills/review-code/references/code-quality-metrics.md +174 -0
  138. package/templates/skills/review-code/references/feedback-patterns.md +149 -0
  139. package/templates/skills/review-code/references/security-checklist.md +127 -0
  140. package/templates/skills/ui-components/SKILL.md +54 -54
  141. package/templates/skills/workflow/SKILL.md +46 -46
  142. package/templates/commands/ai-prompt.md +0 -315
  143. package/templates/commands/apex/1-analyze.md +0 -100
  144. package/templates/commands/apex/2-plan.md +0 -145
  145. package/templates/commands/apex/3-execute.md +0 -171
  146. package/templates/commands/apex/4-examine.md +0 -116
  147. package/templates/commands/apex/5-tasks.md +0 -209
  148. package/templates/commands/apex.md +0 -76
  149. package/templates/commands/application/create.md +0 -362
  150. package/templates/commands/application/templates-backend.md +0 -463
  151. package/templates/commands/application/templates-frontend.md +0 -517
  152. package/templates/commands/application/templates-i18n.md +0 -478
  153. package/templates/commands/application/templates-seed.md +0 -362
  154. package/templates/commands/application.md +0 -303
  155. package/templates/commands/business-analyse/0-orchestrate.md +0 -156
  156. package/templates/commands/business-analyse/1-init.md +0 -99
  157. package/templates/commands/business-analyse/2-discover.md +0 -143
  158. package/templates/commands/business-analyse/3-analyse.md +0 -106
  159. package/templates/commands/business-analyse/4-specify.md +0 -133
  160. package/templates/commands/business-analyse/5-validate.md +0 -132
  161. package/templates/commands/business-analyse/6-handoff.md +0 -157
  162. package/templates/commands/business-analyse/7-doc-html.md +0 -103
  163. package/templates/commands/business-analyse/_shared.md +0 -176
  164. package/templates/commands/business-analyse/bug.md +0 -118
  165. package/templates/commands/business-analyse/change-request.md +0 -144
  166. package/templates/commands/business-analyse/hotfix.md +0 -116
  167. package/templates/commands/business-analyse.md +0 -121
  168. package/templates/commands/controller/create.md +0 -216
  169. package/templates/commands/controller/postman-templates.md +0 -528
  170. package/templates/commands/controller/templates.md +0 -600
  171. package/templates/commands/controller.md +0 -337
  172. package/templates/commands/create/agent.md +0 -138
  173. package/templates/commands/create/command.md +0 -166
  174. package/templates/commands/create/hook.md +0 -234
  175. package/templates/commands/create/plugin.md +0 -329
  176. package/templates/commands/create/project.md +0 -508
  177. package/templates/commands/create/skill.md +0 -199
  178. package/templates/commands/create.md +0 -220
  179. package/templates/commands/documentation/module.md +0 -202
  180. package/templates/commands/documentation/templates.md +0 -432
  181. package/templates/commands/documentation.md +0 -190
  182. package/templates/commands/epct.md +0 -69
  183. package/templates/commands/explain.md +0 -186
  184. package/templates/commands/feature-full.md +0 -267
  185. package/templates/commands/gitflow/1-init.md +0 -188
  186. package/templates/commands/gitflow/10-start.md +0 -190
  187. package/templates/commands/gitflow/11-finish.md +0 -382
  188. package/templates/commands/gitflow/12-cleanup.md +0 -103
  189. package/templates/commands/gitflow/13-sync.md +0 -216
  190. package/templates/commands/gitflow/14-rebase.md +0 -251
  191. package/templates/commands/gitflow/2-status.md +0 -122
  192. package/templates/commands/gitflow/3-commit.md +0 -209
  193. package/templates/commands/gitflow/4-plan.md +0 -174
  194. package/templates/commands/gitflow/5-exec.md +0 -202
  195. package/templates/commands/gitflow/6-abort.md +0 -121
  196. package/templates/commands/gitflow/7-pull-request.md +0 -176
  197. package/templates/commands/gitflow/8-review.md +0 -113
  198. package/templates/commands/gitflow/9-merge.md +0 -157
  199. package/templates/commands/gitflow.md +0 -128
  200. package/templates/commands/implement.md +0 -663
  201. package/templates/commands/init.md +0 -567
  202. package/templates/commands/mcp-integration.md +0 -330
  203. package/templates/commands/notification.md +0 -129
  204. package/templates/commands/oneshot.md +0 -57
  205. package/templates/commands/quickstart.md +0 -154
  206. package/templates/commands/ralph-loop/cancel-ralph.md +0 -18
  207. package/templates/commands/ralph-loop/help.md +0 -126
  208. package/templates/commands/ralph-loop/ralph-loop.md +0 -120
  209. package/templates/commands/review.md +0 -106
  210. package/templates/commands/workflow.md +0 -193
@@ -1,25 +1,25 @@
1
- # Templates React - Documentation FRD
1
+ # Templates React - FRD Documentation
2
2
 
3
- > **Usage:** Templates pour générer la documentation HTML (React) des specs fonctionnelles
3
+ > **Usage:** Templates for generating HTML (React) documentation of functional specifications
4
4
  > **Output:** `web/smartstack-web/src/pages/docs/business/{app}/{module}/`
5
- > **Context7:** Utiliser pour génération de code React à jour
5
+ > **Context7:** Use for up-to-date React code generation
6
6
 
7
7
  ---
8
8
 
9
- ## RÈGLE CONTEXT7 (OBLIGATOIRE)
9
+ ## CONTEXT7 RULE (MANDATORY)
10
10
 
11
11
  ```
12
12
  ╔══════════════════════════════════════════════════════════════════════════════╗
13
- GÉNÉRATION REACT AVEC CONTEXT7 ║
13
+ ║ REACT GENERATION WITH CONTEXT7 ║
14
14
  ╠══════════════════════════════════════════════════════════════════════════════╣
15
15
  ║ ║
16
- TOUJOURS utiliser Context7 pour la génération de composants React:
16
+ ALWAYS use Context7 for React component generation:
17
17
  ║ ║
18
18
  ║ Prompt pattern: ║
19
19
  ║ "use context7 with /facebook/react and /i18next/react-i18next ║
20
20
  ║ to generate {component} following SmartStack patterns" ║
21
21
  ║ ║
22
- ║ Libraries à référencer: ║
22
+ ║ Libraries to reference: ║
23
23
  ║ • /facebook/react - React 19 patterns ║
24
24
  ║ • /i18next/react-i18next - Internationalization ║
25
25
  ║ • /remix-run/react-router - React Router v7 ║
@@ -34,7 +34,7 @@
34
34
 
35
35
  ```tsx
36
36
  // web/smartstack-web/src/pages/docs/business/{app}/{module}/FrdDocPage.tsx
37
- // GÉNÉRER AVEC: use context7 with /facebook/react
37
+ // GENERATE WITH: use context7 with /facebook/react
38
38
 
39
39
  import { Link } from 'react-router-dom';
40
40
  import { useTranslation } from 'react-i18next';
@@ -51,7 +51,7 @@ import {
51
51
  Database
52
52
  } from 'lucide-react';
53
53
 
54
- // Types pour les données FRD
54
+ // Types for FRD data
55
55
  interface UseCase {
56
56
  id: string;
57
57
  name: string;
@@ -83,7 +83,7 @@ interface FrdData {
83
83
  permissions: Permission[];
84
84
  }
85
85
 
86
- // Données chargées depuis le FRD (à générer dynamiquement)
86
+ // Data loaded from FRD (to be generated dynamically)
87
87
  const frdData: FrdData = {
88
88
  featureId: 'FEAT-XXX',
89
89
  moduleName: '{ModuleName}',
@@ -120,7 +120,7 @@ const frdData: FrdData = {
120
120
  ]
121
121
  };
122
122
 
123
- // Composant Badge de priorité
123
+ // Priority Badge Component
124
124
  function PriorityBadge({ priority }: { priority: string }) {
125
125
  const colors = {
126
126
  Must: 'bg-red-500/10 text-red-600',
@@ -134,7 +134,7 @@ function PriorityBadge({ priority }: { priority: string }) {
134
134
  );
135
135
  }
136
136
 
137
- // Composant Section numérotée
137
+ // Numbered Section Component
138
138
  function NumberedSection({
139
139
  number,
140
140
  title,
@@ -203,7 +203,7 @@ export function {ModuleName}FrdDocPage() {
203
203
  </p>
204
204
  </header>
205
205
 
206
- {/* Table des matières */}
206
+ {/* Table of Contents */}
207
207
  <div className="card p-4 bg-[var(--bg-secondary)]">
208
208
  <h2 className="font-semibold mb-3 flex items-center gap-2">
209
209
  <List className="w-4 h-4" />
@@ -223,7 +223,7 @@ export function {ModuleName}FrdDocPage() {
223
223
  </nav>
224
224
  </div>
225
225
 
226
- {/* Section 1: Vue d'ensemble */}
226
+ {/* Section 1: Overview */}
227
227
  <NumberedSection number={1} title={t('sections.overview')} icon={Layout}>
228
228
  <p className="text-[var(--text-secondary)] mb-4">
229
229
  {t(`modules.${frdData.moduleName.toLowerCase()}.overview`)}
@@ -250,7 +250,7 @@ export function {ModuleName}FrdDocPage() {
250
250
  </div>
251
251
  </NumberedSection>
252
252
 
253
- {/* Section 2: Cas d'utilisation */}
253
+ {/* Section 2: Use Cases */}
254
254
  <NumberedSection number={2} title={t('sections.useCases')} icon={Users}>
255
255
  <div className="space-y-4">
256
256
  {frdData.useCases.map((uc) => (
@@ -276,7 +276,7 @@ export function {ModuleName}FrdDocPage() {
276
276
  </div>
277
277
  </NumberedSection>
278
278
 
279
- {/* Section 3: Règles métier */}
279
+ {/* Section 3: Business Rules */}
280
280
  <NumberedSection number={3} title={t('sections.businessRules')} icon={CheckCircle}>
281
281
  <div className="overflow-x-auto">
282
282
  <table className="w-full text-sm">
@@ -322,7 +322,7 @@ export function {ModuleName}FrdDocPage() {
322
322
  ))}
323
323
  </div>
324
324
 
325
- {/* Avertissement permissions */}
325
+ {/* Permission Warning */}
326
326
  <div className="mt-4 p-4 rounded-lg bg-amber-500/10 border border-amber-500/20 flex items-start gap-3">
327
327
  <AlertTriangle className="w-5 h-5 text-amber-600 flex-shrink-0 mt-0.5" />
328
328
  <div>
@@ -340,7 +340,7 @@ export function {ModuleName}FrdDocPage() {
340
340
  <div className="text-center text-sm text-[var(--text-tertiary)] mb-4">
341
341
  {t('common.wireframePreview')}
342
342
  </div>
343
- {/* Wireframe simplifié */}
343
+ {/* Simplified wireframe */}
344
344
  <div className="space-y-4">
345
345
  <div className="h-12 bg-[var(--bg-secondary)] rounded flex items-center px-4 justify-between">
346
346
  <span className="text-sm">[Header + Navigation]</span>
@@ -395,7 +395,7 @@ export function {ModuleName}FrdDocPage() {
395
395
  </div>
396
396
  </NumberedSection>
397
397
 
398
- {/* Navigation footer */}
398
+ {/* Navigation Footer */}
399
399
  <div className="flex justify-between pt-6 border-t border-[var(--border-color)]">
400
400
  <Link
401
401
  to={`/docs/business/${frdData.applicationName.toLowerCase()}`}
@@ -569,12 +569,12 @@ export function {App}DocsIndexPage() {
569
569
 
570
570
  ---
571
571
 
572
- ## Checklist génération
572
+ ## Generation Checklist
573
573
 
574
- Lors de la génération avec `/business-analyse:7-doc-html`:
574
+ When generating with `/business-analyse:7-doc-html`:
575
575
 
576
- - [ ] Utiliser Context7 pour patterns React actuels
577
- - [ ] Générer `FrdDocPage.tsx` avec données du FRD
578
- - [ ] Créer/mettre à jour `docs-business.json` (4 langues)
579
- - [ ] Ajouter route dans `App.tsx`
580
- - [ ] Mettre à jour index parent si nouveau module
576
+ - [ ] Use Context7 for current React patterns
577
+ - [ ] Generate `FrdDocPage.tsx` with FRD data
578
+ - [ ] Create/update `docs-business.json` (4 languages)
579
+ - [ ] Add route in `App.tsx`
580
+ - [ ] Update parent index if new module
@@ -1,113 +1,162 @@
1
1
  ---
2
2
  name: controller
3
- description: |
4
- Génère automatiquement des controllers API pour SmartStack.
5
- Utiliser ce skill quand:
6
- - L'utilisateur demande de créer un controller, endpoint, ou API
7
- - L'utilisateur mentionne "CRUD", "REST API", "endpoint"
8
- - L'utilisateur veut ajouter des actions à un module existant
9
- - Après création d'une entité Domain pour exposer via API
10
- Types: CRUD standard, Auth/Login, Custom actions
3
+ description: Generate SmartStack API controllers with progressive step loading and context refresh.
4
+ argument-hint: "[-a] [-p] [-d] [-i] <area> <module> [entity]"
11
5
  ---
12
6
 
13
- # Skill Controller SmartStack
7
+ <objective>
8
+ Generate complete API controllers following SmartStack conventions. Uses progressive step loading to minimize context usage and ensure thorough validation at each phase.
9
+ </objective>
14
10
 
15
- **Référence:** [_shared.md](../_shared.md) pour permissions, services, sécurité
11
+ <quick_start>
12
+ **Basic usage:**
16
13
 
17
- ## QUAND CE SKILL S'ACTIVE
18
-
19
- | Déclencheur | Exemple |
20
- |-------------|---------|
21
- | Demande explicite | "Crée un controller pour les tickets" |
22
- | Mention d'API | "Il faut exposer les SLA via REST" |
23
- | Après entité Domain | "L'entité est prête, génère l'API" |
24
- | Mots-clés | "CRUD", "endpoint", "controller", "API REST" |
25
-
26
- ## WORKFLOW
27
-
28
- ### 1. Détection du Type
29
-
30
- | Indice | → Type |
31
- |--------|--------|
32
- | Authentification, login | `auth` |
33
- | Module avec CRUD | `crud` |
34
- | Actions spécifiques | `custom` |
14
+ ```bash
15
+ /controller Admin Users
16
+ ```
35
17
 
36
- ### 2. Extraction Paramètres
37
- `$AREA` (Admin/Support/Business), `$MODULE`, `$ENTITY`, `$PERMISSION_PATH` (platform.support.tickets)
18
+ **With Postman tests:**
38
19
 
39
- ### 3. Exécution
40
- Suivre workflow `/controller:create`
20
+ ```bash
21
+ /controller -p Support Tickets Ticket
22
+ ```
41
23
 
42
- ### 4. Synchronisation Permissions (OBLIGATOIRE)
24
+ **Full generation (auto + DTOs + Postman):**
43
25
 
44
- ```
45
- 1. GÉNÉRER CONTROLLER avec [RequirePermission(Permissions.{Module}.View)]
46
- 2. AJOUTER À Permissions.cs (Application layer)
47
- 3. AJOUTER À PermissionConfiguration.cs (Infrastructure - HasData)
48
- 4. CRÉER MIGRATION: /efcore:migration Add{Module}Permissions
49
- 5. VALIDER: tous paths dans Permissions.cs existent dans PermissionConfiguration.cs
26
+ ```bash
27
+ /controller -a -d -p Business Orders Order
50
28
  ```
51
29
 
52
- ## SÉCURITÉ (OBLIGATOIRE)
30
+ **Flags:**
53
31
 
54
- ### Logs Critiques
55
- | Événement | Niveau |
56
- |-----------|--------|
57
- | Login échoué | `Critical` |
58
- | Compte verrouillé | `Critical` |
59
- | Password change | `Warning` |
60
- | Suppression | `Warning` |
32
+ - `-a` (auto): Skip confirmations
33
+ - `-p` (postman): Generate Postman tests
34
+ - `-d` (dtos): Generate request/response DTOs
35
+ - `-i` (interactive): Configure via menu
61
36
 
62
- ### Protection Comptes Système
63
- ```csharp
64
- if (entity.UserType == UserType.System || entity.UserType == UserType.LocalAdmin)
65
- return BadRequest(new { message = "Cannot modify system accounts" });
66
- ```
37
+ See `<parameters>` for complete flag list.
38
+ </quick_start>
67
39
 
68
- ### Permissions
69
- ```csharp
70
- [RequirePermission(Permissions.Support.Tickets.View)] // ✅
71
- [RequirePermission("platform.support.tickets.read")] // ❌ Éviter strings
72
- ```
40
+ <parameters>
73
41
 
74
- ### Cache Invalidation (si rôles/permissions)
75
- ```csharp
76
- await _permissionService.InvalidateUserPermissionsCacheAsync(userId, ct);
77
- ```
42
+ <flags>
43
+ **Enable flags (turn ON):**
44
+ | Short | Long | Description |
45
+ |-------|------|-------------|
46
+ | `-a` | `--auto` | Autonomous mode: skip confirmations |
47
+ | `-p` | `--postman` | Postman mode: generate API tests |
48
+ | `-d` | `--dtos` | DTO mode: generate CreateDto, UpdateDto, ResponseDto |
49
+ | `-i` | `--interactive` | Interactive mode: configure flags via menu |
78
50
 
79
- ## SERVICES À INJECTER
80
-
81
- | Service | Usage | Obligatoire |
82
- |---------|-------|-------------|
83
- | `IApplicationDbContext` | Accès DB | |
84
- | `ICurrentUserService` | User courant | |
85
- | `ILogger<T>` | Logging | ✅ |
86
- | `IPermissionService` | Cache permissions | Si roles |
87
- | `IPasswordService` | Hash passwords | Si auth |
88
- | `IJwtService` | Tokens JWT | Si auth |
89
-
90
- ## PRODUCES RESPONSE TYPE (OBLIGATOIRE)
91
-
92
- ```csharp
93
- [ProducesResponseType(typeof(ItemDto), StatusCodes.Status200OK)]
94
- [ProducesResponseType(StatusCodes.Status401Unauthorized)] // Si [Authorize]
95
- [ProducesResponseType(StatusCodes.Status403Forbidden)] // Si [RequirePermission]
96
- [ProducesResponseType(StatusCodes.Status404NotFound)] // Si GET by ID
97
- [ProducesResponseType(StatusCodes.Status400BadRequest)] // Si validation
98
- ```
51
+ **Disable flags (turn OFF):**
52
+ | Short | Long | Description |
53
+ |-------|------|-------------|
54
+ | `-A` | `--no-auto` | Disable auto mode |
55
+ | `-P` | `--no-postman` | Disable postman mode |
56
+ | `-D` | `--no-dtos` | Disable DTO mode |
57
+ </flags>
99
58
 
100
- ## TESTS POSTMAN
59
+ <examples>
60
+ ```bash
61
+ # Basic CRUD controller
62
+ /controller Admin Users
101
63
 
102
- | Test | User | Status |
103
- |------|------|--------|
104
- | GET list | SuperAdmin | 200 |
105
- | GET list | NoPerm | 403 |
106
- | GET list | Anonymous | 401 |
107
- | POST create | WithPerm | 201 |
108
- | DELETE | ReadOnly | 403 |
64
+ # With specific entity name
65
+ /controller Support Tickets Ticket
109
66
 
110
- ## FICHIERS ASSOCIÉS
67
+ # Full autonomous generation
68
+ /controller -a -d -p Admin Roles Role
111
69
 
112
- - [templates.md](templates.md)
113
- - [postman-templates.md](postman-templates.md)
70
+ # Interactive mode
71
+ /controller -i Business Products
72
+ ```
73
+ </examples>
74
+
75
+ <parsing_rules>
76
+ **Argument parsing:**
77
+
78
+ 1. Parse flags first (remove from input)
79
+ 2. `{area}` = First remaining word (Admin, Support, Business, User, Auth)
80
+ 3. `{module}` = Second remaining word (PascalCase)
81
+ 4. `{entity}` = Third word OR singularize({module})
82
+ </parsing_rules>
83
+
84
+ </parameters>
85
+
86
+ <workflow>
87
+ **Standard flow:**
88
+ 1. Parse flags and arguments
89
+ 2. Analyze existing codebase (Entity, DbContext, Permissions)
90
+ 3. Plan controller structure (endpoints, DTOs, permissions)
91
+ 4. Generate controller file
92
+ 5. Synchronize permissions (Permissions.cs + PermissionConfiguration.cs)
93
+ 6. Generate Postman tests (if -p)
94
+ 7. Validate build and conventions
95
+ </workflow>
96
+
97
+ <state_variables>
98
+ **Persist throughout all steps:**
99
+
100
+ | Variable | Type | Description |
101
+ |----------|------|-------------|
102
+ | `{area}` | string | Controller area (Admin, Support, Business, User, Auth) |
103
+ | `{module}` | string | Module name PascalCase (e.g., Users, Tickets) |
104
+ | `{entity}` | string | Entity name PascalCase (e.g., User, Ticket) |
105
+ | `{controller_type}` | string | crud, readonly, auth, custom |
106
+ | `{permission_path}` | string | Full permission path (e.g., platform.support.tickets) |
107
+ | `{auto_mode}` | boolean | Skip confirmations |
108
+ | `{postman_mode}` | boolean | Generate Postman tests |
109
+ | `{dto_mode}` | boolean | Generate DTOs |
110
+ | `{interactive_mode}` | boolean | Configure interactively |
111
+
112
+ </state_variables>
113
+
114
+ <entry_point>
115
+
116
+ **FIRST ACTION:** Load `steps/step-00-init.md`
117
+
118
+ </entry_point>
119
+
120
+ <step_files>
121
+ **Progressive loading - only load current step:**
122
+
123
+ | Step | File | Purpose |
124
+ |------|------|---------|
125
+ | 00 | `steps/step-00-init.md` | Parse args, validate area/module, initialize state |
126
+ | 01 | `steps/step-01-analyze.md` | Find Entity, DbContext, existing patterns |
127
+ | 02 | `steps/step-02-plan.md` | Plan endpoints, DTOs, permissions |
128
+ | 03 | `steps/step-03-generate.md` | Generate controller + DTOs |
129
+ | 04 | `steps/step-04-perms.md` | Sync Permissions.cs + PermissionConfiguration.cs |
130
+ | 05 | `steps/step-05-validate.md` | Build check, convention validation |
131
+
132
+ </step_files>
133
+
134
+ <execution_rules>
135
+
136
+ - **Load one step at a time** - Only load the current step file
137
+ - **ULTRA THINK** before code generation
138
+ - **Persist state variables** across all steps
139
+ - **Follow next_step directive** at end of each step
140
+ - **NEVER skip permission sync** - security is mandatory
141
+ - **Use templates from** `templates.md` and `postman-templates.md`
142
+ </execution_rules>
143
+
144
+ <security_rules>
145
+
146
+ **MANDATORY - Never skip:**
147
+
148
+ 1. `[RequirePermission(Permissions.*)]` - Never use string literals
149
+ 2. `[ProducesResponseType]` - Document all response codes
150
+ 3. Protect system accounts (UserType.System/LocalAdmin)
151
+ 4. Log all operations (Info for CRUD, Warning for Delete)
152
+ 5. No raw SQL - use EF Core only
153
+ </security_rules>
154
+
155
+ <success_criteria>
156
+
157
+ - Controller follows SmartStack conventions
158
+ - Permissions synced in both files
159
+ - Build passes without errors
160
+ - Postman tests generated (if -p)
161
+ - All endpoints documented with [ProducesResponseType]
162
+ </success_criteria>
@@ -1,7 +1,7 @@
1
- # Templates Postman SmartStack
1
+ # SmartStack Postman Templates
2
2
 
3
- > **Note:** Ces templates sont utilisés pour générer automatiquement les tests Postman
4
- > après la création d'un controller.
3
+ > **Note:** These templates are used to automatically generate Postman tests
4
+ > after creating a controller.
5
5
 
6
6
  ---
7
7
 
@@ -23,16 +23,16 @@
23
23
 
24
24
  ---
25
25
 
26
- ## Users de Test Disponibles
26
+ ## Available Test Users
27
27
 
28
28
  | User | Email | Password | Permissions |
29
29
  |------|-------|----------|-------------|
30
- | SuperAdmin | `superadmin@smartstack.test` | `SuperAdmin123!` | `*` (toutes) |
30
+ | SuperAdmin | `superadmin@smartstack.test` | `SuperAdmin123!` | `*` (all) |
31
31
  | PlatformAdmin | `platformadmin@smartstack.test` | `PlatformAdmin123!` | `platform.administration.*` |
32
32
  | User | `user@smartstack.test` | `User123!` | Standard |
33
- | ReadOnly | `readonly@smartstack.test` | `ReadOnly123!` | `*.read` uniquement |
34
- | NoPerm | `noperm@smartstack.test` | `NoPerm123!` | Aucune |
35
- | Inactive | `inactive@smartstack.test` | `Inactive123!` | Compte désactivé |
33
+ | ReadOnly | `readonly@smartstack.test` | `ReadOnly123!` | `*.read` only |
34
+ | NoPerm | `noperm@smartstack.test` | `NoPerm123!` | None |
35
+ | Inactive | `inactive@smartstack.test` | `Inactive123!` | Disabled account |
36
36
 
37
37
  ---
38
38
 
@@ -585,17 +585,17 @@
585
585
 
586
586
  ---
587
587
 
588
- ## Génération Automatique
588
+ ## Automatic Generation
589
589
 
590
- Pour générer les tests d'un nouveau controller, remplacer :
590
+ To generate tests for a new controller, replace:
591
591
 
592
- | Variable | Exemple |
592
+ | Variable | Example |
593
593
  |----------|---------|
594
594
  | `{area}` | `support`, `admin`, `business` |
595
595
  | `{module}` | `tickets`, `sla`, `users` |
596
596
  | `{Entity}` | `Ticket`, `SlaDefinition`, `User` |
597
597
 
598
- ### Tests Minimum par Controller
598
+ ### Minimum Tests per Controller
599
599
 
600
600
  1. GET list - SuperAdmin (200)
601
601
  2. GET list - NoPerm (403)
@@ -604,11 +604,11 @@ Pour générer les tests d'un nouveau controller, remplacer :
604
604
  5. POST create - ReadOnly (403)
605
605
  6. DELETE - ReadOnly (403)
606
606
 
607
- ### Tests Optionnels
607
+ ### Optional Tests
608
608
 
609
609
  - GET by ID - (200)
610
610
  - GET by ID - Not Found (404)
611
611
  - PUT update - (200)
612
612
  - PATCH activate/deactivate - (204)
613
- - POST avec données invalides - (400)
614
- - POST doublon - (409)
613
+ - POST with invalid data - (400)
614
+ - POST duplicate - (409)
@@ -0,0 +1,191 @@
1
+ ---
2
+ name: step-00-init
3
+ description: Initialize controller generation - parse arguments, validate inputs, setup state
4
+ next_step: steps/step-01-analyze.md
5
+ ---
6
+
7
+ # Step 0: Initialization
8
+
9
+ ## MANDATORY EXECUTION RULES:
10
+
11
+ - NEVER skip argument parsing
12
+ - ALWAYS validate area is valid (Admin, Support, Business, User, Auth)
13
+ - YOU ARE AN INITIALIZER, not a generator
14
+ - FORBIDDEN to load step-01 until init is complete
15
+
16
+ ## YOUR TASK:
17
+
18
+ Parse arguments, validate inputs, and initialize state variables for controller generation.
19
+
20
+ ---
21
+
22
+ <defaults>
23
+ ## Default Configuration
24
+
25
+ ```yaml
26
+ auto_mode: false # -a: Skip confirmations
27
+ postman_mode: false # -p: Generate Postman tests
28
+ dto_mode: false # -d: Generate DTOs
29
+ interactive_mode: false # -i: Configure via menu
30
+ ```
31
+ </defaults>
32
+
33
+ ---
34
+
35
+ ## EXECUTION SEQUENCE:
36
+
37
+ ### 1. Parse Flags and Input
38
+
39
+ **Step 1: Load defaults from config above**
40
+
41
+ ```
42
+ {auto_mode} = false
43
+ {postman_mode} = false
44
+ {dto_mode} = false
45
+ {interactive_mode} = false
46
+ ```
47
+
48
+ **Step 2: Parse user input and override defaults:**
49
+
50
+ ```
51
+ Enable flags (lowercase - turn ON):
52
+ -a or --auto -> {auto_mode} = true
53
+ -p or --postman -> {postman_mode} = true
54
+ -d or --dtos -> {dto_mode} = true
55
+ -i or --interactive -> {interactive_mode} = true
56
+
57
+ Disable flags (UPPERCASE - turn OFF):
58
+ -A or --no-auto -> {auto_mode} = false
59
+ -P or --no-postman -> {postman_mode} = false
60
+ -D or --no-dtos -> {dto_mode} = false
61
+
62
+ Arguments (after flags removed):
63
+ First word -> {area}
64
+ Second word -> {module}
65
+ Third word -> {entity} (optional, default = singularize({module}))
66
+ ```
67
+
68
+ ### 2. Validate Area
69
+
70
+ **Valid areas:**
71
+
72
+ | Area | Route Prefix | Permission Context |
73
+ |------|--------------|-------------------|
74
+ | `Admin` | `api/admin/` | `platform.administration.` |
75
+ | `Support` | `api/support/` | `platform.support.` |
76
+ | `Business` | `api/business/` | `business.` |
77
+ | `User` | `api/user/` | `personal.myspace.` |
78
+ | `Auth` | `api/auth/` | (AllowAnonymous) |
79
+
80
+ **If {area} missing or invalid:**
81
+
82
+ ```yaml
83
+ AskUserQuestion:
84
+ header: "Area"
85
+ question: "Which area for the controller?"
86
+ options:
87
+ - label: "Admin"
88
+ description: "Platform administration (api/admin/)"
89
+ - label: "Support"
90
+ description: "Support features (api/support/)"
91
+ - label: "Business"
92
+ description: "Business modules (api/business/)"
93
+ - label: "User"
94
+ description: "User-facing features (api/user/)"
95
+ ```
96
+
97
+ ### 3. Validate Module
98
+
99
+ **If {module} missing:**
100
+
101
+ ```yaml
102
+ AskUserQuestion:
103
+ header: "Module"
104
+ question: "What is the module name? (PascalCase, e.g., Tickets, Users)"
105
+ # Free text input
106
+ ```
107
+
108
+ **Normalize:**
109
+ - Convert to PascalCase
110
+ - Example: "tickets" → "Tickets", "user-roles" → "UserRoles"
111
+
112
+ ### 4. Derive Entity Name
113
+
114
+ **If {entity} not provided:**
115
+
116
+ ```
117
+ {entity} = singularize({module})
118
+
119
+ Examples:
120
+ Users → User
121
+ Tickets → Ticket
122
+ Categories → Category
123
+ SlaDefinitions → SlaDefinition
124
+ ```
125
+
126
+ ### 5. Compute Permission Path
127
+
128
+ **Based on {area}:**
129
+
130
+ ```
131
+ Admin → {permission_path} = "platform.administration.{module_lowercase}"
132
+ Support → {permission_path} = "platform.support.{module_lowercase}"
133
+ Business → {permission_path} = "business.{module_lowercase}"
134
+ User → {permission_path} = "personal.myspace.{module_lowercase}"
135
+ Auth → {permission_path} = null (AllowAnonymous)
136
+ ```
137
+
138
+ ### 6. Interactive Mode (if -i flag)
139
+
140
+ If `{interactive_mode}` = true:
141
+
142
+ ```yaml
143
+ questions:
144
+ - header: "Configure"
145
+ question: "Select options for controller generation:"
146
+ options:
147
+ - label: "Auto mode (-a)"
148
+ description: "Skip all confirmations"
149
+ - label: "Postman tests (-p)"
150
+ description: "Generate Postman test collection"
151
+ - label: "DTOs (-d)"
152
+ description: "Generate CreateDto, UpdateDto, ResponseDto"
153
+ multiSelect: true
154
+ ```
155
+
156
+ ### 7. Show Summary and Proceed
157
+
158
+ **Always show COMPACT summary:**
159
+
160
+ ```
161
+ Controller: {area}/{module}Controller
162
+
163
+ | Variable | Value |
164
+ |----------|-------|
165
+ | {area} | Admin |
166
+ | {module} | Users |
167
+ | {entity} | User |
168
+ | {permission_path} | platform.administration.users |
169
+ | {auto_mode} | true/false |
170
+ | {postman_mode} | true/false |
171
+ | {dto_mode} | true/false |
172
+
173
+ -> Analyzing codebase...
174
+ ```
175
+
176
+ **Then proceed directly to step-01-analyze.md**
177
+
178
+ ---
179
+
180
+ ## SUCCESS METRICS:
181
+
182
+ - All arguments correctly parsed
183
+ - Area validated against allowed values
184
+ - Module/Entity derived correctly
185
+ - Permission path computed
186
+ - Output is COMPACT (one table)
187
+ - Proceeded to step-01 immediately after summary
188
+
189
+ ## NEXT STEP:
190
+
191
+ After showing initialization summary, always proceed directly to `./step-01-analyze.md`