@girardelli/architect 5.0.0 → 8.1.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 (335) hide show
  1. package/dist/{cli.d.ts → src/adapters/cli.d.ts} +1 -2
  2. package/dist/{cli.js → src/adapters/cli.js} +191 -213
  3. package/dist/src/adapters/cli.js.map +1 -0
  4. package/dist/src/adapters/github-action.d.ts +9 -0
  5. package/dist/src/adapters/github-action.js +94 -0
  6. package/dist/src/adapters/github-action.js.map +1 -0
  7. package/dist/src/adapters/html-reporter/scripts.d.ts +5 -0
  8. package/dist/src/adapters/html-reporter/scripts.js +400 -0
  9. package/dist/src/adapters/html-reporter/scripts.js.map +1 -0
  10. package/dist/src/adapters/html-reporter/sections/agents.d.ts +2 -0
  11. package/dist/src/adapters/html-reporter/sections/agents.js +260 -0
  12. package/dist/src/adapters/html-reporter/sections/agents.js.map +1 -0
  13. package/dist/src/adapters/html-reporter/sections/anti-patterns.d.ts +13 -0
  14. package/dist/src/adapters/html-reporter/sections/anti-patterns.js +64 -0
  15. package/dist/src/adapters/html-reporter/sections/anti-patterns.js.map +1 -0
  16. package/dist/src/adapters/html-reporter/sections/header.d.ts +3 -0
  17. package/dist/src/adapters/html-reporter/sections/header.js +30 -0
  18. package/dist/src/adapters/html-reporter/sections/header.js.map +1 -0
  19. package/dist/src/adapters/html-reporter/sections/layers.d.ts +9 -0
  20. package/dist/src/adapters/html-reporter/sections/layers.js +143 -0
  21. package/dist/src/adapters/html-reporter/sections/layers.js.map +1 -0
  22. package/dist/src/adapters/html-reporter/sections/overview.d.ts +2 -0
  23. package/dist/src/adapters/html-reporter/sections/overview.js +58 -0
  24. package/dist/src/adapters/html-reporter/sections/overview.js.map +1 -0
  25. package/dist/src/adapters/html-reporter/sections/refactoring-plan.d.ts +3 -0
  26. package/dist/src/adapters/html-reporter/sections/refactoring-plan.js +151 -0
  27. package/dist/src/adapters/html-reporter/sections/refactoring-plan.js.map +1 -0
  28. package/dist/src/adapters/html-reporter/sections/score.d.ts +7 -0
  29. package/dist/src/adapters/html-reporter/sections/score.js +70 -0
  30. package/dist/src/adapters/html-reporter/sections/score.js.map +1 -0
  31. package/dist/src/adapters/html-reporter/sections/suggestions.d.ts +7 -0
  32. package/dist/src/adapters/html-reporter/sections/suggestions.js +34 -0
  33. package/dist/src/adapters/html-reporter/sections/suggestions.js.map +1 -0
  34. package/dist/src/adapters/html-reporter/styles.d.ts +1 -0
  35. package/dist/src/adapters/html-reporter/styles.js +526 -0
  36. package/dist/src/adapters/html-reporter/styles.js.map +1 -0
  37. package/dist/src/adapters/html-reporter/utils_adapters.d.ts +20 -0
  38. package/dist/src/adapters/html-reporter/utils_adapters.js +32 -0
  39. package/dist/src/adapters/html-reporter/utils_adapters.js.map +1 -0
  40. package/dist/src/adapters/html-reporter/utils_sections.d.ts +7 -0
  41. package/dist/src/adapters/html-reporter/utils_sections.js +58 -0
  42. package/dist/src/adapters/html-reporter/utils_sections.js.map +1 -0
  43. package/dist/src/adapters/html-reporter.d.ts +10 -0
  44. package/dist/src/adapters/html-reporter.js +97 -0
  45. package/dist/src/adapters/html-reporter.js.map +1 -0
  46. package/dist/src/adapters/progress-logger.d.ts +55 -0
  47. package/dist/src/adapters/progress-logger.js +200 -0
  48. package/dist/src/adapters/progress-logger.js.map +1 -0
  49. package/dist/{refactor-reporter.d.ts → src/adapters/refactor-reporter.d.ts} +1 -2
  50. package/dist/{refactor-reporter.js → src/adapters/refactor-reporter.js} +1 -1
  51. package/dist/src/adapters/refactor-reporter.js.map +1 -0
  52. package/dist/{reporter.d.ts → src/adapters/reporter.d.ts} +1 -2
  53. package/dist/src/adapters/reporter.js.map +1 -0
  54. package/dist/src/core/GenesisTerminal.d.ts +8 -0
  55. package/dist/src/core/GenesisTerminal.js +105 -0
  56. package/dist/src/core/GenesisTerminal.js.map +1 -0
  57. package/dist/{index.d.ts → src/core/architect.d.ts} +4 -18
  58. package/dist/{index.js → src/core/architect.js} +22 -21
  59. package/dist/src/core/architect.js.map +1 -0
  60. package/dist/tests/architect-adapter-enrichment.test.d.ts +1 -0
  61. package/dist/tests/architect-adapter-enrichment.test.js +11 -0
  62. package/dist/tests/architect-adapter-enrichment.test.js.map +1 -0
  63. package/dist/tests/github-action.test.d.ts +1 -0
  64. package/dist/tests/github-action.test.js +92 -0
  65. package/dist/tests/github-action.test.js.map +1 -0
  66. package/package.json +15 -65
  67. package/src/adapters/cli.ts +492 -0
  68. package/src/adapters/github-action.ts +109 -0
  69. package/src/adapters/html-reporter/scripts.ts +402 -0
  70. package/src/adapters/html-reporter/sections/agents.ts +267 -0
  71. package/src/adapters/html-reporter/sections/anti-patterns.ts +81 -0
  72. package/src/adapters/html-reporter/sections/header.ts +35 -0
  73. package/src/adapters/html-reporter/sections/layers.ts +165 -0
  74. package/src/adapters/html-reporter/sections/overview.ts +64 -0
  75. package/src/adapters/html-reporter/sections/refactoring-plan.ts +166 -0
  76. package/src/adapters/html-reporter/sections/score.ts +80 -0
  77. package/src/adapters/html-reporter/sections/suggestions.ts +39 -0
  78. package/src/adapters/html-reporter/styles.ts +525 -0
  79. package/src/adapters/html-reporter/utils_adapters.ts +39 -0
  80. package/src/adapters/html-reporter/utils_sections.ts +55 -0
  81. package/src/adapters/html-reporter.ts +102 -0
  82. package/src/adapters/progress-logger.ts +236 -0
  83. package/src/{refactor-reporter.ts → adapters/refactor-reporter.ts} +2 -2
  84. package/src/{reporter.ts → adapters/reporter.ts} +1 -1
  85. package/src/core/GenesisTerminal.ts +127 -0
  86. package/src/{index.ts → core/architect.ts} +27 -45
  87. package/tests/github-action.test.ts +109 -0
  88. package/tsconfig.json +12 -19
  89. package/CONTRIBUTING.md +0 -140
  90. package/LICENSE +0 -21
  91. package/PROJECT_STRUCTURE.txt +0 -168
  92. package/README.md +0 -257
  93. package/architect-run.sh +0 -431
  94. package/assets/banner-v3.html +0 -561
  95. package/dist/agent-generator/context-enricher.d.ts +0 -58
  96. package/dist/agent-generator/context-enricher.d.ts.map +0 -1
  97. package/dist/agent-generator/context-enricher.js +0 -613
  98. package/dist/agent-generator/context-enricher.js.map +0 -1
  99. package/dist/agent-generator/domain-inferrer.d.ts +0 -52
  100. package/dist/agent-generator/domain-inferrer.d.ts.map +0 -1
  101. package/dist/agent-generator/domain-inferrer.js +0 -585
  102. package/dist/agent-generator/domain-inferrer.js.map +0 -1
  103. package/dist/agent-generator/framework-detector.d.ts +0 -40
  104. package/dist/agent-generator/framework-detector.d.ts.map +0 -1
  105. package/dist/agent-generator/framework-detector.js +0 -611
  106. package/dist/agent-generator/framework-detector.js.map +0 -1
  107. package/dist/agent-generator/index.d.ts +0 -47
  108. package/dist/agent-generator/index.d.ts.map +0 -1
  109. package/dist/agent-generator/index.js +0 -545
  110. package/dist/agent-generator/index.js.map +0 -1
  111. package/dist/agent-generator/stack-detector.d.ts +0 -14
  112. package/dist/agent-generator/stack-detector.d.ts.map +0 -1
  113. package/dist/agent-generator/stack-detector.js +0 -124
  114. package/dist/agent-generator/stack-detector.js.map +0 -1
  115. package/dist/agent-generator/templates/core/agents.d.ts +0 -17
  116. package/dist/agent-generator/templates/core/agents.d.ts.map +0 -1
  117. package/dist/agent-generator/templates/core/agents.js +0 -1256
  118. package/dist/agent-generator/templates/core/agents.js.map +0 -1
  119. package/dist/agent-generator/templates/core/architecture-rules.d.ts +0 -7
  120. package/dist/agent-generator/templates/core/architecture-rules.d.ts.map +0 -1
  121. package/dist/agent-generator/templates/core/architecture-rules.js +0 -274
  122. package/dist/agent-generator/templates/core/architecture-rules.js.map +0 -1
  123. package/dist/agent-generator/templates/core/general-rules.d.ts +0 -8
  124. package/dist/agent-generator/templates/core/general-rules.d.ts.map +0 -1
  125. package/dist/agent-generator/templates/core/general-rules.js +0 -301
  126. package/dist/agent-generator/templates/core/general-rules.js.map +0 -1
  127. package/dist/agent-generator/templates/core/hooks-generator.d.ts +0 -21
  128. package/dist/agent-generator/templates/core/hooks-generator.d.ts.map +0 -1
  129. package/dist/agent-generator/templates/core/hooks-generator.js +0 -233
  130. package/dist/agent-generator/templates/core/hooks-generator.js.map +0 -1
  131. package/dist/agent-generator/templates/core/index-md.d.ts +0 -7
  132. package/dist/agent-generator/templates/core/index-md.d.ts.map +0 -1
  133. package/dist/agent-generator/templates/core/index-md.js +0 -246
  134. package/dist/agent-generator/templates/core/index-md.js.map +0 -1
  135. package/dist/agent-generator/templates/core/orchestrator.d.ts +0 -8
  136. package/dist/agent-generator/templates/core/orchestrator.d.ts.map +0 -1
  137. package/dist/agent-generator/templates/core/orchestrator.js +0 -422
  138. package/dist/agent-generator/templates/core/orchestrator.js.map +0 -1
  139. package/dist/agent-generator/templates/core/preflight.d.ts +0 -8
  140. package/dist/agent-generator/templates/core/preflight.d.ts.map +0 -1
  141. package/dist/agent-generator/templates/core/preflight.js +0 -213
  142. package/dist/agent-generator/templates/core/preflight.js.map +0 -1
  143. package/dist/agent-generator/templates/core/quality-gates.d.ts +0 -11
  144. package/dist/agent-generator/templates/core/quality-gates.d.ts.map +0 -1
  145. package/dist/agent-generator/templates/core/quality-gates.js +0 -254
  146. package/dist/agent-generator/templates/core/quality-gates.js.map +0 -1
  147. package/dist/agent-generator/templates/core/security-rules.d.ts +0 -7
  148. package/dist/agent-generator/templates/core/security-rules.d.ts.map +0 -1
  149. package/dist/agent-generator/templates/core/security-rules.js +0 -528
  150. package/dist/agent-generator/templates/core/security-rules.js.map +0 -1
  151. package/dist/agent-generator/templates/core/skills-generator.d.ts +0 -19
  152. package/dist/agent-generator/templates/core/skills-generator.d.ts.map +0 -1
  153. package/dist/agent-generator/templates/core/skills-generator.js +0 -546
  154. package/dist/agent-generator/templates/core/skills-generator.js.map +0 -1
  155. package/dist/agent-generator/templates/core/workflow-fix-bug.d.ts +0 -7
  156. package/dist/agent-generator/templates/core/workflow-fix-bug.d.ts.map +0 -1
  157. package/dist/agent-generator/templates/core/workflow-fix-bug.js +0 -237
  158. package/dist/agent-generator/templates/core/workflow-fix-bug.js.map +0 -1
  159. package/dist/agent-generator/templates/core/workflow-new-feature.d.ts +0 -8
  160. package/dist/agent-generator/templates/core/workflow-new-feature.d.ts.map +0 -1
  161. package/dist/agent-generator/templates/core/workflow-new-feature.js +0 -321
  162. package/dist/agent-generator/templates/core/workflow-new-feature.js.map +0 -1
  163. package/dist/agent-generator/templates/core/workflow-review.d.ts +0 -7
  164. package/dist/agent-generator/templates/core/workflow-review.d.ts.map +0 -1
  165. package/dist/agent-generator/templates/core/workflow-review.js +0 -104
  166. package/dist/agent-generator/templates/core/workflow-review.js.map +0 -1
  167. package/dist/agent-generator/templates/domain/index.d.ts +0 -22
  168. package/dist/agent-generator/templates/domain/index.d.ts.map +0 -1
  169. package/dist/agent-generator/templates/domain/index.js +0 -1176
  170. package/dist/agent-generator/templates/domain/index.js.map +0 -1
  171. package/dist/agent-generator/templates/stack/index.d.ts +0 -8
  172. package/dist/agent-generator/templates/stack/index.d.ts.map +0 -1
  173. package/dist/agent-generator/templates/stack/index.js +0 -695
  174. package/dist/agent-generator/templates/stack/index.js.map +0 -1
  175. package/dist/agent-generator/templates/template-helpers.d.ts +0 -75
  176. package/dist/agent-generator/templates/template-helpers.d.ts.map +0 -1
  177. package/dist/agent-generator/templates/template-helpers.js +0 -726
  178. package/dist/agent-generator/templates/template-helpers.js.map +0 -1
  179. package/dist/agent-generator/types.d.ts +0 -196
  180. package/dist/agent-generator/types.d.ts.map +0 -1
  181. package/dist/agent-generator/types.js +0 -27
  182. package/dist/agent-generator/types.js.map +0 -1
  183. package/dist/analyzer.d.ts +0 -38
  184. package/dist/analyzer.d.ts.map +0 -1
  185. package/dist/analyzer.js +0 -383
  186. package/dist/analyzer.js.map +0 -1
  187. package/dist/analyzers/forecast.d.ts +0 -85
  188. package/dist/analyzers/forecast.d.ts.map +0 -1
  189. package/dist/analyzers/forecast.js +0 -337
  190. package/dist/analyzers/forecast.js.map +0 -1
  191. package/dist/analyzers/git-cache.d.ts +0 -7
  192. package/dist/analyzers/git-cache.d.ts.map +0 -1
  193. package/dist/analyzers/git-cache.js +0 -41
  194. package/dist/analyzers/git-cache.js.map +0 -1
  195. package/dist/analyzers/git-history.d.ts +0 -113
  196. package/dist/analyzers/git-history.d.ts.map +0 -1
  197. package/dist/analyzers/git-history.js +0 -333
  198. package/dist/analyzers/git-history.js.map +0 -1
  199. package/dist/analyzers/index.d.ts +0 -10
  200. package/dist/analyzers/index.d.ts.map +0 -1
  201. package/dist/analyzers/index.js +0 -7
  202. package/dist/analyzers/index.js.map +0 -1
  203. package/dist/analyzers/temporal-scorer.d.ts +0 -72
  204. package/dist/analyzers/temporal-scorer.d.ts.map +0 -1
  205. package/dist/analyzers/temporal-scorer.js +0 -140
  206. package/dist/analyzers/temporal-scorer.js.map +0 -1
  207. package/dist/anti-patterns.d.ts +0 -24
  208. package/dist/anti-patterns.d.ts.map +0 -1
  209. package/dist/anti-patterns.js +0 -230
  210. package/dist/anti-patterns.js.map +0 -1
  211. package/dist/cli.d.ts.map +0 -1
  212. package/dist/cli.js.map +0 -1
  213. package/dist/config.d.ts +0 -12
  214. package/dist/config.d.ts.map +0 -1
  215. package/dist/config.js +0 -110
  216. package/dist/config.js.map +0 -1
  217. package/dist/diagram.d.ts +0 -9
  218. package/dist/diagram.d.ts.map +0 -1
  219. package/dist/diagram.js +0 -116
  220. package/dist/diagram.js.map +0 -1
  221. package/dist/html-reporter.d.ts +0 -47
  222. package/dist/html-reporter.d.ts.map +0 -1
  223. package/dist/html-reporter.js +0 -1747
  224. package/dist/html-reporter.js.map +0 -1
  225. package/dist/index.d.ts.map +0 -1
  226. package/dist/index.js.map +0 -1
  227. package/dist/project-summarizer.d.ts +0 -38
  228. package/dist/project-summarizer.d.ts.map +0 -1
  229. package/dist/project-summarizer.js +0 -463
  230. package/dist/project-summarizer.js.map +0 -1
  231. package/dist/refactor-engine.d.ts +0 -18
  232. package/dist/refactor-engine.d.ts.map +0 -1
  233. package/dist/refactor-engine.js +0 -86
  234. package/dist/refactor-engine.js.map +0 -1
  235. package/dist/refactor-reporter.d.ts.map +0 -1
  236. package/dist/refactor-reporter.js.map +0 -1
  237. package/dist/reporter.d.ts.map +0 -1
  238. package/dist/reporter.js.map +0 -1
  239. package/dist/rules/barrel-optimizer.d.ts +0 -13
  240. package/dist/rules/barrel-optimizer.d.ts.map +0 -1
  241. package/dist/rules/barrel-optimizer.js +0 -77
  242. package/dist/rules/barrel-optimizer.js.map +0 -1
  243. package/dist/rules/dead-code-detector.d.ts +0 -21
  244. package/dist/rules/dead-code-detector.d.ts.map +0 -1
  245. package/dist/rules/dead-code-detector.js +0 -117
  246. package/dist/rules/dead-code-detector.js.map +0 -1
  247. package/dist/rules/hub-splitter.d.ts +0 -13
  248. package/dist/rules/hub-splitter.d.ts.map +0 -1
  249. package/dist/rules/hub-splitter.js +0 -110
  250. package/dist/rules/hub-splitter.js.map +0 -1
  251. package/dist/rules/import-organizer.d.ts +0 -13
  252. package/dist/rules/import-organizer.d.ts.map +0 -1
  253. package/dist/rules/import-organizer.js +0 -85
  254. package/dist/rules/import-organizer.js.map +0 -1
  255. package/dist/rules/module-grouper.d.ts +0 -13
  256. package/dist/rules/module-grouper.d.ts.map +0 -1
  257. package/dist/rules/module-grouper.js +0 -110
  258. package/dist/rules/module-grouper.js.map +0 -1
  259. package/dist/scanner.d.ts +0 -31
  260. package/dist/scanner.d.ts.map +0 -1
  261. package/dist/scanner.js +0 -328
  262. package/dist/scanner.js.map +0 -1
  263. package/dist/scorer.d.ts +0 -27
  264. package/dist/scorer.d.ts.map +0 -1
  265. package/dist/scorer.js +0 -229
  266. package/dist/scorer.js.map +0 -1
  267. package/dist/types.d.ts +0 -186
  268. package/dist/types.d.ts.map +0 -1
  269. package/dist/types.js +0 -2
  270. package/dist/types.js.map +0 -1
  271. package/examples/sample-report.md +0 -207
  272. package/jest.config.js +0 -18
  273. package/src/agent-generator/context-enricher.ts +0 -672
  274. package/src/agent-generator/domain-inferrer.ts +0 -635
  275. package/src/agent-generator/framework-detector.ts +0 -669
  276. package/src/agent-generator/index.ts +0 -634
  277. package/src/agent-generator/stack-detector.ts +0 -115
  278. package/src/agent-generator/templates/core/agents.ts +0 -1296
  279. package/src/agent-generator/templates/core/architecture-rules.ts +0 -287
  280. package/src/agent-generator/templates/core/general-rules.ts +0 -306
  281. package/src/agent-generator/templates/core/hooks-generator.ts +0 -242
  282. package/src/agent-generator/templates/core/index-md.ts +0 -260
  283. package/src/agent-generator/templates/core/orchestrator.ts +0 -459
  284. package/src/agent-generator/templates/core/preflight.ts +0 -215
  285. package/src/agent-generator/templates/core/quality-gates.ts +0 -256
  286. package/src/agent-generator/templates/core/security-rules.ts +0 -543
  287. package/src/agent-generator/templates/core/skills-generator.ts +0 -585
  288. package/src/agent-generator/templates/core/workflow-fix-bug.ts +0 -239
  289. package/src/agent-generator/templates/core/workflow-new-feature.ts +0 -323
  290. package/src/agent-generator/templates/core/workflow-review.ts +0 -106
  291. package/src/agent-generator/templates/domain/index.ts +0 -1201
  292. package/src/agent-generator/templates/stack/index.ts +0 -705
  293. package/src/agent-generator/templates/template-helpers.ts +0 -776
  294. package/src/agent-generator/types.ts +0 -232
  295. package/src/analyzer.ts +0 -447
  296. package/src/analyzers/forecast.ts +0 -496
  297. package/src/analyzers/git-cache.ts +0 -52
  298. package/src/analyzers/git-history.ts +0 -488
  299. package/src/analyzers/index.ts +0 -33
  300. package/src/analyzers/temporal-scorer.ts +0 -227
  301. package/src/anti-patterns.ts +0 -287
  302. package/src/cli.ts +0 -517
  303. package/src/config.ts +0 -123
  304. package/src/diagram.ts +0 -144
  305. package/src/html-reporter.ts +0 -1830
  306. package/src/project-summarizer.ts +0 -521
  307. package/src/refactor-engine.ts +0 -117
  308. package/src/rules/barrel-optimizer.ts +0 -97
  309. package/src/rules/dead-code-detector.ts +0 -132
  310. package/src/rules/hub-splitter.ts +0 -123
  311. package/src/rules/import-organizer.ts +0 -98
  312. package/src/rules/module-grouper.ts +0 -124
  313. package/src/scanner.ts +0 -344
  314. package/src/scorer.ts +0 -254
  315. package/src/types.ts +0 -193
  316. package/tests/agent-generator.test.ts +0 -427
  317. package/tests/analyzers-integration.test.ts +0 -174
  318. package/tests/anti-patterns.test.ts +0 -94
  319. package/tests/context-enricher.test.ts +0 -971
  320. package/tests/fixtures/monorepo/package.json +0 -6
  321. package/tests/fixtures/monorepo/packages/app/package.json +0 -12
  322. package/tests/fixtures/monorepo/packages/app/src/index.ts +0 -6
  323. package/tests/fixtures/monorepo/packages/core/package.json +0 -7
  324. package/tests/fixtures/monorepo/packages/core/src/index.ts +0 -7
  325. package/tests/forecast.test.ts +0 -509
  326. package/tests/framework-detector.test.ts +0 -1172
  327. package/tests/git-history.test.ts +0 -254
  328. package/tests/monorepo-scan.test.ts +0 -170
  329. package/tests/scanner.test.ts +0 -54
  330. package/tests/scorer.test.ts +0 -674
  331. package/tests/stack-detector.test.ts +0 -241
  332. package/tests/template-generation.test.ts +0 -706
  333. package/tests/template-helpers.test.ts +0 -1152
  334. package/tests/temporal-scorer.test.ts +0 -307
  335. /package/dist/{reporter.js → src/adapters/reporter.js} +0 -0
