@atlashub/smartstack-cli 4.76.0 → 4.80.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/package.json +1 -1
  2. package/templates/project/claude-md/root.CLAUDE.md.template +1 -1
  3. package/templates/skills/ai-prompt/SKILL.md +64 -0
  4. package/templates/skills/ai-prompt/references/ai-agent-modes.md +89 -0
  5. package/templates/skills/ai-prompt/references/eval-framework.md +129 -0
  6. package/templates/skills/apex/references/checks/frontend-checks.sh +97 -11
  7. package/templates/skills/apex/references/checks/seed-checks.sh +34 -0
  8. package/templates/skills/apex/references/core-seed-data.md +7 -4
  9. package/templates/skills/apex/references/domain-events-pattern.md +45 -0
  10. package/templates/skills/apex/references/entity-hooks-pattern.md +68 -0
  11. package/templates/skills/apex/references/licensing-enforcement.md +52 -0
  12. package/templates/skills/apex/references/smartstack-api.md +112 -1
  13. package/templates/skills/apex-verify/steps/step-01-nav-audit.md +4 -0
  14. package/templates/skills/application/references/contexts-cheatsheet.md +86 -0
  15. package/templates/skills/application/references/extensions-system.md +158 -0
  16. package/templates/skills/application/references/frontend-route-naming.md +7 -5
  17. package/templates/skills/application/references/frontend-verification.md +7 -5
  18. package/templates/skills/application/references/provider-template.md +4 -2
  19. package/templates/skills/application/references/smartstack-provider.md +118 -0
  20. package/templates/skills/application/references/themes-db-driven.md +484 -0
  21. package/templates/skills/application/templates-seed.md +4 -2
  22. package/templates/skills/audit-route/references/routing-pattern.md +3 -1
  23. package/templates/skills/business-analyse/react/components.md +30 -28
  24. package/templates/skills/business-analyse/templates-react.md +15 -15
  25. package/templates/skills/cli-app-sync/SKILL.md +105 -4
  26. package/templates/skills/cli-app-sync/references/comparison-map.md +13 -0
  27. package/templates/skills/cli-app-sync/references/diff-entities.md +162 -0
  28. package/templates/skills/documentation/templates.md +16 -16
  29. package/templates/skills/migrate/SKILL.md +312 -0
  30. package/templates/skills/migrate/references/v3.34-to-v3.46.md +289 -0
  31. package/templates/skills/smoke-generation/SKILL.md +313 -0
  32. package/templates/skills/ui-components/SKILL.md +10 -0
  33. package/templates/skills/ui-components/references/component-catalog.md +82 -0
  34. package/templates/skills/workflow/SKILL.md +70 -1
