specialist-agent 2.12.0 → 3.2.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/LICENSE +1 -1
- package/README.md +33 -207
- package/dist/catalog.json +15529 -0
- package/dist/hw-worker.mjs +254 -0
- package/dist/icones/icone.ico +0 -0
- package/dist/icones/icone.png +0 -0
- package/dist/interface/assets/figtree-latin-400-normal-g7Dtegnw.woff2 +0 -0
- package/dist/interface/assets/figtree-latin-500-normal-BWnGEVsr.woff2 +0 -0
- package/dist/interface/assets/figtree-latin-600-normal-Cv_xCTDl.woff2 +0 -0
- package/dist/interface/assets/figtree-latin-700-normal-th6qEP7c.woff2 +0 -0
- package/dist/interface/assets/figtree-latin-ext-400-normal-CXAzuTZb.woff2 +0 -0
- package/dist/interface/assets/figtree-latin-ext-500-normal-Du0rIuHj.woff2 +0 -0
- package/dist/interface/assets/figtree-latin-ext-600-normal-DJlfifZj.woff2 +0 -0
- package/dist/interface/assets/figtree-latin-ext-700-normal-CS4sQkGV.woff2 +0 -0
- package/dist/interface/assets/index-BIyqZkro.css +1 -0
- package/dist/interface/assets/index-zAegy908.js +13 -0
- package/dist/interface/assets/jetbrains-mono-latin-400-normal-V6pRDFza.woff2 +0 -0
- package/dist/interface/assets/jetbrains-mono-latin-500-normal-BWZEU5yA.woff2 +0 -0
- package/dist/interface/assets/jetbrains-mono-latin-600-normal-C8RAYTDA.woff2 +0 -0
- package/dist/interface/assets/jetbrains-mono-latin-ext-400-normal-Bc8Ftmh3.woff2 +0 -0
- package/dist/interface/assets/jetbrains-mono-latin-ext-500-normal-Cut-4mMH.woff2 +0 -0
- package/dist/interface/assets/jetbrains-mono-latin-ext-600-normal-BfB_LPfz.woff2 +0 -0
- package/dist/interface/assets/unbounded-latin-500-normal-4slEIF53.woff2 +0 -0
- package/dist/interface/assets/unbounded-latin-700-normal-CaoNriVp.woff2 +0 -0
- package/dist/interface/assets/unbounded-latin-ext-500-normal-BTIpesyw.woff2 +0 -0
- package/dist/interface/assets/unbounded-latin-ext-700-normal-BLzWLLjG.woff2 +0 -0
- package/dist/interface/icones/apple-touch-icon.png +0 -0
- package/dist/interface/icones/favicon-32.png +0 -0
- package/dist/interface/icones/icone-192.png +0 -0
- package/dist/interface/icones/icone-512.png +0 -0
- package/dist/interface/icones/icone-mascara-512.png +0 -0
- package/dist/interface/index.html +19 -0
- package/dist/interface/manifest.webmanifest +19 -0
- package/dist/interface/sw.js +63 -0
- package/dist/specialist-agent.mjs +6919 -0
- package/dist/usage-worker.mjs +174 -0
- package/package.json +32 -57
- package/.claude-plugin/marketplace.json +0 -52
- package/.claude-plugin/plugin.json +0 -37
- package/.codex/INSTALL.md +0 -145
- package/.cursor-plugin/marketplace.json +0 -52
- package/.cursor-plugin/plugin.json +0 -37
- package/.opencode/INSTALL.md +0 -127
- package/.opencode/opencode.json +0 -186
- package/agents/analyst-lite.md +0 -48
- package/agents/analyst.md +0 -396
- package/agents/api-lite.md +0 -43
- package/agents/api.md +0 -427
- package/agents/architect-lite.md +0 -104
- package/agents/architect.md +0 -571
- package/agents/autopilot-lite.md +0 -46
- package/agents/autopilot.md +0 -196
- package/agents/cloud-lite.md +0 -75
- package/agents/cloud.md +0 -213
- package/agents/data-lite.md +0 -67
- package/agents/data.md +0 -306
- package/agents/debugger-lite.md +0 -46
- package/agents/debugger.md +0 -410
- package/agents/deps-lite.md +0 -41
- package/agents/deps.md +0 -363
- package/agents/designer-lite.md +0 -67
- package/agents/designer.md +0 -195
- package/agents/devops-lite.md +0 -67
- package/agents/devops.md +0 -205
- package/agents/docs-lite.md +0 -42
- package/agents/docs.md +0 -454
- package/agents/executor-lite.md +0 -61
- package/agents/executor.md +0 -695
- package/agents/explorer-lite.md +0 -55
- package/agents/explorer.md +0 -152
- package/agents/finance-lite.md +0 -66
- package/agents/finance.md +0 -255
- package/agents/i18n-lite.md +0 -44
- package/agents/i18n.md +0 -594
- package/agents/legal-lite.md +0 -113
- package/agents/legal.md +0 -302
- package/agents/marketing-lite.md +0 -25
- package/agents/marketing.md +0 -188
- package/agents/memory.md +0 -166
- package/agents/orchestrator-lite.md +0 -40
- package/agents/orchestrator.md +0 -512
- package/agents/pair-lite.md +0 -38
- package/agents/pair.md +0 -310
- package/agents/perf-lite.md +0 -42
- package/agents/perf.md +0 -320
- package/agents/planner-lite.md +0 -59
- package/agents/planner.md +0 -272
- package/agents/product-lite.md +0 -25
- package/agents/product.md +0 -195
- package/agents/refactor-lite.md +0 -42
- package/agents/refactor.md +0 -467
- package/agents/ripple-lite.md +0 -106
- package/agents/ripple.md +0 -166
- package/agents/scout-lite.md +0 -37
- package/agents/scout.md +0 -224
- package/agents/security-lite.md +0 -66
- package/agents/security.md +0 -252
- package/agents/sentry-triage-lite.md +0 -54
- package/agents/sentry-triage.md +0 -217
- package/agents/starter-lite.md +0 -80
- package/agents/starter.md +0 -300
- package/agents/support-lite.md +0 -24
- package/agents/support.md +0 -191
- package/agents/tdd-lite.md +0 -43
- package/agents/tdd.md +0 -329
- package/agents/tester-lite.md +0 -71
- package/agents/tester.md +0 -237
- package/cli/architectures.mjs +0 -713
- package/cli/detect-architecture.mjs +0 -752
- package/cli/generate-architecture.mjs +0 -1096
- package/cli/index.mjs +0 -1217
- package/cli/recommend-architecture.mjs +0 -870
- package/hooks/after-review.mjs +0 -130
- package/hooks/after-task.mjs +0 -117
- package/hooks/before-plan.mjs +0 -155
- package/hooks/before-review.mjs +0 -139
- package/hooks/hooks.json +0 -66
- package/hooks/lifecycle.json +0 -91
- package/hooks/native/auto-dispatch.mjs +0 -207
- package/hooks/native/auto-format.mjs +0 -176
- package/hooks/native/mcp-discovery.mjs +0 -168
- package/hooks/native/security-config.json +0 -38
- package/hooks/native/security-guard.mjs +0 -323
- package/hooks/native/session-context.mjs +0 -179
- package/hooks/native/session-end.mjs +0 -42
- package/hooks/native/utils.mjs +0 -62
- package/hooks/on-error.mjs +0 -129
- package/hooks/session-end.mjs +0 -185
- package/hooks/session-start.mjs +0 -154
- package/packs/angular/ARCHITECTURE.md +0 -814
- package/packs/angular/CLAUDE.md +0 -105
- package/packs/angular/agents/builder.md +0 -113
- package/packs/angular/agents/doctor.md +0 -187
- package/packs/angular/agents/migrator.md +0 -101
- package/packs/angular/agents/reviewer.md +0 -252
- package/packs/angular/agents-lite/builder.md +0 -65
- package/packs/angular/agents-lite/doctor.md +0 -64
- package/packs/angular/agents-lite/migrator.md +0 -75
- package/packs/angular/agents-lite/reviewer.md +0 -69
- package/packs/angular/skills/dev-create-component/SKILL.md +0 -56
- package/packs/angular/skills/dev-create-injectable/SKILL.md +0 -60
- package/packs/angular/skills/dev-create-module/SKILL.md +0 -49
- package/packs/angular/skills/dev-create-service/SKILL.md +0 -34
- package/packs/angular/skills/dev-create-test/SKILL.md +0 -78
- package/packs/angular/skills/dev-generate-types/SKILL.md +0 -37
- package/packs/angular/skills/docs-onboard/SKILL.md +0 -42
- package/packs/angular/skills/migration-migrate-component/SKILL.md +0 -42
- package/packs/angular/skills/migration-migrate-module/SKILL.md +0 -25
- package/packs/angular/skills/review-check-architecture/SKILL.md +0 -67
- package/packs/angular/skills/review-fix-violations/SKILL.md +0 -43
- package/packs/angular/skills/review-review/SKILL.md +0 -43
- package/packs/astro/ARCHITECTURE.md +0 -718
- package/packs/astro/CLAUDE.md +0 -106
- package/packs/astro/agents/builder.md +0 -123
- package/packs/astro/agents/doctor.md +0 -200
- package/packs/astro/agents/migrator.md +0 -105
- package/packs/astro/agents/reviewer.md +0 -253
- package/packs/astro/agents-lite/builder.md +0 -71
- package/packs/astro/agents-lite/doctor.md +0 -66
- package/packs/astro/agents-lite/migrator.md +0 -71
- package/packs/astro/agents-lite/reviewer.md +0 -70
- package/packs/astro/skills/dev-create-component/SKILL.md +0 -50
- package/packs/astro/skills/dev-create-island/SKILL.md +0 -63
- package/packs/astro/skills/dev-create-module/SKILL.md +0 -49
- package/packs/astro/skills/dev-create-service/SKILL.md +0 -34
- package/packs/astro/skills/dev-create-test/SKILL.md +0 -76
- package/packs/astro/skills/dev-generate-types/SKILL.md +0 -37
- package/packs/astro/skills/docs-onboard/SKILL.md +0 -51
- package/packs/astro/skills/migration-migrate-component/SKILL.md +0 -48
- package/packs/astro/skills/migration-migrate-module/SKILL.md +0 -25
- package/packs/astro/skills/review-check-architecture/SKILL.md +0 -72
- package/packs/astro/skills/review-fix-violations/SKILL.md +0 -43
- package/packs/astro/skills/review-review/SKILL.md +0 -45
- package/packs/nextjs/ARCHITECTURE.md +0 -1033
- package/packs/nextjs/CLAUDE.md +0 -106
- package/packs/nextjs/agents/builder.md +0 -132
- package/packs/nextjs/agents/doctor.md +0 -226
- package/packs/nextjs/agents/migrator.md +0 -101
- package/packs/nextjs/agents/reviewer.md +0 -243
- package/packs/nextjs/agents-lite/builder.md +0 -74
- package/packs/nextjs/agents-lite/doctor.md +0 -74
- package/packs/nextjs/agents-lite/migrator.md +0 -75
- package/packs/nextjs/agents-lite/reviewer.md +0 -73
- package/packs/nextjs/skills/dev-create-component/SKILL.md +0 -82
- package/packs/nextjs/skills/dev-create-hook/SKILL.md +0 -90
- package/packs/nextjs/skills/dev-create-module/SKILL.md +0 -63
- package/packs/nextjs/skills/dev-create-service/SKILL.md +0 -35
- package/packs/nextjs/skills/dev-create-test/SKILL.md +0 -106
- package/packs/nextjs/skills/dev-generate-types/SKILL.md +0 -37
- package/packs/nextjs/skills/docs-onboard/SKILL.md +0 -55
- package/packs/nextjs/skills/migration-migrate-component/SKILL.md +0 -58
- package/packs/nextjs/skills/migration-migrate-module/SKILL.md +0 -25
- package/packs/nextjs/skills/review-check-architecture/SKILL.md +0 -101
- package/packs/nextjs/skills/review-fix-violations/SKILL.md +0 -48
- package/packs/nextjs/skills/review-review/SKILL.md +0 -47
- package/packs/nuxt/ARCHITECTURE.md +0 -831
- package/packs/nuxt/CLAUDE.md +0 -111
- package/packs/nuxt/agents/builder.md +0 -120
- package/packs/nuxt/agents/doctor.md +0 -198
- package/packs/nuxt/agents/migrator.md +0 -101
- package/packs/nuxt/agents/reviewer.md +0 -255
- package/packs/nuxt/agents-lite/builder.md +0 -67
- package/packs/nuxt/agents-lite/doctor.md +0 -67
- package/packs/nuxt/agents-lite/migrator.md +0 -80
- package/packs/nuxt/agents-lite/reviewer.md +0 -71
- package/packs/nuxt/skills/dev-create-component/SKILL.md +0 -60
- package/packs/nuxt/skills/dev-create-composable/SKILL.md +0 -33
- package/packs/nuxt/skills/dev-create-module/SKILL.md +0 -49
- package/packs/nuxt/skills/dev-create-service/SKILL.md +0 -34
- package/packs/nuxt/skills/dev-create-test/SKILL.md +0 -61
- package/packs/nuxt/skills/dev-generate-types/SKILL.md +0 -37
- package/packs/nuxt/skills/docs-onboard/SKILL.md +0 -49
- package/packs/nuxt/skills/migration-migrate-component/SKILL.md +0 -48
- package/packs/nuxt/skills/migration-migrate-module/SKILL.md +0 -25
- package/packs/nuxt/skills/review-check-architecture/SKILL.md +0 -71
- package/packs/nuxt/skills/review-fix-violations/SKILL.md +0 -43
- package/packs/nuxt/skills/review-review/SKILL.md +0 -45
- package/packs/react/ARCHITECTURE.md +0 -991
- package/packs/react/CLAUDE.md +0 -102
- package/packs/react/agents/builder.md +0 -113
- package/packs/react/agents/doctor.md +0 -203
- package/packs/react/agents/migrator.md +0 -101
- package/packs/react/agents/reviewer.md +0 -252
- package/packs/react/agents-lite/builder.md +0 -65
- package/packs/react/agents-lite/doctor.md +0 -64
- package/packs/react/agents-lite/migrator.md +0 -74
- package/packs/react/agents-lite/reviewer.md +0 -69
- package/packs/react/skills/dev-create-component/SKILL.md +0 -53
- package/packs/react/skills/dev-create-hook/SKILL.md +0 -78
- package/packs/react/skills/dev-create-module/SKILL.md +0 -51
- package/packs/react/skills/dev-create-service/SKILL.md +0 -34
- package/packs/react/skills/dev-create-test/SKILL.md +0 -92
- package/packs/react/skills/dev-generate-types/SKILL.md +0 -37
- package/packs/react/skills/docs-onboard/SKILL.md +0 -42
- package/packs/react/skills/migration-migrate-component/SKILL.md +0 -44
- package/packs/react/skills/migration-migrate-module/SKILL.md +0 -25
- package/packs/react/skills/review-check-architecture/SKILL.md +0 -73
- package/packs/react/skills/review-fix-violations/SKILL.md +0 -45
- package/packs/react/skills/review-review/SKILL.md +0 -44
- package/packs/svelte/ARCHITECTURE.md +0 -975
- package/packs/svelte/CLAUDE.md +0 -102
- package/packs/svelte/agents/builder.md +0 -114
- package/packs/svelte/agents/doctor.md +0 -174
- package/packs/svelte/agents/migrator.md +0 -101
- package/packs/svelte/agents/reviewer.md +0 -238
- package/packs/svelte/agents-lite/builder.md +0 -66
- package/packs/svelte/agents-lite/doctor.md +0 -67
- package/packs/svelte/agents-lite/migrator.md +0 -82
- package/packs/svelte/agents-lite/reviewer.md +0 -70
- package/packs/svelte/skills/dev-create-component/SKILL.md +0 -77
- package/packs/svelte/skills/dev-create-module/SKILL.md +0 -59
- package/packs/svelte/skills/dev-create-service/SKILL.md +0 -35
- package/packs/svelte/skills/dev-create-store/SKILL.md +0 -94
- package/packs/svelte/skills/dev-create-test/SKILL.md +0 -98
- package/packs/svelte/skills/dev-generate-types/SKILL.md +0 -37
- package/packs/svelte/skills/docs-onboard/SKILL.md +0 -47
- package/packs/svelte/skills/migration-migrate-component/SKILL.md +0 -51
- package/packs/svelte/skills/migration-migrate-module/SKILL.md +0 -25
- package/packs/svelte/skills/review-check-architecture/SKILL.md +0 -79
- package/packs/svelte/skills/review-fix-violations/SKILL.md +0 -47
- package/packs/svelte/skills/review-review/SKILL.md +0 -45
- package/packs/vue/ARCHITECTURE.md +0 -798
- package/packs/vue/CLAUDE.md +0 -102
- package/packs/vue/agents/builder.md +0 -112
- package/packs/vue/agents/doctor.md +0 -185
- package/packs/vue/agents/migrator.md +0 -101
- package/packs/vue/agents/reviewer.md +0 -249
- package/packs/vue/agents-lite/builder.md +0 -65
- package/packs/vue/agents-lite/doctor.md +0 -63
- package/packs/vue/agents-lite/migrator.md +0 -73
- package/packs/vue/agents-lite/reviewer.md +0 -68
- package/packs/vue/skills/dev-create-component/SKILL.md +0 -58
- package/packs/vue/skills/dev-create-composable/SKILL.md +0 -31
- package/packs/vue/skills/dev-create-module/SKILL.md +0 -50
- package/packs/vue/skills/dev-create-service/SKILL.md +0 -34
- package/packs/vue/skills/dev-create-test/SKILL.md +0 -62
- package/packs/vue/skills/dev-generate-types/SKILL.md +0 -37
- package/packs/vue/skills/docs-onboard/SKILL.md +0 -42
- package/packs/vue/skills/migration-migrate-component/SKILL.md +0 -41
- package/packs/vue/skills/migration-migrate-module/SKILL.md +0 -25
- package/packs/vue/skills/review-check-architecture/SKILL.md +0 -73
- package/packs/vue/skills/review-fix-violations/SKILL.md +0 -42
- package/packs/vue/skills/review-review/SKILL.md +0 -43
- package/skills/audit/SKILL.md +0 -231
- package/skills/autofix/SKILL.md +0 -166
- package/skills/autopilot/SKILL.md +0 -286
- package/skills/brainstorm/SKILL.md +0 -298
- package/skills/checkpoint/SKILL.md +0 -217
- package/skills/codereview/SKILL.md +0 -268
- package/skills/commit/SKILL.md +0 -150
- package/skills/copywriting/SKILL.md +0 -218
- package/skills/cro/SKILL.md +0 -234
- package/skills/debug/SKILL.md +0 -210
- package/skills/design-review/SKILL.md +0 -217
- package/skills/discovery/SKILL.md +0 -218
- package/skills/estimate/SKILL.md +0 -154
- package/skills/finish/SKILL.md +0 -220
- package/skills/grill/SKILL.md +0 -270
- package/skills/health/SKILL.md +0 -251
- package/skills/improve-architecture/SKILL.md +0 -205
- package/skills/learn/SKILL.md +0 -260
- package/skills/lint/SKILL.md +0 -126
- package/skills/migrate-architecture/SKILL.md +0 -242
- package/skills/migrate-framework/SKILL.md +0 -172
- package/skills/onboard/SKILL.md +0 -168
- package/skills/plan/SKILL.md +0 -141
- package/skills/prd/SKILL.md +0 -241
- package/skills/recall/SKILL.md +0 -112
- package/skills/remember/SKILL.md +0 -108
- package/skills/seo-audit/SKILL.md +0 -240
- package/skills/tdd/SKILL.md +0 -201
- package/skills/tutorial/SKILL.md +0 -346
- package/skills/verify/SKILL.md +0 -168
- package/skills/worktree/SKILL.md +0 -168
- package/skills/write-skill/SKILL.md +0 -225
- package/templates/autopilot/PROMPT.md +0 -39
- package/templates/autopilot/README.md +0 -122
- package/templates/autopilot/devcontainer.json +0 -21
- package/templates/industry/ecommerce.md +0 -127
- package/templates/industry/fintech.md +0 -161
- package/templates/industry/saas.md +0 -134
- package/templates/session-memory.json +0 -48
- package/templates/skill-template/SKILL.md +0 -90
|
@@ -1,870 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Architecture Recommendation Engine
|
|
3
|
-
*
|
|
4
|
-
* Provides opinionated, best-practice recommendations for both frontend
|
|
5
|
-
* and backend architectures based on:
|
|
6
|
-
* - Current detected architecture
|
|
7
|
-
* - Framework
|
|
8
|
-
* - Project size and complexity indicators
|
|
9
|
-
* - Team size (asked interactively)
|
|
10
|
-
* - Whether it's a monorepo
|
|
11
|
-
* - Whether the project has backend code
|
|
12
|
-
*
|
|
13
|
-
* Philosophy: Always recommend the BEST architecture for the context,
|
|
14
|
-
* not just the easiest migration. Provide Full and Lite variants so
|
|
15
|
-
* teams of any size can adopt best practices.
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
import { ARCHITECTURE_PATTERNS, MIGRATION_MAP, FRAMEWORK_ADAPTATIONS } from './architectures.mjs'
|
|
19
|
-
|
|
20
|
-
// ── Recommendation Profiles ───────────────────────────
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* For each project context, these are the recommended architectures
|
|
24
|
-
* ranked by preference. Based on industry best practices from:
|
|
25
|
-
* - Martin Fowler, Robert C. Martin, Eric Evans, Sam Newman
|
|
26
|
-
* - Netflix, Shopify, Amazon, GitHub migration case studies
|
|
27
|
-
* - Feature-Sliced Design methodology (Yandex)
|
|
28
|
-
* - Clean Architecture (Uncle Bob)
|
|
29
|
-
*/
|
|
30
|
-
const RECOMMENDATIONS = {
|
|
31
|
-
// ── Frontend-Only Projects ──────────────────────────
|
|
32
|
-
|
|
33
|
-
frontend: {
|
|
34
|
-
small: {
|
|
35
|
-
// 1-3 devs, < 20 components, prototype/MVP
|
|
36
|
-
primary: 'modular',
|
|
37
|
-
alternatives: ['flat'],
|
|
38
|
-
reason: 'Modular architecture scales well from day one. Even small projects benefit from feature isolation. Use the Lite variant to keep it lightweight.',
|
|
39
|
-
},
|
|
40
|
-
medium: {
|
|
41
|
-
// 3-10 devs, 20-100 components
|
|
42
|
-
primary: 'modular',
|
|
43
|
-
alternatives: ['fsd', 'atomic'],
|
|
44
|
-
reason: 'Modular architecture with services/adapters/types layers gives clear boundaries and excellent testability. Feature-Sliced Design is a strong alternative for teams that want stricter import rules.',
|
|
45
|
-
},
|
|
46
|
-
large: {
|
|
47
|
-
// 10+ devs, 100+ components
|
|
48
|
-
primary: 'fsd',
|
|
49
|
-
alternatives: ['modular', 'clean'],
|
|
50
|
-
reason: 'Feature-Sliced Design enforces strict layer dependencies preventing architectural decay. Modular (Full) is equally strong with more framework flexibility. Clean Architecture adds explicit domain separation for complex business logic.',
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
|
|
54
|
-
// ── Fullstack Projects ──────────────────────────────
|
|
55
|
-
|
|
56
|
-
fullstack: {
|
|
57
|
-
small: {
|
|
58
|
-
// 1-3 devs, simple CRUD
|
|
59
|
-
primary: 'modular',
|
|
60
|
-
alternatives: ['mvc'],
|
|
61
|
-
backendRecommendation: 'modular-monolith',
|
|
62
|
-
reason: 'Modular architecture works for both frontend and backend modules. Start as a modular monolith - you get isolation without distributed complexity.',
|
|
63
|
-
},
|
|
64
|
-
medium: {
|
|
65
|
-
// 3-10 devs, moderate business logic
|
|
66
|
-
primary: 'modular',
|
|
67
|
-
alternatives: ['clean', 'hexagonal'],
|
|
68
|
-
backendRecommendation: 'modular-monolith',
|
|
69
|
-
reason: 'Modular architecture with Clean Architecture principles inside each module. Backend as Modular Monolith with domain/application/infrastructure layers. Extract to microservices only when needed.',
|
|
70
|
-
},
|
|
71
|
-
large: {
|
|
72
|
-
// 10+ devs, complex domain
|
|
73
|
-
primary: 'clean',
|
|
74
|
-
alternatives: ['hexagonal', 'ddd'],
|
|
75
|
-
backendRecommendation: 'hexagonal',
|
|
76
|
-
reason: 'Clean Architecture or Hexagonal for both frontend and backend. Domain logic isolated from framework. Backend with DDD patterns (aggregates, value objects) for complex domains. Consider CQRS for read-heavy scenarios.',
|
|
77
|
-
},
|
|
78
|
-
enterprise: {
|
|
79
|
-
// 20+ devs, multiple teams
|
|
80
|
-
primary: 'ddd',
|
|
81
|
-
alternatives: ['hexagonal', 'clean'],
|
|
82
|
-
backendRecommendation: 'ddd',
|
|
83
|
-
reason: 'Domain-Driven Design with bounded contexts, each team owns a context. Start as Modular Monolith with DDD, extract to microservices per bounded context when teams need independent deployment.',
|
|
84
|
-
},
|
|
85
|
-
},
|
|
86
|
-
|
|
87
|
-
// ── Backend-Only Projects ───────────────────────────
|
|
88
|
-
|
|
89
|
-
backend: {
|
|
90
|
-
small: {
|
|
91
|
-
primary: 'modular-monolith',
|
|
92
|
-
alternatives: ['mvc'],
|
|
93
|
-
reason: 'Even small APIs benefit from modular structure. Modular Monolith (Lite) gives you feature isolation with minimal overhead.',
|
|
94
|
-
},
|
|
95
|
-
medium: {
|
|
96
|
-
primary: 'modular-monolith',
|
|
97
|
-
alternatives: ['hexagonal', 'clean'],
|
|
98
|
-
reason: 'Modular Monolith with domain layers inside each module. Hexagonal architecture if you need infrastructure flexibility (multiple databases, message brokers).',
|
|
99
|
-
},
|
|
100
|
-
large: {
|
|
101
|
-
primary: 'hexagonal',
|
|
102
|
-
alternatives: ['clean', 'ddd'],
|
|
103
|
-
reason: 'Hexagonal architecture isolates your domain from infrastructure. Add DDD tactical patterns (aggregates, domain events) for complex business rules.',
|
|
104
|
-
},
|
|
105
|
-
enterprise: {
|
|
106
|
-
primary: 'ddd',
|
|
107
|
-
alternatives: ['hexagonal', 'cqrs'],
|
|
108
|
-
reason: 'Full DDD with bounded contexts. CQRS for domains with asymmetric read/write patterns. Event-driven communication between contexts. Start as Modular Monolith, extract services as needed.',
|
|
109
|
-
},
|
|
110
|
-
},
|
|
111
|
-
|
|
112
|
-
// ── Monorepo Projects ──────────────────────────────
|
|
113
|
-
|
|
114
|
-
monorepo: {
|
|
115
|
-
small: {
|
|
116
|
-
primary: 'modular',
|
|
117
|
-
alternatives: ['flat'],
|
|
118
|
-
reason: 'Each app in the monorepo uses Modular architecture. Shared packages in packages/ follow the same module conventions.',
|
|
119
|
-
},
|
|
120
|
-
medium: {
|
|
121
|
-
primary: 'modular',
|
|
122
|
-
alternatives: ['clean', 'hexagonal'],
|
|
123
|
-
reason: 'Modular architecture per app. Shared domain logic in packages/. Consider Clean Architecture for apps with complex business logic.',
|
|
124
|
-
},
|
|
125
|
-
large: {
|
|
126
|
-
primary: 'clean',
|
|
127
|
-
alternatives: ['hexagonal', 'ddd'],
|
|
128
|
-
reason: 'Clean Architecture per app with shared domain packages. Backend services use Hexagonal or DDD. Each bounded context can be its own package.',
|
|
129
|
-
},
|
|
130
|
-
},
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
// ── Framework-Specific Recommendations ────────────────
|
|
134
|
-
|
|
135
|
-
const FRAMEWORK_RECOMMENDATIONS = {
|
|
136
|
-
nextjs: {
|
|
137
|
-
extraNotes: [
|
|
138
|
-
'Server Components as default - data fetching in pages/layouts',
|
|
139
|
-
'Client Components only when interactivity needed',
|
|
140
|
-
'Server Actions for mutations (replace API routes for forms)',
|
|
141
|
-
'Route groups (feature)/ for organizing related routes',
|
|
142
|
-
],
|
|
143
|
-
preferredStateManagement: 'Zustand (client) + TanStack React Query (server)',
|
|
144
|
-
routerNote: {
|
|
145
|
-
'app-router': 'App Router detected - use Server Components, Server Actions, and route groups',
|
|
146
|
-
'pages-router': 'Pages Router detected - consider migrating to App Router for better performance and DX',
|
|
147
|
-
'hybrid': 'Both routers detected - migrate Pages Router routes to App Router incrementally',
|
|
148
|
-
},
|
|
149
|
-
},
|
|
150
|
-
react: {
|
|
151
|
-
extraNotes: [
|
|
152
|
-
'React Router 6 with lazy-loaded routes',
|
|
153
|
-
'Error boundaries at route level',
|
|
154
|
-
'Suspense for data loading states',
|
|
155
|
-
],
|
|
156
|
-
preferredStateManagement: 'Zustand (client) + TanStack React Query (server)',
|
|
157
|
-
},
|
|
158
|
-
vue: {
|
|
159
|
-
extraNotes: [
|
|
160
|
-
'<script setup lang="ts"> for all components',
|
|
161
|
-
'Composition API exclusively (no Options API)',
|
|
162
|
-
'provide/inject for cross-component state',
|
|
163
|
-
],
|
|
164
|
-
preferredStateManagement: 'Pinia (client) + TanStack Vue Query (server)',
|
|
165
|
-
},
|
|
166
|
-
nuxt: {
|
|
167
|
-
extraNotes: [
|
|
168
|
-
'Auto-imports for composables and components',
|
|
169
|
-
'server/api/ for API routes (Nitro)',
|
|
170
|
-
'File-based routing in pages/',
|
|
171
|
-
'Modules in modules/ alongside Nuxt conventions',
|
|
172
|
-
],
|
|
173
|
-
preferredStateManagement: 'Pinia (client) + TanStack Vue Query (server)',
|
|
174
|
-
},
|
|
175
|
-
svelte: {
|
|
176
|
-
extraNotes: [
|
|
177
|
-
'$lib alias for module imports',
|
|
178
|
-
'+page.server.ts for server-side data loading',
|
|
179
|
-
'Form actions for mutations',
|
|
180
|
-
'Stores in lib/modules/ organized by feature',
|
|
181
|
-
],
|
|
182
|
-
preferredStateManagement: 'Svelte stores (client) + TanStack Svelte Query (server)',
|
|
183
|
-
},
|
|
184
|
-
angular: {
|
|
185
|
-
extraNotes: [
|
|
186
|
-
'Standalone components (no NgModules)',
|
|
187
|
-
'Signals for reactive state',
|
|
188
|
-
'inject() function-based DI',
|
|
189
|
-
'Lazy-loaded feature routes',
|
|
190
|
-
],
|
|
191
|
-
preferredStateManagement: 'NgRx Signals (client) + TanStack Angular Query (server)',
|
|
192
|
-
},
|
|
193
|
-
astro: {
|
|
194
|
-
extraNotes: [
|
|
195
|
-
'Static by default, interactive islands for dynamic UI',
|
|
196
|
-
'Content Collections for structured content',
|
|
197
|
-
'Framework islands (React, Vue, Svelte) for interactive components',
|
|
198
|
-
'Zero JS by default - opt into client-side interactivity',
|
|
199
|
-
],
|
|
200
|
-
preferredStateManagement: 'Nanostores (client)',
|
|
201
|
-
},
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
// ── Main Recommendation Function ──────────────────────
|
|
205
|
-
|
|
206
|
-
export function getRecommendations(detectionResult, options = {}) {
|
|
207
|
-
const { teamSize = 'medium', projectType = 'auto' } = options
|
|
208
|
-
|
|
209
|
-
// Determine project type if auto
|
|
210
|
-
let resolvedType = projectType
|
|
211
|
-
if (resolvedType === 'auto') {
|
|
212
|
-
resolvedType = inferProjectType(detectionResult)
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
// Determine size category
|
|
216
|
-
const sizeCategory = resolveTeamSizeCategory(teamSize, resolvedType)
|
|
217
|
-
|
|
218
|
-
// Get base recommendations
|
|
219
|
-
let recKey = resolvedType
|
|
220
|
-
if (detectionResult.monorepo) recKey = 'monorepo'
|
|
221
|
-
|
|
222
|
-
const recs = RECOMMENDATIONS[recKey]?.[sizeCategory] || RECOMMENDATIONS.frontend.medium
|
|
223
|
-
|
|
224
|
-
// Build recommendation list
|
|
225
|
-
const recommendations = []
|
|
226
|
-
|
|
227
|
-
// Primary recommendation
|
|
228
|
-
const primary = buildRecommendation(recs.primary, detectionResult, 'recommended', sizeCategory)
|
|
229
|
-
if (primary) recommendations.push(primary)
|
|
230
|
-
|
|
231
|
-
// Backend recommendation (for fullstack)
|
|
232
|
-
if (recs.backendRecommendation && resolvedType === 'fullstack') {
|
|
233
|
-
const backend = buildRecommendation(recs.backendRecommendation, detectionResult, 'backend-recommended', sizeCategory)
|
|
234
|
-
if (backend) recommendations.push(backend)
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
// Alternative recommendations
|
|
238
|
-
for (const altId of recs.alternatives) {
|
|
239
|
-
const alt = buildRecommendation(altId, detectionResult, 'alternative', sizeCategory)
|
|
240
|
-
if (alt) recommendations.push(alt)
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
// Framework-specific notes
|
|
244
|
-
const frameworkNotes = FRAMEWORK_RECOMMENDATIONS[detectionResult.framework] || null
|
|
245
|
-
|
|
246
|
-
return {
|
|
247
|
-
projectType: resolvedType,
|
|
248
|
-
sizeCategory,
|
|
249
|
-
reason: recs.reason,
|
|
250
|
-
currentArchitecture: detectionResult.architecture,
|
|
251
|
-
recommendations,
|
|
252
|
-
frameworkNotes,
|
|
253
|
-
monorepoNote: detectionResult.monorepo
|
|
254
|
-
? `Monorepo detected (${detectionResult.monorepo.name}). Each app/package should follow the recommended architecture independently. Shared domain logic goes in packages/.`
|
|
255
|
-
: null,
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
function buildRecommendation(archId, detectionResult, tag, sizeCategory) {
|
|
260
|
-
const pattern = ARCHITECTURE_PATTERNS[archId]
|
|
261
|
-
if (!pattern) return null
|
|
262
|
-
|
|
263
|
-
const currentArch = detectionResult.architecture
|
|
264
|
-
const migrationKey = `${currentArch}->${archId}`
|
|
265
|
-
const migration = MIGRATION_MAP[migrationKey]
|
|
266
|
-
|
|
267
|
-
// Check if it's the same architecture
|
|
268
|
-
const isSameArch = currentArch === archId
|
|
269
|
-
|
|
270
|
-
const recommendation = {
|
|
271
|
-
id: archId,
|
|
272
|
-
name: pattern.name,
|
|
273
|
-
tag, // 'recommended', 'backend-recommended', 'alternative'
|
|
274
|
-
description: pattern.description,
|
|
275
|
-
bestFor: pattern.bestFor,
|
|
276
|
-
category: pattern.category,
|
|
277
|
-
isSameArch,
|
|
278
|
-
variants: [],
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
if (!isSameArch && migration) {
|
|
282
|
-
recommendation.migration = {
|
|
283
|
-
effort: migration.effort,
|
|
284
|
-
description: migration.description,
|
|
285
|
-
agents: getMigrationAgents(archId),
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
// Full variant
|
|
290
|
-
recommendation.variants.push({
|
|
291
|
-
id: 'full',
|
|
292
|
-
name: 'Full',
|
|
293
|
-
description: getFullVariantDescription(archId, pattern),
|
|
294
|
-
teamSize: pattern.bestFor.teamSize,
|
|
295
|
-
layers: getArchitectureLayers(archId, detectionResult.framework, 'full'),
|
|
296
|
-
directoryStructure: generateDirectoryPreview(archId, detectionResult.framework, 'full'),
|
|
297
|
-
})
|
|
298
|
-
|
|
299
|
-
// Lite variant
|
|
300
|
-
recommendation.variants.push({
|
|
301
|
-
id: 'lite',
|
|
302
|
-
name: 'Simplified',
|
|
303
|
-
description: getLiteVariantDescription(archId, pattern),
|
|
304
|
-
teamSize: reducedTeamSize(pattern.bestFor.teamSize),
|
|
305
|
-
layers: getArchitectureLayers(archId, detectionResult.framework, 'lite'),
|
|
306
|
-
directoryStructure: generateDirectoryPreview(archId, detectionResult.framework, 'lite'),
|
|
307
|
-
})
|
|
308
|
-
|
|
309
|
-
return recommendation
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
// ── Variant Descriptions ──────────────────────────────
|
|
313
|
-
|
|
314
|
-
function getFullVariantDescription(archId, pattern) {
|
|
315
|
-
const descriptions = {
|
|
316
|
-
'modular': 'All layers: components, services, adapters, types/contracts, stores, hooks/composables, __tests__. Each module has barrel exports (index.ts). Strict import rules between modules.',
|
|
317
|
-
'fsd': 'All 7 FSD layers: app, processes, pages, widgets, features, entities, shared. Each slice with segments: ui, model, api, lib. Strict top-down import rules.',
|
|
318
|
-
'atomic': 'All Atomic levels: atoms, molecules, organisms, templates, pages. Separate design system from feature logic.',
|
|
319
|
-
'mvc': 'Classic layers: controllers, models/entities, services, repositories, middleware, routes. Separation of concerns by technical role.',
|
|
320
|
-
'clean': 'Four concentric layers: domain (entities, value objects), application (use cases, DTOs), infrastructure (database, HTTP, messaging), presentation (controllers/components). Strict dependency rule: inward only.',
|
|
321
|
-
'hexagonal': 'Core with domain + use cases. Ports (in/out interfaces). Adapters (in: REST/GraphQL/CLI, out: database/external APIs/messaging). Domain has zero external dependencies.',
|
|
322
|
-
'ddd': 'Bounded contexts with: aggregates, entities, value objects, domain events, domain services. Application layer with command/query handlers. Anti-Corruption Layer between contexts.',
|
|
323
|
-
'cqrs': 'Separate command and query pipelines. Command handlers + write model + event store. Query handlers + read models + projections. Event-driven synchronization.',
|
|
324
|
-
'event-driven': 'Event bus/broker (RabbitMQ/Kafka). Event publishers, subscribers, handlers. Sagas for cross-service workflows. Eventual consistency patterns.',
|
|
325
|
-
'microservices': 'Independent services, each with own database. API Gateway. Service discovery. Inter-service communication via REST/gRPC/events. Independent CI/CD per service.',
|
|
326
|
-
'modular-monolith': 'Single deployment with strict module boundaries. Each module has domain/application/infrastructure layers. Communication via interfaces only. Barrel exports enforce encapsulation.',
|
|
327
|
-
'serverless': 'Function handlers organized by domain. Shared middleware and utilities. Event triggers (HTTP, queue, schedule). Infrastructure as Code (SAM/CDK/Serverless Framework).',
|
|
328
|
-
'flat': 'Simple components/, pages/, utils/ structure. Direct imports. Good for prototypes and very small projects.',
|
|
329
|
-
'screaming': 'Top-level directories named after business domains. Each domain is self-contained. The folder structure "screams" what the application does.',
|
|
330
|
-
}
|
|
331
|
-
return descriptions[archId] || pattern.description
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
function getLiteVariantDescription(archId, pattern) {
|
|
335
|
-
const descriptions = {
|
|
336
|
-
'modular': 'Core layers only: components, services, types. No adapters (inline transforms in services). No separate stores (co-locate state with hooks/composables). Simplified but still modular.',
|
|
337
|
-
'fsd': 'Reduced to 5 layers: app, pages, features, entities, shared. No processes or widgets layers. Simpler segments (ui, model only).',
|
|
338
|
-
'atomic': 'Three levels: primitives (atoms+molecules), organisms, pages. No templates layer. Simpler component categorization.',
|
|
339
|
-
'mvc': 'Two layers: services (merged controllers+repositories) and models. Middleware as simple functions. Minimal ceremony.',
|
|
340
|
-
'clean': 'Two layers: core (domain+application merged) and infra (infrastructure+presentation merged). Same dependency rule, fewer directories.',
|
|
341
|
-
'hexagonal': 'Flat ports/ and adapters/ (no in/out subdivision). Single core/ directory for domain+use cases. Same isolation, less ceremony.',
|
|
342
|
-
'ddd': 'Single bounded context. Domain with entities and value objects (no formal aggregates). Application layer with handlers. Simplified events.',
|
|
343
|
-
'cqrs': 'CQRS without Event Sourcing. Separate command/query handlers sharing the same database. No projections or event store.',
|
|
344
|
-
'event-driven': 'In-process event bus (no external broker). Simple publish/subscribe. Domain events for decoupling within the application.',
|
|
345
|
-
'microservices': '2-3 services only. Shared infrastructure (database can be shared initially). Single CI pipeline. Simple API gateway.',
|
|
346
|
-
'modular-monolith': 'Modules with services + types + index.ts only. No internal domain/application/infrastructure layering. Boundary enforcement via barrel exports.',
|
|
347
|
-
'serverless': 'Functions organized by domain folder. Shared utils. No formal middleware layer.',
|
|
348
|
-
'flat': 'Minimal: components/, pages/, api/, utils/. The simplest possible structure.',
|
|
349
|
-
'screaming': 'Domain directories with flat internal structure (services, types, components co-located).',
|
|
350
|
-
}
|
|
351
|
-
return descriptions[archId] || `Simplified version of ${pattern.name}. Same core principles, fewer layers.`
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
// ── Directory Structure Preview ───────────────────────
|
|
355
|
-
|
|
356
|
-
function generateDirectoryPreview(archId, framework, variant) {
|
|
357
|
-
const fw = FRAMEWORK_ADAPTATIONS[framework]
|
|
358
|
-
const adaptation = fw?.adaptations?.[archId]
|
|
359
|
-
|
|
360
|
-
// Framework-specific module layer names
|
|
361
|
-
const hookDir = ['vue', 'nuxt'].includes(framework) ? 'composables' : 'hooks'
|
|
362
|
-
const storeLib = ['vue', 'nuxt'].includes(framework) ? 'pinia' : ['angular'].includes(framework) ? 'ngrx-signals' : 'zustand'
|
|
363
|
-
const viewDir = ['vue', 'nuxt'].includes(framework) ? 'views' : 'pages'
|
|
364
|
-
const srcPrefix = ['nuxt'].includes(framework) ? '' : 'src/'
|
|
365
|
-
|
|
366
|
-
switch (archId) {
|
|
367
|
-
case 'modular':
|
|
368
|
-
if (variant === 'full') {
|
|
369
|
-
return [
|
|
370
|
-
`${srcPrefix}modules/`,
|
|
371
|
-
` [feature]/`,
|
|
372
|
-
` components/`,
|
|
373
|
-
` ${hookDir}/`,
|
|
374
|
-
` services/`,
|
|
375
|
-
` adapters/`,
|
|
376
|
-
` stores/ # ${storeLib}`,
|
|
377
|
-
framework === 'nextjs' ? ` actions/ # Server Actions` : null,
|
|
378
|
-
` types/`,
|
|
379
|
-
` ${viewDir}/`,
|
|
380
|
-
` __tests__/`,
|
|
381
|
-
` index.ts # barrel export`,
|
|
382
|
-
`${srcPrefix}shared/`,
|
|
383
|
-
` components/`,
|
|
384
|
-
` ${hookDir}/`,
|
|
385
|
-
` services/`,
|
|
386
|
-
` types/`,
|
|
387
|
-
` utils/`,
|
|
388
|
-
` helpers/`,
|
|
389
|
-
].filter(Boolean)
|
|
390
|
-
}
|
|
391
|
-
return [
|
|
392
|
-
`${srcPrefix}modules/`,
|
|
393
|
-
` [feature]/`,
|
|
394
|
-
` components/`,
|
|
395
|
-
` ${hookDir}/`,
|
|
396
|
-
` services/`,
|
|
397
|
-
` types/`,
|
|
398
|
-
` index.ts`,
|
|
399
|
-
`${srcPrefix}shared/`,
|
|
400
|
-
` components/`,
|
|
401
|
-
` utils/`,
|
|
402
|
-
` types/`,
|
|
403
|
-
]
|
|
404
|
-
|
|
405
|
-
case 'clean':
|
|
406
|
-
if (variant === 'full') {
|
|
407
|
-
return [
|
|
408
|
-
`${srcPrefix}domain/`,
|
|
409
|
-
` entities/`,
|
|
410
|
-
` value-objects/`,
|
|
411
|
-
` repositories/ # interfaces only`,
|
|
412
|
-
` errors/`,
|
|
413
|
-
`${srcPrefix}application/`,
|
|
414
|
-
` use-cases/`,
|
|
415
|
-
` dtos/`,
|
|
416
|
-
` ports/`,
|
|
417
|
-
`${srcPrefix}infrastructure/`,
|
|
418
|
-
` database/`,
|
|
419
|
-
` http/`,
|
|
420
|
-
` messaging/`,
|
|
421
|
-
` repositories/ # implementations`,
|
|
422
|
-
`${srcPrefix}presentation/`,
|
|
423
|
-
` components/`,
|
|
424
|
-
` ${viewDir}/`,
|
|
425
|
-
` ${hookDir}/`,
|
|
426
|
-
]
|
|
427
|
-
}
|
|
428
|
-
return [
|
|
429
|
-
`${srcPrefix}core/ # domain + application`,
|
|
430
|
-
` entities/`,
|
|
431
|
-
` use-cases/`,
|
|
432
|
-
` ports/`,
|
|
433
|
-
`${srcPrefix}infra/ # infrastructure + presentation`,
|
|
434
|
-
` database/`,
|
|
435
|
-
` http/`,
|
|
436
|
-
` components/`,
|
|
437
|
-
` ${viewDir}/`,
|
|
438
|
-
]
|
|
439
|
-
|
|
440
|
-
case 'hexagonal':
|
|
441
|
-
if (variant === 'full') {
|
|
442
|
-
return [
|
|
443
|
-
`${srcPrefix}core/`,
|
|
444
|
-
` domain/`,
|
|
445
|
-
` entities/`,
|
|
446
|
-
` value-objects/`,
|
|
447
|
-
` services/`,
|
|
448
|
-
` ports/`,
|
|
449
|
-
` in/ # driving ports (use case interfaces)`,
|
|
450
|
-
` out/ # driven ports (repository interfaces)`,
|
|
451
|
-
` use-cases/`,
|
|
452
|
-
`${srcPrefix}adapters/`,
|
|
453
|
-
` in/ # driving adapters`,
|
|
454
|
-
` web/ # REST controllers / components`,
|
|
455
|
-
` cli/`,
|
|
456
|
-
` out/ # driven adapters`,
|
|
457
|
-
` database/`,
|
|
458
|
-
` http-client/`,
|
|
459
|
-
` messaging/`,
|
|
460
|
-
]
|
|
461
|
-
}
|
|
462
|
-
return [
|
|
463
|
-
`${srcPrefix}core/`,
|
|
464
|
-
` domain/`,
|
|
465
|
-
` ports/`,
|
|
466
|
-
` use-cases/`,
|
|
467
|
-
`${srcPrefix}adapters/`,
|
|
468
|
-
` web/`,
|
|
469
|
-
` database/`,
|
|
470
|
-
` http-client/`,
|
|
471
|
-
]
|
|
472
|
-
|
|
473
|
-
case 'fsd':
|
|
474
|
-
if (variant === 'full') {
|
|
475
|
-
return [
|
|
476
|
-
`${srcPrefix}app/ # app init, providers, routing`,
|
|
477
|
-
`${srcPrefix}processes/ # cross-page business flows`,
|
|
478
|
-
`${srcPrefix}pages/ # full page compositions`,
|
|
479
|
-
`${srcPrefix}widgets/ # composite UI blocks`,
|
|
480
|
-
`${srcPrefix}features/ # user interaction features`,
|
|
481
|
-
` [feature]/`,
|
|
482
|
-
` ui/`,
|
|
483
|
-
` model/`,
|
|
484
|
-
` api/`,
|
|
485
|
-
` lib/`,
|
|
486
|
-
`${srcPrefix}entities/ # business entities`,
|
|
487
|
-
` [entity]/`,
|
|
488
|
-
` ui/`,
|
|
489
|
-
` model/`,
|
|
490
|
-
` api/`,
|
|
491
|
-
`${srcPrefix}shared/ # reusable infra`,
|
|
492
|
-
` ui/`,
|
|
493
|
-
` lib/`,
|
|
494
|
-
` api/`,
|
|
495
|
-
` config/`,
|
|
496
|
-
]
|
|
497
|
-
}
|
|
498
|
-
return [
|
|
499
|
-
`${srcPrefix}app/`,
|
|
500
|
-
`${srcPrefix}pages/`,
|
|
501
|
-
`${srcPrefix}features/`,
|
|
502
|
-
` [feature]/`,
|
|
503
|
-
` ui/`,
|
|
504
|
-
` model/`,
|
|
505
|
-
`${srcPrefix}entities/`,
|
|
506
|
-
`${srcPrefix}shared/`,
|
|
507
|
-
` ui/`,
|
|
508
|
-
` lib/`,
|
|
509
|
-
]
|
|
510
|
-
|
|
511
|
-
case 'ddd':
|
|
512
|
-
if (variant === 'full') {
|
|
513
|
-
return [
|
|
514
|
-
`${srcPrefix}bounded-contexts/`,
|
|
515
|
-
` [context]/`,
|
|
516
|
-
` domain/`,
|
|
517
|
-
` aggregates/`,
|
|
518
|
-
` [aggregate]/`,
|
|
519
|
-
` AggregateRoot.ts`,
|
|
520
|
-
` Entity.ts`,
|
|
521
|
-
` ValueObject.ts`,
|
|
522
|
-
` events/`,
|
|
523
|
-
` repositories/ # interfaces`,
|
|
524
|
-
` services/`,
|
|
525
|
-
` application/`,
|
|
526
|
-
` commands/`,
|
|
527
|
-
` queries/`,
|
|
528
|
-
` handlers/`,
|
|
529
|
-
` infrastructure/`,
|
|
530
|
-
` persistence/`,
|
|
531
|
-
` messaging/`,
|
|
532
|
-
`${srcPrefix}shared-kernel/`,
|
|
533
|
-
` types/`,
|
|
534
|
-
` events/`,
|
|
535
|
-
]
|
|
536
|
-
}
|
|
537
|
-
return [
|
|
538
|
-
`${srcPrefix}modules/`,
|
|
539
|
-
` [context]/`,
|
|
540
|
-
` domain/`,
|
|
541
|
-
` entities/`,
|
|
542
|
-
` value-objects/`,
|
|
543
|
-
` events/`,
|
|
544
|
-
` application/`,
|
|
545
|
-
` handlers/`,
|
|
546
|
-
` infrastructure/`,
|
|
547
|
-
` index.ts`,
|
|
548
|
-
`${srcPrefix}shared/`,
|
|
549
|
-
]
|
|
550
|
-
|
|
551
|
-
case 'modular-monolith':
|
|
552
|
-
if (variant === 'full') {
|
|
553
|
-
return [
|
|
554
|
-
`${srcPrefix}modules/`,
|
|
555
|
-
` [module]/`,
|
|
556
|
-
` domain/`,
|
|
557
|
-
` entities/`,
|
|
558
|
-
` value-objects/`,
|
|
559
|
-
` repositories/ # interfaces`,
|
|
560
|
-
` application/`,
|
|
561
|
-
` use-cases/`,
|
|
562
|
-
` dtos/`,
|
|
563
|
-
` infrastructure/`,
|
|
564
|
-
` persistence/`,
|
|
565
|
-
` http/`,
|
|
566
|
-
` index.ts # public API`,
|
|
567
|
-
`${srcPrefix}shared/`,
|
|
568
|
-
` database/`,
|
|
569
|
-
` config/`,
|
|
570
|
-
` utils/`,
|
|
571
|
-
]
|
|
572
|
-
}
|
|
573
|
-
return [
|
|
574
|
-
`${srcPrefix}modules/`,
|
|
575
|
-
` [module]/`,
|
|
576
|
-
` services/`,
|
|
577
|
-
` types/`,
|
|
578
|
-
` index.ts`,
|
|
579
|
-
`${srcPrefix}shared/`,
|
|
580
|
-
` database/`,
|
|
581
|
-
` utils/`,
|
|
582
|
-
]
|
|
583
|
-
|
|
584
|
-
case 'cqrs':
|
|
585
|
-
if (variant === 'full') {
|
|
586
|
-
return [
|
|
587
|
-
`${srcPrefix}commands/`,
|
|
588
|
-
` CreateOrder.ts`,
|
|
589
|
-
`${srcPrefix}command-handlers/`,
|
|
590
|
-
` CreateOrderHandler.ts`,
|
|
591
|
-
`${srcPrefix}queries/`,
|
|
592
|
-
` GetOrderById.ts`,
|
|
593
|
-
`${srcPrefix}query-handlers/`,
|
|
594
|
-
` GetOrderByIdHandler.ts`,
|
|
595
|
-
`${srcPrefix}read-models/`,
|
|
596
|
-
` OrderReadModel.ts`,
|
|
597
|
-
`${srcPrefix}write-models/`,
|
|
598
|
-
` Order.ts`,
|
|
599
|
-
`${srcPrefix}events/`,
|
|
600
|
-
` OrderCreated.ts`,
|
|
601
|
-
`${srcPrefix}projections/`,
|
|
602
|
-
]
|
|
603
|
-
}
|
|
604
|
-
return [
|
|
605
|
-
`${srcPrefix}commands/`,
|
|
606
|
-
`${srcPrefix}queries/`,
|
|
607
|
-
`${srcPrefix}handlers/`,
|
|
608
|
-
`${srcPrefix}models/`,
|
|
609
|
-
`${srcPrefix}events/`,
|
|
610
|
-
]
|
|
611
|
-
|
|
612
|
-
case 'event-driven':
|
|
613
|
-
if (variant === 'full') {
|
|
614
|
-
return [
|
|
615
|
-
`${srcPrefix}events/`,
|
|
616
|
-
` OrderPlaced.ts`,
|
|
617
|
-
`${srcPrefix}handlers/`,
|
|
618
|
-
` OnOrderPlaced.ts`,
|
|
619
|
-
`${srcPrefix}publishers/`,
|
|
620
|
-
`${srcPrefix}subscribers/`,
|
|
621
|
-
`${srcPrefix}sagas/`,
|
|
622
|
-
`${srcPrefix}config/`,
|
|
623
|
-
` rabbitmq.config.ts`,
|
|
624
|
-
]
|
|
625
|
-
}
|
|
626
|
-
return [
|
|
627
|
-
`${srcPrefix}events/`,
|
|
628
|
-
`${srcPrefix}handlers/`,
|
|
629
|
-
`${srcPrefix}config/`,
|
|
630
|
-
]
|
|
631
|
-
|
|
632
|
-
case 'microservices':
|
|
633
|
-
if (variant === 'full') {
|
|
634
|
-
return [
|
|
635
|
-
`services/`,
|
|
636
|
-
` orders/`,
|
|
637
|
-
` src/`,
|
|
638
|
-
` package.json`,
|
|
639
|
-
` Dockerfile`,
|
|
640
|
-
` prisma/`,
|
|
641
|
-
` payments/`,
|
|
642
|
-
` src/`,
|
|
643
|
-
` package.json`,
|
|
644
|
-
` Dockerfile`,
|
|
645
|
-
`gateway/`,
|
|
646
|
-
` src/`,
|
|
647
|
-
` package.json`,
|
|
648
|
-
`shared/`,
|
|
649
|
-
` proto/`,
|
|
650
|
-
` events/`,
|
|
651
|
-
`docker-compose.yml`,
|
|
652
|
-
]
|
|
653
|
-
}
|
|
654
|
-
return [
|
|
655
|
-
`services/`,
|
|
656
|
-
` [service]/`,
|
|
657
|
-
` src/`,
|
|
658
|
-
` package.json`,
|
|
659
|
-
` Dockerfile`,
|
|
660
|
-
`gateway/`,
|
|
661
|
-
`shared/`,
|
|
662
|
-
`docker-compose.yml`,
|
|
663
|
-
]
|
|
664
|
-
|
|
665
|
-
case 'atomic':
|
|
666
|
-
if (variant === 'full') {
|
|
667
|
-
return [
|
|
668
|
-
`${srcPrefix}components/`,
|
|
669
|
-
` atoms/`,
|
|
670
|
-
` Button.${framework === 'vue' ? 'vue' : 'tsx'}`,
|
|
671
|
-
` Input.${framework === 'vue' ? 'vue' : 'tsx'}`,
|
|
672
|
-
` molecules/`,
|
|
673
|
-
` SearchBar.${framework === 'vue' ? 'vue' : 'tsx'}`,
|
|
674
|
-
` organisms/`,
|
|
675
|
-
` Header.${framework === 'vue' ? 'vue' : 'tsx'}`,
|
|
676
|
-
` ProductCard.${framework === 'vue' ? 'vue' : 'tsx'}`,
|
|
677
|
-
` templates/`,
|
|
678
|
-
` PageLayout.${framework === 'vue' ? 'vue' : 'tsx'}`,
|
|
679
|
-
`${srcPrefix}pages/`,
|
|
680
|
-
`${srcPrefix}${hookDir}/`,
|
|
681
|
-
`${srcPrefix}services/`,
|
|
682
|
-
`${srcPrefix}types/`,
|
|
683
|
-
]
|
|
684
|
-
}
|
|
685
|
-
return [
|
|
686
|
-
`${srcPrefix}components/`,
|
|
687
|
-
` primitives/ # atoms + molecules`,
|
|
688
|
-
` organisms/`,
|
|
689
|
-
`${srcPrefix}pages/`,
|
|
690
|
-
`${srcPrefix}services/`,
|
|
691
|
-
`${srcPrefix}types/`,
|
|
692
|
-
]
|
|
693
|
-
|
|
694
|
-
case 'mvc':
|
|
695
|
-
if (variant === 'full') {
|
|
696
|
-
return [
|
|
697
|
-
`${srcPrefix}controllers/`,
|
|
698
|
-
`${srcPrefix}services/`,
|
|
699
|
-
`${srcPrefix}repositories/`,
|
|
700
|
-
`${srcPrefix}models/`,
|
|
701
|
-
`${srcPrefix}middlewares/`,
|
|
702
|
-
`${srcPrefix}routes/`,
|
|
703
|
-
`${srcPrefix}config/`,
|
|
704
|
-
`${srcPrefix}utils/`,
|
|
705
|
-
]
|
|
706
|
-
}
|
|
707
|
-
return [
|
|
708
|
-
`${srcPrefix}services/ # controllers + services merged`,
|
|
709
|
-
`${srcPrefix}models/`,
|
|
710
|
-
`${srcPrefix}routes/`,
|
|
711
|
-
`${srcPrefix}utils/`,
|
|
712
|
-
]
|
|
713
|
-
|
|
714
|
-
default:
|
|
715
|
-
return [`${srcPrefix}# See docs/ARCHITECTURE.md for structure`]
|
|
716
|
-
}
|
|
717
|
-
}
|
|
718
|
-
|
|
719
|
-
// ── Helper Functions ──────────────────────────────────
|
|
720
|
-
|
|
721
|
-
function inferProjectType(detectionResult) {
|
|
722
|
-
const fw = detectionResult.framework
|
|
723
|
-
|
|
724
|
-
// Check if the project has backend indicators
|
|
725
|
-
const hasBackend = checkHasBackend(detectionResult)
|
|
726
|
-
|
|
727
|
-
// Next.js/Nuxt are inherently fullstack
|
|
728
|
-
if (['nextjs', 'nuxt'].includes(fw)) return 'fullstack'
|
|
729
|
-
|
|
730
|
-
// If backend indicators found
|
|
731
|
-
if (hasBackend) return 'fullstack'
|
|
732
|
-
|
|
733
|
-
// Check if it's a backend-only project (no frontend framework)
|
|
734
|
-
if (!fw) return 'backend'
|
|
735
|
-
|
|
736
|
-
return 'frontend'
|
|
737
|
-
}
|
|
738
|
-
|
|
739
|
-
function checkHasBackend(detectionResult) {
|
|
740
|
-
// Look for backend indicators in the detected architecture scores
|
|
741
|
-
const scores = detectionResult.scores || {}
|
|
742
|
-
const backendPatterns = ['mvc', 'clean', 'hexagonal', 'ddd', 'cqrs', 'event-driven', 'microservices', 'modular-monolith']
|
|
743
|
-
for (const pattern of backendPatterns) {
|
|
744
|
-
if (scores[pattern] && !scores[pattern].belowThreshold && scores[pattern].score > 3) {
|
|
745
|
-
return true
|
|
746
|
-
}
|
|
747
|
-
}
|
|
748
|
-
return false
|
|
749
|
-
}
|
|
750
|
-
|
|
751
|
-
function resolveTeamSizeCategory(teamSize, projectType) {
|
|
752
|
-
if (typeof teamSize === 'number') {
|
|
753
|
-
if (teamSize <= 3) return 'small'
|
|
754
|
-
if (teamSize <= 10) return 'medium'
|
|
755
|
-
if (teamSize <= 20) return 'large'
|
|
756
|
-
return 'enterprise'
|
|
757
|
-
}
|
|
758
|
-
// String categories
|
|
759
|
-
if (['small', 'medium', 'large', 'enterprise'].includes(teamSize)) {
|
|
760
|
-
// Validate that the category exists for the project type
|
|
761
|
-
const recs = RECOMMENDATIONS[projectType]
|
|
762
|
-
if (recs?.[teamSize]) return teamSize
|
|
763
|
-
// Fallback: enterprise -> large for frontend/backend
|
|
764
|
-
if (teamSize === 'enterprise' && !recs?.enterprise) return 'large'
|
|
765
|
-
return 'medium'
|
|
766
|
-
}
|
|
767
|
-
return 'medium'
|
|
768
|
-
}
|
|
769
|
-
|
|
770
|
-
function getArchitectureLayers(archId, framework, variant) {
|
|
771
|
-
const fw = FRAMEWORK_ADAPTATIONS[framework]
|
|
772
|
-
const adaptation = fw?.adaptations?.[archId]
|
|
773
|
-
|
|
774
|
-
if (adaptation) {
|
|
775
|
-
return variant === 'full'
|
|
776
|
-
? (adaptation.layers || adaptation.liteLayers)
|
|
777
|
-
: (adaptation.liteLayers || adaptation.layers)
|
|
778
|
-
}
|
|
779
|
-
|
|
780
|
-
// Generic layers
|
|
781
|
-
const pattern = ARCHITECTURE_PATTERNS[archId]
|
|
782
|
-
return variant === 'full'
|
|
783
|
-
? pattern?.detection?.moduleSubDirs || []
|
|
784
|
-
: (pattern?.detection?.moduleSubDirs?.slice(0, 3) || [])
|
|
785
|
-
}
|
|
786
|
-
|
|
787
|
-
function getMigrationAgents(targetArchId) {
|
|
788
|
-
const agentMap = {
|
|
789
|
-
'modular': ['@architect', '@refactor'],
|
|
790
|
-
'fsd': ['@architect', '@refactor', '@migrator'],
|
|
791
|
-
'atomic': ['@architect', '@designer'],
|
|
792
|
-
'clean': ['@architect', '@refactor'],
|
|
793
|
-
'hexagonal': ['@architect', '@refactor'],
|
|
794
|
-
'ddd': ['@architect', '@data'],
|
|
795
|
-
'cqrs': ['@architect', '@data', '@api'],
|
|
796
|
-
'event-driven': ['@architect', '@api'],
|
|
797
|
-
'microservices': ['@architect', '@devops', '@api'],
|
|
798
|
-
'modular-monolith': ['@architect', '@refactor'],
|
|
799
|
-
'mvc': ['@architect'],
|
|
800
|
-
'serverless': ['@architect', '@cloud'],
|
|
801
|
-
}
|
|
802
|
-
return agentMap[targetArchId] || ['@architect']
|
|
803
|
-
}
|
|
804
|
-
|
|
805
|
-
function reducedTeamSize(teamSize) {
|
|
806
|
-
const match = teamSize.match(/(\d+)-(\d+)/)
|
|
807
|
-
if (!match) return '1-5'
|
|
808
|
-
const min = Math.max(1, Math.floor(parseInt(match[1]) / 2))
|
|
809
|
-
const max = Math.max(min + 2, Math.floor(parseInt(match[2]) / 2))
|
|
810
|
-
return `${min}-${max}`
|
|
811
|
-
}
|
|
812
|
-
|
|
813
|
-
// ── Format Report for CLI Display ─────────────────────
|
|
814
|
-
|
|
815
|
-
export function formatRecommendationsForCLI(recs) {
|
|
816
|
-
const lines = []
|
|
817
|
-
|
|
818
|
-
// Current state
|
|
819
|
-
const currentPattern = ARCHITECTURE_PATTERNS[recs.currentArchitecture]
|
|
820
|
-
if (currentPattern) {
|
|
821
|
-
lines.push(`Current: ${currentPattern.name}`)
|
|
822
|
-
lines.push('')
|
|
823
|
-
}
|
|
824
|
-
|
|
825
|
-
// Reason
|
|
826
|
-
lines.push(recs.reason)
|
|
827
|
-
lines.push('')
|
|
828
|
-
|
|
829
|
-
// Monorepo note
|
|
830
|
-
if (recs.monorepoNote) {
|
|
831
|
-
lines.push(recs.monorepoNote)
|
|
832
|
-
lines.push('')
|
|
833
|
-
}
|
|
834
|
-
|
|
835
|
-
// Recommendations
|
|
836
|
-
for (const rec of recs.recommendations) {
|
|
837
|
-
const tagLabel = rec.tag === 'recommended' ? 'RECOMMENDED'
|
|
838
|
-
: rec.tag === 'backend-recommended' ? 'BACKEND'
|
|
839
|
-
: 'ALTERNATIVE'
|
|
840
|
-
const sameNote = rec.isSameArch ? ' (current)' : ''
|
|
841
|
-
|
|
842
|
-
lines.push(`[${tagLabel}] ${rec.name}${sameNote}`)
|
|
843
|
-
lines.push(` ${rec.description}`)
|
|
844
|
-
|
|
845
|
-
if (rec.migration) {
|
|
846
|
-
lines.push(` Migration effort: ${rec.migration.effort}`)
|
|
847
|
-
lines.push(` ${rec.migration.description}`)
|
|
848
|
-
lines.push(` Agents: ${rec.migration.agents.join(', ')}`)
|
|
849
|
-
}
|
|
850
|
-
|
|
851
|
-
lines.push(` Variants:`)
|
|
852
|
-
for (const v of rec.variants) {
|
|
853
|
-
lines.push(` ${v.name}: ${v.description.slice(0, 80)}...`)
|
|
854
|
-
}
|
|
855
|
-
lines.push('')
|
|
856
|
-
}
|
|
857
|
-
|
|
858
|
-
// Framework notes
|
|
859
|
-
if (recs.frameworkNotes) {
|
|
860
|
-
lines.push('Framework-specific notes:')
|
|
861
|
-
for (const note of recs.frameworkNotes.extraNotes) {
|
|
862
|
-
lines.push(` - ${note}`)
|
|
863
|
-
}
|
|
864
|
-
if (recs.frameworkNotes.preferredStateManagement) {
|
|
865
|
-
lines.push(` State: ${recs.frameworkNotes.preferredStateManagement}`)
|
|
866
|
-
}
|
|
867
|
-
}
|
|
868
|
-
|
|
869
|
-
return lines.join('\n')
|
|
870
|
-
}
|