@girardelli/architect 2.2.0 → 5.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 (212) hide show
  1. package/README.md +105 -116
  2. package/architect-run.sh +431 -0
  3. package/assets/banner-v3.html +561 -0
  4. package/dist/agent-generator/context-enricher.d.ts +58 -0
  5. package/dist/agent-generator/context-enricher.d.ts.map +1 -0
  6. package/dist/agent-generator/context-enricher.js +613 -0
  7. package/dist/agent-generator/context-enricher.js.map +1 -0
  8. package/dist/agent-generator/domain-inferrer.d.ts +52 -0
  9. package/dist/agent-generator/domain-inferrer.d.ts.map +1 -0
  10. package/dist/agent-generator/domain-inferrer.js +585 -0
  11. package/dist/agent-generator/domain-inferrer.js.map +1 -0
  12. package/dist/agent-generator/framework-detector.d.ts +40 -0
  13. package/dist/agent-generator/framework-detector.d.ts.map +1 -0
  14. package/dist/agent-generator/framework-detector.js +611 -0
  15. package/dist/agent-generator/framework-detector.js.map +1 -0
  16. package/dist/agent-generator/index.d.ts +47 -0
  17. package/dist/agent-generator/index.d.ts.map +1 -0
  18. package/dist/agent-generator/index.js +545 -0
  19. package/dist/agent-generator/index.js.map +1 -0
  20. package/dist/agent-generator/stack-detector.d.ts +14 -0
  21. package/dist/agent-generator/stack-detector.d.ts.map +1 -0
  22. package/dist/agent-generator/stack-detector.js +124 -0
  23. package/dist/agent-generator/stack-detector.js.map +1 -0
  24. package/dist/agent-generator/templates/core/agents.d.ts +17 -0
  25. package/dist/agent-generator/templates/core/agents.d.ts.map +1 -0
  26. package/dist/agent-generator/templates/core/agents.js +1256 -0
  27. package/dist/agent-generator/templates/core/agents.js.map +1 -0
  28. package/dist/agent-generator/templates/core/architecture-rules.d.ts +7 -0
  29. package/dist/agent-generator/templates/core/architecture-rules.d.ts.map +1 -0
  30. package/dist/agent-generator/templates/core/architecture-rules.js +274 -0
  31. package/dist/agent-generator/templates/core/architecture-rules.js.map +1 -0
  32. package/dist/agent-generator/templates/core/general-rules.d.ts +8 -0
  33. package/dist/agent-generator/templates/core/general-rules.d.ts.map +1 -0
  34. package/dist/agent-generator/templates/core/general-rules.js +301 -0
  35. package/dist/agent-generator/templates/core/general-rules.js.map +1 -0
  36. package/dist/agent-generator/templates/core/hooks-generator.d.ts +21 -0
  37. package/dist/agent-generator/templates/core/hooks-generator.d.ts.map +1 -0
  38. package/dist/agent-generator/templates/core/hooks-generator.js +233 -0
  39. package/dist/agent-generator/templates/core/hooks-generator.js.map +1 -0
  40. package/dist/agent-generator/templates/core/index-md.d.ts +7 -0
  41. package/dist/agent-generator/templates/core/index-md.d.ts.map +1 -0
  42. package/dist/agent-generator/templates/core/index-md.js +246 -0
  43. package/dist/agent-generator/templates/core/index-md.js.map +1 -0
  44. package/dist/agent-generator/templates/core/orchestrator.d.ts +8 -0
  45. package/dist/agent-generator/templates/core/orchestrator.d.ts.map +1 -0
  46. package/dist/agent-generator/templates/core/orchestrator.js +422 -0
  47. package/dist/agent-generator/templates/core/orchestrator.js.map +1 -0
  48. package/dist/agent-generator/templates/core/preflight.d.ts +8 -0
  49. package/dist/agent-generator/templates/core/preflight.d.ts.map +1 -0
  50. package/dist/agent-generator/templates/core/preflight.js +213 -0
  51. package/dist/agent-generator/templates/core/preflight.js.map +1 -0
  52. package/dist/agent-generator/templates/core/quality-gates.d.ts +11 -0
  53. package/dist/agent-generator/templates/core/quality-gates.d.ts.map +1 -0
  54. package/dist/agent-generator/templates/core/quality-gates.js +254 -0
  55. package/dist/agent-generator/templates/core/quality-gates.js.map +1 -0
  56. package/dist/agent-generator/templates/core/security-rules.d.ts +7 -0
  57. package/dist/agent-generator/templates/core/security-rules.d.ts.map +1 -0
  58. package/dist/agent-generator/templates/core/security-rules.js +528 -0
  59. package/dist/agent-generator/templates/core/security-rules.js.map +1 -0
  60. package/dist/agent-generator/templates/core/skills-generator.d.ts +19 -0
  61. package/dist/agent-generator/templates/core/skills-generator.d.ts.map +1 -0
  62. package/dist/agent-generator/templates/core/skills-generator.js +546 -0
  63. package/dist/agent-generator/templates/core/skills-generator.js.map +1 -0
  64. package/dist/agent-generator/templates/core/workflow-fix-bug.d.ts +7 -0
  65. package/dist/agent-generator/templates/core/workflow-fix-bug.d.ts.map +1 -0
  66. package/dist/agent-generator/templates/core/workflow-fix-bug.js +237 -0
  67. package/dist/agent-generator/templates/core/workflow-fix-bug.js.map +1 -0
  68. package/dist/agent-generator/templates/core/workflow-new-feature.d.ts +8 -0
  69. package/dist/agent-generator/templates/core/workflow-new-feature.d.ts.map +1 -0
  70. package/dist/agent-generator/templates/core/workflow-new-feature.js +321 -0
  71. package/dist/agent-generator/templates/core/workflow-new-feature.js.map +1 -0
  72. package/dist/agent-generator/templates/core/workflow-review.d.ts +7 -0
  73. package/dist/agent-generator/templates/core/workflow-review.d.ts.map +1 -0
  74. package/dist/agent-generator/templates/core/workflow-review.js +104 -0
  75. package/dist/agent-generator/templates/core/workflow-review.js.map +1 -0
  76. package/dist/agent-generator/templates/domain/index.d.ts +22 -0
  77. package/dist/agent-generator/templates/domain/index.d.ts.map +1 -0
  78. package/dist/agent-generator/templates/domain/index.js +1176 -0
  79. package/dist/agent-generator/templates/domain/index.js.map +1 -0
  80. package/dist/agent-generator/templates/stack/index.d.ts +8 -0
  81. package/dist/agent-generator/templates/stack/index.d.ts.map +1 -0
  82. package/dist/agent-generator/templates/stack/index.js +695 -0
  83. package/dist/agent-generator/templates/stack/index.js.map +1 -0
  84. package/dist/agent-generator/templates/template-helpers.d.ts +75 -0
  85. package/dist/agent-generator/templates/template-helpers.d.ts.map +1 -0
  86. package/dist/agent-generator/templates/template-helpers.js +726 -0
  87. package/dist/agent-generator/templates/template-helpers.js.map +1 -0
  88. package/dist/agent-generator/types.d.ts +196 -0
  89. package/dist/agent-generator/types.d.ts.map +1 -0
  90. package/dist/agent-generator/types.js +27 -0
  91. package/dist/agent-generator/types.js.map +1 -0
  92. package/dist/analyzer.d.ts +5 -0
  93. package/dist/analyzer.d.ts.map +1 -1
  94. package/dist/analyzer.js +46 -5
  95. package/dist/analyzer.js.map +1 -1
  96. package/dist/analyzers/forecast.d.ts +85 -0
  97. package/dist/analyzers/forecast.d.ts.map +1 -0
  98. package/dist/analyzers/forecast.js +337 -0
  99. package/dist/analyzers/forecast.js.map +1 -0
  100. package/dist/analyzers/git-cache.d.ts +7 -0
  101. package/dist/analyzers/git-cache.d.ts.map +1 -0
  102. package/dist/analyzers/git-cache.js +41 -0
  103. package/dist/analyzers/git-cache.js.map +1 -0
  104. package/dist/analyzers/git-history.d.ts +113 -0
  105. package/dist/analyzers/git-history.d.ts.map +1 -0
  106. package/dist/analyzers/git-history.js +333 -0
  107. package/dist/analyzers/git-history.js.map +1 -0
  108. package/dist/analyzers/index.d.ts +10 -0
  109. package/dist/analyzers/index.d.ts.map +1 -0
  110. package/dist/analyzers/index.js +7 -0
  111. package/dist/analyzers/index.js.map +1 -0
  112. package/dist/analyzers/temporal-scorer.d.ts +72 -0
  113. package/dist/analyzers/temporal-scorer.d.ts.map +1 -0
  114. package/dist/analyzers/temporal-scorer.js +140 -0
  115. package/dist/analyzers/temporal-scorer.js.map +1 -0
  116. package/dist/anti-patterns.d.ts +7 -0
  117. package/dist/anti-patterns.d.ts.map +1 -1
  118. package/dist/anti-patterns.js +25 -6
  119. package/dist/anti-patterns.js.map +1 -1
  120. package/dist/cli.d.ts +2 -3
  121. package/dist/cli.d.ts.map +1 -1
  122. package/dist/cli.js +275 -113
  123. package/dist/cli.js.map +1 -1
  124. package/dist/config.d.ts +6 -0
  125. package/dist/config.d.ts.map +1 -1
  126. package/dist/config.js +48 -11
  127. package/dist/config.js.map +1 -1
  128. package/dist/html-reporter.d.ts +3 -1
  129. package/dist/html-reporter.d.ts.map +1 -1
  130. package/dist/html-reporter.js +248 -12
  131. package/dist/html-reporter.js.map +1 -1
  132. package/dist/index.d.ts +16 -3
  133. package/dist/index.d.ts.map +1 -1
  134. package/dist/index.js +63 -4
  135. package/dist/index.js.map +1 -1
  136. package/dist/project-summarizer.d.ts +38 -0
  137. package/dist/project-summarizer.d.ts.map +1 -0
  138. package/dist/project-summarizer.js +463 -0
  139. package/dist/project-summarizer.js.map +1 -0
  140. package/dist/refactor-reporter.js +1 -1
  141. package/dist/scanner.d.ts +8 -2
  142. package/dist/scanner.d.ts.map +1 -1
  143. package/dist/scanner.js +153 -113
  144. package/dist/scanner.js.map +1 -1
  145. package/dist/scorer.d.ts.map +1 -1
  146. package/dist/scorer.js +24 -11
  147. package/dist/scorer.js.map +1 -1
  148. package/dist/types.d.ts +29 -0
  149. package/dist/types.d.ts.map +1 -1
  150. package/package.json +12 -3
  151. package/src/agent-generator/context-enricher.ts +672 -0
  152. package/src/agent-generator/domain-inferrer.ts +635 -0
  153. package/src/agent-generator/framework-detector.ts +669 -0
  154. package/src/agent-generator/index.ts +634 -0
  155. package/src/agent-generator/stack-detector.ts +115 -0
  156. package/src/agent-generator/templates/core/agents.ts +1296 -0
  157. package/src/agent-generator/templates/core/architecture-rules.ts +287 -0
  158. package/src/agent-generator/templates/core/general-rules.ts +306 -0
  159. package/src/agent-generator/templates/core/hooks-generator.ts +242 -0
  160. package/src/agent-generator/templates/core/index-md.ts +260 -0
  161. package/src/agent-generator/templates/core/orchestrator.ts +459 -0
  162. package/src/agent-generator/templates/core/preflight.ts +215 -0
  163. package/src/agent-generator/templates/core/quality-gates.ts +256 -0
  164. package/src/agent-generator/templates/core/security-rules.ts +543 -0
  165. package/src/agent-generator/templates/core/skills-generator.ts +585 -0
  166. package/src/agent-generator/templates/core/workflow-fix-bug.ts +239 -0
  167. package/src/agent-generator/templates/core/workflow-new-feature.ts +323 -0
  168. package/src/agent-generator/templates/core/workflow-review.ts +106 -0
  169. package/src/agent-generator/templates/domain/index.ts +1201 -0
  170. package/src/agent-generator/templates/stack/index.ts +705 -0
  171. package/src/agent-generator/templates/template-helpers.ts +776 -0
  172. package/src/agent-generator/types.ts +232 -0
  173. package/src/analyzer.ts +51 -5
  174. package/src/analyzers/forecast.ts +496 -0
  175. package/src/analyzers/git-cache.ts +52 -0
  176. package/src/analyzers/git-history.ts +488 -0
  177. package/src/analyzers/index.ts +33 -0
  178. package/src/analyzers/temporal-scorer.ts +227 -0
  179. package/src/anti-patterns.ts +29 -6
  180. package/src/cli.ts +316 -117
  181. package/src/config.ts +52 -11
  182. package/src/html-reporter.ts +263 -13
  183. package/src/index.ts +93 -10
  184. package/src/project-summarizer.ts +521 -0
  185. package/src/refactor-reporter.ts +1 -1
  186. package/src/scanner.ts +136 -90
  187. package/src/scorer.ts +26 -11
  188. package/src/types.ts +27 -0
  189. package/tests/agent-generator.test.ts +427 -0
  190. package/tests/analyzers-integration.test.ts +174 -0
  191. package/tests/architect-adapter-enrichment.test.ts +9 -0
  192. package/tests/context-enricher.test.ts +971 -0
  193. package/tests/fixtures/monorepo/package.json +6 -0
  194. package/tests/fixtures/monorepo/packages/app/package.json +12 -0
  195. package/tests/fixtures/monorepo/packages/app/src/index.ts +6 -0
  196. package/tests/fixtures/monorepo/packages/core/package.json +7 -0
  197. package/tests/fixtures/monorepo/packages/core/src/index.ts +7 -0
  198. package/tests/forecast.test.ts +509 -0
  199. package/tests/framework-detector.test.ts +1172 -0
  200. package/tests/git-history.test.ts +254 -0
  201. package/tests/monorepo-scan.test.ts +170 -0
  202. package/tests/scanner.test.ts +7 -8
  203. package/tests/scorer.test.ts +594 -0
  204. package/tests/stack-detector.test.ts +241 -0
  205. package/tests/template-generation.test.ts +706 -0
  206. package/tests/template-helpers.test.ts +1152 -0
  207. package/tests/temporal-scorer.test.ts +307 -0
  208. package/dist/agent-generator.d.ts +0 -106
  209. package/dist/agent-generator.d.ts.map +0 -1
  210. package/dist/agent-generator.js +0 -1398
  211. package/dist/agent-generator.js.map +0 -1
  212. package/src/agent-generator.ts +0 -1526
