@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,242 +0,0 @@
1
- import { TemplateContext, EnrichedTemplateContext } from '../../types.js';
2
- import { getEnriched } from '../template-helpers.js';
3
-
4
- /**
5
- * Generates executable hook scripts (.sh) for the .agent/hooks/ directory.
6
- * These are real, runnable shell scripts tied to git lifecycle events.
7
- *
8
- * v5.1: Uses project-specific toolchain commands, score thresholds,
9
- * and coverage targets from the enriched context.
10
- */
11
-
12
- /**
13
- * Pre-commit hook: lint + build check
14
- */
15
- export function generatePreCommitHook(ctx: TemplateContext | EnrichedTemplateContext): string {
16
- const enriched = getEnriched(ctx);
17
- const tc = enriched.toolchain;
18
- const config = ctx.config;
19
- const projectName = ctx.projectName;
20
-
21
- const lintCmd = tc?.lintCmd || 'npx eslint .';
22
- const buildCmd = tc?.buildCmd || 'npm run build';
23
-
24
- return `#!/bin/bash
25
- # ============================================================
26
- # PRE-COMMIT HOOK — ${projectName}
27
- # Gerado por Architect v5.1
28
- #
29
- # Instalação:
30
- # cp .agent/hooks/pre-commit.sh .git/hooks/pre-commit
31
- # chmod +x .git/hooks/pre-commit
32
- # ============================================================
33
-
34
- set -e
35
-
36
- echo "🔍 [pre-commit] Verificando qualidade do código..."
37
-
38
- # ── 1. Branch Safety ──
39
- BRANCH=$(git branch --show-current)
40
- if [[ "$BRANCH" == "main" || "$BRANCH" == "master" || "$BRANCH" == "staging" || "$BRANCH" == "develop" ]]; then
41
- echo "❌ BLOQUEADO: Commit direto em '$BRANCH' é proibido."
42
- echo " Crie uma branch: git checkout -b feature/<nome>"
43
- exit 1
44
- fi
45
-
46
- # ── 2. Secrets Check ──
47
- echo "🔐 Verificando secrets..."
48
- SECRETS_PATTERN='(password|secret|api[_-]?key|access[_-]?token|private[_-]?key)\\s*[:=]\\s*["\\'\\x60][^"\\x60]{8,}'
49
-
50
- STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM)
51
- if echo "$STAGED_FILES" | xargs grep -ilE "$SECRETS_PATTERN" 2>/dev/null; then
52
- echo "❌ BLOQUEADO: Possível secret detectado nos arquivos staged."
53
- echo " Remova o secret e use variáveis de ambiente."
54
- exit 1
55
- fi
56
-
57
- # ── 3. File Size Check ──
58
- echo "📏 Verificando tamanho de arquivos..."
59
- for file in $STAGED_FILES; do
60
- if [ -f "$file" ]; then
61
- LINES=$(wc -l < "$file" 2>/dev/null || echo "0")
62
- if [ "$LINES" -gt 500 ]; then
63
- echo "⚠️ AVISO: $file tem $LINES linhas (limite: 500)"
64
- fi
65
- fi
66
- done
67
-
68
- # ── 4. Lint ──
69
- echo "🧹 Executando lint..."
70
- ${lintCmd} --quiet 2>/dev/null || {
71
- echo "❌ BLOQUEADO: Lint falhou."
72
- echo " Corrija: ${lintCmd}"
73
- exit 1
74
- }
75
-
76
- # ── 5. Build ──
77
- echo "🔨 Verificando build..."
78
- ${buildCmd} 2>/dev/null || {
79
- echo "❌ BLOQUEADO: Build falhou."
80
- echo " Corrija: ${buildCmd}"
81
- exit 1
82
- }
83
-
84
- # ── 6. Debug Statements ──
85
- echo "🐛 Verificando debug statements..."
86
- if echo "$STAGED_FILES" | xargs grep -n 'console\\.log\\|debugger\\|print(' 2>/dev/null | grep -v 'node_modules' | grep -v '.test.'; then
87
- echo "⚠️ AVISO: Debug statements encontrados. Remova antes do merge."
88
- fi
89
-
90
- echo "✅ [pre-commit] Tudo OK — commit liberado."
91
- exit 0
92
- `;
93
- }
94
-
95
- /**
96
- * Pre-push hook: test + score gate
97
- */
98
- export function generatePrePushHook(ctx: TemplateContext | EnrichedTemplateContext): string {
99
- const enriched = getEnriched(ctx);
100
- const tc = enriched.toolchain;
101
- const config = ctx.config;
102
- const projectName = ctx.projectName;
103
-
104
- const testCmd = tc?.testCmd || 'npm test';
105
- const coverageCmd = tc?.coverageCmd || 'npm run test -- --coverage';
106
-
107
- return `#!/bin/bash
108
- # ============================================================
109
- # PRE-PUSH HOOK — ${projectName}
110
- # Gerado por Architect v5.1
111
- #
112
- # Instalação:
113
- # cp .agent/hooks/pre-push.sh .git/hooks/pre-push
114
- # chmod +x .git/hooks/pre-push
115
- # ============================================================
116
-
117
- set -e
118
-
119
- echo "🚀 [pre-push] Verificação completa antes do push..."
120
-
121
- # ── 1. Branch Safety ──
122
- BRANCH=$(git branch --show-current)
123
- if [[ "$BRANCH" == "main" || "$BRANCH" == "master" ]]; then
124
- echo "❌ BLOQUEADO: Push direto para '$BRANCH' é proibido."
125
- echo " Use Pull Request."
126
- exit 1
127
- fi
128
-
129
- # ── 2. Full Test Suite ──
130
- echo "🧪 Executando testes completos..."
131
- ${testCmd} || {
132
- echo "❌ BLOQUEADO: Testes falharam."
133
- echo " Corrija antes de fazer push."
134
- exit 1
135
- }
136
-
137
- # ── 3. Coverage Gate ──
138
- echo "📊 Verificando cobertura (mínimo: ${config.coverageMinimum}%)..."
139
- COVERAGE_OUTPUT=$(${coverageCmd} 2>&1 || true)
140
- echo "$COVERAGE_OUTPUT" | tail -5
141
-
142
- # Parse coverage percentage (works with Jest/Istanbul output)
143
- COVERAGE=$(echo "$COVERAGE_OUTPUT" | grep -oP 'All files[^|]*\\|\\s*[\\d.]+' | grep -oP '[\\d.]+$' || echo "0")
144
- if [ -n "$COVERAGE" ]; then
145
- COVERAGE_INT=\${COVERAGE%.*}
146
- if [ "$COVERAGE_INT" -lt ${config.coverageMinimum} ] 2>/dev/null; then
147
- echo "⚠️ AVISO: Cobertura ($COVERAGE_INT%) abaixo do mínimo (${config.coverageMinimum}%)"
148
- fi
149
- fi
150
-
151
- # ── 4. Architecture Score Gate ──
152
- echo "🏗️ Verificando score de arquitetura (mínimo: ${config.scoreThreshold}/100)..."
153
- if command -v architect &> /dev/null; then
154
- SCORE=$(architect score . --json 2>/dev/null | grep -oP '"overall":\\s*\\K[0-9]+' || echo "N/A")
155
- if [ "$SCORE" != "N/A" ] && [ "$SCORE" -lt ${config.scoreThreshold} ] 2>/dev/null; then
156
- echo "❌ BLOQUEADO: Score ($SCORE/100) abaixo do mínimo (${config.scoreThreshold}/100)"
157
- exit 1
158
- fi
159
- echo " Score: $SCORE/100 ✅"
160
- else
161
- echo " ⏭️ architect não instalado — skip score gate"
162
- fi
163
-
164
- echo "✅ [pre-push] Tudo OK — push liberado."
165
- exit 0
166
- `;
167
- }
168
-
169
- /**
170
- * Post-analysis hook: remediation actions
171
- */
172
- export function generatePostAnalysisHook(ctx: TemplateContext | EnrichedTemplateContext): string {
173
- const enriched = getEnriched(ctx);
174
- const projectName = ctx.projectName;
175
- const report = ctx.report;
176
-
177
- return `#!/bin/bash
178
- # ============================================================
179
- # POST-ANALYSIS HOOK — ${projectName}
180
- # Gerado por Architect v5.1
181
- #
182
- # Executa após 'architect analyze .' para gerar ações
183
- # de remediação automáticas.
184
- #
185
- # Uso:
186
- # architect analyze . && bash .agent/hooks/post-analysis.sh
187
- # ============================================================
188
-
189
- set -e
190
-
191
- echo "🔧 [post-analysis] Processando resultados da análise..."
192
-
193
- REPORT_JSON="architect-report.json"
194
- REPORT_HTML="architect-report.html"
195
-
196
- # ── 1. Score Evolution ──
197
- CURRENT_SCORE=${report.score.overall}
198
- echo "📊 Score atual: $CURRENT_SCORE/100"
199
- echo " Meta curto prazo: ${Math.min(100, report.score.overall + 5)}/100"
200
- echo " Meta médio prazo: ${Math.min(100, report.score.overall + 10)}/100"
201
-
202
- # ── 2. Critical Anti-Patterns Alert ──
203
- CRITICAL_COUNT=$(grep -c '"severity":"CRITICAL"' "$REPORT_JSON" 2>/dev/null || echo "0")
204
- HIGH_COUNT=$(grep -c '"severity":"HIGH"' "$REPORT_JSON" 2>/dev/null || echo "0")
205
-
206
- if [ "$CRITICAL_COUNT" -gt 0 ]; then
207
- echo ""
208
- echo "🔴 ATENÇÃO: $CRITICAL_COUNT anti-patterns CRÍTICOS detectados!"
209
- echo " Resolva antes do próximo sprint."
210
- fi
211
-
212
- if [ "$HIGH_COUNT" -gt 0 ]; then
213
- echo "🟠 $HIGH_COUNT anti-patterns HIGH detectados."
214
- fi
215
-
216
- # ── 3. Generate Summary ──
217
- echo ""
218
- echo "📋 Resumo:"
219
- echo " Arquivos: ${report.projectInfo.totalFiles}"
220
- echo " Linhas: ${report.projectInfo.totalLines.toLocaleString()}"
221
- echo " Anti-patterns: ${report.antiPatterns.length}"
222
- echo ""
223
-
224
- # ── 4. Suggestions ──
225
- if [ -f "$REPORT_JSON" ]; then
226
- echo "💡 Top 5 sugestões:"
227
- cat "$REPORT_JSON" | python3 -c "
228
- import json, sys
229
- data = json.load(sys.stdin)
230
- for s in data.get('suggestions', [])[:5]:
231
- print(f' → {s.get(\"description\", \"\")}')
232
- " 2>/dev/null || echo " (instale python3 para ver sugestões)"
233
- fi
234
-
235
- echo ""
236
- echo "📄 Report HTML: $REPORT_HTML"
237
- echo "📦 Report JSON: $REPORT_JSON"
238
- echo ""
239
- echo "✅ [post-analysis] Concluído."
240
- exit 0
241
- `;
242
- }
@@ -1,260 +0,0 @@
1
- import { TemplateContext } from '../../types.js';
2
-
3
- /**
4
- * Generates enterprise-grade INDEX.md — master navigation guide for the agent framework.
5
- * ~350+ lines with: mandatory reads, situational guide, agent catalog, templates, flow diagram.
6
- */
7
- export function generateIndexMd(ctx: TemplateContext): string {
8
- const { report, stack, projectName, stackLabel, plan, config } = ctx;
9
-
10
- const agents = buildAgentCatalog(ctx);
11
- const situationalGuide = buildSituationalGuide(ctx);
12
- const templates = buildTemplatesCatalog();
13
-
14
- return `# ${projectName} — Agent Framework
15
-
16
- > **Auto-generated by [Architect v3.1](https://github.com/camilooscargbaptista/architect)**
17
- > Stack: **${stackLabel}** | Score: **${report.score.overall}/100** | Files: **${report.projectInfo.totalFiles}** | Lines: **${report.projectInfo.totalLines.toLocaleString()}**
18
-
19
- ---
20
-
21
- ## ⛔ PARE AQUI — LEITURA OBRIGATÓRIA
22
-
23
- > **Antes de qualquer ação, leia estes documentos NA ORDEM.**
24
- > Pular esta etapa é violação do protocolo.
25
-
26
- | # | Arquivo | O que contém | Quando ler |
27
- |---|---------|-------------|-----------|
28
- | 1 | [00-general.md](./rules/00-general.md) | Regras de Ouro, convenções, identidade do projeto | **SEMPRE** |
29
- | 2 | [PREFLIGHT.md](./guards/PREFLIGHT.md) | Checklist pré-ação por camada | **SEMPRE** |
30
- | 3 | [QUALITY-GATES.md](./guards/QUALITY-GATES.md) | Métricas mínimas, blockers, processo de verificação | **SEMPRE** |
31
- | 4 | [CODE-REVIEW-CHECKLIST.md](./guards/CODE-REVIEW-CHECKLIST.md) | Pontos obrigatórios de revisão | Antes de PR |
32
-
33
- ---
34
-
35
- ## 🗺️ Guia Situacional
36
-
37
- > **"O que vou fazer?"** → Siga a coluna correspondente.
38
-
39
- ${situationalGuide}
40
-
41
- ---
42
-
43
- ## 🤖 Agentes Disponíveis
44
-
45
- ${agents}
46
-
47
- ---
48
-
49
- ## 📋 Templates Disponíveis
50
-
51
- ${templates}
52
-
53
- ---
54
-
55
- ## 📁 Estrutura do Framework
56
-
57
- \`\`\`
58
- .agent/
59
- ├── INDEX.md ← VOCÊ ESTÁ AQUI
60
- ├── agents/ → Agentes especializados
61
- │ ├── AGENT-ORCHESTRATOR.md
62
- ${stack.hasBackend ? `│ ├── ${stack.primary.toUpperCase()}-BACKEND-DEVELOPER.md\n` : ''}${stack.hasFrontend ? `│ ├── FRONTEND-DEVELOPER.md\n` : ''}${stack.hasMobile ? `│ ├── FLUTTER-UI-DEVELOPER.md\n` : ''}${stack.hasDatabase ? `│ ├── DATABASE-ENGINEER.md\n` : ''}│ ├── SECURITY-AUDITOR.md
63
- │ ├── QA-TEST-ENGINEER.md
64
- │ └── TECH-DEBT-CONTROLLER.md
65
- ├── rules/ → Regras de codificação
66
- │ ├── 00-general.md
67
- │ ├── 01-architecture.md
68
- │ └── 02-security.md
69
- ├── guards/ → Checklists e quality gates
70
- │ ├── PREFLIGHT.md
71
- │ ├── QUALITY-GATES.md
72
- │ └── CODE-REVIEW-CHECKLIST.md
73
- ├── workflows/ → Fluxos de trabalho
74
- │ ├── new-feature.md
75
- │ ├── fix-bug.md
76
- │ └── review.md
77
- ├── templates/ → Templates reutilizáveis
78
- │ ├── C4.md
79
- │ ├── BDD.md
80
- │ ├── TDD.md
81
- │ ├── ADR.md
82
- │ └── THREAT-MODEL.md
83
- └── skills/ → Padrões e referências
84
- \`\`\`
85
-
86
- ---
87
-
88
- ## 🔄 Fluxo Completo de Desenvolvimento
89
-
90
- \`\`\`
91
- REQUISIÇÃO RECEBIDA
92
-
93
-
94
- ┌──────────────────┐
95
- │ PREFLIGHT.md │ ← Ler OBRIGATÓRIO
96
- │ (diagnóstico) │
97
- └────────┬─────────┘
98
-
99
-
100
- ┌──────────────────┐
101
- │ ORCHESTRATOR │ ← Decompõe a requisição
102
- │ (classificar) │
103
- └────────┬─────────┘
104
-
105
-
106
- ┌──────────────────────────────────────┐
107
- │ 6 GATES OBRIGATÓRIOS │
108
- │ │
109
- │ 1. MOCKUP (se tem UI) │
110
- │ 2. User Stories │
111
- │ 3. Arquitetura (C4) │
112
- │ 4. Tarefas (breakdown) │
113
- │ 5. BDD (cenários) │
114
- │ 6. TDD (casos de teste) │
115
- │ │
116
- │ ⚠️ /approved após cada gate │
117
- └────────┬─────────────────────────────┘
118
-
119
-
120
- ┌──────────────────────────────────────┐
121
- │ IMPLEMENTAÇÃO (ordenada) │
122
- │ │
123
- │ 1° Backend (se houver) │
124
- │ 2° Documento de Integração │
125
- │ 3° Frontend / App (se houver) │
126
- └────────┬─────────────────────────────┘
127
-
128
-
129
- ┌──────────────────┐
130
- │ QUALITY-GATES │ ← Build + Coverage ≥ ${config.coverageMinimum}%
131
- │ (verificação) │
132
- └────────┬─────────┘
133
-
134
-
135
- ┌──────────────────┐
136
- │ CODE REVIEW │ ← Checklist obrigatório
137
- │ (PR) │
138
- └────────┬─────────┘
139
-
140
-
141
- ✅ DONE
142
- \`\`\`
143
-
144
- ---
145
-
146
- ## ⚡ Atalhos Rápidos
147
-
148
- | Situação | Comando / Workflow |
149
- |----------|-------------------|
150
- | Nova feature | \`/new-feature\` → [workflow](./workflows/new-feature.md) |
151
- | Corrigir bug | \`/fix-bug\` → [workflow](./workflows/fix-bug.md) |
152
- | Code review | \`/review\` → [workflow](./workflows/review.md) |
153
- | Verificar qualidade | \`architect score ./src\` |
154
- | Analisar arquitetura | \`architect analyze ./src\` |
155
-
156
- ---
157
-
158
- ## 🔌 Plugin Recomendado
159
-
160
- Para análise contínua de arquitetura e manutenção do score:
161
-
162
- \`\`\`
163
- ┌─────────────────────────────────────────────┐
164
- │ 📦 @girardelli/architect │
165
- │ Plugin para Claude Code │
166
- │ │
167
- │ npm install -g @girardelli/architect │
168
- │ │
169
- │ Comandos: │
170
- │ • architect analyze ./src │
171
- │ • architect score ./src │
172
- │ • architect agents ./src │
173
- │ • architect refactor ./src │
174
- │ │
175
- │ Score atual: ${String(report.score.overall).padEnd(2)}/100 │
176
- │ Meta: ${String(Math.min(100, report.score.overall + 10)).padEnd(3)}/100 │
177
- └─────────────────────────────────────────────┘
178
- \`\`\`
179
-
180
- ---
181
-
182
- ## ⚠️ REGRA DE OURO
183
-
184
- > **Na dúvida, PARA e PERGUNTA ao humano.**
185
- > Nunca assuma. Nunca decida sozinho. Sempre valide.
186
-
187
- ---
188
-
189
- **Gerado por Architect v3.1 · Score: ${report.score.overall}/100 · ${new Date().toISOString().split('T')[0]}**
190
- `;
191
- }
192
-
193
- function buildAgentCatalog(ctx: TemplateContext): string {
194
- const { stack } = ctx;
195
- const rows: string[] = [];
196
-
197
- rows.push('| Agente | Role | Capabilities |');
198
- rows.push('|--------|------|-------------|');
199
- rows.push('| [AGENT-ORCHESTRATOR](./agents/AGENT-ORCHESTRATOR.md) | coordination | Decomposição, dispatch, consolidação, quality gate |');
200
-
201
- if (stack.hasBackend) {
202
- rows.push(`| [${stack.primary.toUpperCase()}-BACKEND-DEVELOPER](./agents/${stack.primary.toUpperCase()}-BACKEND-DEVELOPER.md) | development | APIs, serviços, lógica de negócio, migrations |`);
203
- }
204
- if (stack.hasFrontend) {
205
- const fw = stack.frameworks.find(f => ['Angular', 'Vue', 'Next.js', 'React'].includes(f)) || 'FRONTEND';
206
- rows.push(`| [${fw.toUpperCase().replace('.', '')}-FRONTEND-DEVELOPER](./agents/${fw.toUpperCase().replace('.', '')}-FRONTEND-DEVELOPER.md) | development | Componentes, state management, UX responsiva |`);
207
- }
208
- if (stack.hasMobile) {
209
- rows.push('| [FLUTTER-UI-DEVELOPER](./agents/FLUTTER-UI-DEVELOPER.md) | development | Screens, widgets, navegação, integração API |');
210
- }
211
- if (stack.hasDatabase) {
212
- rows.push('| [DATABASE-ENGINEER](./agents/DATABASE-ENGINEER.md) | development | Schema, migrations, indexação, performance |');
213
- }
214
-
215
- rows.push('| [SECURITY-AUDITOR](./agents/SECURITY-AUDITOR.md) | quality | Ameaças STRIDE, OWASP, LGPD, vulnerabilidades |');
216
- rows.push('| [QA-TEST-ENGINEER](./agents/QA-TEST-ENGINEER.md) | quality | Planos de teste, BDD/TDD, cobertura, regressão |');
217
- rows.push('| [TECH-DEBT-CONTROLLER](./agents/TECH-DEBT-CONTROLLER.md) | governance | Débito técnico, refatorações, metas de score |');
218
-
219
- return rows.join('\n');
220
- }
221
-
222
- function buildSituationalGuide(ctx: TemplateContext): string {
223
- const { stack } = ctx;
224
- const rows: string[] = [];
225
-
226
- rows.push('| Ação | Leia antes | Workflow | Agente principal |');
227
- rows.push('|------|-----------|---------|-----------------|');
228
- rows.push('| Nova feature | 00-general + PREFLIGHT | [new-feature](./workflows/new-feature.md) | ORCHESTRATOR |');
229
- rows.push('| Corrigir bug | 00-general + PREFLIGHT | [fix-bug](./workflows/fix-bug.md) | ORCHESTRATOR |');
230
-
231
- if (stack.hasBackend) {
232
- rows.push(`| Mexer em backend | 00-general + 01-architecture | new-feature ou fix-bug | ${stack.primary.toUpperCase()}-BACKEND |`);
233
- }
234
- if (stack.hasFrontend) {
235
- rows.push('| Mexer em frontend | 00-general + 01-architecture | new-feature ou fix-bug | FRONTEND |');
236
- }
237
- if (stack.hasMobile) {
238
- rows.push('| Mexer no app | 00-general | new-feature ou fix-bug | FLUTTER-UI |');
239
- }
240
- if (stack.hasDatabase) {
241
- rows.push('| Mexer em banco | 00-general + 01-architecture | new-feature | DATABASE-ENGINEER |');
242
- }
243
-
244
- rows.push('| Segurança | 02-security | — | SECURITY-AUDITOR |');
245
- rows.push('| Testes | 00-general | — | QA-TEST-ENGINEER |');
246
- rows.push('| Refatoração | QUALITY-GATES | — | TECH-DEBT-CONTROLLER |');
247
- rows.push('| Code review | CODE-REVIEW-CHECKLIST | [review](./workflows/review.md) | QA-TEST-ENGINEER |');
248
-
249
- return rows.join('\n');
250
- }
251
-
252
- function buildTemplatesCatalog(): string {
253
- return `| Template | Arquivo | Quando usar |
254
- |----------|---------|-----------|
255
- | C4 Architecture | [C4.md](./templates/C4.md) | Documentar arquitetura de qualquer feature |
256
- | BDD Scenarios | [BDD.md](./templates/BDD.md) | Antes de implementar — cenários de aceite |
257
- | TDD Cases | [TDD.md](./templates/TDD.md) | Antes de implementar — casos de teste |
258
- | ADR | [ADR.md](./templates/ADR.md) | Decisões arquiteturais significativas |
259
- | Threat Model | [THREAT-MODEL.md](./templates/THREAT-MODEL.md) | Features que lidam com dados sensíveis |`;
260
- }