mega-brain-ai 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of mega-brain-ai might be problematic. Click here for more details.
- package/.claude/CLAUDE.md +155 -0
- package/.claude/commands/agents.md +161 -0
- package/.claude/commands/ask.md +117 -0
- package/.claude/commands/benchmark.md +224 -0
- package/.claude/commands/chat.md +343 -0
- package/.claude/commands/compare.md +116 -0
- package/.claude/commands/conclave.md +194 -0
- package/.claude/commands/config.md +133 -0
- package/.claude/commands/council.md +194 -0
- package/.claude/commands/create-agent.md +452 -0
- package/.claude/commands/debate.md +157 -0
- package/.claude/commands/documentation/create-architecture-documentation.md +175 -0
- package/.claude/commands/dossiers.md +180 -0
- package/.claude/commands/evolve.md +223 -0
- package/.claude/commands/extract-dna.md +170 -0
- package/.claude/commands/extract-knowledge.md +507 -0
- package/.claude/commands/inbox.md +296 -0
- package/.claude/commands/ingest-empresa.md +191 -0
- package/.claude/commands/ingest.md +182 -0
- package/.claude/commands/jarvis-briefing.md +67 -0
- package/.claude/commands/jarvis-control.md +169 -0
- package/.claude/commands/jarvis-full.md +181 -0
- package/.claude/commands/jarvis.md +212 -0
- package/.claude/commands/ler-drive.md +212 -0
- package/.claude/commands/log.md +158 -0
- package/.claude/commands/loop.md +133 -0
- package/.claude/commands/loops.md +73 -0
- package/.claude/commands/mission-autopilot.md +538 -0
- package/.claude/commands/mission.md +353 -0
- package/.claude/commands/process-inbox.md +148 -0
- package/.claude/commands/process-jarvis.md +3036 -0
- package/.claude/commands/process-video.md +131 -0
- package/.claude/commands/rag-search.md +78 -0
- package/.claude/commands/resume.md +33 -0
- package/.claude/commands/save.md +38 -0
- package/.claude/commands/scan-inbox.md +125 -0
- package/.claude/commands/setup.md +99 -0
- package/.claude/commands/system-digest.md +243 -0
- package/.claude/commands/verify.md +182 -0
- package/.claude/commands/view-dna.md +169 -0
- package/.claude/hooks/agent_doctor.py +433 -0
- package/.claude/hooks/agent_memory_persister.py +203 -0
- package/.claude/hooks/auto_formatter.py +158 -0
- package/.claude/hooks/checkpoint_writer.py +244 -0
- package/.claude/hooks/claude_md_guard.py +146 -0
- package/.claude/hooks/creation_validator.py +357 -0
- package/.claude/hooks/enforce_dual_location.py +501 -0
- package/.claude/hooks/enforce_plan_mode.py +220 -0
- package/.claude/hooks/inbox_age_alert.py +367 -0
- package/.claude/hooks/jarvis_briefing.py +506 -0
- package/.claude/hooks/ledger_updater.py +301 -0
- package/.claude/hooks/memory_hints_injector.py +251 -0
- package/.claude/hooks/memory_updater.py +202 -0
- package/.claude/hooks/multi_agent_hook.py +464 -0
- package/.claude/hooks/notification_system.py +120 -0
- package/.claude/hooks/pattern_analyzer.py +526 -0
- package/.claude/hooks/pending_tracker.py +188 -0
- package/.claude/hooks/post_batch_cascading.py +1740 -0
- package/.claude/hooks/post_output_validator.py +358 -0
- package/.claude/hooks/post_tool_use.py +120 -0
- package/.claude/hooks/post_write_validator.py +200 -0
- package/.claude/hooks/quality_watchdog.py +394 -0
- package/.claude/hooks/ralph_wiggum.py +277 -0
- package/.claude/hooks/session-source-sync.py +218 -0
- package/.claude/hooks/session_autosave_v2.py +1135 -0
- package/.claude/hooks/session_end.py +203 -0
- package/.claude/hooks/session_start.py +939 -0
- package/.claude/hooks/skill_indexer.py +48 -0
- package/.claude/hooks/skill_router.py +358 -0
- package/.claude/hooks/stop_hook_completeness.py +178 -0
- package/.claude/hooks/subagent_tracker.py +163 -0
- package/.claude/hooks/token_checkpoint.py +584 -0
- package/.claude/hooks/user_prompt_submit.py +125 -0
- package/.claude/rules/ANTHROPIC-STANDARDS.md +384 -0
- package/.claude/rules/CLAUDE-LITE.md +201 -0
- package/.claude/rules/RULE-GROUP-1.md +320 -0
- package/.claude/rules/RULE-GROUP-2.md +307 -0
- package/.claude/rules/RULE-GROUP-3.md +248 -0
- package/.claude/rules/RULE-GROUP-4.md +427 -0
- package/.claude/rules/RULE-GROUP-5.md +388 -0
- package/.claude/rules/RULE-GROUP-6.md +387 -0
- package/.claude/rules/logging.md +53 -0
- package/.claude/rules/mcp-governance.md +128 -0
- package/.claude/rules/pipeline.md +60 -0
- package/.claude/rules/state-management.md +93 -0
- package/.claude/scripts/apply-tags.py +77 -0
- package/.claude/scripts/batch-extract-transcriptions.py +132 -0
- package/.claude/scripts/build-complete-index.py +250 -0
- package/.claude/scripts/build-planilha-index.py +170 -0
- package/.claude/scripts/complete-tag-matching.py +250 -0
- package/.claude/scripts/deduplicate-inbox.py +139 -0
- package/.claude/scripts/docx-xml-extractor.py +141 -0
- package/.claude/scripts/extract-docx-text.py +58 -0
- package/.claude/scripts/extract-single-transcription.py +74 -0
- package/.claude/scripts/extract_docx_from_gdrive.py +77 -0
- package/.claude/scripts/organized-downloader.py +246 -0
- package/.claude/scripts/planilha-tagger.py +187 -0
- package/.claude/scripts/revert-tags.py +70 -0
- package/.claude/scripts/source-sync.py +265 -0
- package/.claude/scripts/tag-inbox-files.py +276 -0
- package/.claude/scripts/tag-inbox-v2.py +253 -0
- package/.claude/scripts/test-extraction.py +35 -0
- package/.claude/scripts/test-full-extraction.py +74 -0
- package/.claude/skills/00-SKILL-CREATOR/SKILL.md +186 -0
- package/.claude/skills/01-SKILL-DOCS-MEGABRAIN/SKILL.md +251 -0
- package/.claude/skills/02-SKILL-PYTHON-MEGABRAIN/SKILL.md +323 -0
- package/.claude/skills/03-SKILL-AGENT-CREATION/SKILL.md +374 -0
- package/.claude/skills/04-SKILL-KNOWLEDGE-EXTRACTION/SKILL.md +318 -0
- package/.claude/skills/05-SKILL-PIPELINE-JARVIS/SKILL.md +430 -0
- package/.claude/skills/06-SKILL-BRAINSTORMING/SKILL.md +72 -0
- package/.claude/skills/07-SKILL-DISPATCHING-PARALLEL-AGENTS/SKILL.md +193 -0
- package/.claude/skills/08-SKILL-EXECUTING-PLANS/SKILL.md +114 -0
- package/.claude/skills/09-SKILL-WRITING-PLANS/SKILL.md +184 -0
- package/.claude/skills/10-SKILL-VERIFICATION-BEFORE-COMPLETION/SKILL.md +130 -0
- package/.claude/skills/11-SKILL-USING-SUPERPOWERS/SKILL.md +105 -0
- package/.claude/skills/DETECTION-PROTOCOL.md +217 -0
- package/.claude/skills/README.md +240 -0
- package/.claude/skills/SKILL-REGISTRY.md +284 -0
- package/.claude/skills/SKILL-SUGGESTIONS.md +114 -0
- package/.claude/skills/_TEMPLATES/SKILL-WRITER-GUIDE.md +385 -0
- package/.claude/skills/chronicler/SKILL.md +146 -0
- package/.claude/skills/chronicler/chronicler_core.py +468 -0
- package/.claude/skills/code-review/SKILL.md +160 -0
- package/.claude/skills/council/SKILL.md +210 -0
- package/.claude/skills/executor/SKILL.md +161 -0
- package/.claude/skills/fase-2-5-tagging/SKILL.md +182 -0
- package/.claude/skills/feature-dev/SKILL.md +154 -0
- package/.claude/skills/finance-agent/SKILL.md +137 -0
- package/.claude/skills/frontend-design/SKILL.md +165 -0
- package/.claude/skills/gdrive-transcription-downloader/SKILL.md +249 -0
- package/.claude/skills/gemini-fallback/SKILL.md +67 -0
- package/.claude/skills/gemini-fallback/gemini_fetch.py +0 -0
- package/.claude/skills/gha/SKILL.md +96 -0
- package/.claude/skills/gha/gha_diagnostic.py +227 -0
- package/.claude/skills/github-workflow/SKILL.md +190 -0
- package/.claude/skills/hookify/SKILL.md +134 -0
- package/.claude/skills/hybrid-source-reading/SKILL.md +265 -0
- package/.claude/skills/jarvis/SKILL.md +546 -0
- package/.claude/skills/jarvis-briefing/SKILL.md +340 -0
- package/.claude/skills/ler-planilha/SKILL.md +281 -0
- package/.claude/skills/plugin-dev/SKILL.md +176 -0
- package/.claude/skills/pr-review-toolkit/SKILL.md +178 -0
- package/.claude/skills/resume/SKILL.md +61 -0
- package/.claude/skills/save/SKILL.md +87 -0
- package/.claude/skills/skill-writer/SKILL.md +153 -0
- package/.claude/skills/skill-writer/examples.md +191 -0
- package/.claude/skills/skill-writer/troubleshooting.md +205 -0
- package/.claude/skills/smart-download-tagger/SKILL.md +148 -0
- package/.claude/skills/source-sync/SKILL.md +240 -0
- package/.claude/skills/sync-docs/SKILL.md +193 -0
- package/.claude/skills/sync-docs/config.json +37 -0
- package/.claude/skills/sync-docs/gdrive_sync.py +358 -0
- package/.claude/skills/sync-docs/reauth.py +71 -0
- package/.claude/skills/talent-agent/SKILL.md +183 -0
- package/.claude/skills/verify/SKILL.md +154 -0
- package/.claude/skills/verify/verify_runner.py +0 -0
- package/.claude/skills/verify-6-levels/SKILL.md +234 -0
- package/.claude/templates/BATCH-LOG-TEMPLATE.md +221 -0
- package/.claudeignore +9 -0
- package/.gitattributes +4 -0
- package/.github/layer1-allowlist.txt +80 -0
- package/.github/layer2-manifest.txt +40 -0
- package/.gitignore +219 -0
- package/README.md +1210 -0
- package/agents/_templates/INDEX.md +741 -0
- package/agents/_templates/TEMPLATE-AGENT-MD-ULTRA-ROBUSTO-V3.md +2399 -0
- package/agents/boardroom/CHECKLIST-MASTER.md +281 -0
- package/agents/boardroom/INTEGRATION-GUIDE.md +406 -0
- package/agents/boardroom/README.md +238 -0
- package/agents/boardroom/config/BOARDROOM-CONFIG.md +186 -0
- package/agents/boardroom/config/TTS-INTEGRATION.md +258 -0
- package/agents/boardroom/config/VOICE-PROFILES.md +624 -0
- package/agents/boardroom/config/voice_mapping.json +128 -0
- package/agents/boardroom/scripts/audio_generator.py +375 -0
- package/agents/boardroom/scripts/audio_generator_edge.py +353 -0
- package/agents/boardroom/scripts/jarvis_boardroom_hook.py +415 -0
- package/agents/boardroom/scripts/notebooklm_generator.py +578 -0
- package/agents/boardroom/templates/EPISODE-TEMPLATE.md +367 -0
- package/agents/boardroom/templates/scene-templates/SCENE-AGENT-DEBATE.md +252 -0
- package/agents/boardroom/templates/scene-templates/SCENE-COUNCIL.md +270 -0
- package/agents/boardroom/templates/scene-templates/SCENE-DNA-CONSULTATION.md +126 -0
- package/agents/boardroom/templates/scene-templates/SCENE-QUESTION.md +174 -0
- package/agents/boardroom/workflows/WORKFLOW-AUDIO-GENERATION.md +421 -0
- package/agents/constitution/BASE-CONSTITUTION.md +254 -0
- package/agents/council/CRITIC.md +197 -0
- package/agents/council/DEVILS-ADVOCATE.md +274 -0
- package/agents/council/SYNTHESIZER.md +293 -0
- package/agents/council/advogado-do-diabo/AGENT.md +489 -0
- package/agents/council/advogado-do-diabo/SOUL.md +100 -0
- package/agents/council/critico-metodologico/AGENT.md +670 -0
- package/agents/council/critico-metodologico/SOUL.md +107 -0
- package/agents/council/sintetizador/AGENT.md +558 -0
- package/agents/council/sintetizador/SOUL.md +94 -0
- package/agents/persons/_example/AGENT-EXAMPLE.md +42 -0
- package/agents/persons/_example/DNA-EXAMPLE.yaml +61 -0
- package/agents/protocols/AGENT-COGNITION-PROTOCOL.md +779 -0
- package/agents/protocols/AGENT-INTEGRITY-PROTOCOL.md +692 -0
- package/agents/protocols/BATCH-VISUAL-PROTOCOL.md +841 -0
- package/agents/protocols/DNA-CONFIG-TEMPLATE.yaml +181 -0
- package/agents/protocols/DNA-EXTRACTION-PROTOCOL.md +370 -0
- package/agents/protocols/EPISTEMIC-PROTOCOL.md +333 -0
- package/agents/protocols/LOG-STRUCTURE-PROTOCOL.md +65 -0
- package/agents/protocols/MEMORY-PROTOCOL.md +567 -0
- package/agents/protocols/NARRATIVE-SYNTHESIS-PROTOCOL.md +278 -0
- package/agents/protocols/PHASE-4-VERIFICATION-CHECKPOINT.md +146 -0
- package/agents/protocols/SOUL-TEMPLATE.md +416 -0
- package/agents/protocols/TEMPLATE-EVOLUTION-PROTOCOL.md +544 -0
- package/agents/protocols/VISUAL-DIFF-PROTOCOL.md +159 -0
- package/agents/sua-empresa/README.md +44 -0
- package/agents/sua-empresa/_example/jds/EXAMPLE-JD.md +42 -0
- package/agents/sua-empresa/_example/org/EXAMPLE-ORG.md +32 -0
- package/agents/sua-empresa/_example/roles/EXAMPLE-ROLE.md +38 -0
- package/bin/cli.js +2 -0
- package/bin/lib/ascii-art.js +234 -0
- package/bin/lib/installer.js +402 -0
- package/bin/lib/setup-wizard.js +95 -0
- package/bin/lib/validate-email.js +109 -0
- package/bin/mega-brain.js +97 -0
- package/bin/push.js +342 -0
- package/bin/templates/env.example +38 -0
- package/inbox/.gitkeep +0 -0
- package/integrations/README.md +46 -0
- package/integrations/mcps/MCP-REGISTRY.md +56 -0
- package/integrations/mcps/excalidraw/CONFIG.md +56 -0
- package/integrations/mcps/gdrive/CONFIG.md +38 -0
- package/knowledge/dna/.gitkeep +0 -0
- package/knowledge/dossiers/persons/.gitkeep +0 -0
- package/knowledge/dossiers/persons/DOSSIER-EXAMPLE.md +49 -0
- package/knowledge/dossiers/system/.gitkeep +0 -0
- package/knowledge/dossiers/themes/.gitkeep +0 -0
- package/knowledge/playbooks/.gitkeep +0 -0
- package/knowledge/playbooks/PLAYBOOK-EXAMPLE.md +50 -0
- package/knowledge/sources/.gitkeep +0 -0
- package/logs/.gitkeep +0 -0
- package/package.json +128 -0
- package/processing/canonical/.gitkeep +0 -0
- package/processing/chunks/.gitkeep +0 -0
- package/processing/insights/.gitkeep +0 -0
- package/processing/narratives/.gitkeep +0 -0
- package/reference/CONSELHO.md +337 -0
- package/reference/CONTEXT7_README.md +28 -0
- package/reference/JARVIS-LOGGING-PROTOCOL.md +380 -0
- package/reference/QUICK-START.md +197 -0
- package/reference/README-RALPH-CASCATEAMENTO.md +207 -0
- package/reference/TEMPLATE-MASTER.md +727 -0
- package/reference/prds/prd-jarvis-mega-brain-v3.md +1305 -0
- package/reference/templates/phase5/IMPLEMENTATION-GUIDE.md +355 -0
- package/reference/templates/phase5/MOGA-BRAIN-PHASE5-TEMPLATES.md +1284 -0
- package/reference/templates/phase5/README.md +165 -0
- package/reference/workflow-claude-code-boris-cherny-continuous-claude.md +2232 -0
- package/system/database/001_moneyclub_buyers.sql +160 -0
- package/system/database/002_premium_token.sql +97 -0
- package/system/database/apply-migration.mjs +129 -0
- package/system/docs/MEGA-BRAIN-DEMO-COMPLETA.md +1226 -0
- package/system/docs/MEGA-BRAIN-MANIFESTO-COMPLETO.md +1054 -0
- package/system/docs/MOGA-BRAIN-EXPLICACAO-COMPLETA.md +791 -0
- package/system/docs/STRATEGIC-INTEGRATION-GUIDE.md +725 -0
- package/system/docs/architecture/01-system-context.md +136 -0
- package/system/docs/architecture/02-components.md +225 -0
- package/system/docs/architecture/03-data-flow.md +235 -0
- package/system/docs/architecture/04-integrations.md +283 -0
- package/system/docs/architecture/README.md +71 -0
- package/system/docs/architecture/diagrams/component-diagram.mmd +50 -0
- package/system/docs/architecture/diagrams/data-flow.mmd +39 -0
- package/system/docs/architecture/diagrams/system-overview.mmd +68 -0
- package/system/protocols/AGENT-AUTHORITY.md +217 -0
- package/system/protocols/CONSTITUICAO-BASE.md +115 -0
- package/system/protocols/CONSTITUTION.md +231 -0
- package/system/protocols/GOVERNANCE-MAP.md +123 -0
- package/system/protocols/HOOK-SECURITY-THREAT-MODEL.md +152 -0
- package/system/protocols/ORQUESTRACAO-PROTOCOL.md +215 -0
- package/system/protocols/_archive/CHUNKING-PROTOCOL.md +207 -0
- package/system/protocols/_archive/ENTITY-RESOLUTION-PROTOCOL.md +269 -0
- package/system/protocols/_archive/INSIGHT-EXTRACTION-PROTOCOL.md +257 -0
- package/system/protocols/_archive/NARRATIVE-SYNTHESIS-PROTOCOL.md +290 -0
- package/system/protocols/agents/AGENT-INTERACTION.md +315 -0
- package/system/protocols/agents/CORTEX-PROTOCOL.md +520 -0
- package/system/protocols/agents/EPISTEMIC-PROTOCOL.md +465 -0
- package/system/protocols/agents/MEMORY-PROTOCOL.md +366 -0
- package/system/protocols/agents/WAR-ROOM.md +355 -0
- package/system/protocols/company/COMPANY-DOCUMENT-PROTOCOL.md +793 -0
- package/system/protocols/company/COMPANY-ENRICHMENT-PROTOCOL.md +679 -0
- package/system/protocols/conclave/CONCLAVE-LOG-TEMPLATE-v2.md +309 -0
- package/system/protocols/conclave/CONCLAVE-PROTOCOL.md +518 -0
- package/system/protocols/conclave/DEBATE-DYNAMICS-CONFIG.yaml +322 -0
- package/system/protocols/conclave/DEBATE-DYNAMICS-PROTOCOL.md +613 -0
- package/system/protocols/conclave/DEBATE-PROTOCOL.md +323 -0
- package/system/protocols/council/COUNCIL-LOG-TEMPLATE-v2.md +309 -0
- package/system/protocols/council/COUNCIL-PROTOCOL.md +518 -0
- package/system/protocols/council/DEBATE-DYNAMICS-CONFIG.yaml +322 -0
- package/system/protocols/council/DEBATE-DYNAMICS-PROTOCOL.md +613 -0
- package/system/protocols/council/DEBATE-PROTOCOL.md +323 -0
- package/system/protocols/dna/DNA-EXTRACTION-PROTOCOL.md +1214 -0
- package/system/protocols/dna/ENRICHMENT-PROTOCOL.md +408 -0
- package/system/protocols/dna/REASONING-MODEL-PROTOCOL.md +331 -0
- package/system/protocols/pipeline/DOSSIER-COMPILATION-PROTOCOL.md +790 -0
- package/system/protocols/pipeline/NARRATIVE-METABOLISM-PROTOCOL.md +292 -0
- package/system/protocols/pipeline/PIPELINE-JARVIS-v2.1.md +606 -0
- package/system/protocols/pipeline/PROMPT-1.1-CHUNKING.md +154 -0
- package/system/protocols/pipeline/PROMPT-1.2-ENTITY-RESOLUTION.md +186 -0
- package/system/protocols/pipeline/PROMPT-2.1-DNA-TAGS-INCREMENT.md +208 -0
- package/system/protocols/pipeline/PROMPT-2.1-INSIGHT-EXTRACTION.md +191 -0
- package/system/protocols/pipeline/PROMPT-3.1-NARRATIVE-SYNTHESIS.md +331 -0
- package/system/protocols/pipeline/SOURCES-COMPILATION-PROTOCOL.md +340 -0
- package/system/protocols/system/AUTO-LOG-PROTOCOL.md +369 -0
- package/system/protocols/system/CHECKPOINT-ENFORCEMENT.md +176 -0
- package/system/protocols/system/ENFORCEMENT.md +435 -0
- package/system/protocols/system/LOG-TEMPLATES.md +1068 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: gha
|
|
3
|
+
description: Diagnóstico de GitHub Actions failures
|
|
4
|
+
triggers:
|
|
5
|
+
- "/gha"
|
|
6
|
+
- "github actions"
|
|
7
|
+
- "ci failed"
|
|
8
|
+
- "workflow failed"
|
|
9
|
+
- "build failed"
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# GitHub Actions Diagnostics
|
|
13
|
+
|
|
14
|
+
Diagnóstico automático de falhas em GitHub Actions.
|
|
15
|
+
|
|
16
|
+
## Uso
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
/gha # Verifica último workflow run
|
|
20
|
+
/gha [run_id] # Analisa run específico
|
|
21
|
+
/gha --flaky # Identifica testes flaky
|
|
22
|
+
/gha --history # Histórico de falhas
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## O Que Faz
|
|
26
|
+
|
|
27
|
+
1. **Busca último workflow run com falha**
|
|
28
|
+
2. **Baixa logs do job**
|
|
29
|
+
3. **Analisa erro e identifica causa raiz**
|
|
30
|
+
4. **Sugere correção**
|
|
31
|
+
|
|
32
|
+
## Execução Manual
|
|
33
|
+
|
|
34
|
+
Se precisar debugar manualmente:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
# Listar workflows
|
|
38
|
+
gh run list --limit 10
|
|
39
|
+
|
|
40
|
+
# Ver detalhes de um run
|
|
41
|
+
gh run view [RUN_ID]
|
|
42
|
+
|
|
43
|
+
# Baixar logs
|
|
44
|
+
gh run view [RUN_ID] --log
|
|
45
|
+
|
|
46
|
+
# Ver jobs de um run
|
|
47
|
+
gh run view [RUN_ID] --job [JOB_ID]
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Análise Automática
|
|
51
|
+
|
|
52
|
+
Quando acionado, JARVIS irá:
|
|
53
|
+
|
|
54
|
+
1. Executar `gh run list --status failure --limit 5`
|
|
55
|
+
2. Identificar o run mais recente
|
|
56
|
+
3. Executar `gh run view [ID] --log`
|
|
57
|
+
4. Analisar os logs buscando:
|
|
58
|
+
- Erros de teste
|
|
59
|
+
- Erros de build
|
|
60
|
+
- Erros de lint
|
|
61
|
+
- Timeout
|
|
62
|
+
- Dependências faltando
|
|
63
|
+
5. Reportar causa provável e sugerir fix
|
|
64
|
+
|
|
65
|
+
## Padrões Comuns de Erro
|
|
66
|
+
|
|
67
|
+
| Padrão | Causa Provável | Sugestão |
|
|
68
|
+
|--------|----------------|----------|
|
|
69
|
+
| `npm ERR!` | Dependência | `npm ci` ou limpar cache |
|
|
70
|
+
| `ENOENT` | Arquivo faltando | Verificar paths |
|
|
71
|
+
| `timeout` | Teste lento/flaky | Aumentar timeout ou otimizar |
|
|
72
|
+
| `FAILED` em test | Teste quebrado | Ver stack trace |
|
|
73
|
+
| `TypeScript error` | Tipo incorreto | Fix no código |
|
|
74
|
+
| `ESLint` | Lint error | Auto-fix ou manual |
|
|
75
|
+
|
|
76
|
+
## Exemplo de Output
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
╔══════════════════════════════════════════════════════════════════════════════╗
|
|
80
|
+
║ GITHUB ACTIONS DIAGNOSTIC ║
|
|
81
|
+
╠══════════════════════════════════════════════════════════════════════════════╣
|
|
82
|
+
║ Run ID: 12345678 ║
|
|
83
|
+
║ Workflow: CI ║
|
|
84
|
+
║ Status: FAILED ║
|
|
85
|
+
║ Duration: 3m 42s ║
|
|
86
|
+
╠══════════════════════════════════════════════════════════════════════════════╣
|
|
87
|
+
║ CAUSA RAIZ: ║
|
|
88
|
+
║ Test failure in src/__tests__/api.test.ts:42 ║
|
|
89
|
+
║ ║
|
|
90
|
+
║ Error: Expected 200, got 404 ║
|
|
91
|
+
║ ║
|
|
92
|
+
║ SUGESTÃO: ║
|
|
93
|
+
║ O endpoint /api/users foi removido ou renomeado. ║
|
|
94
|
+
║ Verificar se o route existe em src/routes/users.ts ║
|
|
95
|
+
╚══════════════════════════════════════════════════════════════════════════════╝
|
|
96
|
+
```
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
GITHUB ACTIONS DIAGNOSTIC
|
|
4
|
+
=========================
|
|
5
|
+
Diagnóstico automático de falhas em GitHub Actions.
|
|
6
|
+
|
|
7
|
+
Usage:
|
|
8
|
+
python3 gha_diagnostic.py # Último run com falha
|
|
9
|
+
python3 gha_diagnostic.py [run_id] # Run específico
|
|
10
|
+
python3 gha_diagnostic.py --flaky # Testes flaky
|
|
11
|
+
python3 gha_diagnostic.py --history # Histórico
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
import sys
|
|
15
|
+
import subprocess
|
|
16
|
+
import json
|
|
17
|
+
import re
|
|
18
|
+
from datetime import datetime
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def run_gh(args: list) -> tuple[bool, str]:
|
|
22
|
+
"""Execute gh CLI command"""
|
|
23
|
+
try:
|
|
24
|
+
result = subprocess.run(
|
|
25
|
+
['gh'] + args,
|
|
26
|
+
capture_output=True,
|
|
27
|
+
text=True,
|
|
28
|
+
timeout=30
|
|
29
|
+
)
|
|
30
|
+
if result.returncode == 0:
|
|
31
|
+
return True, result.stdout
|
|
32
|
+
return False, result.stderr
|
|
33
|
+
except Exception as e:
|
|
34
|
+
return False, str(e)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def get_failed_runs(limit: int = 5) -> list:
|
|
38
|
+
"""Get recent failed runs"""
|
|
39
|
+
success, output = run_gh([
|
|
40
|
+
'run', 'list',
|
|
41
|
+
'--status', 'failure',
|
|
42
|
+
'--limit', str(limit),
|
|
43
|
+
'--json', 'databaseId,name,conclusion,createdAt,headBranch'
|
|
44
|
+
])
|
|
45
|
+
|
|
46
|
+
if success:
|
|
47
|
+
try:
|
|
48
|
+
return json.loads(output)
|
|
49
|
+
except:
|
|
50
|
+
pass
|
|
51
|
+
return []
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def get_run_logs(run_id: str) -> str:
|
|
55
|
+
"""Get logs for a specific run"""
|
|
56
|
+
success, output = run_gh(['run', 'view', run_id, '--log'])
|
|
57
|
+
if success:
|
|
58
|
+
return output
|
|
59
|
+
return f"Error getting logs: {output}"
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def get_run_details(run_id: str) -> dict:
|
|
63
|
+
"""Get detailed info about a run"""
|
|
64
|
+
success, output = run_gh([
|
|
65
|
+
'run', 'view', run_id,
|
|
66
|
+
'--json', 'databaseId,name,conclusion,createdAt,headBranch,jobs'
|
|
67
|
+
])
|
|
68
|
+
|
|
69
|
+
if success:
|
|
70
|
+
try:
|
|
71
|
+
return json.loads(output)
|
|
72
|
+
except:
|
|
73
|
+
pass
|
|
74
|
+
return {}
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def analyze_logs(logs: str) -> dict:
|
|
78
|
+
"""Analyze logs to find root cause"""
|
|
79
|
+
analysis = {
|
|
80
|
+
'error_type': 'Unknown',
|
|
81
|
+
'error_message': '',
|
|
82
|
+
'file': '',
|
|
83
|
+
'line': '',
|
|
84
|
+
'suggestion': ''
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
# Common patterns
|
|
88
|
+
patterns = [
|
|
89
|
+
# Test failures
|
|
90
|
+
(r'FAIL\s+(.+\.test\.[jt]sx?)', 'Test Failure', 'Verificar o teste indicado'),
|
|
91
|
+
(r'AssertionError:\s*(.+)', 'Assertion Failed', 'Verificar expectativa do teste'),
|
|
92
|
+
(r'Expected:\s*(.+)\s*Received:\s*(.+)', 'Assertion Mismatch', 'Valores não correspondem'),
|
|
93
|
+
|
|
94
|
+
# TypeScript errors
|
|
95
|
+
(r'error TS\d+:\s*(.+)', 'TypeScript Error', 'Corrigir tipo no código'),
|
|
96
|
+
(r"Property '(\w+)' does not exist", 'Missing Property', 'Adicionar propriedade ao tipo'),
|
|
97
|
+
|
|
98
|
+
# Build errors
|
|
99
|
+
(r'npm ERR!\s*(.+)', 'NPM Error', 'Verificar dependências, rodar npm ci'),
|
|
100
|
+
(r'Module not found:\s*(.+)', 'Module Not Found', 'Instalar módulo faltante'),
|
|
101
|
+
|
|
102
|
+
# ESLint
|
|
103
|
+
(r'error\s+(.+)\s+@typescript-eslint', 'ESLint Error', 'Corrigir lint error'),
|
|
104
|
+
|
|
105
|
+
# Generic errors
|
|
106
|
+
(r'Error:\s*(.+)', 'Generic Error', 'Ver stack trace para mais detalhes'),
|
|
107
|
+
(r'ENOENT.*?([^\s]+)', 'File Not Found', 'Verificar se arquivo existe'),
|
|
108
|
+
(r'timeout', 'Timeout', 'Aumentar timeout ou otimizar'),
|
|
109
|
+
]
|
|
110
|
+
|
|
111
|
+
for pattern, error_type, suggestion in patterns:
|
|
112
|
+
match = re.search(pattern, logs, re.IGNORECASE)
|
|
113
|
+
if match:
|
|
114
|
+
analysis['error_type'] = error_type
|
|
115
|
+
analysis['error_message'] = match.group(1) if match.groups() else match.group(0)
|
|
116
|
+
analysis['suggestion'] = suggestion
|
|
117
|
+
break
|
|
118
|
+
|
|
119
|
+
# Try to find file:line reference
|
|
120
|
+
file_match = re.search(r'([^\s]+\.[jt]sx?):(\d+)', logs)
|
|
121
|
+
if file_match:
|
|
122
|
+
analysis['file'] = file_match.group(1)
|
|
123
|
+
analysis['line'] = file_match.group(2)
|
|
124
|
+
|
|
125
|
+
return analysis
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
def print_diagnostic(run_id: str):
|
|
129
|
+
"""Print full diagnostic for a run"""
|
|
130
|
+
details = get_run_details(run_id)
|
|
131
|
+
logs = get_run_logs(run_id)
|
|
132
|
+
analysis = analyze_logs(logs)
|
|
133
|
+
|
|
134
|
+
print("""
|
|
135
|
+
╔══════════════════════════════════════════════════════════════════════════════╗
|
|
136
|
+
║ GITHUB ACTIONS DIAGNOSTIC ║
|
|
137
|
+
╠══════════════════════════════════════════════════════════════════════════════╣""")
|
|
138
|
+
|
|
139
|
+
if details:
|
|
140
|
+
name = details.get('name', 'Unknown')[:60]
|
|
141
|
+
branch = details.get('headBranch', 'Unknown')[:30]
|
|
142
|
+
conclusion = details.get('conclusion', 'Unknown')
|
|
143
|
+
|
|
144
|
+
print(f"║ Run ID: {run_id:<62} ║")
|
|
145
|
+
print(f"║ Workflow: {name:<62} ║")
|
|
146
|
+
print(f"║ Branch: {branch:<62} ║")
|
|
147
|
+
print(f"║ Status: {conclusion:<62} ║")
|
|
148
|
+
|
|
149
|
+
print("╠══════════════════════════════════════════════════════════════════════════════╣")
|
|
150
|
+
print("║ ANÁLISE: ║")
|
|
151
|
+
print(f"║ Tipo: {analysis['error_type']:<62} ║")
|
|
152
|
+
|
|
153
|
+
if analysis['error_message']:
|
|
154
|
+
msg = analysis['error_message'][:60]
|
|
155
|
+
print(f"║ Erro: {msg:<62} ║")
|
|
156
|
+
|
|
157
|
+
if analysis['file']:
|
|
158
|
+
loc = f"{analysis['file']}:{analysis['line']}"[:60]
|
|
159
|
+
print(f"║ Local: {loc:<62} ║")
|
|
160
|
+
|
|
161
|
+
print("║ ║")
|
|
162
|
+
print("║ SUGESTÃO: ║")
|
|
163
|
+
suggestion = analysis['suggestion'][:70]
|
|
164
|
+
print(f"║ {suggestion:<76} ║")
|
|
165
|
+
|
|
166
|
+
print("╚══════════════════════════════════════════════════════════════════════════════╝")
|
|
167
|
+
|
|
168
|
+
# Print relevant log snippet
|
|
169
|
+
if analysis['error_message']:
|
|
170
|
+
print("\n📋 LOG RELEVANTE:")
|
|
171
|
+
print("-" * 80)
|
|
172
|
+
# Find context around error
|
|
173
|
+
lines = logs.split('\n')
|
|
174
|
+
for i, line in enumerate(lines):
|
|
175
|
+
if analysis['error_message'][:30] in line:
|
|
176
|
+
start = max(0, i - 5)
|
|
177
|
+
end = min(len(lines), i + 10)
|
|
178
|
+
print('\n'.join(lines[start:end]))
|
|
179
|
+
break
|
|
180
|
+
print("-" * 80)
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
def main():
|
|
184
|
+
args = sys.argv[1:]
|
|
185
|
+
|
|
186
|
+
if '--help' in args or '-h' in args:
|
|
187
|
+
print(__doc__)
|
|
188
|
+
return
|
|
189
|
+
|
|
190
|
+
# Check gh CLI
|
|
191
|
+
success, _ = run_gh(['--version'])
|
|
192
|
+
if not success:
|
|
193
|
+
print("❌ GitHub CLI (gh) not installed or not authenticated")
|
|
194
|
+
print(" Install: brew install gh")
|
|
195
|
+
print(" Auth: gh auth login")
|
|
196
|
+
return
|
|
197
|
+
|
|
198
|
+
if '--history' in args:
|
|
199
|
+
print("📊 Histórico de falhas recentes:\n")
|
|
200
|
+
runs = get_failed_runs(10)
|
|
201
|
+
for run in runs:
|
|
202
|
+
print(f" • {run['databaseId']} - {run['name']} ({run['headBranch']})")
|
|
203
|
+
return
|
|
204
|
+
|
|
205
|
+
if '--flaky' in args:
|
|
206
|
+
print("🔍 Analisando testes flaky...\n")
|
|
207
|
+
# Get recent runs and look for intermittent failures
|
|
208
|
+
runs = get_failed_runs(20)
|
|
209
|
+
print(f" {len(runs)} falhas nas últimas 20 runs")
|
|
210
|
+
# Could do more sophisticated analysis here
|
|
211
|
+
return
|
|
212
|
+
|
|
213
|
+
# Get specific run or latest failed
|
|
214
|
+
if args and args[0].isdigit():
|
|
215
|
+
run_id = args[0]
|
|
216
|
+
else:
|
|
217
|
+
runs = get_failed_runs(1)
|
|
218
|
+
if not runs:
|
|
219
|
+
print("✅ Nenhuma falha recente encontrada!")
|
|
220
|
+
return
|
|
221
|
+
run_id = str(runs[0]['databaseId'])
|
|
222
|
+
|
|
223
|
+
print_diagnostic(run_id)
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
if __name__ == '__main__':
|
|
227
|
+
main()
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
> **Auto-Trigger:** Quando usuário menciona GitHub, issues, PRs, branches, ou workflow de código
|
|
2
|
+
> **Keywords:** "github", "issue", "pull request", "pr", "branch", "merge", "commit", "workflow"
|
|
3
|
+
> **Prioridade:** ALTA
|
|
4
|
+
> **Tools:** Bash, Read, Write
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# /github-workflow - Guia do Fluxo GitHub
|
|
9
|
+
|
|
10
|
+
## Propósito
|
|
11
|
+
|
|
12
|
+
Este skill guia o usuário através do fluxo GitHub obrigatório definido na **REGRA #30**.
|
|
13
|
+
Todo código modificado DEVE seguir este workflow: **Issue → Branch → PR → Merge**.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Workflow Completo
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
┌─────────────────────────────────────────────────────────────────────────────┐
|
|
21
|
+
│ GITHUB WORKFLOW OBRIGATÓRIO │
|
|
22
|
+
├─────────────────────────────────────────────────────────────────────────────┤
|
|
23
|
+
│ │
|
|
24
|
+
│ 1. CRIAR ISSUE │
|
|
25
|
+
│ ├── Prefixo correto: [FEAT], [FIX], [REFACTOR], [DOCS] │
|
|
26
|
+
│ ├── Título descritivo │
|
|
27
|
+
│ └── Critérios de aceite claros │
|
|
28
|
+
│ │
|
|
29
|
+
│ 2. CRIAR BRANCH │
|
|
30
|
+
│ ├── Formato: tipo/issue-XX-descricao │
|
|
31
|
+
│ ├── Exemplos: │
|
|
32
|
+
│ │ feat/issue-42-add-auth │
|
|
33
|
+
│ │ fix/issue-15-memory-leak │
|
|
34
|
+
│ │ refactor/issue-8-cleanup-hooks │
|
|
35
|
+
│ └── git checkout -b tipo/issue-XX-desc │
|
|
36
|
+
│ │
|
|
37
|
+
│ 3. FAZER COMMITS │
|
|
38
|
+
│ ├── Mensagens descritivas │
|
|
39
|
+
│ ├── Referência à issue: refs #XX │
|
|
40
|
+
│ └── Exemplo: "Add auth module refs #42" │
|
|
41
|
+
│ │
|
|
42
|
+
│ 4. ABRIR PULL REQUEST │
|
|
43
|
+
│ ├── Título claro │
|
|
44
|
+
│ ├── "Fixes #XX" no body (auto-fecha issue) │
|
|
45
|
+
│ ├── Checklist de 6 níveis de verificação │
|
|
46
|
+
│ └── Usar template: .github/PULL_REQUEST_TEMPLATE.md │
|
|
47
|
+
│ │
|
|
48
|
+
│ 5. VERIFICAR (6 Níveis) │
|
|
49
|
+
│ ├── 1. Lint/Hooks │
|
|
50
|
+
│ ├── 2. Tests │
|
|
51
|
+
│ ├── 3. Build/Integrity │
|
|
52
|
+
│ ├── 4. Visual │
|
|
53
|
+
│ ├── 5. Staging │
|
|
54
|
+
│ └── 6. Security │
|
|
55
|
+
│ │
|
|
56
|
+
│ 6. MERGE │
|
|
57
|
+
│ └── Apenas após todos os níveis passarem │
|
|
58
|
+
│ │
|
|
59
|
+
└─────────────────────────────────────────────────────────────────────────────┘
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## Templates de Issue
|
|
65
|
+
|
|
66
|
+
### [FEAT] - Nova Funcionalidade
|
|
67
|
+
```bash
|
|
68
|
+
gh issue create --title "[FEAT] Descrição curta" --body "## Descrição
|
|
69
|
+
[Detalhe da feature]
|
|
70
|
+
|
|
71
|
+
## Critérios de Aceite
|
|
72
|
+
- [ ] Critério 1
|
|
73
|
+
- [ ] Critério 2
|
|
74
|
+
|
|
75
|
+
## Contexto JARVIS
|
|
76
|
+
- Fase: [X]
|
|
77
|
+
- Regras afetadas: [lista]"
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### [FIX] - Correção de Bug
|
|
81
|
+
```bash
|
|
82
|
+
gh issue create --title "[FIX] Descrição do bug" --body "## Bug
|
|
83
|
+
[Descrição do problema]
|
|
84
|
+
|
|
85
|
+
## Reprodução
|
|
86
|
+
1. Passo 1
|
|
87
|
+
2. Passo 2
|
|
88
|
+
|
|
89
|
+
## Comportamento Esperado
|
|
90
|
+
[O que deveria acontecer]
|
|
91
|
+
|
|
92
|
+
## Logs/Screenshots
|
|
93
|
+
[Se aplicável]"
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### [REFACTOR] - Refatoração
|
|
97
|
+
```bash
|
|
98
|
+
gh issue create --title "[REFACTOR] Área de refatoração" --body "## Objetivo
|
|
99
|
+
[Por que refatorar]
|
|
100
|
+
|
|
101
|
+
## Escopo
|
|
102
|
+
- Arquivos afetados: [lista]
|
|
103
|
+
- Impacto: [baixo/médio/alto]
|
|
104
|
+
|
|
105
|
+
## Abordagem
|
|
106
|
+
[Como será feito]"
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## Comandos Úteis
|
|
112
|
+
|
|
113
|
+
### Criar Issue
|
|
114
|
+
```bash
|
|
115
|
+
gh issue create --title "[TIPO] Título" --label "tipo"
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Criar Branch
|
|
119
|
+
```bash
|
|
120
|
+
git checkout -b feat/issue-XX-descricao
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Abrir PR
|
|
124
|
+
```bash
|
|
125
|
+
gh pr create --title "Título do PR" --body "Fixes #XX
|
|
126
|
+
|
|
127
|
+
## Summary
|
|
128
|
+
- Change 1
|
|
129
|
+
- Change 2
|
|
130
|
+
|
|
131
|
+
## Verification Checklist
|
|
132
|
+
- [ ] 1. Hooks/Lint passed
|
|
133
|
+
- [ ] 2. Tests passed
|
|
134
|
+
- [ ] 3. Build successful
|
|
135
|
+
- [ ] 4. Visual verification
|
|
136
|
+
- [ ] 5. Staging tested
|
|
137
|
+
- [ ] 6. Security audit"
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Verificar Status
|
|
141
|
+
```bash
|
|
142
|
+
gh pr status
|
|
143
|
+
gh pr checks
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## 6 Níveis de Verificação
|
|
149
|
+
|
|
150
|
+
| Nível | Nome | Comando | O que Verifica |
|
|
151
|
+
|-------|------|---------|----------------|
|
|
152
|
+
| 1 | Lint/Hooks | `pre-commit run --all` | Formatação, style |
|
|
153
|
+
| 2 | Tests | `pytest` / `npm test` | Testes automatizados |
|
|
154
|
+
| 3 | Build | `python -m py_compile **/*.py` | Integridade do código |
|
|
155
|
+
| 4 | Visual | Manual | Revisão visual do output |
|
|
156
|
+
| 5 | Staging | Deploy staging | Funciona em ambiente real |
|
|
157
|
+
| 6 | Security | `bandit` / manual | Vulnerabilidades |
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
## Quando NÃO Ativar
|
|
162
|
+
|
|
163
|
+
- Perguntas gerais sobre git (não sobre o workflow específico)
|
|
164
|
+
- Quando usuário já está no meio de um workflow e sabe o que fazer
|
|
165
|
+
- Consultas sobre histórico de commits sem intenção de modificar
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## Regras Relacionadas
|
|
170
|
+
|
|
171
|
+
- **REGRA #30**: GitHub Workflow Obrigatório
|
|
172
|
+
- **REGRA #13**: Plan Mode para modificações
|
|
173
|
+
- **REGRA #8**: Logging obrigatório
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
## Exemplos de Uso
|
|
178
|
+
|
|
179
|
+
**Usuário:** "Como faço para criar uma issue de feature?"
|
|
180
|
+
**JARVIS:** [Ativa este skill, mostra template de issue FEAT]
|
|
181
|
+
|
|
182
|
+
**Usuário:** "Preciso fazer um PR para a issue #42"
|
|
183
|
+
**JARVIS:** [Ativa este skill, guia através do processo de PR]
|
|
184
|
+
|
|
185
|
+
**Usuário:** "Qual o workflow do GitHub?"
|
|
186
|
+
**JARVIS:** [Ativa este skill, mostra diagrama completo]
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
*Para verificação completa de 6 níveis, use `/verify-6-levels`*
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# Hookify Skill
|
|
2
|
+
|
|
3
|
+
> **Auto-Trigger:** Quando usuário quiser criar hook, regra de segurança, validação customizada, lifecycle hook
|
|
4
|
+
> **Keywords:** "hook", "criar hook", "lifecycle", "safety rule", "validação", "regra de segurança", "pre-tool", "post-tool"
|
|
5
|
+
> **Prioridade:** ALTA
|
|
6
|
+
> **Namespace:** [OFFICIAL]
|
|
7
|
+
> **Tools:** Read, Write, Edit, Glob, Grep
|
|
8
|
+
|
|
9
|
+
## Quando NÃO Ativar
|
|
10
|
+
|
|
11
|
+
- Discussões sobre hooks existentes sem intenção de criar novos
|
|
12
|
+
- Debugging de hooks já implementados
|
|
13
|
+
- Perguntas gerais sobre o sistema de hooks
|
|
14
|
+
- Quando usuário explicitamente pedir skill diferente
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Core Purpose
|
|
19
|
+
|
|
20
|
+
Creating custom safety rules and hooks for Claude Code via markdown files with YAML frontmatter.
|
|
21
|
+
Enables pattern detection, regex matching, and warn/block modes for tool usage control.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Hook Structure
|
|
26
|
+
|
|
27
|
+
### File Format
|
|
28
|
+
|
|
29
|
+
```markdown
|
|
30
|
+
---
|
|
31
|
+
name: hook-name
|
|
32
|
+
description: What this hook does
|
|
33
|
+
trigger: PreToolUse | PostToolUse | UserPromptSubmit | SessionStart | Stop
|
|
34
|
+
tools: ["Bash", "Write", "Edit"] # Optional: specific tools to match
|
|
35
|
+
pattern: "regex pattern" # Optional: content pattern matching
|
|
36
|
+
mode: warn | block # Default: warn
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
# Instructions for what to do when triggered
|
|
40
|
+
|
|
41
|
+
Your custom logic here...
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Trigger Types
|
|
45
|
+
|
|
46
|
+
| Trigger | When It Fires |
|
|
47
|
+
|---------|---------------|
|
|
48
|
+
| `PreToolUse` | Before any tool execution |
|
|
49
|
+
| `PostToolUse` | After tool execution |
|
|
50
|
+
| `UserPromptSubmit` | When user sends a message |
|
|
51
|
+
| `SessionStart` | At session initialization |
|
|
52
|
+
| `Stop` | At session end |
|
|
53
|
+
|
|
54
|
+
### Mode Options
|
|
55
|
+
|
|
56
|
+
| Mode | Behavior |
|
|
57
|
+
|------|----------|
|
|
58
|
+
| `warn` | Alerts but continues execution |
|
|
59
|
+
| `block` | Prevents the action entirely |
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Implementation Guidelines
|
|
64
|
+
|
|
65
|
+
### 1. Identify the Need
|
|
66
|
+
|
|
67
|
+
- What action should be controlled?
|
|
68
|
+
- When should the hook trigger?
|
|
69
|
+
- Should it warn or block?
|
|
70
|
+
|
|
71
|
+
### 2. Define Patterns
|
|
72
|
+
|
|
73
|
+
- Use regex for content matching
|
|
74
|
+
- Specify tools if action-specific
|
|
75
|
+
- Consider edge cases
|
|
76
|
+
|
|
77
|
+
### 3. Write Instructions
|
|
78
|
+
|
|
79
|
+
- Clear, concise logic
|
|
80
|
+
- Explain the "why" for debugging
|
|
81
|
+
- Include examples if complex
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## Example Hooks
|
|
86
|
+
|
|
87
|
+
### Prevent Dangerous Commands
|
|
88
|
+
|
|
89
|
+
```markdown
|
|
90
|
+
---
|
|
91
|
+
name: prevent-rm-rf
|
|
92
|
+
description: Blocks recursive force delete commands
|
|
93
|
+
trigger: PreToolUse
|
|
94
|
+
tools: ["Bash"]
|
|
95
|
+
pattern: "rm\\s+-rf"
|
|
96
|
+
mode: block
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
This command is blocked for safety. Use explicit file deletion instead.
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Warn on Sensitive Files
|
|
103
|
+
|
|
104
|
+
```markdown
|
|
105
|
+
---
|
|
106
|
+
name: warn-env-access
|
|
107
|
+
description: Warns when accessing environment files
|
|
108
|
+
trigger: PreToolUse
|
|
109
|
+
tools: ["Read", "Edit"]
|
|
110
|
+
pattern: "\\.env"
|
|
111
|
+
mode: warn
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
You're accessing an environment file. Ensure no secrets are exposed.
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## Example Prompts This Skill Handles
|
|
120
|
+
|
|
121
|
+
- "Crie um hook para bloquear comandos perigosos"
|
|
122
|
+
- "Create a safety rule for database operations"
|
|
123
|
+
- "Preciso de uma validação antes de editar arquivos .env"
|
|
124
|
+
- "Make a pre-tool hook that warns about large file writes"
|
|
125
|
+
- "Quero criar regras de segurança customizadas"
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## Integration Notes
|
|
130
|
+
|
|
131
|
+
This skill is part of the **Claude Code Official Skills** collection.
|
|
132
|
+
Namespace: `[OFFICIAL]` - Distinguishes from Mega Brain custom skills.
|
|
133
|
+
|
|
134
|
+
For custom Mega Brain skills, see: `/.claude/skills/`
|