@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.
- package/README.md +105 -116
- package/__test_agent_output__/INDEX.md +1 -0
- package/__test_agent_output__/agents/AGENT-ORCHESTRATOR.md +1 -0
- package/__test_agent_output__/agents/DATABASE-ENGINEER.md +174 -0
- package/__test_agent_output__/agents/QA-TEST-ENGINEER.md +138 -0
- package/__test_agent_output__/agents/SECURITY-AUDITOR.md +106 -0
- package/__test_agent_output__/agents/TECH-DEBT-CONTROLLER.md +104 -0
- package/__test_agent_output__/agents/TYPESCRIPT-BACKEND-DEVELOPER.md +135 -0
- package/__test_agent_output__/guards/CODE-REVIEW-CHECKLIST.md +95 -0
- package/__test_agent_output__/guards/PREFLIGHT.md +200 -0
- package/__test_agent_output__/guards/QUALITY-GATES.md +1 -0
- package/__test_agent_output__/rules/00-general.md +229 -0
- package/__test_agent_output__/rules/01-architecture.md +191 -0
- package/__test_agent_output__/rules/02-security.md +402 -0
- package/__test_agent_output__/rules/03-nestjs.md +124 -0
- package/__test_agent_output__/templates/ADR.md +95 -0
- package/__test_agent_output__/templates/BDD.md +58 -0
- package/__test_agent_output__/templates/C4.md +68 -0
- package/__test_agent_output__/templates/TDD.md +86 -0
- package/__test_agent_output__/templates/THREAT-MODEL.md +82 -0
- package/__test_agent_output__/workflows/fix-bug.md +228 -0
- package/__test_agent_output__/workflows/new-feature.md +311 -0
- package/__test_agent_output__/workflows/review.md +95 -0
- package/__test_context_7RvUrO/src/modules/empty/empty.ts +0 -0
- package/__test_context_Rf5fNJ/src/modules/mixed/mixed.ts +5 -0
- package/__test_context_WRCnYH/src/modules/test/test.ts +10 -0
- package/__test_context_YsnVS3/src/modules/test/test.ts +10 -0
- package/__test_context_w7XZeH/src/modules/mixed/mixed.ts +5 -0
- package/__test_context_y5noh6/src/modules/empty/empty.ts +0 -0
- package/__test_framework__24OjAu/package.json +1 -0
- package/__test_framework__3ZDZsx/pyproject.toml +8 -0
- package/__test_framework__4T54Jn/package.json +1 -0
- package/__test_framework__4tlXu9/pyproject.toml +8 -0
- package/__test_framework__6boWqQ/Pipfile +6 -0
- package/__test_framework__6gygMU/pom.xml +10 -0
- package/__test_framework__6kxj0N/go.mod +8 -0
- package/__test_framework__7CEoXw/pom.xml +10 -0
- package/__test_framework__85DDz0/Pipfile +6 -0
- package/__test_framework__9WrRIr/pom.xml +7 -0
- package/__test_framework__ANqGKl/Gemfile +5 -0
- package/__test_framework__BCXTEM/go.mod +3 -0
- package/__test_framework__BHiPNq/setup.py +2 -0
- package/__test_framework__BqkiKv/package.json +1 -0
- package/__test_framework__C5yd8X/Pipfile.lock +1 -0
- package/__test_framework__C5yd8X/requirements.txt +1 -0
- package/__test_framework__C87d3a/manage.py +1 -0
- package/__test_framework__C87d3a/requirements.txt +2 -0
- package/__test_framework__DXNwc5/build.gradle +7 -0
- package/__test_framework__GhHSt3/build.gradle.kts +4 -0
- package/__test_framework__GzklJP/Cargo.toml +7 -0
- package/__test_framework__H4hd13/go.mod +8 -0
- package/__test_framework__HKjOXO/composer.json +1 -0
- package/__test_framework__HaDN45/Gemfile +3 -0
- package/__test_framework__IBO7YG/pyproject.toml +9 -0
- package/__test_framework__JwSOyF/pyproject.toml +6 -0
- package/__test_framework__K6HrCr/build.gradle +2 -0
- package/__test_framework__KzRPlh/pubspec.yaml +9 -0
- package/__test_framework__L6uIym/pyproject.toml +6 -0
- package/__test_framework__LOdoGK/requirements.txt +4 -0
- package/__test_framework__LgHzss/package.json +1 -0
- package/__test_framework__M76M6q/Gemfile +5 -0
- package/__test_framework__Mr9vWW/composer.json +1 -0
- package/__test_framework__N03Gnv/package.json +1 -0
- package/__test_framework__Num4UE/requirements +1 -0
- package/__test_framework__OAGw3Y/build.gradle +7 -0
- package/__test_framework__OQc8yG/pubspec.yaml +9 -0
- package/__test_framework__OwKZcd/requirements.txt +3 -0
- package/__test_framework__P0gFv7/requirements +1 -0
- package/__test_framework__PN55Rq/package.json +1 -0
- package/__test_framework__PQiqX8/pubspec.yaml +3 -0
- package/__test_framework__RBHsg7/composer.json +1 -0
- package/__test_framework__RHxif4/Cargo.toml +7 -0
- package/__test_framework__T0v0p1/Cargo.toml +4 -0
- package/__test_framework__Tu0clt/Pipfile.lock +1 -0
- package/__test_framework__Tu0clt/requirements.txt +1 -0
- package/__test_framework__TwDj9P/Cargo.toml +4 -0
- package/__test_framework__VQJNC4/pom.xml +7 -0
- package/__test_framework__W6sm05/package.json +1 -0
- package/__test_framework__W7vBLy/pyproject.toml +4 -0
- package/__test_framework__WNJOWT/setup.py +2 -0
- package/__test_framework__WSJs7U/package.json +1 -0
- package/__test_framework__YQ5VpA/build.gradle.kts +4 -0
- package/__test_framework__ZNEUEs/package.json +1 -0
- package/__test_framework__Znt922/pom.xml +7 -0
- package/__test_framework__azyg0h/pom.xml +7 -0
- package/__test_framework__c6otLr/package.json +1 -0
- package/__test_framework__cl9S9G/build.gradle +2 -0
- package/__test_framework__eilvV4/composer.json +1 -0
- package/__test_framework__gQZxXO/manage.py +1 -0
- package/__test_framework__gQZxXO/requirements.txt +2 -0
- package/__test_framework__ghvl26/poetry.lock +1 -0
- package/__test_framework__ghvl26/pyproject.toml +2 -0
- package/__test_framework__hR7b9U/Makefile +11 -0
- package/__test_framework__iESVsi/composer.json +1 -0
- package/__test_framework__jm6TJy/package.json +1 -0
- package/__test_framework__kBUpjs/pyproject.toml +9 -0
- package/__test_framework__kqoZrw/requirements.txt +4 -0
- package/__test_framework__lWkoyO/pyproject.toml +4 -0
- package/__test_framework__mTKnUO/package.json +1 -0
- package/__test_framework__nCeZwe/Makefile +11 -0
- package/__test_framework__oljsU0/package.json +1 -0
- package/__test_framework__osRG4q/go.mod +3 -0
- package/__test_framework__pCHH4F/package.json +1 -0
- package/__test_framework__pExx6E/Gemfile +3 -0
- package/__test_framework__pyBoGd/pyproject.toml +5 -0
- package/__test_framework__qw16VQ/package.json +1 -0
- package/__test_framework__rRayrG/package.json +1 -0
- package/__test_framework__s82zO5/package.json +1 -0
- package/__test_framework__tp8MFK/pyproject.toml +5 -0
- package/__test_framework__w44k4w/composer.json +1 -0
- package/__test_framework__yefPZY/poetry.lock +1 -0
- package/__test_framework__yefPZY/pyproject.toml +2 -0
- package/__test_framework__zCiyDT/requirements.txt +3 -0
- package/__test_framework__zGZN3j/pubspec.yaml +3 -0
- package/__test_framework__zXpnxL/package.json +1 -0
- package/architect-run.sh +431 -0
- package/assets/banner-v3.html +561 -0
- package/dist/agent-generator/context-enricher.d.ts +58 -0
- package/dist/agent-generator/context-enricher.d.ts.map +1 -0
- package/dist/agent-generator/context-enricher.js +581 -0
- package/dist/agent-generator/context-enricher.js.map +1 -0
- package/dist/agent-generator/domain-inferrer.d.ts +52 -0
- package/dist/agent-generator/domain-inferrer.d.ts.map +1 -0
- package/dist/agent-generator/domain-inferrer.js +575 -0
- package/dist/agent-generator/domain-inferrer.js.map +1 -0
- package/dist/agent-generator/framework-detector.d.ts +40 -0
- package/dist/agent-generator/framework-detector.d.ts.map +1 -0
- package/dist/agent-generator/framework-detector.js +611 -0
- package/dist/agent-generator/framework-detector.js.map +1 -0
- package/dist/agent-generator/index.d.ts +33 -0
- package/dist/agent-generator/index.d.ts.map +1 -0
- package/dist/agent-generator/index.js +477 -0
- package/dist/agent-generator/index.js.map +1 -0
- package/dist/agent-generator/stack-detector.d.ts +12 -0
- package/dist/agent-generator/stack-detector.d.ts.map +1 -0
- package/dist/agent-generator/stack-detector.js +128 -0
- package/dist/agent-generator/stack-detector.js.map +1 -0
- package/dist/agent-generator/templates/core/agents.d.ts +17 -0
- package/dist/agent-generator/templates/core/agents.d.ts.map +1 -0
- package/dist/agent-generator/templates/core/agents.js +1252 -0
- package/dist/agent-generator/templates/core/agents.js.map +1 -0
- package/dist/agent-generator/templates/core/architecture-rules.d.ts +7 -0
- package/dist/agent-generator/templates/core/architecture-rules.d.ts.map +1 -0
- package/dist/agent-generator/templates/core/architecture-rules.js +274 -0
- package/dist/agent-generator/templates/core/architecture-rules.js.map +1 -0
- package/dist/agent-generator/templates/core/general-rules.d.ts +8 -0
- package/dist/agent-generator/templates/core/general-rules.d.ts.map +1 -0
- package/dist/agent-generator/templates/core/general-rules.js +301 -0
- package/dist/agent-generator/templates/core/general-rules.js.map +1 -0
- package/dist/agent-generator/templates/core/index-md.d.ts +7 -0
- package/dist/agent-generator/templates/core/index-md.d.ts.map +1 -0
- package/dist/agent-generator/templates/core/index-md.js +246 -0
- package/dist/agent-generator/templates/core/index-md.js.map +1 -0
- package/dist/agent-generator/templates/core/orchestrator.d.ts +8 -0
- package/dist/agent-generator/templates/core/orchestrator.d.ts.map +1 -0
- package/dist/agent-generator/templates/core/orchestrator.js +422 -0
- package/dist/agent-generator/templates/core/orchestrator.js.map +1 -0
- package/dist/agent-generator/templates/core/preflight.d.ts +8 -0
- package/dist/agent-generator/templates/core/preflight.d.ts.map +1 -0
- package/dist/agent-generator/templates/core/preflight.js +213 -0
- package/dist/agent-generator/templates/core/preflight.js.map +1 -0
- package/dist/agent-generator/templates/core/quality-gates.d.ts +11 -0
- package/dist/agent-generator/templates/core/quality-gates.d.ts.map +1 -0
- package/dist/agent-generator/templates/core/quality-gates.js +254 -0
- package/dist/agent-generator/templates/core/quality-gates.js.map +1 -0
- package/dist/agent-generator/templates/core/security-rules.d.ts +7 -0
- package/dist/agent-generator/templates/core/security-rules.d.ts.map +1 -0
- package/dist/agent-generator/templates/core/security-rules.js +528 -0
- package/dist/agent-generator/templates/core/security-rules.js.map +1 -0
- package/dist/agent-generator/templates/core/skills-generator.d.ts +6 -0
- package/dist/agent-generator/templates/core/skills-generator.d.ts.map +1 -0
- package/dist/agent-generator/templates/core/skills-generator.js +207 -0
- package/dist/agent-generator/templates/core/skills-generator.js.map +1 -0
- package/dist/agent-generator/templates/core/workflow-fix-bug.d.ts +7 -0
- package/dist/agent-generator/templates/core/workflow-fix-bug.d.ts.map +1 -0
- package/dist/agent-generator/templates/core/workflow-fix-bug.js +237 -0
- package/dist/agent-generator/templates/core/workflow-fix-bug.js.map +1 -0
- package/dist/agent-generator/templates/core/workflow-new-feature.d.ts +8 -0
- package/dist/agent-generator/templates/core/workflow-new-feature.d.ts.map +1 -0
- package/dist/agent-generator/templates/core/workflow-new-feature.js +321 -0
- package/dist/agent-generator/templates/core/workflow-new-feature.js.map +1 -0
- package/dist/agent-generator/templates/core/workflow-review.d.ts +7 -0
- package/dist/agent-generator/templates/core/workflow-review.d.ts.map +1 -0
- package/dist/agent-generator/templates/core/workflow-review.js +104 -0
- package/dist/agent-generator/templates/core/workflow-review.js.map +1 -0
- package/dist/agent-generator/templates/domain/index.d.ts +22 -0
- package/dist/agent-generator/templates/domain/index.d.ts.map +1 -0
- package/dist/agent-generator/templates/domain/index.js +1176 -0
- package/dist/agent-generator/templates/domain/index.js.map +1 -0
- package/dist/agent-generator/templates/stack/index.d.ts +8 -0
- package/dist/agent-generator/templates/stack/index.d.ts.map +1 -0
- package/dist/agent-generator/templates/stack/index.js +695 -0
- package/dist/agent-generator/templates/stack/index.js.map +1 -0
- package/dist/agent-generator/templates/template-helpers.d.ts +75 -0
- package/dist/agent-generator/templates/template-helpers.d.ts.map +1 -0
- package/dist/agent-generator/templates/template-helpers.js +726 -0
- package/dist/agent-generator/templates/template-helpers.js.map +1 -0
- package/dist/agent-generator/types.d.ts +196 -0
- package/dist/agent-generator/types.d.ts.map +1 -0
- package/dist/agent-generator/types.js +27 -0
- package/dist/agent-generator/types.js.map +1 -0
- package/dist/analyzer.d.ts +5 -0
- package/dist/analyzer.d.ts.map +1 -1
- package/dist/analyzer.js +35 -4
- package/dist/analyzer.js.map +1 -1
- package/dist/analyzers/forecast.d.ts +85 -0
- package/dist/analyzers/forecast.d.ts.map +1 -0
- package/dist/analyzers/forecast.js +337 -0
- package/dist/analyzers/forecast.js.map +1 -0
- package/dist/analyzers/git-cache.d.ts +7 -0
- package/dist/analyzers/git-cache.d.ts.map +1 -0
- package/dist/analyzers/git-cache.js +41 -0
- package/dist/analyzers/git-cache.js.map +1 -0
- package/dist/analyzers/git-history.d.ts +113 -0
- package/dist/analyzers/git-history.d.ts.map +1 -0
- package/dist/analyzers/git-history.js +333 -0
- package/dist/analyzers/git-history.js.map +1 -0
- package/dist/analyzers/index.d.ts +10 -0
- package/dist/analyzers/index.d.ts.map +1 -0
- package/dist/analyzers/index.js +7 -0
- package/dist/analyzers/index.js.map +1 -0
- package/dist/analyzers/temporal-scorer.d.ts +72 -0
- package/dist/analyzers/temporal-scorer.d.ts.map +1 -0
- package/dist/analyzers/temporal-scorer.js +140 -0
- package/dist/analyzers/temporal-scorer.js.map +1 -0
- package/dist/cli.d.ts +2 -3
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +275 -113
- package/dist/cli.js.map +1 -1
- package/dist/html-reporter.d.ts +3 -1
- package/dist/html-reporter.d.ts.map +1 -1
- package/dist/html-reporter.js +248 -12
- package/dist/html-reporter.js.map +1 -1
- package/dist/index.d.ts +16 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +63 -4
- package/dist/index.js.map +1 -1
- package/dist/project-summarizer.d.ts +18 -0
- package/dist/project-summarizer.d.ts.map +1 -0
- package/dist/project-summarizer.js +306 -0
- package/dist/project-summarizer.js.map +1 -0
- package/dist/refactor-reporter.js +1 -1
- package/dist/types.d.ts +13 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +12 -3
- package/src/agent-generator/context-enricher.ts +643 -0
- package/src/agent-generator/domain-inferrer.ts +625 -0
- package/src/agent-generator/framework-detector.ts +669 -0
- package/src/agent-generator/index.ts +555 -0
- package/src/agent-generator/stack-detector.ts +103 -0
- package/src/agent-generator/templates/core/agents.ts +1293 -0
- package/src/agent-generator/templates/core/architecture-rules.ts +287 -0
- package/src/agent-generator/templates/core/general-rules.ts +306 -0
- package/src/agent-generator/templates/core/index-md.ts +260 -0
- package/src/agent-generator/templates/core/orchestrator.ts +459 -0
- package/src/agent-generator/templates/core/preflight.ts +215 -0
- package/src/agent-generator/templates/core/quality-gates.ts +256 -0
- package/src/agent-generator/templates/core/security-rules.ts +543 -0
- package/src/agent-generator/templates/core/skills-generator.ts +236 -0
- package/src/agent-generator/templates/core/workflow-fix-bug.ts +239 -0
- package/src/agent-generator/templates/core/workflow-new-feature.ts +323 -0
- package/src/agent-generator/templates/core/workflow-review.ts +106 -0
- package/src/agent-generator/templates/domain/index.ts +1201 -0
- package/src/agent-generator/templates/stack/index.ts +705 -0
- package/src/agent-generator/templates/template-helpers.ts +776 -0
- package/src/agent-generator/types.ts +232 -0
- package/src/analyzer.ts +38 -4
- package/src/analyzers/forecast.ts +496 -0
- package/src/analyzers/git-cache.ts +52 -0
- package/src/analyzers/git-history.ts +488 -0
- package/src/analyzers/index.ts +33 -0
- package/src/analyzers/temporal-scorer.ts +227 -0
- package/src/cli.ts +316 -117
- package/src/html-reporter.ts +263 -13
- package/src/index.ts +92 -9
- package/src/project-summarizer.ts +347 -0
- package/src/refactor-reporter.ts +1 -1
- package/src/types.ts +10 -0
- package/tests/agent-generator.test.ts +411 -0
- package/tests/analyzers-integration.test.ts +174 -0
- package/tests/architect-adapter-enrichment.test.ts +9 -0
- package/tests/context-enricher.test.ts +971 -0
- package/tests/forecast.test.ts +509 -0
- package/tests/framework-detector.test.ts +1172 -0
- package/tests/git-history.test.ts +254 -0
- package/tests/scanner.test.ts +7 -8
- package/tests/scorer.test.ts +588 -0
- package/tests/stack-detector.test.ts +241 -0
- package/tests/template-generation.test.ts +706 -0
- package/tests/template-helpers.test.ts +1152 -0
- package/tests/temporal-scorer.test.ts +307 -0
- package/dist/agent-generator.d.ts +0 -106
- package/dist/agent-generator.d.ts.map +0 -1
- package/dist/agent-generator.js +0 -1398
- package/dist/agent-generator.js.map +0 -1
- package/src/agent-generator.ts +0 -1526
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import { getEnriched } from '../template-helpers.js';
|
|
2
|
+
/**
|
|
3
|
+
* Analisa módulos e detecta padrões recorrentes (adapters, factories, extractors, etc.)
|
|
4
|
+
*/
|
|
5
|
+
function detectPatterns(ctx) {
|
|
6
|
+
const enriched = getEnriched(ctx);
|
|
7
|
+
const modules = enriched.modules || [];
|
|
8
|
+
const patterns = [];
|
|
9
|
+
// Collect all file/class names from modules
|
|
10
|
+
const allFiles = [];
|
|
11
|
+
const allServices = [];
|
|
12
|
+
const allControllers = [];
|
|
13
|
+
const allEntities = [];
|
|
14
|
+
for (const mod of modules) {
|
|
15
|
+
allServices.push(...mod.services);
|
|
16
|
+
allControllers.push(...mod.controllers);
|
|
17
|
+
allEntities.push(...mod.entities);
|
|
18
|
+
allFiles.push(...mod.testFiles);
|
|
19
|
+
}
|
|
20
|
+
const allNames = [...allServices, ...allControllers, ...allEntities, ...allFiles];
|
|
21
|
+
// Detect Adapter pattern
|
|
22
|
+
const adapters = allNames.filter(n => /adapter/i.test(n));
|
|
23
|
+
if (adapters.length > 0) {
|
|
24
|
+
patterns.push({
|
|
25
|
+
name: 'Adapter Pattern',
|
|
26
|
+
description: 'O projeto utiliza o padrão Adapter para abstrair integrações externas e garantir desacoplamento.',
|
|
27
|
+
examples: adapters.slice(0, 5),
|
|
28
|
+
howToCreate: `1. Criar interface no domínio: \`I{Nome}Port\`
|
|
29
|
+
2. Implementar adapter: \`{Nome}Adapter implements I{Nome}Port\`
|
|
30
|
+
3. Registrar no container de DI
|
|
31
|
+
4. Escrever testes unitários com mock do adapter
|
|
32
|
+
5. Garantir que o domínio nunca importe o adapter diretamente`,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
// Detect Factory pattern
|
|
36
|
+
const factories = allNames.filter(n => /factory/i.test(n));
|
|
37
|
+
if (factories.length > 0) {
|
|
38
|
+
patterns.push({
|
|
39
|
+
name: 'Factory Pattern',
|
|
40
|
+
description: 'Factories são usadas para encapsular a lógica de criação de objetos complexos.',
|
|
41
|
+
examples: factories.slice(0, 5),
|
|
42
|
+
howToCreate: `1. Criar classe factory: \`{Nome}Factory\`
|
|
43
|
+
2. Método principal: \`create({params}): {Tipo}\`
|
|
44
|
+
3. Encapsular validações e defaults
|
|
45
|
+
4. Escrever testes para cada variação de criação`,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
// Detect Extractor pattern
|
|
49
|
+
const extractors = allNames.filter(n => /extractor|parser|reader/i.test(n));
|
|
50
|
+
if (extractors.length > 0) {
|
|
51
|
+
patterns.push({
|
|
52
|
+
name: 'Extractor/Parser Pattern',
|
|
53
|
+
description: 'Extractors/Parsers são usados para extrair e transformar dados de fontes externas (PDFs, APIs, arquivos).',
|
|
54
|
+
examples: extractors.slice(0, 5),
|
|
55
|
+
howToCreate: `1. Criar interface: \`I{Tipo}Extractor\`
|
|
56
|
+
2. Implementar: \`{Tipo}Extractor implements I{Tipo}Extractor\`
|
|
57
|
+
3. Método principal: \`extract(source): ExtractedData\`
|
|
58
|
+
4. Testar com fixtures (dados de exemplo)
|
|
59
|
+
5. Tratar edge cases: dados vazios, formato inválido, timeout`,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
// Detect Repository pattern
|
|
63
|
+
const repositories = allNames.filter(n => /repository|repo/i.test(n));
|
|
64
|
+
if (repositories.length > 0) {
|
|
65
|
+
patterns.push({
|
|
66
|
+
name: 'Repository Pattern',
|
|
67
|
+
description: 'Repositories abstraem o acesso a dados, separando lógica de negócio da persistência.',
|
|
68
|
+
examples: repositories.slice(0, 5),
|
|
69
|
+
howToCreate: `1. Criar interface: \`I{Entidade}Repository\`
|
|
70
|
+
2. Métodos padrão: findById, findAll, save, delete
|
|
71
|
+
3. Implementar com ORM ou query builder
|
|
72
|
+
4. Testar com banco in-memory ou mock`,
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
// Detect Middleware/Guard pattern
|
|
76
|
+
const middlewares = allNames.filter(n => /middleware|guard|interceptor|pipe/i.test(n));
|
|
77
|
+
if (middlewares.length > 0) {
|
|
78
|
+
patterns.push({
|
|
79
|
+
name: 'Middleware/Guard Pattern',
|
|
80
|
+
description: 'Middlewares e Guards implementam cross-cutting concerns (auth, logging, validation).',
|
|
81
|
+
examples: middlewares.slice(0, 5),
|
|
82
|
+
howToCreate: `1. Criar middleware/guard com interface do framework
|
|
83
|
+
2. Implementar lógica de interceptação
|
|
84
|
+
3. Registrar no pipeline de request
|
|
85
|
+
4. Testar isoladamente com request mocking`,
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
// Detect DTO/Schema pattern
|
|
89
|
+
const dtos = allNames.filter(n => /dto|schema|model|entity/i.test(n));
|
|
90
|
+
if (dtos.length > 2) { // Only if there are several
|
|
91
|
+
patterns.push({
|
|
92
|
+
name: 'DTO/Schema Pattern',
|
|
93
|
+
description: 'DTOs e Schemas definem contratos de entrada/saída e validações.',
|
|
94
|
+
examples: dtos.slice(0, 5),
|
|
95
|
+
howToCreate: `1. Criar DTO/Schema para cada endpoint
|
|
96
|
+
2. Validações no DTO (não no controller)
|
|
97
|
+
3. Separar RequestDTO e ResponseDTO
|
|
98
|
+
4. Documentar campos obrigatórios e opcionais
|
|
99
|
+
5. Usar validação automática do framework`,
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
// Detect Service Layer pattern (almost always present)
|
|
103
|
+
if (allServices.length > 1) {
|
|
104
|
+
patterns.push({
|
|
105
|
+
name: 'Service Layer Pattern',
|
|
106
|
+
description: 'Services encapsulam toda a lógica de negócio, mantendo controllers finos.',
|
|
107
|
+
examples: allServices.slice(0, 5),
|
|
108
|
+
howToCreate: `1. Criar service: \`{Domínio}Service\`
|
|
109
|
+
2. Injetar dependências via constructor
|
|
110
|
+
3. Um método por caso de uso (SRP)
|
|
111
|
+
4. Lançar exceções de domínio (não HTTP)
|
|
112
|
+
5. Testar unitariamente com mocks de dependências`,
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
return patterns;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Gera conteúdo do skill principal do projeto
|
|
119
|
+
*/
|
|
120
|
+
export function generateProjectSkills(ctx) {
|
|
121
|
+
const enriched = getEnriched(ctx);
|
|
122
|
+
const patterns = detectPatterns(ctx);
|
|
123
|
+
const stack = 'stack' in ctx ? ctx.stack : undefined;
|
|
124
|
+
const domain = enriched.domain;
|
|
125
|
+
if (patterns.length === 0) {
|
|
126
|
+
return null; // Não gerar se não houver padrões detectados
|
|
127
|
+
}
|
|
128
|
+
const langs = stack?.languages.map((l) => l.toLowerCase()) || [];
|
|
129
|
+
const isPython = langs.includes('python');
|
|
130
|
+
const isDart = langs.includes('dart');
|
|
131
|
+
const isGo = langs.includes('go');
|
|
132
|
+
// Naming convention per language
|
|
133
|
+
let fileConvention = 'camelCase para arquivos, PascalCase para classes';
|
|
134
|
+
if (isPython)
|
|
135
|
+
fileConvention = 'snake_case para arquivos e funções, PascalCase para classes';
|
|
136
|
+
else if (isDart)
|
|
137
|
+
fileConvention = 'snake_case para arquivos, camelCase para funções, PascalCase para classes';
|
|
138
|
+
else if (isGo)
|
|
139
|
+
fileConvention = 'lowercase para pacotes, PascalCase para exports, camelCase para privados';
|
|
140
|
+
// Build frameworks label from enriched detectedFrameworks (most accurate) or stack.frameworks
|
|
141
|
+
const detectedFw = enriched.detectedFrameworks;
|
|
142
|
+
const frameworksLabel = detectedFw && detectedFw.length > 0
|
|
143
|
+
? detectedFw.map(f => f.version ? `${f.name} v${f.version}` : f.name).join(', ')
|
|
144
|
+
: (stack?.frameworks.length ? stack.frameworks.join(', ') : 'Não detectados');
|
|
145
|
+
const patternsContent = patterns.map(p => `### ${p.name}
|
|
146
|
+
|
|
147
|
+
${p.description}
|
|
148
|
+
|
|
149
|
+
**Exemplos no projeto:**
|
|
150
|
+
${p.examples.map(e => `- \`${e}\``).join('\n')}
|
|
151
|
+
|
|
152
|
+
**Como criar um novo:**
|
|
153
|
+
${p.howToCreate}
|
|
154
|
+
`).join('\n---\n\n');
|
|
155
|
+
const domainSection = domain ? `
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## Padrões de Domínio: ${domain.domain}${domain.subDomain ? ` / ${domain.subDomain}` : ''}
|
|
159
|
+
|
|
160
|
+
${domain.businessEntities?.length ? `### Entidades de Negócio
|
|
161
|
+
${domain.businessEntities.map(e => `- **${e.name}**: ${e.fields?.join(', ') || 'campos detectados'}`).join('\n')}` : ''}
|
|
162
|
+
|
|
163
|
+
${domain.integrations?.length ? `### Integrações
|
|
164
|
+
${domain.integrations.map(i => `- **${i.name}** (${i.type})`).join('\n')}` : ''}
|
|
165
|
+
|
|
166
|
+
${domain.compliance?.length ? `### Compliance
|
|
167
|
+
${domain.compliance.map(c => `- **${c.name}**: ${c.reason}`).join('\n')}` : ''}
|
|
168
|
+
` : '';
|
|
169
|
+
return `---
|
|
170
|
+
antigravity:
|
|
171
|
+
trigger: 'on_demand'
|
|
172
|
+
description: 'Padrões e convenções específicos do projeto'
|
|
173
|
+
version: 3.1.0
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
# 📚 Skills: Padrões do Projeto
|
|
177
|
+
|
|
178
|
+
> Referência rápida dos padrões arquiteturais detectados e como seguí-los.
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
## Convenções
|
|
183
|
+
|
|
184
|
+
- **Nomenclatura de arquivos:** ${fileConvention}
|
|
185
|
+
- **Stack:** ${stack?.languages.join(', ') || 'Não detectada'}
|
|
186
|
+
- **Frameworks:** ${frameworksLabel}
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## Padrões Arquiteturais Detectados
|
|
191
|
+
|
|
192
|
+
${patternsContent}
|
|
193
|
+
${domainSection}
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
## Checklist para Novo Código
|
|
197
|
+
|
|
198
|
+
\`\`\`
|
|
199
|
+
□ Segue os padrões acima?
|
|
200
|
+
□ Testes escritos antes do código (TDD)?
|
|
201
|
+
□ Nomenclatura consistente com convenções?
|
|
202
|
+
□ Sem duplicação de lógica existente?
|
|
203
|
+
□ Documentação atualizada (JSDoc/docstring)?
|
|
204
|
+
\`\`\`
|
|
205
|
+
`;
|
|
206
|
+
}
|
|
207
|
+
//# sourceMappingURL=skills-generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skills-generator.js","sourceRoot":"","sources":["../../../../src/agent-generator/templates/core/skills-generator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAcrD;;GAEG;AACH,SAAS,cAAc,CAAC,GAA8C;IACpE,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;IAClC,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,IAAI,EAAE,CAAC;IACvC,MAAM,QAAQ,GAAsB,EAAE,CAAC;IAEvC,4CAA4C;IAC5C,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,MAAM,WAAW,GAAa,EAAE,CAAC;IACjC,MAAM,cAAc,GAAa,EAAE,CAAC;IACpC,MAAM,WAAW,GAAa,EAAE,CAAC;IAEjC,KAAK,MAAM,GAAG,IAAI,OAAO,EAAE,CAAC;QAC1B,WAAW,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,QAAQ,CAAC,CAAC;QAClC,cAAc,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,WAAW,CAAC,CAAC;QACxC,WAAW,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,QAAQ,CAAC,CAAC;QAClC,QAAQ,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,SAAS,CAAC,CAAC;IAClC,CAAC;IAED,MAAM,QAAQ,GAAG,CAAC,GAAG,WAAW,EAAE,GAAG,cAAc,EAAE,GAAG,WAAW,EAAE,GAAG,QAAQ,CAAC,CAAC;IAElF,yBAAyB;IACzB,MAAM,QAAQ,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1D,IAAI,QAAQ,CAAC,MAAM,GAAG,CA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EAC9B,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE;;EAE7E,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC;EAC5B,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE;CAC7E,CAAC,CAAC,CAAC,EAAE,CAAC;IAEL,OAAO;;;;;;;;;;;;;;;kCAeyB,cAAc;eACjC,KAAK,EAAE,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,eAAe;oBACzC,eAAe;;;;;;EAMjC,eAAe;EACf,aAAa;;;;;;;;;;;;CAYd,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { TemplateContext } from '../../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Generates enterprise-grade fix-bug.md workflow.
|
|
4
|
+
* 10 steps: diagnosis → localization → root cause → RED test → fix → regression → docs.
|
|
5
|
+
*/
|
|
6
|
+
export declare function generateFixBugWorkflow(ctx: TemplateContext): string;
|
|
7
|
+
//# sourceMappingURL=workflow-fix-bug.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-fix-bug.d.ts","sourceRoot":"","sources":["../../../../src/agent-generator/templates/core/workflow-fix-bug.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,eAAe,GAAG,MAAM,CAwOnE"}
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generates enterprise-grade fix-bug.md workflow.
|
|
3
|
+
* 10 steps: diagnosis → localization → root cause → RED test → fix → regression → docs.
|
|
4
|
+
*/
|
|
5
|
+
export function generateFixBugWorkflow(ctx) {
|
|
6
|
+
const { stack, projectName, config, report } = ctx;
|
|
7
|
+
return `---
|
|
8
|
+
antigravity:
|
|
9
|
+
trigger: 'on_demand'
|
|
10
|
+
description: 'Workflow completo para correção de bug em ${projectName}'
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# 🐛 Workflow: Fix Bug
|
|
14
|
+
|
|
15
|
+
> **Bugs não se corrigem por tentativa e erro.**
|
|
16
|
+
> Diagnóstico rigoroso → reprodução → root cause → teste RED → fix → regressão.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Pré-requisitos
|
|
21
|
+
|
|
22
|
+
\`\`\`
|
|
23
|
+
□ Li INDEX.md e PREFLIGHT.md
|
|
24
|
+
□ Li LESSONS-LEARNED.md (se existir) — talvez esse bug já aconteceu
|
|
25
|
+
□ Li ERROR-PATTERNS.md (se existir) — talvez é um padrão conhecido
|
|
26
|
+
□ Estou em uma branch fix/ ou hotfix/ (NUNCA main/develop)
|
|
27
|
+
□ Build e testes passando ANTES da minha alteração
|
|
28
|
+
\`\`\`
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Step 1: Diagnóstico Inicial
|
|
33
|
+
|
|
34
|
+
\`\`\`
|
|
35
|
+
Bug: [descrição clara do problema]
|
|
36
|
+
Reportado por: [quem reportou]
|
|
37
|
+
Ambiente: [produção / staging / dev]
|
|
38
|
+
Severidade: [CRITICAL / HIGH / MEDIUM / LOW]
|
|
39
|
+
|
|
40
|
+
Comportamento atual: [o que acontece]
|
|
41
|
+
Comportamento esperado: [o que deveria acontecer]
|
|
42
|
+
Como reproduzir:
|
|
43
|
+
1. [passo 1]
|
|
44
|
+
2. [passo 2]
|
|
45
|
+
3. [resultado errado]
|
|
46
|
+
\`\`\`
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Step 2: Leitura de Contexto
|
|
51
|
+
|
|
52
|
+
\`\`\`bash
|
|
53
|
+
# Verificar LESSONS-LEARNED para bugs similares
|
|
54
|
+
grep -i "[termo do bug]" LESSONS-LEARNED.md 2>/dev/null
|
|
55
|
+
|
|
56
|
+
# Verificar ERROR-PATTERNS
|
|
57
|
+
grep -i "[termo do bug]" ERROR-PATTERNS.md 2>/dev/null
|
|
58
|
+
|
|
59
|
+
# Verificar regras de negócio relevantes
|
|
60
|
+
grep -i "[domínio do bug]" BUSINESS-RULES.md 2>/dev/null
|
|
61
|
+
|
|
62
|
+
# Histórico de commits na área afetada
|
|
63
|
+
git log --oneline -20 -- [arquivo ou diretório afetado]
|
|
64
|
+
\`\`\`
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## Step 3: Localização do Problema
|
|
69
|
+
|
|
70
|
+
\`\`\`bash
|
|
71
|
+
# Buscar no código
|
|
72
|
+
grep -rn "[termo do erro]" --include="*.${stack.primary === 'Python' ? 'py' : stack.primary === 'Dart' ? 'dart' : 'ts'}" src/
|
|
73
|
+
|
|
74
|
+
# Verificar logs (se disponível)
|
|
75
|
+
# Verificar stack trace
|
|
76
|
+
|
|
77
|
+
# Mapear o fluxo de dados:
|
|
78
|
+
# Input → [onde entra] → [como transforma] → [onde sai] → Output
|
|
79
|
+
\`\`\`
|
|
80
|
+
|
|
81
|
+
\`\`\`
|
|
82
|
+
Arquivo(s) suspeito(s): _______________
|
|
83
|
+
Função/método suspeito: _______________
|
|
84
|
+
Linha(s) suspeita(s): _______________
|
|
85
|
+
\`\`\`
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## Step 4: Root Cause — Identificação da Causa Raiz
|
|
90
|
+
|
|
91
|
+
\`\`\`
|
|
92
|
+
╔══════════════════════════════════════════════╗
|
|
93
|
+
║ NUNCA corrigir o SINTOMA. ║
|
|
94
|
+
║ SEMPRE encontrar a CAUSA RAIZ. ║
|
|
95
|
+
║ ║
|
|
96
|
+
║ Técnica dos 5 Porquês: ║
|
|
97
|
+
║ 1. Por que o bug acontece? → porque... ║
|
|
98
|
+
║ 2. Por que isso? → porque... ║
|
|
99
|
+
║ 3. Por que isso? → porque... ║
|
|
100
|
+
║ 4. Por que isso? → porque... ║
|
|
101
|
+
║ 5. Por que isso? → CAUSA RAIZ ║
|
|
102
|
+
╚══════════════════════════════════════════════╝
|
|
103
|
+
\`\`\`
|
|
104
|
+
|
|
105
|
+
\`\`\`
|
|
106
|
+
Causa raiz: _______________
|
|
107
|
+
Confiança: [ ] Alta (reproduzi) [ ] Média (hipótese forte) [ ] Baixa (preciso investigar mais)
|
|
108
|
+
\`\`\`
|
|
109
|
+
|
|
110
|
+
> **Se confiança é Baixa → PARAR e investigar mais. Não chutar.**
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## Step 5: Verificar Testes Existentes
|
|
115
|
+
|
|
116
|
+
\`\`\`bash
|
|
117
|
+
# Testes que cobrem a área afetada
|
|
118
|
+
grep -rn "[nome da função/classe]" --include="*.test.*" --include="*.spec.*" tests/ src/
|
|
119
|
+
|
|
120
|
+
# Rodar testes existentes
|
|
121
|
+
${stack.testFramework === 'pytest' ? 'pytest -v -k "[nome do módulo]"' : stack.testFramework === 'flutter_test' ? 'flutter test test/[modulo]_test.dart' : 'npx jest --testPathPattern="[modulo]"'}
|
|
122
|
+
\`\`\`
|
|
123
|
+
|
|
124
|
+
\`\`\`
|
|
125
|
+
□ Existem testes para a área afetada? [sim/não]
|
|
126
|
+
□ Os testes passam? [sim/não]
|
|
127
|
+
□ Os testes cobrem o cenário do bug? [sim/não — se não, criar no Step 6]
|
|
128
|
+
\`\`\`
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## Step 6: Criar Teste RED
|
|
133
|
+
|
|
134
|
+
> **PRIMEIRO criar um teste que FALHA reproduzindo o bug.**
|
|
135
|
+
> Só depois corrigir o código.
|
|
136
|
+
|
|
137
|
+
\`\`\`
|
|
138
|
+
Teste: [nome descritivo do teste]
|
|
139
|
+
Input: [dados que reproduzem o bug]
|
|
140
|
+
Expected: [resultado correto]
|
|
141
|
+
Actual: [resultado errado — o teste deve FALHAR]
|
|
142
|
+
\`\`\`
|
|
143
|
+
|
|
144
|
+
\`\`\`bash
|
|
145
|
+
# Rodar e confirmar que FALHA (RED)
|
|
146
|
+
${stack.testFramework === 'pytest' ? 'pytest -v -k "[nome do teste]"' : 'npx jest --testNamePattern="[nome do teste]"'}
|
|
147
|
+
# DEVE FALHAR ❌
|
|
148
|
+
\`\`\`
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## Step 7: Correção Mínima
|
|
153
|
+
|
|
154
|
+
\`\`\`
|
|
155
|
+
╔══════════════════════════════════════════════╗
|
|
156
|
+
║ REGRA: Correção MÍNIMA. ║
|
|
157
|
+
║ ║
|
|
158
|
+
║ ✓ Corrigir APENAS a causa raiz ║
|
|
159
|
+
║ ✓ Menor quantidade de linhas possível ║
|
|
160
|
+
║ ✗ NÃO refatorar código adjacente ║
|
|
161
|
+
║ ✗ NÃO "aproveitar" para melhorar outra coisa║
|
|
162
|
+
║ ✗ NÃO adicionar features junto com o fix ║
|
|
163
|
+
╚══════════════════════════════════════════════╝
|
|
164
|
+
\`\`\`
|
|
165
|
+
|
|
166
|
+
Após corrigir:
|
|
167
|
+
\`\`\`bash
|
|
168
|
+
# Rodar o teste do Step 6 — agora deve PASSAR (GREEN)
|
|
169
|
+
${stack.testFramework === 'pytest' ? 'pytest -v -k "[nome do teste]"' : 'npx jest --testNamePattern="[nome do teste]"'}
|
|
170
|
+
# DEVE PASSAR ✅
|
|
171
|
+
\`\`\`
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
## Step 8: Teste de Regressão
|
|
176
|
+
|
|
177
|
+
\`\`\`bash
|
|
178
|
+
# Rodar TODOS os testes (não só o novo)
|
|
179
|
+
${stack.testFramework === 'pytest' ? 'pytest' : stack.testFramework === 'flutter_test' ? 'flutter test' : 'npm run test'}
|
|
180
|
+
|
|
181
|
+
# Build completo
|
|
182
|
+
${stack.packageManager === 'npm' ? 'npm run build' : 'make build'}
|
|
183
|
+
|
|
184
|
+
# Score
|
|
185
|
+
npx @girardelli/architect score .
|
|
186
|
+
\`\`\`
|
|
187
|
+
|
|
188
|
+
\`\`\`
|
|
189
|
+
□ Teste do bug passa (GREEN) ✓
|
|
190
|
+
□ TODOS os outros testes passam ✓
|
|
191
|
+
□ Build compila ✓
|
|
192
|
+
□ Score não regrediu ✓
|
|
193
|
+
\`\`\`
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## Step 9: Verificação de Fluxos Existentes
|
|
198
|
+
|
|
199
|
+
\`\`\`
|
|
200
|
+
□ Verifiquei que features dependentes não foram afetadas
|
|
201
|
+
□ Verifiquei edge cases relacionados
|
|
202
|
+
□ Se o bug era em API → verifiquei clientes da API
|
|
203
|
+
□ Se o bug era em banco → verifiquei migrations e seeds
|
|
204
|
+
\`\`\`
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
## Step 10: Documentação
|
|
209
|
+
|
|
210
|
+
\`\`\`
|
|
211
|
+
□ Atualizar LESSONS-LEARNED.md:
|
|
212
|
+
- O que aconteceu
|
|
213
|
+
- Causa raiz
|
|
214
|
+
- Como foi corrigido
|
|
215
|
+
- Como prevenir no futuro
|
|
216
|
+
|
|
217
|
+
□ Atualizar ERROR-PATTERNS.md (se é um padrão novo):
|
|
218
|
+
- Padrão do erro
|
|
219
|
+
- Sintomas
|
|
220
|
+
- Solução
|
|
221
|
+
|
|
222
|
+
□ Commit com mensagem semântica:
|
|
223
|
+
fix: [descrição clara do que foi corrigido]
|
|
224
|
+
|
|
225
|
+
□ PR criado com:
|
|
226
|
+
- Descrição do bug
|
|
227
|
+
- Causa raiz
|
|
228
|
+
- Solução aplicada
|
|
229
|
+
- Testes adicionados
|
|
230
|
+
\`\`\`
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
**Gerado por Architect v3.1 · Score: ${report.score.overall}/100 · ${new Date().toISOString().split('T')[0]}**
|
|
235
|
+
`;
|
|
236
|
+
}
|
|
237
|
+
//# sourceMappingURL=workflow-fix-bug.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-fix-bug.js","sourceRoot":"","sources":["../../../../src/agent-generator/templates/core/workflow-fix-bug.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CAAC,GAAoB;IACzD,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC;IAEnD,OAAO;;;4DAGmD,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0CA8D7B,KAAK,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiDpH,KAAK,CAAC,aAAa,KAAK,QAAQ,CAAC,CAAC,CAAC,iCAAiC,CAAC,CAAC,CAAC,KAAK,CAAC,aAAa,KAAK,cAAc,CAAC,CAAC,CAAC,sCAAsC,CAAC,CAAC,CAAC,uCAAuC;;;;;;;;;;;;;;;;;;;;;;;;;EAyBhM,KAAK,CAAC,aAAa,KAAK,QAAQ,CAAC,CAAC,CAAC,gCAAgC,CAAC,CAAC,CAAC,8CAA8C;;;;;;;;;;;;;;;;;;;;;;;EAuBpH,KAAK,CAAC,aAAa,KAAK,QAAQ,CAAC,CAAC,CAAC,gCAAgC,CAAC,CAAC,CAAC,8CAA8C;;;;;;;;;;EAUpH,KAAK,CAAC,aAAa,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,aAAa,KAAK,cAAc,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,cAAc;;;EAGtH,KAAK,CAAC,cAAc,KAAK,KAAK,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uCAoD1B,MAAM,CAAC,KAAK,CAAC,OAAO,UAAU,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAC1G,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { TemplateContext } from '../../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Generates enterprise-grade new-feature.md workflow.
|
|
4
|
+
* 10 steps with approval gates, mockup-first, backend-first order,
|
|
5
|
+
* integration doc, coverage gate, user story/task templates.
|
|
6
|
+
*/
|
|
7
|
+
export declare function generateNewFeatureWorkflow(ctx: TemplateContext): string;
|
|
8
|
+
//# sourceMappingURL=workflow-new-feature.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-new-feature.d.ts","sourceRoot":"","sources":["../../../../src/agent-generator/templates/core/workflow-new-feature.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,eAAe,GAAG,MAAM,CA2TvE"}
|