@atlashub/smartstack-cli 3.36.0 → 3.38.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/dist/index.js +16 -24
- package/dist/index.js.map +1 -1
- package/dist/mcp-entry.mjs +201 -256
- package/dist/mcp-entry.mjs.map +1 -1
- package/package.json +3 -2
- package/scripts/extract-api-endpoints.ts +325 -0
- package/scripts/extract-business-rules.ts +440 -0
- package/scripts/generate-doc-with-mock-ui.ts +804 -0
- package/scripts/health-check.sh +168 -0
- package/scripts/postinstall.js +18 -0
- package/templates/agents/ba-reader.md +9 -9
- package/templates/agents/ba-writer.md +12 -15
- package/templates/agents/code-reviewer.md +1 -1
- package/templates/agents/docs-context-reader.md +1 -1
- package/templates/agents/gitflow/merge.md +0 -4
- package/templates/agents/gitflow/pr.md +0 -4
- package/templates/agents/gitflow/start.md +30 -5
- package/templates/mcp-scaffolding/frontend/nav-routes.ts.hbs +20 -20
- package/templates/mcp-scaffolding/frontend/routes.tsx.hbs +16 -24
- package/templates/mcp-scaffolding/migrations/seed-roles.cs.hbs +2 -2
- package/templates/skills/_resources/mcp-validate-documentation-spec.md +3 -3
- package/templates/skills/_shared.md +15 -17
- package/templates/skills/ai-prompt/SKILL.md +1 -1
- package/templates/skills/ai-prompt/steps/step-00-init.md +47 -0
- package/templates/skills/apex/SKILL.md +3 -4
- package/templates/skills/apex/_shared.md +10 -20
- package/templates/skills/apex/references/analysis-methods.md +141 -0
- package/templates/skills/apex/references/challenge-questions.md +1 -21
- package/templates/skills/apex/references/core-seed-data.md +35 -57
- package/templates/skills/apex/references/examine-build-validation.md +87 -0
- package/templates/skills/apex/references/execution-frontend-gates.md +177 -0
- package/templates/skills/apex/references/execution-frontend-patterns.md +105 -0
- package/templates/skills/apex/references/execution-layer1-rules.md +96 -0
- package/templates/skills/apex/references/initialization-challenge-flow.md +110 -0
- package/templates/skills/apex/references/planning-layer-mapping.md +151 -0
- package/templates/skills/apex/references/post-checks.md +145 -40
- package/templates/skills/apex/references/smartstack-api.md +35 -51
- package/templates/skills/apex/references/smartstack-frontend.md +17 -17
- package/templates/skills/apex/references/smartstack-layers.md +38 -62
- package/templates/skills/apex/steps/step-00-init.md +14 -26
- package/templates/skills/apex/steps/step-01-analyze.md +10 -143
- package/templates/skills/apex/steps/step-02-plan.md +10 -92
- package/templates/skills/apex/steps/step-03-execute.md +47 -249
- package/templates/skills/apex/steps/step-04-examine.md +14 -78
- package/templates/skills/apex/steps/step-05-deep-review.md +2 -2
- package/templates/skills/apex/steps/step-08-run-tests.md +2 -0
- package/templates/skills/application/SKILL.md +6 -7
- package/templates/skills/application/references/backend-controller-hierarchy.md +16 -16
- package/templates/skills/application/references/backend-seeding-and-dto-output.md +83 -0
- package/templates/skills/application/references/backend-table-prefix-mapping.md +79 -0
- package/templates/skills/application/references/backend-verification.md +1 -1
- package/templates/skills/application/references/frontend-i18n-and-output.md +67 -0
- package/templates/skills/application/references/frontend-route-naming.md +117 -0
- package/templates/skills/application/references/frontend-route-wiring-app-tsx.md +107 -0
- package/templates/skills/application/references/frontend-verification.md +12 -12
- package/templates/skills/application/references/init-parameter-detection.md +120 -0
- package/templates/skills/application/references/migration-checklist-troubleshooting.md +100 -0
- package/templates/skills/application/references/nav-fallback-procedure.md +5 -6
- package/templates/skills/application/references/provider-template.md +2 -6
- package/templates/skills/application/references/roles-client-project-handling.md +55 -0
- package/templates/skills/application/references/roles-fallback-procedure.md +149 -0
- package/templates/skills/application/references/test-coverage-requirements.md +213 -0
- package/templates/skills/application/references/test-frontend.md +3 -3
- package/templates/skills/application/steps/step-00-init.md +11 -141
- package/templates/skills/application/steps/step-01-navigation.md +3 -3
- package/templates/skills/application/steps/step-02-permissions.md +4 -4
- package/templates/skills/application/steps/step-03-roles.md +18 -175
- package/templates/skills/application/steps/step-03b-provider.md +1 -2
- package/templates/skills/application/steps/step-04-backend.md +19 -110
- package/templates/skills/application/steps/step-05-frontend.md +17 -143
- package/templates/skills/application/steps/step-06-migration.md +12 -60
- package/templates/skills/application/steps/step-07-tests.md +9 -76
- package/templates/skills/application/templates-backend.md +29 -27
- package/templates/skills/application/templates-frontend.md +48 -48
- package/templates/skills/application/templates-seed.md +57 -131
- package/templates/skills/business-analyse/SKILL.md +27 -30
- package/templates/skills/business-analyse/_architecture.md +6 -6
- package/templates/skills/business-analyse/_shared.md +60 -88
- package/templates/skills/business-analyse/questionnaire/04-data.md +3 -3
- package/templates/skills/business-analyse/questionnaire/06-security.md +1 -1
- package/templates/skills/business-analyse/questionnaire/13-cross-module.md +1 -1
- package/templates/skills/business-analyse/react/application-viewer.md +12 -12
- package/templates/skills/business-analyse/react/components.md +8 -12
- package/templates/skills/business-analyse/react/schema.md +11 -11
- package/templates/skills/business-analyse/references/agent-module-prompt.md +2 -3
- package/templates/skills/business-analyse/references/analysis-semantic-checks.md +190 -0
- package/templates/skills/business-analyse/references/cache-warming-strategy.md +2 -2
- package/templates/skills/business-analyse/references/cadrage-challenge-patterns.md +41 -0
- package/templates/skills/business-analyse/references/cadrage-coverage-matrix.md +74 -0
- package/templates/skills/business-analyse/references/cadrage-shared-modules.md +69 -0
- package/templates/skills/business-analyse/references/cadrage-structure-cards.md +1 -1
- package/templates/skills/business-analyse/references/compilation-structure-cards.md +297 -0
- package/templates/skills/business-analyse/references/consolidation-structural-checks.md +2 -2
- package/templates/skills/business-analyse/references/deploy-modes.md +5 -5
- package/templates/skills/business-analyse/references/detection-strategies.md +7 -7
- package/templates/skills/business-analyse/references/handoff-file-templates.md +14 -22
- package/templates/skills/business-analyse/references/handoff-mappings.md +4 -4
- package/templates/skills/business-analyse/references/handoff-seeddata-generation.md +312 -0
- package/templates/skills/business-analyse/references/init-schema-deployment.md +3 -3
- package/templates/skills/business-analyse/references/naming-conventions.md +22 -24
- package/templates/skills/business-analyse/references/prd-generation.md +2 -2
- package/templates/skills/business-analyse/references/review-data-mapping.md +2 -2
- package/templates/skills/business-analyse/references/robustness-checks.md +1 -1
- package/templates/skills/business-analyse/references/spec-auto-inference.md +3 -3
- package/templates/skills/business-analyse/references/team-orchestration.md +49 -6
- package/templates/skills/business-analyse/references/ui-dashboard-spec.md +1 -1
- package/templates/skills/business-analyse/references/ui-resource-cards.md +18 -18
- package/templates/skills/business-analyse/references/validate-incremental-html.md +2 -2
- package/templates/skills/business-analyse/references/validation-checklist.md +2 -2
- package/templates/skills/business-analyse/schemas/application-schema.json +4 -5
- package/templates/skills/business-analyse/schemas/project-schema.json +1 -6
- package/templates/skills/business-analyse/schemas/sections/metadata-schema.json +2 -3
- package/templates/skills/business-analyse/schemas/sections/specification-schema.json +4 -4
- package/templates/skills/business-analyse/steps/step-00-init.md +8 -17
- package/templates/skills/business-analyse/steps/step-01-cadrage.md +35 -198
- package/templates/skills/business-analyse/steps/step-01b-applications.md +16 -20
- package/templates/skills/business-analyse/steps/step-02-decomposition.md +1 -1
- package/templates/skills/business-analyse/steps/step-03a1-setup.md +4 -4
- package/templates/skills/business-analyse/steps/step-03a2-analysis.md +1 -1
- package/templates/skills/business-analyse/steps/step-03b-ui.md +4 -4
- package/templates/skills/business-analyse/steps/step-03c-compile.md +66 -140
- package/templates/skills/business-analyse/steps/step-03d-validate.md +2 -2
- package/templates/skills/business-analyse/steps/step-04a-collect.md +2 -2
- package/templates/skills/business-analyse/steps/step-04b-analyze.md +42 -160
- package/templates/skills/business-analyse/steps/step-04c-decide.md +1 -1
- package/templates/skills/business-analyse/steps/step-05a-handoff.md +74 -104
- package/templates/skills/business-analyse/steps/step-05b-deploy.md +13 -11
- package/templates/skills/business-analyse/steps/step-06-review.md +3 -3
- package/templates/skills/business-analyse/templates/tpl-frd.md +13 -13
- package/templates/skills/business-analyse/templates/tpl-handoff.md +12 -12
- package/templates/skills/business-analyse/templates-frd.md +25 -25
- package/templates/skills/business-analyse/templates-react.md +15 -21
- package/templates/skills/controller/SKILL.md +1 -1
- package/templates/skills/controller/postman-templates.md +1 -1
- package/templates/skills/controller/references/controller-code-templates.md +2 -2
- package/templates/skills/controller/references/mcp-scaffold-workflow.md +209 -0
- package/templates/skills/controller/references/permission-sync-templates.md +13 -16
- package/templates/skills/controller/steps/step-00-init.md +11 -11
- package/templates/skills/controller/steps/step-03-generate.md +64 -103
- package/templates/skills/controller/templates.md +67 -71
- package/templates/skills/debug/SKILL.md +13 -218
- package/templates/skills/debug/steps/step-00-init.md +57 -0
- package/templates/skills/debug/steps/step-01-analyze.md +219 -0
- package/templates/skills/debug/steps/step-02-resolve.md +85 -0
- package/templates/skills/documentation/SKILL.md +49 -345
- package/templates/skills/documentation/data-schema.md +11 -8
- package/templates/skills/documentation/steps/step-00-init.md +70 -0
- package/templates/skills/documentation/steps/step-01-scan.md +113 -0
- package/templates/skills/documentation/steps/step-02-generate.md +231 -0
- package/templates/skills/documentation/steps/step-03-validate.md +238 -0
- package/templates/skills/documentation/templates.md +480 -322
- package/templates/skills/efcore/references/both-contexts.md +32 -0
- package/templates/skills/efcore/references/database-operations.md +67 -0
- package/templates/skills/efcore/references/destructive-operations.md +38 -0
- package/templates/skills/efcore/references/reset-operations.md +81 -0
- package/templates/skills/efcore/references/seed-methods.md +86 -0
- package/templates/skills/efcore/references/shared-init-functions.md +250 -0
- package/templates/skills/efcore/references/sql-objects-injection.md +61 -0
- package/templates/skills/efcore/references/troubleshooting.md +81 -0
- package/templates/skills/efcore/steps/db/step-deploy.md +1 -32
- package/templates/skills/efcore/steps/db/step-reset.md +7 -103
- package/templates/skills/efcore/steps/db/step-seed.md +10 -132
- package/templates/skills/efcore/steps/db/step-status.md +5 -44
- package/templates/skills/efcore/steps/migration/step-03-validate.md +8 -62
- package/templates/skills/efcore/steps/rebase-snapshot/step-03-create.md +1 -57
- package/templates/skills/efcore/steps/shared/step-00-init.md +11 -254
- package/templates/skills/efcore/steps/squash/step-03-create.md +1 -58
- package/templates/skills/feature-full/SKILL.md +1 -1
- package/templates/skills/feature-full/steps/step-00-init.md +57 -0
- package/templates/skills/feature-full/steps/step-01-implementation.md +1 -1
- package/templates/skills/gitflow/SKILL.md +1 -1
- package/templates/skills/gitflow/_shared.md +23 -0
- package/templates/skills/gitflow/references/commit-message-generation.md +58 -0
- package/templates/skills/gitflow/references/commit-migration-validation.md +49 -0
- package/templates/skills/gitflow/references/finish-cleanup.md +51 -0
- package/templates/skills/gitflow/references/finish-version-bumping.md +45 -0
- package/templates/skills/gitflow/references/init-environment-detection.md +41 -0
- package/templates/skills/gitflow/references/init-questions.md +185 -0
- package/templates/skills/gitflow/references/init-structure-creation.md +71 -0
- package/templates/skills/gitflow/references/init-version-detection.md +21 -0
- package/templates/skills/gitflow/references/init-workspace-detection.md +43 -0
- package/templates/skills/gitflow/references/merge-ci-status.md +36 -0
- package/templates/skills/gitflow/references/merge-execution.md +62 -0
- package/templates/skills/gitflow/references/merge-pr-context.md +76 -0
- package/templates/skills/gitflow/references/pr-build-checks.md +60 -0
- package/templates/skills/gitflow/references/pr-generation.md +58 -0
- package/templates/skills/gitflow/references/start-branch-normalization.md +28 -0
- package/templates/skills/gitflow/references/start-worktree-creation.md +50 -0
- package/templates/skills/gitflow/references/sync-push-verify.md +44 -0
- package/templates/skills/gitflow/references/sync-rebase-conflicts.md +38 -0
- package/templates/skills/gitflow/steps/step-commit.md +12 -91
- package/templates/skills/gitflow/steps/step-finish.md +15 -159
- package/templates/skills/gitflow/steps/step-init.md +24 -326
- package/templates/skills/gitflow/steps/step-merge.md +17 -176
- package/templates/skills/gitflow/steps/step-pr.md +10 -116
- package/templates/skills/gitflow/steps/step-start.md +16 -109
- package/templates/skills/gitflow/steps/step-sync.md +6 -69
- package/templates/skills/ralph-loop/SKILL.md +6 -0
- package/templates/skills/ralph-loop/references/category-completeness.md +185 -0
- package/templates/skills/ralph-loop/references/compact-loop.md +1 -1
- package/templates/skills/ralph-loop/references/init-resume-recovery.md +127 -0
- package/templates/skills/ralph-loop/references/module-transition.md +151 -0
- package/templates/skills/ralph-loop/references/multi-module-queue.md +171 -0
- package/templates/skills/ralph-loop/references/parallel-execution.md +246 -0
- package/templates/skills/ralph-loop/references/task-transform-legacy.md +6 -9
- package/templates/skills/ralph-loop/references/team-orchestration.md +45 -3
- package/templates/skills/ralph-loop/steps/step-00-init.md +36 -109
- package/templates/skills/ralph-loop/steps/step-01-task.md +15 -163
- package/templates/skills/ralph-loop/steps/step-02-execute.md +8 -154
- package/templates/skills/ralph-loop/steps/step-04-check.md +21 -73
- package/templates/skills/review-code/references/owasp-api-top10.md +5 -5
- package/templates/skills/review-code/references/smartstack-conventions.md +11 -11
- package/templates/skills/validate-feature/references/api-smoke-tests.md +140 -0
- package/templates/skills/validate-feature/references/db-validation-checks.md +180 -0
- package/templates/skills/validate-feature/steps/step-01-compile.md +5 -2
- package/templates/skills/validate-feature/steps/step-04-api-smoke.md +34 -145
- package/templates/skills/validate-feature/steps/step-05-db-validation.md +74 -260
- package/templates/skills/workflow/SKILL.md +1 -1
- package/templates/skills/workflow/steps/step-00-init.md +57 -0
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
# Test Generation: Coverage Requirements & Categories
|
|
2
|
+
|
|
3
|
+
> Referenced from `steps/step-07-tests.md` — Test coverage minimums and category definitions.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Minimum Test Coverage Per Category
|
|
8
|
+
|
|
9
|
+
| Category | Minimum Tests | Focus Areas |
|
|
10
|
+
|----------|---------------|------------|
|
|
11
|
+
| Controller (mock) | 10 | CRUD routing, auth/tenant handling, error responses |
|
|
12
|
+
| Controller (real integration) | 8 | CRUD with actual DB persistence, tenant isolation, 404/409 cases |
|
|
13
|
+
| Service | 8 | Business logic, CRUD, error handling, edge cases |
|
|
14
|
+
| Entity | 5 | Factory method, property updates, validation, soft delete |
|
|
15
|
+
| Validator | 8 | Code validation, name validation, security rules |
|
|
16
|
+
| Repository | 8 | CRUD, tenant filtering, pagination, indexes |
|
|
17
|
+
| Security | 10 | Auth bypass attempts, injection attacks, header validation |
|
|
18
|
+
|
|
19
|
+
**Total minimum:** ~67 tests per entity
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Real Integration Test Coverage
|
|
24
|
+
|
|
25
|
+
Integration tests (with actual DB):
|
|
26
|
+
- GET all → 200 with list
|
|
27
|
+
- GET by ID → 200 when exists, 404 when not
|
|
28
|
+
- POST → 201/200 when valid, persist to DB, read back to verify
|
|
29
|
+
- POST → 400 when invalid data
|
|
30
|
+
- POST → 409 when duplicate code
|
|
31
|
+
- PUT → 200 when valid, persist changes, read back to verify
|
|
32
|
+
- PUT → 404 when not exists
|
|
33
|
+
- DELETE → 204 when exists
|
|
34
|
+
- DELETE → 404 when not exists
|
|
35
|
+
- Tenant isolation → create in tenant A, invisible in tenant B (REAL DB)
|
|
36
|
+
- Authorization → 401 when not authenticated
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## Test Naming Convention (BLOCKING)
|
|
41
|
+
|
|
42
|
+
All test methods MUST follow: `{Method}_When{Condition}_Should{Result}`
|
|
43
|
+
|
|
44
|
+
**FORBIDDEN patterns:**
|
|
45
|
+
- `Test1`, `Test2`, `TestMethod`, `MyTest`
|
|
46
|
+
- `Should_Return_OK`, `test_get_all`
|
|
47
|
+
|
|
48
|
+
**REQUIRED pattern:**
|
|
49
|
+
```csharp
|
|
50
|
+
GetAll_WhenCalled_ShouldReturn200WithList
|
|
51
|
+
Create_WhenDuplicateCode_ShouldThrowException
|
|
52
|
+
Delete_WhenNotAuthenticated_ShouldReturn401
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Test Structure (BLOCKING)
|
|
58
|
+
|
|
59
|
+
All tests MUST follow Arrange-Act-Assert:
|
|
60
|
+
|
|
61
|
+
```csharp
|
|
62
|
+
// CORRECT
|
|
63
|
+
[Fact]
|
|
64
|
+
public async Task GetById_WhenExists_ShouldReturn200()
|
|
65
|
+
{
|
|
66
|
+
// Arrange
|
|
67
|
+
var id = Guid.NewGuid();
|
|
68
|
+
// ... setup
|
|
69
|
+
|
|
70
|
+
// Act
|
|
71
|
+
var response = await _client.GetAsync($"/api/{entityCode}/{id}");
|
|
72
|
+
|
|
73
|
+
// Assert
|
|
74
|
+
response.StatusCode.Should().Be(HttpStatusCode.OK);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// FORBIDDEN - No structure
|
|
78
|
+
[Fact]
|
|
79
|
+
public void TestGetById()
|
|
80
|
+
{
|
|
81
|
+
var response = _client.GetAsync("/api/product/1");
|
|
82
|
+
Assert.Equal(200, response.StatusCode);
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## Dependencies Check (BLOCKING)
|
|
89
|
+
|
|
90
|
+
Verify test project uses:
|
|
91
|
+
- `FluentAssertions` (NOT `Assert.Equal`)
|
|
92
|
+
- `Moq` (NOT manual fakes)
|
|
93
|
+
- `xunit` (NOT NUnit or MSTest)
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## Test Categories
|
|
98
|
+
|
|
99
|
+
### 1. Controller Mock Tests
|
|
100
|
+
|
|
101
|
+
Unit tests with mocked dependencies:
|
|
102
|
+
- Routing validation
|
|
103
|
+
- Authentication/Authorization
|
|
104
|
+
- Error response formatting
|
|
105
|
+
- Input validation
|
|
106
|
+
|
|
107
|
+
```csharp
|
|
108
|
+
[Fact]
|
|
109
|
+
public async Task GetAll_WhenCalled_ShouldReturn200WithList()
|
|
110
|
+
{
|
|
111
|
+
// Mock service
|
|
112
|
+
_mockService.Setup(s => s.GetAllAsync(It.IsAny<CancellationToken>()))
|
|
113
|
+
.ReturnsAsync(new List<ProductDto>());
|
|
114
|
+
|
|
115
|
+
// Act & Assert
|
|
116
|
+
...
|
|
117
|
+
}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### 2. Controller Integration Tests
|
|
121
|
+
|
|
122
|
+
REAL tests with actual DB (via WebApplicationFactory):
|
|
123
|
+
- Full HTTP flow
|
|
124
|
+
- Database persistence
|
|
125
|
+
- Tenant isolation
|
|
126
|
+
- Query validation
|
|
127
|
+
|
|
128
|
+
### 3. Service Tests
|
|
129
|
+
|
|
130
|
+
Unit tests for business logic:
|
|
131
|
+
- CRUD operations
|
|
132
|
+
- Error handling
|
|
133
|
+
- Validation logic
|
|
134
|
+
|
|
135
|
+
### 4. Entity Tests
|
|
136
|
+
|
|
137
|
+
Domain model tests:
|
|
138
|
+
- Factory methods
|
|
139
|
+
- Property validation
|
|
140
|
+
- State transitions
|
|
141
|
+
- Soft delete
|
|
142
|
+
|
|
143
|
+
### 5. Validator Tests
|
|
144
|
+
|
|
145
|
+
Input validation:
|
|
146
|
+
- Code format validation
|
|
147
|
+
- Name constraints
|
|
148
|
+
- Security rules (XSS, SQL injection detection)
|
|
149
|
+
|
|
150
|
+
### 6. Repository Tests
|
|
151
|
+
|
|
152
|
+
Data access tests:
|
|
153
|
+
- Query correctness
|
|
154
|
+
- Tenant filtering
|
|
155
|
+
- Pagination
|
|
156
|
+
- Indexes
|
|
157
|
+
|
|
158
|
+
### 7. Security Tests
|
|
159
|
+
|
|
160
|
+
OWASP coverage:
|
|
161
|
+
- Authentication bypass attempts
|
|
162
|
+
- Authorization bypass attempts
|
|
163
|
+
- SQL injection attempts
|
|
164
|
+
- XSS payload handling
|
|
165
|
+
- CSRF token validation
|
|
166
|
+
- Tenant isolation breach attempts
|
|
167
|
+
- Header injection attempts
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
## Build & Run Checks (BLOCKING)
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
# Build
|
|
175
|
+
dotnet build tests/{SolutionName}.Tests/{SolutionName}.Tests.csproj
|
|
176
|
+
|
|
177
|
+
# Run
|
|
178
|
+
dotnet test tests/{SolutionName}.Tests/{SolutionName}.Tests.csproj --no-build --verbosity normal
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
**ALL tests MUST pass.** If tests fail:
|
|
182
|
+
1. Read the failure output carefully
|
|
183
|
+
2. Fix the failing tests or the code they test
|
|
184
|
+
3. Re-run until all tests pass
|
|
185
|
+
4. Do NOT proceed to the next step until all tests are green
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
## Frontend Test Categories
|
|
190
|
+
|
|
191
|
+
| File | Category | Focus |
|
|
192
|
+
|------|----------|-------|
|
|
193
|
+
| `{EntityName}Page.test.tsx` | Page | Loading, error, render with data |
|
|
194
|
+
| `{EntityName}ListView.test.tsx` | List | Pagination, filtering, view toggle |
|
|
195
|
+
| `{EntityName}DetailPage.test.tsx` | Detail | Tab switching, back navigation |
|
|
196
|
+
| `use{EntityName}Preferences.test.ts` | Hooks | State persistence, local storage |
|
|
197
|
+
| `{entityName}Api.test.ts` | API Client | MSW mocking, HTTP methods |
|
|
198
|
+
|
|
199
|
+
---
|
|
200
|
+
|
|
201
|
+
## Validation Checklist
|
|
202
|
+
|
|
203
|
+
- [ ] All test methods follow `{Method}_When{Condition}_Should{Result}` naming
|
|
204
|
+
- [ ] All tests use Arrange-Act-Assert structure
|
|
205
|
+
- [ ] FluentAssertions used throughout (not Assert.Equal)
|
|
206
|
+
- [ ] Moq used for mock-based tests only
|
|
207
|
+
- [ ] Minimum test count met per category
|
|
208
|
+
- [ ] Real integration tests verify DB persistence
|
|
209
|
+
- [ ] Security tests cover OWASP top 10 issues
|
|
210
|
+
- [ ] Backend tests build successfully
|
|
211
|
+
- [ ] **ALL backend tests pass**
|
|
212
|
+
- [ ] Frontend tests build successfully
|
|
213
|
+
- [ ] **ALL frontend tests pass**
|
|
@@ -53,9 +53,9 @@ Args:
|
|
|
53
53
|
```
|
|
54
54
|
|
|
55
55
|
This generates:
|
|
56
|
-
- `src/pages/{
|
|
57
|
-
- `src/pages/{
|
|
58
|
-
- `src/pages/{
|
|
56
|
+
- `src/pages/{application}/__tests__/{EntityName}Page.test.tsx` - Page rendering, loading, error states
|
|
57
|
+
- `src/pages/{application}/__tests__/{EntityName}ListView.test.tsx` - List display, pagination, view toggle
|
|
58
|
+
- `src/pages/{application}/__tests__/{EntityName}DetailPage.test.tsx` - Detail view, tabs, back navigation
|
|
59
59
|
- `src/hooks/__tests__/use{EntityName}Preferences.test.ts` - Preference get/set
|
|
60
60
|
- `src/services/api/__tests__/{entityName}Api.test.ts` - API client calls with MSW
|
|
61
61
|
|
|
@@ -22,156 +22,26 @@ Initialize the application/module creation by parsing parameters, detecting leve
|
|
|
22
22
|
|
|
23
23
|
## EXECUTION SEQUENCE
|
|
24
24
|
|
|
25
|
-
### 1.
|
|
25
|
+
### 1-4. Parameter Detection & Project Analysis
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
| "module", "feature", "nouveau module" | module | Yes (context.application) |
|
|
34
|
-
| "section", "tab", "nouvelle section" | section | Yes (context.app.module) |
|
|
35
|
-
|
|
36
|
-
### 2. Extract Parameters
|
|
37
|
-
|
|
38
|
-
```yaml
|
|
39
|
-
# Required
|
|
40
|
-
level: context | application | module | section
|
|
41
|
-
code: kebab-case (e.g., "products", "order-management")
|
|
42
|
-
labels:
|
|
43
|
-
fr: "Label français"
|
|
44
|
-
en: "English label"
|
|
45
|
-
it: "Etichetta italiana"
|
|
46
|
-
de: "Deutsche Bezeichnung"
|
|
47
|
-
icon: Lucide icon name (e.g., "Package", "ShoppingCart")
|
|
48
|
-
displayOrder: number
|
|
49
|
-
|
|
50
|
-
# Conditional (required for non-context levels)
|
|
51
|
-
parentPath: "context.application.module" (dot-separated)
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
### 3. MCP Prerequisite Check (BLOCKING)
|
|
55
|
-
|
|
56
|
-
**CRITICAL:** This check is **BLOCKING** - the skill cannot proceed without MCP.
|
|
57
|
-
|
|
58
|
-
> See `_shared.md` → "MCP Prerequisite Guard (BLOCKING)" for the full pattern.
|
|
59
|
-
|
|
60
|
-
```
|
|
61
|
-
Call: mcp__smartstack__validate_conventions
|
|
62
|
-
Args: { checks: ["tables"] }
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
**On success:** Set `mcp_available = true`, continue to Step 4.
|
|
66
|
-
|
|
67
|
-
**On failure (STOP):**
|
|
68
|
-
|
|
69
|
-
```
|
|
70
|
-
═══════════════════════════════════════════════════════════════
|
|
71
|
-
MCP SMARTSTACK NOT AVAILABLE - SKILL BLOCKED
|
|
72
|
-
═══════════════════════════════════════════════════════════════
|
|
73
|
-
|
|
74
|
-
The SmartStack MCP server is required for the application
|
|
75
|
-
skill but could not be reached.
|
|
76
|
-
|
|
77
|
-
To install:
|
|
78
|
-
claude mcp add smartstack -- npx --package @atlashub/smartstack-cli smartstack-mcp
|
|
79
|
-
|
|
80
|
-
To verify:
|
|
81
|
-
/mcp:healthcheck
|
|
82
|
-
|
|
83
|
-
After installation, restart Claude Code and retry.
|
|
84
|
-
|
|
85
|
-
═══════════════════════════════════════════════════════════════
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
**DO NOT** offer manual instructions or degraded execution.
|
|
89
|
-
**DO NOT** proceed with step files.
|
|
90
|
-
**STOP the skill immediately.**
|
|
91
|
-
|
|
92
|
-
### 4. Detect Project Type
|
|
93
|
-
|
|
94
|
-
Read `.smartstack/config.json` at the project root to determine the seeding strategy:
|
|
95
|
-
|
|
96
|
-
```
|
|
97
|
-
Read: .smartstack/config.json
|
|
98
|
-
Extract: projectType, dbContext
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
| projectType | dbContext | Seeding Strategy |
|
|
102
|
-
|-------------|----------|-----------------|
|
|
103
|
-
| `core` | `core` | HasData() in Configuration files (existing pattern) |
|
|
104
|
-
| `client` | `extensions` | IClientSeedDataProvider (runtime seeding) |
|
|
105
|
-
|
|
106
|
-
**If file not found or projectType missing:** Default to `core` / `hasdata`.
|
|
107
|
-
|
|
108
|
-
Store:
|
|
109
|
-
```
|
|
110
|
-
{project_type} = "core" or "client"
|
|
111
|
-
{db_context} = "core" or "extensions"
|
|
112
|
-
{seeding_strategy} = "hasdata" or "provider"
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
### 4b. Detect Feature.json Context (Optional Enrichment)
|
|
116
|
-
|
|
117
|
-
Search for a Business Analysis feature.json for the target module:
|
|
118
|
-
|
|
119
|
-
```
|
|
120
|
-
Glob: docs/business/*/{code}/business-analyse/v*/feature.json
|
|
121
|
-
.business-analyse/business/*/modules/{code}/features/*/feature.json
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
**If found (status = "handed-off" or "consolidated"):**
|
|
125
|
-
|
|
126
|
-
Read the feature.json and extract context for subsequent steps:
|
|
127
|
-
|
|
128
|
-
| feature.json Section | Used In Step | Extracted Data |
|
|
129
|
-
|----------------------|-------------|----------------|
|
|
130
|
-
| `analysis.entities[]` | step-04 (backend) | Entity names, attributes, relationships, validations |
|
|
131
|
-
| `specification.useCases[]` | step-04 (backend) | API endpoint definitions beyond basic CRUD |
|
|
132
|
-
| `specification.permissionMatrix` | step-02 (permissions) | Custom permission paths and role assignments |
|
|
133
|
-
| `specification.apiEndpoints[]` | step-04 (backend) | Exact HTTP methods, routes, DTOs |
|
|
134
|
-
| `specification.navigation` | step-01 (navigation) | Navigation hierarchy with labels and icons |
|
|
135
|
-
| `specification.i18nKeys` | step-05 (frontend) | Pre-defined translation keys |
|
|
136
|
-
| `specification.validations[]` | step-04 (backend) | Field-level validation rules |
|
|
137
|
-
| `specification.uiWireframes[]` | step-05 (frontend) | UI layout guidance |
|
|
138
|
-
| `specification.seedDataCore` | step-01, step-02, step-03 | Pre-computed seeds |
|
|
139
|
-
| `analysis.businessRules[]` | step-04, step-07 | Business rules for service logic and tests |
|
|
140
|
-
| `specification.lifeCycles[]` | step-04 (backend) | Entity state machines |
|
|
141
|
-
| `specification.dashboards` | step-05 (frontend) | Dashboard KPIs and chart specs |
|
|
142
|
-
| `documentation` | step-08 | userDocRequired / techDocRequired flags |
|
|
143
|
-
|
|
144
|
-
Store:
|
|
145
|
-
```
|
|
146
|
-
{feature_json_path} = "path/to/feature.json" or null
|
|
147
|
-
{has_feature_context} = true or false
|
|
148
|
-
{feature_data} = parsed feature.json object (if found)
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
**If NOT found or status not in ["handed-off", "consolidated"]:**
|
|
152
|
-
|
|
153
|
-
```
|
|
154
|
-
{has_feature_context} = false
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
Continue normally. All subsequent steps use their standard generation logic (generic CRUD).
|
|
158
|
-
|
|
159
|
-
> **When `{has_feature_context} = true`**, subsequent steps SHOULD use the feature.json data
|
|
160
|
-
> to generate more accurate code: entities with correct attributes and relationships, custom
|
|
161
|
-
> permissions beyond basic CRUD, specific API routes, validation rules, and business logic
|
|
162
|
-
> in services. This reduces post-generation manual corrections significantly.
|
|
27
|
+
See [references/init-parameter-detection.md](../references/init-parameter-detection.md) for:
|
|
28
|
+
- Navigation level detection (application/module/section)
|
|
29
|
+
- Parameter extraction (code, labels, icon, displayOrder)
|
|
30
|
+
- Project type & seeding strategy detection
|
|
31
|
+
- Feature.json context enrichment (optional)
|
|
32
|
+
- MCP prerequisite validation (BLOCKING)
|
|
163
33
|
|
|
164
34
|
### 5. Build Full Path
|
|
165
35
|
|
|
166
36
|
```
|
|
167
37
|
{full_path} = {parentPath}.{code} (if parentPath exists)
|
|
168
|
-
{full_path} = {code} (if
|
|
38
|
+
{full_path} = {code} (if application level)
|
|
169
39
|
|
|
170
40
|
Example:
|
|
171
41
|
level: module
|
|
172
|
-
parentPath:
|
|
42
|
+
parentPath: sales
|
|
173
43
|
code: products
|
|
174
|
-
→ full_path:
|
|
44
|
+
→ full_path: sales.products
|
|
175
45
|
```
|
|
176
46
|
|
|
177
47
|
### 6. Infer Descriptions (if not provided)
|
|
@@ -218,7 +88,7 @@ descriptions:
|
|
|
218
88
|
|
|
219
89
|
| Variable | Description |
|
|
220
90
|
|----------|-------------|
|
|
221
|
-
| `{level}` |
|
|
91
|
+
| `{level}` | application, module, or section |
|
|
222
92
|
| `{code}` | kebab-case identifier |
|
|
223
93
|
| `{full_path}` | Complete navigation path |
|
|
224
94
|
| `{parent_path}` | Parent path (null for context) |
|
|
@@ -29,7 +29,7 @@ From step-00-init:
|
|
|
29
29
|
|
|
30
30
|
| Variable | Description |
|
|
31
31
|
|----------|-------------|
|
|
32
|
-
| `{level}` |
|
|
32
|
+
| `{level}` | application, module, or section |
|
|
33
33
|
| `{code}` | kebab-case identifier |
|
|
34
34
|
| `{full_path}` | Complete navigation path |
|
|
35
35
|
| `{parent_path}` | Parent path (null for context) |
|
|
@@ -55,7 +55,7 @@ Tool: mcp__smartstack__scaffold_navigation
|
|
|
55
55
|
Args:
|
|
56
56
|
level: "{level}"
|
|
57
57
|
code: "{code}"
|
|
58
|
-
parentPath: "{parent_path}" # Omit if level is "
|
|
58
|
+
parentPath: "{parent_path}" # Omit if level is "application" (top-level)
|
|
59
59
|
labels:
|
|
60
60
|
fr: "{labels.fr}"
|
|
61
61
|
en: "{labels.en}"
|
|
@@ -158,7 +158,7 @@ See [references/nav-fallback-procedure.md](../references/nav-fallback-procedure.
|
|
|
158
158
|
|
|
159
159
|
## FAILURE MODES
|
|
160
160
|
|
|
161
|
-
- Missing parent path for non-
|
|
161
|
+
- Missing parent path for non-application level (return to step-00)
|
|
162
162
|
- Invalid level (return to step-00)
|
|
163
163
|
- Parent entity not found in existing seeds (ask user for parent GUID)
|
|
164
164
|
|
|
@@ -28,7 +28,7 @@ From previous steps:
|
|
|
28
28
|
|
|
29
29
|
| Variable | Description |
|
|
30
30
|
|----------|-------------|
|
|
31
|
-
| `{level}` |
|
|
31
|
+
| `{level}` | application, module, or section |
|
|
32
32
|
| `{full_path}` | Complete navigation path (navRoute) |
|
|
33
33
|
| `{navigation_guid}` | GUID of the navigation entity |
|
|
34
34
|
| `{labels}` | Object with fr, en, it, de |
|
|
@@ -45,7 +45,7 @@ For permissions, the navRoute is the `{full_path}`:
|
|
|
45
45
|
|
|
46
46
|
```
|
|
47
47
|
navRoute = "{full_path}"
|
|
48
|
-
Example: "
|
|
48
|
+
Example: "sales.products"
|
|
49
49
|
```
|
|
50
50
|
|
|
51
51
|
### 2. Call MCP generate_permissions
|
|
@@ -76,7 +76,7 @@ Add to `Application/Common/Authorization/Permissions.cs`:
|
|
|
76
76
|
|
|
77
77
|
**Usage in Controller:**
|
|
78
78
|
```csharp
|
|
79
|
-
[RequirePermission(Permissions.{
|
|
79
|
+
[RequirePermission(Permissions.{Application}.{Module}.Read)]
|
|
80
80
|
public async Task<ActionResult> GetAll() { ... }
|
|
81
81
|
```
|
|
82
82
|
```
|
|
@@ -186,7 +186,7 @@ If MCP call fails:
|
|
|
186
186
|
## FAILURE MODES
|
|
187
187
|
|
|
188
188
|
- MCP call failed (display error, stop)
|
|
189
|
-
- Invalid navRoute format (must be
|
|
189
|
+
- Invalid navRoute format (must be application.module)
|
|
190
190
|
- Missing navigation entity (return to step-01)
|
|
191
191
|
|
|
192
192
|
---
|
|
@@ -37,7 +37,7 @@ From previous steps:
|
|
|
37
37
|
| Variable | Description |
|
|
38
38
|
|----------|-------------|
|
|
39
39
|
| `{full_path}` | Complete navigation path (navRoute) |
|
|
40
|
-
| `{level}` |
|
|
40
|
+
| `{level}` | application, module, or section |
|
|
41
41
|
| `{permission_guids}` | GUIDs for generated permissions |
|
|
42
42
|
| `{mcp_available}` | Boolean - MCP connectivity status |
|
|
43
43
|
| `{project_type}` | "core" or "client" |
|
|
@@ -49,13 +49,10 @@ From previous steps:
|
|
|
49
49
|
|
|
50
50
|
### 1. Determine Default Role Assignments
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
| `platform.*` | Full CRUD | Read only | None |
|
|
57
|
-
| `business.*` | Full CRUD | Full CRUD | Read only |
|
|
58
|
-
| `personal.*` | None | Full CRUD | Full CRUD |
|
|
52
|
+
See [references/roles-client-project-handling.md](../references/roles-client-project-handling.md) for:
|
|
53
|
+
- Default role mapping table by application prefix
|
|
54
|
+
- ApplicationRolesSeedData.cs requirements (once per application)
|
|
55
|
+
- {Module}RolePermissionSeedData.cs requirements (per module)
|
|
59
56
|
|
|
60
57
|
### 2. Call MCP scaffold_role_permissions
|
|
61
58
|
|
|
@@ -134,178 +131,24 @@ If MCP call fails or `{mcp_available}` = false:
|
|
|
134
131
|
|
|
135
132
|
> **Condition:** `{seeding_strategy}` = "provider"
|
|
136
133
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
### 1. ApplicationRolesSeedData.cs (ONCE per application)
|
|
144
|
-
|
|
145
|
-
**File:** `Infrastructure/Persistence/Seeding/Data/ApplicationRolesSeedData.cs`
|
|
146
|
-
|
|
147
|
-
**Purpose:** Defines the 4 standard application-scoped roles (Admin, Manager, Contributor, Viewer) with valid `Code` values.
|
|
148
|
-
|
|
149
|
-
**CRITICAL:** Without this file, role-permission mappings in `SeedRolePermissionsAsync()` will fail silently because `roles.FirstOrDefault(r => r.Code == mapping.RoleCode)` will return null.
|
|
150
|
-
|
|
151
|
-
See [references/application-roles-template.md](../references/application-roles-template.md) for the complete template.
|
|
152
|
-
|
|
153
|
-
**Key requirements:**
|
|
154
|
-
- Deterministic GUIDs based on `role-{applicationId}-{roleType}`
|
|
155
|
-
- 4 roles: Admin, Manager, Contributor, Viewer
|
|
156
|
-
- Each role has a valid `Code` property ("admin", "manager", "contributor", "viewer")
|
|
157
|
-
- `ApplicationId` references the navigation application GUID
|
|
158
|
-
- `IsSystem = false` (application-scoped, not system roles)
|
|
159
|
-
|
|
160
|
-
**Detection:** Check if ApplicationRolesSeedData.cs exists. If yes, skip creation (already exists from Module 1). If no, create it.
|
|
161
|
-
|
|
162
|
-
### 2. {Module}RolePermissionSeedData.cs (PER module)
|
|
163
|
-
|
|
164
|
-
**File:** `Infrastructure/Persistence/Seeding/Data/{Domain}/{Module}RolePermissionSeedData.cs`
|
|
165
|
-
|
|
166
|
-
**Purpose:** Maps permissions to roles by Code (e.g., "admin" → "{navRoute}.*").
|
|
167
|
-
|
|
168
|
-
Content: static class with method `GetRolePermissionEntries()` that returns the role-permission mapping data.
|
|
169
|
-
These entries will be consumed by the `IClientSeedDataProvider` at step 03b.
|
|
170
|
-
|
|
171
|
-
**After creating both files:** Proceed to step-03b-provider.md (which will skip for core projects).
|
|
134
|
+
See [references/roles-client-project-handling.md](../references/roles-client-project-handling.md) for:
|
|
135
|
+
- ApplicationRolesSeedData.cs creation (once per application)
|
|
136
|
+
- {Module}RolePermissionSeedData.cs creation (per module)
|
|
137
|
+
- Role code naming and GUID generation rules
|
|
138
|
+
- Detection of existing ApplicationRolesSeedData.cs
|
|
172
139
|
|
|
173
140
|
---
|
|
174
141
|
|
|
175
142
|
## FALLBACK PROCEDURE (When MCP Unavailable)
|
|
176
143
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
Read the file to determine:
|
|
186
|
-
- Existing role-permission mappings
|
|
187
|
-
- The GetSeedData() method structure
|
|
188
|
-
- Which roles already have which permissions
|
|
189
|
-
- The GUID generation method used (deterministic or hardcoded)
|
|
190
|
-
|
|
191
|
-
### F2. Read Role GUIDs
|
|
192
|
-
|
|
193
|
-
**System-level roles** (well-known GUIDs):
|
|
194
|
-
|
|
195
|
-
| Role | GUID |
|
|
196
|
-
|------|------|
|
|
197
|
-
| SuperAdmin | `11111111-1111-1111-1111-111111111111` |
|
|
198
|
-
| PlatformAdmin | `22222222-2222-2222-2222-222222222222` |
|
|
199
|
-
| TenantAdmin | `33333333-3333-3333-3333-333333333333` |
|
|
200
|
-
| StandardUser | `44444444-4444-4444-4444-444444444444` |
|
|
201
|
-
|
|
202
|
-
**IMPORTANT:** Read the actual `RoleSeedData.cs` or `RoleConfiguration.cs` in the target project to confirm the actual role GUIDs. The above are defaults; the project may use different values.
|
|
203
|
-
|
|
204
|
-
**Application-scoped roles** (deterministic GUIDs based on application):
|
|
205
|
-
|
|
206
|
-
```csharp
|
|
207
|
-
// Read the existing GenerateDeterministicGuid method in RolePermissionConfiguration.cs
|
|
208
|
-
// Typically uses MD5 hash:
|
|
209
|
-
private static Guid GenerateDeterministicGuid(Guid applicationId, string roleType)
|
|
210
|
-
{
|
|
211
|
-
using var md5 = System.Security.Cryptography.MD5.Create();
|
|
212
|
-
var input = $"{applicationId}-{roleType}";
|
|
213
|
-
var hash = md5.ComputeHash(System.Text.Encoding.UTF8.GetBytes(input));
|
|
214
|
-
return new Guid(hash);
|
|
215
|
-
}
|
|
216
|
-
// roleType values: "admin", "manager", "contributor", "viewer"
|
|
217
|
-
```
|
|
218
|
-
|
|
219
|
-
Find the `applicationId` from `NavigationApplicationSeedData.cs` matching `{full_path}`.
|
|
220
|
-
|
|
221
|
-
### F3. Determine Context-Based Default Mappings
|
|
222
|
-
|
|
223
|
-
Based on `{full_path}` prefix:
|
|
224
|
-
|
|
225
|
-
| Context Prefix | SuperAdmin | PlatformAdmin | App Admin | App Manager | App Contributor | App Viewer |
|
|
226
|
-
|----------------|------------|---------------|-----------|-------------|-----------------|------------|
|
|
227
|
-
| `platform.*` | wildcard | Full CRUD | Full CRUD | CRU | CR | R |
|
|
228
|
-
| `business.*` | wildcard | Full CRUD | Full CRUD | CRU | CR | R |
|
|
229
|
-
| `personal.*` | wildcard | None | Full CRUD | CRU | CR | R |
|
|
230
|
-
|
|
231
|
-
### F4. Generate RolePermission HasData Entries
|
|
232
|
-
|
|
233
|
-
Using `{permission_guids}` from step-02:
|
|
234
|
-
|
|
235
|
-
```csharp
|
|
236
|
-
// In RolePermissionConfiguration.cs - GetSeedData() method
|
|
237
|
-
var seedDate = SeedConstants.SeedDate;
|
|
238
|
-
|
|
239
|
-
// ============================================================
|
|
240
|
-
// {MODULE_NAME} PERMISSIONS
|
|
241
|
-
// ============================================================
|
|
242
|
-
|
|
243
|
-
// SuperAdmin: already has *.* wildcard - no individual entries needed
|
|
244
|
-
|
|
245
|
-
// PlatformAdmin (for platform.* context)
|
|
246
|
-
rolePermissions.Add(new { RoleId = platformAdminRoleId, PermissionId = {permission_guids.read}, AssignedAt = seedDate });
|
|
247
|
-
rolePermissions.Add(new { RoleId = platformAdminRoleId, PermissionId = {permission_guids.create}, AssignedAt = seedDate });
|
|
248
|
-
rolePermissions.Add(new { RoleId = platformAdminRoleId, PermissionId = {permission_guids.update}, AssignedAt = seedDate });
|
|
249
|
-
rolePermissions.Add(new { RoleId = platformAdminRoleId, PermissionId = {permission_guids.delete}, AssignedAt = seedDate });
|
|
250
|
-
|
|
251
|
-
// Application-scoped: Admin → wildcard
|
|
252
|
-
rolePermissions.Add(new { RoleId = appAdminRoleId, PermissionId = {permission_guids.wildcard}, AssignedAt = seedDate });
|
|
253
|
-
|
|
254
|
-
// Application-scoped: Manager → CRU (read + create + update — no delete)
|
|
255
|
-
rolePermissions.Add(new { RoleId = appManagerRoleId, PermissionId = {permission_guids.read}, AssignedAt = seedDate });
|
|
256
|
-
rolePermissions.Add(new { RoleId = appManagerRoleId, PermissionId = {permission_guids.create}, AssignedAt = seedDate });
|
|
257
|
-
rolePermissions.Add(new { RoleId = appManagerRoleId, PermissionId = {permission_guids.update}, AssignedAt = seedDate });
|
|
258
|
-
|
|
259
|
-
// Application-scoped: Contributor → CR
|
|
260
|
-
rolePermissions.Add(new { RoleId = appContributorRoleId, PermissionId = {permission_guids.read}, AssignedAt = seedDate });
|
|
261
|
-
rolePermissions.Add(new { RoleId = appContributorRoleId, PermissionId = {permission_guids.create}, AssignedAt = seedDate });
|
|
262
|
-
|
|
263
|
-
// Application-scoped: Viewer → R
|
|
264
|
-
rolePermissions.Add(new { RoleId = appViewerRoleId, PermissionId = {permission_guids.read}, AssignedAt = seedDate });
|
|
265
|
-
```
|
|
266
|
-
|
|
267
|
-
### F5. Write Code to RolePermissionConfiguration.cs
|
|
268
|
-
|
|
269
|
-
**CRITICAL:** Do NOT just display code. WRITE it to the actual file.
|
|
270
|
-
|
|
271
|
-
1. Open `RolePermissionConfiguration.cs`
|
|
272
|
-
2. Find the `GetSeedData()` method
|
|
273
|
-
3. Add the new role-permission entries to the list
|
|
274
|
-
4. Add necessary permission GUID references (import from PermissionConfiguration or use inline)
|
|
275
|
-
5. Add comments grouping the new entries: `// {MODULE_NAME} PERMISSIONS`
|
|
276
|
-
|
|
277
|
-
### F6. Present Summary
|
|
278
|
-
|
|
279
|
-
```markdown
|
|
280
|
-
## Role-Permission Mappings Generated (Fallback)
|
|
281
|
-
|
|
282
|
-
| Role | Permissions |
|
|
283
|
-
|------|-------------|
|
|
284
|
-
| SuperAdmin | Already has wildcard access |
|
|
285
|
-
| PlatformAdmin | {full_path}.read, .create, .update, .delete |
|
|
286
|
-
| App Admin | {full_path}.* (wildcard) |
|
|
287
|
-
| App Manager | {full_path}.read, .create, .update |
|
|
288
|
-
| App Contributor | {full_path}.read, .create |
|
|
289
|
-
| App Viewer | {full_path}.read |
|
|
290
|
-
|
|
291
|
-
Written to: RolePermissionConfiguration.cs
|
|
292
|
-
```
|
|
293
|
-
|
|
294
|
-
### F7. Offer User Adjustment
|
|
295
|
-
|
|
296
|
-
```yaml
|
|
297
|
-
questions:
|
|
298
|
-
- header: "Role Access"
|
|
299
|
-
question: "Default role-permission mappings have been applied. Adjust?"
|
|
300
|
-
options:
|
|
301
|
-
- label: "Keep defaults (Recommended)"
|
|
302
|
-
description: "Standard role hierarchy applied"
|
|
303
|
-
- label: "Custom adjustments"
|
|
304
|
-
description: "I want to change specific role permissions"
|
|
305
|
-
multiSelect: false
|
|
306
|
-
```
|
|
307
|
-
|
|
308
|
-
If user selects "Custom adjustments", ask which roles/permissions to change and update the file accordingly.
|
|
144
|
+
See [references/roles-fallback-procedure.md](../references/roles-fallback-procedure.md) for the complete 7-step fallback:
|
|
145
|
+
- **F1:** Read existing RolePermissionConfiguration.cs to determine state
|
|
146
|
+
- **F2:** Read role GUIDs (system-level and application-scoped)
|
|
147
|
+
- **F3:** Determine default mappings based on application prefix
|
|
148
|
+
- **F4:** Generate RolePermission HasData entries using permission GUIDs
|
|
149
|
+
- **F5:** Write code to RolePermissionConfiguration.cs (CRITICAL: WRITE not display)
|
|
150
|
+
- **F6:** Present summary
|
|
151
|
+
- **F7:** Offer user adjustment option
|
|
309
152
|
|
|
310
153
|
---
|
|
311
154
|
|