@atlashub/smartstack-cli 1.13.2 → 1.14.1
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 +231 -236
- package/.documentation/hooks.html +1 -1
- package/.documentation/index.html +1 -1
- package/.documentation/init.html +3 -3
- package/.documentation/installation.html +1075 -351
- package/.documentation/ralph-loop.html +1 -1
- package/.documentation/test-web.html +1 -1
- package/README.md +88 -20
- package/config/default-config.json +10 -1
- 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 +70 -20
- 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 +31 -2
- package/templates/commands/efcore/db-reset.md +18 -6
- package/templates/commands/efcore/migration.md +1 -1
- package/templates/commands/efcore/rebase-snapshot.md +1 -1
- package/templates/commands/efcore/squash.md +1 -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 +334 -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
- package/templates/gitflow/config.json +0 -138
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
# Templates React - Documentation
|
|
1
|
+
# Templates React - FRD Documentation
|
|
2
2
|
|
|
3
|
-
> **Usage:** Templates
|
|
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:**
|
|
5
|
+
> **Context7:** Use for up-to-date React code generation
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
9
|
-
##
|
|
9
|
+
## CONTEXT7 RULE (MANDATORY)
|
|
10
10
|
|
|
11
11
|
```
|
|
12
12
|
╔══════════════════════════════════════════════════════════════════════════════╗
|
|
13
|
-
║
|
|
13
|
+
║ REACT GENERATION WITH CONTEXT7 ║
|
|
14
14
|
╠══════════════════════════════════════════════════════════════════════════════╣
|
|
15
15
|
║ ║
|
|
16
|
-
║
|
|
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
|
|
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
|
-
//
|
|
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
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
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
|
|
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:
|
|
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:
|
|
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:
|
|
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
|
-
{/*
|
|
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
|
-
{/*
|
|
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
|
|
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
|
|
572
|
+
## Generation Checklist
|
|
573
573
|
|
|
574
|
-
|
|
574
|
+
When generating with `/business-analyse:7-doc-html`:
|
|
575
575
|
|
|
576
|
-
- [ ]
|
|
577
|
-
- [ ]
|
|
578
|
-
- [ ]
|
|
579
|
-
- [ ]
|
|
580
|
-
- [ ]
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
11
|
+
<quick_start>
|
|
12
|
+
**Basic usage:**
|
|
16
13
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
-
|
|
37
|
-
`$AREA` (Admin/Support/Business), `$MODULE`, `$ENTITY`, `$PERMISSION_PATH` (platform.support.tickets)
|
|
18
|
+
**With Postman tests:**
|
|
38
19
|
|
|
39
|
-
|
|
40
|
-
|
|
20
|
+
```bash
|
|
21
|
+
/controller -p Support Tickets Ticket
|
|
22
|
+
```
|
|
41
23
|
|
|
42
|
-
|
|
24
|
+
**Full generation (auto + DTOs + Postman):**
|
|
43
25
|
|
|
44
|
-
```
|
|
45
|
-
|
|
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
|
-
|
|
30
|
+
**Flags:**
|
|
53
31
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
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
|
-
|
|
63
|
-
|
|
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
|
-
|
|
69
|
-
```csharp
|
|
70
|
-
[RequirePermission(Permissions.Support.Tickets.View)] // ✅
|
|
71
|
-
[RequirePermission("platform.support.tickets.read")] // ❌ Éviter strings
|
|
72
|
-
```
|
|
40
|
+
<parameters>
|
|
73
41
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
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
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
| `
|
|
84
|
-
| `
|
|
85
|
-
|
|
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
|
-
|
|
59
|
+
<examples>
|
|
60
|
+
```bash
|
|
61
|
+
# Basic CRUD controller
|
|
62
|
+
/controller Admin Users
|
|
101
63
|
|
|
102
|
-
|
|
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
|
-
|
|
67
|
+
# Full autonomous generation
|
|
68
|
+
/controller -a -d -p Admin Roles Role
|
|
111
69
|
|
|
112
|
-
|
|
113
|
-
-
|
|
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
|
-
#
|
|
1
|
+
# SmartStack Postman Templates
|
|
2
2
|
|
|
3
|
-
> **Note:**
|
|
4
|
-
>
|
|
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
|
-
##
|
|
26
|
+
## Available Test Users
|
|
27
27
|
|
|
28
28
|
| User | Email | Password | Permissions |
|
|
29
29
|
|------|-------|----------|-------------|
|
|
30
|
-
| SuperAdmin | `superadmin@smartstack.test` | `SuperAdmin123!` | `*` (
|
|
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`
|
|
34
|
-
| NoPerm | `noperm@smartstack.test` | `NoPerm123!` |
|
|
35
|
-
| Inactive | `inactive@smartstack.test` | `Inactive123!` |
|
|
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
|
-
##
|
|
588
|
+
## Automatic Generation
|
|
589
589
|
|
|
590
|
-
|
|
590
|
+
To generate tests for a new controller, replace:
|
|
591
591
|
|
|
592
|
-
| Variable |
|
|
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
|
|
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
|
|
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
|
|
614
|
-
- POST
|
|
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`
|