@@ -0,0 +1,312 @@
1
+ ---
2
+ name: migrate
3
+ description: Migrate an existing SmartStack client project from one platform version to another (currently v3.34 → v3.46). Detects the current version, applies declarative rules (renames, signature updates, layout consolidation, theme tokens), then runs validation checks. Designed for clients on older CLI versions who want to upgrade without redoing /apex from scratch.
4
+ argument-hint: "[--from=<version>] [--to=<version>] [--scope=backend|frontend|all] [--dry-run] [--apply]"
5
+ model: sonnet
6
+ allowed-tools: Read, Grep, Glob, Bash, Edit, Write
7
+ ---
8
+
9
+ ## Current state (auto-injected)
10
+
11
+ - Project root: !`pwd 2>/dev/null`
12
+ - Detected SmartStack package version: !`grep -oP '"@atlashub/smartstack":\s*"\K[^"]+' web/smartstack-web/package.json 2>/dev/null || cat src/SmartStack.Api/*.csproj 2>/dev/null | grep -oP 'SmartStack[A-Za-z.]*"\s*Version="\K[^"]+' | head -1 || echo "unknown"`
13
+ - Detected legacy patterns: !`grep -rl "ApplicationZone\|<\(AdminLayout\|BusinessLayout\|UserLayout\)" src/ web/ 2>/dev/null | head -5 || echo "none"`
14
+ - Last migration run: !`cat .claude/cache/migrate.json 2>/dev/null | head -3 || echo "no previous run"`
15
+
16
+ <objective>
17
+ Patch an existing client project (one already generated by an older CLI version) so that it conforms to the latest SmartStack platform version. Current rule set covers `v3.34 → v3.46` (the breaking changes shipped in iteration 1 of the v3.46 alignment work : `ApplicationZone` removal, layout consolidation 7→4, NavigationApplication.Create signature change, Tailwind tokenization).
18
+
19
+ This skill exists because :
20
+ - A client app generated on CLI v3.34 has `Zone = ApplicationZone.Business` hardcoded everywhere — **cannot compile** against v3.46 NuGet packages.
21
+ - Re-running `/apex` from scratch would lose the client's business logic.
22
+ - Manually patching is error-prone (40+ files to touch on a real project).
23
+
24
+ The rules are **declarative** (in `references/v3.34-to-v3.46.md`), so adding a new migration target later is just a new reference doc + a register entry.
25
+ </objective>
26
+
27
+ <quick_start>
28
+ ```bash
29
+ /migrate # Detect version + dry-run report
30
+ /migrate --from=3.34 --to=3.46 # Explicit version pair
31
+ /migrate --dry-run # Print proposed changes without writing
32
+ /migrate --apply # Apply all rules (asks confirmation per category)
33
+ /migrate --scope=frontend --apply # Only frontend rules
34
+ /migrate --scope=backend --apply # Only backend rules
35
+ ```
36
+ </quick_start>
37
+
38
+ <subcommands>
39
+
40
+ | Command | Effect |
41
+ |---|---|
42
+ | `/migrate` (no args) | Auto-detect from→to, run dry-run, print report |
43
+ | `/migrate --from=X --to=Y` | Force version pair (for testing) |
44
+ | `/migrate --dry-run` | Default — report only, no file edits |
45
+ | `/migrate --apply` | Apply rules. Asks confirmation per category (backend / frontend / seed / config) |
46
+ | `/migrate --scope=<s>` | Restrict to one layer |
47
+ | `/migrate --rules` | List all available migration paths and their rule files |
48
+
49
+ </subcommands>
50
+
51
+ <workflow>
52
+
53
+ ## Step 0 — Detect from-version (if not provided)
54
+
55
+ ```bash
56
+ # Look at @atlashub/smartstack version
57
+ PKG_VER=$(grep -oP '"@atlashub/smartstack":\s*"\K[^"]+' web/smartstack-web/package.json 2>/dev/null | sed 's/[\^~]//g' | cut -d. -f1-2)
58
+
59
+ # Look at SmartStack NuGet versions
60
+ NUGET_VER=$(grep -hPoR 'PackageReference\s+Include="SmartStack[^"]*"\s+Version="\K[^"]+' src/ 2>/dev/null | sort -u | head -1 | cut -d. -f1-2)
61
+
62
+ # Look at legacy patterns to confirm
63
+ HAS_ZONE=$(grep -rl "ApplicationZone\." src/ 2>/dev/null | wc -l)
64
+ HAS_LEGACY_LAYOUT=$(grep -rlE "<(AdminLayout|BusinessLayout|UserLayout|HRLayout|SalesLayout)\b" web/ src/ 2>/dev/null | wc -l)
65
+
66
+ # Decide source version
67
+ if [ "$HAS_ZONE" -gt 0 ] || [ "$HAS_LEGACY_LAYOUT" -gt 0 ]; then
68
+ FROM_VERSION="3.34" # Pre-v3.46 platform
69
+ else
70
+ FROM_VERSION="${PKG_VER:-unknown}"
71
+ fi
72
+ ```
73
+
74
+ ## Step 1 — Pick the rule file
75
+
76
+ Map `(from, to)` to a rule file under `references/` :
77
+
78
+ | from → to | Rule file |
79
+ |---|---|
80
+ | `3.34 → 3.46` | [references/v3.34-to-v3.46.md](references/v3.34-to-v3.46.md) |
81
+ | (future) `3.46 → 3.47` | references/v3.46-to-v3.47.md |
82
+ | any unsupported pair | abort with explicit error + suggested manual path |
83
+
84
+ Load the rule file and parse the rule list (each rule has `id`, `category`, `description`, `detect_pattern`, `replace_pattern`, `glob`, `severity`, `requires_confirmation`).
85
+
86
+ ## Step 2 — Detect applicable rules (dry-run)
87
+
88
+ For each rule in the file :
89
+
90
+ 1. Run the `detect_pattern` (grep) over `glob` paths to find candidate files
91
+ 2. Compute the matched count
92
+ 3. If 0 matches : skip (already migrated)
93
+ 4. If ≥ 1 match : add to "applicable rules" list
94
+
95
+ Build the dry-run report :
96
+
97
+ ```
98
+ ================================================================================
99
+ MIGRATION DRY-RUN — {from} → {to}
100
+ ================================================================================
101
+ Project root: {pwd}
102
+ Source version detected: {FROM_VERSION} (via {package.json | NuGet | legacy patterns})
103
+ Rule file: references/v{from}-to-v{to}.md ({total_rules} rules)
104
+
105
+ [BACKEND] ({applicable_be_count} of {total_be_count} rules applicable)
106
+
107
+ R-BE-001 ApplicationZone enum removal
108
+ severity: BLOCKING files: 6
109
+ sample: src/SmartStack.Infrastructure/Persistence/Seeding/Data/NavigationApplicationSeedData.cs:23
110
+ Zone = ApplicationZone.Business
111
+
112
+ R-BE-002 NavigationApplication.Create signature
113
+ severity: BLOCKING files: 2
114
+ sample: src/SmartStack.Infrastructure/.../SeedDataProvider.cs:46
115
+ NavigationApplication.Create(ApplicationZone.Business, code, label, ...)
116
+
117
+ R-BE-003 AddDbContext alias rename (if applicable)
118
+ severity: WARNING files: 0 (no occurrence — skipped)
119
+
120
+ [FRONTEND] ({applicable_fe_count} of {total_fe_count} rules applicable)
121
+
122
+ R-FE-001 Legacy domain-specific layouts (AdminLayout, BusinessLayout, UserLayout, …)
123
+ severity: BLOCKING files: 4
124
+ sample: web/smartstack-web/src/App.tsx:127
125
+ <Route path="/sales" element={<SalesLayout />}>
126
+
127
+ R-FE-002 Hardcoded Tailwind colors → CSS vars
128
+ severity: WARNING files: 12
129
+
130
+ R-FE-003 mergeRoutes() → PageRegistry.register()
131
+ severity: BLOCKING files: 1
132
+
133
+ [SEED] ({applicable_seed_count} of {total_seed_count} rules applicable)
134
+
135
+
136
+ [CONFIG] ({applicable_cfg_count} of {total_cfg_count} rules applicable)
137
+
138
+
139
+ --------------------------------------------------------------------------------
140
+ SUMMARY : {total_applicable} rules applicable across {total_files} files
141
+ {blocking} BLOCKING — must be fixed before the project compiles against v{to}
142
+ {warning} WARNING — should be fixed soon
143
+ ================================================================================
144
+ ```
145
+
146
+ If `--dry-run` (default) → stop here, exit 0.
147
+
148
+ ## Step 3 — Apply mode (`--apply`)
149
+
150
+ Group applicable rules by **category** (BACKEND / FRONTEND / SEED / CONFIG). For each category :
151
+
152
+ ```yaml
153
+ AskUserQuestion:
154
+ header: "Apply BACKEND rules?"
155
+ question: "{N} BACKEND rules will modify {M} files (e.g. R-BE-001, R-BE-002). Apply?"
156
+ options:
157
+ - label: "Yes, apply all BACKEND rules"
158
+ description: "Run all BLOCKING + WARNING rules in this category"
159
+ - label: "Yes, BLOCKING only"
160
+ description: "Apply only BLOCKING (safer for review)"
161
+ - label: "Skip this category"
162
+ description: "Don't touch BACKEND files"
163
+ - label: "Review one by one"
164
+ description: "Confirm before each rule"
165
+ ```
166
+
167
+ For each rule the user accepts :
168
+ 1. Read each candidate file
169
+ 2. Apply the `replace_pattern` (often a regex substitution, sometimes a whole-block rewrite — see rule definition)
170
+ 3. Save the file
171
+ 4. Track the change in a per-rule changelog
172
+
173
+ After every rule in the batch is applied, build the post-apply report and run **post-validation** (Step 4).
174
+
175
+ ## Step 4 — Post-validation
176
+
177
+ ```bash
178
+ # Backend compilation (smoke test)
179
+ if [ "$SCOPE" != "frontend" ]; then
180
+ cd src/SmartStack.Api 2>/dev/null && dotnet build --nologo 2>&1 | tail -20 | tee /tmp/migrate-build-be.log
181
+ fi
182
+
183
+ # Frontend compilation
184
+ if [ "$SCOPE" != "backend" ]; then
185
+ cd web/smartstack-web 2>/dev/null && npx tsc -b --noEmit 2>&1 | tail -20 | tee /tmp/migrate-build-fe.log
186
+ fi
187
+
188
+ # Run apex post-checks if available
189
+ if [ -f templates/skills/apex/references/checks/seed-checks.sh ]; then
190
+ bash templates/skills/apex/references/checks/seed-checks.sh 2>&1 | tail -30
191
+ fi
192
+ ```
193
+
194
+ Print the validation report. If errors remain : explicit list of "manual fixes still needed" + suggested next action (`/debug` skill).
195
+
196
+ ## Step 5 — Cache and summary
197
+
198
+ ```bash
199
+ mkdir -p .claude/cache
200
+ cat > .claude/cache/migrate.json << EOF
201
+ {
202
+ "lastRun": "$(date -Iseconds)",
203
+ "from": "{from}",
204
+ "to": "{to}",
205
+ "scope": "{scope}",
206
+ "rulesApplied": {N},
207
+ "filesChanged": {M},
208
+ "buildPassed": {true|false},
209
+ "remainingIssues": {K}
210
+ }
211
+ EOF
212
+ ```
213
+
214
+ Print a final summary :
215
+
216
+ ```
217
+ ================================================================================
218
+ MIGRATION COMPLETE — {from} → {to}
219
+ ================================================================================
220
+ Rules applied : {N} ({blocking} BLOCKING, {warning} WARNING)
221
+ Files changed : {M}
222
+ Build status : {OK | FAILED}
223
+ Manual fixes : {K} remaining (see /tmp/migrate-build-*.log)
224
+
225
+ Next steps :
226
+ 1. Review changes: git diff
227
+ 2. Run tests: dotnet test + npm test
228
+ 3. Commit migration: /gitflow commit
229
+ 4. If issues remain: /debug
230
+ ================================================================================
231
+ ```
232
+
233
+ ## Step 6 — Exit code
234
+
235
+ - 0 if all rules applied and build passes
236
+ - 1 if any rule failed to apply (likely needs manual intervention)
237
+ - 2 if build doesn't pass after migration
238
+
239
+ </workflow>
240
+
241
+ <safety>
242
+
243
+ - **Always run dry-run first** : the default mode. Forces the user to see the diff before any file is touched.
244
+ - **Per-category confirmation** in `--apply` mode. No "yes to all" shortcut.
245
+ - **Backup is the user's responsibility** — recommend `git stash` or `git commit` before running `--apply`. The skill will print this as a banner.
246
+ - **Some rules cannot be safely automated** : signature changes that depend on context. Those rules have `requires_confirmation: true` in the rule file, and the skill walks through them one by one.
247
+ - **Never modify files outside the project root** (cwd). Defensive `pwd`-based path resolution.
248
+
249
+ </safety>
250
+
251
+ <rule_file_format>
252
+
253
+ Each `references/v{from}-to-v{to}.md` file contains a YAML-fenced rule list :
254
+
255
+ ````markdown
256
+ # Migration rules: v{from} → v{to}
257
+
258
+ ```yaml
259
+ rules:
260
+ - id: R-BE-001
261
+ category: backend
262
+ description: ApplicationZone enum removed in v3.46
263
+ detect_pattern: "ApplicationZone\\.\\w+"
264
+ replace_pattern: |
265
+ # Custom multi-line replacement (see "implementations" below)
266
+ glob: "src/**/Seeding/Data/**/*.cs"
267
+ severity: BLOCKING
268
+ requires_confirmation: false
269
+ references:
270
+ - templates/skills/apex/references/core-seed-data.md
271
+ - templates/skills/application/references/provider-template.md
272
+
273
+ - id: R-BE-002
274
+ category: backend
275
+
276
+ ```
277
+
278
+ ## Implementations
279
+
280
+ Some rules are too complex for a single regex. The "implementation" section
281
+ provides a step-by-step Bash/sed/Edit recipe per rule.
282
+
283
+ ### R-BE-001 — ApplicationZone removal
284
+
285
+ For each file matching the glob :
286
+ 1. Remove the line `Zone = ApplicationZone.Business,`
287
+ 2. Insert two lines : `IsPersonal = false,` and `IsOpen = false,`
288
+ 3. … (full recipe)
289
+ ````
290
+
291
+ The skill parses the YAML block, then for each rule with `requires_confirmation: true` it falls back to the implementation recipe (read + execute step by step).
292
+
293
+ </rule_file_format>
294
+
295
+ <known_limitations>
296
+
297
+ - **Single migration path supported today** : `v3.34 → v3.46`. Adding `v3.46 → v3.47` is a new rule file, not a code change.
298
+ - **No multi-hop chaining yet** : if a project is on `v3.20`, you can't go straight to `v3.46`. Manual intervention required.
299
+ - **Doesn't migrate database schema** — rules are code-only. Schema migration is `/efcore migration` territory.
300
+ - **Heuristic version detection** : if `package.json` lacks `@atlashub/smartstack`, the skill falls back to grepping legacy patterns. Always confirm the detected version before `--apply`.
301
+
302
+ </known_limitations>
303
+
304
+ <success_criteria>
305
+ - Detects current SmartStack version from project artifacts
306
+ - Picks the correct rule file based on (from, to)
307
+ - Dry-run report lists every applicable rule with file/line evidence
308
+ - Apply mode confirms per category before touching files
309
+ - Post-validation runs `dotnet build` and `tsc --noEmit` to catch new compile errors
310
+ - Cache record allows subsequent `/migrate` runs to skip already-applied rules
311
+ - Exit code reflects success/failure for CI scripting
312
+ </success_criteria>
@@ -0,0 +1,289 @@
1
+ # Migration rules: v3.34 → v3.46
2
+
3
+ > Used by `/migrate --from=3.34 --to=3.46`.
4
+ > Covers the breaking changes shipped during the v3.46 alignment work
5
+ > (ApplicationZone removal, layout consolidation, NavigationApplication.Create
6
+ > signature change, Tailwind tokenisation, mergeRoutes deprecation, AI patterns).
7
+
8
+ ## Rule list (machine-readable)
9
+
10
+ ```yaml
11
+ rules:
12
+ # ──────────────────────────────────────────────────────────────────
13
+ # BACKEND — Domain / Seed / API
14
+ # ──────────────────────────────────────────────────────────────────
15
+
16
+ - id: R-BE-001
17
+ category: backend
18
+ description: "ApplicationZone enum and Zone column removed (replaced by IsPersonal + IsOpen flags on NavigationApplication)."
19
+ detect_pattern: 'ApplicationZone\.\w+|Zone\s*=\s*ApplicationZone\.\w+|public\s+ApplicationZone\s+Zone'
20
+ glob: "src/**/*.cs"
21
+ severity: BLOCKING
22
+ requires_confirmation: false
23
+ references:
24
+ - templates/skills/apex/references/core-seed-data.md
25
+ - templates/skills/application/references/provider-template.md
26
+ - templates/skills/apex/references/checks/seed-checks.sh # check C66 enforces this
27
+
28
+ - id: R-BE-002
29
+ category: backend
30
+ description: "NavigationApplication.Create() signature lost the first 'zone' parameter; gained isOpen + isPersonal at the end (both default false)."
31
+ detect_pattern: 'NavigationApplication\.Create\(\s*ApplicationZone\.\w+'
32
+ glob: "src/**/*.cs"
33
+ severity: BLOCKING
34
+ requires_confirmation: true # contextual — review each call site
35
+ references:
36
+ - D:/01 - projets/SmartStack.app/features/IA-Workflow/src/SmartStack.Domain/Navigation/NavigationApplication.cs
37
+
38
+ - id: R-BE-003
39
+ category: backend
40
+ description: "ApplicationMenuDto.Zone (string) field removed; consume IsPersonal + IsOpen instead."
41
+ detect_pattern: '\.Zone\b|"Zone"'
42
+ glob: "src/SmartStack.Application/Navigation/**/*.cs"
43
+ severity: BLOCKING
44
+ requires_confirmation: true
45
+
46
+ - id: R-BE-004
47
+ category: backend
48
+ description: "Migration to drop the 'Zone' column and add IsPersonal/IsOpen columns. Generate via dotnet ef if missing."
49
+ detect_pattern: 'Zone'
50
+ glob: "src/SmartStack.Infrastructure/Persistence/Migrations/*.cs"
51
+ severity: WARNING
52
+ requires_confirmation: true
53
+ note: "If the project's last migration is older than core_v3.46.0, prompt user to run /efcore:migration RemoveApplicationZone."
54
+
55
+ - id: R-BE-005
56
+ category: backend
57
+ description: "Domain Hooks moved to SmartStack.Application.Common.Interfaces.Hooks namespace (previously: scattered)."
58
+ detect_pattern: 'SmartStack\.(?:Domain|Application)\.(?!Common\.Interfaces\.Hooks)\w+\.(?:IBeforeCreate|IAfterCreate|IBeforeUpdate|IAfterUpdate|IBeforeDelete|IAfterDelete)'
59
+ glob: "src/**/*.cs"
60
+ severity: WARNING
61
+ requires_confirmation: false
62
+ references:
63
+ - templates/skills/apex/references/smartstack-api.md # Entity Lifecycle Hooks section
64
+
65
+ - id: R-BE-006
66
+ category: backend
67
+ description: "BaseEntity gained an ExtensionData (string JSON) property + 7 typed methods. EF configuration must include builder.Property(x => x.ExtensionData).HasColumnType(\"nvarchar(max)\").HasDefaultValue(\"{}\")."
68
+ detect_pattern: 'class\s+\w+Configuration\s*:\s*IEntityTypeConfiguration<\w+>'
69
+ glob: "src/SmartStack.Infrastructure/Persistence/Configurations/**/*.cs"
70
+ severity: WARNING
71
+ requires_confirmation: true
72
+ note: "Inspect each EF config file; only add the ExtensionData mapping where the entity inherits BaseEntity AND the table is meant to store extension data."
73
+
74
+ # ──────────────────────────────────────────────────────────────────
75
+ # FRONTEND — Layouts / Routing / Theme
76
+ # ──────────────────────────────────────────────────────────────────
77
+
78
+ - id: R-FE-001
79
+ category: frontend
80
+ description: "Legacy domain-specific layouts (AdminLayout / BusinessLayout / UserLayout / HRLayout / SalesLayout) consolidated into AppLayout (sole authenticated shell)."
81
+ detect_pattern: '<\s*(AdminLayout|BusinessLayout|UserLayout|HRLayout|SalesLayout)\b|from\s+["\x27][^"\x27]*\/(AdminLayout|BusinessLayout|UserLayout|HRLayout|SalesLayout)["\x27]'
82
+ glob: "web/**/*.tsx"
83
+ severity: BLOCKING
84
+ requires_confirmation: false
85
+ references:
86
+ - templates/skills/application/references/frontend-route-naming.md
87
+ - templates/skills/apex/references/checks/seed-checks.sh # check C67
88
+
89
+ - id: R-FE-002
90
+ category: frontend
91
+ description: "Hardcoded Tailwind colors must be replaced by CSS variables. Mapping table in themes-db-driven.md (24 rows: bg-blue-* → var(--info-bg), text-gray-900 → var(--text-primary), etc.)."
92
+ detect_pattern: '(bg|text|border)-(?!\[)(red|blue|green|gray|amber|yellow|orange|purple|indigo|violet|cyan|pink|emerald|rose|sky|teal|lime|fuchsia|stone|slate|zinc|neutral)-\d'
93
+ glob: "web/**/*.tsx"
94
+ severity: WARNING # was BLOCKING in iteration 2 — but for a migration we relax to WARNING and let the user batch-fix
95
+ requires_confirmation: true
96
+ references:
97
+ - templates/skills/application/references/themes-db-driven.md # Section 5: Migration map
98
+ - templates/skills/apex/references/checks/frontend-checks.sh # check C9
99
+
100
+ - id: R-FE-003
101
+ category: frontend
102
+ description: "Tailwind dark: prefix removed. SmartStack toggles a .dark class on root; CSS vars adapt automatically."
103
+ detect_pattern: '\bdark:(bg|text|border)-'
104
+ glob: "web/**/*.tsx"
105
+ severity: WARNING
106
+ requires_confirmation: false
107
+
108
+ - id: R-FE-004
109
+ category: frontend
110
+ description: "mergeRoutes() and getStaticAppRoutes() removed in v3.7+. Pages must register via PageRegistry.register() in componentRegistry.generated.ts."
111
+ detect_pattern: 'mergeRoutes\s*\(|getStaticAppRoutes\s*\('
112
+ glob: "web/**/*.{ts,tsx}"
113
+ severity: BLOCKING
114
+ requires_confirmation: true
115
+ references:
116
+ - templates/skills/audit-route/references/routing-pattern.md
117
+ - templates/skills/application/references/smartstack-provider.md
118
+
119
+ - id: R-FE-005
120
+ category: frontend
121
+ description: "RouteGuard.tsx replaced by ProtectedRoute.tsx (API-driven permissions)."
122
+ detect_pattern: 'RouteGuard|from\s+["\x27][^"\x27]*\/RouteGuard["\x27]'
123
+ glob: "web/**/*.{ts,tsx}"
124
+ severity: BLOCKING
125
+ requires_confirmation: false
126
+
127
+ - id: R-FE-006
128
+ category: frontend
129
+ description: "useParams must use generic { id: string } (not custom names like { ticketId, userId }). Custom names go in the destructuration."
130
+ detect_pattern: 'useParams<\{\s*(?!id\s*:)\w+Id\s*:'
131
+ glob: "web/**/*.tsx"
132
+ severity: WARNING
133
+ requires_confirmation: true
134
+ note: "Refactor: const { id: ticketId } = useParams<{ id: string }>(). Param URL must be 'id' for DynamicRouter."
135
+
136
+ - id: R-FE-007
137
+ category: frontend
138
+ description: "Client App.tsx must wrap with <SmartStackProvider config={...}> (replaces ad-hoc provider stacks)."
139
+ detect_pattern: 'AuthProvider|TenantProvider|ThemeProvider' # if present in App.tsx without SmartStackProvider above
140
+ glob: "web/**/{App,main}.tsx"
141
+ severity: WARNING
142
+ requires_confirmation: true
143
+ references:
144
+ - templates/skills/application/references/smartstack-provider.md
145
+
146
+ # ──────────────────────────────────────────────────────────────────
147
+ # SEED — Navigation & Roles
148
+ # ──────────────────────────────────────────────────────────────────
149
+
150
+ - id: R-SEED-001
151
+ category: seed
152
+ description: "NavigationApplicationSeedEntry must include IsPersonal + IsOpen (both bool, default false). Replaces the Zone field."
153
+ detect_pattern: 'NavigationApplicationSeedEntry'
154
+ glob: "src/**/*NavigationApplicationSeedData.cs"
155
+ severity: BLOCKING
156
+ requires_confirmation: false
157
+
158
+ - id: R-SEED-002
159
+ category: seed
160
+ description: "MySpace and Personal-scope apps should set IsPersonal = true."
161
+ detect_pattern: 'NavigationApplicationSeedEntry'
162
+ glob: "src/**/*MySpace*SeedData.cs"
163
+ severity: WARNING
164
+ requires_confirmation: true
165
+ note: "Manual judgement: only set IsPersonal=true on apps that genuinely belong to user space."
166
+
167
+ # ──────────────────────────────────────────────────────────────────
168
+ # CONFIG — appsettings / package.json
169
+ # ──────────────────────────────────────────────────────────────────
170
+
171
+ - id: R-CFG-001
172
+ category: config
173
+ description: "@atlashub/smartstack peer must be at least 3.46.0."
174
+ detect_pattern: '"@atlashub/smartstack":\s*"\^?[0-2]\.|^"@atlashub/smartstack":\s*"\^?3\.[0-3][0-9]\.|^"@atlashub/smartstack":\s*"\^?3\.4[0-5]\.'
175
+ glob: "web/smartstack-web/package.json"
176
+ severity: BLOCKING
177
+ requires_confirmation: false
178
+ note: "Bump @atlashub/smartstack to ^3.46.0 (or latest)."
179
+
180
+ - id: R-CFG-002
181
+ category: config
182
+ description: "Tailwind v4 + @tailwindcss/vite required. Old @tailwindcss/postcss configuration deprecated."
183
+ detect_pattern: '"@tailwindcss/postcss"'
184
+ glob: "web/smartstack-web/package.json"
185
+ severity: WARNING
186
+ requires_confirmation: false
187
+ note: "Install @tailwindcss/vite, remove @tailwindcss/postcss, update vite.config.ts plugins list."
188
+
189
+ - id: R-CFG-003
190
+ category: config
191
+ description: "appsettings.json should include the new sections : SlaMonitoring, SolutionAutoClose, AutoAssignment, WorkflowExecution (added in v3.45/v3.46)."
192
+ detect_pattern: '^\s*"(?:Logging|Email)\s*"'
193
+ glob: "src/SmartStack.Api/appsettings.json"
194
+ severity: WARNING
195
+ requires_confirmation: true
196
+ note: "Compare against templates/project/appsettings.json.template ; add missing sections (defaults are safe)."
197
+ ```
198
+
199
+ ## Implementation recipes
200
+
201
+ The rules above are declarative ; some need a step-by-step recipe when a single regex isn't enough. The skill's `--apply` mode falls back to these recipes for any rule with `requires_confirmation: true`.
202
+
203
+ ### R-BE-001 — `ApplicationZone` removal
204
+
205
+ For each file matched :
206
+
207
+ 1. Remove every line that matches `^\s*Zone\s*=\s*ApplicationZone\.\w+,?\s*$`
208
+ 2. After the line `Id = ApplicationId,` (or the first property of the SeedEntry), insert :
209
+ ```
210
+ IsPersonal = false,
211
+ IsOpen = false,
212
+ ```
213
+ 3. Replace `public ApplicationZone Zone { get; init; }` (DTO) by :
214
+ ```csharp
215
+ public bool IsPersonal { get; init; }
216
+ public bool IsOpen { get; init; }
217
+ ```
218
+ 4. Remove `using` directives for `SmartStack.Domain.Navigation` if `ApplicationZone` was the only reason they were imported.
219
+
220
+ ### R-BE-002 — `NavigationApplication.Create()` signature
221
+
222
+ For each call site :
223
+
224
+ - Old signature : `NavigationApplication.Create(ApplicationZone.X, code, label, description, icon, iconType, route, displayOrder)`
225
+ - New signature : `NavigationApplication.Create(code, label, description, icon, iconType, route, displayOrder, isOpen: bool, isPersonal: bool)`
226
+
227
+ **Recipe** :
228
+ 1. Remove the first argument (`ApplicationZone.X`).
229
+ 2. Append two named arguments at the end : `isOpen: false, isPersonal: false` (or `true` based on context — see R-SEED-002).
230
+ 3. **Manual review** : if the original call passed `Personal` zone, propose `isPersonal: true`. If `Admin` zone (system app), propose `isOpen: true`.
231
+
232
+ ### R-FE-001 — Layout consolidation
233
+
234
+ For each `.tsx` file containing `<AdminLayout>`, `<BusinessLayout>`, `<UserLayout>`, `<HRLayout>`, or `<SalesLayout>` :
235
+
236
+ 1. Replace the JSX tag (open + close) by `<AppLayout>` / `</AppLayout>`.
237
+ 2. Update the import : `import { AppLayout } from '@/layouts/AppLayout'`.
238
+ 3. Remove the old import line.
239
+
240
+ If the file was `src/layouts/AdminLayout.tsx` (or similar), DELETE the file — it no longer has a purpose.
241
+
242
+ ### R-FE-002 — Tailwind tokenisation
243
+
244
+ This rule is **bulk** but **noisy**. Apply only if the user accepts (default WARNING in migration ; was BLOCKING in iteration 2).
245
+
246
+ Use the migration map in `templates/skills/application/references/themes-db-driven.md` Section 5. For each `(bg|text|border)-{color}-{shade}` occurrence, propose the canonical CSS-var replacement based on context :
247
+ - Status badges (success/warning/error/info) → `var(--{status}-bg)` / `var(--{status}-text)` / `var(--{status}-border)`
248
+ - Action buttons → `var(--color-accent-600)` / `hover:bg-[var(--color-accent-700)]`
249
+ - Body text → `var(--text-primary)` / `var(--text-secondary)`
250
+ - Card backgrounds → `var(--bg-card)`
251
+ - Borders → `var(--border-color)`
252
+
253
+ When the context is ambiguous (e.g. random `bg-blue-100`), prompt for the intent (info badge ? accent ? branding ?) and apply accordingly.
254
+
255
+ ### R-FE-004 — `mergeRoutes` / `getStaticAppRoutes` removal
256
+
257
+ These calls usually live in `src/main.tsx` or `src/App.tsx`. Recipe :
258
+
259
+ 1. Open the file.
260
+ 2. Find the call to `mergeRoutes(...)` or `getStaticAppRoutes(...)`.
261
+ 3. For each route registered :
262
+ - Convert to `PageRegistry.register('module.section', lazy(() => import(...)))`
263
+ - Place those calls in `src/extensions/componentRegistry.generated.ts` (create the file if missing).
264
+ 4. Remove the original `mergeRoutes` call ; remove its imports.
265
+ 5. Ensure `main.tsx` imports `./extensions/componentRegistry.generated` early (before render).
266
+
267
+ This is a refactor — the skill SHOULD prompt the user to confirm and provide a diff preview.
268
+
269
+ ### R-CFG-002 — Tailwind v4 migration
270
+
271
+ ```bash
272
+ # Inside web/smartstack-web/
273
+ npm uninstall @tailwindcss/postcss
274
+ npm install --save-dev @tailwindcss/vite
275
+
276
+ # Edit vite.config.ts:
277
+ # + import tailwindcss from '@tailwindcss/vite';
278
+ # + plugins: [react(), tailwindcss()],
279
+
280
+ # Edit index.css to use the new @theme {} syntax (see themes-db-driven.md Section 3.3)
281
+ ```
282
+
283
+ The skill prompts and applies one step at a time, since these touch different files.
284
+
285
+ ## Notes
286
+
287
+ - This rule file is the single source of truth for `v3.34 → v3.46`. Add new rules here as breaking changes are discovered.
288
+ - For future migrations (e.g. `v3.46 → v3.47`), create `references/v3.46-to-v3.47.md` and register it in the SKILL.md mapping table.
289
+ - Always run with `--dry-run` first. Always commit before `--apply`.