specialist-agent 2.13.0 → 3.3.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 +36 -206
- package/dist/catalog.json +16677 -0
- package/dist/hw-worker.mjs +288 -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-BltVv7tb.js +24 -0
- package/dist/interface/assets/index-Cpa6kApK.css +1 -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 +64 -0
- package/dist/licencas/BRAND.md +22 -0
- package/dist/licencas/LICENSE-CONTENT.md +44 -0
- package/dist/licencas/OFL-Figtree.txt +93 -0
- package/dist/licencas/OFL-JetBrainsMono.txt +93 -0
- package/dist/licencas/OFL-Unbounded.txt +93 -0
- package/dist/licencas/TERCEIROS.txt +104 -0
- package/dist/specialist-agent.mjs +14515 -0
- package/dist/usage-worker.mjs +1077 -0
- package/package.json +34 -58
- 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,1096 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Architecture Guide Generator
|
|
3
|
-
*
|
|
4
|
-
* Generates framework-specific ARCHITECTURE.md files for any
|
|
5
|
-
* architecture pattern + framework + variant combination.
|
|
6
|
-
*
|
|
7
|
-
* Uses the existing pack ARCHITECTURE.md files as the base for 'modular'
|
|
8
|
-
* pattern, and generates new ones for other patterns by adapting the
|
|
9
|
-
* structure to the target architecture while preserving framework-specific
|
|
10
|
-
* conventions (Server Components, composables, etc.)
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
import { existsSync, readFileSync } from 'fs'
|
|
14
|
-
import { join, resolve, dirname } from 'path'
|
|
15
|
-
import { fileURLToPath } from 'url'
|
|
16
|
-
import { ARCHITECTURE_PATTERNS, FRAMEWORK_ADAPTATIONS } from './architectures.mjs'
|
|
17
|
-
|
|
18
|
-
const __filename = fileURLToPath(import.meta.url)
|
|
19
|
-
const __dirname = dirname(__filename)
|
|
20
|
-
const ROOT = resolve(__dirname, '..')
|
|
21
|
-
|
|
22
|
-
// ── Main Generator ────────────────────────────────────
|
|
23
|
-
|
|
24
|
-
export function generateArchitectureGuide(options) {
|
|
25
|
-
const {
|
|
26
|
-
architecture, // 'modular', 'clean', 'hexagonal', 'fsd', 'ddd', etc.
|
|
27
|
-
framework, // 'nextjs', 'react', 'vue', 'nuxt', 'svelte', 'angular', 'astro'
|
|
28
|
-
variant = 'full', // 'full' | 'lite'
|
|
29
|
-
nextjsRouter = null, // 'app-router' | 'pages-router' | null
|
|
30
|
-
} = options
|
|
31
|
-
|
|
32
|
-
// For modular architecture, use the existing pack ARCHITECTURE.md if available
|
|
33
|
-
if (architecture === 'modular' && variant === 'full') {
|
|
34
|
-
const packArchPath = join(ROOT, 'packs', framework, 'ARCHITECTURE.md')
|
|
35
|
-
if (existsSync(packArchPath)) {
|
|
36
|
-
return readFileSync(packArchPath, 'utf-8')
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// Generate from template
|
|
41
|
-
const generator = GENERATORS[architecture]
|
|
42
|
-
if (!generator) {
|
|
43
|
-
return generateGenericGuide(architecture, framework, variant)
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return generator(framework, variant, { nextjsRouter })
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// ── Framework Helpers ─────────────────────────────────
|
|
50
|
-
|
|
51
|
-
function fw(framework) {
|
|
52
|
-
const configs = {
|
|
53
|
-
nextjs: {
|
|
54
|
-
name: 'Next.js',
|
|
55
|
-
lang: 'TypeScript',
|
|
56
|
-
componentExt: 'tsx',
|
|
57
|
-
hookDir: 'hooks',
|
|
58
|
-
hookPrefix: 'use',
|
|
59
|
-
stateClient: 'Zustand',
|
|
60
|
-
stateServer: 'TanStack React Query',
|
|
61
|
-
testLib: 'Vitest + React Testing Library',
|
|
62
|
-
validation: 'Zod',
|
|
63
|
-
styling: 'Tailwind CSS / CSS Modules',
|
|
64
|
-
router: 'App Router (file-system)',
|
|
65
|
-
componentPattern: 'React Server Components + Client Components',
|
|
66
|
-
},
|
|
67
|
-
react: {
|
|
68
|
-
name: 'React',
|
|
69
|
-
lang: 'TypeScript',
|
|
70
|
-
componentExt: 'tsx',
|
|
71
|
-
hookDir: 'hooks',
|
|
72
|
-
hookPrefix: 'use',
|
|
73
|
-
stateClient: 'Zustand',
|
|
74
|
-
stateServer: 'TanStack React Query',
|
|
75
|
-
testLib: 'Vitest + React Testing Library',
|
|
76
|
-
validation: 'Zod',
|
|
77
|
-
styling: 'Tailwind CSS / CSS Modules',
|
|
78
|
-
router: 'React Router 6',
|
|
79
|
-
componentPattern: 'Functional Components',
|
|
80
|
-
},
|
|
81
|
-
vue: {
|
|
82
|
-
name: 'Vue 3',
|
|
83
|
-
lang: 'TypeScript',
|
|
84
|
-
componentExt: 'vue',
|
|
85
|
-
hookDir: 'composables',
|
|
86
|
-
hookPrefix: 'use',
|
|
87
|
-
stateClient: 'Pinia',
|
|
88
|
-
stateServer: 'TanStack Vue Query',
|
|
89
|
-
testLib: 'Vitest + @vue/test-utils',
|
|
90
|
-
validation: 'Zod',
|
|
91
|
-
styling: 'Scoped CSS / Tailwind',
|
|
92
|
-
router: 'Vue Router 4',
|
|
93
|
-
componentPattern: '<script setup lang="ts">',
|
|
94
|
-
},
|
|
95
|
-
nuxt: {
|
|
96
|
-
name: 'Nuxt 3',
|
|
97
|
-
lang: 'TypeScript',
|
|
98
|
-
componentExt: 'vue',
|
|
99
|
-
hookDir: 'composables',
|
|
100
|
-
hookPrefix: 'use',
|
|
101
|
-
stateClient: 'Pinia',
|
|
102
|
-
stateServer: 'TanStack Vue Query',
|
|
103
|
-
testLib: 'Vitest + @vue/test-utils',
|
|
104
|
-
validation: 'Zod',
|
|
105
|
-
styling: 'Scoped CSS / Tailwind',
|
|
106
|
-
router: 'File-based routing (pages/)',
|
|
107
|
-
componentPattern: '<script setup lang="ts"> + auto-imports',
|
|
108
|
-
},
|
|
109
|
-
svelte: {
|
|
110
|
-
name: 'SvelteKit',
|
|
111
|
-
lang: 'TypeScript',
|
|
112
|
-
componentExt: 'svelte',
|
|
113
|
-
hookDir: 'stores',
|
|
114
|
-
hookPrefix: '',
|
|
115
|
-
stateClient: 'Svelte stores',
|
|
116
|
-
stateServer: 'TanStack Svelte Query',
|
|
117
|
-
testLib: 'Vitest + @testing-library/svelte',
|
|
118
|
-
validation: 'Zod',
|
|
119
|
-
styling: 'Scoped CSS / Tailwind',
|
|
120
|
-
router: 'File-based routing (+page.svelte)',
|
|
121
|
-
componentPattern: 'Svelte Components + Load Functions',
|
|
122
|
-
},
|
|
123
|
-
angular: {
|
|
124
|
-
name: 'Angular',
|
|
125
|
-
lang: 'TypeScript',
|
|
126
|
-
componentExt: 'ts',
|
|
127
|
-
hookDir: 'services',
|
|
128
|
-
hookPrefix: '',
|
|
129
|
-
stateClient: 'NgRx Signals',
|
|
130
|
-
stateServer: 'TanStack Angular Query',
|
|
131
|
-
testLib: 'Vitest + Angular Testing Library',
|
|
132
|
-
validation: 'Zod',
|
|
133
|
-
styling: 'Component styles / Tailwind',
|
|
134
|
-
router: 'Angular Router (lazy-loaded)',
|
|
135
|
-
componentPattern: 'Standalone Components + Signals',
|
|
136
|
-
},
|
|
137
|
-
astro: {
|
|
138
|
-
name: 'Astro',
|
|
139
|
-
lang: 'TypeScript',
|
|
140
|
-
componentExt: 'astro',
|
|
141
|
-
hookDir: 'utils',
|
|
142
|
-
hookPrefix: '',
|
|
143
|
-
stateClient: 'Nanostores',
|
|
144
|
-
stateServer: 'Astro data fetching',
|
|
145
|
-
testLib: 'Vitest',
|
|
146
|
-
validation: 'Zod',
|
|
147
|
-
styling: 'Scoped CSS / Tailwind',
|
|
148
|
-
router: 'File-based routing (pages/)',
|
|
149
|
-
componentPattern: 'Astro Components + Framework Islands',
|
|
150
|
-
},
|
|
151
|
-
}
|
|
152
|
-
return configs[framework] || configs.react
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
// ── Architecture Generators ───────────────────────────
|
|
156
|
-
|
|
157
|
-
const GENERATORS = {
|
|
158
|
-
modular: generateModularGuide,
|
|
159
|
-
'modular-lite': generateModularLiteGuide,
|
|
160
|
-
clean: generateCleanGuide,
|
|
161
|
-
hexagonal: generateHexagonalGuide,
|
|
162
|
-
fsd: generateFSDGuide,
|
|
163
|
-
ddd: generateDDDGuide,
|
|
164
|
-
'modular-monolith': generateModularMonolithGuide,
|
|
165
|
-
cqrs: generateCQRSGuide,
|
|
166
|
-
atomic: generateAtomicGuide,
|
|
167
|
-
mvc: generateMVCGuide,
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
function generateModularGuide(framework, variant, options) {
|
|
171
|
-
if (variant === 'lite') return generateModularLiteGuide(framework, variant, options)
|
|
172
|
-
const f = fw(framework)
|
|
173
|
-
const srcPrefix = framework === 'nuxt' ? '' : 'src/'
|
|
174
|
-
|
|
175
|
-
return `# ARCHITECTURE.md -- Architecture & Patterns Guide (${f.name})
|
|
176
|
-
|
|
177
|
-
> This document is the **source of truth** for all subagents.
|
|
178
|
-
> Every architectural decision must be documented here.
|
|
179
|
-
|
|
180
|
-
---
|
|
181
|
-
|
|
182
|
-
## 1. Overview
|
|
183
|
-
|
|
184
|
-
| Concept | Implementation |
|
|
185
|
-
|---------|---------------|
|
|
186
|
-
| Framework | ${f.name} |
|
|
187
|
-
| Language | ${f.lang} (strict) |
|
|
188
|
-
| Architecture | Modular (Feature-Based) -- Full |
|
|
189
|
-
| Components | ${f.componentPattern} |
|
|
190
|
-
| Client state | ${f.stateClient} |
|
|
191
|
-
| Server state | ${f.stateServer} |
|
|
192
|
-
| Routing | ${f.router} |
|
|
193
|
-
| Testing | ${f.testLib} |
|
|
194
|
-
| Validation | ${f.validation} |
|
|
195
|
-
|
|
196
|
-
### Architecture Flow
|
|
197
|
-
|
|
198
|
-
\`\`\`
|
|
199
|
-
Service (HTTP only) --> Adapter (parse) --> ${f.hookDir === 'composables' ? 'Composable' : 'Hook'} (orchestrate) --> Component
|
|
200
|
-
\`\`\`
|
|
201
|
-
|
|
202
|
-
---
|
|
203
|
-
|
|
204
|
-
## 2. Directory Structure
|
|
205
|
-
|
|
206
|
-
\`\`\`
|
|
207
|
-
${srcPrefix}
|
|
208
|
-
├── modules/ # Feature modules (bounded contexts)
|
|
209
|
-
│ ├── [feature]/
|
|
210
|
-
│ │ ├── components/
|
|
211
|
-
│ │ ├── ${f.hookDir}/
|
|
212
|
-
│ │ ├── services/
|
|
213
|
-
│ │ ├── adapters/
|
|
214
|
-
│ │ ├── stores/
|
|
215
|
-
│ │ ├── types/
|
|
216
|
-
│ │ ├── __tests__/
|
|
217
|
-
│ │ └── index.ts # Barrel export (public API)
|
|
218
|
-
│
|
|
219
|
-
├── shared/ # Shared across modules
|
|
220
|
-
│ ├── components/
|
|
221
|
-
│ ├── ${f.hookDir}/
|
|
222
|
-
│ ├── services/
|
|
223
|
-
│ ├── types/
|
|
224
|
-
│ ├── utils/ # Pure functions
|
|
225
|
-
│ └── helpers/ # Functions with side effects
|
|
226
|
-
\`\`\`
|
|
227
|
-
|
|
228
|
-
### Import Rules
|
|
229
|
-
|
|
230
|
-
\`\`\`
|
|
231
|
-
modules/auth <-> shared/ OK
|
|
232
|
-
modules/auth --> modules/market NO (modules don't import from each other)
|
|
233
|
-
shared/ --> modules/auth NO (shared doesn't import from modules)
|
|
234
|
-
\`\`\`
|
|
235
|
-
|
|
236
|
-
---
|
|
237
|
-
|
|
238
|
-
## 3. Responsibility Layers
|
|
239
|
-
|
|
240
|
-
### Services -- Pure HTTP Calls
|
|
241
|
-
- NO try/catch, NO transformation, NO business logic
|
|
242
|
-
- One file per domain/resource
|
|
243
|
-
- Export as object with methods
|
|
244
|
-
|
|
245
|
-
### Adapters -- Contract Parsers
|
|
246
|
-
- Pure functions: API response <-> App contract
|
|
247
|
-
- Rename fields (snake_case -> camelCase)
|
|
248
|
-
- Convert types (string -> Date, cents -> decimal)
|
|
249
|
-
|
|
250
|
-
### ${f.hookDir === 'composables' ? 'Composables' : 'Hooks'} -- Orchestration
|
|
251
|
-
- Connect service -> adapter -> ${f.stateServer}
|
|
252
|
-
- Manage loading, error, empty states
|
|
253
|
-
- Prefix with \`${f.hookPrefix}\`
|
|
254
|
-
|
|
255
|
-
### Stores -- Client State Only
|
|
256
|
-
- ${f.stateClient} for UI state, filters, preferences
|
|
257
|
-
- NO server state (use ${f.stateServer} instead)
|
|
258
|
-
- NO HTTP calls inside stores
|
|
259
|
-
|
|
260
|
-
### Types
|
|
261
|
-
- \`.types.ts\` for API types (raw response, snake_case)
|
|
262
|
-
- \`.contracts.ts\` for app contracts (camelCase, correct types)
|
|
263
|
-
- NO \`any\`
|
|
264
|
-
|
|
265
|
-
---
|
|
266
|
-
|
|
267
|
-
## 4. Rules
|
|
268
|
-
|
|
269
|
-
- Components < 200 lines, typed props
|
|
270
|
-
- Barrel exports (index.ts) per module
|
|
271
|
-
- Utils = pure functions | Helpers = side effects
|
|
272
|
-
- Error handling: centralized in ${f.hookDir} layer
|
|
273
|
-
`
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
function generateModularLiteGuide(framework, variant, options) {
|
|
277
|
-
const f = fw(framework)
|
|
278
|
-
const srcPrefix = framework === 'nuxt' ? '' : 'src/'
|
|
279
|
-
|
|
280
|
-
return `# ARCHITECTURE.md -- Architecture & Patterns Guide (${f.name})
|
|
281
|
-
|
|
282
|
-
> Simplified Modular Architecture -- fewer layers, same principles.
|
|
283
|
-
|
|
284
|
-
---
|
|
285
|
-
|
|
286
|
-
## 1. Overview
|
|
287
|
-
|
|
288
|
-
| Concept | Implementation |
|
|
289
|
-
|---------|---------------|
|
|
290
|
-
| Framework | ${f.name} |
|
|
291
|
-
| Language | ${f.lang} (strict) |
|
|
292
|
-
| Architecture | Modular (Feature-Based) -- Simplified |
|
|
293
|
-
| Client state | ${f.stateClient} |
|
|
294
|
-
| Server state | ${f.stateServer} |
|
|
295
|
-
|
|
296
|
-
### Architecture Flow
|
|
297
|
-
|
|
298
|
-
\`\`\`
|
|
299
|
-
Service (HTTP + transform) --> ${f.hookDir === 'composables' ? 'Composable' : 'Hook'} (orchestrate) --> Component
|
|
300
|
-
\`\`\`
|
|
301
|
-
|
|
302
|
-
---
|
|
303
|
-
|
|
304
|
-
## 2. Directory Structure
|
|
305
|
-
|
|
306
|
-
\`\`\`
|
|
307
|
-
${srcPrefix}
|
|
308
|
-
├── modules/
|
|
309
|
-
│ ├── [feature]/
|
|
310
|
-
│ │ ├── components/
|
|
311
|
-
│ │ ├── ${f.hookDir}/
|
|
312
|
-
│ │ ├── services/ # HTTP + data transformation (no separate adapters)
|
|
313
|
-
│ │ ├── types/
|
|
314
|
-
│ │ └── index.ts
|
|
315
|
-
│
|
|
316
|
-
├── shared/
|
|
317
|
-
│ ├── components/
|
|
318
|
-
│ ├── utils/
|
|
319
|
-
│ └── types/
|
|
320
|
-
\`\`\`
|
|
321
|
-
|
|
322
|
-
### Key Differences from Full
|
|
323
|
-
|
|
324
|
-
- **No adapters/**: data transformation done in services directly
|
|
325
|
-
- **No stores/**: co-locate state with ${f.hookDir}
|
|
326
|
-
- **No helpers/**: merge into utils or ${f.hookDir}
|
|
327
|
-
- Same import rules: modules don't import from each other
|
|
328
|
-
|
|
329
|
-
---
|
|
330
|
-
|
|
331
|
-
## 3. Rules
|
|
332
|
-
|
|
333
|
-
- Services: HTTP calls + response transformation (combined)
|
|
334
|
-
- ${f.hookDir === 'composables' ? 'Composables' : 'Hooks'}: orchestrate service calls + manage state
|
|
335
|
-
- Types: \`.types.ts\` for API + app contracts (single file per domain)
|
|
336
|
-
- Components < 200 lines, typed props
|
|
337
|
-
- Barrel exports (index.ts) per module
|
|
338
|
-
`
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
function generateCleanGuide(framework, variant, options) {
|
|
342
|
-
const f = fw(framework)
|
|
343
|
-
const srcPrefix = framework === 'nuxt' ? '' : 'src/'
|
|
344
|
-
const isLite = variant === 'lite'
|
|
345
|
-
|
|
346
|
-
if (isLite) {
|
|
347
|
-
return `# ARCHITECTURE.md -- Clean Architecture Simplified (${f.name})
|
|
348
|
-
|
|
349
|
-
> Two-layer Clean Architecture: Core + Infrastructure.
|
|
350
|
-
|
|
351
|
-
---
|
|
352
|
-
|
|
353
|
-
## 1. Overview
|
|
354
|
-
|
|
355
|
-
| Concept | Implementation |
|
|
356
|
-
|---------|---------------|
|
|
357
|
-
| Framework | ${f.name} |
|
|
358
|
-
| Architecture | Clean Architecture -- Simplified |
|
|
359
|
-
| Dependency Rule | core/ has ZERO framework imports |
|
|
360
|
-
|
|
361
|
-
---
|
|
362
|
-
|
|
363
|
-
## 2. Directory Structure
|
|
364
|
-
|
|
365
|
-
\`\`\`
|
|
366
|
-
${srcPrefix}
|
|
367
|
-
├── core/ # Domain + Application (merged)
|
|
368
|
-
│ ├── entities/ # Business objects (pure TS)
|
|
369
|
-
│ ├── use-cases/ # Application logic
|
|
370
|
-
│ └── ports/ # Interfaces for external deps
|
|
371
|
-
│
|
|
372
|
-
├── infra/ # Infrastructure + Presentation (merged)
|
|
373
|
-
│ ├── database/ # Repository implementations
|
|
374
|
-
│ ├── http/ # API clients, REST controllers
|
|
375
|
-
│ ├── components/ # UI components
|
|
376
|
-
│ └── ${f.hookDir}/
|
|
377
|
-
\`\`\`
|
|
378
|
-
|
|
379
|
-
### Dependency Rule
|
|
380
|
-
|
|
381
|
-
\`\`\`
|
|
382
|
-
infra/ --> core/ OK (infra implements core interfaces)
|
|
383
|
-
core/ --> infra/ NEVER (core has no external dependencies)
|
|
384
|
-
\`\`\`
|
|
385
|
-
|
|
386
|
-
---
|
|
387
|
-
|
|
388
|
-
## 3. Key Rules
|
|
389
|
-
|
|
390
|
-
- **core/** has ZERO imports from framework (${f.name}), database, or HTTP libraries
|
|
391
|
-
- **ports/** define interfaces that **infra/** implements
|
|
392
|
-
- Use cases contain business logic, not components or services
|
|
393
|
-
- Entities are pure TypeScript objects with behavior
|
|
394
|
-
`
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
return `# ARCHITECTURE.md -- Clean Architecture (${f.name})
|
|
398
|
-
|
|
399
|
-
> Four-layer Clean Architecture with strict dependency rule.
|
|
400
|
-
> Dependencies point INWARD only: Frameworks -> Adapters -> Use Cases -> Entities.
|
|
401
|
-
|
|
402
|
-
---
|
|
403
|
-
|
|
404
|
-
## 1. Overview
|
|
405
|
-
|
|
406
|
-
| Concept | Implementation |
|
|
407
|
-
|---------|---------------|
|
|
408
|
-
| Framework | ${f.name} |
|
|
409
|
-
| Architecture | Clean Architecture -- Full |
|
|
410
|
-
| Client state | ${f.stateClient} |
|
|
411
|
-
| Server state | ${f.stateServer} |
|
|
412
|
-
| Dependency Rule | All dependencies point INWARD |
|
|
413
|
-
|
|
414
|
-
---
|
|
415
|
-
|
|
416
|
-
## 2. Directory Structure
|
|
417
|
-
|
|
418
|
-
\`\`\`
|
|
419
|
-
${srcPrefix}
|
|
420
|
-
├── domain/ # Innermost: Enterprise Business Rules
|
|
421
|
-
│ ├── entities/ # Business objects with behavior
|
|
422
|
-
│ ├── value-objects/ # Immutable, equality by value
|
|
423
|
-
│ ├── repositories/ # Interfaces ONLY (no implementations)
|
|
424
|
-
│ └── errors/ # Domain-specific errors
|
|
425
|
-
│
|
|
426
|
-
├── application/ # Use Cases: Application Business Rules
|
|
427
|
-
│ ├── use-cases/ # One class per use case
|
|
428
|
-
│ ├── dtos/ # Data Transfer Objects
|
|
429
|
-
│ └── ports/ # Input/Output interfaces
|
|
430
|
-
│
|
|
431
|
-
├── infrastructure/ # Outer: Frameworks & Drivers
|
|
432
|
-
│ ├── database/ # Repository implementations
|
|
433
|
-
│ ├── http/ # API clients, external services
|
|
434
|
-
│ ├── messaging/ # Message queue adapters
|
|
435
|
-
│ └── repositories/ # Concrete repository implementations
|
|
436
|
-
│
|
|
437
|
-
├── presentation/ # Outer: UI Layer
|
|
438
|
-
│ ├── components/ # ${f.componentPattern}
|
|
439
|
-
│ ├── ${f.hookDir}/
|
|
440
|
-
│ ├── stores/ # ${f.stateClient}
|
|
441
|
-
│ └── pages/
|
|
442
|
-
\`\`\`
|
|
443
|
-
|
|
444
|
-
### Dependency Rule (Iron Law)
|
|
445
|
-
|
|
446
|
-
\`\`\`
|
|
447
|
-
presentation/ --> application/ OK (uses use cases)
|
|
448
|
-
presentation/ --> domain/ OK (uses entities/types)
|
|
449
|
-
presentation/ --> infrastructure/ NEVER
|
|
450
|
-
infrastructure/ --> application/ OK (implements ports)
|
|
451
|
-
infrastructure/ --> domain/ OK (implements repositories)
|
|
452
|
-
application/ --> domain/ OK (uses entities)
|
|
453
|
-
application/ --> infrastructure/ NEVER
|
|
454
|
-
domain/ --> anything NEVER (zero external deps)
|
|
455
|
-
\`\`\`
|
|
456
|
-
|
|
457
|
-
---
|
|
458
|
-
|
|
459
|
-
## 3. Key Layers
|
|
460
|
-
|
|
461
|
-
### Domain (entities/, value-objects/)
|
|
462
|
-
- Pure TypeScript, no framework imports
|
|
463
|
-
- Business rules live here
|
|
464
|
-
- Repository interfaces (not implementations)
|
|
465
|
-
|
|
466
|
-
### Application (use-cases/)
|
|
467
|
-
- One class/function per use case: \`CreateOrder\`, \`GetUserById\`
|
|
468
|
-
- Depends only on domain
|
|
469
|
-
- DTOs for input/output
|
|
470
|
-
|
|
471
|
-
### Infrastructure (database/, http/)
|
|
472
|
-
- Implements domain interfaces
|
|
473
|
-
- Database, HTTP clients, message queues
|
|
474
|
-
- Framework-specific code lives here
|
|
475
|
-
|
|
476
|
-
### Presentation (components/, ${f.hookDir}/)
|
|
477
|
-
- ${f.componentPattern}
|
|
478
|
-
- ${f.hookDir} orchestrate use cases
|
|
479
|
-
- ${f.stateClient} for UI state only
|
|
480
|
-
|
|
481
|
-
---
|
|
482
|
-
|
|
483
|
-
## 4. Rules
|
|
484
|
-
|
|
485
|
-
- domain/ has ZERO imports from any other layer
|
|
486
|
-
- application/ only imports from domain/
|
|
487
|
-
- Use case per file (Single Responsibility)
|
|
488
|
-
- Repository pattern: interface in domain/, implementation in infrastructure/
|
|
489
|
-
- DTOs at layer boundaries (never pass entities to presentation)
|
|
490
|
-
`
|
|
491
|
-
}
|
|
492
|
-
|
|
493
|
-
function generateHexagonalGuide(framework, variant, options) {
|
|
494
|
-
const f = fw(framework)
|
|
495
|
-
const srcPrefix = framework === 'nuxt' ? '' : 'src/'
|
|
496
|
-
const isLite = variant === 'lite'
|
|
497
|
-
|
|
498
|
-
if (isLite) {
|
|
499
|
-
return `# ARCHITECTURE.md -- Hexagonal Architecture Simplified (${f.name})
|
|
500
|
-
|
|
501
|
-
> Ports & Adapters with flat structure.
|
|
502
|
-
|
|
503
|
-
---
|
|
504
|
-
|
|
505
|
-
## 1. Directory Structure
|
|
506
|
-
|
|
507
|
-
\`\`\`
|
|
508
|
-
${srcPrefix}
|
|
509
|
-
├── core/ # Domain + Use Cases
|
|
510
|
-
│ ├── domain/ # Entities, value objects
|
|
511
|
-
│ ├── ports/ # All interfaces (no in/out split)
|
|
512
|
-
│ └── use-cases/ # Application logic
|
|
513
|
-
│
|
|
514
|
-
├── adapters/ # All implementations (no in/out split)
|
|
515
|
-
│ ├── web/ # ${f.componentPattern}
|
|
516
|
-
│ ├── database/ # Repository implementations
|
|
517
|
-
│ └── http-client/ # External API clients
|
|
518
|
-
\`\`\`
|
|
519
|
-
|
|
520
|
-
### Rule
|
|
521
|
-
|
|
522
|
-
\`\`\`
|
|
523
|
-
core/ has ZERO external dependencies
|
|
524
|
-
adapters/ implement core/ports/ interfaces
|
|
525
|
-
\`\`\`
|
|
526
|
-
`
|
|
527
|
-
}
|
|
528
|
-
|
|
529
|
-
return `# ARCHITECTURE.md -- Hexagonal Architecture (${f.name})
|
|
530
|
-
|
|
531
|
-
> Ports & Adapters: Core domain isolated by explicit interfaces.
|
|
532
|
-
|
|
533
|
-
---
|
|
534
|
-
|
|
535
|
-
## 1. Overview
|
|
536
|
-
|
|
537
|
-
| Concept | Implementation |
|
|
538
|
-
|---------|---------------|
|
|
539
|
-
| Framework | ${f.name} |
|
|
540
|
-
| Architecture | Hexagonal (Ports & Adapters) -- Full |
|
|
541
|
-
| Core | Domain model with zero external dependencies |
|
|
542
|
-
| Ports | Interfaces that define how the core communicates |
|
|
543
|
-
| Adapters | Implementations that connect the core to the outside world |
|
|
544
|
-
|
|
545
|
-
---
|
|
546
|
-
|
|
547
|
-
## 2. Directory Structure
|
|
548
|
-
|
|
549
|
-
\`\`\`
|
|
550
|
-
${srcPrefix}
|
|
551
|
-
├── core/
|
|
552
|
-
│ ├── domain/
|
|
553
|
-
│ │ ├── entities/
|
|
554
|
-
│ │ ├── value-objects/
|
|
555
|
-
│ │ └── services/ # Domain services
|
|
556
|
-
│ ├── ports/
|
|
557
|
-
│ │ ├── in/ # Driving ports (use case interfaces)
|
|
558
|
-
│ │ └── out/ # Driven ports (repository/external interfaces)
|
|
559
|
-
│ └── use-cases/ # Implements driving ports
|
|
560
|
-
│
|
|
561
|
-
├── adapters/
|
|
562
|
-
│ ├── in/ # Driving adapters (trigger the app)
|
|
563
|
-
│ │ ├── web/ # ${f.componentPattern}, controllers
|
|
564
|
-
│ │ └── cli/ # CLI commands (if applicable)
|
|
565
|
-
│ └── out/ # Driven adapters (called by the app)
|
|
566
|
-
│ ├── database/ # Repository implementations
|
|
567
|
-
│ ├── http-client/ # External API clients
|
|
568
|
-
│ └── messaging/ # Message broker adapters
|
|
569
|
-
\`\`\`
|
|
570
|
-
|
|
571
|
-
### Port & Adapter Flow
|
|
572
|
-
|
|
573
|
-
\`\`\`
|
|
574
|
-
[User/External] -> Driving Adapter -> Driving Port -> Use Case -> Driven Port -> Driven Adapter -> [DB/API/Queue]
|
|
575
|
-
\`\`\`
|
|
576
|
-
|
|
577
|
-
---
|
|
578
|
-
|
|
579
|
-
## 3. Key Rules
|
|
580
|
-
|
|
581
|
-
- **core/** has ZERO imports from adapters/ or any framework
|
|
582
|
-
- **Ports** are interfaces defined in core/
|
|
583
|
-
- **Adapters** implement port interfaces
|
|
584
|
-
- Driving adapters (in/) trigger application logic
|
|
585
|
-
- Driven adapters (out/) are called by application logic
|
|
586
|
-
- Use cases implement driving ports and consume driven ports
|
|
587
|
-
- To swap infrastructure (e.g., PostgreSQL -> MongoDB), only change the adapter
|
|
588
|
-
`
|
|
589
|
-
}
|
|
590
|
-
|
|
591
|
-
function generateFSDGuide(framework, variant, options) {
|
|
592
|
-
const f = fw(framework)
|
|
593
|
-
const srcPrefix = framework === 'nuxt' ? '' : 'src/'
|
|
594
|
-
const isLite = variant === 'lite'
|
|
595
|
-
|
|
596
|
-
const layers = isLite
|
|
597
|
-
? `\`\`\`
|
|
598
|
-
${srcPrefix}
|
|
599
|
-
├── app/ # App init, providers, routing
|
|
600
|
-
├── pages/ # Full page compositions
|
|
601
|
-
├── features/ # User interaction units
|
|
602
|
-
│ └── [feature]/
|
|
603
|
-
│ ├── ui/
|
|
604
|
-
│ └── model/
|
|
605
|
-
├── entities/ # Business entities
|
|
606
|
-
│ └── [entity]/
|
|
607
|
-
│ ├── ui/
|
|
608
|
-
│ └── model/
|
|
609
|
-
└── shared/ # Reusable infrastructure
|
|
610
|
-
├── ui/
|
|
611
|
-
└── lib/
|
|
612
|
-
\`\`\``
|
|
613
|
-
: `\`\`\`
|
|
614
|
-
${srcPrefix}
|
|
615
|
-
├── app/ # App init, providers, global styles
|
|
616
|
-
├── processes/ # Cross-page business flows (optional)
|
|
617
|
-
├── pages/ # Full page compositions
|
|
618
|
-
├── widgets/ # Composite UI blocks
|
|
619
|
-
├── features/ # User interaction units
|
|
620
|
-
│ └── [feature]/
|
|
621
|
-
│ ├── ui/ # Components
|
|
622
|
-
│ ├── model/ # State, types, logic
|
|
623
|
-
│ ├── api/ # API calls
|
|
624
|
-
│ └── lib/ # Utils
|
|
625
|
-
├── entities/ # Business entities
|
|
626
|
-
│ └── [entity]/
|
|
627
|
-
│ ├── ui/
|
|
628
|
-
│ ├── model/
|
|
629
|
-
│ └── api/
|
|
630
|
-
└── shared/ # Reusable infrastructure
|
|
631
|
-
├── ui/ # Design system components
|
|
632
|
-
├── lib/ # Utilities
|
|
633
|
-
├── api/ # API client
|
|
634
|
-
└── config/ # App config
|
|
635
|
-
\`\`\``
|
|
636
|
-
|
|
637
|
-
return `# ARCHITECTURE.md -- Feature-Sliced Design (${f.name})
|
|
638
|
-
|
|
639
|
-
> Strict layered architecture with import rules.
|
|
640
|
-
> Import direction: app -> pages -> widgets -> features -> entities -> shared
|
|
641
|
-
|
|
642
|
-
---
|
|
643
|
-
|
|
644
|
-
## 1. Overview
|
|
645
|
-
|
|
646
|
-
| Concept | Implementation |
|
|
647
|
-
|---------|---------------|
|
|
648
|
-
| Framework | ${f.name} |
|
|
649
|
-
| Architecture | Feature-Sliced Design -- ${isLite ? 'Simplified' : 'Full'} |
|
|
650
|
-
| Layers | ${isLite ? '5 (no processes/widgets)' : '7'} |
|
|
651
|
-
| Import rule | Top-down only, never upward |
|
|
652
|
-
|
|
653
|
-
---
|
|
654
|
-
|
|
655
|
-
## 2. Directory Structure
|
|
656
|
-
|
|
657
|
-
${layers}
|
|
658
|
-
|
|
659
|
-
### Import Rules (strict)
|
|
660
|
-
|
|
661
|
-
\`\`\`
|
|
662
|
-
app -> pages -> ${isLite ? '' : 'widgets -> '}features -> entities -> shared
|
|
663
|
-
\`\`\`
|
|
664
|
-
|
|
665
|
-
A layer can ONLY import from layers BELOW it. Never upward, never sideways at the same level.
|
|
666
|
-
|
|
667
|
-
---
|
|
668
|
-
|
|
669
|
-
## 3. Slice Structure
|
|
670
|
-
|
|
671
|
-
Each feature/entity is a "slice" with segments:
|
|
672
|
-
|
|
673
|
-
- **ui/**: Components specific to this slice
|
|
674
|
-
- **model/**: State management, types, business logic
|
|
675
|
-
- **api/**: Data fetching for this slice
|
|
676
|
-
- **lib/**: Utilities specific to this slice
|
|
677
|
-
|
|
678
|
-
Each slice has a public API via \`index.ts\`.
|
|
679
|
-
|
|
680
|
-
---
|
|
681
|
-
|
|
682
|
-
## 4. Key Rules
|
|
683
|
-
|
|
684
|
-
- NEVER import upward (features cannot import from pages)
|
|
685
|
-
- NEVER import sideways (feature A cannot import from feature B)
|
|
686
|
-
- Cross-slice communication goes through shared/ or via events
|
|
687
|
-
- Each slice is self-contained with its own segments
|
|
688
|
-
`
|
|
689
|
-
}
|
|
690
|
-
|
|
691
|
-
function generateDDDGuide(framework, variant, options) {
|
|
692
|
-
const f = fw(framework)
|
|
693
|
-
const srcPrefix = framework === 'nuxt' ? '' : 'src/'
|
|
694
|
-
const isLite = variant === 'lite'
|
|
695
|
-
|
|
696
|
-
if (isLite) {
|
|
697
|
-
return `# ARCHITECTURE.md -- Domain-Driven Design Simplified (${f.name})
|
|
698
|
-
|
|
699
|
-
> DDD with simplified tactical patterns.
|
|
700
|
-
|
|
701
|
-
---
|
|
702
|
-
|
|
703
|
-
## 1. Directory Structure
|
|
704
|
-
|
|
705
|
-
\`\`\`
|
|
706
|
-
${srcPrefix}
|
|
707
|
-
├── modules/ # One per bounded context
|
|
708
|
-
│ └── [context]/
|
|
709
|
-
│ ├── domain/
|
|
710
|
-
│ │ ├── entities/ # Business objects
|
|
711
|
-
│ │ ├── value-objects/ # Immutable types
|
|
712
|
-
│ │ └── events/ # Domain events
|
|
713
|
-
│ ├── application/
|
|
714
|
-
│ │ └── handlers/ # Command/query handlers
|
|
715
|
-
│ ├── infrastructure/ # DB, HTTP, messaging
|
|
716
|
-
│ └── index.ts # Public API
|
|
717
|
-
│
|
|
718
|
-
└── shared/ # Shared kernel
|
|
719
|
-
├── types/
|
|
720
|
-
└── events/
|
|
721
|
-
\`\`\`
|
|
722
|
-
|
|
723
|
-
---
|
|
724
|
-
|
|
725
|
-
## 2. Key Rules
|
|
726
|
-
|
|
727
|
-
- Each module = one bounded context
|
|
728
|
-
- Domain layer has ZERO external dependencies
|
|
729
|
-
- Communicate between contexts via events or shared kernel
|
|
730
|
-
- Entities encapsulate business rules (not anemic models)
|
|
731
|
-
`
|
|
732
|
-
}
|
|
733
|
-
|
|
734
|
-
return `# ARCHITECTURE.md -- Domain-Driven Design (${f.name})
|
|
735
|
-
|
|
736
|
-
> Full DDD with bounded contexts and tactical patterns.
|
|
737
|
-
|
|
738
|
-
---
|
|
739
|
-
|
|
740
|
-
## 1. Overview
|
|
741
|
-
|
|
742
|
-
| Concept | Implementation |
|
|
743
|
-
|---------|---------------|
|
|
744
|
-
| Framework | ${f.name} |
|
|
745
|
-
| Architecture | Domain-Driven Design -- Full |
|
|
746
|
-
| Strategic | Bounded Contexts, Context Mapping |
|
|
747
|
-
| Tactical | Aggregates, Value Objects, Domain Events |
|
|
748
|
-
|
|
749
|
-
---
|
|
750
|
-
|
|
751
|
-
## 2. Directory Structure
|
|
752
|
-
|
|
753
|
-
\`\`\`
|
|
754
|
-
${srcPrefix}
|
|
755
|
-
├── bounded-contexts/
|
|
756
|
-
│ └── [context]/
|
|
757
|
-
│ ├── domain/
|
|
758
|
-
│ │ ├── aggregates/
|
|
759
|
-
│ │ │ └── [aggregate]/
|
|
760
|
-
│ │ │ ├── AggregateRoot.ts
|
|
761
|
-
│ │ │ ├── Entity.ts
|
|
762
|
-
│ │ │ └── ValueObject.ts
|
|
763
|
-
│ │ ├── events/
|
|
764
|
-
│ │ │ └── [DomainEvent].ts
|
|
765
|
-
│ │ ├── repositories/ # Interfaces only
|
|
766
|
-
│ │ └── services/ # Domain services
|
|
767
|
-
│ ├── application/
|
|
768
|
-
│ │ ├── commands/
|
|
769
|
-
│ │ ├── queries/
|
|
770
|
-
│ │ └── handlers/
|
|
771
|
-
│ └── infrastructure/
|
|
772
|
-
│ ├── persistence/
|
|
773
|
-
│ └── messaging/
|
|
774
|
-
│
|
|
775
|
-
└── shared-kernel/
|
|
776
|
-
├── types/
|
|
777
|
-
└── events/
|
|
778
|
-
\`\`\`
|
|
779
|
-
|
|
780
|
-
---
|
|
781
|
-
|
|
782
|
-
## 3. Tactical Patterns
|
|
783
|
-
|
|
784
|
-
### Aggregate Root
|
|
785
|
-
- Entry point for modifications to an aggregate
|
|
786
|
-
- Ensures consistency within the aggregate boundary
|
|
787
|
-
- Only aggregate roots are referenced by ID from outside
|
|
788
|
-
|
|
789
|
-
### Value Object
|
|
790
|
-
- Immutable, equality by value (not identity)
|
|
791
|
-
- Examples: Money, Email, Address, DateRange
|
|
792
|
-
|
|
793
|
-
### Domain Event
|
|
794
|
-
- Past tense: \`OrderPlaced\`, \`PaymentReceived\`
|
|
795
|
-
- Published when something important happens in the domain
|
|
796
|
-
- Consumed by other bounded contexts
|
|
797
|
-
|
|
798
|
-
---
|
|
799
|
-
|
|
800
|
-
## 4. Key Rules
|
|
801
|
-
|
|
802
|
-
- Domain layer has ZERO framework dependencies
|
|
803
|
-
- Aggregate Root is the only way to modify an aggregate
|
|
804
|
-
- Value Objects are immutable
|
|
805
|
-
- Bounded contexts communicate via events or ACL
|
|
806
|
-
- Ubiquitous language: use business terms, not technical ones
|
|
807
|
-
`
|
|
808
|
-
}
|
|
809
|
-
|
|
810
|
-
function generateModularMonolithGuide(framework, variant, options) {
|
|
811
|
-
const f = fw(framework)
|
|
812
|
-
const srcPrefix = framework === 'nuxt' ? '' : 'src/'
|
|
813
|
-
const isLite = variant === 'lite'
|
|
814
|
-
|
|
815
|
-
if (isLite) {
|
|
816
|
-
return `# ARCHITECTURE.md -- Modular Monolith Simplified (${f.name})
|
|
817
|
-
|
|
818
|
-
> Single deployment with module boundaries enforced by barrel exports.
|
|
819
|
-
|
|
820
|
-
---
|
|
821
|
-
|
|
822
|
-
## 1. Directory Structure
|
|
823
|
-
|
|
824
|
-
\`\`\`
|
|
825
|
-
${srcPrefix}
|
|
826
|
-
├── modules/
|
|
827
|
-
│ └── [module]/
|
|
828
|
-
│ ├── services/ # Business logic + data access
|
|
829
|
-
│ ├── types/ # Module types
|
|
830
|
-
│ └── index.ts # Public API (barrel export)
|
|
831
|
-
│
|
|
832
|
-
└── shared/
|
|
833
|
-
├── database/
|
|
834
|
-
└── utils/
|
|
835
|
-
\`\`\`
|
|
836
|
-
|
|
837
|
-
---
|
|
838
|
-
|
|
839
|
-
## 2. Key Rules
|
|
840
|
-
|
|
841
|
-
- Single package.json, single deployment
|
|
842
|
-
- Modules communicate ONLY through barrel exports (index.ts)
|
|
843
|
-
- No direct imports between module internals
|
|
844
|
-
- When two modules need to share: move to shared/
|
|
845
|
-
`
|
|
846
|
-
}
|
|
847
|
-
|
|
848
|
-
return `# ARCHITECTURE.md -- Modular Monolith (${f.name})
|
|
849
|
-
|
|
850
|
-
> Single deployment with strict module boundaries and internal layering.
|
|
851
|
-
|
|
852
|
-
---
|
|
853
|
-
|
|
854
|
-
## 1. Overview
|
|
855
|
-
|
|
856
|
-
| Concept | Implementation |
|
|
857
|
-
|---------|---------------|
|
|
858
|
-
| Framework | ${f.name} |
|
|
859
|
-
| Architecture | Modular Monolith -- Full |
|
|
860
|
-
| Deployment | Single unit |
|
|
861
|
-
| Boundaries | Enforced via barrel exports + internal layers |
|
|
862
|
-
|
|
863
|
-
---
|
|
864
|
-
|
|
865
|
-
## 2. Directory Structure
|
|
866
|
-
|
|
867
|
-
\`\`\`
|
|
868
|
-
${srcPrefix}
|
|
869
|
-
├── modules/
|
|
870
|
-
│ └── [module]/
|
|
871
|
-
│ ├── domain/
|
|
872
|
-
│ │ ├── entities/
|
|
873
|
-
│ │ ├── value-objects/
|
|
874
|
-
│ │ └── repositories/ # Interfaces
|
|
875
|
-
│ ├── application/
|
|
876
|
-
│ │ ├── use-cases/
|
|
877
|
-
│ │ └── dtos/
|
|
878
|
-
│ ├── infrastructure/
|
|
879
|
-
│ │ ├── persistence/
|
|
880
|
-
│ │ └── http/
|
|
881
|
-
│ └── index.ts # Public API
|
|
882
|
-
│
|
|
883
|
-
└── shared/
|
|
884
|
-
├── database/
|
|
885
|
-
├── config/
|
|
886
|
-
└── utils/
|
|
887
|
-
\`\`\`
|
|
888
|
-
|
|
889
|
-
---
|
|
890
|
-
|
|
891
|
-
## 3. Key Rules
|
|
892
|
-
|
|
893
|
-
- **Single deployment** but **strict module boundaries**
|
|
894
|
-
- Modules communicate ONLY through their public API (index.ts)
|
|
895
|
-
- Each module has domain/application/infrastructure layers
|
|
896
|
-
- domain/ has ZERO external dependencies (same as Clean Architecture)
|
|
897
|
-
- This IS the stepping stone to microservices: extract modules when needed
|
|
898
|
-
- To extract a module to a microservice: move its folder, add network boundary
|
|
899
|
-
`
|
|
900
|
-
}
|
|
901
|
-
|
|
902
|
-
function generateCQRSGuide(framework, variant, options) {
|
|
903
|
-
const f = fw(framework)
|
|
904
|
-
const srcPrefix = framework === 'nuxt' ? '' : 'src/'
|
|
905
|
-
const isLite = variant === 'lite'
|
|
906
|
-
|
|
907
|
-
return `# ARCHITECTURE.md -- CQRS (${f.name})
|
|
908
|
-
|
|
909
|
-
> Command Query Responsibility Segregation${isLite ? ' -- without Event Sourcing' : ''}.
|
|
910
|
-
|
|
911
|
-
---
|
|
912
|
-
|
|
913
|
-
## 1. Directory Structure
|
|
914
|
-
|
|
915
|
-
${isLite ? `\`\`\`
|
|
916
|
-
${srcPrefix}
|
|
917
|
-
├── commands/ # Write operations
|
|
918
|
-
│ └── CreateOrder.ts
|
|
919
|
-
├── queries/ # Read operations
|
|
920
|
-
│ └── GetOrderById.ts
|
|
921
|
-
├── handlers/ # Both command + query handlers
|
|
922
|
-
│ ├── CreateOrderHandler.ts
|
|
923
|
-
│ └── GetOrderByIdHandler.ts
|
|
924
|
-
├── models/ # Shared model (single DB)
|
|
925
|
-
└── events/ # Domain events (optional)
|
|
926
|
-
\`\`\`` : `\`\`\`
|
|
927
|
-
${srcPrefix}
|
|
928
|
-
├── commands/
|
|
929
|
-
│ └── CreateOrder.ts
|
|
930
|
-
├── command-handlers/
|
|
931
|
-
│ └── CreateOrderHandler.ts
|
|
932
|
-
├── queries/
|
|
933
|
-
│ └── GetOrderById.ts
|
|
934
|
-
├── query-handlers/
|
|
935
|
-
│ └── GetOrderByIdHandler.ts
|
|
936
|
-
├── write-models/ # Write-optimized models
|
|
937
|
-
├── read-models/ # Read-optimized projections
|
|
938
|
-
├── events/ # Domain events
|
|
939
|
-
├── projections/ # Event -> Read Model updaters
|
|
940
|
-
└── event-store/ # Event persistence
|
|
941
|
-
\`\`\``}
|
|
942
|
-
|
|
943
|
-
---
|
|
944
|
-
|
|
945
|
-
## 2. Key Rules
|
|
946
|
-
|
|
947
|
-
- Commands change state, Queries read state (never both)
|
|
948
|
-
- Command handlers validate and execute writes
|
|
949
|
-
- Query handlers optimize for reads (denormalized if needed)
|
|
950
|
-
${isLite ? '- Same database for reads and writes (simplified)' : '- Separate read/write databases for optimal performance'}
|
|
951
|
-
${isLite ? '' : '- Event Store records all state changes as events\n- Projections build read models from events'}
|
|
952
|
-
`
|
|
953
|
-
}
|
|
954
|
-
|
|
955
|
-
function generateAtomicGuide(framework, variant, options) {
|
|
956
|
-
const f = fw(framework)
|
|
957
|
-
const srcPrefix = framework === 'nuxt' ? '' : 'src/'
|
|
958
|
-
const isLite = variant === 'lite'
|
|
959
|
-
|
|
960
|
-
return `# ARCHITECTURE.md -- Atomic Design (${f.name})
|
|
961
|
-
|
|
962
|
-
> Components organized by granularity: ${isLite ? 'primitives, organisms, pages' : 'atoms, molecules, organisms, templates, pages'}.
|
|
963
|
-
|
|
964
|
-
---
|
|
965
|
-
|
|
966
|
-
## 1. Directory Structure
|
|
967
|
-
|
|
968
|
-
${isLite ? `\`\`\`
|
|
969
|
-
${srcPrefix}
|
|
970
|
-
├── components/
|
|
971
|
-
│ ├── primitives/ # Atoms + Molecules (merged)
|
|
972
|
-
│ │ ├── Button.${f.componentExt}
|
|
973
|
-
│ │ ├── Input.${f.componentExt}
|
|
974
|
-
│ │ └── SearchBar.${f.componentExt}
|
|
975
|
-
│ └── organisms/
|
|
976
|
-
│ ├── Header.${f.componentExt}
|
|
977
|
-
│ └── ProductCard.${f.componentExt}
|
|
978
|
-
├── pages/
|
|
979
|
-
├── services/
|
|
980
|
-
└── types/
|
|
981
|
-
\`\`\`` : `\`\`\`
|
|
982
|
-
${srcPrefix}
|
|
983
|
-
├── components/
|
|
984
|
-
│ ├── atoms/ # Smallest units (Button, Input, Icon)
|
|
985
|
-
│ ├── molecules/ # Combinations (SearchBar, FormField)
|
|
986
|
-
│ ├── organisms/ # Complex blocks (Header, ProductCard)
|
|
987
|
-
│ └── templates/ # Page layouts (DashboardTemplate)
|
|
988
|
-
├── pages/
|
|
989
|
-
├── ${f.hookDir}/
|
|
990
|
-
├── services/
|
|
991
|
-
└── types/
|
|
992
|
-
\`\`\``}
|
|
993
|
-
|
|
994
|
-
---
|
|
995
|
-
|
|
996
|
-
## 2. Component Hierarchy
|
|
997
|
-
|
|
998
|
-
\`\`\`
|
|
999
|
-
${isLite ? 'Pages -> Organisms -> Primitives' : 'Pages -> Templates -> Organisms -> Molecules -> Atoms'}
|
|
1000
|
-
\`\`\`
|
|
1001
|
-
|
|
1002
|
-
Each level can only use components from levels below it.
|
|
1003
|
-
|
|
1004
|
-
---
|
|
1005
|
-
|
|
1006
|
-
## 3. Key Rules
|
|
1007
|
-
|
|
1008
|
-
- ${isLite ? 'Primitives' : 'Atoms/Molecules'}: no business logic, pure presentation
|
|
1009
|
-
- Organisms: can contain business logic, composed from smaller components
|
|
1010
|
-
- ${isLite ? '' : 'Templates: define page structure without data\n- '}Pages: compose ${isLite ? 'organisms' : 'templates'} with data
|
|
1011
|
-
`
|
|
1012
|
-
}
|
|
1013
|
-
|
|
1014
|
-
function generateMVCGuide(framework, variant, options) {
|
|
1015
|
-
const f = fw(framework)
|
|
1016
|
-
const srcPrefix = framework === 'nuxt' ? '' : 'src/'
|
|
1017
|
-
const isLite = variant === 'lite'
|
|
1018
|
-
|
|
1019
|
-
return `# ARCHITECTURE.md -- MVC / Layered Architecture (${f.name})
|
|
1020
|
-
|
|
1021
|
-
> Horizontal slicing by technical layer${isLite ? ' (simplified)' : ''}.
|
|
1022
|
-
|
|
1023
|
-
---
|
|
1024
|
-
|
|
1025
|
-
## 1. Directory Structure
|
|
1026
|
-
|
|
1027
|
-
${isLite ? `\`\`\`
|
|
1028
|
-
${srcPrefix}
|
|
1029
|
-
├── services/ # Business logic + data access (merged)
|
|
1030
|
-
├── models/ # Data models
|
|
1031
|
-
├── routes/ # Route definitions
|
|
1032
|
-
└── utils/
|
|
1033
|
-
\`\`\`` : `\`\`\`
|
|
1034
|
-
${srcPrefix}
|
|
1035
|
-
├── controllers/ # Request handling
|
|
1036
|
-
├── services/ # Business logic
|
|
1037
|
-
├── repositories/ # Data access
|
|
1038
|
-
├── models/ # Data models / entities
|
|
1039
|
-
├── middlewares/ # Cross-cutting concerns
|
|
1040
|
-
├── routes/ # Route definitions
|
|
1041
|
-
├── config/
|
|
1042
|
-
└── utils/
|
|
1043
|
-
\`\`\``}
|
|
1044
|
-
|
|
1045
|
-
---
|
|
1046
|
-
|
|
1047
|
-
## 2. Layer Responsibilities
|
|
1048
|
-
|
|
1049
|
-
${isLite ? `- **services/**: Business logic + data access combined
|
|
1050
|
-
- **models/**: Data structures and validation
|
|
1051
|
-
- **routes/**: HTTP route definitions` : `- **controllers/**: Handle HTTP requests, delegate to services
|
|
1052
|
-
- **services/**: Business logic, orchestration
|
|
1053
|
-
- **repositories/**: Data access, database queries
|
|
1054
|
-
- **models/**: Data structures, ORM entities
|
|
1055
|
-
- **middlewares/**: Auth, logging, validation
|
|
1056
|
-
- **routes/**: HTTP route mapping`}
|
|
1057
|
-
|
|
1058
|
-
---
|
|
1059
|
-
|
|
1060
|
-
## 3. Key Rules
|
|
1061
|
-
|
|
1062
|
-
- ${isLite ? 'Services handle both logic and data access' : 'Controllers don\'t contain business logic'}
|
|
1063
|
-
- ${isLite ? '' : 'Services don\'t access the database directly (use repositories)\n- '}Models define data structure and validation
|
|
1064
|
-
- Each layer only calls the layer below it
|
|
1065
|
-
`
|
|
1066
|
-
}
|
|
1067
|
-
|
|
1068
|
-
// ── Generic Fallback ──────────────────────────────────
|
|
1069
|
-
|
|
1070
|
-
function generateGenericGuide(architecture, framework, variant) {
|
|
1071
|
-
const f = fw(framework)
|
|
1072
|
-
const pattern = ARCHITECTURE_PATTERNS[architecture]
|
|
1073
|
-
const name = pattern?.name || architecture
|
|
1074
|
-
|
|
1075
|
-
return `# ARCHITECTURE.md -- ${name} (${f.name})
|
|
1076
|
-
|
|
1077
|
-
> Architecture guide for ${name} pattern with ${f.name}.
|
|
1078
|
-
> See docs/ for detailed patterns.
|
|
1079
|
-
|
|
1080
|
-
## Overview
|
|
1081
|
-
|
|
1082
|
-
| Concept | Implementation |
|
|
1083
|
-
|---------|---------------|
|
|
1084
|
-
| Framework | ${f.name} |
|
|
1085
|
-
| Architecture | ${name} -- ${variant === 'full' ? 'Full' : 'Simplified'} |
|
|
1086
|
-
| Language | ${f.lang} (strict) |
|
|
1087
|
-
|
|
1088
|
-
## Key Principles
|
|
1089
|
-
|
|
1090
|
-
${pattern?.description || 'Follow the architecture patterns defined in this document.'}
|
|
1091
|
-
|
|
1092
|
-
## Best For
|
|
1093
|
-
|
|
1094
|
-
${pattern?.bestFor?.description || 'See architecture documentation for guidelines.'}
|
|
1095
|
-
`
|
|
1096
|
-
}
|