@atlashub/smartstack-cli 4.35.0 → 4.37.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 +54 -100
- package/dist/index.js.map +1 -1
- package/dist/mcp-entry.mjs +54 -11
- package/dist/mcp-entry.mjs.map +1 -1
- package/package.json +1 -1
- package/templates/agents/efcore/migration.md +43 -0
- package/templates/agents/efcore/rebase-snapshot.md +36 -0
- package/templates/agents/efcore/squash.md +36 -0
- package/templates/skills/apex/references/checks/seed-checks.sh +1 -1
- package/templates/skills/apex/references/core-seed-data.md +39 -21
- package/templates/skills/application/references/application-roles-template.md +14 -8
- package/templates/skills/application/references/provider-template.md +32 -20
- package/templates/skills/application/templates-frontend.md +294 -2
- package/templates/skills/application/templates-seed.md +23 -11
- package/templates/skills/audit-route/SKILL.md +107 -0
- package/templates/skills/audit-route/references/routing-pattern.md +129 -0
- package/templates/skills/audit-route/steps/step-00-init.md +128 -0
- package/templates/skills/audit-route/steps/step-01-inventory.md +157 -0
- package/templates/skills/audit-route/steps/step-02-conformity.md +193 -0
- package/templates/skills/audit-route/steps/step-03-report.md +201 -0
- package/templates/skills/dev-start/SKILL.md +12 -2
- package/templates/skills/efcore/SKILL.md +219 -67
- package/templates/agents/efcore/conflicts.md +0 -114
- package/templates/agents/efcore/db-deploy.md +0 -86
- package/templates/agents/efcore/db-reset.md +0 -98
- package/templates/agents/efcore/db-seed.md +0 -73
- package/templates/agents/efcore/db-status.md +0 -97
- package/templates/agents/efcore/scan.md +0 -124
- package/templates/skills/efcore/references/both-contexts.md +0 -32
- package/templates/skills/efcore/references/destructive-operations.md +0 -38
- package/templates/skills/efcore/steps/db/step-deploy.md +0 -217
- package/templates/skills/efcore/steps/db/step-reset.md +0 -186
- package/templates/skills/efcore/steps/db/step-seed.md +0 -166
- package/templates/skills/efcore/steps/db/step-status.md +0 -173
- package/templates/skills/efcore/steps/migration/step-00-init.md +0 -102
- package/templates/skills/efcore/steps/migration/step-01-check.md +0 -164
- package/templates/skills/efcore/steps/migration/step-02-create.md +0 -160
- package/templates/skills/efcore/steps/migration/step-03-validate.md +0 -168
- package/templates/skills/efcore/steps/rebase-snapshot/step-00-init.md +0 -173
- package/templates/skills/efcore/steps/rebase-snapshot/step-01-backup.md +0 -100
- package/templates/skills/efcore/steps/rebase-snapshot/step-02-fetch.md +0 -115
- package/templates/skills/efcore/steps/rebase-snapshot/step-03-create.md +0 -112
- package/templates/skills/efcore/steps/rebase-snapshot/step-04-validate.md +0 -157
- package/templates/skills/efcore/steps/shared/step-00-init.md +0 -131
- package/templates/skills/efcore/steps/squash/step-00-init.md +0 -141
- package/templates/skills/efcore/steps/squash/step-01-backup.md +0 -120
- package/templates/skills/efcore/steps/squash/step-02-fetch.md +0 -168
- package/templates/skills/efcore/steps/squash/step-03-create.md +0 -184
- package/templates/skills/efcore/steps/squash/step-04-validate.md +0 -174
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: step-00-init
|
|
3
|
+
description: Parse flags, detect project structure, resolve paths for routing audit
|
|
4
|
+
next_step: steps/step-01-inventory.md
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Step 0: Initialization
|
|
8
|
+
|
|
9
|
+
## MANDATORY EXECUTION RULES:
|
|
10
|
+
- NEVER skip project detection
|
|
11
|
+
- ALWAYS resolve actual filesystem paths before proceeding
|
|
12
|
+
- YOU ARE AN INITIALIZER, not a scanner
|
|
13
|
+
|
|
14
|
+
## YOUR TASK:
|
|
15
|
+
Parse the flags, detect the SmartStack project structure, and resolve which directories to scan.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## EXECUTION SEQUENCE:
|
|
20
|
+
|
|
21
|
+
### 1. Parse Input
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
Arguments from $ARGUMENTS:
|
|
25
|
+
--scope=frontend -> {scope} = "frontend" (elements 1-4 only)
|
|
26
|
+
--scope=backend -> {scope} = "backend" (element 5 only)
|
|
27
|
+
--scope=all -> {scope} = "all" (default)
|
|
28
|
+
--strict -> {strict} = true (default: false)
|
|
29
|
+
|
|
30
|
+
No arguments -> {scope} = "all", {strict} = false
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### 2. Detect Project Structure
|
|
34
|
+
|
|
35
|
+
Use Glob and Bash to locate:
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
Frontend paths:
|
|
39
|
+
{web_root} = web/smartstack-web/src/
|
|
40
|
+
Verify: package.json exists in web/smartstack-web/
|
|
41
|
+
Verify: src/ directory exists
|
|
42
|
+
|
|
43
|
+
Backend paths:
|
|
44
|
+
{api_root} = src/SmartStack.Api/
|
|
45
|
+
{app_root} = src/SmartStack.Application/
|
|
46
|
+
{infra_root} = src/SmartStack.Infrastructure/
|
|
47
|
+
Verify: SmartStack.sln exists at project root
|
|
48
|
+
|
|
49
|
+
Key files to pre-locate (existence check only):
|
|
50
|
+
- componentRegistry: Glob for "**/componentRegistry*" in {web_root}
|
|
51
|
+
- ProtectedRoute: Glob for "**/ProtectedRoute*" in {web_root}
|
|
52
|
+
- DynamicRouter: Glob for "**/DynamicRouter*" in {web_root}
|
|
53
|
+
- useRouteConfig: Glob for "**/useRouteConfig*" in {web_root}
|
|
54
|
+
- Navigation controller: Glob for "**/Navigation*Controller*" in {api_root}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### 3. Validate Paths
|
|
58
|
+
|
|
59
|
+
For each required path:
|
|
60
|
+
- If missing: record as CRITICAL warning
|
|
61
|
+
- If found: record path for next steps
|
|
62
|
+
|
|
63
|
+
### 4. MCP Pre-scan (automated baseline)
|
|
64
|
+
|
|
65
|
+
Use `ToolSearch` to fetch MCP tools, then call them to get an automated baseline:
|
|
66
|
+
|
|
67
|
+
```
|
|
68
|
+
Step 4a: Fetch MCP tools
|
|
69
|
+
ToolSearch query="select:mcp__smartstack__validate_frontend_routes,mcp__smartstack__validate_conventions"
|
|
70
|
+
|
|
71
|
+
Step 4b: Call validate_frontend_routes (if available)
|
|
72
|
+
mcp__smartstack__validate_frontend_routes scope="all"
|
|
73
|
+
-> Store full result as {mcp_results.frontend_routes}
|
|
74
|
+
-> This gives: registry status, API client issues, component registry keys, missing keys, recommendations
|
|
75
|
+
|
|
76
|
+
Step 4c: Call validate_conventions (if available)
|
|
77
|
+
mcp__smartstack__validate_conventions checks=["frontend-routes"]
|
|
78
|
+
-> Store result as {mcp_results.conventions}
|
|
79
|
+
-> This gives: seed data cross-reference, missing PageRegistry entries
|
|
80
|
+
|
|
81
|
+
If MCP is unavailable: record as WARNING and continue without MCP baseline.
|
|
82
|
+
The manual audit in steps 1-2 will still produce a complete report.
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### 5. Show Summary and Proceed
|
|
86
|
+
|
|
87
|
+
Display:
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
Routing Audit Configuration:
|
|
91
|
+
|
|
92
|
+
| Setting | Value |
|
|
93
|
+
|---------|-------|
|
|
94
|
+
| Scope | {scope} |
|
|
95
|
+
| Strict mode | {strict} |
|
|
96
|
+
| Web root | {web_root} |
|
|
97
|
+
| API root | {api_root} |
|
|
98
|
+
| MCP available | {yes/no} |
|
|
99
|
+
|
|
100
|
+
Pre-scan results:
|
|
101
|
+
| Element | File Found |
|
|
102
|
+
|---------|-----------|
|
|
103
|
+
| componentRegistry | {path or MISSING} |
|
|
104
|
+
| ProtectedRoute | {path or MISSING} |
|
|
105
|
+
| DynamicRouter | {path or MISSING} |
|
|
106
|
+
| useRouteConfig | {path or MISSING} |
|
|
107
|
+
| Navigation API | {path or MISSING} |
|
|
108
|
+
|
|
109
|
+
MCP baseline (if available):
|
|
110
|
+
| Check | Result |
|
|
111
|
+
|-------|--------|
|
|
112
|
+
| validate_frontend_routes | {valid: true/false, issues: N} |
|
|
113
|
+
| validate_conventions | {errors: N, warnings: N} |
|
|
114
|
+
|
|
115
|
+
-> Proceeding to inventory...
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## SUCCESS METRICS:
|
|
121
|
+
- Scope and flags correctly parsed
|
|
122
|
+
- All filesystem paths resolved and validated
|
|
123
|
+
- MCP pre-scan executed (or gracefully skipped if unavailable)
|
|
124
|
+
- Pre-scan summary displayed with file existence status
|
|
125
|
+
- Ready for detailed inventory in next step
|
|
126
|
+
|
|
127
|
+
## NEXT STEP:
|
|
128
|
+
After showing initialization summary, proceed directly to `./step-01-inventory.md`
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: step-01-inventory
|
|
3
|
+
description: Locate and inventory all 5 mandatory routing elements in the codebase
|
|
4
|
+
next_step: steps/step-02-conformity.md
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Step 1: Inventory
|
|
8
|
+
|
|
9
|
+
## MANDATORY EXECUTION RULES:
|
|
10
|
+
- Read EVERY file identified — do NOT guess from file names alone
|
|
11
|
+
- Record exact file paths AND line numbers for each finding
|
|
12
|
+
- If an element is ABSENT, search for alternative implementations before declaring missing
|
|
13
|
+
- Use parallel tool calls where possible for speed
|
|
14
|
+
|
|
15
|
+
## YOUR TASK:
|
|
16
|
+
For each of the 5 mandatory elements, locate the implementation, read it, and record key characteristics.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## EXECUTION SEQUENCE:
|
|
21
|
+
|
|
22
|
+
### 1. componentRegistry
|
|
23
|
+
|
|
24
|
+
**Search strategy:**
|
|
25
|
+
1. Glob: `**/componentRegistry*`, `**/pageRegistry*`, `**/PageRegistry*` in {web_root}
|
|
26
|
+
2. If not found: Grep for `React.lazy` or `lazy(` across all `.ts`/`.tsx` files
|
|
27
|
+
3. If not found: Grep for `import.*Page` to find eager imports pattern
|
|
28
|
+
|
|
29
|
+
**Record:**
|
|
30
|
+
- File path and total lines
|
|
31
|
+
- Registration mechanism (PageRegistry.register, object literal, Map, etc.)
|
|
32
|
+
- Import style: lazy (`React.lazy(() => import(...))`) vs eager (`import X from`)
|
|
33
|
+
- Number of registered components
|
|
34
|
+
- Key naming convention (dot-separated, slash-separated, flat)
|
|
35
|
+
- Where it's imported/loaded (main.tsx, App.tsx, etc.)
|
|
36
|
+
|
|
37
|
+
### 2. ProtectedRoute
|
|
38
|
+
|
|
39
|
+
**Search strategy:**
|
|
40
|
+
1. Glob: `**/ProtectedRoute*`, `**/RouteGuard*`, `**/AuthRoute*` in {web_root}
|
|
41
|
+
2. If not found: Grep for `permissions.*check\|requiredPermission\|canAccess` in routing files
|
|
42
|
+
3. If not found: Grep for `Navigate.*login\|redirect.*unauthorized` in route wrappers
|
|
43
|
+
|
|
44
|
+
**Record:**
|
|
45
|
+
- File path and total lines
|
|
46
|
+
- How permissions are received (props, context, hook)
|
|
47
|
+
- Where permission data comes from (API via hook, static constants, hardcoded)
|
|
48
|
+
- What happens on unauthorized (redirect, 403 page, null render)
|
|
49
|
+
- Whether it contains any hardcoded route or permission lists
|
|
50
|
+
|
|
51
|
+
### 3. DynamicRouter
|
|
52
|
+
|
|
53
|
+
**Search strategy:**
|
|
54
|
+
1. Glob: `**/DynamicRouter*`, `**/AppRouter*`, `**/RouterConfig*` in {web_root}
|
|
55
|
+
2. If not found: Grep for `<Route.*path=` to find where routes are defined
|
|
56
|
+
3. Also check: `App.tsx` for inline route definitions
|
|
57
|
+
|
|
58
|
+
**Record:**
|
|
59
|
+
- File path and total lines
|
|
60
|
+
- Route generation method (iterates API data, static JSX, hybrid)
|
|
61
|
+
- How components are resolved (from registry, inline import, direct reference)
|
|
62
|
+
- Whether ProtectedRoute wrapping is applied
|
|
63
|
+
- Handling of nested routes / outlets
|
|
64
|
+
- Loading state handling (Suspense, loader, etc.)
|
|
65
|
+
- Any hardcoded routes within the file (count and list them)
|
|
66
|
+
|
|
67
|
+
### 4. useRouteConfig
|
|
68
|
+
|
|
69
|
+
**Search strategy:**
|
|
70
|
+
1. Glob: `**/useRouteConfig*`, `**/useRoutes*`, `**/useNavigation*` in {web_root}
|
|
71
|
+
2. If not found: Grep for `fetch.*navigation\|fetch.*routes\|fetch.*menu` in hooks
|
|
72
|
+
3. If not found: Grep for `/api/navigation` or `/api/routes` in service files
|
|
73
|
+
|
|
74
|
+
**Record:**
|
|
75
|
+
- File path and total lines
|
|
76
|
+
- API endpoint called
|
|
77
|
+
- Data transformation (flat list, tree, maps)
|
|
78
|
+
- Return shape (routes, permissions, loading, error)
|
|
79
|
+
- Caching strategy (React Query, SWR, useState, context)
|
|
80
|
+
- When it re-fetches (auth change, mount only, interval)
|
|
81
|
+
|
|
82
|
+
### 5. Navigation API
|
|
83
|
+
|
|
84
|
+
**Search strategy (backend):**
|
|
85
|
+
1. Glob: `**/Navigation*Controller*` in {api_root}
|
|
86
|
+
2. Grep for `[HttpGet].*menu\|[HttpGet].*route\|[HttpGet].*navigation` in controllers
|
|
87
|
+
3. Also check: service files with Glob `**/NavigationService*` in {infra_root}
|
|
88
|
+
|
|
89
|
+
**Search strategy (frontend, as consumer):**
|
|
90
|
+
1. Grep for `/api/navigation` or `navigation/menu` in {web_root}/services/
|
|
91
|
+
|
|
92
|
+
**Record:**
|
|
93
|
+
- Controller file path, endpoint path, HTTP method
|
|
94
|
+
- Service file path (business logic)
|
|
95
|
+
- Response DTO structure (what fields are returned)
|
|
96
|
+
- Whether response is filtered by user permissions/JWT
|
|
97
|
+
- Whether ComponentKey is included in response
|
|
98
|
+
- Whether PermissionPath is included in response
|
|
99
|
+
- Feature gating support (RequiredFeature field)
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
### 6. Cross-reference with MCP Results
|
|
104
|
+
|
|
105
|
+
If `{mcp_results}` is available from step-00:
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
For componentRegistry:
|
|
109
|
+
- Compare manual key count with MCP componentRegistry.registeredKeys.length
|
|
110
|
+
- Note any missingKeys reported by MCP
|
|
111
|
+
- Flag if MCP found issues not visible from manual inspection
|
|
112
|
+
|
|
113
|
+
For Navigation API:
|
|
114
|
+
- Compare seed data routes (from MCP validate_conventions) with manual API analysis
|
|
115
|
+
- Note any backend routes with no frontend counterpart
|
|
116
|
+
|
|
117
|
+
For API clients:
|
|
118
|
+
- Use MCP apiClients.issues to enrich anti-pattern detection later (step-02)
|
|
119
|
+
- Record hardcoded paths found by MCP
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### 7. Compile Inventory Table
|
|
123
|
+
|
|
124
|
+
After all 5 elements are investigated, compile:
|
|
125
|
+
|
|
126
|
+
```
|
|
127
|
+
## Element Inventory
|
|
128
|
+
|
|
129
|
+
| # | Element | Status | File | Lines | Key Characteristics |
|
|
130
|
+
|---|---------|--------|------|-------|-------------------|
|
|
131
|
+
| 1 | componentRegistry | FOUND/ABSENT | {path} | {n} | {summary} |
|
|
132
|
+
| 2 | ProtectedRoute | FOUND/ABSENT | {path} | {n} | {summary} |
|
|
133
|
+
| 3 | DynamicRouter | FOUND/ABSENT | {path} | {n} | {summary} |
|
|
134
|
+
| 4 | useRouteConfig | FOUND/ABSENT | {path} | {n} | {summary} |
|
|
135
|
+
| 5 | Navigation API | FOUND/ABSENT | {path} | {n} | {summary} |
|
|
136
|
+
|
|
137
|
+
MCP Cross-reference (if available):
|
|
138
|
+
| MCP Check | Issues Found | Aligned with Manual |
|
|
139
|
+
|-----------|-------------|-------------------|
|
|
140
|
+
| componentRegistry keys | {N missing} | {yes/no + detail} |
|
|
141
|
+
| API client paths | {N hardcoded} | {yes/no + detail} |
|
|
142
|
+
| Seed data sync | {N missing} | {yes/no + detail} |
|
|
143
|
+
|
|
144
|
+
-> Proceeding to conformity analysis...
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## SUCCESS METRICS:
|
|
150
|
+
- All 5 elements searched with at least 2 search strategies each
|
|
151
|
+
- Exact file paths and line numbers recorded
|
|
152
|
+
- Key characteristics noted for each found element
|
|
153
|
+
- ABSENT elements confirmed after exhaustive search
|
|
154
|
+
- Inventory table displayed
|
|
155
|
+
|
|
156
|
+
## NEXT STEP:
|
|
157
|
+
After displaying inventory, proceed directly to `./step-02-conformity.md`
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: step-02-conformity
|
|
3
|
+
description: Evaluate conformity of each element and scan for anti-patterns
|
|
4
|
+
next_step: steps/step-03-report.md
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Step 2: Conformity Analysis
|
|
8
|
+
|
|
9
|
+
## MANDATORY EXECUTION RULES:
|
|
10
|
+
- Load `references/routing-pattern.md` FIRST for the reference pattern
|
|
11
|
+
- Read each element's FULL source code before evaluating
|
|
12
|
+
- NEVER judge developers — analyze code objectively
|
|
13
|
+
- Distinguish errors from conscious architectural choices
|
|
14
|
+
- If a deviation has a valid technical justification, say so explicitly
|
|
15
|
+
- Cross-reference manual findings with MCP results from `{mcp_results}` (step-00)
|
|
16
|
+
|
|
17
|
+
## YOUR TASK:
|
|
18
|
+
For each of the 5 elements found in Step 1, evaluate conformity against the reference pattern. Then scan the entire codebase for anti-patterns.
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## EXECUTION SEQUENCE:
|
|
23
|
+
|
|
24
|
+
### Phase A: Conformity Evaluation (per element)
|
|
25
|
+
|
|
26
|
+
For each of the 5 elements, read the full source file and evaluate:
|
|
27
|
+
|
|
28
|
+
#### Rating Scale:
|
|
29
|
+
| Rating | Symbol | Meaning |
|
|
30
|
+
|--------|--------|---------|
|
|
31
|
+
| Conforme | ✅ | Implementation matches the pattern |
|
|
32
|
+
| Partiellement conforme | ⚠️ | Intent is correct but execution deviates |
|
|
33
|
+
| Non conforme | ❌ | Implementation contradicts the pattern |
|
|
34
|
+
| Absent | 🔴 | Element does not exist |
|
|
35
|
+
|
|
36
|
+
#### For each element, record:
|
|
37
|
+
|
|
38
|
+
**If ✅ Conforme:**
|
|
39
|
+
- Brief confirmation of what makes it compliant
|
|
40
|
+
- Any notable strengths or best practices observed
|
|
41
|
+
|
|
42
|
+
**If ⚠️ Partiellement conforme, ❌ Non conforme, or 🔴 Absent — answer ALL 5 questions:**
|
|
43
|
+
|
|
44
|
+
**a) Qu'est-ce qui a ete fait a la place ?**
|
|
45
|
+
Describe precisely the alternative implementation found in the code.
|
|
46
|
+
Include specific file paths and line numbers.
|
|
47
|
+
|
|
48
|
+
**b) Pourquoi est-ce que ca ne respecte pas le pattern ?**
|
|
49
|
+
Technical explanation of the deviation:
|
|
50
|
+
- Tight coupling (front depends on route structure)
|
|
51
|
+
- Static routes (hardcoded in JSX instead of API-driven)
|
|
52
|
+
- Missing guard (no permission check at route level)
|
|
53
|
+
- Non-lazy imports (eager loading bloats bundle)
|
|
54
|
+
- Incomplete implementation (partial API usage)
|
|
55
|
+
|
|
56
|
+
**c) Pourquoi le developpeur a probablement fait ca ?**
|
|
57
|
+
Formulate a benevolent hypothesis:
|
|
58
|
+
- Pattern unknown at development time?
|
|
59
|
+
- Technical constraint (bundler, framework limitation)?
|
|
60
|
+
- Deliberate MVP simplification?
|
|
61
|
+
- Misunderstanding of front/back responsibility separation?
|
|
62
|
+
- Legacy architecture inheritance?
|
|
63
|
+
- Confusion between static protected routes and dynamic routes?
|
|
64
|
+
- Migration in progress (intentional intermediate state)?
|
|
65
|
+
|
|
66
|
+
**d) Quelle est la consequence concrete de cette deviation ?**
|
|
67
|
+
Concrete impact:
|
|
68
|
+
- DB/front coupling (routes changes require front deploy)
|
|
69
|
+
- Potential security flaw (permission bypass)
|
|
70
|
+
- Rigidity (adding a route requires code change + deploy)
|
|
71
|
+
- Technical debt (maintenance burden)
|
|
72
|
+
- Bundle size impact (non-lazy loading)
|
|
73
|
+
- User experience (flash of wrong page, etc.)
|
|
74
|
+
|
|
75
|
+
**e) Comment migrer vers le pattern cible ?**
|
|
76
|
+
Concrete migration steps considering existing code:
|
|
77
|
+
- DO NOT propose a complete rewrite if a targeted refactor suffices
|
|
78
|
+
- Number the steps in priority order
|
|
79
|
+
- Estimate scope: small (1-2 files), medium (3-5 files), large (6+ files)
|
|
80
|
+
- Note any prerequisites or dependencies between migration steps
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
### Phase B: Anti-Pattern Scan
|
|
85
|
+
|
|
86
|
+
Scan the ENTIRE codebase (not just routing files) for these anti-patterns:
|
|
87
|
+
|
|
88
|
+
#### B1. Hardcoded Routes in JSX
|
|
89
|
+
```
|
|
90
|
+
Grep patterns (in {web_root}):
|
|
91
|
+
- <Route\s+path= (outside DynamicRouter)
|
|
92
|
+
- path:\s*['"/] (in non-config files)
|
|
93
|
+
- navigate\(['"]\/ (hardcoded navigation targets)
|
|
94
|
+
- to=['"]\/ (Link/NavLink with hardcoded paths)
|
|
95
|
+
- href=['"]\/(?!http) (internal links with hardcoded paths)
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
**IMPORTANT**: Exclude legitimate cases:
|
|
99
|
+
- DynamicRouter.tsx itself (it generates routes dynamically)
|
|
100
|
+
- Test files
|
|
101
|
+
- Constants files that define route patterns for DynamicRouter consumption
|
|
102
|
+
- Documentation files
|
|
103
|
+
|
|
104
|
+
#### B2. Hardcoded Permissions in Components
|
|
105
|
+
```
|
|
106
|
+
Grep patterns (in {web_root}):
|
|
107
|
+
- hasPermission\(['"] (string literal permission checks)
|
|
108
|
+
- permission.*=== (direct comparison)
|
|
109
|
+
- role.*===.*['"]admin (role-based instead of permission-based)
|
|
110
|
+
- canAccess\(['"] (string literal access checks)
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
**Distinguish**: Permission checks using API-provided data (OK) vs hardcoded permission strings (anti-pattern).
|
|
114
|
+
|
|
115
|
+
**NOTE**: Components checking `permissionPath` from the menu API or from `useRouteConfig` data are CONFORMING — this is defense in depth, not hardcoding.
|
|
116
|
+
|
|
117
|
+
#### B2bis. MCP-detected Hardcoded Paths (cross-reference)
|
|
118
|
+
```
|
|
119
|
+
If {mcp_results.frontend_routes} is available:
|
|
120
|
+
- Merge MCP apiClients.issues (type: 'invalid-path') with manual B1 findings
|
|
121
|
+
- Add any MCP-detected hardcoded navigate()/Link paths not found by manual grep
|
|
122
|
+
- Deduplicate: same file:line from both sources counts as ONE finding
|
|
123
|
+
- Mark source: [MANUAL], [MCP], or [BOTH] for each finding
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
#### B3. Non-Lazy Imports in Registry
|
|
127
|
+
```
|
|
128
|
+
Grep patterns (in componentRegistry files):
|
|
129
|
+
- ^import .* from (eager imports of page components)
|
|
130
|
+
- require\( (CommonJS require of pages)
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
**Expected pattern**: `lazy(() => import(...))`
|
|
134
|
+
|
|
135
|
+
#### B4. Missing Suspense Boundaries
|
|
136
|
+
```
|
|
137
|
+
Grep patterns (in {web_root}):
|
|
138
|
+
- Check DynamicRouter and App.tsx for <Suspense> wrapping
|
|
139
|
+
- Check if lazy components are rendered without Suspense parent
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
#### B5. Route/Permission Path Misalignment
|
|
143
|
+
```
|
|
144
|
+
Cross-reference:
|
|
145
|
+
- Backend: permission paths in navigation seed data
|
|
146
|
+
- Frontend: permission checks in components
|
|
147
|
+
- Look for mismatches between API-provided paths and frontend expectations
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
#### B6. Duplicate Route Definitions
|
|
151
|
+
```
|
|
152
|
+
Check for routes defined in multiple places:
|
|
153
|
+
- DynamicRouter + another router file
|
|
154
|
+
- Static route config + dynamic route config
|
|
155
|
+
- Multiple files registering the same path
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
### Phase C: Compile Conformity Summary
|
|
161
|
+
|
|
162
|
+
```
|
|
163
|
+
## Conformity Results
|
|
164
|
+
|
|
165
|
+
| # | Element | Rating | Key Finding |
|
|
166
|
+
|---|---------|--------|-------------|
|
|
167
|
+
| 1 | componentRegistry | ✅/⚠️/❌/🔴 | {one-line summary} |
|
|
168
|
+
| 2 | ProtectedRoute | ✅/⚠️/❌/🔴 | {one-line summary} |
|
|
169
|
+
| 3 | DynamicRouter | ✅/⚠️/❌/🔴 | {one-line summary} |
|
|
170
|
+
| 4 | useRouteConfig | ✅/⚠️/❌/🔴 | {one-line summary} |
|
|
171
|
+
| 5 | Navigation API | ✅/⚠️/❌/🔴 | {one-line summary} |
|
|
172
|
+
|
|
173
|
+
## Anti-Patterns Detected: {count}
|
|
174
|
+
|
|
175
|
+
| # | Anti-Pattern | File:Line | Severity | Description |
|
|
176
|
+
|---|-------------|-----------|----------|-------------|
|
|
177
|
+
| 1 | {type} | {file}:{line} | HIGH/MED/LOW | {description} |
|
|
178
|
+
| ... | | | | |
|
|
179
|
+
|
|
180
|
+
-> Proceeding to final report...
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
## SUCCESS METRICS:
|
|
186
|
+
- Each element rated with justification
|
|
187
|
+
- All 5 causal questions answered for every deviation
|
|
188
|
+
- Anti-pattern scan covers entire web_root (not just routing files)
|
|
189
|
+
- False positives excluded (legitimate uses identified)
|
|
190
|
+
- Conformity summary table complete
|
|
191
|
+
|
|
192
|
+
## NEXT STEP:
|
|
193
|
+
After displaying conformity results, proceed directly to `./step-03-report.md`
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: step-03-report
|
|
3
|
+
description: Generate the final structured audit report with migration plan
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Step 3: Final Report
|
|
7
|
+
|
|
8
|
+
## MANDATORY EXECUTION RULES:
|
|
9
|
+
- Use ALL data collected from steps 0-2
|
|
10
|
+
- Follow the EXACT output structure below
|
|
11
|
+
- Prioritize migration steps by impact (critical > important > nice-to-have)
|
|
12
|
+
- Include file:line references for every finding
|
|
13
|
+
- Keep executive summary to 3 lines maximum
|
|
14
|
+
|
|
15
|
+
## YOUR TASK:
|
|
16
|
+
Generate the complete structured audit report.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## OUTPUT STRUCTURE:
|
|
21
|
+
|
|
22
|
+
Generate the following report EXACTLY in this format:
|
|
23
|
+
|
|
24
|
+
```markdown
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
# Audit Dynamic Routing — {project_name}
|
|
28
|
+
|
|
29
|
+
**Date**: {current_date}
|
|
30
|
+
**Branch**: {current_branch}
|
|
31
|
+
**Scope**: {scope}
|
|
32
|
+
**Strict mode**: {strict}
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Resume executif
|
|
37
|
+
|
|
38
|
+
**Score global : {X}/5 elements conformes — Statut : {OK / A corriger / Critique}**
|
|
39
|
+
|
|
40
|
+
{Line 1: Overall architecture state in one sentence}
|
|
41
|
+
{Line 2: Most critical finding or strength}
|
|
42
|
+
{Line 3: Recommended immediate action (if any)}
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## 1. componentRegistry
|
|
47
|
+
**Statut** : {✅ / ⚠️ / ❌ / 🔴}
|
|
48
|
+
**Fichier** : {path:line or ABSENT}
|
|
49
|
+
|
|
50
|
+
{If deviation: full 5-question causal analysis (a through e)}
|
|
51
|
+
{If conforme: brief confirmation with notable strengths}
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## 2. ProtectedRoute
|
|
56
|
+
**Statut** : {✅ / ⚠️ / ❌ / 🔴}
|
|
57
|
+
**Fichier** : {path:line or ABSENT}
|
|
58
|
+
|
|
59
|
+
{If deviation: full 5-question causal analysis}
|
|
60
|
+
{If conforme: brief confirmation}
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## 3. DynamicRouter
|
|
65
|
+
**Statut** : {✅ / ⚠️ / ❌ / 🔴}
|
|
66
|
+
**Fichier** : {path:line or ABSENT}
|
|
67
|
+
|
|
68
|
+
{If deviation: full 5-question causal analysis}
|
|
69
|
+
{If conforme: brief confirmation}
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## 4. useRouteConfig (hook de fetch)
|
|
74
|
+
**Statut** : {✅ / ⚠️ / ❌ / 🔴}
|
|
75
|
+
**Fichier** : {path:line or ABSENT}
|
|
76
|
+
|
|
77
|
+
{If deviation: full 5-question causal analysis}
|
|
78
|
+
{If conforme: brief confirmation}
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## 5. API Navigation
|
|
83
|
+
**Statut** : {✅ / ⚠️ / ❌ / 🔴}
|
|
84
|
+
**Endpoint** : {method path or ABSENT}
|
|
85
|
+
|
|
86
|
+
{If deviation: full 5-question causal analysis}
|
|
87
|
+
{If conforme: brief confirmation}
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Validation MCP (baseline automatique)
|
|
92
|
+
|
|
93
|
+
{If MCP unavailable: "MCP non disponible — audit base sur l'analyse manuelle uniquement."}
|
|
94
|
+
|
|
95
|
+
{If MCP available:}
|
|
96
|
+
|
|
97
|
+
### validate_frontend_routes
|
|
98
|
+
| Metrique | Valeur |
|
|
99
|
+
|----------|--------|
|
|
100
|
+
| Valid | {yes/no} |
|
|
101
|
+
| Registry exists | {yes/no} |
|
|
102
|
+
| Registered keys | {N} |
|
|
103
|
+
| Missing keys | {N} |
|
|
104
|
+
| API client issues | {N} |
|
|
105
|
+
| Recommendations | {list} |
|
|
106
|
+
|
|
107
|
+
### validate_conventions (frontend-routes)
|
|
108
|
+
| Metrique | Valeur |
|
|
109
|
+
|----------|--------|
|
|
110
|
+
| Errors | {N} |
|
|
111
|
+
| Warnings | {N} |
|
|
112
|
+
| Seed data routes checked | {N} |
|
|
113
|
+
|
|
114
|
+
### Divergences MCP vs analyse manuelle
|
|
115
|
+
{List any differences between MCP automated results and manual analysis.
|
|
116
|
+
If both agree, state: "Aucune divergence — MCP et analyse manuelle sont alignes."}
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## Anti-patterns detectes
|
|
121
|
+
|
|
122
|
+
{If none: "Aucun anti-pattern detecte."}
|
|
123
|
+
|
|
124
|
+
{If found, list ALL with file:line references:}
|
|
125
|
+
|
|
126
|
+
| # | Type | Fichier:Ligne | Severite | Description |
|
|
127
|
+
|---|------|--------------|----------|-------------|
|
|
128
|
+
| 1 | {type} | {file}:{line} | {CRITIQUE/IMPORTANT/MINEUR} | {description} |
|
|
129
|
+
|
|
130
|
+
### Detail par anti-pattern
|
|
131
|
+
|
|
132
|
+
#### AP-{n}: {title}
|
|
133
|
+
- **Localisation** : {file}:{line}
|
|
134
|
+
- **Code concerne** :
|
|
135
|
+
```tsx
|
|
136
|
+
{relevant code snippet, max 5 lines}
|
|
137
|
+
```
|
|
138
|
+
- **Probleme** : {why this is an anti-pattern}
|
|
139
|
+
- **Impact** : {concrete consequence}
|
|
140
|
+
- **Correction** : {specific fix}
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## Plan de migration priorise
|
|
145
|
+
|
|
146
|
+
{If no migration needed: "Aucune migration necessaire — l'architecture est conforme au pattern cible."}
|
|
147
|
+
|
|
148
|
+
{If migration needed:}
|
|
149
|
+
|
|
150
|
+
### Critique (bloquer toute PR)
|
|
151
|
+
{numbered list of critical fixes with file references and estimated scope}
|
|
152
|
+
|
|
153
|
+
### Important (a planifier dans le sprint)
|
|
154
|
+
{numbered list of important fixes}
|
|
155
|
+
|
|
156
|
+
### Nice-to-have (backlog)
|
|
157
|
+
{numbered list of improvements}
|
|
158
|
+
|
|
159
|
+
### Ordre de migration recommande
|
|
160
|
+
{If multiple fixes, specify dependency order:}
|
|
161
|
+
1. {First fix — prerequisite for others}
|
|
162
|
+
2. {Second fix — depends on #1}
|
|
163
|
+
3. ...
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## Metriques
|
|
168
|
+
|
|
169
|
+
| Metrique | Valeur |
|
|
170
|
+
|----------|--------|
|
|
171
|
+
| Elements conformes | {X}/5 |
|
|
172
|
+
| Elements partiellement conformes | {Y}/5 |
|
|
173
|
+
| Elements non conformes | {Z}/5 |
|
|
174
|
+
| Elements absents | {W}/5 |
|
|
175
|
+
| Anti-patterns detectes | {count} |
|
|
176
|
+
| Anti-patterns critiques | {count} |
|
|
177
|
+
| Fichiers a modifier | {count} |
|
|
178
|
+
| Estimation effort migration | {Faible/Moyen/Eleve} |
|
|
179
|
+
| MCP baseline disponible | {Oui/Non} |
|
|
180
|
+
| Divergences MCP vs manuel | {count} |
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
## REPORT QUALITY RULES:
|
|
188
|
+
|
|
189
|
+
1. **Every finding has evidence** — file:line or code snippet
|
|
190
|
+
2. **No vague statements** — "some routes are hardcoded" -> "3 routes hardcoded in TicketListView.tsx:42, UserPage.tsx:18, AdminDashboard.tsx:7"
|
|
191
|
+
3. **Migration steps are actionable** — not "refactor the routing" but "Move Route definition from App.tsx:34-56 to DynamicRouter, add componentKey 'admin.dashboard' to PageRegistry"
|
|
192
|
+
4. **Distinguish SmartStack-specific patterns** — Some deviations from the generic pattern may be correct for SmartStack SDK architecture. Flag these as "SmartStack-specific: conforming to SDK pattern" rather than as deviations
|
|
193
|
+
5. **Be honest about ambiguity** — If you cannot determine whether a deviation is intentional, say "Intention ambigue" and present both interpretations
|
|
194
|
+
|
|
195
|
+
## SUCCESS METRICS:
|
|
196
|
+
- Report follows exact structure above
|
|
197
|
+
- All sections populated with data from steps 0-2
|
|
198
|
+
- Executive summary is exactly 3 lines
|
|
199
|
+
- Migration plan is prioritized and actionable
|
|
200
|
+
- Metrics table is complete and accurate
|
|
201
|
+
- Every finding has a file:line reference
|