jarvis-ai-framework 1.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/AGENTS.md +416 -0
- package/LICENSE +21 -0
- package/README.md +190 -0
- package/agents/AGENTS.md +234 -0
- package/agents/README.md +309 -0
- package/agents/engineering/data/eng.data-engineer.agent.md +309 -0
- package/agents/engineering/eng.agent.md +303 -0
- package/agents/engineering/eng.bug-hunter.md +386 -0
- package/agents/engineering/eng.cybersecurity.agent.md +503 -0
- package/agents/engineering/eng.dev-code-reviewer.md +148 -0
- package/agents/engineering/eng.docs-writer.md +152 -0
- package/agents/engineering/eng.frontend.agent.md +117 -0
- package/agents/engineering/eng.rpa.agent.md +215 -0
- package/agents/engineering/eng.tech-analyst.agent.md +102 -0
- package/agents/engineering/eng.ux-designer.agent.md +193 -0
- package/agents/engineering/qa/eng.qa.cypress-specialist.md +109 -0
- package/agents/engineering/qa/eng.qa.quality-champion-task-agent.md +85 -0
- package/agents/engineering/qa/eng.qa.quality-strategist.md +111 -0
- package/agents/engineering/qa/eng.qa.test-architect.md +400 -0
- package/agents/engineering/qa/eng.qa.test-planner.md +477 -0
- package/agents/engineering/qa/eng.qa.testing-engineer.md +339 -0
- package/agents/product/prod.pm-checker.md +52 -0
- package/bin/commands/docs-publish.js +184 -0
- package/bin/commands/docs-sync.js +139 -0
- package/bin/commands/info.js +87 -0
- package/bin/commands/init.js +237 -0
- package/bin/commands/install-rtk.js +90 -0
- package/bin/commands/list.js +48 -0
- package/bin/commands/qa-signoff.js +112 -0
- package/bin/commands/whoami.js +43 -0
- package/bin/jarvis.js +159 -0
- package/bin/lib/auth/session.js +56 -0
- package/bin/lib/config/constants.js +123 -0
- package/bin/lib/config/ide-config.js +233 -0
- package/bin/lib/core/scanner.js +124 -0
- package/bin/lib/core/sync-engine.js +551 -0
- package/bin/lib/docs/fetch-file.sh +41 -0
- package/bin/lib/docs/publish-file.sh +284 -0
- package/bin/lib/docs/validate-frontmatter.js +157 -0
- package/bin/lib/env-loader.js +198 -0
- package/bin/lib/tasks/comment.js +131 -0
- package/bin/lib/utils/git-parser.js +145 -0
- package/bin/lib/utils/logger.js +104 -0
- package/bin/lib/utils/npmrc-parser.js +106 -0
- package/bin/lib/utils/paths.js +55 -0
- package/bin/lib/utils/ui.js +59 -0
- package/bin/lib/vcs/api.js +312 -0
- package/bin/lib/vcs/create-issue.js +43 -0
- package/bin/lib/vcs/create-merge.js +43 -0
- package/bin/lib/vcs/fetch-raw.js +30 -0
- package/bin/postinstall.js +41 -0
- package/members.md +25 -0
- package/package.json +55 -0
- package/rules/AGENTS.md +205 -0
- package/rules/engineering/data/data-rules.md +200 -0
- package/rules/engineering/eng-rules.md +243 -0
- package/rules/engineering/eng-security-rules.md +186 -0
- package/rules/engineering/eng.breakdown-subtasks-rules.md +585 -0
- package/rules/engineering/eng.bump-rules.md +27 -0
- package/rules/engineering/eng.docs-scraping-rules.md +64 -0
- package/rules/engineering/eng.downstream-flow-rules.md +297 -0
- package/rules/engineering/eng.integrations-rules.md +73 -0
- package/rules/engineering/eng.plan-rules.md +333 -0
- package/rules/engineering/eng.pr-rules.md +359 -0
- package/rules/engineering/eng.pre-pr-rules.md +103 -0
- package/rules/engineering/eng.start-rules.md +246 -0
- package/rules/engineering/eng.tech-spec-rules.md +968 -0
- package/rules/engineering/eng.work-rules.md +312 -0
- package/rules/engineering/frontend/eng.frontend-rules.md +147 -0
- package/rules/engineering/qa/eng.qa.cypress-standards-rules.md +259 -0
- package/rules/engineering/qa/eng.qa.exploratory-session-rules.md +137 -0
- package/rules/engineering/qa/eng.qa.quality-gate-scoring-rules.md +181 -0
- package/rules/engineering/qa/eng.qa.tech-spec-validation-criteria-rules.md +120 -0
- package/rules/engineering/rpa/eng.rpa-rules.md +230 -0
- package/rules/product/README.md +24 -0
- package/rules/product/prod-rules.md +151 -0
- package/rules/rtk-rules.md +68 -0
- package/skills/AGENTS.md +290 -0
- package/skills/SKILLS-ROADMAP.md +333 -0
- package/skills/churn-audit/SKILL.md +385 -0
- package/skills/context-detect/SKILL.md +399 -0
- package/skills/context-detect/assets/context-profile-template.md +127 -0
- package/skills/docs-central/README.md +310 -0
- package/skills/docs-central/SKILL.md +423 -0
- package/skills/docs-index/SKILL.md +377 -0
- package/skills/eng-ai-engineer/SKILL.md +296 -0
- package/skills/eng-arch-c4/SKILL.md +358 -0
- package/skills/eng-arch-c4/assets/example-code.md +189 -0
- package/skills/eng-arch-c4/assets/example-component.md +105 -0
- package/skills/eng-arch-c4/assets/example-container.md +104 -0
- package/skills/eng-arch-c4/assets/example-context.md +81 -0
- package/skills/eng-backend/SKILL.md +776 -0
- package/skills/eng-browser-extension-builder/SKILL.md +385 -0
- package/skills/eng-cybersecurity/SKILL.md +645 -0
- package/skills/eng-data-bi/SKILL.md +199 -0
- package/skills/eng-data-debug/SKILL.md +307 -0
- package/skills/eng-data-engineer/SKILL.md +256 -0
- package/skills/eng-data-onboard/SKILL.md +310 -0
- package/skills/eng-data-orchestrator/SKILL.md +426 -0
- package/skills/eng-design-system/SKILL.md +619 -0
- package/skills/eng-docs-write/SKILL.md +312 -0
- package/skills/eng-frontend/SKILL.md +913 -0
- package/skills/eng-jira-comment/SKILL.md +17 -0
- package/skills/eng-microfrontend/SKILL.md +602 -0
- package/skills/eng-ms-trace/SKILL.md +469 -0
- package/skills/eng-nestjs/SKILL.md +791 -0
- package/skills/eng-performance-engineer/SKILL.md +312 -0
- package/skills/eng-pr/SKILL.md +339 -0
- package/skills/eng-qa-a11y-audit/SKILL.md +269 -0
- package/skills/eng-qa-bug-report/SKILL.md +1088 -0
- package/skills/eng-qa-bug-report/TASK_MANAGERS.md +138 -0
- package/skills/eng-qa-cypress-e2e/SKILL.md +177 -0
- package/skills/eng-qa-dev-guide/SKILL.md +164 -0
- package/skills/eng-qa-e2e/SKILL.md +400 -0
- package/skills/eng-qa-e2e-spec-writer/SKILL.md +322 -0
- package/skills/eng-qa-exploratory/SKILL.md +188 -0
- package/skills/eng-qa-gate/SKILL.md +370 -0
- package/skills/eng-qa-gate/assets/checklist-validacao.md +291 -0
- package/skills/eng-qa-graphql-contract/SKILL.md +256 -0
- package/skills/eng-qa-quality-report/SKILL.md +412 -0
- package/skills/eng-qa-test-plan/SKILL.md +466 -0
- package/skills/eng-qa-test-plan/assets/test-coverage-template.md +92 -0
- package/skills/eng-qa-test-plan/assets/test-patterns.md +178 -0
- package/skills/eng-qa-testsprite/SKILL.md +325 -0
- package/skills/eng-qa-testsprite/references/testsprite-mcp.md +224 -0
- package/skills/eng-qa-unit-test/SKILL.md +471 -0
- package/skills/eng-rabbitmq/SKILL.md +661 -0
- package/skills/eng-scraper/SKILL.md +683 -0
- package/skills/eng-scraper-robot-builder/SKILL.md +370 -0
- package/skills/eng-security-patch/SKILL.md +378 -0
- package/skills/eng-security-triage/SKILL.md +266 -0
- package/skills/eng-task-comment/SKILL.md +60 -0
- package/skills/eng-tech-analyst/SKILL.md +529 -0
- package/skills/eng-threat-model/SKILL.md +161 -0
- package/skills/init-jarvis/SKILL.md +1304 -0
- package/skills/init-jarvis/assets/mcp-configs.md +389 -0
- package/skills/init-jarvis/assets/onboarding-checklist.md +104 -0
- package/skills/init-jarvis/assets/setup-guide.md +360 -0
- package/skills/lovable-prompt-generator/SKILL.md +304 -0
- package/skills/prod-roadmap-report/README.md +303 -0
- package/skills/prod-roadmap-report/SKILL.md +198 -0
- package/skills/prod-roadmap-report/commands/status.compiled.single.team.md +23 -0
- package/skills/prod-roadmap-report/commands/status.list.projects.md +17 -0
- package/skills/prod-roadmap-report/commands/status.memory.md +192 -0
- package/skills/prod-roadmap-report/commands/status.roadmap.preview.md +94 -0
- package/skills/prod-roadmap-report/references/detailed-guide.md +236 -0
- package/skills/prod-roadmap-report/rules/detailed-guide.md +237 -0
- package/skills/prod-roadmap-report/rules/status-report-rules.md +44 -0
- package/skills/prod-roadmap-report/templates/template-multiple-teams-compiled-status.md +53 -0
- package/skills/prod-roadmap-report/templates/template-projects-list.md +23 -0
- package/skills/prod-roadmap-report/templates/template-single-team-compiled-status.md +60 -0
- package/skills/prod-roadmap-report/templates/template-single-team-status.md +49 -0
- package/skills/prod-specs/SKILL.md +108 -0
- package/skills/prod-specs/references/prod.spec.clarify.md +176 -0
- package/skills/prod-specs/references/prod.spec.epic.md +107 -0
- package/skills/prod-specs/references/prod.spec.frd.md +135 -0
- package/skills/prod-specs/references/prod.spec.issue.md +145 -0
- package/skills/prod-specs/references/prod.spec.prd.md +118 -0
- package/skills/prod-specs/rules/prod-spec-rules.md +186 -0
- package/skills/prod-specs/templates/prod-breakdown-template.md +136 -0
- package/skills/prod-specs/templates/prod-epic-template.md +76 -0
- package/skills/prod-specs/templates/prod-frd-template.md +172 -0
- package/skills/prod-specs/templates/prod-issue-template.md +68 -0
- package/skills/prod-specs/templates/prod-prd-full-template.md +159 -0
- package/skills/prod-specs/templates/prod-prd-template.md +173 -0
- package/skills/prod-specs-update/SKILL.md +272 -0
- package/skills/report-issue/SKILL.md +156 -0
- package/taxonomy.md +270 -0
- package/templates/AGENTS.md +189 -0
- package/templates/CDD aplicado a Prompts.md +182 -0
- package/templates/ENV-template.md +187 -0
- package/templates/engineering/AGENTS-template.md +71 -0
- package/templates/engineering/ARD-template.md +193 -0
- package/templates/engineering/CONTACTS-template.md +135 -0
- package/templates/engineering/PR-template.md +40 -0
- package/templates/engineering/RFC-Playbook.md +325 -0
- package/templates/engineering/RFC-template.md +199 -0
- package/templates/engineering/architecture-template.md +277 -0
- package/templates/engineering/breakdown-subtasks-template.md +582 -0
- package/templates/engineering/c4-model-template.md +516 -0
- package/templates/engineering/data-contract-template.md +135 -0
- package/templates/engineering/data-pipeline-template.md +163 -0
- package/templates/engineering/plan-template.md +255 -0
- package/templates/engineering/qa/eng.qa.quality-gate-examples-template.md +311 -0
- package/templates/engineering/qa/eng.qa.quality-gate-report-template.md +249 -0
- package/templates/engineering/qa/qa.cypress-test-template.md +172 -0
- package/templates/engineering/qa/qa.exploratory-session-template.md +148 -0
- package/templates/engineering/qa/qa.quality-report-template.md +130 -0
- package/templates/engineering/qa/qa.release-signoff-template.md +54 -0
- package/templates/engineering/qa/qa.sprint-plan-template.md +49 -0
- package/templates/engineering/swagger-template.md +145 -0
- package/templates/engineering/tech-spec-template.md +497 -0
- package/templates/engineering/work-progress-template.md +155 -0
- package/workflows/AGENTS.md +240 -0
- package/workflows/README.md +160 -0
- package/workflows/all-tools.md +11 -0
- package/workflows/engineering/data/data.contract.md +202 -0
- package/workflows/engineering/data/data.new-pipeline.md +234 -0
- package/workflows/engineering/eng.breakdown-subtasks.md +420 -0
- package/workflows/engineering/eng.bug-audit.md +591 -0
- package/workflows/engineering/eng.build-tech-spec.md +1116 -0
- package/workflows/engineering/eng.create-ard-from-code.md +259 -0
- package/workflows/engineering/eng.create-ard.md +382 -0
- package/workflows/engineering/eng.create-rfc.md +245 -0
- package/workflows/engineering/eng.debug.md +479 -0
- package/workflows/engineering/eng.docs.md +40 -0
- package/workflows/engineering/eng.light-arch.md +84 -0
- package/workflows/engineering/eng.plan.md +213 -0
- package/workflows/engineering/eng.pr.md +466 -0
- package/workflows/engineering/eng.pre-pr.md +167 -0
- package/workflows/engineering/eng.review.md +185 -0
- package/workflows/engineering/eng.rpa.robot.md +342 -0
- package/workflows/engineering/eng.security-audit.md +312 -0
- package/workflows/engineering/eng.security-incident.md +275 -0
- package/workflows/engineering/eng.security-pipeline.md +210 -0
- package/workflows/engineering/eng.security-review.md +235 -0
- package/workflows/engineering/eng.start.md +494 -0
- package/workflows/engineering/eng.work.md +558 -0
- package/workflows/engineering/frontend/eng.frontend-component.md +190 -0
- package/workflows/engineering/frontend/eng.frontend-perf-audit.md +375 -0
- package/workflows/engineering/frontend/eng.frontend-review.md +185 -0
- package/workflows/engineering/qa/eng.qa-dev-quality-guide.md +51 -0
- package/workflows/engineering/qa/eng.qa-e2e-test-generation.md +51 -0
- package/workflows/engineering/qa/eng.qa-exploratory-session.md +60 -0
- package/workflows/engineering/qa/eng.qa-quality-gate-validation.md +202 -0
- package/workflows/engineering/qa/eng.qa-quality-report.md +83 -0
- package/workflows/engineering/qa/eng.qa-refinement-entry.md +83 -0
- package/workflows/engineering/qa/eng.qa-release-signoff.md +170 -0
- package/workflows/engineering/qa/eng.qa-sprint-planning.md +100 -0
- package/workflows/engineering/ta/eng.ta.atendimento.md +93 -0
- package/workflows/product/prod.roadmap.preview.md +110 -0
- package/workflows/product/prod.spec.breakdown.md +163 -0
- package/workflows/product/prod.spec.clarify.md +178 -0
- package/workflows/product/prod.spec.epic.md +154 -0
- package/workflows/product/prod.spec.frd.md +96 -0
- package/workflows/product/prod.spec.issue.md +145 -0
- package/workflows/product/prod.spec.md +60 -0
- package/workflows/product/prod.spec.prd.md +100 -0
- package/workflows/taxonomy.md +92 -0
- package/workflows/warm-up.md +574 -0
|
@@ -0,0 +1,591 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Workflow de Engenharia para Audit de Bugs e Gaps de Qualidade
|
|
3
|
+
globs:
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
recommended_model: claude-sonnet-4-20250514
|
|
6
|
+
model_tier: very_high
|
|
7
|
+
model_justification: Audit requer análise profunda de código, identificação de patterns, priorização de riscos e geração de relatórios estruturados
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Workflow de Engenharia – Bug Audit & Quality Assessment
|
|
11
|
+
|
|
12
|
+
## Objetivo
|
|
13
|
+
|
|
14
|
+
Guiar o Bug Hunter (ENG) na análise sistemática de projetos existentes para identificar bugs latentes, code smells, gaps de qualidade e débito técnico, gerando relatório estruturado e cards no task manager ($TASK_MANAGER) para rastreamento.
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Quando Usar Este Workflow
|
|
19
|
+
|
|
20
|
+
- Onboarding em projeto legado
|
|
21
|
+
- Revisão de qualidade pós-incidente
|
|
22
|
+
- Assessment periódico de saúde do código
|
|
23
|
+
- Preparação para refactoring de larga escala
|
|
24
|
+
- Análise de risco antes de mudanças críticas
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Pré-requisitos
|
|
29
|
+
|
|
30
|
+
### Validar ENV.md
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
# Verificar existência e completude
|
|
34
|
+
if [ ! -f "$IDE/ENV.md" ]; then
|
|
35
|
+
echo "⚠️ ENV.md não encontrado. Execute /init-jarvis primeiro."
|
|
36
|
+
exit 1
|
|
37
|
+
fi
|
|
38
|
+
|
|
39
|
+
# Validar variáveis obrigatórias
|
|
40
|
+
required_vars=("WORKSPACE" "IDE" "SQUAD" "HUB" "AREA" "POSITION")
|
|
41
|
+
for var in "${required_vars[@]}"; do
|
|
42
|
+
if ! grep -q "^$var=.\+" "$IDE/ENV.md"; then
|
|
43
|
+
echo "⚠️ Variável $var não definida no ENV.md"
|
|
44
|
+
fi
|
|
45
|
+
done
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Definir Escopo (Argumento)
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
/eng.bug-audit [escopo]
|
|
52
|
+
|
|
53
|
+
Onde [escopo] pode ser:
|
|
54
|
+
- Caminho de pasta/arquivo: ./src/components/
|
|
55
|
+
- Módulo específico: auth-service
|
|
56
|
+
- Projeto completo: --all
|
|
57
|
+
- Por tecnologia: --tech=react
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## Fase 0 – Análise de Contexto (CDD)
|
|
63
|
+
|
|
64
|
+
> 📚 **Skill**: Use `/context-detect` se existir uma sessão ativa
|
|
65
|
+
> ⚙️ **Configurável**: Controlada pela variável `ENABLE_CDD` no ENV.md
|
|
66
|
+
|
|
67
|
+
### Verificação de Ativação
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
grep "^ENABLE_CDD=" $IDE/ENV.md
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
- Se `ENABLE_CDD=false` ou não definida → Pular esta fase
|
|
74
|
+
- Se `ENABLE_CDD=true` → Herdar contexto
|
|
75
|
+
|
|
76
|
+
### Calibração por Urgência
|
|
77
|
+
|
|
78
|
+
| urgencia | Comportamento no Audit |
|
|
79
|
+
|----------|------------------------|
|
|
80
|
+
| `alta` | Foco em bugs críticos e blockers, análise rápida |
|
|
81
|
+
| `normal` | Análise balanceada: bugs + code smells + débito técnico |
|
|
82
|
+
| `baixa` | Análise profunda: inclui refactoring opportunities e melhorias arquiteturais |
|
|
83
|
+
|
|
84
|
+
### Calibração por POSITION
|
|
85
|
+
|
|
86
|
+
| POSITION | Foco do Relatório |
|
|
87
|
+
|----------|-------------------|
|
|
88
|
+
| `junior`, `pleno` | Explicações detalhadas, referências para aprendizado |
|
|
89
|
+
| `senior`, `specialist` | Direto ao ponto, foco em trade-offs e riscos |
|
|
90
|
+
| `tech-lead`, `staff` | Incluir impacto organizacional, custo vs. benefício |
|
|
91
|
+
| `pm`, `tpm`, `gpm`, `cto` | Impacto no negócio, ROI de correções |
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Fase 1 – Scoping (Definição de Escopo)
|
|
96
|
+
|
|
97
|
+
### 1.1 Entender o Contexto do Projeto
|
|
98
|
+
|
|
99
|
+
Perguntar ao usuário (se não estiver claro):
|
|
100
|
+
|
|
101
|
+
- Qual é o **propósito** do projeto/módulo?
|
|
102
|
+
- Quais são as **áreas críticas** (autenticação, pagamentos, dados sensíveis)?
|
|
103
|
+
- Existe alguma **área conhecida** com problemas recorrentes?
|
|
104
|
+
- Qual é a **prioridade**: bugs funcionais, performance, segurança, UX?
|
|
105
|
+
|
|
106
|
+
### 1.2 Identificar Stack e Tecnologias
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
# Detectar tecnologias principais
|
|
110
|
+
ls package.json 2>/dev/null && echo "Node.js project detected"
|
|
111
|
+
ls requirements.txt 2>/dev/null && echo "Python project detected"
|
|
112
|
+
ls Gemfile 2>/dev/null && echo "Ruby project detected"
|
|
113
|
+
|
|
114
|
+
# Detectar frameworks
|
|
115
|
+
grep -E "(react|vue|angular|svelte)" package.json 2>/dev/null
|
|
116
|
+
grep -E "(django|flask|fastapi)" requirements.txt 2>/dev/null
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### 1.3 Avaliar Cobertura de Testes
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
# Verificar se há testes
|
|
123
|
+
find . -name "*.test.*" -o -name "*.spec.*" | head -5
|
|
124
|
+
|
|
125
|
+
# Verificar cobertura (se configurada)
|
|
126
|
+
[ -f coverage/coverage-summary.json ] && cat coverage/coverage-summary.json
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### 1.4 Definir Escopo Final
|
|
130
|
+
|
|
131
|
+
Criar arquivo de sessão com escopo:
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
mkdir -p $SESSIONS_DIR/eng/bug-audit-$(date +%Y%m%d-%H%M%S)/
|
|
135
|
+
|
|
136
|
+
cat > $SESSIONS_DIR/eng/bug-audit-$(date +%Y%m%d-%H%M%S)/scope.md << 'EOF'
|
|
137
|
+
# Escopo do Audit
|
|
138
|
+
|
|
139
|
+
**Data**: $(date +%Y-%m-%d)
|
|
140
|
+
**Workspace**: ${WORKSPACE}
|
|
141
|
+
**Escopo definido**: {caminho ou --all}
|
|
142
|
+
|
|
143
|
+
## Áreas a Analisar
|
|
144
|
+
- [ ] {área 1}
|
|
145
|
+
- [ ] {área 2}
|
|
146
|
+
- [ ] {área 3}
|
|
147
|
+
|
|
148
|
+
## Prioridades
|
|
149
|
+
1. {prioridade 1}
|
|
150
|
+
2. {prioridade 2}
|
|
151
|
+
3. {prioridade 3}
|
|
152
|
+
|
|
153
|
+
## Critérios de Severidade
|
|
154
|
+
- **CRÍTICO**: Impacto em produção, segurança, perda de dados
|
|
155
|
+
- **ALTO**: Bug funcional, impacto em UX crítica
|
|
156
|
+
- **MÉDIO**: Code smell, débito técnico impactante
|
|
157
|
+
- **BAIXO**: Melhoria de código, otimização
|
|
158
|
+
EOF
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
## Fase 2 – Scanning (Análise e Detecção)
|
|
164
|
+
|
|
165
|
+
### 2.1 Análise Automatizada
|
|
166
|
+
|
|
167
|
+
Execute verificações automatizadas disponíveis:
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
# Linter (se configurado)
|
|
171
|
+
npm run lint 2>/dev/null || echo "Linter não configurado"
|
|
172
|
+
|
|
173
|
+
# Type checking (TypeScript)
|
|
174
|
+
npx tsc --noEmit 2>/dev/null || echo "TypeScript não configurado"
|
|
175
|
+
|
|
176
|
+
# Security scan (se disponível)
|
|
177
|
+
npm audit 2>/dev/null || echo "npm audit não disponível"
|
|
178
|
+
|
|
179
|
+
# Testes (para identificar quebrados)
|
|
180
|
+
npm test -- --passWithNoTests 2>/dev/null || echo "Testes não configurados"
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### 2.2 Análise Manual Guiada
|
|
184
|
+
|
|
185
|
+
#### A. **Bugs Funcionais**
|
|
186
|
+
|
|
187
|
+
Procurar por padrões problemáticos:
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
# Tratamento de erro inadequado
|
|
191
|
+
grep -r "catch.*{}" --include="*.js" --include="*.ts"
|
|
192
|
+
grep -r "catch (e) {}" --include="*.js" --include="*.ts"
|
|
193
|
+
|
|
194
|
+
# Console.log em produção
|
|
195
|
+
grep -r "console.log" --include="*.js" --include="*.ts" | grep -v "test"
|
|
196
|
+
|
|
197
|
+
# Variáveis não inicializadas
|
|
198
|
+
grep -r "let.*;" --include="*.js" --include="*.ts"
|
|
199
|
+
|
|
200
|
+
# Comparação com == ao invés de ===
|
|
201
|
+
grep -r " == " --include="*.js" --include="*.ts" | grep -v "test"
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
#### B. **Code Smells**
|
|
205
|
+
|
|
206
|
+
Identificar anti-patterns:
|
|
207
|
+
|
|
208
|
+
- **Funções gigantes** (> 50 linhas)
|
|
209
|
+
- **Arquivos gigantes** (> 300 linhas)
|
|
210
|
+
- **Duplicação de código**
|
|
211
|
+
- **Acoplamento excessivo**
|
|
212
|
+
- **Complexidade ciclomática alta**
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
# Funções muito longas (heurística)
|
|
216
|
+
find . -name "*.js" -o -name "*.ts" | xargs wc -l | sort -nr | head -20
|
|
217
|
+
|
|
218
|
+
# Duplicação (similaridade)
|
|
219
|
+
# (usar ferramentas externas se disponíveis: jscpd, simian)
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
#### C. **Gaps de Segurança**
|
|
223
|
+
|
|
224
|
+
Procurar por vulnerabilidades comuns:
|
|
225
|
+
|
|
226
|
+
```bash
|
|
227
|
+
# Injeção SQL
|
|
228
|
+
grep -r "execute.*+.*" --include="*.js" --include="*.ts"
|
|
229
|
+
grep -r "query.*\${" --include="*.js" --include="*.ts"
|
|
230
|
+
|
|
231
|
+
# XSS
|
|
232
|
+
grep -r "innerHTML.*=" --include="*.js" --include="*.ts"
|
|
233
|
+
grep -r "dangerouslySetInnerHTML" --include="*.jsx" --include="*.tsx"
|
|
234
|
+
|
|
235
|
+
# Segredos expostos
|
|
236
|
+
grep -r "API_KEY\|SECRET\|PASSWORD" --include="*.js" --include="*.ts" | grep -v "test"
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
#### D. **Problemas de Performance**
|
|
240
|
+
|
|
241
|
+
- Loops aninhados
|
|
242
|
+
- Queries N+1
|
|
243
|
+
- Lack of pagination
|
|
244
|
+
- Memory leaks (event listeners não removidos)
|
|
245
|
+
|
|
246
|
+
```bash
|
|
247
|
+
# Loops aninhados
|
|
248
|
+
grep -A 5 "for.*{" | grep "for.*{"
|
|
249
|
+
|
|
250
|
+
# Event listeners sem cleanup
|
|
251
|
+
grep -r "addEventListener" --include="*.js" --include="*.ts" | grep -v "removeEventListener"
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
#### E. **Débito Técnico**
|
|
255
|
+
|
|
256
|
+
- TODOs e FIXMEs não tratados
|
|
257
|
+
- Código comentado
|
|
258
|
+
- Dependencies desatualizadas
|
|
259
|
+
|
|
260
|
+
```bash
|
|
261
|
+
# TODOs e FIXMEs
|
|
262
|
+
grep -rn "TODO\|FIXME\|HACK\|XXX" --include="*.js" --include="*.ts"
|
|
263
|
+
|
|
264
|
+
# Código comentado
|
|
265
|
+
grep -rn "^.*//.*function\|^.*//.*const\|^.*//.*let" --include="*.js" --include="*.ts"
|
|
266
|
+
|
|
267
|
+
# Dependencies vulneráveis
|
|
268
|
+
npm outdated 2>/dev/null
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
### 2.3 Análise de Arquitetura
|
|
272
|
+
|
|
273
|
+
Avaliar estrutura e organização:
|
|
274
|
+
|
|
275
|
+
- Separação de concerns
|
|
276
|
+
- Estrutura de pastas
|
|
277
|
+
- Modularidade
|
|
278
|
+
- Consistência de padrões
|
|
279
|
+
|
|
280
|
+
---
|
|
281
|
+
|
|
282
|
+
## Fase 3 – Classification (Classificação e Priorização)
|
|
283
|
+
|
|
284
|
+
### 3.1 Categorizar Problemas
|
|
285
|
+
|
|
286
|
+
Para cada problema identificado:
|
|
287
|
+
|
|
288
|
+
| Categoria | Descrição |
|
|
289
|
+
|-----------|-----------|
|
|
290
|
+
| **BUG-CRÍTICO** | Afeta produção, segurança, perda de dados |
|
|
291
|
+
| **BUG-ALTO** | Quebra funcionalidade importante, impacto UX |
|
|
292
|
+
| **BUG-MÉDIO** | Comportamento inesperado não crítico |
|
|
293
|
+
| **BUG-BAIXO** | Edge case, problema visual menor |
|
|
294
|
+
| **CODE-SMELL** | Anti-pattern, código difícil de manter |
|
|
295
|
+
| **DÉBITO-TÉCNICO** | Código desatualizado, falta de testes |
|
|
296
|
+
| **SEGURANÇA** | Vulnerabilidade potencial |
|
|
297
|
+
| **PERFORMANCE** | Lentidão, uso excessivo de recursos |
|
|
298
|
+
|
|
299
|
+
### 3.2 Calcular Severidade
|
|
300
|
+
|
|
301
|
+
```
|
|
302
|
+
Severidade = (Impacto × Probabilidade × Esforço de Correção)
|
|
303
|
+
|
|
304
|
+
Impacto: 1-5 (1=mínimo, 5=crítico)
|
|
305
|
+
Probabilidade: 1-5 (1=raro, 5=frequente)
|
|
306
|
+
Esforço: 1-5 (1=trivial, 5=complexo)
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
### 3.3 Priorizar para Criação de Cards
|
|
310
|
+
|
|
311
|
+
| Prioridade | Critério |
|
|
312
|
+
|------------|----------|
|
|
313
|
+
| **P0** | Severidade >= 60, categoria BUG-CRÍTICO ou SEGURANÇA |
|
|
314
|
+
| **P1** | Severidade >= 40, categoria BUG-ALTO |
|
|
315
|
+
| **P2** | Severidade >= 20, categoria BUG-MÉDIO ou CODE-SMELL |
|
|
316
|
+
| **P3** | Severidade < 20, categoria BUG-BAIXO ou DÉBITO-TÉCNICO |
|
|
317
|
+
|
|
318
|
+
---
|
|
319
|
+
|
|
320
|
+
## Fase 4 – Reporting (Geração de Relatório)
|
|
321
|
+
|
|
322
|
+
### 4.1 Estrutura do Relatório
|
|
323
|
+
|
|
324
|
+
Gerar arquivo `bug-audit-report.md` na sessão:
|
|
325
|
+
|
|
326
|
+
```markdown
|
|
327
|
+
# Bug Audit Report
|
|
328
|
+
|
|
329
|
+
**Workspace**: ${WORKSPACE}
|
|
330
|
+
**Data**: $(date +%Y-%m-%d)
|
|
331
|
+
**Escopo**: {escopo analisado}
|
|
332
|
+
**Executado por**: Bug Hunter (eng.bug-hunter)
|
|
333
|
+
|
|
334
|
+
---
|
|
335
|
+
|
|
336
|
+
## Resumo Executivo
|
|
337
|
+
|
|
338
|
+
- **Total de problemas encontrados**: {N}
|
|
339
|
+
- Bugs Críticos: {N}
|
|
340
|
+
- Bugs Altos: {N}
|
|
341
|
+
- Bugs Médios: {N}
|
|
342
|
+
- Bugs Baixos: {N}
|
|
343
|
+
- Code Smells: {N}
|
|
344
|
+
- Débito Técnico: {N}
|
|
345
|
+
- Segurança: {N}
|
|
346
|
+
- Performance: {N}
|
|
347
|
+
|
|
348
|
+
- **Cobertura de Testes**: {X}%
|
|
349
|
+
- **Dependencies Desatualizadas**: {N}
|
|
350
|
+
- **TODOs/FIXMEs**: {N}
|
|
351
|
+
|
|
352
|
+
---
|
|
353
|
+
|
|
354
|
+
## Problemas por Prioridade
|
|
355
|
+
|
|
356
|
+
### P0 - Críticos (Ação Imediata)
|
|
357
|
+
|
|
358
|
+
#### 1. {Título do problema}
|
|
359
|
+
- **Categoria**: {BUG-CRÍTICO | SEGURANÇA}
|
|
360
|
+
- **Localização**: {arquivo:linha}
|
|
361
|
+
- **Descrição**: {descrição detalhada}
|
|
362
|
+
- **Impacto**: {impacto no negócio/usuário}
|
|
363
|
+
- **Sugestão de Correção**: {como corrigir}
|
|
364
|
+
- **Estimativa**: {esforço estimado}
|
|
365
|
+
- **Card $TASK_MANAGER**: {ID} (a ser criado)
|
|
366
|
+
|
|
367
|
+
### P1 - Altos (Próxima Sprint)
|
|
368
|
+
|
|
369
|
+
{repetir estrutura}
|
|
370
|
+
|
|
371
|
+
### P2 - Médios (Backlog)
|
|
372
|
+
|
|
373
|
+
{repetir estrutura}
|
|
374
|
+
|
|
375
|
+
### P3 - Baixos (Débito Técnico)
|
|
376
|
+
|
|
377
|
+
{repetir estrutura}
|
|
378
|
+
|
|
379
|
+
---
|
|
380
|
+
|
|
381
|
+
## Análise de Áreas de Risco
|
|
382
|
+
|
|
383
|
+
### Áreas Críticas Sem Testes
|
|
384
|
+
- {área 1}: {motivo}
|
|
385
|
+
- {área 2}: {motivo}
|
|
386
|
+
|
|
387
|
+
### Código Complexo (Alta Complexidade Ciclomática)
|
|
388
|
+
- {arquivo}: {métrica}
|
|
389
|
+
|
|
390
|
+
### Dependencies Vulneráveis
|
|
391
|
+
| Dependência | Versão Atual | Versão Segura | Severidade |
|
|
392
|
+
|-------------|--------------|---------------|------------|
|
|
393
|
+
| {dep1} | {v1} | {v2} | HIGH |
|
|
394
|
+
|
|
395
|
+
---
|
|
396
|
+
|
|
397
|
+
## Recomendações Estratégicas
|
|
398
|
+
|
|
399
|
+
### Curto Prazo (1-2 sprints)
|
|
400
|
+
1. {recomendação 1}
|
|
401
|
+
2. {recomendação 2}
|
|
402
|
+
|
|
403
|
+
### Médio Prazo (3-6 meses)
|
|
404
|
+
1. {recomendação 1}
|
|
405
|
+
2. {recomendação 2}
|
|
406
|
+
|
|
407
|
+
### Longo Prazo (6-12 meses)
|
|
408
|
+
1. {recomendação 1}
|
|
409
|
+
2. {recomendação 2}
|
|
410
|
+
|
|
411
|
+
---
|
|
412
|
+
|
|
413
|
+
## Melhorias Preventivas
|
|
414
|
+
|
|
415
|
+
### Testes
|
|
416
|
+
- Aumentar cobertura para {X}%
|
|
417
|
+
- Adicionar testes de integração em {áreas}
|
|
418
|
+
|
|
419
|
+
### Observabilidade
|
|
420
|
+
- Adicionar logs estruturados em {áreas}
|
|
421
|
+
- Configurar alertas para {cenários}
|
|
422
|
+
|
|
423
|
+
### Processo
|
|
424
|
+
- Adicionar linter rules para prevenir {padrão}
|
|
425
|
+
- Configurar pre-commit hooks para {validações}
|
|
426
|
+
|
|
427
|
+
---
|
|
428
|
+
|
|
429
|
+
## Anexos
|
|
430
|
+
|
|
431
|
+
### A. Lista Completa de TODOs/FIXMEs
|
|
432
|
+
{lista}
|
|
433
|
+
|
|
434
|
+
### B. Dependencies Desatualizadas
|
|
435
|
+
{lista}
|
|
436
|
+
|
|
437
|
+
### C. Métricas de Código
|
|
438
|
+
- Linhas de código: {N}
|
|
439
|
+
- Arquivos analisados: {N}
|
|
440
|
+
- Complexidade média: {N}
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
### 4.2 Salvar Relatório
|
|
444
|
+
|
|
445
|
+
```bash
|
|
446
|
+
# Salvar relatório na sessão
|
|
447
|
+
cat > $SESSIONS_DIR/eng/bug-audit-$(date +%Y%m%d-%H%M%S)/bug-audit-report.md << 'EOF'
|
|
448
|
+
{conteúdo do relatório}
|
|
449
|
+
EOF
|
|
450
|
+
|
|
451
|
+
# Notificar usuário
|
|
452
|
+
echo "✅ Relatório gerado em: $SESSIONS_DIR/eng/bug-audit-$(date +%Y%m%d-%H%M%S)/bug-audit-report.md"
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
---
|
|
456
|
+
|
|
457
|
+
## Fase 5 – Ticketing (Criação de Cards no Task Manager)
|
|
458
|
+
|
|
459
|
+
### 5.1 Usar Skill bug-report
|
|
460
|
+
|
|
461
|
+
Para cada problema P0 e P1:
|
|
462
|
+
|
|
463
|
+
```bash
|
|
464
|
+
/bug-report create \
|
|
465
|
+
--title="{título do bug}" \
|
|
466
|
+
--category="{categoria}" \
|
|
467
|
+
--severity="{P0|P1|P2|P3}" \
|
|
468
|
+
--location="{arquivo:linha}" \
|
|
469
|
+
--description="{descrição}" \
|
|
470
|
+
--suggestion="{sugestão de correção}"
|
|
471
|
+
```
|
|
472
|
+
|
|
473
|
+
### 5.2 Estrutura dos Cards Criados
|
|
474
|
+
|
|
475
|
+
Cada card deve conter:
|
|
476
|
+
|
|
477
|
+
- **Título**: Claro e descritivo
|
|
478
|
+
- **Tipo**: Bug / Task (débito técnico) / Security
|
|
479
|
+
- **Prioridade**: Baseada na classificação P0-P3
|
|
480
|
+
- **Labels**: `bug-audit`, `{categoria}`, `{severidade}`
|
|
481
|
+
- **Descrição**:
|
|
482
|
+
- Comportamento atual
|
|
483
|
+
- Comportamento esperado
|
|
484
|
+
- Localização no código
|
|
485
|
+
- Impacto
|
|
486
|
+
- Sugestão de correção
|
|
487
|
+
- **Anexo**: Link para o relatório completo
|
|
488
|
+
|
|
489
|
+
### 5.3 Sumarizar Cards Criados
|
|
490
|
+
|
|
491
|
+
```markdown
|
|
492
|
+
## Cards Criados no $TASK_MANAGER
|
|
493
|
+
|
|
494
|
+
| Card ID | Título | Prioridade | Categoria |
|
|
495
|
+
|---------|--------|------------|-----------|
|
|
496
|
+
| PROJ-101 | {título} | P0 | BUG-CRÍTICO |
|
|
497
|
+
| PROJ-102 | {título} | P0 | SEGURANÇA |
|
|
498
|
+
| PROJ-103 | {título} | P1 | BUG-ALTO |
|
|
499
|
+
| ... | ... | ... | ... |
|
|
500
|
+
|
|
501
|
+
**Total de cards criados**: {N}
|
|
502
|
+
```
|
|
503
|
+
|
|
504
|
+
---
|
|
505
|
+
|
|
506
|
+
## Checklist de Conclusão
|
|
507
|
+
|
|
508
|
+
- [ ] Escopo definido e documentado
|
|
509
|
+
- [ ] Análise automatizada executada
|
|
510
|
+
- [ ] Análise manual completada para todas as categorias
|
|
511
|
+
- [ ] Problemas classificados e priorizados
|
|
512
|
+
- [ ] Relatório gerado no formato padrão
|
|
513
|
+
- [ ] Relatório salvo em `$SESSIONS_DIR/eng/{session-id}/bug-audit-report.md`
|
|
514
|
+
- [ ] Cards P0 e P1 criados no task manager
|
|
515
|
+
- [ ] Recomendações estratégicas documentadas
|
|
516
|
+
- [ ] Melhorias preventivas sugeridas
|
|
517
|
+
- [ ] Usuário notificado sobre conclusão
|
|
518
|
+
|
|
519
|
+
---
|
|
520
|
+
|
|
521
|
+
## Tratamento de Erros
|
|
522
|
+
|
|
523
|
+
### Escopo não definido
|
|
524
|
+
- Perguntar ao usuário qual área analisar
|
|
525
|
+
- Sugerir começar por áreas críticas
|
|
526
|
+
|
|
527
|
+
### Projeto sem estrutura reconhecível
|
|
528
|
+
- Solicitar explicação do usuário sobre organização
|
|
529
|
+
- Adaptar análise conforme necessário
|
|
530
|
+
|
|
531
|
+
### Ferramentas indisponíveis (linter, testes, etc.)
|
|
532
|
+
- Prosseguir com análise manual
|
|
533
|
+
- Recomendar configuração dessas ferramentas
|
|
534
|
+
|
|
535
|
+
### Muitos problemas encontrados (> 100)
|
|
536
|
+
- Priorizar P0 e P1 no relatório principal
|
|
537
|
+
- Criar anexo com lista completa
|
|
538
|
+
- Sugerir análise incremental por áreas
|
|
539
|
+
|
|
540
|
+
---
|
|
541
|
+
|
|
542
|
+
## Mensagem de Conclusão
|
|
543
|
+
|
|
544
|
+
```
|
|
545
|
+
✅ Bug Audit concluído!
|
|
546
|
+
|
|
547
|
+
**Resumo**:
|
|
548
|
+
- Problemas encontrados: {N}
|
|
549
|
+
- Críticos (P0): {N}
|
|
550
|
+
- Altos (P1): {N}
|
|
551
|
+
- Médios (P2): {N}
|
|
552
|
+
- Baixos (P3): {N}
|
|
553
|
+
|
|
554
|
+
**Cards criados no $TASK_MANAGER**: {N}
|
|
555
|
+
|
|
556
|
+
**Relatório completo**: $SESSIONS_DIR/eng/{session-id}/bug-audit-report.md
|
|
557
|
+
|
|
558
|
+
**Próximos passos**:
|
|
559
|
+
1. Revisar problemas P0 imediatamente
|
|
560
|
+
2. Planejar correção de P1 na próxima sprint
|
|
561
|
+
3. Priorizar P2 e P3 no backlog de débito técnico
|
|
562
|
+
4. Implementar melhorias preventivas sugeridas
|
|
563
|
+
```
|
|
564
|
+
|
|
565
|
+
---
|
|
566
|
+
|
|
567
|
+
## Integração com Outros Workflows
|
|
568
|
+
|
|
569
|
+
- **eng.debug**: Para investigar bugs específicos encontrados no audit
|
|
570
|
+
- **eng.work**: Para implementar correções
|
|
571
|
+
- **eng.pr**: Para submeter correções
|
|
572
|
+
- **eng-qa-gate**: Para validar correções antes de merge
|
|
573
|
+
|
|
574
|
+
---
|
|
575
|
+
|
|
576
|
+
## Regras
|
|
577
|
+
|
|
578
|
+
### Nunca
|
|
579
|
+
- Fazer suposições sobre severidade sem análise
|
|
580
|
+
- Criar cards sem descrição adequada
|
|
581
|
+
- Ignorar problemas de segurança
|
|
582
|
+
- Relatar falsos positivos sem validação
|
|
583
|
+
|
|
584
|
+
### Sempre
|
|
585
|
+
- Validar ENV.md antes de iniciar
|
|
586
|
+
- Definir escopo claramente
|
|
587
|
+
- Priorizar por impacto real no negócio
|
|
588
|
+
- Fornecer sugestões de correção
|
|
589
|
+
- Documentar melhorias preventivas
|
|
590
|
+
- Salvar relatório na sessão
|
|
591
|
+
- Notificar usuário sobre conclusão
|