@luanpdd/kit-mcp 1.21.0 → 1.22.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/LICENSE +21 -21
- package/README.md +648 -648
- package/kit/COMANDOS.md +138 -138
- package/kit/README.md +76 -52
- package/kit/agents/advisor-researcher.md +106 -106
- package/kit/agents/assumptions-analyzer.md +107 -107
- package/kit/agents/auditor-consistencia-isolamento.md +380 -0
- package/kit/agents/codebase-mapper.md +768 -768
- package/kit/agents/crm-pipeline-implementer.md +17 -0
- package/kit/agents/debugger.md +772 -772
- package/kit/agents/detector-tenant-quente.md +337 -0
- package/kit/agents/example-reviewer.md +21 -21
- package/kit/agents/executor.md +523 -523
- package/kit/agents/integration-checker.md +200 -200
- package/kit/agents/multi-tenant-isolation-auditor.md +10 -0
- package/kit/agents/nyquist-auditor.md +178 -178
- package/kit/agents/phase-researcher.md +696 -696
- package/kit/agents/plan-checker.md +272 -272
- package/kit/agents/planner.md +891 -891
- package/kit/agents/project-researcher.md +652 -652
- package/kit/agents/research-synthesizer.md +245 -245
- package/kit/agents/roadmapper.md +677 -677
- package/kit/agents/supabase-architect.md +10 -0
- package/kit/agents/supabase-migration-writer.md +12 -0
- package/kit/agents/ui-auditor.md +437 -437
- package/kit/agents/ui-checker.md +302 -302
- package/kit/agents/ui-researcher.md +355 -355
- package/kit/agents/user-profiler.md +175 -175
- package/kit/agents/validador-evolucao-schema.md +335 -0
- package/kit/agents/verifier.md +728 -728
- package/kit/commands/adicionar-backlog.md +75 -75
- package/kit/commands/adicionar-fase.md +42 -42
- package/kit/commands/adicionar-tarefa.md +45 -45
- package/kit/commands/adicionar-testes.md +41 -41
- package/kit/commands/ajuda.md +21 -21
- package/kit/commands/atualizar.md +37 -37
- package/kit/commands/auditar-marco.md +179 -179
- package/kit/commands/auditar-uat.md +23 -23
- package/kit/commands/autonomo.md +40 -40
- package/kit/commands/branch-pr.md +24 -24
- package/kit/commands/concluir-marco.md +247 -247
- package/kit/commands/configuracoes.md +36 -36
- package/kit/commands/dados-distribuidos.md +188 -0
- package/kit/commands/definir-perfil.md +10 -10
- package/kit/commands/depurar.md +190 -190
- package/kit/commands/discutir-fase.md +131 -131
- package/kit/commands/entrar-discord.md +17 -17
- package/kit/commands/estatisticas.md +18 -18
- package/kit/commands/example-greeting.md +33 -33
- package/kit/commands/executar-fase.md +58 -58
- package/kit/commands/expresso.md +56 -56
- package/kit/commands/fase-ui.md +34 -34
- package/kit/commands/fazer.md +57 -57
- package/kit/commands/fio.md +125 -125
- package/kit/commands/fluxos-trabalho.md +64 -64
- package/kit/commands/forense.md +176 -176
- package/kit/commands/gerenciador.md +38 -38
- package/kit/commands/inserir-fase.md +31 -31
- package/kit/commands/limpeza.md +17 -17
- package/kit/commands/listar-hipoteses-fase.md +45 -45
- package/kit/commands/listar-workspaces.md +18 -18
- package/kit/commands/mapear-codebase.md +70 -70
- package/kit/commands/nota.md +33 -33
- package/kit/commands/novo-marco.md +43 -43
- package/kit/commands/novo-projeto.md +41 -41
- package/kit/commands/novo-workspace.md +43 -43
- package/kit/commands/pausar-trabalho.md +37 -37
- package/kit/commands/perfil-usuario.md +45 -45
- package/kit/commands/pesquisar-fase.md +195 -195
- package/kit/commands/planejar-fase.md +67 -67
- package/kit/commands/planejar-lacunas.md +33 -33
- package/kit/commands/plantar-ideia.md +25 -25
- package/kit/commands/progresso.md +24 -24
- package/kit/commands/proximo.md +30 -30
- package/kit/commands/publicar.md +490 -490
- package/kit/commands/rapido.md +35 -35
- package/kit/commands/reaplicar-patches.md +124 -124
- package/kit/commands/relatorio-sessao.md +19 -19
- package/kit/commands/remover-fase.md +31 -31
- package/kit/commands/remover-workspace.md +26 -26
- package/kit/commands/resumo-marco.md +50 -50
- package/kit/commands/retomar-trabalho.md +40 -40
- package/kit/commands/revisar-backlog.md +60 -60
- package/kit/commands/revisar-ui.md +32 -32
- package/kit/commands/revisar.md +37 -37
- package/kit/commands/saude.md +21 -21
- package/kit/commands/setup-notion.md +93 -93
- package/kit/commands/sync-main.md +68 -68
- package/kit/commands/validar-fase.md +35 -35
- package/kit/commands/verificar-tarefas.md +44 -44
- package/kit/commands/verificar-trabalho.md +64 -64
- package/kit/file-manifest.json +27 -15
- package/kit/framework/bin/lib/commands.cjs +959 -959
- package/kit/framework/bin/lib/config.cjs +442 -442
- package/kit/framework/bin/lib/core.cjs +1230 -1230
- package/kit/framework/bin/lib/frontmatter.cjs +336 -336
- package/kit/framework/bin/lib/init.cjs +1442 -1442
- package/kit/framework/bin/lib/milestone.cjs +252 -252
- package/kit/framework/bin/lib/model-profiles.cjs +68 -68
- package/kit/framework/bin/lib/phase.cjs +888 -888
- package/kit/framework/bin/lib/profile-output.cjs +952 -952
- package/kit/framework/bin/lib/profile-pipeline.cjs +539 -539
- package/kit/framework/bin/lib/roadmap.cjs +329 -329
- package/kit/framework/bin/lib/security.cjs +382 -382
- package/kit/framework/bin/lib/state.cjs +1031 -1031
- package/kit/framework/bin/lib/template.cjs +222 -222
- package/kit/framework/bin/lib/uat.cjs +282 -282
- package/kit/framework/bin/lib/verify.cjs +888 -888
- package/kit/framework/bin/lib/workstream.cjs +491 -491
- package/kit/framework/bin/tools.cjs +918 -918
- package/kit/framework/commands/workstreams.md +63 -63
- package/kit/framework/references/checkpoints.md +778 -778
- package/kit/framework/references/continuation-format.md +249 -249
- package/kit/framework/references/decimal-phase-calculation.md +64 -64
- package/kit/framework/references/git-integration.md +295 -295
- package/kit/framework/references/git-planning-commit.md +38 -38
- package/kit/framework/references/model-profile-resolution.md +36 -36
- package/kit/framework/references/model-profiles.md +139 -139
- package/kit/framework/references/phase-argument-parsing.md +61 -61
- package/kit/framework/references/planning-config.md +202 -202
- package/kit/framework/references/questioning.md +162 -162
- package/kit/framework/references/tdd.md +263 -263
- package/kit/framework/references/ui-brand.md +160 -160
- package/kit/framework/references/user-profiling.md +657 -657
- package/kit/framework/references/verification-patterns.md +612 -612
- package/kit/framework/references/workstream-flag.md +58 -58
- package/kit/framework/templates/DEBUG.md +164 -164
- package/kit/framework/templates/UAT.md +265 -265
- package/kit/framework/templates/UI-SPEC.md +100 -100
- package/kit/framework/templates/VALIDATION.md +76 -76
- package/kit/framework/templates/claude-md.md +122 -122
- package/kit/framework/templates/codebase/architecture.md +185 -185
- package/kit/framework/templates/codebase/concerns.md +205 -205
- package/kit/framework/templates/codebase/conventions.md +204 -204
- package/kit/framework/templates/codebase/integrations.md +192 -192
- package/kit/framework/templates/codebase/stack.md +158 -158
- package/kit/framework/templates/codebase/structure.md +199 -199
- package/kit/framework/templates/codebase/testing.md +301 -301
- package/kit/framework/templates/config.json +44 -44
- package/kit/framework/templates/context.md +352 -352
- package/kit/framework/templates/continue-here.md +78 -78
- package/kit/framework/templates/copilot-instructions.md +7 -7
- package/kit/framework/templates/debug-subagent-prompt.md +91 -91
- package/kit/framework/templates/dev-preferences.md +20 -20
- package/kit/framework/templates/discovery.md +146 -146
- package/kit/framework/templates/discussion-log.md +63 -63
- package/kit/framework/templates/milestone-archive.md +123 -123
- package/kit/framework/templates/milestone.md +115 -115
- package/kit/framework/templates/phase-prompt.md +610 -610
- package/kit/framework/templates/planner-subagent-prompt.md +117 -117
- package/kit/framework/templates/project.md +186 -186
- package/kit/framework/templates/requirements.md +231 -231
- package/kit/framework/templates/research-project/ARCHITECTURE.md +204 -204
- package/kit/framework/templates/research-project/FEATURES.md +147 -147
- package/kit/framework/templates/research-project/PITFALLS.md +200 -200
- package/kit/framework/templates/research-project/STACK.md +120 -120
- package/kit/framework/templates/research-project/SUMMARY.md +170 -170
- package/kit/framework/templates/research.md +419 -419
- package/kit/framework/templates/retrospective.md +54 -54
- package/kit/framework/templates/roadmap.md +202 -202
- package/kit/framework/templates/state.md +176 -176
- package/kit/framework/templates/summary-complex.md +59 -59
- package/kit/framework/templates/summary-minimal.md +41 -41
- package/kit/framework/templates/summary-standard.md +48 -48
- package/kit/framework/templates/summary.md +209 -209
- package/kit/framework/templates/user-profile.md +146 -146
- package/kit/framework/templates/user-setup.md +256 -256
- package/kit/framework/templates/verification-report.md +258 -258
- package/kit/framework/workflows/add-phase.md +112 -112
- package/kit/framework/workflows/add-tests.md +351 -351
- package/kit/framework/workflows/add-todo.md +158 -158
- package/kit/framework/workflows/audit-milestone.md +340 -340
- package/kit/framework/workflows/audit-uat.md +109 -109
- package/kit/framework/workflows/autonomous.md +891 -891
- package/kit/framework/workflows/check-todos.md +177 -177
- package/kit/framework/workflows/cleanup.md +152 -152
- package/kit/framework/workflows/complete-milestone.md +696 -696
- package/kit/framework/workflows/diagnose-issues.md +231 -231
- package/kit/framework/workflows/discovery-phase.md +289 -289
- package/kit/framework/workflows/discuss-phase-assumptions.md +653 -653
- package/kit/framework/workflows/discuss-phase.md +784 -784
- package/kit/framework/workflows/do.md +104 -104
- package/kit/framework/workflows/execute-phase.md +838 -838
- package/kit/framework/workflows/execute-plan.md +510 -510
- package/kit/framework/workflows/fast.md +102 -102
- package/kit/framework/workflows/forensics.md +265 -265
- package/kit/framework/workflows/health.md +181 -181
- package/kit/framework/workflows/help.md +619 -619
- package/kit/framework/workflows/insert-phase.md +130 -130
- package/kit/framework/workflows/list-phase-assumptions.md +178 -178
- package/kit/framework/workflows/list-workspaces.md +56 -56
- package/kit/framework/workflows/manager.md +362 -362
- package/kit/framework/workflows/map-codebase.md +377 -377
- package/kit/framework/workflows/milestone-summary.md +223 -223
- package/kit/framework/workflows/new-milestone.md +486 -486
- package/kit/framework/workflows/new-project.md +1159 -1159
- package/kit/framework/workflows/new-workspace.md +237 -237
- package/kit/framework/workflows/next.md +97 -97
- package/kit/framework/workflows/node-repair.md +92 -92
- package/kit/framework/workflows/note.md +156 -156
- package/kit/framework/workflows/pause-work.md +176 -176
- package/kit/framework/workflows/plan-milestone-gaps.md +273 -273
- package/kit/framework/workflows/plan-phase.md +765 -765
- package/kit/framework/workflows/plant-seed.md +169 -169
- package/kit/framework/workflows/pr-branch.md +129 -129
- package/kit/framework/workflows/profile-user.md +450 -450
- package/kit/framework/workflows/progress.md +507 -507
- package/kit/framework/workflows/quick.md +757 -757
- package/kit/framework/workflows/remove-phase.md +155 -155
- package/kit/framework/workflows/remove-workspace.md +90 -90
- package/kit/framework/workflows/research-phase.md +82 -82
- package/kit/framework/workflows/resume-project.md +326 -326
- package/kit/framework/workflows/review.md +228 -228
- package/kit/framework/workflows/session-report.md +146 -146
- package/kit/framework/workflows/settings.md +283 -283
- package/kit/framework/workflows/ship.md +228 -228
- package/kit/framework/workflows/stats.md +60 -60
- package/kit/framework/workflows/transition.md +671 -671
- package/kit/framework/workflows/ui-phase.md +302 -302
- package/kit/framework/workflows/ui-review.md +165 -165
- package/kit/framework/workflows/update.md +323 -323
- package/kit/framework/workflows/validate-phase.md +174 -174
- package/kit/framework/workflows/verify-phase.md +252 -252
- package/kit/framework/workflows/verify-work.md +637 -637
- package/kit/hooks/check-update.js +118 -118
- package/kit/hooks/context-monitor.js +163 -163
- package/kit/hooks/prompt-guard.js +103 -103
- package/kit/hooks/statusline.js +125 -125
- package/kit/hooks/workflow-guard.js +101 -101
- package/kit/settings.json +45 -45
- package/kit/skills/_shared-dados-distribuidos/glossary.md +224 -0
- package/kit/skills/armadilhas-sistemas-distribuidos/SKILL.md +447 -0
- package/kit/skills/audit-log-multi-tenant/SKILL.md +6 -0
- package/kit/skills/cascading-failures/SKILL.md +4 -0
- package/kit/skills/consistencia-leitura-replica/SKILL.md +385 -0
- package/kit/skills/crm-lead-pipeline-patterns/SKILL.md +17 -0
- package/kit/skills/escolha-modelo-consistencia/SKILL.md +495 -0
- package/kit/skills/evolucao-schema-compativel/SKILL.md +448 -0
- package/kit/skills/example-skill/SKILL.md +42 -42
- package/kit/skills/multi-tenant-performance-scaling/SKILL.md +4 -0
- package/kit/skills/multi-tenant-rls-hierarchy/SKILL.md +4 -0
- package/kit/skills/postgres-isolamento-concorrencia/SKILL.md +552 -0
- package/kit/skills/streams-eventos-cdc/SKILL.md +712 -0
- package/kit/skills/supabase-cron-queues/SKILL.md +9 -0
- package/kit/skills/supabase-migrations/SKILL.md +10 -0
- package/kit/skills/super-admin-platform-pattern/SKILL.md +4 -0
- package/kit/skills/tenant-quente-mitigacao/SKILL.md +605 -0
- package/package.json +63 -63
- package/src/core/kit.js +216 -216
- package/src/core/reflect.js +247 -247
- package/src/core/reverse-sync.js +372 -372
- package/src/core/sync.js +418 -418
- package/src/core/watch.js +121 -121
|
@@ -1,101 +1,101 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
// hook-version: 1.30.1
|
|
3
|
-
// SEC-13-05: flush-before-exit category = A (stdout.write + immediate exit)
|
|
4
|
-
// Fix applied: process.stdout.write(payload, () => process.exit(0)) on warning path.
|
|
5
|
-
// framework Workflow Guard — PreToolUse hook
|
|
6
|
-
// Detects when Claude attempts file edits outside a framework workflow context
|
|
7
|
-
// (no active / command or Task subagent) and injects an advisory warning.
|
|
8
|
-
//
|
|
9
|
-
// This is a SOFT guard — it advises, not blocks. The edit still proceeds.
|
|
10
|
-
// The warning nudges Claude to use /quick or /fast instead of
|
|
11
|
-
// making direct edits that bypass state tracking.
|
|
12
|
-
//
|
|
13
|
-
// Enable via config: hooks.workflow_guard: true (default: false)
|
|
14
|
-
// Only triggers on Write/Edit tool calls to non-.planning/ files.
|
|
15
|
-
|
|
16
|
-
const fs = require('fs');
|
|
17
|
-
const path = require('path');
|
|
18
|
-
|
|
19
|
-
let input = '';
|
|
20
|
-
const stdinTimeout = setTimeout(() => process.exit(0), 3000);
|
|
21
|
-
process.stdin.setEncoding('utf8');
|
|
22
|
-
process.stdin.on('data', chunk => input += chunk);
|
|
23
|
-
process.stdin.on('end', () => {
|
|
24
|
-
clearTimeout(stdinTimeout);
|
|
25
|
-
try {
|
|
26
|
-
const data = JSON.parse(input);
|
|
27
|
-
const toolName = data.tool_name;
|
|
28
|
-
|
|
29
|
-
// Only guard Write and Edit tool calls
|
|
30
|
-
if (toolName !== 'Write' && toolName !== 'Edit') {
|
|
31
|
-
process.exit(0);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// Check if we're inside a framework workflow (Task subagent or / command)
|
|
35
|
-
// Subagents have a session_id that differs from the parent
|
|
36
|
-
// and typically have a description field set by the orchestrator
|
|
37
|
-
if (data.tool_input?.is_subagent || data.session_type === 'task') {
|
|
38
|
-
process.exit(0);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// Check the file being edited
|
|
42
|
-
const filePath = data.tool_input?.file_path || data.tool_input?.path || '';
|
|
43
|
-
|
|
44
|
-
// Allow edits to .planning/ files (framework state management)
|
|
45
|
-
if (filePath.includes('.planning/') || filePath.includes('.planning\\')) {
|
|
46
|
-
process.exit(0);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// Allow edits to common config/docs files that don't need framework tracking
|
|
50
|
-
const allowedPatterns = [
|
|
51
|
-
/\.gitignore$/,
|
|
52
|
-
/\.env/,
|
|
53
|
-
/CLAUDE\.md$/,
|
|
54
|
-
/AGENTS\.md$/,
|
|
55
|
-
/GEMINI\.md$/,
|
|
56
|
-
/settings\.json$/,
|
|
57
|
-
];
|
|
58
|
-
if (allowedPatterns.some(p => p.test(filePath))) {
|
|
59
|
-
process.exit(0);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// Check if workflow guard is enabled
|
|
63
|
-
const cwd = data.cwd || process.cwd();
|
|
64
|
-
const configPath = path.join(cwd, '.planning', 'config.json');
|
|
65
|
-
if (fs.existsSync(configPath)) {
|
|
66
|
-
try {
|
|
67
|
-
const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
|
|
68
|
-
if (!config.hooks?.workflow_guard) {
|
|
69
|
-
process.exit(0); // Guard disabled (default)
|
|
70
|
-
}
|
|
71
|
-
} catch (e) {
|
|
72
|
-
process.exit(0);
|
|
73
|
-
}
|
|
74
|
-
} else {
|
|
75
|
-
process.exit(0); // No framework project — don't guard
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
// If we get here: framework project, guard enabled, file edit outside .planning/,
|
|
79
|
-
// not in a subagent context. Inject advisory warning.
|
|
80
|
-
const output = {
|
|
81
|
-
hookSpecificOutput: {
|
|
82
|
-
hookEventName: "PreToolUse",
|
|
83
|
-
additionalContext: `⚠️ AVISO DE FLUXO DE TRABALHO: Você está editando ${path.basename(filePath)} diretamente sem um comando do framework. ` +
|
|
84
|
-
'Esta edição não será rastreada no STATE.md nem produzirá um SUMMARY.md. ' +
|
|
85
|
-
'Considere usar /fast para correções triviais ou /quick para mudanças maiores ' +
|
|
86
|
-
'para manter o rastreamento de estado do projeto. ' +
|
|
87
|
-
'Se isso for intencional (ex.: usuário solicitou explicitamente uma edição direta), prossiga normalmente.'
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
// SEC-13-05: aguardar flush do stdout antes do exit. Sem callback, em
|
|
92
|
-
// pipes lentos (CI/Windows/Git Bash) o JSON pode ser dropado quando o
|
|
93
|
-
// process termina antes do kernel drenar o buffer.
|
|
94
|
-
process.stdout.write(JSON.stringify(output), () => {
|
|
95
|
-
process.exit(0);
|
|
96
|
-
});
|
|
97
|
-
} catch (e) {
|
|
98
|
-
// Silent fail — never block tool execution
|
|
99
|
-
process.exit(0);
|
|
100
|
-
}
|
|
101
|
-
});
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// hook-version: 1.30.1
|
|
3
|
+
// SEC-13-05: flush-before-exit category = A (stdout.write + immediate exit)
|
|
4
|
+
// Fix applied: process.stdout.write(payload, () => process.exit(0)) on warning path.
|
|
5
|
+
// framework Workflow Guard — PreToolUse hook
|
|
6
|
+
// Detects when Claude attempts file edits outside a framework workflow context
|
|
7
|
+
// (no active / command or Task subagent) and injects an advisory warning.
|
|
8
|
+
//
|
|
9
|
+
// This is a SOFT guard — it advises, not blocks. The edit still proceeds.
|
|
10
|
+
// The warning nudges Claude to use /quick or /fast instead of
|
|
11
|
+
// making direct edits that bypass state tracking.
|
|
12
|
+
//
|
|
13
|
+
// Enable via config: hooks.workflow_guard: true (default: false)
|
|
14
|
+
// Only triggers on Write/Edit tool calls to non-.planning/ files.
|
|
15
|
+
|
|
16
|
+
const fs = require('fs');
|
|
17
|
+
const path = require('path');
|
|
18
|
+
|
|
19
|
+
let input = '';
|
|
20
|
+
const stdinTimeout = setTimeout(() => process.exit(0), 3000);
|
|
21
|
+
process.stdin.setEncoding('utf8');
|
|
22
|
+
process.stdin.on('data', chunk => input += chunk);
|
|
23
|
+
process.stdin.on('end', () => {
|
|
24
|
+
clearTimeout(stdinTimeout);
|
|
25
|
+
try {
|
|
26
|
+
const data = JSON.parse(input);
|
|
27
|
+
const toolName = data.tool_name;
|
|
28
|
+
|
|
29
|
+
// Only guard Write and Edit tool calls
|
|
30
|
+
if (toolName !== 'Write' && toolName !== 'Edit') {
|
|
31
|
+
process.exit(0);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Check if we're inside a framework workflow (Task subagent or / command)
|
|
35
|
+
// Subagents have a session_id that differs from the parent
|
|
36
|
+
// and typically have a description field set by the orchestrator
|
|
37
|
+
if (data.tool_input?.is_subagent || data.session_type === 'task') {
|
|
38
|
+
process.exit(0);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Check the file being edited
|
|
42
|
+
const filePath = data.tool_input?.file_path || data.tool_input?.path || '';
|
|
43
|
+
|
|
44
|
+
// Allow edits to .planning/ files (framework state management)
|
|
45
|
+
if (filePath.includes('.planning/') || filePath.includes('.planning\\')) {
|
|
46
|
+
process.exit(0);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Allow edits to common config/docs files that don't need framework tracking
|
|
50
|
+
const allowedPatterns = [
|
|
51
|
+
/\.gitignore$/,
|
|
52
|
+
/\.env/,
|
|
53
|
+
/CLAUDE\.md$/,
|
|
54
|
+
/AGENTS\.md$/,
|
|
55
|
+
/GEMINI\.md$/,
|
|
56
|
+
/settings\.json$/,
|
|
57
|
+
];
|
|
58
|
+
if (allowedPatterns.some(p => p.test(filePath))) {
|
|
59
|
+
process.exit(0);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Check if workflow guard is enabled
|
|
63
|
+
const cwd = data.cwd || process.cwd();
|
|
64
|
+
const configPath = path.join(cwd, '.planning', 'config.json');
|
|
65
|
+
if (fs.existsSync(configPath)) {
|
|
66
|
+
try {
|
|
67
|
+
const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
|
|
68
|
+
if (!config.hooks?.workflow_guard) {
|
|
69
|
+
process.exit(0); // Guard disabled (default)
|
|
70
|
+
}
|
|
71
|
+
} catch (e) {
|
|
72
|
+
process.exit(0);
|
|
73
|
+
}
|
|
74
|
+
} else {
|
|
75
|
+
process.exit(0); // No framework project — don't guard
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// If we get here: framework project, guard enabled, file edit outside .planning/,
|
|
79
|
+
// not in a subagent context. Inject advisory warning.
|
|
80
|
+
const output = {
|
|
81
|
+
hookSpecificOutput: {
|
|
82
|
+
hookEventName: "PreToolUse",
|
|
83
|
+
additionalContext: `⚠️ AVISO DE FLUXO DE TRABALHO: Você está editando ${path.basename(filePath)} diretamente sem um comando do framework. ` +
|
|
84
|
+
'Esta edição não será rastreada no STATE.md nem produzirá um SUMMARY.md. ' +
|
|
85
|
+
'Considere usar /fast para correções triviais ou /quick para mudanças maiores ' +
|
|
86
|
+
'para manter o rastreamento de estado do projeto. ' +
|
|
87
|
+
'Se isso for intencional (ex.: usuário solicitou explicitamente uma edição direta), prossiga normalmente.'
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
// SEC-13-05: aguardar flush do stdout antes do exit. Sem callback, em
|
|
92
|
+
// pipes lentos (CI/Windows/Git Bash) o JSON pode ser dropado quando o
|
|
93
|
+
// process termina antes do kernel drenar o buffer.
|
|
94
|
+
process.stdout.write(JSON.stringify(output), () => {
|
|
95
|
+
process.exit(0);
|
|
96
|
+
});
|
|
97
|
+
} catch (e) {
|
|
98
|
+
// Silent fail — never block tool execution
|
|
99
|
+
process.exit(0);
|
|
100
|
+
}
|
|
101
|
+
});
|
package/kit/settings.json
CHANGED
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
{
|
|
2
|
-
"permissions": {
|
|
3
|
-
"allow": []
|
|
4
|
-
},
|
|
5
|
-
"hooks": {
|
|
6
|
-
"SessionStart": [
|
|
7
|
-
{
|
|
8
|
-
"hooks": [
|
|
9
|
-
{
|
|
10
|
-
"type": "command",
|
|
11
|
-
"command": "node .claude/hooks/check-update.js"
|
|
12
|
-
}
|
|
13
|
-
]
|
|
14
|
-
}
|
|
15
|
-
],
|
|
16
|
-
"PostToolUse": [
|
|
17
|
-
{
|
|
18
|
-
"matcher": "Bash|Edit|Write|MultiEdit|Agent|Task",
|
|
19
|
-
"hooks": [
|
|
20
|
-
{
|
|
21
|
-
"type": "command",
|
|
22
|
-
"command": "node .claude/hooks/context-monitor.js",
|
|
23
|
-
"timeout": 10
|
|
24
|
-
}
|
|
25
|
-
]
|
|
26
|
-
}
|
|
27
|
-
],
|
|
28
|
-
"PreToolUse": [
|
|
29
|
-
{
|
|
30
|
-
"matcher": "Write|Edit",
|
|
31
|
-
"hooks": [
|
|
32
|
-
{
|
|
33
|
-
"type": "command",
|
|
34
|
-
"command": "node .claude/hooks/prompt-guard.js",
|
|
35
|
-
"timeout": 5
|
|
36
|
-
}
|
|
37
|
-
]
|
|
38
|
-
}
|
|
39
|
-
]
|
|
40
|
-
},
|
|
41
|
-
"statusLine": {
|
|
42
|
-
"type": "command",
|
|
43
|
-
"command": "node .claude/hooks/statusline.js"
|
|
44
|
-
}
|
|
45
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"permissions": {
|
|
3
|
+
"allow": []
|
|
4
|
+
},
|
|
5
|
+
"hooks": {
|
|
6
|
+
"SessionStart": [
|
|
7
|
+
{
|
|
8
|
+
"hooks": [
|
|
9
|
+
{
|
|
10
|
+
"type": "command",
|
|
11
|
+
"command": "node .claude/hooks/check-update.js"
|
|
12
|
+
}
|
|
13
|
+
]
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
"PostToolUse": [
|
|
17
|
+
{
|
|
18
|
+
"matcher": "Bash|Edit|Write|MultiEdit|Agent|Task",
|
|
19
|
+
"hooks": [
|
|
20
|
+
{
|
|
21
|
+
"type": "command",
|
|
22
|
+
"command": "node .claude/hooks/context-monitor.js",
|
|
23
|
+
"timeout": 10
|
|
24
|
+
}
|
|
25
|
+
]
|
|
26
|
+
}
|
|
27
|
+
],
|
|
28
|
+
"PreToolUse": [
|
|
29
|
+
{
|
|
30
|
+
"matcher": "Write|Edit",
|
|
31
|
+
"hooks": [
|
|
32
|
+
{
|
|
33
|
+
"type": "command",
|
|
34
|
+
"command": "node .claude/hooks/prompt-guard.js",
|
|
35
|
+
"timeout": 5
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
]
|
|
40
|
+
},
|
|
41
|
+
"statusLine": {
|
|
42
|
+
"type": "command",
|
|
43
|
+
"command": "node .claude/hooks/statusline.js"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
# Glossário Dados Distribuídos — Termos, Patterns e Convenções
|
|
2
|
+
|
|
3
|
+
> Arquivo de referência compartilhado pelas skills da Suíte DDIA Foundations v1.22 (capítulos 4, 5, 6, 7, 8, 9 e 11 de *Designing Data-Intensive Applications*, Martin Kleppmann, O'Reilly 2017, ISBN 978-1-449-37332-0). **NÃO é skill** — não tem `description:` triggerável; não aparece em `listKit`. Cross-referenciado pelas 7 skills da suíte via Markdown link relativo.
|
|
4
|
+
>
|
|
5
|
+
> **Cross-suite reference ATIVO:** termos Supabase já definidos em [`_shared-supabase/glossary.md`](../_shared-supabase/glossary.md) (v1.8) e termos multi-tenant em [`_shared-multi-tenant/glossary.md`](../_shared-multi-tenant/glossary.md) (v1.21) — esta skill **não duplica**, apenas linka. Termos como `RLS`, `STABLE`, `pgmq`, `pg_cron`, `wal2json`, `tenant`, `org_id`, `audit log`, `RBAC` são definidos lá.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## (a) Termos PT-BR ↔ EN — Modelos de Consistência (Ch 5, 9)
|
|
10
|
+
|
|
11
|
+
| EN | PT-BR / Significado |
|
|
12
|
+
|---|---|
|
|
13
|
+
| **linearizability** | **Linearizabilidade** — modelo de consistência forte: dados replicados aparecem como uma única cópia, todas as operações executam atomicamente em uma ordem total única. Behavior = "variável em programa single-threaded". Custo: lento em redes com latência alta. Postgres single-leader oferece linearizabilidade no líder; réplicas físicas não. |
|
|
14
|
+
| **causal consistency** | **Consistência causal** — modelo mais fraco que linearizabilidade: preserva ordem de eventos relacionados causalmente (causa antes do efeito), permite eventos concorrentes em qualquer ordem. Sem overhead de coordenação global. Adequado para chat/colaboração onde "resposta vem após pergunta" mas mensagens paralelas podem ter ordem livre. |
|
|
15
|
+
| **eventual consistency** | **Consistência eventual** — modelo fraco: réplicas convergem ao mesmo estado *eventualmente* se as escritas pararem. Sem garantia de quando. Usado em feeds sociais, contadores, analytics. Anti-pattern: usar para invariantes (uniqueness, saldo financeiro). |
|
|
16
|
+
| **read-after-write consistency** | **Consistência leitura-após-escrita** — usuário sempre vê os próprios writes mais recentes (mesmo lendo de réplica). Solução típica: roteamento sticky por `user_id` ou ler do líder por janela de tempo após write. |
|
|
17
|
+
| **monotonic reads** | **Leituras monotônicas** — garantia de que leituras sucessivas do mesmo usuário não "voltam no tempo". Solução: sticky session por user para a mesma réplica. |
|
|
18
|
+
| **consistent prefix reads** | **Prefixo causal consistente** — observador vê escritas em uma ordem que respeita causalidade (efeito não aparece antes da causa). Solução: log de replicação com partição por chave causal. |
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## (b) Termos PT-BR ↔ EN — Replicação (Ch 5)
|
|
23
|
+
|
|
24
|
+
| EN | PT-BR / Significado |
|
|
25
|
+
|---|---|
|
|
26
|
+
| **leader-follower replication** | **Replicação líder-seguidor** — single-leader: clientes mandam writes ao líder, líder propaga eventos de mudança aos seguidores (réplicas). Reads podem ser feitos em qualquer réplica (sujeito a lag). Pattern Postgres + read replicas Supabase Pro+. |
|
|
27
|
+
| **multi-leader replication** | **Replicação multi-líder** — clientes mandam writes a qualquer um dos líderes, líderes sincronizam entre si. Robusto contra falhas/latência mas complexo (resolução de conflitos). Raramente usado em Supabase. |
|
|
28
|
+
| **leaderless replication** | **Replicação sem líder** — clientes mandam write a N nodes, leem de M nodes em paralelo, detectam stale reads. Usado em Cassandra/DynamoDB; fora do escopo Supabase. |
|
|
29
|
+
| **replication lag** | **Atraso de replicação** — diferença temporal entre commit no líder e visibilidade na réplica. Tipicamente <100ms em Supabase mas pode crescer sob carga. Mensurável via `pg_last_wal_replay_lsn()`. |
|
|
30
|
+
| **synchronous replication** | **Replicação síncrona** — líder confirma write apenas após replicar para ≥1 seguidor. Garante zero data loss em failover; custo de latência. |
|
|
31
|
+
| **asynchronous replication** | **Replicação assíncrona** — líder confirma write antes de replicar. Default Postgres. Risco: failover em momento de lag perde writes. |
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## (c) Termos PT-BR ↔ EN — Transações e Isolamento (Ch 7)
|
|
36
|
+
|
|
37
|
+
> Termos canônicos do livro DDIA + manual oficial Postgres preservados em EN (não traduzir nas descrições internas).
|
|
38
|
+
|
|
39
|
+
| EN | PT-BR / Significado |
|
|
40
|
+
|---|---|
|
|
41
|
+
| **dirty read** | **Leitura suja** — transação A lê dados não-commitados de transação B. Prevenido por READ COMMITTED e níveis acima (default Postgres). |
|
|
42
|
+
| **dirty write** | **Escrita suja** — transação A sobrescreve write não-commitado de transação B. Prevenido por todas as implementações de transação. |
|
|
43
|
+
| **read skew** | **Distorção de leitura (não-repeatable read)** — cliente vê partes do DB em diferentes pontos no tempo durante a mesma transação. Prevenido por snapshot isolation (REPEATABLE READ Postgres). |
|
|
44
|
+
| **lost update** | **Atualização perdida** — duas transações fazem read-modify-write concorrente; uma sobrescreve o write da outra sem incorporar suas mudanças. Prevenido por: `SELECT FOR UPDATE` (lock pessimista), CAS atomic com `WHERE version = $v` (lock otimista), ou `pg_advisory_xact_lock`. |
|
|
45
|
+
| **write skew** | **Distorção de escrita** — transação lê algo, decide com base no valor, escreve a decisão. Mas a premissa da decisão é invalidada pelo write concorrente de outra transação. Apenas **serializable isolation** previne completamente. Mitigação no nível do app: materializar o conflito via `SELECT ... FOR UPDATE` em todas as rows do predicate. |
|
|
46
|
+
| **phantom read** | **Leitura fantasma** — transação lê objetos que casam com search condition; outra transação muda resultados via insert/delete. Snapshot isolation previne phantoms simples; phantoms no contexto de write skew exigem index-range locks ou SSI. |
|
|
47
|
+
| **MVCC** | **Multi-version concurrency control** — Postgres mantém múltiplas versões da mesma row; readers veem a versão consistente do snapshot da transação, sem bloquear writers. Base do REPEATABLE READ no Postgres. Visualizado via `xmin`/`xmax`. |
|
|
48
|
+
| **snapshot isolation** | **Isolamento de snapshot** — transação lê de um snapshot consistente do DB tirado no início. Postgres REPEATABLE READ implementa via MVCC. Não previne write skew nem lost update genérico. |
|
|
49
|
+
| **serializable snapshot isolation (SSI)** | **Isolamento de snapshot serializável (SSI)** — algoritmo otimista: transações executam sem bloquear; ao commit, sistema verifica se a execução foi serializável e aborta se não. Postgres SERIALIZABLE = SSI desde 9.1. Predicate-aware (detecta conflitos de write skew automaticamente). Trade-off: aborts esporádicos, app precisa retry. |
|
|
50
|
+
| **two-phase locking (2PL)** | **Bloqueio em duas fases** — abordagem clássica de serializability: cada transação adquire locks em todas as rows lidas/escritas (fase 1) e libera no commit (fase 2). Custo de performance alto; raramente usado em Postgres moderno. |
|
|
51
|
+
| **predicate lock** | **Lock por predicado** — lock que cobre não apenas rows existentes mas também rows futuras que casariam com o predicate. Necessário para prevenir phantoms em SSI. |
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## (d) Termos PT-BR ↔ EN — Particionamento e Tenant Quente (Ch 6)
|
|
56
|
+
|
|
57
|
+
| EN | PT-BR / Significado |
|
|
58
|
+
|---|---|
|
|
59
|
+
| **partition / shard** | **Partição / shard** — divisão horizontal de uma tabela: cada subset reside em uma partição separada. Postgres native via `PARTITION BY` (range/hash/list); Supabase suporta. |
|
|
60
|
+
| **range partitioning** | **Particionamento por range** — partições por intervalos contínuos da chave (ex: `created_at` por mês). Bom para range scans; risco de hot partition na partição mais recente. |
|
|
61
|
+
| **hash partitioning** | **Particionamento por hash** — partições pela função hash da chave (ex: `HASH (org_id) PARTITIONS 16`). Distribuição uniforme; perde locality para range scans. |
|
|
62
|
+
| **hot partition / hot tenant** | **Partição quente / tenant quente** — partição/tenant que recebe desproporcionalmente mais traffic que a média (3×–100×). Caso canônico no livro: "tenant Justin Bieber" (celebridade que gera 1000× tráfego de um usuário comum). Detecção: queries/min ratio, storage GB ratio, slots de conexão ratio agrupados por `tenant_id`. |
|
|
63
|
+
| **document-partitioned secondary index** | **Índice secundário particionado por documento** — índice secundário local em cada partição. Query cross-partition precisa scatter-gather (mais lento); writes baratos. Default recomendado no livro. |
|
|
64
|
+
| **term-partitioned secondary index** | **Índice secundário particionado por termo** — índice global organizado pelo valor indexado. Query rápida; writes caros (precisa atualizar índice em outra partição). |
|
|
65
|
+
| **rebalancing** | **Rebalanceamento** — redistribuir dados entre partições conforme volume cresce ou tenants ficam quentes. Estratégias: hash mod N (ruim, requer remap total ao adicionar node), consistent hashing, partitioning fixo (hash partitions = N nodes adiciona node = move 1/N partitions). |
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## (e) Termos PT-BR ↔ EN — Sistemas Distribuídos: Armadilhas (Ch 8)
|
|
70
|
+
|
|
71
|
+
| EN | PT-BR / Significado |
|
|
72
|
+
|---|---|
|
|
73
|
+
| **partial failure** | **Falha parcial** — sistema distribuído onde alguns nodes funcionam e outros não. Detecção via timeouts é falaciosa (lento ≠ morto). Mitigação: consenso de N-1 nodes, não decisão unilateral. |
|
|
74
|
+
| **clock skew** | **Desvio de relógio** — relógios de diferentes nodes podem divergir significativamente (mesmo com NTP). NUNCA usar `clock_timestamp()` para lógica de expiração. Em Postgres: `now()` = início da transação (monotônico dentro), `clock_timestamp()` = wall clock real (pode pular para trás), `transaction_timestamp()` = alias para `now()`. |
|
|
75
|
+
| **fencing token** | **Token de fencing (cerca)** — número monotônico crescente associado a uma lock/lease. Storage rejeita writes com token < último visto. Previne split-brain quando processo sofre GC pause, perde a lease, e volta sem saber. Implementação Postgres: `pg_advisory_xact_lock(hashtext('lock_name'))` + sequence monotônica para o ID. |
|
|
76
|
+
| **GC pause / process pause** | **Pausa de GC / processo** — processo congela por segundos (garbage collector stop-the-world, swap para disco, virtualização). Outros nodes assumem que morreu, fazem failover; processo volta achando que ainda tem a lease. Mitigação: fencing token. |
|
|
77
|
+
| **byzantine fault** | **Falha bizantina** — node mente / envia mensagens corrompidas / age maliciosamente. Fora do escopo de aplicações típicas (apenas blockchain / safety-critical). Default em Supabase: assumir crash-recovery model (node pode reiniciar com estado parcial), não byzantine. |
|
|
78
|
+
| **phi accrual failure detector** | **Detector de falha phi accrual** — algoritmo probabilístico que estima a chance de um node estar morto baseado no histórico de heartbeats. Substitui timeout fixo binário. |
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## (f) Termos PT-BR ↔ EN — Consensus (Ch 9)
|
|
83
|
+
|
|
84
|
+
| EN | PT-BR / Significado |
|
|
85
|
+
|---|---|
|
|
86
|
+
| **consensus** | **Consenso** — N nodes concordam em uma decisão única e irrevogável (qual node é líder, qual valor a write tomou). Necessário para uniqueness constraints distribuídos, eleição de líder, total order broadcast. |
|
|
87
|
+
| **total order broadcast** | **Broadcast de ordem total** — entrega de mensagens a todos os nodes na mesma ordem. Reducível a consenso. Em Postgres: WAL é total order broadcast natural para replicação. |
|
|
88
|
+
| **two-phase commit (2PC)** | **Commit em duas fases (2PC)** — protocolo de commit atômico distribuído: coordinator pergunta "prepared?" a todos participants (fase 1), depois envia "commit/abort" (fase 2). Limitações: blocking se coordinator morre, performance impact, falta de heuristic recovery. Alternativas modernas: sagas, transactional outbox. |
|
|
89
|
+
| **saga pattern** | **Saga** — alternativa a 2PC para transações distribuídas: sequência de transações locais, cada uma com compensating action que desfaz se step posterior falhar. |
|
|
90
|
+
| **transactional outbox** | **Outbox transacional** — pattern de publishing eventos atomic com write no DB: `INSERT INTO outbox (event) VALUES (...)` na mesma transação do `UPDATE` principal; processador async lê outbox e publica no broker. Garante exactly-once entre DB e broker. |
|
|
91
|
+
| **CAP theorem** | **Teorema CAP** — durante partição de rede, sistema escolhe Consistency (C) OU Availability (A); Partition tolerance (P) é dada (rede falha sempre). Postgres single-leader = CP (rejeita writes). |
|
|
92
|
+
| **PACELC** | **PACELC** — extensão prática do CAP: durante Partição = escolher A vs C; Else (operação normal) = escolher Latency vs Consistency. Quadrante real onde sistemas vivem. |
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## (g) Termos PT-BR ↔ EN — Encoding e Evolução (Ch 4)
|
|
97
|
+
|
|
98
|
+
| EN | PT-BR / Significado |
|
|
99
|
+
|---|---|
|
|
100
|
+
| **encoding / serialization** | **Encoding / serialização** — converter representação in-memory (objetos, structs) em sequência de bytes para storage/network. Reversa = decoding/deserialization. |
|
|
101
|
+
| **backward compatibility** | **Compat backward** — código novo lê dados escritos por código antigo. Geralmente fácil (autor do código novo conhece formato antigo). |
|
|
102
|
+
| **forward compatibility** | **Compat forward** — código antigo lê dados escritos por código novo. Mais difícil — código antigo precisa ignorar campos novos sem quebrar. |
|
|
103
|
+
| **rolling upgrade / staged rollout** | **Rolling upgrade / rollout escalonado** — deploy gradual: nova versão sobe em poucos nodes primeiro, validação, depois espalha. Permite zero downtime + rollback rápido se v2 quebrar. Pré-requisito: backward + forward compat dos dados em trânsito. |
|
|
104
|
+
| **schema evolution** | **Evolução de schema** — mudança no schema de dados ao longo do tempo (add field, drop field, rename, type change) preservando compat. Avro/Protobuf têm regras formais; Postgres precisa de pattern 3-passos. |
|
|
105
|
+
| **Avro** | Sistema de encoding binário schema-driven (Apache). Reader's schema diferente do writer's schema é resolvido via schema resolution rules. |
|
|
106
|
+
| **Protocol Buffers / Protobuf** | Sistema de encoding binário schema-driven (Google). Field tags numéricos preservam compat; `optional` campos nunca quebram leitura. |
|
|
107
|
+
| **Thrift** | Sistema de encoding binário schema-driven (Facebook). Similar a Protobuf em garantias de compat. |
|
|
108
|
+
| **schema registry** | **Registro de schemas** — serviço central que armazena schemas versionados (typically para Avro/Kafka). Cada mensagem carrega ID do schema; consumer puxa schema do registry para deserializar. |
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## (h) Termos PT-BR ↔ EN — Streams de Eventos (Ch 11)
|
|
113
|
+
|
|
114
|
+
| EN | PT-BR / Significado |
|
|
115
|
+
|---|---|
|
|
116
|
+
| **AMQP/JMS-style broker** | **Broker AMQP/JMS-style** — broker assigna mensagens individuais a consumers; consumer faz ack; mensagem deletada após ack. Ex: RabbitMQ, postgres LISTEN/NOTIFY. Adequado para task queue onde ordem não importa. |
|
|
117
|
+
| **log-based broker** | **Broker baseado em log** — broker grava mensagens em log append-only particionado; consumer rastreia offset; mensagens permanecem no disk (replayable). Ex: Kafka, pgmq. Adequado para stream processing. |
|
|
118
|
+
| **CDC** | **Change Data Capture** — captura mudanças no DB como stream de eventos. Em Postgres: `wal2json`, Supabase Realtime broadcast, `pglogical`. Use cases: sync índice de busca, desnormalização, sync multi-region. |
|
|
119
|
+
| **event sourcing** | **Event sourcing** — eventos imutáveis são source of truth; estado atual é projeção. Em Postgres: tabela append-only de eventos + projeções via Materialized Views ou trigger. Audit log v1.21 = event sourcing parcial. |
|
|
120
|
+
| **exactly-once semantics** | **Semântica exactly-once** — cada evento processado uma e somente uma vez. Implementação Postgres: idempotency key + unique constraint, transactional outbox. |
|
|
121
|
+
| **at-least-once semantics** | **Semântica at-least-once** — evento pode ser entregue mais de uma vez (retry após crash). Default Meta Cloud API webhooks. App precisa idempotency. |
|
|
122
|
+
| **stream-stream join** | **Join stream-stream** — match entre dois streams dentro de janela temporal (ex: pedido + pagamento dentro de 5min). |
|
|
123
|
+
| **stream-table join** | **Join stream-table** — stream de eventos enriquecido com lookup em changelog table (CDC + atividade). |
|
|
124
|
+
| **table-table join** | **Join table-table** — merge de dois changelogs CDC, produzindo stream de mudanças da view materializada. |
|
|
125
|
+
| **log compaction** | **Compactação de log** — para cada chave, manter apenas o último valor (não toda história). Pgmq usa retention TTL via `vacuum_archive`; event sourcing precisa snapshot periódico. |
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## (i) Convenção de naming PT-BR (a partir de v1.22)
|
|
130
|
+
|
|
131
|
+
A partir do milestone v1.22 (Suíte DDIA Foundations), o kit-mcp adota **PT-BR como linguagem default** para naming de skills, agents, commands e diretórios `_shared-*`. Esta seção é a **referência canônica** consumida pelas 7 skills da suíte e pelas suítes futuras.
|
|
132
|
+
|
|
133
|
+
### Regras
|
|
134
|
+
|
|
135
|
+
| Regra | Aplicação | Exemplo |
|
|
136
|
+
|---|---|---|
|
|
137
|
+
| **Novos artefatos: PT-BR** | Skills/agents/commands criados a partir de v1.22 usam nomes PT-BR | `evolucao-schema-compativel`, `tenant-quente-mitigacao`, `auditor-consistencia-isolamento` |
|
|
138
|
+
| **Termos técnicos canônicos preservados** | Termos do manual oficial Postgres, livros DDIA/SRE/Feathers, RFCs e specs ficam em EN dentro de descrições/conteúdo | `write skew`, `lost update`, `MVCC`, `RLS`, `CDC`, `snapshot isolation`, `fencing token`, `linearizability` |
|
|
139
|
+
| **Artefatos pré-v1.22 NÃO renomeados** | Skills/agents/commands de v1.0 → v1.21 mantêm nomes EN para preservar discoverability via `mcp__kit__list_kit` e quebra zero de cross-refs externos | `multi-tenant-rls-hierarchy` (v1.21), `supabase-edge-functions` (v1.8), `core-analysis-loop` (v1.10) |
|
|
140
|
+
| **Diretórios `_shared-*` PT-BR** | Novos diretórios compartilhados usam PT-BR | `_shared-dados-distribuidos` (v1.22) vs `_shared-multi-tenant` (v1.21, mantido) |
|
|
141
|
+
| **Code blocks SQL/TS em EN** | Identificadores SQL e TypeScript permanecem em EN; comentários acima do código em PT-BR | `-- Adiciona coluna nullable\nalter table public.leads add column phone_country text;` |
|
|
142
|
+
| **Headings de skill em PT-BR** | Títulos de seção em PT-BR; termos técnicos canônicos preservados na descrição | `## Quando usar`, `## Regras absolutas`, `## Patterns canônicos`, `## Anti-patterns`, `## Ver também` |
|
|
143
|
+
| **Frontmatter `description:` em PT-BR** | Início da descrição em PT-BR; termos técnicos preservados | `description: Use ao escrever migration Postgres ... padrão 3-passos (adicionar nullable → backfill em batches → impor NOT NULL), análogos Avro/Protobuf...` |
|
|
144
|
+
|
|
145
|
+
### Exemplos lado a lado
|
|
146
|
+
|
|
147
|
+
```
|
|
148
|
+
# v1.22 (PT-BR novo)
|
|
149
|
+
kit/skills/evolucao-schema-compativel/SKILL.md
|
|
150
|
+
kit/skills/tenant-quente-mitigacao/SKILL.md
|
|
151
|
+
kit/skills/postgres-isolamento-concorrencia/SKILL.md
|
|
152
|
+
kit/agents/auditor-consistencia-isolamento.md
|
|
153
|
+
kit/commands/dados-distribuidos.md
|
|
154
|
+
kit/skills/_shared-dados-distribuidos/glossary.md
|
|
155
|
+
|
|
156
|
+
# v1.21 (EN preservado, NÃO renomeado)
|
|
157
|
+
kit/skills/multi-tenant-rls-hierarchy/SKILL.md
|
|
158
|
+
kit/skills/audit-log-multi-tenant/SKILL.md
|
|
159
|
+
kit/agents/multi-tenant-isolation-auditor.md
|
|
160
|
+
kit/commands/multi-tenant.md
|
|
161
|
+
kit/skills/_shared-multi-tenant/glossary.md
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### Rationale
|
|
165
|
+
|
|
166
|
+
1. **Alinhamento com o usuário primário** do kit-mcp (português brasileiro) — nomes de comandos digitados frequentemente devem ser legíveis na língua nativa.
|
|
167
|
+
2. **Preservação de termos canônicos** porque o vocabulário técnico (write skew, MVCC, RLS, CDC) é o mesmo em qualquer língua e está consagrado na literatura — traduzir cria ambiguidade ("distorção de escrita" sozinho ≠ "write skew" para quem busca via Google).
|
|
168
|
+
3. **Não-renomeação retroativa** evita quebra silenciosa de cross-refs entre skills (`see also: multi-tenant-rls-hierarchy`), bookmarks de usuários, e referências externas em PRs/Notion.
|
|
169
|
+
|
|
170
|
+
### Checklist para skill v1.22+
|
|
171
|
+
|
|
172
|
+
- [ ] Nome do diretório/arquivo em PT-BR (kebab-case)
|
|
173
|
+
- [ ] Frontmatter `description:` começa em PT-BR
|
|
174
|
+
- [ ] Termos técnicos canônicos preservados em EN dentro da descrição
|
|
175
|
+
- [ ] Headings em PT-BR
|
|
176
|
+
- [ ] Texto narrativo em PT-BR
|
|
177
|
+
- [ ] Code blocks SQL/TS em EN; comentários em PT-BR
|
|
178
|
+
- [ ] Cross-refs ATIVOS (link Markdown relativo) para glossário e skills relacionadas — sem duplicar definições
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
## (j) Cross-Refs Externos
|
|
183
|
+
|
|
184
|
+
- [Designing Data-Intensive Applications, Martin Kleppmann (O'Reilly 2017)](https://www.oreilly.com/library/view/designing-data-intensive-applications/9781491903063/) — fonte canônica desta suíte
|
|
185
|
+
- [PostgreSQL Documentation — Concurrency Control](https://www.postgresql.org/docs/current/mvcc.html)
|
|
186
|
+
- [PostgreSQL Documentation — Transaction Isolation](https://www.postgresql.org/docs/current/transaction-iso.html)
|
|
187
|
+
- [Apache Avro — Schema Evolution](https://avro.apache.org/docs/current/spec.html#Schema+Resolution)
|
|
188
|
+
- [Protocol Buffers — Updating Message Types](https://protobuf.dev/programming-guides/proto3/#updating)
|
|
189
|
+
- [Martin Kleppmann blog — Schema evolution in Avro, Protocol Buffers and Thrift](https://martin.kleppmann.com/2012/12/05/schema-evolution-in-avro-protocol-buffers-thrift.html)
|
|
190
|
+
- [Supabase Supavisor 1M Connections](https://supabase.com/blog/supavisor-1-million)
|
|
191
|
+
- [PostgreSQL Wiki — Loose indexscan / Hot update / pg_stat_statements](https://wiki.postgresql.org/)
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
## (k) Cross-Suite Invocation Pattern (herdado de v1.21)
|
|
196
|
+
|
|
197
|
+
Skills da Suíte DDIA Foundations **não duplicam** lógica das suítes anteriores. Padrão canônico de delegação:
|
|
198
|
+
|
|
199
|
+
```
|
|
200
|
+
evolucao-schema-compativel (v1.22)
|
|
201
|
+
├─ cross-ref ativo para supabase-migrations (v1.8) — naming convention + RLS obrigatório
|
|
202
|
+
└─ cross-ref ativo para supabase-declarative-schema (v1.8) — workflow stop → db diff → revisar
|
|
203
|
+
|
|
204
|
+
tenant-quente-mitigacao (v1.22)
|
|
205
|
+
├─ cross-ref ativo para multi-tenant-performance-scaling (v1.21) — Supavisor + partial indexes
|
|
206
|
+
└─ cross-ref ativo para b2b-saas-architecture (v1.21) — Single Schema + org_id default
|
|
207
|
+
|
|
208
|
+
streams-eventos-cdc (v1.22)
|
|
209
|
+
├─ cross-ref ativo para supabase-cron-queues (v1.8) — pg_cron + pgmq pattern
|
|
210
|
+
├─ cross-ref ativo para audit-log-multi-tenant (v1.21) — append-only event sourcing semântica
|
|
211
|
+
└─ cross-ref ativo para supabase-realtime (v1.8) — broadcast como CDC stream
|
|
212
|
+
|
|
213
|
+
postgres-isolamento-concorrencia (v1.22)
|
|
214
|
+
└─ cross-ref ativo para supabase-database-functions (v1.8) — STABLE/IMMUTABLE/VOLATILE markers
|
|
215
|
+
|
|
216
|
+
auditor-consistencia-isolamento (v1.22)
|
|
217
|
+
└─→ Task(supabase-migration-writer) # SQL final corrigido
|
|
218
|
+
└─→ Task(supabase-edge-fn-writer) # Edge Function instrumentada
|
|
219
|
+
|
|
220
|
+
validador-evolucao-schema (v1.22)
|
|
221
|
+
└─ invocado por supabase-migration-writer (v1.8) ANTES de escrever migration arriscada
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
**Anti-pattern:** skill v1.22 reescrever lógica RLS multi-tenant do zero (deve cross-ref). Agent v1.22 escrever migration direta (deve delegar para `supabase-migration-writer`).
|