@@ -0,0 +1,422 @@
1
+ import { isEnriched, depthAtLeast, domainBadge, complianceBadges, depthIndicator, modulesSummaryTable, integrationsSummary, frameworkBadge, toolchainCommands, projectStructureBadge, } from '../template-helpers.js';
2
+ /**
3
+ * Generates enterprise-grade AGENT-ORCHESTRATOR.md
4
+ * ~800+ lines: 5-phase protocol, mandatory artifact gates, business interrogation,
5
+ * parallel dispatch, C4/BDD/TDD inline templates, risk matrix, implementation order.
6
+ */
7
+ export function generateOrchestrator(ctx) {
8
+ const { report, stack, projectName, stackLabel, plan, config } = ctx;
9
+ const layers = report.layers.map(l => l.name).join(', ') || 'Not detected';
10
+ const antiPatterns = report.antiPatterns.map(a => `${a.name} (${a.severity})`).join(', ') || 'None';
11
+ const agentDispatch = buildAgentDispatch(ctx);
12
+ const businessQuestions = buildBusinessQuestions(ctx);
13
+ // Extract toolchain commands for Quality Gates (dynamic per-stack)
14
+ const enrichedCtx = isEnriched(ctx) ? ctx : null;
15
+ const buildCmd = enrichedCtx?.toolchain?.buildCmd || 'npm run build';
16
+ const testCmd = enrichedCtx?.toolchain?.testCmd || 'npm run test';
17
+ return `---
18
+ antigravity:
19
+ trigger: 'always_on'
20
+ globs: ['**/*']
21
+ description: 'META-AGENT ORQUESTRADOR — Centro de comando para ${projectName}'
22
+ priority: CRITICAL
23
+ agent_card:
24
+ id: 'orchestrator'
25
+ name: 'Agent Orchestrator'
26
+ role: 'coordination'
27
+ capabilities: [request-decomposition, agent-dispatch, plan-consolidation, quality-verification, artifact-gating]
28
+ inputs: [user-story, feature-request, bug-report, refactoring-request]
29
+ outputs: [consolidated-plan, implementation-blocks, effort-estimate, architecture-docs]
30
+ depends_on: []
31
+ version: 3.1.0
32
+ ---
33
+
34
+ # 🎭 AGENT-ORCHESTRATOR: ${projectName}
35
+
36
+ > **Centro de comando.** Toda requisição passa por aqui.
37
+ > **Nenhuma linha de código é escrita sem os artefatos obrigatórios.**
38
+
39
+ ---
40
+
41
+ ## ⛔ REGRA ABSOLUTA: ARTEFATOS ANTES DE CÓDIGO
42
+
43
+ \`\`\`
44
+ ╔══════════════════════════════════════════════════════════════╗
45
+ ║ ║
46
+ ║ ANTES de escrever QUALQUER linha de código, os seguintes ║
47
+ ║ artefatos DEVEM existir e ser APROVADOS pelo humano: ║
48
+ ║ ║
49
+ ║ 1. 🎨 MOCKUP (se tem UI) ║
50
+ ║ → Todas as telas, estados, erros, modais, mensagens ║
51
+ ║ → Seguir padrão visual do sistema ║
52
+ ║ ║
53
+ ║ 2. 📖 USER STORIES ║
54
+ ║ → Como [ator], quero [ação], para [benefício] ║
55
+ ║ → Critérios de aceite mensuráveis ║
56
+ ║ ║
57
+ ║ 3. 🏗️ ARQUITETURA (C4) ║
58
+ ║ → Contexto, Container, Componente, Código ║
59
+ ║ → Decisões arquiteturais (ADR) ║
60
+ ║ ║
61
+ ║ 4. 📋 TAREFAS ║
62
+ ║ → Breakdown com TASK-XXX ║
63
+ ║ → Estimativa T-shirt (XS/S/M/L/XL) ║
64
+ ║ ║
65
+ ║ 5. 🧪 BDD (cenários) ║
66
+ ║ → Given/When/Then para cada critério de aceite ║
67
+ ║ ║
68
+ ║ 6. 🔬 TDD (casos de teste) ║
69
+ ║ → RED → GREEN → REFACTOR ║
70
+ ║ → Cobertura mínima: ${config.coverageMinimum}% ║
71
+ ║ ║
72
+ ║ ⚠️ PRODUZIR APENAS UM IMPLEMENTATION PLAN SEM ESTES ║
73
+ ║ ARTEFATOS É VIOLAÇÃO DO PROTOCOLO. ║
74
+ ║ ║
75
+ ║ ORDEM DE IMPLEMENTAÇÃO: ║
76
+ ║ 1° Backend → 2° Doc. Integração → 3° Frontend/App ║
77
+ ║ ║
78
+ ╚══════════════════════════════════════════════════════════════╝
79
+ \`\`\`
80
+
81
+ ---
82
+
83
+ ## 📊 Contexto do Projeto
84
+
85
+ | Métrica | Valor |
86
+ |---------|-------|
87
+ | **Projeto** | ${projectName} |
88
+ | **Stack** | ${stackLabel} |
89
+ | **Score Atual** | ${report.score.overall}/100 |
90
+ | **Meta de Score** | ${Math.min(100, report.score.overall + 10)}/100 |
91
+ | **Camadas** | ${layers} |
92
+ | **Anti-Patterns** | ${antiPatterns} |
93
+ | **Arquivos** | ${report.projectInfo.totalFiles} |
94
+ | **Linhas** | ${report.projectInfo.totalLines.toLocaleString()} |
95
+ | **Cobertura Mínima** | ${config.coverageMinimum}% |
96
+ | **Refatorações Pendentes** | ${plan.steps.length} steps |
97
+
98
+ ${depthAtLeast(ctx, 'medium') ? `\n---\n\n## 📍 Contexto Enriquecido\n\n${depthIndicator(ctx)} · ${projectStructureBadge(ctx)}\n\n${frameworkBadge(ctx)}\n${domainBadge(ctx)}${modulesSummaryTable(ctx) ? `\n### 📦 Resumo de Módulos\n\n${modulesSummaryTable(ctx)}` : ''}${integrationsSummary(ctx)}${complianceBadges(ctx)}${toolchainCommands(ctx)}` : ''}
99
+
100
+ ---
101
+
102
+ ## 🔄 Protocolo de Orquestração (5 Fases)
103
+
104
+ ### FASE 0: Parsing da Requisição
105
+
106
+ Ao receber qualquer requisição, CLASSIFICAR imediatamente:
107
+
108
+ \`\`\`
109
+ ✓ Nome da feature/fix: _______________
110
+ ✓ Tipo: [ ] Feature [ ] Bug Fix [ ] Refactoring [ ] Documentation
111
+ ✓ Camadas tocadas: [ ] Backend [ ] Frontend [ ] Mobile [ ] Database
112
+ ✓ Tem UI: [ ] Sim [ ] Não
113
+ ✓ Complexidade: [ ] XS (<2h) [ ] S (2-4h) [ ] M (4-8h) [ ] L (1-3d) [ ] XL (3d+)
114
+ ✓ Assunções (listar): _______________
115
+ ✓ Riscos identificados: _______________
116
+ \`\`\`
117
+
118
+ Se houver QUALQUER dúvida na classificação → **PERGUNTAR ao humano**.
119
+
120
+ ### FASE 1: Interrogação de Negócio
121
+
122
+ Antes de qualquer design, RESPONDER estas perguntas:
123
+
124
+ ${businessQuestions}
125
+
126
+ > **Se não conseguir responder ≥ 70% das perguntas relevantes → PERGUNTAR ao humano.**
127
+
128
+ ### FASE 2: Disparo de Agentes (Paralelo)
129
+
130
+ \`\`\`
131
+ ORQUESTRADOR decompõe a requisição
132
+
133
+ ${agentDispatch} │
134
+ └──→ CONSOLIDAÇÃO
135
+ \`\`\`
136
+
137
+ Cada agente recebe:
138
+ - Contexto do projeto (score, stack, anti-patterns)
139
+ - Requisição decomposta (sua parte)
140
+ - Constraints (regras, patterns proibidos)
141
+ - Output esperado (formato e escopo)
142
+
143
+ ### FASE 3: Consolidação
144
+
145
+ O orquestrador consolida as respostas dos agentes em:
146
+
147
+ 1. **Plano Unificado** com:
148
+ - Diagrama de arquitetura (C4)
149
+ - Cenários BDD
150
+ - Casos de teste TDD
151
+ - Estimativa de esforço (T-shirt)
152
+ - Riscos e mitigações
153
+ - Decisões arquiteturais (ADR)
154
+
155
+ 2. **6 Gates para Aprovação** (apresentar um de cada vez):
156
+ - Gate 1: MOCKUP → \`/approved\`
157
+ - Gate 2: User Stories → \`/approved\`
158
+ - Gate 3: Arquitetura → \`/approved\`
159
+ - Gate 4: Tasks → \`/approved\`
160
+ - Gate 5: BDD → \`/approved\`
161
+ - Gate 6: TDD → \`/approved\`
162
+
163
+ ### FASE 4: Implementação (Após Todas Aprovações)
164
+
165
+ \`\`\`
166
+ ╔════════════════════════════════════════════════╗
167
+ ║ ORDEM OBRIGATÓRIA DE IMPLEMENTAÇÃO: ║
168
+ ║ ║
169
+ ║ 1° BACKEND ║
170
+ ║ └─→ Controllers, Services, Entities, DTOs ║
171
+ ║ └─→ Testes unitários + integração ║
172
+ ║ └─→ Migrations (se houver) ║
173
+ ║ ║
174
+ ║ 2° DOCUMENTO DE INTEGRAÇÃO ║
175
+ ║ └─→ Endpoints, payloads, erros ║
176
+ ║ └─→ Exemplos de request/response ║
177
+ ║ └─→ Contrato para frontend/app ║
178
+ ║ ║
179
+ ║ 3° FRONTEND / APP ║
180
+ ║ └─→ Baseado no documento de integração ║
181
+ ║ └─→ Componentes, pages, state ║
182
+ ║ └─→ Testes e2e ║
183
+ ╚════════════════════════════════════════════════╝
184
+ \`\`\`
185
+
186
+ ### FASE 5: Verificação e Entrega
187
+
188
+ \`\`\`
189
+ □ Build compila sem erros
190
+ □ Todos os testes passam
191
+ □ Cobertura ≥ ${config.coverageMinimum}%
192
+ □ Score ≥ ${config.scoreThreshold}/100
193
+ □ Zero anti-patterns CRITICAL novos
194
+ □ Sem regressão de score
195
+ □ Lint sem warnings
196
+ □ Documentação atualizada
197
+ \`\`\`
198
+
199
+ ---
200
+
201
+ ## 📐 Templates Inline
202
+
203
+ ### Template: User Story
204
+
205
+ \`\`\`markdown
206
+ ## US-XXX: [Título]
207
+
208
+ **Como** [ator],
209
+ **Quero** [ação],
210
+ **Para** [benefício].
211
+
212
+ ### Critérios de Aceite
213
+
214
+ - CA1: [critério mensurável]
215
+ - CA2: [critério mensurável]
216
+ - CA3: [critério mensurável]
217
+
218
+ ### Regras de Negócio
219
+
220
+ - RN1: [regra]
221
+ - RN2: [regra]
222
+
223
+ ### Notas Técnicas
224
+
225
+ - [observação relevante]
226
+ \`\`\`
227
+
228
+ ### Template: Task Breakdown
229
+
230
+ \`\`\`markdown
231
+ ## TASK-XXX: [Título]
232
+
233
+ **User Story:** US-XXX
234
+ **Estimativa:** [XS|S|M|L|XL]
235
+ **Camada:** [Backend|Frontend|App|Database]
236
+ **Agente:** [nome do agente]
237
+
238
+ ### Descrição
239
+ [o que precisa ser feito]
240
+
241
+ ### Critério de Done
242
+ - [ ] Implementado
243
+ - [ ] Testado (cobertura ≥ ${config.coverageMinimum}%)
244
+ - [ ] Code review
245
+ - [ ] Documentação
246
+ \`\`\`
247
+
248
+ ### Template: ADR (Architecture Decision Record)
249
+
250
+ \`\`\`markdown
251
+ ## ADR-XXX: [Título da Decisão]
252
+
253
+ **Status:** [proposed | accepted | deprecated | superseded]
254
+ **Data:** [YYYY-MM-DD]
255
+
256
+ ### Contexto
257
+ [Por que essa decisão é necessária?]
258
+
259
+ ### Decisão
260
+ [O que foi decidido?]
261
+
262
+ ### Consequências
263
+ [Positivas e negativas]
264
+
265
+ ### Alternativas Consideradas
266
+ 1. [alternativa 1] — descartada porque...
267
+ 2. [alternativa 2] — descartada porque...
268
+ \`\`\`
269
+
270
+ ---
271
+
272
+ ## ⚖️ Matriz de Risco
273
+
274
+ | Risco | Probabilidade | Impacto | Mitigação |
275
+ |-------|-------------|---------|-----------|
276
+ | Regressão de testes | Média | Alto | CI/CD com gate obrigatório |
277
+ | Degradação de score | Média | Médio | architect score antes de PR |
278
+ | Breaking changes em API | Alta | Crítico | Versionamento + integration doc |
279
+ | Security vulnerability | Baixa | Crítico | SECURITY-AUDITOR em toda feature |
280
+ | Performance degradation | Média | Alto | Benchmark antes/depois |
281
+
282
+ ---
283
+
284
+ ## 🏷️ T-Shirt Sizing
285
+
286
+ | Size | Duração | Scope | Gates |
287
+ |------|---------|-------|-------|
288
+ | **XS** | < 2h | Fix pontual, 1 arquivo | Simplificado (skip mockup se sem UI) |
289
+ | **S** | 2-4h | Fix + teste, 2-3 arquivos | Gates 2, 5, 6 obrigatórios |
290
+ | **M** | 4-8h | Feature pequena, 1 camada | Todos os 6 gates |
291
+ | **L** | 1-3 dias | Feature multi-camada | Todos + ADR |
292
+ | **XL** | 3+ dias | Feature épica | Todos + ADR + Threat Model |
293
+
294
+ ---
295
+
296
+ ## 🔀 Protocolo de Conflitos
297
+
298
+ Quando dois agentes discordam:
299
+
300
+ 1. **Identificar** o ponto de conflito
301
+ 2. **Documentar** ambas as posições com prós/contras
302
+ 3. **Escalar** ao humano com recomendação
303
+ 4. **Registrar** a decisão como ADR
304
+
305
+ > **NUNCA resolver conflitos automaticamente.** O humano decide.
306
+
307
+ ---
308
+
309
+ ## 🔧 Quality Gates (Enforcement)
310
+
311
+ \`\`\`
312
+ ╔══════════════════════════════════════════╗
313
+ ║ BUILD GATE ║
314
+ ║ $ ${buildCmd}
315
+ ║ Resultado: PASS ou BLOCK ║
316
+ ╠══════════════════════════════════════════╣
317
+ ║ TEST GATE ║
318
+ ║ $ ${testCmd}
319
+
320
+ ║ Resultado: PASS ou BLOCK ║
321
+ ╠══════════════════════════════════════════╣
322
+ ║ COVERAGE GATE ║
323
+ ║ Mínimo: ${config.coverageMinimum}% ║
324
+ ║ Resultado: PASS ou BLOCK ║
325
+ ║ ⚠️ INEGOCIÁVEL ║
326
+ ╠══════════════════════════════════════════╣
327
+ ║ SCORE GATE ║
328
+ ║ $ architect score ./src ║
329
+ ║ Mínimo: ${config.scoreThreshold}/100 ║
330
+ ║ Regressão: NÃO PERMITIDA ║
331
+ ╚══════════════════════════════════════════╝
332
+ \`\`\`
333
+
334
+ ---
335
+
336
+ **Gerado por Architect v3.1 · Score: ${report.score.overall}/100 · ${new Date().toISOString().split('T')[0]}**
337
+ `;
338
+ }
339
+ function buildAgentDispatch(ctx) {
340
+ const { stack } = ctx;
341
+ let dispatch = '';
342
+ // Add module context if enriched
343
+ const enriched = isEnriched(ctx) ? ctx : null;
344
+ const moduleContext = enriched?.modules?.length
345
+ ? ` (${enriched.modules.slice(0, 3).map((m) => m.name).join(', ')})`
346
+ : '';
347
+ if (stack.hasBackend) {
348
+ dispatch += ` ├──→ [${stack.primary.toUpperCase()}-BACKEND-DEVELOPER]${moduleContext}\n`;
349
+ dispatch += ` │ • Arquitetura de serviços e APIs\n`;
350
+ dispatch += ` │ • Lógica de negócio e validações\n`;
351
+ dispatch += ` │ • Entities, DTOs, migrations\n`;
352
+ dispatch += ` │\n`;
353
+ }
354
+ if (stack.hasFrontend) {
355
+ const fw = stack.frameworks.find(f => ['Angular', 'Vue', 'Next.js', 'React'].includes(f)) || 'FRONTEND';
356
+ dispatch += ` ├──→ [${fw.toUpperCase().replace('.', '')}-FRONTEND-DEVELOPER]\n`;
357
+ dispatch += ` │ • Componentes e páginas\n`;
358
+ dispatch += ` │ • State management e formulários\n`;
359
+ dispatch += ` │ • UX responsiva\n`;
360
+ dispatch += ` │\n`;
361
+ }
362
+ if (stack.hasMobile) {
363
+ dispatch += ` ├──→ [FLUTTER-UI-DEVELOPER]\n`;
364
+ dispatch += ` │ • Screens e widgets\n`;
365
+ dispatch += ` │ • Navegação e integração API\n`;
366
+ dispatch += ` │\n`;
367
+ }
368
+ if (stack.hasDatabase) {
369
+ dispatch += ` ├──→ [DATABASE-ENGINEER]\n`;
370
+ dispatch += ` │ • Schema design e migrations\n`;
371
+ dispatch += ` │ • Índices e performance de queries\n`;
372
+ dispatch += ` │\n`;
373
+ }
374
+ dispatch += ` ├──→ [SECURITY-AUDITOR]\n`;
375
+ dispatch += ` │ • Análise de ameaças (STRIDE)\n`;
376
+ dispatch += ` │ • Compliance check\n`;
377
+ dispatch += ` │\n`;
378
+ dispatch += ` ├──→ [QA-TEST-ENGINEER]\n`;
379
+ dispatch += ` │ • Plano de testes\n`;
380
+ dispatch += ` │ • Cobertura mínima: ${ctx.config.coverageMinimum}%\n`;
381
+ dispatch += ` │\n`;
382
+ dispatch += ` └──→ [TECH-DEBT-CONTROLLER]\n`;
383
+ dispatch += ` • Débito técnico existente\n`;
384
+ dispatch += ` • Refatorações pré-requisito\n`;
385
+ return dispatch;
386
+ }
387
+ function buildBusinessQuestions(ctx) {
388
+ const questions = [
389
+ 'Q1: Quem são os atores envolvidos? (personas)',
390
+ 'Q2: Qual o impacto em receita/negócio?',
391
+ 'Q3: Existem regras de negócio específicas?',
392
+ 'Q4: Quais métricas de sucesso?',
393
+ 'Q5: Há requisitos de compliance (LGPD, PCI, etc)?',
394
+ 'Q6: Quais módulos/serviços são afetados?',
395
+ 'Q7: Quais entidades de banco são tocadas?',
396
+ 'Q8: Existe fluxo de dados entre sistemas?',
397
+ 'Q9: Precisa de versionamento de API?',
398
+ 'Q10: Há integrações externas envolvidas?',
399
+ ];
400
+ // Add domain-specific questions if enriched context available
401
+ const enriched = isEnriched(ctx) ? ctx : null;
402
+ if (enriched?.domain) {
403
+ const { domain } = enriched;
404
+ questions.push(`Q11: Como isso se alinha com o domínio ${domain.domain}?`);
405
+ if (domain.compliance?.length) {
406
+ const complianceNames = domain.compliance.map((c) => c.name).join(', ');
407
+ questions.push(`Q12: Como garantir conformidade com ${complianceNames}?`);
408
+ }
409
+ if (domain.integrations?.length) {
410
+ const integrationNames = domain.integrations.slice(0, 3).map((i) => i.name).join(', ');
411
+ questions.push(`Q13: Como essa mudança afeta as integrações com ${integrationNames}?`);
412
+ }
413
+ }
414
+ if (ctx.stack.hasDatabase) {
415
+ const startIdx = enriched?.domain ? 14 : 11;
416
+ questions.push(`Q${startIdx}: Volume estimado de dados?`, `Q${startIdx + 1}: Há picos de uso previsíveis?`, `Q${startIdx + 2}: Processamento síncrono ou assíncrono?`);
417
+ }
418
+ let nextQ = questions.length + 1;
419
+ questions.push(`Q${nextQ++}: Quem precisa de autenticação?`, `Q${nextQ++}: Quais permissões são necessárias?`, `Q${nextQ++}: Há dados sensíveis envolvidos?`, `Q${nextQ++}: Quais ameaças são relevantes?`);
420
+ return questions.map(q => `- **${q}**`).join('\n');
421
+ }
422
+ //# sourceMappingURL=orchestrator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"orchestrator.js","sourceRoot":"","sources":["../../../../src/agent-generator/templates/core/orchestrator.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,UAAU,EAEV,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACnB,cAAc,EACd,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,wBAAwB,CAAC;AAEhC;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAAC,GAA8C;IACjF,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC;IACrE,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,cAAc,CAAC;IAC3E,MAAM,YAAY,GAAG,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,MA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,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC5F,SAAS,CAAC,IAAI,CAAC,mDAAmD,gBAAgB,GAAG,CAAC,CAAC;QACzF,CAAC;IACH,CAAC;IAED,IAAI,GAAG,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;QAC1B,MAAM,QAAQ,GAAG,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC5C,SAAS,CAAC,IAAI,CACZ,IAAI,QAAQ,6BAA6B,EACzC,IAAI,QAAQ,GAAG,CAAC,gCAAgC,EAChD,IAAI,QAAQ,GAAG,CAAC,yCAAyC,CAC1D,CAAC;IACJ,CAAC;IAED,IAAI,KAAK,GAAG,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC;IACjC,SAAS,CAAC,IAAI,CACZ,IAAI,KAAK,EAAE,iCAAiC,EAC5C,IAAI,KAAK,EAAE,qCAAqC,EAChD,IAAI,KAAK,EAAE,kCAAkC,EAC7C,IAAI,KAAK,EAAE,iCAAiC,CAC7C,CAAC;IAEF,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACrD,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { TemplateContext } from '../../types.js';
2
+ /**
3
+ * Generates enterprise-grade PREFLIGHT.md
4
+ * 6-phase checklist: mental prep → mandatory reads → environment → business rules →
5
+ * before-code by layer → before-done. Red flags, diagnostic template, delivery checklist.
6
+ */
7
+ export declare function generatePreflight(ctx: TemplateContext): string;
8
+ //# sourceMappingURL=preflight.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preflight.d.ts","sourceRoot":"","sources":["../../../../src/agent-generator/templates/core/preflight.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAA2B,MAAM,gBAAgB,CAAC;AAG1E;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,eAAe,GAAG,MAAM,CA8M9D"}
@@ -0,0 +1,213 @@
1
+ import { getEnriched } from '../template-helpers.js';
2
+ /**
3
+ * Generates enterprise-grade PREFLIGHT.md
4
+ * 6-phase checklist: mental prep → mandatory reads → environment → business rules →
5
+ * before-code by layer → before-done. Red flags, diagnostic template, delivery checklist.
6
+ */
7
+ export function generatePreflight(ctx) {
8
+ const { stack, projectName, config, report } = ctx;
9
+ const enriched = getEnriched(ctx);
10
+ const tc = enriched.toolchain;
11
+ return `---
12
+ antigravity:
13
+ trigger: 'always_on'
14
+ globs: ['**/*']
15
+ description: 'PREFLIGHT — Checklist obrigatório pré-ação para ${projectName}'
16
+ priority: CRITICAL
17
+ ---
18
+
19
+ # ✈️ PREFLIGHT — Checklist Pré-Ação
20
+
21
+ > **NENHUMA ação de código é permitida antes de completar este checklist.**
22
+ > Pular qualquer fase é violação do protocolo.
23
+
24
+ ---
25
+
26
+ ## FASE 0: Preparação Mental
27
+
28
+ Antes de abrir qualquer arquivo:
29
+
30
+ \`\`\`
31
+ □ Li e entendi a requisição COMPLETAMENTE
32
+ □ Sei qual WORKFLOW estou seguindo (new-feature / fix-bug / review)
33
+ □ Identifiquei as CAMADAS envolvidas (Backend / Frontend / App / Database)
34
+ □ Tenho CLAREZA sobre o que é esperado como entrega
35
+ □ Se algo não está claro → PAREI e PERGUNTEI ao humano
36
+ \`\`\`
37
+
38
+ ---
39
+
40
+ ## FASE 1: Leitura Obrigatória
41
+
42
+ \`\`\`
43
+ □ [00-general.md](../rules/00-general.md) → Regras de Ouro do projeto
44
+ □ [QUALITY-GATES.md](./QUALITY-GATES.md) → Métricas e blockers
45
+ □ LESSONS-LEARNED.md (se existir) → Erros passados
46
+ □ ERROR-PATTERNS.md (se existir) → Padrões de erro conhecidos
47
+ □ BUSINESS-RULES.md (se existir) → Regras de negócio do domínio
48
+ \`\`\`
49
+
50
+ > **Objetivo:** Não repetir erros e entender o contexto antes de agir.
51
+
52
+ ---
53
+
54
+ ## FASE 2: Verificação de Ambiente
55
+
56
+ \`\`\`bash
57
+ # Git: verificar branch e status
58
+ git branch --show-current # NUNCA em main/develop direto
59
+ git status # Limpo antes de começar
60
+ git pull origin <branch> # Sincronizado
61
+
62
+ # Deps: verificar se está tudo instalado
63
+ ${tc?.installCmd || (stack.packageManager === 'npm' ? 'npm ci' : stack.packageManager === 'pip' ? 'pip install -r requirements.txt' : stack.packageManager === 'pub' ? 'flutter pub get' : `${stack.packageManager} install`)}
64
+
65
+ # Build: verificar se compila
66
+ ${tc?.buildCmd || (stack.packageManager === 'npm' ? 'npm run build' : stack.packageManager === 'pub' ? 'flutter build' : 'make build')}
67
+
68
+ # Tests: verificar se passam ANTES de começar
69
+ ${tc?.testCmd || (stack.testFramework === 'pytest' ? 'pytest' : stack.testFramework === 'flutter_test' ? 'flutter test' : stack.testFramework === 'go test' ? 'go test ./...' : 'npm run test')}
70
+ \`\`\`
71
+
72
+ \`\`\`
73
+ □ Branch correta (NUNCA main/develop)
74
+ □ Working tree limpa
75
+ □ Dependências instaladas
76
+ □ Build passando
77
+ □ Testes passando ANTES da minha alteração
78
+ \`\`\`
79
+
80
+ ---
81
+
82
+ ## FASE 3: Verificação de Regras de Negócio
83
+
84
+ \`\`\`
85
+ □ Entendo QUEM são os atores afetados
86
+ □ Entendo QUAL é a regra de negócio envolvida
87
+ □ Verifiquei se existe documentação do domínio
88
+ □ Se a feature envolve dinheiro/pagamento → ATENÇÃO REDOBRADA
89
+ □ Se a feature envolve dados pessoais → verificar LGPD/compliance
90
+ □ Se a feature muda um fluxo existente → verificar impacto em features dependentes
91
+ \`\`\`
92
+
93
+ ---
94
+
95
+ ## FASE 4: Before-Code Checklist (por Camada)
96
+
97
+ ### 4A: Backend ${stack.hasBackend ? '✅' : '⬜ (skip se não aplicável)'}
98
+
99
+ \`\`\`
100
+ □ Entendo a estrutura de módulos existente
101
+ □ Sei onde criar/modificar controllers, services, entities
102
+ □ Verifiquei se já existe código similar (DRY)
103
+ □ DTOs e validações planejados
104
+ □ Tratamento de erros definido
105
+ □ Sei qual padrão de teste usar (unitário + integração)
106
+ □ Migrations planejadas (se houver alteração de banco)
107
+ \`\`\`
108
+
109
+ ### 4B: Frontend ${stack.hasFrontend ? '✅' : '⬜ (skip se não aplicável)'}
110
+
111
+ \`\`\`
112
+ □ MOCKUP aprovado pelo humano
113
+ □ Entendo o state management utilizado
114
+ □ Sei onde criar/modificar componentes
115
+ □ Verificar padrão visual (cores, fontes, espaçamentos)
116
+ □ Responsividade considerada
117
+ □ Acessibilidade básica (labels, aria, contraste)
118
+ □ Documento de integração do backend disponível
119
+ \`\`\`
120
+
121
+ ### 4C: Mobile (Flutter) ${stack.hasMobile ? '✅' : '⬜ (skip se não aplicável)'}
122
+
123
+ \`\`\`
124
+ □ MOCKUP aprovado pelo humano
125
+ □ Entendo a navegação atual do app
126
+ □ Sei onde criar/modificar screens e widgets
127
+ □ Verificar padrão visual do app
128
+ □ Comportamento offline considerado
129
+ □ Documento de integração do backend disponível
130
+ \`\`\`
131
+
132
+ ### 4D: Database ${stack.hasDatabase ? '✅' : '⬜ (skip se não aplicável)'}
133
+
134
+ \`\`\`
135
+ □ Schema atual compreendido
136
+ □ Migration reversível planejada
137
+ □ Índices necessários identificados
138
+ □ Impacto em queries existentes avaliado
139
+ □ Seed data / fixtures atualizados
140
+ □ Backup strategy para dados existentes
141
+ \`\`\`
142
+
143
+ ---
144
+
145
+ ## FASE 5: Before-Commit
146
+
147
+ \`\`\`
148
+ □ Build compila sem erros
149
+ □ TODOS os testes passam (velhos + novos)
150
+ □ Cobertura ≥ ${config.coverageMinimum}%
151
+ □ Lint sem warnings
152
+ □ Sem console.log / print() em produção
153
+ □ Sem TODO / FIXME sem issue
154
+ □ Sem secrets hardcoded
155
+ □ Sem arquivos > 500 linhas sem justificativa
156
+ □ Commit message segue padrão (feat: / fix: / refactor: / docs:)
157
+ □ Branch está atualizada com base (rebase se necessário)
158
+ \`\`\`
159
+
160
+ ---
161
+
162
+ ## FASE 6: Before-Done
163
+
164
+ \`\`\`
165
+ □ TODOS os critérios de aceite estão cobertos
166
+ □ Score não regrediu: architect score ./src ≥ ${config.scoreThreshold}/100
167
+ □ Documentação atualizada (se necessário)
168
+ □ LESSONS-LEARNED atualizado (se descobri algo novo)
169
+ □ PR criado com descrição completa
170
+ □ Code review solicitado
171
+ \`\`\`
172
+
173
+ ---
174
+
175
+ ## 🚩 Red Flags — PARE IMEDIATAMENTE SE:
176
+
177
+ | Red Flag | Ação |
178
+ |----------|------|
179
+ | Não entendo a requisição | PARAR → Perguntar ao humano |
180
+ | Código que mexo tem 0% de cobertura | PARAR → Escrever testes ANTES |
181
+ | Estou modificando > 10 arquivos | PARAR → Reavaliar escopo |
182
+ | Build quebrou após minha mudança | PARAR → Reverter → Investigar |
183
+ | Estou copiando/colando código | PARAR → Extrair abstração |
184
+ | Estou trabalhando em main/develop | PARAR → Criar branch |
185
+ | Não tenho mockup e a feature tem UI | PARAR → Gate 1 primeiro |
186
+ | Estou escrevendo código sem testes | PARAR → TDD |
187
+
188
+ ---
189
+
190
+ ## 🔍 Template de Diagnóstico
191
+
192
+ Execute antes de qualquer implementação:
193
+
194
+ \`\`\`bash
195
+ # Estrutura do projeto
196
+ find . -type f -name "*.${stack.primary === 'Python' ? 'py' : stack.primary === 'Dart' ? 'dart' : 'ts'}" | head -30
197
+
198
+ # Dependências do módulo que vou modificar
199
+ grep -r "import.*${stack.primary === 'Python' ? 'from' : 'from'}" --include="*.${stack.primary === 'Python' ? 'py' : 'ts'}" [modulo]/ | head -20
200
+
201
+ # Testes existentes
202
+ find . -name "*.test.*" -o -name "*.spec.*" -o -name "*_test.*" | head -20
203
+
204
+ # Score atual
205
+ npx @girardelli/architect score .
206
+ \`\`\`
207
+
208
+ ---
209
+
210
+ **Gerado por Architect v3.1 · Score: ${report.score.overall}/100 · ${new Date().toISOString().split('T')[0]}**
211
+ `;
212
+ }
213
+ //# sourceMappingURL=preflight.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preflight.js","sourceRoot":"","sources":["../../../../src/agent-generator/templates/core/preflight.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,GAAoB;IACpD,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC;IACnD,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;IAClC,MAAM,EAAE,GAAG,QAAQ,CAAC,SAAS,CAAC;IAE9B,OAAO;;;;kEAIyD,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgD3E,EAAE,EAAE,UAAU,IAAI,CAAC,KAAK,CAAC,cAAc,KAAK,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,cAAc,KAAK,KAAK,CAAC,CAAC,CAAC,iCAAiC,CAAC,CAAC,CAAC,KAAK,CAAC,cAAc,KAAK,KAAK,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,cAAc,UAAU,CAAC;;;EAG3N,EAAE,EAAE,QAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,KAAK,KAAK,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,KAAK,CAAC,cAAc,KAAK,KAAK,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,YAAY,CAAC;;;EAGpI,EAAE,EAAE,OAAO,IAAI,CAAC,KAAK,CAAC,aAAa,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,aAAa,KAAK,cAAc,CAAC,CAAC,CAAC,cAAc,CAA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ICAL/IMPORTANT/DESIRABLE), per-layer checklists,
5
+ * explicit blockers list, metrics table, 4-stage verification process.
6
+ *
7
+ * Context-aware: Adds compliance-specific gates, untested modules warnings,
8
+ * and domain-specific blockers when enriched data is available.
9
+ */
10
+ export declare function generateQualityGates(ctx: TemplateContext | EnrichedTemplateContext): string;
11
+ //# sourceMappingURL=quality-gates.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quality-gates.d.ts","sourceRoot":"","sources":["../../../../src/agent-generator/templates/core/quality-gates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAG1E;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,eAAe,GAAG,uBAAuB,GAAG,MAAM,CAoP3F"}