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.
Files changed (323) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +33 -207
  3. package/dist/catalog.json +15529 -0
  4. package/dist/hw-worker.mjs +254 -0
  5. package/dist/icones/icone.ico +0 -0
  6. package/dist/icones/icone.png +0 -0
  7. package/dist/interface/assets/figtree-latin-400-normal-g7Dtegnw.woff2 +0 -0
  8. package/dist/interface/assets/figtree-latin-500-normal-BWnGEVsr.woff2 +0 -0
  9. package/dist/interface/assets/figtree-latin-600-normal-Cv_xCTDl.woff2 +0 -0
  10. package/dist/interface/assets/figtree-latin-700-normal-th6qEP7c.woff2 +0 -0
  11. package/dist/interface/assets/figtree-latin-ext-400-normal-CXAzuTZb.woff2 +0 -0
  12. package/dist/interface/assets/figtree-latin-ext-500-normal-Du0rIuHj.woff2 +0 -0
  13. package/dist/interface/assets/figtree-latin-ext-600-normal-DJlfifZj.woff2 +0 -0
  14. package/dist/interface/assets/figtree-latin-ext-700-normal-CS4sQkGV.woff2 +0 -0
  15. package/dist/interface/assets/index-BIyqZkro.css +1 -0
  16. package/dist/interface/assets/index-zAegy908.js +13 -0
  17. package/dist/interface/assets/jetbrains-mono-latin-400-normal-V6pRDFza.woff2 +0 -0
  18. package/dist/interface/assets/jetbrains-mono-latin-500-normal-BWZEU5yA.woff2 +0 -0
  19. package/dist/interface/assets/jetbrains-mono-latin-600-normal-C8RAYTDA.woff2 +0 -0
  20. package/dist/interface/assets/jetbrains-mono-latin-ext-400-normal-Bc8Ftmh3.woff2 +0 -0
  21. package/dist/interface/assets/jetbrains-mono-latin-ext-500-normal-Cut-4mMH.woff2 +0 -0
  22. package/dist/interface/assets/jetbrains-mono-latin-ext-600-normal-BfB_LPfz.woff2 +0 -0
  23. package/dist/interface/assets/unbounded-latin-500-normal-4slEIF53.woff2 +0 -0
  24. package/dist/interface/assets/unbounded-latin-700-normal-CaoNriVp.woff2 +0 -0
  25. package/dist/interface/assets/unbounded-latin-ext-500-normal-BTIpesyw.woff2 +0 -0
  26. package/dist/interface/assets/unbounded-latin-ext-700-normal-BLzWLLjG.woff2 +0 -0
  27. package/dist/interface/icones/apple-touch-icon.png +0 -0
  28. package/dist/interface/icones/favicon-32.png +0 -0
  29. package/dist/interface/icones/icone-192.png +0 -0
  30. package/dist/interface/icones/icone-512.png +0 -0
  31. package/dist/interface/icones/icone-mascara-512.png +0 -0
  32. package/dist/interface/index.html +19 -0
  33. package/dist/interface/manifest.webmanifest +19 -0
  34. package/dist/interface/sw.js +63 -0
  35. package/dist/specialist-agent.mjs +6919 -0
  36. package/dist/usage-worker.mjs +174 -0
  37. package/package.json +32 -57
  38. package/.claude-plugin/marketplace.json +0 -52
  39. package/.claude-plugin/plugin.json +0 -37
  40. package/.codex/INSTALL.md +0 -145
  41. package/.cursor-plugin/marketplace.json +0 -52
  42. package/.cursor-plugin/plugin.json +0 -37
  43. package/.opencode/INSTALL.md +0 -127
  44. package/.opencode/opencode.json +0 -186
  45. package/agents/analyst-lite.md +0 -48
  46. package/agents/analyst.md +0 -396
  47. package/agents/api-lite.md +0 -43
  48. package/agents/api.md +0 -427
  49. package/agents/architect-lite.md +0 -104
  50. package/agents/architect.md +0 -571
  51. package/agents/autopilot-lite.md +0 -46
  52. package/agents/autopilot.md +0 -196
  53. package/agents/cloud-lite.md +0 -75
  54. package/agents/cloud.md +0 -213
  55. package/agents/data-lite.md +0 -67
  56. package/agents/data.md +0 -306
  57. package/agents/debugger-lite.md +0 -46
  58. package/agents/debugger.md +0 -410
  59. package/agents/deps-lite.md +0 -41
  60. package/agents/deps.md +0 -363
  61. package/agents/designer-lite.md +0 -67
  62. package/agents/designer.md +0 -195
  63. package/agents/devops-lite.md +0 -67
  64. package/agents/devops.md +0 -205
  65. package/agents/docs-lite.md +0 -42
  66. package/agents/docs.md +0 -454
  67. package/agents/executor-lite.md +0 -61
  68. package/agents/executor.md +0 -695
  69. package/agents/explorer-lite.md +0 -55
  70. package/agents/explorer.md +0 -152
  71. package/agents/finance-lite.md +0 -66
  72. package/agents/finance.md +0 -255
  73. package/agents/i18n-lite.md +0 -44
  74. package/agents/i18n.md +0 -594
  75. package/agents/legal-lite.md +0 -113
  76. package/agents/legal.md +0 -302
  77. package/agents/marketing-lite.md +0 -25
  78. package/agents/marketing.md +0 -188
  79. package/agents/memory.md +0 -166
  80. package/agents/orchestrator-lite.md +0 -40
  81. package/agents/orchestrator.md +0 -512
  82. package/agents/pair-lite.md +0 -38
  83. package/agents/pair.md +0 -310
  84. package/agents/perf-lite.md +0 -42
  85. package/agents/perf.md +0 -320
  86. package/agents/planner-lite.md +0 -59
  87. package/agents/planner.md +0 -272
  88. package/agents/product-lite.md +0 -25
  89. package/agents/product.md +0 -195
  90. package/agents/refactor-lite.md +0 -42
  91. package/agents/refactor.md +0 -467
  92. package/agents/ripple-lite.md +0 -106
  93. package/agents/ripple.md +0 -166
  94. package/agents/scout-lite.md +0 -37
  95. package/agents/scout.md +0 -224
  96. package/agents/security-lite.md +0 -66
  97. package/agents/security.md +0 -252
  98. package/agents/sentry-triage-lite.md +0 -54
  99. package/agents/sentry-triage.md +0 -217
  100. package/agents/starter-lite.md +0 -80
  101. package/agents/starter.md +0 -300
  102. package/agents/support-lite.md +0 -24
  103. package/agents/support.md +0 -191
  104. package/agents/tdd-lite.md +0 -43
  105. package/agents/tdd.md +0 -329
  106. package/agents/tester-lite.md +0 -71
  107. package/agents/tester.md +0 -237
  108. package/cli/architectures.mjs +0 -713
  109. package/cli/detect-architecture.mjs +0 -752
  110. package/cli/generate-architecture.mjs +0 -1096
  111. package/cli/index.mjs +0 -1217
  112. package/cli/recommend-architecture.mjs +0 -870
  113. package/hooks/after-review.mjs +0 -130
  114. package/hooks/after-task.mjs +0 -117
  115. package/hooks/before-plan.mjs +0 -155
  116. package/hooks/before-review.mjs +0 -139
  117. package/hooks/hooks.json +0 -66
  118. package/hooks/lifecycle.json +0 -91
  119. package/hooks/native/auto-dispatch.mjs +0 -207
  120. package/hooks/native/auto-format.mjs +0 -176
  121. package/hooks/native/mcp-discovery.mjs +0 -168
  122. package/hooks/native/security-config.json +0 -38
  123. package/hooks/native/security-guard.mjs +0 -323
  124. package/hooks/native/session-context.mjs +0 -179
  125. package/hooks/native/session-end.mjs +0 -42
  126. package/hooks/native/utils.mjs +0 -62
  127. package/hooks/on-error.mjs +0 -129
  128. package/hooks/session-end.mjs +0 -185
  129. package/hooks/session-start.mjs +0 -154
  130. package/packs/angular/ARCHITECTURE.md +0 -814
  131. package/packs/angular/CLAUDE.md +0 -105
  132. package/packs/angular/agents/builder.md +0 -113
  133. package/packs/angular/agents/doctor.md +0 -187
  134. package/packs/angular/agents/migrator.md +0 -101
  135. package/packs/angular/agents/reviewer.md +0 -252
  136. package/packs/angular/agents-lite/builder.md +0 -65
  137. package/packs/angular/agents-lite/doctor.md +0 -64
  138. package/packs/angular/agents-lite/migrator.md +0 -75
  139. package/packs/angular/agents-lite/reviewer.md +0 -69
  140. package/packs/angular/skills/dev-create-component/SKILL.md +0 -56
  141. package/packs/angular/skills/dev-create-injectable/SKILL.md +0 -60
  142. package/packs/angular/skills/dev-create-module/SKILL.md +0 -49
  143. package/packs/angular/skills/dev-create-service/SKILL.md +0 -34
  144. package/packs/angular/skills/dev-create-test/SKILL.md +0 -78
  145. package/packs/angular/skills/dev-generate-types/SKILL.md +0 -37
  146. package/packs/angular/skills/docs-onboard/SKILL.md +0 -42
  147. package/packs/angular/skills/migration-migrate-component/SKILL.md +0 -42
  148. package/packs/angular/skills/migration-migrate-module/SKILL.md +0 -25
  149. package/packs/angular/skills/review-check-architecture/SKILL.md +0 -67
  150. package/packs/angular/skills/review-fix-violations/SKILL.md +0 -43
  151. package/packs/angular/skills/review-review/SKILL.md +0 -43
  152. package/packs/astro/ARCHITECTURE.md +0 -718
  153. package/packs/astro/CLAUDE.md +0 -106
  154. package/packs/astro/agents/builder.md +0 -123
  155. package/packs/astro/agents/doctor.md +0 -200
  156. package/packs/astro/agents/migrator.md +0 -105
  157. package/packs/astro/agents/reviewer.md +0 -253
  158. package/packs/astro/agents-lite/builder.md +0 -71
  159. package/packs/astro/agents-lite/doctor.md +0 -66
  160. package/packs/astro/agents-lite/migrator.md +0 -71
  161. package/packs/astro/agents-lite/reviewer.md +0 -70
  162. package/packs/astro/skills/dev-create-component/SKILL.md +0 -50
  163. package/packs/astro/skills/dev-create-island/SKILL.md +0 -63
  164. package/packs/astro/skills/dev-create-module/SKILL.md +0 -49
  165. package/packs/astro/skills/dev-create-service/SKILL.md +0 -34
  166. package/packs/astro/skills/dev-create-test/SKILL.md +0 -76
  167. package/packs/astro/skills/dev-generate-types/SKILL.md +0 -37
  168. package/packs/astro/skills/docs-onboard/SKILL.md +0 -51
  169. package/packs/astro/skills/migration-migrate-component/SKILL.md +0 -48
  170. package/packs/astro/skills/migration-migrate-module/SKILL.md +0 -25
  171. package/packs/astro/skills/review-check-architecture/SKILL.md +0 -72
  172. package/packs/astro/skills/review-fix-violations/SKILL.md +0 -43
  173. package/packs/astro/skills/review-review/SKILL.md +0 -45
  174. package/packs/nextjs/ARCHITECTURE.md +0 -1033
  175. package/packs/nextjs/CLAUDE.md +0 -106
  176. package/packs/nextjs/agents/builder.md +0 -132
  177. package/packs/nextjs/agents/doctor.md +0 -226
  178. package/packs/nextjs/agents/migrator.md +0 -101
  179. package/packs/nextjs/agents/reviewer.md +0 -243
  180. package/packs/nextjs/agents-lite/builder.md +0 -74
  181. package/packs/nextjs/agents-lite/doctor.md +0 -74
  182. package/packs/nextjs/agents-lite/migrator.md +0 -75
  183. package/packs/nextjs/agents-lite/reviewer.md +0 -73
  184. package/packs/nextjs/skills/dev-create-component/SKILL.md +0 -82
  185. package/packs/nextjs/skills/dev-create-hook/SKILL.md +0 -90
  186. package/packs/nextjs/skills/dev-create-module/SKILL.md +0 -63
  187. package/packs/nextjs/skills/dev-create-service/SKILL.md +0 -35
  188. package/packs/nextjs/skills/dev-create-test/SKILL.md +0 -106
  189. package/packs/nextjs/skills/dev-generate-types/SKILL.md +0 -37
  190. package/packs/nextjs/skills/docs-onboard/SKILL.md +0 -55
  191. package/packs/nextjs/skills/migration-migrate-component/SKILL.md +0 -58
  192. package/packs/nextjs/skills/migration-migrate-module/SKILL.md +0 -25
  193. package/packs/nextjs/skills/review-check-architecture/SKILL.md +0 -101
  194. package/packs/nextjs/skills/review-fix-violations/SKILL.md +0 -48
  195. package/packs/nextjs/skills/review-review/SKILL.md +0 -47
  196. package/packs/nuxt/ARCHITECTURE.md +0 -831
  197. package/packs/nuxt/CLAUDE.md +0 -111
  198. package/packs/nuxt/agents/builder.md +0 -120
  199. package/packs/nuxt/agents/doctor.md +0 -198
  200. package/packs/nuxt/agents/migrator.md +0 -101
  201. package/packs/nuxt/agents/reviewer.md +0 -255
  202. package/packs/nuxt/agents-lite/builder.md +0 -67
  203. package/packs/nuxt/agents-lite/doctor.md +0 -67
  204. package/packs/nuxt/agents-lite/migrator.md +0 -80
  205. package/packs/nuxt/agents-lite/reviewer.md +0 -71
  206. package/packs/nuxt/skills/dev-create-component/SKILL.md +0 -60
  207. package/packs/nuxt/skills/dev-create-composable/SKILL.md +0 -33
  208. package/packs/nuxt/skills/dev-create-module/SKILL.md +0 -49
  209. package/packs/nuxt/skills/dev-create-service/SKILL.md +0 -34
  210. package/packs/nuxt/skills/dev-create-test/SKILL.md +0 -61
  211. package/packs/nuxt/skills/dev-generate-types/SKILL.md +0 -37
  212. package/packs/nuxt/skills/docs-onboard/SKILL.md +0 -49
  213. package/packs/nuxt/skills/migration-migrate-component/SKILL.md +0 -48
  214. package/packs/nuxt/skills/migration-migrate-module/SKILL.md +0 -25
  215. package/packs/nuxt/skills/review-check-architecture/SKILL.md +0 -71
  216. package/packs/nuxt/skills/review-fix-violations/SKILL.md +0 -43
  217. package/packs/nuxt/skills/review-review/SKILL.md +0 -45
  218. package/packs/react/ARCHITECTURE.md +0 -991
  219. package/packs/react/CLAUDE.md +0 -102
  220. package/packs/react/agents/builder.md +0 -113
  221. package/packs/react/agents/doctor.md +0 -203
  222. package/packs/react/agents/migrator.md +0 -101
  223. package/packs/react/agents/reviewer.md +0 -252
  224. package/packs/react/agents-lite/builder.md +0 -65
  225. package/packs/react/agents-lite/doctor.md +0 -64
  226. package/packs/react/agents-lite/migrator.md +0 -74
  227. package/packs/react/agents-lite/reviewer.md +0 -69
  228. package/packs/react/skills/dev-create-component/SKILL.md +0 -53
  229. package/packs/react/skills/dev-create-hook/SKILL.md +0 -78
  230. package/packs/react/skills/dev-create-module/SKILL.md +0 -51
  231. package/packs/react/skills/dev-create-service/SKILL.md +0 -34
  232. package/packs/react/skills/dev-create-test/SKILL.md +0 -92
  233. package/packs/react/skills/dev-generate-types/SKILL.md +0 -37
  234. package/packs/react/skills/docs-onboard/SKILL.md +0 -42
  235. package/packs/react/skills/migration-migrate-component/SKILL.md +0 -44
  236. package/packs/react/skills/migration-migrate-module/SKILL.md +0 -25
  237. package/packs/react/skills/review-check-architecture/SKILL.md +0 -73
  238. package/packs/react/skills/review-fix-violations/SKILL.md +0 -45
  239. package/packs/react/skills/review-review/SKILL.md +0 -44
  240. package/packs/svelte/ARCHITECTURE.md +0 -975
  241. package/packs/svelte/CLAUDE.md +0 -102
  242. package/packs/svelte/agents/builder.md +0 -114
  243. package/packs/svelte/agents/doctor.md +0 -174
  244. package/packs/svelte/agents/migrator.md +0 -101
  245. package/packs/svelte/agents/reviewer.md +0 -238
  246. package/packs/svelte/agents-lite/builder.md +0 -66
  247. package/packs/svelte/agents-lite/doctor.md +0 -67
  248. package/packs/svelte/agents-lite/migrator.md +0 -82
  249. package/packs/svelte/agents-lite/reviewer.md +0 -70
  250. package/packs/svelte/skills/dev-create-component/SKILL.md +0 -77
  251. package/packs/svelte/skills/dev-create-module/SKILL.md +0 -59
  252. package/packs/svelte/skills/dev-create-service/SKILL.md +0 -35
  253. package/packs/svelte/skills/dev-create-store/SKILL.md +0 -94
  254. package/packs/svelte/skills/dev-create-test/SKILL.md +0 -98
  255. package/packs/svelte/skills/dev-generate-types/SKILL.md +0 -37
  256. package/packs/svelte/skills/docs-onboard/SKILL.md +0 -47
  257. package/packs/svelte/skills/migration-migrate-component/SKILL.md +0 -51
  258. package/packs/svelte/skills/migration-migrate-module/SKILL.md +0 -25
  259. package/packs/svelte/skills/review-check-architecture/SKILL.md +0 -79
  260. package/packs/svelte/skills/review-fix-violations/SKILL.md +0 -47
  261. package/packs/svelte/skills/review-review/SKILL.md +0 -45
  262. package/packs/vue/ARCHITECTURE.md +0 -798
  263. package/packs/vue/CLAUDE.md +0 -102
  264. package/packs/vue/agents/builder.md +0 -112
  265. package/packs/vue/agents/doctor.md +0 -185
  266. package/packs/vue/agents/migrator.md +0 -101
  267. package/packs/vue/agents/reviewer.md +0 -249
  268. package/packs/vue/agents-lite/builder.md +0 -65
  269. package/packs/vue/agents-lite/doctor.md +0 -63
  270. package/packs/vue/agents-lite/migrator.md +0 -73
  271. package/packs/vue/agents-lite/reviewer.md +0 -68
  272. package/packs/vue/skills/dev-create-component/SKILL.md +0 -58
  273. package/packs/vue/skills/dev-create-composable/SKILL.md +0 -31
  274. package/packs/vue/skills/dev-create-module/SKILL.md +0 -50
  275. package/packs/vue/skills/dev-create-service/SKILL.md +0 -34
  276. package/packs/vue/skills/dev-create-test/SKILL.md +0 -62
  277. package/packs/vue/skills/dev-generate-types/SKILL.md +0 -37
  278. package/packs/vue/skills/docs-onboard/SKILL.md +0 -42
  279. package/packs/vue/skills/migration-migrate-component/SKILL.md +0 -41
  280. package/packs/vue/skills/migration-migrate-module/SKILL.md +0 -25
  281. package/packs/vue/skills/review-check-architecture/SKILL.md +0 -73
  282. package/packs/vue/skills/review-fix-violations/SKILL.md +0 -42
  283. package/packs/vue/skills/review-review/SKILL.md +0 -43
  284. package/skills/audit/SKILL.md +0 -231
  285. package/skills/autofix/SKILL.md +0 -166
  286. package/skills/autopilot/SKILL.md +0 -286
  287. package/skills/brainstorm/SKILL.md +0 -298
  288. package/skills/checkpoint/SKILL.md +0 -217
  289. package/skills/codereview/SKILL.md +0 -268
  290. package/skills/commit/SKILL.md +0 -150
  291. package/skills/copywriting/SKILL.md +0 -218
  292. package/skills/cro/SKILL.md +0 -234
  293. package/skills/debug/SKILL.md +0 -210
  294. package/skills/design-review/SKILL.md +0 -217
  295. package/skills/discovery/SKILL.md +0 -218
  296. package/skills/estimate/SKILL.md +0 -154
  297. package/skills/finish/SKILL.md +0 -220
  298. package/skills/grill/SKILL.md +0 -270
  299. package/skills/health/SKILL.md +0 -251
  300. package/skills/improve-architecture/SKILL.md +0 -205
  301. package/skills/learn/SKILL.md +0 -260
  302. package/skills/lint/SKILL.md +0 -126
  303. package/skills/migrate-architecture/SKILL.md +0 -242
  304. package/skills/migrate-framework/SKILL.md +0 -172
  305. package/skills/onboard/SKILL.md +0 -168
  306. package/skills/plan/SKILL.md +0 -141
  307. package/skills/prd/SKILL.md +0 -241
  308. package/skills/recall/SKILL.md +0 -112
  309. package/skills/remember/SKILL.md +0 -108
  310. package/skills/seo-audit/SKILL.md +0 -240
  311. package/skills/tdd/SKILL.md +0 -201
  312. package/skills/tutorial/SKILL.md +0 -346
  313. package/skills/verify/SKILL.md +0 -168
  314. package/skills/worktree/SKILL.md +0 -168
  315. package/skills/write-skill/SKILL.md +0 -225
  316. package/templates/autopilot/PROMPT.md +0 -39
  317. package/templates/autopilot/README.md +0 -122
  318. package/templates/autopilot/devcontainer.json +0 -21
  319. package/templates/industry/ecommerce.md +0 -127
  320. package/templates/industry/fintech.md +0 -161
  321. package/templates/industry/saas.md +0 -134
  322. package/templates/session-memory.json +0 -48
  323. 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
- }