@girardelli/architect 2.2.0 → 4.0.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 (296) hide show
  1. package/README.md +105 -116
  2. package/__test_agent_output__/INDEX.md +1 -0
  3. package/__test_agent_output__/agents/AGENT-ORCHESTRATOR.md +1 -0
  4. package/__test_agent_output__/agents/DATABASE-ENGINEER.md +174 -0
  5. package/__test_agent_output__/agents/QA-TEST-ENGINEER.md +138 -0
  6. package/__test_agent_output__/agents/SECURITY-AUDITOR.md +106 -0
  7. package/__test_agent_output__/agents/TECH-DEBT-CONTROLLER.md +104 -0
  8. package/__test_agent_output__/agents/TYPESCRIPT-BACKEND-DEVELOPER.md +135 -0
  9. package/__test_agent_output__/guards/CODE-REVIEW-CHECKLIST.md +95 -0
  10. package/__test_agent_output__/guards/PREFLIGHT.md +200 -0
  11. package/__test_agent_output__/guards/QUALITY-GATES.md +1 -0
  12. package/__test_agent_output__/rules/00-general.md +229 -0
  13. package/__test_agent_output__/rules/01-architecture.md +191 -0
  14. package/__test_agent_output__/rules/02-security.md +402 -0
  15. package/__test_agent_output__/rules/03-nestjs.md +124 -0
  16. package/__test_agent_output__/templates/ADR.md +95 -0
  17. package/__test_agent_output__/templates/BDD.md +58 -0
  18. package/__test_agent_output__/templates/C4.md +68 -0
  19. package/__test_agent_output__/templates/TDD.md +86 -0
  20. package/__test_agent_output__/templates/THREAT-MODEL.md +82 -0
  21. package/__test_agent_output__/workflows/fix-bug.md +228 -0
  22. package/__test_agent_output__/workflows/new-feature.md +311 -0
  23. package/__test_agent_output__/workflows/review.md +95 -0
  24. package/__test_context_7RvUrO/src/modules/empty/empty.ts +0 -0
  25. package/__test_context_Rf5fNJ/src/modules/mixed/mixed.ts +5 -0
  26. package/__test_context_WRCnYH/src/modules/test/test.ts +10 -0
  27. package/__test_context_YsnVS3/src/modules/test/test.ts +10 -0
  28. package/__test_context_w7XZeH/src/modules/mixed/mixed.ts +5 -0
  29. package/__test_context_y5noh6/src/modules/empty/empty.ts +0 -0
  30. package/__test_framework__24OjAu/package.json +1 -0
  31. package/__test_framework__3ZDZsx/pyproject.toml +8 -0
  32. package/__test_framework__4T54Jn/package.json +1 -0
  33. package/__test_framework__4tlXu9/pyproject.toml +8 -0
  34. package/__test_framework__6boWqQ/Pipfile +6 -0
  35. package/__test_framework__6gygMU/pom.xml +10 -0
  36. package/__test_framework__6kxj0N/go.mod +8 -0
  37. package/__test_framework__7CEoXw/pom.xml +10 -0
  38. package/__test_framework__85DDz0/Pipfile +6 -0
  39. package/__test_framework__9WrRIr/pom.xml +7 -0
  40. package/__test_framework__ANqGKl/Gemfile +5 -0
  41. package/__test_framework__BCXTEM/go.mod +3 -0
  42. package/__test_framework__BHiPNq/setup.py +2 -0
  43. package/__test_framework__BqkiKv/package.json +1 -0
  44. package/__test_framework__C5yd8X/Pipfile.lock +1 -0
  45. package/__test_framework__C5yd8X/requirements.txt +1 -0
  46. package/__test_framework__C87d3a/manage.py +1 -0
  47. package/__test_framework__C87d3a/requirements.txt +2 -0
  48. package/__test_framework__DXNwc5/build.gradle +7 -0
  49. package/__test_framework__GhHSt3/build.gradle.kts +4 -0
  50. package/__test_framework__GzklJP/Cargo.toml +7 -0
  51. package/__test_framework__H4hd13/go.mod +8 -0
  52. package/__test_framework__HKjOXO/composer.json +1 -0
  53. package/__test_framework__HaDN45/Gemfile +3 -0
  54. package/__test_framework__IBO7YG/pyproject.toml +9 -0
  55. package/__test_framework__JwSOyF/pyproject.toml +6 -0
  56. package/__test_framework__K6HrCr/build.gradle +2 -0
  57. package/__test_framework__KzRPlh/pubspec.yaml +9 -0
  58. package/__test_framework__L6uIym/pyproject.toml +6 -0
  59. package/__test_framework__LOdoGK/requirements.txt +4 -0
  60. package/__test_framework__LgHzss/package.json +1 -0
  61. package/__test_framework__M76M6q/Gemfile +5 -0
  62. package/__test_framework__Mr9vWW/composer.json +1 -0
  63. package/__test_framework__N03Gnv/package.json +1 -0
  64. package/__test_framework__Num4UE/requirements +1 -0
  65. package/__test_framework__OAGw3Y/build.gradle +7 -0
  66. package/__test_framework__OQc8yG/pubspec.yaml +9 -0
  67. package/__test_framework__OwKZcd/requirements.txt +3 -0
  68. package/__test_framework__P0gFv7/requirements +1 -0
  69. package/__test_framework__PN55Rq/package.json +1 -0
  70. package/__test_framework__PQiqX8/pubspec.yaml +3 -0
  71. package/__test_framework__RBHsg7/composer.json +1 -0
  72. package/__test_framework__RHxif4/Cargo.toml +7 -0
  73. package/__test_framework__T0v0p1/Cargo.toml +4 -0
  74. package/__test_framework__Tu0clt/Pipfile.lock +1 -0
  75. package/__test_framework__Tu0clt/requirements.txt +1 -0
  76. package/__test_framework__TwDj9P/Cargo.toml +4 -0
  77. package/__test_framework__VQJNC4/pom.xml +7 -0
  78. package/__test_framework__W6sm05/package.json +1 -0
  79. package/__test_framework__W7vBLy/pyproject.toml +4 -0
  80. package/__test_framework__WNJOWT/setup.py +2 -0
  81. package/__test_framework__WSJs7U/package.json +1 -0
  82. package/__test_framework__YQ5VpA/build.gradle.kts +4 -0
  83. package/__test_framework__ZNEUEs/package.json +1 -0
  84. package/__test_framework__Znt922/pom.xml +7 -0
  85. package/__test_framework__azyg0h/pom.xml +7 -0
  86. package/__test_framework__c6otLr/package.json +1 -0
  87. package/__test_framework__cl9S9G/build.gradle +2 -0
  88. package/__test_framework__eilvV4/composer.json +1 -0
  89. package/__test_framework__gQZxXO/manage.py +1 -0
  90. package/__test_framework__gQZxXO/requirements.txt +2 -0
  91. package/__test_framework__ghvl26/poetry.lock +1 -0
  92. package/__test_framework__ghvl26/pyproject.toml +2 -0
  93. package/__test_framework__hR7b9U/Makefile +11 -0
  94. package/__test_framework__iESVsi/composer.json +1 -0
  95. package/__test_framework__jm6TJy/package.json +1 -0
  96. package/__test_framework__kBUpjs/pyproject.toml +9 -0
  97. package/__test_framework__kqoZrw/requirements.txt +4 -0
  98. package/__test_framework__lWkoyO/pyproject.toml +4 -0
  99. package/__test_framework__mTKnUO/package.json +1 -0
  100. package/__test_framework__nCeZwe/Makefile +11 -0
  101. package/__test_framework__oljsU0/package.json +1 -0
  102. package/__test_framework__osRG4q/go.mod +3 -0
  103. package/__test_framework__pCHH4F/package.json +1 -0
  104. package/__test_framework__pExx6E/Gemfile +3 -0
  105. package/__test_framework__pyBoGd/pyproject.toml +5 -0
  106. package/__test_framework__qw16VQ/package.json +1 -0
  107. package/__test_framework__rRayrG/package.json +1 -0
  108. package/__test_framework__s82zO5/package.json +1 -0
  109. package/__test_framework__tp8MFK/pyproject.toml +5 -0
  110. package/__test_framework__w44k4w/composer.json +1 -0
  111. package/__test_framework__yefPZY/poetry.lock +1 -0
  112. package/__test_framework__yefPZY/pyproject.toml +2 -0
  113. package/__test_framework__zCiyDT/requirements.txt +3 -0
  114. package/__test_framework__zGZN3j/pubspec.yaml +3 -0
  115. package/__test_framework__zXpnxL/package.json +1 -0
  116. package/architect-run.sh +431 -0
  117. package/assets/banner-v3.html +561 -0
  118. package/dist/agent-generator/context-enricher.d.ts +58 -0
  119. package/dist/agent-generator/context-enricher.d.ts.map +1 -0
  120. package/dist/agent-generator/context-enricher.js +581 -0
  121. package/dist/agent-generator/context-enricher.js.map +1 -0
  122. package/dist/agent-generator/domain-inferrer.d.ts +52 -0
  123. package/dist/agent-generator/domain-inferrer.d.ts.map +1 -0
  124. package/dist/agent-generator/domain-inferrer.js +575 -0
  125. package/dist/agent-generator/domain-inferrer.js.map +1 -0
  126. package/dist/agent-generator/framework-detector.d.ts +40 -0
  127. package/dist/agent-generator/framework-detector.d.ts.map +1 -0
  128. package/dist/agent-generator/framework-detector.js +611 -0
  129. package/dist/agent-generator/framework-detector.js.map +1 -0
  130. package/dist/agent-generator/index.d.ts +33 -0
  131. package/dist/agent-generator/index.d.ts.map +1 -0
  132. package/dist/agent-generator/index.js +477 -0
  133. package/dist/agent-generator/index.js.map +1 -0
  134. package/dist/agent-generator/stack-detector.d.ts +12 -0
  135. package/dist/agent-generator/stack-detector.d.ts.map +1 -0
  136. package/dist/agent-generator/stack-detector.js +128 -0
  137. package/dist/agent-generator/stack-detector.js.map +1 -0
  138. package/dist/agent-generator/templates/core/agents.d.ts +17 -0
  139. package/dist/agent-generator/templates/core/agents.d.ts.map +1 -0
  140. package/dist/agent-generator/templates/core/agents.js +1252 -0
  141. package/dist/agent-generator/templates/core/agents.js.map +1 -0
  142. package/dist/agent-generator/templates/core/architecture-rules.d.ts +7 -0
  143. package/dist/agent-generator/templates/core/architecture-rules.d.ts.map +1 -0
  144. package/dist/agent-generator/templates/core/architecture-rules.js +274 -0
  145. package/dist/agent-generator/templates/core/architecture-rules.js.map +1 -0
  146. package/dist/agent-generator/templates/core/general-rules.d.ts +8 -0
  147. package/dist/agent-generator/templates/core/general-rules.d.ts.map +1 -0
  148. package/dist/agent-generator/templates/core/general-rules.js +301 -0
  149. package/dist/agent-generator/templates/core/general-rules.js.map +1 -0
  150. package/dist/agent-generator/templates/core/index-md.d.ts +7 -0
  151. package/dist/agent-generator/templates/core/index-md.d.ts.map +1 -0
  152. package/dist/agent-generator/templates/core/index-md.js +246 -0
  153. package/dist/agent-generator/templates/core/index-md.js.map +1 -0
  154. package/dist/agent-generator/templates/core/orchestrator.d.ts +8 -0
  155. package/dist/agent-generator/templates/core/orchestrator.d.ts.map +1 -0
  156. package/dist/agent-generator/templates/core/orchestrator.js +422 -0
  157. package/dist/agent-generator/templates/core/orchestrator.js.map +1 -0
  158. package/dist/agent-generator/templates/core/preflight.d.ts +8 -0
  159. package/dist/agent-generator/templates/core/preflight.d.ts.map +1 -0
  160. package/dist/agent-generator/templates/core/preflight.js +213 -0
  161. package/dist/agent-generator/templates/core/preflight.js.map +1 -0
  162. package/dist/agent-generator/templates/core/quality-gates.d.ts +11 -0
  163. package/dist/agent-generator/templates/core/quality-gates.d.ts.map +1 -0
  164. package/dist/agent-generator/templates/core/quality-gates.js +254 -0
  165. package/dist/agent-generator/templates/core/quality-gates.js.map +1 -0
  166. package/dist/agent-generator/templates/core/security-rules.d.ts +7 -0
  167. package/dist/agent-generator/templates/core/security-rules.d.ts.map +1 -0
  168. package/dist/agent-generator/templates/core/security-rules.js +528 -0
  169. package/dist/agent-generator/templates/core/security-rules.js.map +1 -0
  170. package/dist/agent-generator/templates/core/skills-generator.d.ts +6 -0
  171. package/dist/agent-generator/templates/core/skills-generator.d.ts.map +1 -0
  172. package/dist/agent-generator/templates/core/skills-generator.js +207 -0
  173. package/dist/agent-generator/templates/core/skills-generator.js.map +1 -0
  174. package/dist/agent-generator/templates/core/workflow-fix-bug.d.ts +7 -0
  175. package/dist/agent-generator/templates/core/workflow-fix-bug.d.ts.map +1 -0
  176. package/dist/agent-generator/templates/core/workflow-fix-bug.js +237 -0
  177. package/dist/agent-generator/templates/core/workflow-fix-bug.js.map +1 -0
  178. package/dist/agent-generator/templates/core/workflow-new-feature.d.ts +8 -0
  179. package/dist/agent-generator/templates/core/workflow-new-feature.d.ts.map +1 -0
  180. package/dist/agent-generator/templates/core/workflow-new-feature.js +321 -0
  181. package/dist/agent-generator/templates/core/workflow-new-feature.js.map +1 -0
  182. package/dist/agent-generator/templates/core/workflow-review.d.ts +7 -0
  183. package/dist/agent-generator/templates/core/workflow-review.d.ts.map +1 -0
  184. package/dist/agent-generator/templates/core/workflow-review.js +104 -0
  185. package/dist/agent-generator/templates/core/workflow-review.js.map +1 -0
  186. package/dist/agent-generator/templates/domain/index.d.ts +22 -0
  187. package/dist/agent-generator/templates/domain/index.d.ts.map +1 -0
  188. package/dist/agent-generator/templates/domain/index.js +1176 -0
  189. package/dist/agent-generator/templates/domain/index.js.map +1 -0
  190. package/dist/agent-generator/templates/stack/index.d.ts +8 -0
  191. package/dist/agent-generator/templates/stack/index.d.ts.map +1 -0
  192. package/dist/agent-generator/templates/stack/index.js +695 -0
  193. package/dist/agent-generator/templates/stack/index.js.map +1 -0
  194. package/dist/agent-generator/templates/template-helpers.d.ts +75 -0
  195. package/dist/agent-generator/templates/template-helpers.d.ts.map +1 -0
  196. package/dist/agent-generator/templates/template-helpers.js +726 -0
  197. package/dist/agent-generator/templates/template-helpers.js.map +1 -0
  198. package/dist/agent-generator/types.d.ts +196 -0
  199. package/dist/agent-generator/types.d.ts.map +1 -0
  200. package/dist/agent-generator/types.js +27 -0
  201. package/dist/agent-generator/types.js.map +1 -0
  202. package/dist/analyzer.d.ts +5 -0
  203. package/dist/analyzer.d.ts.map +1 -1
  204. package/dist/analyzer.js +35 -4
  205. package/dist/analyzer.js.map +1 -1
  206. package/dist/analyzers/forecast.d.ts +85 -0
  207. package/dist/analyzers/forecast.d.ts.map +1 -0
  208. package/dist/analyzers/forecast.js +337 -0
  209. package/dist/analyzers/forecast.js.map +1 -0
  210. package/dist/analyzers/git-cache.d.ts +7 -0
  211. package/dist/analyzers/git-cache.d.ts.map +1 -0
  212. package/dist/analyzers/git-cache.js +41 -0
  213. package/dist/analyzers/git-cache.js.map +1 -0
  214. package/dist/analyzers/git-history.d.ts +113 -0
  215. package/dist/analyzers/git-history.d.ts.map +1 -0
  216. package/dist/analyzers/git-history.js +333 -0
  217. package/dist/analyzers/git-history.js.map +1 -0
  218. package/dist/analyzers/index.d.ts +10 -0
  219. package/dist/analyzers/index.d.ts.map +1 -0
  220. package/dist/analyzers/index.js +7 -0
  221. package/dist/analyzers/index.js.map +1 -0
  222. package/dist/analyzers/temporal-scorer.d.ts +72 -0
  223. package/dist/analyzers/temporal-scorer.d.ts.map +1 -0
  224. package/dist/analyzers/temporal-scorer.js +140 -0
  225. package/dist/analyzers/temporal-scorer.js.map +1 -0
  226. package/dist/cli.d.ts +2 -3
  227. package/dist/cli.d.ts.map +1 -1
  228. package/dist/cli.js +275 -113
  229. package/dist/cli.js.map +1 -1
  230. package/dist/html-reporter.d.ts +3 -1
  231. package/dist/html-reporter.d.ts.map +1 -1
  232. package/dist/html-reporter.js +248 -12
  233. package/dist/html-reporter.js.map +1 -1
  234. package/dist/index.d.ts +16 -3
  235. package/dist/index.d.ts.map +1 -1
  236. package/dist/index.js +63 -4
  237. package/dist/index.js.map +1 -1
  238. package/dist/project-summarizer.d.ts +18 -0
  239. package/dist/project-summarizer.d.ts.map +1 -0
  240. package/dist/project-summarizer.js +306 -0
  241. package/dist/project-summarizer.js.map +1 -0
  242. package/dist/refactor-reporter.js +1 -1
  243. package/dist/types.d.ts +13 -0
  244. package/dist/types.d.ts.map +1 -1
  245. package/package.json +12 -3
  246. package/src/agent-generator/context-enricher.ts +643 -0
  247. package/src/agent-generator/domain-inferrer.ts +625 -0
  248. package/src/agent-generator/framework-detector.ts +669 -0
  249. package/src/agent-generator/index.ts +555 -0
  250. package/src/agent-generator/stack-detector.ts +103 -0
  251. package/src/agent-generator/templates/core/agents.ts +1293 -0
  252. package/src/agent-generator/templates/core/architecture-rules.ts +287 -0
  253. package/src/agent-generator/templates/core/general-rules.ts +306 -0
  254. package/src/agent-generator/templates/core/index-md.ts +260 -0
  255. package/src/agent-generator/templates/core/orchestrator.ts +459 -0
  256. package/src/agent-generator/templates/core/preflight.ts +215 -0
  257. package/src/agent-generator/templates/core/quality-gates.ts +256 -0
  258. package/src/agent-generator/templates/core/security-rules.ts +543 -0
  259. package/src/agent-generator/templates/core/skills-generator.ts +236 -0
  260. package/src/agent-generator/templates/core/workflow-fix-bug.ts +239 -0
  261. package/src/agent-generator/templates/core/workflow-new-feature.ts +323 -0
  262. package/src/agent-generator/templates/core/workflow-review.ts +106 -0
  263. package/src/agent-generator/templates/domain/index.ts +1201 -0
  264. package/src/agent-generator/templates/stack/index.ts +705 -0
  265. package/src/agent-generator/templates/template-helpers.ts +776 -0
  266. package/src/agent-generator/types.ts +232 -0
  267. package/src/analyzer.ts +38 -4
  268. package/src/analyzers/forecast.ts +496 -0
  269. package/src/analyzers/git-cache.ts +52 -0
  270. package/src/analyzers/git-history.ts +488 -0
  271. package/src/analyzers/index.ts +33 -0
  272. package/src/analyzers/temporal-scorer.ts +227 -0
  273. package/src/cli.ts +316 -117
  274. package/src/html-reporter.ts +263 -13
  275. package/src/index.ts +92 -9
  276. package/src/project-summarizer.ts +347 -0
  277. package/src/refactor-reporter.ts +1 -1
  278. package/src/types.ts +10 -0
  279. package/tests/agent-generator.test.ts +411 -0
  280. package/tests/analyzers-integration.test.ts +174 -0
  281. package/tests/architect-adapter-enrichment.test.ts +9 -0
  282. package/tests/context-enricher.test.ts +971 -0
  283. package/tests/forecast.test.ts +509 -0
  284. package/tests/framework-detector.test.ts +1172 -0
  285. package/tests/git-history.test.ts +254 -0
  286. package/tests/scanner.test.ts +7 -8
  287. package/tests/scorer.test.ts +588 -0
  288. package/tests/stack-detector.test.ts +241 -0
  289. package/tests/template-generation.test.ts +706 -0
  290. package/tests/template-helpers.test.ts +1152 -0
  291. package/tests/temporal-scorer.test.ts +307 -0
  292. package/dist/agent-generator.d.ts +0 -106
  293. package/dist/agent-generator.d.ts.map +0 -1
  294. package/dist/agent-generator.js +0 -1398
  295. package/dist/agent-generator.js.map +0 -1
  296. package/src/agent-generator.ts +0 -1526