@@ -1,706 +0,0 @@
1
- import { TemplateContext, DEFAULT_AGENT_CONFIG, StackInfo } from '../src/agent-generator/types.js';
2
- import { AnalysisReport, RefactoringPlan } from '../src/types.js';
3
-
4
- // ── Core Templates ──
5
- import { generateIndexMd } from '../src/agent-generator/templates/core/index-md.js';
6
- import { generateOrchestrator } from '../src/agent-generator/templates/core/orchestrator.js';
7
- import { generatePreflight } from '../src/agent-generator/templates/core/preflight.js';
8
- import { generateQualityGates } from '../src/agent-generator/templates/core/quality-gates.js';
9
- import { generateGeneralRules } from '../src/agent-generator/templates/core/general-rules.js';
10
- import { generateArchitectureRules } from '../src/agent-generator/templates/core/architecture-rules.js';
11
- import { generateSecurityRules } from '../src/agent-generator/templates/core/security-rules.js';
12
- import { generateNewFeatureWorkflow } from '../src/agent-generator/templates/core/workflow-new-feature.js';
13
- import { generateFixBugWorkflow } from '../src/agent-generator/templates/core/workflow-fix-bug.js';
14
- import { generateReviewWorkflow } from '../src/agent-generator/templates/core/workflow-review.js';
15
- import {
16
- generateBackendAgent,
17
- generateFrontendAgent,
18
- generateSecurityAgent,
19
- generateQAAgent,
20
- generateTechDebtAgent,
21
- generateCodeReviewChecklist,
22
- generateDatabaseAgent,
23
- generateMobileAgent,
24
- } from '../src/agent-generator/templates/core/agents.js';
25
-
26
- // ── Domain Templates ──
27
- import {
28
- generateC4Template,
29
- generateBddTemplate,
30
- generateTddTemplate,
31
- generateAdrTemplate,
32
- generateThreatModelTemplate,
33
- } from '../src/agent-generator/templates/domain/index.js';
34
-
35
- // ── Stack Templates ──
36
- import { generateStackRules, getStackRuleFileName } from '../src/agent-generator/templates/stack/index.js';
37
-
38
- // ── Helpers ──
39
-
40
- function makeStack(overrides: Partial<StackInfo> = {}): StackInfo {
41
- return {
42
- primary: 'TypeScript',
43
- languages: ['TypeScript'],
44
- frameworks: ['NestJS'],
45
- hasBackend: true,
46
- hasFrontend: false,
47
- hasMobile: false,
48
- hasDatabase: true,
49
- testFramework: 'Jest',
50
- packageManager: 'npm',
51
- ...overrides,
52
- };
53
- }
54
-
55
- function makeReport(overrides: Partial<AnalysisReport> = {}): AnalysisReport {
56
- return {
57
- timestamp: new Date().toISOString(),
58
- projectInfo: {
59
- path: '/test',
60
- name: 'test-project',
61
- frameworks: ['NestJS'],
62
- totalFiles: 50,
63
- totalLines: 5000,
64
- primaryLanguages: ['TypeScript'],
65
- },
66
- score: {
67
- overall: 72,
68
- components: [],
69
- breakdown: { modularity: 80, coupling: 65, cohesion: 70, layering: 75 },
70
- },
71
- antiPatterns: [
72
- {
73
- name: 'God Class',
74
- severity: 'CRITICAL',
75
- location: 'src/AppService.ts',
76
- description: 'Class with 800 lines',
77
- suggestion: 'Split into smaller services',
78
- affectedFiles: ['src/AppService.ts'],
79
- },
80
- ],
81
- layers: [
82
- { name: 'API', files: ['src/controller.ts'], description: 'API layer' },
83
- { name: 'Service', files: ['src/service.ts'], description: 'Service layer' },
84
- ],
85
- dependencyGraph: {
86
- nodes: ['src/controller.ts', 'src/service.ts'],
87
- edges: [{ from: 'src/controller.ts', to: 'src/service.ts', type: 'import', weight: 1 }],
88
- },
89
- suggestions: [],
90
- diagram: { mermaid: '', type: 'layer' },
91
- ...overrides,
92
- };
93
- }
94
-
95
- function makePlan(overrides: Partial<RefactoringPlan> = {}): RefactoringPlan {
96
- return {
97
- timestamp: new Date().toISOString(),
98
- projectPath: '/test',
99
- currentScore: {
100
- overall: 72,
101
- components: [],
102
- breakdown: { modularity: 80, coupling: 65, cohesion: 70, layering: 75 },
103
- },
104
- estimatedScoreAfter: { overall: 82, breakdown: { modularity: 85, coupling: 75, cohesion: 80, layering: 80 } },
105
- steps: [
106
- {
107
- id: 1,
108
- tier: 1,
109
- rule: 'hub-splitter',
110
- priority: 'HIGH',
111
- title: 'Split AppService',
112
- description: 'Split into smaller services',
113
- rationale: 'Reduce God Class',
114
- operations: [],
115
- scoreImpact: [{ metric: 'modularity', before: 80, after: 85 }],
116
- },
117
- ],
118
- totalOperations: 1,
119
- tier1Steps: 1,
120
- tier2Steps: 0,
121
- ...overrides,
122
- };
123
- }
124
-
125
- function makeCtx(stackOverrides: Partial<StackInfo> = {}, reportOverrides: Partial<AnalysisReport> = {}): TemplateContext {
126
- const stack = makeStack(stackOverrides);
127
- const report = makeReport(reportOverrides);
128
- const plan = makePlan();
129
- return {
130
- report,
131
- plan,
132
- stack,
133
- projectName: 'test-project',
134
- stackLabel: [...stack.languages, ...stack.frameworks].join(' + '),
135
- config: DEFAULT_AGENT_CONFIG,
136
- };
137
- }
138
-
139
- // ──────────────────────────────────────────────────
140
-
141
- describe('Core Templates', () => {
142
- const ctx = makeCtx();
143
-
144
- describe('INDEX.md', () => {
145
- const output = generateIndexMd(ctx);
146
-
147
- it('should contain header and project info', () => {
148
- expect(output).toContain('Agent Framework');
149
- expect(output).toContain('Architect v3.1');
150
- });
151
-
152
- it('should contain project name', () => {
153
- expect(output).toContain('test-project');
154
- });
155
-
156
- it('should list mandatory reading order', () => {
157
- expect(output).toContain('00-general');
158
- expect(output).toContain('QUALITY-GATES');
159
- });
160
-
161
- it('should reference Architect plugin', () => {
162
- expect(output).toMatch(/architect/i);
163
- });
164
- });
165
-
166
- describe('ORCHESTRATOR', () => {
167
- const output = generateOrchestrator(ctx);
168
-
169
- it('should contain REGRA ABSOLUTA', () => {
170
- expect(output).toContain('REGRA ABSOLUTA');
171
- });
172
-
173
- it('should contain approval gates', () => {
174
- expect(output).toMatch(/gate|aprovação|approval/i);
175
- });
176
-
177
- it('should contain business questions', () => {
178
- expect(output).toMatch(/Q\d/);
179
- });
180
-
181
- it('should be substantial (Enterprise-Grade)', () => {
182
- expect(output.length).toBeGreaterThan(2000);
183
- });
184
- });
185
-
186
- describe('PREFLIGHT', () => {
187
- const output = generatePreflight(ctx);
188
-
189
- it('should contain multiple phases', () => {
190
- expect(output).toMatch(/Phase|Fase|FASE/);
191
- });
192
-
193
- it('should contain environment verification commands', () => {
194
- expect(output).toMatch(/npm|npx|node/);
195
- });
196
-
197
- it('should contain red flags', () => {
198
- expect(output).toMatch(/red flag|PARAR|STOP/i);
199
- });
200
- });
201
-
202
- describe('QUALITY-GATES', () => {
203
- const output = generateQualityGates(ctx);
204
-
205
- it('should contain 3 gate levels', () => {
206
- expect(output).toContain('CRITICAL');
207
- expect(output).toContain('IMPORTANT');
208
- expect(output).toContain('DESIRABLE');
209
- });
210
-
211
- it('should contain coverage threshold', () => {
212
- expect(output).toContain(`${DEFAULT_AGENT_CONFIG.coverageMinimum}%`);
213
- });
214
-
215
- it('should contain blockers', () => {
216
- expect(output).toContain('console.log');
217
- });
218
- });
219
-
220
- describe('00-general', () => {
221
- const output = generateGeneralRules(ctx);
222
-
223
- it('should contain golden rules', () => {
224
- expect(output).toContain('Regras de Ouro');
225
- expect(output).toContain('Git Flow');
226
- });
227
-
228
- it('should contain naming conventions', () => {
229
- expect(output).toMatch(/naming|convention|nomenclatura/i);
230
- });
231
-
232
- it('should contain forbidden actions', () => {
233
- expect(output).toMatch(/proibid|forbidden/i);
234
- });
235
- });
236
-
237
- describe('01-architecture', () => {
238
- const output = generateArchitectureRules(ctx);
239
-
240
- it('should contain layer rules table', () => {
241
- expect(output).toContain('Camada');
242
- expect(output).toContain('Responsabilidade');
243
- });
244
-
245
- it('should contain NestJS-specific patterns for NestJS stack', () => {
246
- expect(output).toContain('NestJS');
247
- expect(output).toContain('@Controller');
248
- });
249
-
250
- it('should contain dependency direction', () => {
251
- expect(output).toContain('Direção de Dependência');
252
- });
253
-
254
- it('should contain anti-patterns section', () => {
255
- expect(output).toContain('God Class');
256
- expect(output).toContain('Circular');
257
- });
258
-
259
- it('should contain project anti-patterns from report', () => {
260
- expect(output).toContain('AppService');
261
- });
262
-
263
- it('should contain architecture checklist', () => {
264
- expect(output).toContain('Checklist');
265
- });
266
- });
267
-
268
- describe('01-architecture (Python stack)', () => {
269
- const pythonCtx = makeCtx({
270
- primary: 'Python',
271
- languages: ['Python'],
272
- frameworks: ['Django'],
273
- });
274
- const output = generateArchitectureRules(pythonCtx);
275
-
276
- it('should contain Python-specific layer rules', () => {
277
- expect(output).toContain('Python');
278
- expect(output).toContain('views.py');
279
- });
280
- });
281
-
282
- describe('02-security', () => {
283
- const output = generateSecurityRules(ctx);
284
-
285
- it('should contain OWASP Top 10', () => {
286
- expect(output).toContain('OWASP');
287
- expect(output).toContain('A01');
288
- expect(output).toContain('A10');
289
- });
290
-
291
- it('should contain REGRA ZERO', () => {
292
- expect(output).toContain('REGRA ZERO');
293
- });
294
-
295
- it('should contain validation patterns', () => {
296
- expect(output).toContain('Validação de Input');
297
- });
298
-
299
- it('should contain NestJS validation for NestJS stack', () => {
300
- expect(output).toContain('class-validator');
301
- expect(output).toContain('ValidationPipe');
302
- });
303
-
304
- it('should contain secrets management', () => {
305
- expect(output).toContain('Secrets');
306
- expect(output).toContain('.env');
307
- expect(output).toContain('.gitignore');
308
- });
309
-
310
- it('should contain STRIDE', () => {
311
- expect(output).toContain('STRIDE');
312
- });
313
-
314
- it('should contain security checklist per layer', () => {
315
- expect(output).toContain('Controller');
316
- expect(output).toContain('Service');
317
- expect(output).toContain('Data');
318
- });
319
- });
320
-
321
- describe('02-security (Python stack)', () => {
322
- const pythonCtx = makeCtx({
323
- primary: 'Python',
324
- languages: ['Python'],
325
- frameworks: ['FastAPI'],
326
- });
327
- const output = generateSecurityRules(pythonCtx);
328
-
329
- it('should contain Python validation patterns', () => {
330
- expect(output).toContain('Pydantic');
331
- });
332
-
333
- it('should contain Python audit commands', () => {
334
- expect(output).toContain('pip audit');
335
- });
336
- });
337
- });
338
-
339
- describe('Workflow Templates', () => {
340
- const ctx = makeCtx();
341
-
342
- describe('new-feature', () => {
343
- const output = generateNewFeatureWorkflow(ctx);
344
-
345
- it('should contain 10 steps', () => {
346
- // Check for step markers
347
- const stepMatches = output.match(/step|passo|fase/gi);
348
- expect(stepMatches).toBeTruthy();
349
- expect(stepMatches!.length).toBeGreaterThan(5);
350
- });
351
-
352
- it('should contain approval gates', () => {
353
- expect(output).toMatch(/aprov|gate|humano/i);
354
- });
355
-
356
- it('should contain integration document requirement', () => {
357
- expect(output).toMatch(/integração|integration/i);
358
- });
359
- });
360
-
361
- describe('fix-bug', () => {
362
- const output = generateFixBugWorkflow(ctx);
363
-
364
- it('should contain diagnostic approach', () => {
365
- expect(output).toMatch(/diagnós|root cause|5 why/i);
366
- });
367
-
368
- it('should contain RED test requirement', () => {
369
- expect(output).toMatch(/RED|teste.*falha/i);
370
- });
371
- });
372
-
373
- describe('review', () => {
374
- const output = generateReviewWorkflow(ctx);
375
-
376
- it('should contain review dimensions', () => {
377
- expect(output).toContain('Funcional');
378
- expect(output).toMatch(/Qualidade|Quality/);
379
- expect(output).toMatch(/Segurança|Security/);
380
- });
381
- });
382
- });
383
-
384
- describe('Agent Templates', () => {
385
- const ctx = makeCtx();
386
-
387
- describe('Backend Agent', () => {
388
- const output = generateBackendAgent(ctx);
389
-
390
- it('should reference the detected stack', () => {
391
- expect(output).toContain('TypeScript');
392
- });
393
-
394
- it('should contain SOLID principles', () => {
395
- expect(output).toContain('SOLID');
396
- expect(output).toContain('Single Responsibility');
397
- });
398
-
399
- it('should require integration document', () => {
400
- expect(output).toMatch(/integração|integration/i);
401
- });
402
-
403
- it('should contain coverage gate', () => {
404
- expect(output).toContain(`${DEFAULT_AGENT_CONFIG.coverageMinimum}%`);
405
- });
406
- });
407
-
408
- describe('Frontend Agent', () => {
409
- const frontendCtx = makeCtx({
410
- hasFrontend: true,
411
- frameworks: ['Angular'],
412
- });
413
- const output = generateFrontendAgent(frontendCtx);
414
-
415
- it('should require mockup approval', () => {
416
- expect(output).toMatch(/mockup|MOCKUP/i);
417
- });
418
-
419
- it('should require all UI states', () => {
420
- expect(output).toContain('loading');
421
- expect(output).toContain('error');
422
- expect(output).toContain('empty');
423
- });
424
- });
425
-
426
- describe('Security Agent', () => {
427
- const output = generateSecurityAgent(ctx);
428
-
429
- it('should contain OWASP checklist', () => {
430
- expect(output).toContain('OWASP');
431
- });
432
- });
433
-
434
- describe('QA Agent', () => {
435
- const output = generateQAAgent(ctx);
436
-
437
- it('should contain coverage requirement', () => {
438
- expect(output).toContain(`${DEFAULT_AGENT_CONFIG.coverageMinimum}%`);
439
- });
440
-
441
- it('should contain test pyramid', () => {
442
- expect(output).toMatch(/pirâmide|pyramid/i);
443
- });
444
-
445
- it('should contain BDD/TDD process', () => {
446
- expect(output).toContain('BDD');
447
- expect(output).toContain('TDD');
448
- });
449
- });
450
-
451
- describe('Tech Debt Agent', () => {
452
- const output = generateTechDebtAgent(ctx);
453
-
454
- it('should contain current score', () => {
455
- expect(output).toContain('72/100');
456
- });
457
-
458
- it('should contain anti-patterns from report', () => {
459
- expect(output).toContain('God Class');
460
- });
461
-
462
- it('should prevent score regression', () => {
463
- expect(output).toMatch(/regre|NUNCA.*pode.*regredir/i);
464
- });
465
- });
466
-
467
- describe('Database Agent', () => {
468
- const output = generateDatabaseAgent(ctx);
469
-
470
- it('should contain migration rules', () => {
471
- expect(output).toMatch(/migration|migração/i);
472
- });
473
-
474
- it('should contain indexing rules', () => {
475
- expect(output).toMatch(/índice|index/i);
476
- });
477
- });
478
-
479
- describe('Mobile Agent', () => {
480
- const mobileCtx = makeCtx({
481
- primary: 'Dart',
482
- languages: ['Dart'],
483
- frameworks: ['Flutter'],
484
- hasMobile: true,
485
- });
486
- const output = generateMobileAgent(mobileCtx);
487
-
488
- it('should be Flutter-specific', () => {
489
- expect(output).toContain('Flutter');
490
- });
491
-
492
- it('should require all states', () => {
493
- expect(output).toContain('loading');
494
- expect(output).toContain('error');
495
- expect(output).toContain('empty');
496
- });
497
- });
498
-
499
- describe('Code Review Checklist', () => {
500
- const output = generateCodeReviewChecklist(ctx);
501
-
502
- it('should contain mandatory section', () => {
503
- expect(output).toContain('Obrigatório');
504
- });
505
-
506
- it('should contain security section', () => {
507
- expect(output).toMatch(/Segurança|Security/);
508
- });
509
- });
510
- });
511
-
512
- describe('Domain Templates', () => {
513
- it('C4 template should contain 4 levels', () => {
514
- const output = generateC4Template();
515
- expect(output).toContain('Contexto');
516
- expect(output).toContain('Container');
517
- expect(output).toContain('Componente');
518
- expect(output).toContain('Código');
519
- });
520
-
521
- it('BDD template should contain Gherkin format', () => {
522
- const output = generateBddTemplate();
523
- expect(output).toMatch(/Given|Dado/i);
524
- expect(output).toMatch(/When|Quando/i);
525
- expect(output).toMatch(/Then|Então/i);
526
- });
527
-
528
- it('TDD template should contain RED-GREEN-REFACTOR', () => {
529
- const output = generateTddTemplate();
530
- expect(output).toContain('RED');
531
- expect(output).toContain('GREEN');
532
- expect(output).toContain('REFACTOR');
533
- });
534
-
535
- it('ADR template should contain decision record structure', () => {
536
- const output = generateAdrTemplate();
537
- expect(output).toMatch(/Status|Contexto|Context|Decision|Decisão/);
538
- });
539
-
540
- it('Threat Model template should contain STRIDE', () => {
541
- const output = generateThreatModelTemplate();
542
- expect(output).toContain('STRIDE');
543
- expect(output).toContain('poofing'); // **S**poofing contains "poofing"
544
- expect(output).toContain('ampering'); // **T**ampering
545
- });
546
- });
547
-
548
- describe('Stack-Specific Templates', () => {
549
- it('should generate NestJS rules for NestJS stack', () => {
550
- const ctx = makeCtx({ frameworks: ['NestJS'] });
551
- const output = generateStackRules(ctx);
552
-
553
- expect(output).not.toBeNull();
554
- expect(output).toContain('NestJS');
555
- expect(output).toContain('@Module');
556
- expect(output).toContain('@Controller');
557
- expect(output).toContain('@Injectable');
558
- });
559
-
560
- it('should generate Angular rules for Angular stack', () => {
561
- const ctx = makeCtx({ frameworks: ['Angular'], hasFrontend: true });
562
- const output = generateStackRules(ctx);
563
-
564
- expect(output).not.toBeNull();
565
- expect(output).toContain('Angular');
566
- expect(output).toContain('OnPush');
567
- });
568
-
569
- it('should generate Flutter rules for Flutter stack', () => {
570
- const ctx = makeCtx({
571
- primary: 'Dart',
572
- languages: ['Dart'],
573
- frameworks: ['Flutter'],
574
- hasMobile: true,
575
- });
576
- const output = generateStackRules(ctx);
577
-
578
- expect(output).not.toBeNull();
579
- expect(output).toContain('Flutter');
580
- expect(output).toContain('BLoC');
581
- });
582
-
583
- it('should generate Python rules for Django stack', () => {
584
- const ctx = makeCtx({
585
- primary: 'Python',
586
- languages: ['Python'],
587
- frameworks: ['Django'],
588
- });
589
- const output = generateStackRules(ctx);
590
-
591
- expect(output).not.toBeNull();
592
- expect(output).toContain('Django');
593
- });
594
-
595
- it('should generate Next.js rules for Next.js stack', () => {
596
- const ctx = makeCtx({ frameworks: ['Next.js'], hasFrontend: true });
597
- const output = generateStackRules(ctx);
598
-
599
- expect(output).not.toBeNull();
600
- expect(output).toContain('Next.js');
601
- expect(output).toContain('Server Component');
602
- });
603
-
604
- it('should generate Spring rules for Spring stack', () => {
605
- const ctx = makeCtx({
606
- primary: 'Java/Kotlin',
607
- languages: ['Java/Kotlin'],
608
- frameworks: ['Spring'],
609
- });
610
- const output = generateStackRules(ctx);
611
-
612
- expect(output).not.toBeNull();
613
- expect(output).toContain('Spring');
614
- });
615
-
616
- it('should generate Express rules for Express stack', () => {
617
- const ctx = makeCtx({ frameworks: ['Express'] });
618
- const output = generateStackRules(ctx);
619
-
620
- expect(output).not.toBeNull();
621
- expect(output).toContain('Express');
622
- });
623
-
624
- it('should return null for stacks without specific rules', () => {
625
- const ctx = makeCtx({ frameworks: [] });
626
- const output = generateStackRules(ctx);
627
-
628
- expect(output).toBeNull();
629
- });
630
-
631
- describe('getStackRuleFileName', () => {
632
- it('should return 03-nestjs for NestJS', () => {
633
- const ctx = makeCtx({ frameworks: ['NestJS'] });
634
- expect(getStackRuleFileName(ctx)).toBe('03-nestjs');
635
- });
636
-
637
- it('should return 03-angular for Angular', () => {
638
- const ctx = makeCtx({ frameworks: ['Angular'] });
639
- expect(getStackRuleFileName(ctx)).toBe('03-angular');
640
- });
641
-
642
- it('should return 03-flutter for Flutter', () => {
643
- const ctx = makeCtx({ frameworks: ['Flutter'] });
644
- expect(getStackRuleFileName(ctx)).toBe('03-flutter');
645
- });
646
-
647
- it('should return null for no framework', () => {
648
- const ctx = makeCtx({ frameworks: [] });
649
- expect(getStackRuleFileName(ctx)).toBeNull();
650
- });
651
- });
652
- });
653
-
654
- describe('Template Quality (Enterprise-Grade)', () => {
655
- const ctx = makeCtx();
656
-
657
- it('core templates should be substantial (not skeleton)', () => {
658
- const templates = [
659
- { name: 'INDEX.md', content: generateIndexMd(ctx) },
660
- { name: 'ORCHESTRATOR', content: generateOrchestrator(ctx) },
661
- { name: 'PREFLIGHT', content: generatePreflight(ctx) },
662
- { name: 'QUALITY-GATES', content: generateQualityGates(ctx) },
663
- { name: '00-general', content: generateGeneralRules(ctx) },
664
- { name: '01-architecture', content: generateArchitectureRules(ctx) },
665
- { name: '02-security', content: generateSecurityRules(ctx) },
666
- { name: 'new-feature', content: generateNewFeatureWorkflow(ctx) },
667
- ];
668
-
669
- for (const t of templates) {
670
- // Enterprise-Grade templates should be > 1500 chars minimum
671
- expect(t.content.length).toBeGreaterThan(1500);
672
- }
673
- });
674
-
675
- it('all templates should contain Architect v3.1 signature', () => {
676
- const templates = [
677
- generateOrchestrator(ctx),
678
- generatePreflight(ctx),
679
- generateQualityGates(ctx),
680
- generateGeneralRules(ctx),
681
- generateArchitectureRules(ctx),
682
- generateSecurityRules(ctx),
683
- generateBackendAgent(ctx),
684
- generateSecurityAgent(ctx),
685
- generateQAAgent(ctx),
686
- ];
687
-
688
- for (const content of templates) {
689
- expect(content).toContain('Architect v3.1');
690
- }
691
- });
692
-
693
- it('all agent templates should contain agent_card or antigravity frontmatter', () => {
694
- const agentTemplates = [
695
- generateOrchestrator(ctx),
696
- generateBackendAgent(ctx),
697
- generateSecurityAgent(ctx),
698
- generateQAAgent(ctx),
699
- generateTechDebtAgent(ctx),
700
- ];
701
-
702
- for (const content of agentTemplates) {
703
- expect(content).toMatch(/antigravity:|agent_card:/);
704
- }
705
- });
706
- });