@@ -0,0 +1,68 @@
1
+ # 🏗️ Template: Arquitetura C4
2
+
3
+ > Preencher os 4 níveis relevantes para a feature/mudança.
4
+
5
+ ---
6
+
7
+ ## Nível 1 — Contexto
8
+
9
+ > Visão de pássaro: quem são os atores e sistemas envolvidos?
10
+
11
+ ```
12
+ Atores:
13
+ - User.Entity: Entidade de negócio
14
+ - User: Entidade de negócio
15
+
16
+ Sistemas Externos:
17
+ - [sistema 1]: [como interage]
18
+ - [sistema 2]: [como interage]
19
+
20
+ Fluxo de dados:
21
+ [ator] → [sistema] → [nosso sistema] → [resposta]
22
+ ```
23
+
24
+ ---
25
+
26
+ ## Nível 2 — Container
27
+
28
+ > Quais serviços, apps, bancos de dados são tocados?
29
+
30
+ ```
31
+ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐
32
+ │ [Frontend] │───▶│ Backend │───▶│ Database │
33
+ └──────────────┘ └──────────────┘ └──────────────┘
34
+ ```
35
+
36
+ ---
37
+
38
+ ## Nível 3 — Componente
39
+
40
+ > Quais módulos, classes, serviços são criados ou modificados?
41
+
42
+ ```
43
+ Módulo: entity
44
+ ├── Controller: [Controllers] — Expõe endpoints REST
45
+ ├── Service: [Services] — Lógica de negócio
46
+ ├── Entity: User — Persistência de dados
47
+ ├── DTO: [Request/Response]
48
+ └── Tests: Pendentes
49
+ ```
50
+
51
+ ---
52
+
53
+ ## Nível 4 — Código (se complexo)
54
+
55
+ > Interfaces, tipos, contratos. Apenas para decisões complexas.
56
+
57
+ ```typescript
58
+ interface Ilist_app.Service {
59
+ // GET /app.
60
+ handlelist_app.(req: Request): Promise<Response>;
61
+ }
62
+ ```
63
+
64
+ ---
65
+
66
+ ## Decisões Arquiteturais
67
+
68
+ Se a decisão é significativa → criar ADR separado (ver template ADR).
@@ -0,0 +1,86 @@
1
+ # 🔬 Template: TDD — Test-Driven Development
2
+
3
+ > RED → GREEN → REFACTOR. Nesta ordem. Sempre.
4
+
5
+ ---
6
+
7
+ ## Estrutura de Testes (jest)
8
+
9
+ ```typescript
10
+ describe('entity', () => {
11
+
12
+ describe('create', () => {
13
+
14
+ // ── Happy Path ──
15
+ it('should create entity successfully', () => {
16
+ // Arrange
17
+ const input = { name: 'Test Entity' };
18
+
19
+ // Act
20
+ const result = service.create(input);
21
+
22
+ // Assert
23
+ expect(result).toBeDefined();
24
+ expect(result.name).toBe('Test Entity');
25
+ });
26
+
27
+ // ── Error Path ──
28
+ it('should throw [erro] when [condição inválida]', () => {
29
+ // Arrange
30
+ const invalidInput = undefined;
31
+
32
+ // Act & Assert
33
+ expect(() => service.create(invalidInput)).toThrow(Error);
34
+ });
35
+
36
+ // ── Boundary ──
37
+ it('should handle empty input', () => {
38
+ // Arrange
39
+ const boundaryInput = {};
40
+
41
+ // Act
42
+ const result = service.create(boundaryInput);
43
+
44
+ // Assert
45
+ expect(result).toBeDefined();
46
+ });
47
+
48
+ it('should get /app. correctly', async () => {
49
+ // Arrange
50
+ const endpoint = '/app.';
51
+
52
+ // Act
53
+ const response = await request(app).get(endpoint);
54
+
55
+ // Assert
56
+ expect(response.status).toBe(200);
57
+ });
58
+ });
59
+ });
60
+ ```
61
+
62
+ ---
63
+
64
+ ## Ciclo TDD
65
+
66
+ ```
67
+ 1. RED: Escrever teste que FALHA
68
+ 2. GREEN: Escrever código MÍNIMO para passar
69
+ 3. REFACTOR: Melhorar sem quebrar testes
70
+ 4. REPEAT
71
+ ```
72
+
73
+ ---
74
+
75
+ ## Checklist
76
+
77
+ ```
78
+ □ Teste escrito ANTES do código
79
+ □ Teste falha antes da implementação (RED)
80
+ □ Implementação mínima para passar (GREEN)
81
+ □ Refatoração sem quebrar testes (REFACTOR)
82
+ □ Happy path coberto
83
+ □ Error path coberto
84
+ □ Boundary cases cobertos
85
+ □ Cobertura atinge o mínimo do projeto
86
+ ```
@@ -0,0 +1,82 @@
1
+ # 🛡️ Template: Threat Model (STRIDE)
2
+
3
+ > Use para features que lidam com dados sensíveis, pagamentos, autenticação.
4
+
5
+ ---
6
+
7
+ ## Feature: Acesso a Histórico Médico
8
+
9
+ ### Atores e Assets
10
+
11
+ | Ator | Nível de Confiança | Assets que Acessa |
12
+ |------|-------------------|------------------|
13
+ | Paciente | Alto | Histórico médico, exames, receitas |
14
+ | Médico | Alto | Prontuário do paciente |
15
+ | Farmacêutico | Médio | Prescrições, alergias |
16
+ | Auditor Compliance | Médio | Logs de acesso, consentimento |
17
+
18
+ ---
19
+
20
+ ### Análise STRIDE
21
+
22
+ | Categoria | Ameaça | Probabilidade | Impacto | Mitigação |
23
+ |-----------|--------|-------------|---------|-----------|
24
+ | **S**poofing | Identidade falsa / autenticação fraca | M | A | MFA, JWT assinado, validação gov |
25
+ | **T**ampering | Alteração de dados em trânsito/repouso | M | A | HTTPS, assinatura digital, checksums |
26
+ | **R**epudiation | Negar ação realizada | M | A | Audit log detalhado com timestamp |
27
+ | **I**nformation Disclosure | Vazamento de dados sensíveis | A | A | Criptografia AES-256, LGPD compliance |
28
+ | **D**enial of Service | Serviço indisponível (DDoS, travamento) | M | A | Rate limiting, WAF, scaling automático |
29
+ | **E**levation of Privilege | Escalar permissão (user → admin) | M | A | RBAC granular, segregação de funções |
30
+
31
+ ---
32
+
33
+ ### Dados Sensíveis
34
+
35
+ | Dado | Classificação | Proteção |
36
+ |------|-------------|----------|
37
+ | Nome Paciente | PII | Criptografado, HIPAA compliant |
38
+ | Histórico Médico | Saúde | AES-256, acesso restrito |
39
+ | Medicamentos | Saúde | Criptografado, masking em logs |
40
+ | Resultado de Exames | Saúde | Criptografado, assinado digitalmente |
41
+
42
+ ---
43
+
44
+ ### Conformidade e Requisitos Regulatórios
45
+
46
+ | Regulamento | Aplicável | Verificação |
47
+ |-------------|-----------|-------------|
48
+ | HIPAA | Sim | PHI encryption at rest and in transit |
49
+ | LGPD-Health | Sim | Explicit consent for health data processing |
50
+
51
+ ---
52
+
53
+ ### Checklist de Segurança
54
+
55
+ ```
56
+ □ Input validado e sanitizado
57
+ □ Output encodado (XSS prevention)
58
+ □ Queries parametrizadas (SQL injection)
59
+ □ Autenticação obrigatória (MFA quando sensível)
60
+ □ Autorização por role/permission (RBAC)
61
+ □ Dados sensíveis criptografados at rest (AES-256)
62
+ □ Dados sensíveis criptografados in transit (TLS 1.2+)
63
+ □ Rate limiting implementado
64
+ □ Audit log para ações sensíveis (timestamp + usuário)
65
+ □ Secrets em variáveis de ambiente (não hardcoded)
66
+ □ Consentimento e transparência (LGPD/GDPR)
67
+ □ Testes de penetração agendados
68
+ ```
69
+
70
+
71
+ ---
72
+
73
+ ## Ameaças Específicas de Healthtech
74
+
75
+ | Ameaça | Descrição | Mitigação |
76
+ |--------|-----------|-----------|
77
+ | Acesso não Autorizado | Outro médico lê prontuário | RBAC por especialidade, audit |
78
+ | Adulteração de Histórico | Alterar resultado de exame | Blockchain/assinatura digital |
79
+ | Vazamento de Dados | Exposição de histórico médico | Criptografia, isolamento de rede |
80
+ | Negação de Diagnóstico | Paciente nega consentimento | Digital signature + timestamp |
81
+ | Indisponibilidade | Sistema cai durante consulta | Backup em tempo real, SLA 99.95% |
82
+ | Privilégio Elevado | Admin lê dados de qualquer paciente | Segregação de funções, logging |
@@ -0,0 +1,228 @@
1
+ ---
2
+ antigravity:
3
+ trigger: 'on_demand'
4
+ description: 'Workflow completo para correção de bug em test-project'
5
+ ---
6
+
7
+ # 🐛 Workflow: Fix Bug
8
+
9
+ > **Bugs não se corrigem por tentativa e erro.**
10
+ > Diagnóstico rigoroso → reprodução → root cause → teste RED → fix → regressão.
11
+
12
+ ---
13
+
14
+ ## Pré-requisitos
15
+
16
+ ```
17
+ □ Li INDEX.md e PREFLIGHT.md
18
+ □ Li LESSONS-LEARNED.md (se existir) — talvez esse bug já aconteceu
19
+ □ Li ERROR-PATTERNS.md (se existir) — talvez é um padrão conhecido
20
+ □ Estou em uma branch fix/ ou hotfix/ (NUNCA main/develop)
21
+ □ Build e testes passando ANTES da minha alteração
22
+ ```
23
+
24
+ ---
25
+
26
+ ## Step 1: Diagnóstico Inicial
27
+
28
+ ```
29
+ Bug: [descrição clara do problema]
30
+ Reportado por: [quem reportou]
31
+ Ambiente: [produção / staging / dev]
32
+ Severidade: [CRITICAL / HIGH / MEDIUM / LOW]
33
+
34
+ Comportamento atual: [o que acontece]
35
+ Comportamento esperado: [o que deveria acontecer]
36
+ Como reproduzir:
37
+ 1. [passo 1]
38
+ 2. [passo 2]
39
+ 3. [resultado errado]
40
+ ```
41
+
42
+ ---
43
+
44
+ ## Step 2: Leitura de Contexto
45
+
46
+ ```bash
47
+ # Verificar LESSONS-LEARNED para bugs similares
48
+ grep -i "[termo do bug]" LESSONS-LEARNED.md 2>/dev/null
49
+
50
+ # Verificar ERROR-PATTERNS
51
+ grep -i "[termo do bug]" ERROR-PATTERNS.md 2>/dev/null
52
+
53
+ # Verificar regras de negócio relevantes
54
+ grep -i "[domínio do bug]" BUSINESS-RULES.md 2>/dev/null
55
+
56
+ # Histórico de commits na área afetada
57
+ git log --oneline -20 -- [arquivo ou diretório afetado]
58
+ ```
59
+
60
+ ---
61
+
62
+ ## Step 3: Localização do Problema
63
+
64
+ ```bash
65
+ # Buscar no código
66
+ grep -rn "[termo do erro]" --include="*.ts" src/
67
+
68
+ # Verificar logs (se disponível)
69
+ # Verificar stack trace
70
+
71
+ # Mapear o fluxo de dados:
72
+ # Input → [onde entra] → [como transforma] → [onde sai] → Output
73
+ ```
74
+
75
+ ```
76
+ Arquivo(s) suspeito(s): _______________
77
+ Função/método suspeito: _______________
78
+ Linha(s) suspeita(s): _______________
79
+ ```
80
+
81
+ ---
82
+
83
+ ## Step 4: Root Cause — Identificação da Causa Raiz
84
+
85
+ ```
86
+ ╔══════════════════════════════════════════════╗
87
+ ║ NUNCA corrigir o SINTOMA. ║
88
+ ║ SEMPRE encontrar a CAUSA RAIZ. ║
89
+ ║ ║
90
+ ║ Técnica dos 5 Porquês: ║
91
+ ║ 1. Por que o bug acontece? → porque... ║
92
+ ║ 2. Por que isso? → porque... ║
93
+ ║ 3. Por que isso? → porque... ║
94
+ ║ 4. Por que isso? → porque... ║
95
+ ║ 5. Por que isso? → CAUSA RAIZ ║
96
+ ╚══════════════════════════════════════════════╝
97
+ ```
98
+
99
+ ```
100
+ Causa raiz: _______________
101
+ Confiança: [ ] Alta (reproduzi) [ ] Média (hipótese forte) [ ] Baixa (preciso investigar mais)
102
+ ```
103
+
104
+ > **Se confiança é Baixa → PARAR e investigar mais. Não chutar.**
105
+
106
+ ---
107
+
108
+ ## Step 5: Verificar Testes Existentes
109
+
110
+ ```bash
111
+ # Testes que cobrem a área afetada
112
+ grep -rn "[nome da função/classe]" --include="*.test.*" --include="*.spec.*" tests/ src/
113
+
114
+ # Rodar testes existentes
115
+ npx jest --testPathPattern="[modulo]"
116
+ ```
117
+
118
+ ```
119
+ □ Existem testes para a área afetada? [sim/não]
120
+ □ Os testes passam? [sim/não]
121
+ □ Os testes cobrem o cenário do bug? [sim/não — se não, criar no Step 6]
122
+ ```
123
+
124
+ ---
125
+
126
+ ## Step 6: Criar Teste RED
127
+
128
+ > **PRIMEIRO criar um teste que FALHA reproduzindo o bug.**
129
+ > Só depois corrigir o código.
130
+
131
+ ```
132
+ Teste: [nome descritivo do teste]
133
+ Input: [dados que reproduzem o bug]
134
+ Expected: [resultado correto]
135
+ Actual: [resultado errado — o teste deve FALHAR]
136
+ ```
137
+
138
+ ```bash
139
+ # Rodar e confirmar que FALHA (RED)
140
+ npx jest --testNamePattern="[nome do teste]"
141
+ # DEVE FALHAR ❌
142
+ ```
143
+
144
+ ---
145
+
146
+ ## Step 7: Correção Mínima
147
+
148
+ ```
149
+ ╔══════════════════════════════════════════════╗
150
+ ║ REGRA: Correção MÍNIMA. ║
151
+ ║ ║
152
+ ║ ✓ Corrigir APENAS a causa raiz ║
153
+ ║ ✓ Menor quantidade de linhas possível ║
154
+ ║ ✗ NÃO refatorar código adjacente ║
155
+ ║ ✗ NÃO "aproveitar" para melhorar outra coisa║
156
+ ║ ✗ NÃO adicionar features junto com o fix ║
157
+ ╚══════════════════════════════════════════════╝
158
+ ```
159
+
160
+ Após corrigir:
161
+ ```bash
162
+ # Rodar o teste do Step 6 — agora deve PASSAR (GREEN)
163
+ npx jest --testNamePattern="[nome do teste]"
164
+ # DEVE PASSAR ✅
165
+ ```
166
+
167
+ ---
168
+
169
+ ## Step 8: Teste de Regressão
170
+
171
+ ```bash
172
+ # Rodar TODOS os testes (não só o novo)
173
+ npm run test
174
+
175
+ # Build completo
176
+ npm run build
177
+
178
+ # Score
179
+ npx @girardelli/architect score .
180
+ ```
181
+
182
+ ```
183
+ □ Teste do bug passa (GREEN) ✓
184
+ □ TODOS os outros testes passam ✓
185
+ □ Build compila ✓
186
+ □ Score não regrediu ✓
187
+ ```
188
+
189
+ ---
190
+
191
+ ## Step 9: Verificação de Fluxos Existentes
192
+
193
+ ```
194
+ □ Verifiquei que features dependentes não foram afetadas
195
+ □ Verifiquei edge cases relacionados
196
+ □ Se o bug era em API → verifiquei clientes da API
197
+ □ Se o bug era em banco → verifiquei migrations e seeds
198
+ ```
199
+
200
+ ---
201
+
202
+ ## Step 10: Documentação
203
+
204
+ ```
205
+ □ Atualizar LESSONS-LEARNED.md:
206
+ - O que aconteceu
207
+ - Causa raiz
208
+ - Como foi corrigido
209
+ - Como prevenir no futuro
210
+
211
+ □ Atualizar ERROR-PATTERNS.md (se é um padrão novo):
212
+ - Padrão do erro
213
+ - Sintomas
214
+ - Solução
215
+
216
+ □ Commit com mensagem semântica:
217
+ fix: [descrição clara do que foi corrigido]
218
+
219
+ □ PR criado com:
220
+ - Descrição do bug
221
+ - Causa raiz
222
+ - Solução aplicada
223
+ - Testes adicionados
224
+ ```
225
+
226
+ ---
227
+
228
+ **Gerado por Architect v3.1 · Score: 72/100 · 2026-03-25**