@luanpdd/kit-mcp 1.35.0 → 1.36.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/bin/cli.js +2 -2
  2. package/bin/mcp.js +6 -6
  3. package/bin/ui.js +74 -74
  4. package/gates/ai-prompt-stability.md +120 -120
  5. package/gates/budget-description.md +68 -68
  6. package/gates/confidence.md +29 -29
  7. package/gates/dependency-check.md +33 -33
  8. package/gates/dept-cycle-prevention.md +179 -179
  9. package/gates/golden-signals-coverage.md +133 -133
  10. package/gates/legacy-refactor-safety.md +178 -178
  11. package/gates/multi-tenant-rls-coverage.md +102 -102
  12. package/gates/no-personal-uuid.md +72 -72
  13. package/gates/obs-agents-mcp-supabase.md +86 -86
  14. package/gates/obs-skills-frontmatter.md +76 -76
  15. package/gates/observability-coverage.md +151 -151
  16. package/gates/omm-no-regression.md +83 -83
  17. package/gates/postmortem-template-required.md +127 -127
  18. package/gates/prr-checklist-coverage.md +128 -128
  19. package/gates/regression.md +32 -32
  20. package/gates/release-pipeline-policy.md +132 -132
  21. package/gates/secrets-scan.md +33 -33
  22. package/gates/service-role-not-in-user-facing.md +113 -113
  23. package/gates/skill-must-include.md +71 -71
  24. package/gates/sync-idempotent.md +62 -62
  25. package/gates/verify-phase-goal.md +34 -34
  26. package/kit/agents/designer-ui.md +216 -216
  27. package/kit/agents/workflow-generator.md +537 -167
  28. package/kit/commands/adicionar-backlog.md +1 -1
  29. package/kit/commands/adicionar-fase.md +1 -1
  30. package/kit/commands/adicionar-tarefa.md +1 -1
  31. package/kit/commands/auditar-observabilidade.md +103 -103
  32. package/kit/commands/auditar-toil.md +129 -129
  33. package/kit/commands/caracterizar-prompt.md +195 -195
  34. package/kit/commands/criar-workflow.md +158 -158
  35. package/kit/commands/definir-perfil.md +1 -1
  36. package/kit/commands/definir-slo.md +108 -108
  37. package/kit/commands/fio.md +1 -1
  38. package/kit/commands/golden-signals.md +142 -142
  39. package/kit/commands/instrumentar-fase.md +200 -200
  40. package/kit/commands/investigar-producao.md +162 -162
  41. package/kit/commands/observabilidade.md +118 -118
  42. package/kit/commands/postmortem.md +179 -179
  43. package/kit/commands/prr.md +205 -205
  44. package/kit/commands/publicar-rapido.md +207 -207
  45. package/kit/commands/risk-budget.md +220 -220
  46. package/kit/commands/sre.md +230 -230
  47. package/kit/file-manifest.json +424 -424
  48. package/kit/framework/references/output-style.md +22 -22
  49. package/kit/hooks/post-apply-migration.js +199 -199
  50. package/kit/hooks/sidecar-tool-publisher.js +210 -210
  51. package/kit/skills/_shared-dados-distribuidos/glossary.md +224 -224
  52. package/kit/skills/_shared-legacy/glossary.md +389 -389
  53. package/kit/skills/_shared-multi-tenant/glossary.md +186 -186
  54. package/kit/skills/_shared-observability/glossary.md +396 -396
  55. package/kit/skills/_shared-sre/glossary.md +712 -712
  56. package/kit/skills/_shared-supabase/glossary.md +234 -234
  57. package/kit/skills/blameless-postmortems/SKILL.md +340 -340
  58. package/kit/skills/burn-rate-alerting/SKILL.md +258 -258
  59. package/kit/skills/cascading-failures/SKILL.md +311 -311
  60. package/kit/skills/core-analysis-loop/SKILL.md +352 -352
  61. package/kit/skills/distributed-tracing/SKILL.md +362 -362
  62. package/kit/skills/dynamic-workflow-authoring/SKILL.md +327 -223
  63. package/kit/skills/eliminating-toil/SKILL.md +243 -243
  64. package/kit/skills/event-based-slos/SKILL.md +296 -296
  65. package/kit/skills/four-golden-signals/SKILL.md +314 -314
  66. package/kit/skills/hermetic-builds/SKILL.md +323 -323
  67. package/kit/skills/legacy-monster-methods/SKILL.md +444 -444
  68. package/kit/skills/llm-as-dependency/SKILL.md +436 -436
  69. package/kit/skills/load-shedding-graceful-degradation/SKILL.md +396 -396
  70. package/kit/skills/observability-driven-development/SKILL.md +315 -315
  71. package/kit/skills/observability-maturity-model/SKILL.md +222 -222
  72. package/kit/skills/opentelemetry-standard/SKILL.md +351 -351
  73. package/kit/skills/production-readiness-review/SKILL.md +305 -305
  74. package/kit/skills/release-engineering/SKILL.md +367 -367
  75. package/kit/skills/retry-strategies/SKILL.md +372 -372
  76. package/kit/skills/sre-risk-management/SKILL.md +221 -221
  77. package/kit/skills/structured-events/SKILL.md +265 -265
  78. package/kit/skills/supabase-cron-queues/SKILL.md +275 -275
  79. package/kit/skills/supabase-database-functions/SKILL.md +332 -332
  80. package/kit/skills/supabase-declarative-schema/SKILL.md +183 -183
  81. package/kit/skills/supabase-pgvector-rag/SKILL.md +253 -253
  82. package/kit/skills/supabase-postgres-style/SKILL.md +138 -138
  83. package/kit/skills/supabase-storage/SKILL.md +234 -234
  84. package/kit/skills/telemetry-pipelines/SKILL.md +259 -259
  85. package/kit/skills/telemetry-sampling/SKILL.md +256 -256
  86. package/kit/skills/ui-anti-padroes-ia/SKILL.md +261 -261
  87. package/kit/skills/ui-contexto-produto/SKILL.md +248 -248
  88. package/kit/skills/ui-cor-estrategia/SKILL.md +213 -213
  89. package/kit/skills/ui-critica-auditoria/SKILL.md +260 -260
  90. package/kit/skills/ui-motion-funcional/SKILL.md +264 -264
  91. package/kit/skills/ui-ritmo-espacial/SKILL.md +259 -259
  92. package/kit/skills/ui-tipografia/SKILL.md +211 -211
  93. package/package.json +1 -1
  94. package/src/cli/index.js +1114 -1114
  95. package/src/cli/render.js +194 -194
  96. package/src/cli/upgrade-check.js +135 -135
  97. package/src/core/error-redaction.js +76 -76
  98. package/src/core/failures.js +153 -153
  99. package/src/core/gate-runner.js +205 -205
  100. package/src/core/gates.js +82 -82
  101. package/src/core/logger.js +170 -170
  102. package/src/core/manifest-verify.js +174 -174
  103. package/src/core/metrics.js +268 -268
  104. package/src/core/notify.js +60 -60
  105. package/src/core/path-safety.js +141 -141
  106. package/src/core/replays.js +120 -120
  107. package/src/core/ui.js +185 -185
  108. package/src/mcp-server/install.js +149 -149
  109. package/src/mcp-server/roots.js +124 -124
  110. package/src/ui/auto-spawn.js +113 -113
  111. package/src/ui/browser.js +78 -78
  112. package/src/ui/client.js +130 -130
  113. package/src/ui/events.js +65 -65
  114. package/src/ui/lockfile.js +191 -191
  115. package/src/ui/port.js +67 -67
  116. package/src/ui/server.js +547 -547
  117. package/src/ui/wrapper.js +129 -129
package/bin/cli.js CHANGED
@@ -1,2 +1,2 @@
1
- #!/usr/bin/env node
2
- import '../src/cli/index.js';
1
+ #!/usr/bin/env node
2
+ import '../src/cli/index.js';
package/bin/mcp.js CHANGED
@@ -1,6 +1,6 @@
1
- #!/usr/bin/env node
2
- import { startStdio } from '../src/mcp-server/index.js';
3
- startStdio().catch((e) => {
4
- process.stderr.write(`kit-mcp failed to start: ${e.stack ?? e.message}\n`);
5
- process.exit(1);
6
- });
1
+ #!/usr/bin/env node
2
+ import { startStdio } from '../src/mcp-server/index.js';
3
+ startStdio().catch((e) => {
4
+ process.stderr.write(`kit-mcp failed to start: ${e.stack ?? e.message}\n`);
5
+ process.exit(1);
6
+ });
package/bin/ui.js CHANGED
@@ -1,74 +1,74 @@
1
- #!/usr/bin/env node
2
- // bin/ui.js — entry point for the sidecar HTTP server.
3
- //
4
- // Used both directly (when the user runs `kit ui start`) and as the spawn target
5
- // when `--auto-spawn` is enabled on an MCP tool.
6
- //
7
- // Logging discipline: all output goes to stderr. stdout is reserved so that
8
- // callers can pipe `node bin/ui.js | jq` without UI server chatter contaminating
9
- // data streams (and so that this file can never poison an MCP stdio channel).
10
-
11
- import process from 'node:process';
12
- import { createServer } from '../src/ui/server.js';
13
-
14
- function parseArgs(argv) {
15
- const args = { projectRoot: process.cwd(), port: undefined, idleMs: undefined };
16
- for (let i = 0; i < argv.length; i += 1) {
17
- const a = argv[i];
18
- if (a === '--project-root' && argv[i + 1]) { args.projectRoot = argv[i + 1]; i += 1; }
19
- else if (a === '--port' && argv[i + 1]) { args.port = Number(argv[i + 1]); i += 1; }
20
- else if (a === '--idle-ms' && argv[i + 1]) { args.idleMs = Number(argv[i + 1]); i += 1; }
21
- else if (a === '--version') { args.printVersion = true; }
22
- else if (a === '--help' || a === '-h') { args.help = true; }
23
- }
24
- return args;
25
- }
26
-
27
- const args = parseArgs(process.argv.slice(2));
28
-
29
- if (args.help) {
30
- process.stderr.write([
31
- 'kit-mcp sidecar entry — usually invoked via `kit ui start`',
32
- '',
33
- 'Usage: node bin/ui.js [options]',
34
- ' --project-root <path> project root for lockfile keying (default: cwd)',
35
- ' --port <n> bind to a specific port (default: auto-pick 7100-7199)',
36
- ' --idle-ms <ms> idle shutdown timeout (default: 0 = never; pass e.g. 1800000 for 30min)',
37
- ' --version print version and exit',
38
- ' --help this text',
39
- '',
40
- ].join('\n'));
41
- process.exit(0);
42
- }
43
-
44
- let pkgVersion = null;
45
- try {
46
- const { default: pkg } = await import('../package.json', { with: { type: 'json' } });
47
- pkgVersion = pkg.version;
48
- } catch {
49
- // ok — version may not be available in some packaged contexts
50
- }
51
-
52
- if (args.printVersion) {
53
- process.stderr.write(`${pkgVersion ?? 'unknown'}\n`);
54
- process.exit(0);
55
- }
56
-
57
- const server = createServer({
58
- projectRoot: args.projectRoot,
59
- version: pkgVersion,
60
- idleMs: args.idleMs,
61
- });
62
-
63
- try {
64
- const { port } = await server.start({ port: args.port });
65
- process.stderr.write(`[kit-mcp ui] listening on http://127.0.0.1:${port}/\n`);
66
- process.stderr.write(`[kit-mcp ui] project: ${args.projectRoot}\n`);
67
- } catch (err) {
68
- if (err.code === 'ELIVE') {
69
- process.stderr.write(`[kit-mcp ui] sidecar already running for this project (pid=${err.lock?.pid}, port=${err.lock?.port})\n`);
70
- process.exit(2);
71
- }
72
- process.stderr.write(`[kit-mcp ui] failed to start: ${err.message}\n`);
73
- process.exit(1);
74
- }
1
+ #!/usr/bin/env node
2
+ // bin/ui.js — entry point for the sidecar HTTP server.
3
+ //
4
+ // Used both directly (when the user runs `kit ui start`) and as the spawn target
5
+ // when `--auto-spawn` is enabled on an MCP tool.
6
+ //
7
+ // Logging discipline: all output goes to stderr. stdout is reserved so that
8
+ // callers can pipe `node bin/ui.js | jq` without UI server chatter contaminating
9
+ // data streams (and so that this file can never poison an MCP stdio channel).
10
+
11
+ import process from 'node:process';
12
+ import { createServer } from '../src/ui/server.js';
13
+
14
+ function parseArgs(argv) {
15
+ const args = { projectRoot: process.cwd(), port: undefined, idleMs: undefined };
16
+ for (let i = 0; i < argv.length; i += 1) {
17
+ const a = argv[i];
18
+ if (a === '--project-root' && argv[i + 1]) { args.projectRoot = argv[i + 1]; i += 1; }
19
+ else if (a === '--port' && argv[i + 1]) { args.port = Number(argv[i + 1]); i += 1; }
20
+ else if (a === '--idle-ms' && argv[i + 1]) { args.idleMs = Number(argv[i + 1]); i += 1; }
21
+ else if (a === '--version') { args.printVersion = true; }
22
+ else if (a === '--help' || a === '-h') { args.help = true; }
23
+ }
24
+ return args;
25
+ }
26
+
27
+ const args = parseArgs(process.argv.slice(2));
28
+
29
+ if (args.help) {
30
+ process.stderr.write([
31
+ 'kit-mcp sidecar entry — usually invoked via `kit ui start`',
32
+ '',
33
+ 'Usage: node bin/ui.js [options]',
34
+ ' --project-root <path> project root for lockfile keying (default: cwd)',
35
+ ' --port <n> bind to a specific port (default: auto-pick 7100-7199)',
36
+ ' --idle-ms <ms> idle shutdown timeout (default: 0 = never; pass e.g. 1800000 for 30min)',
37
+ ' --version print version and exit',
38
+ ' --help this text',
39
+ '',
40
+ ].join('\n'));
41
+ process.exit(0);
42
+ }
43
+
44
+ let pkgVersion = null;
45
+ try {
46
+ const { default: pkg } = await import('../package.json', { with: { type: 'json' } });
47
+ pkgVersion = pkg.version;
48
+ } catch {
49
+ // ok — version may not be available in some packaged contexts
50
+ }
51
+
52
+ if (args.printVersion) {
53
+ process.stderr.write(`${pkgVersion ?? 'unknown'}\n`);
54
+ process.exit(0);
55
+ }
56
+
57
+ const server = createServer({
58
+ projectRoot: args.projectRoot,
59
+ version: pkgVersion,
60
+ idleMs: args.idleMs,
61
+ });
62
+
63
+ try {
64
+ const { port } = await server.start({ port: args.port });
65
+ process.stderr.write(`[kit-mcp ui] listening on http://127.0.0.1:${port}/\n`);
66
+ process.stderr.write(`[kit-mcp ui] project: ${args.projectRoot}\n`);
67
+ } catch (err) {
68
+ if (err.code === 'ELIVE') {
69
+ process.stderr.write(`[kit-mcp ui] sidecar already running for this project (pid=${err.lock?.pid}, port=${err.lock?.port})\n`);
70
+ process.exit(2);
71
+ }
72
+ process.stderr.write(`[kit-mcp ui] failed to start: ${err.message}\n`);
73
+ process.exit(1);
74
+ }
@@ -1,120 +1,120 @@
1
- ---
2
- id: ai-prompt-stability
3
- stage: pre-execute
4
- blocking: false
5
- description: Valida que prompts/tools LLM em produção (qualquer arquivo em `prompts/` ou referenciado por código de produção como prompt) têm characterization tests linkados. Skip se projeto não usa LLM. Opt-in via workflow.ai_prompt_gate.
6
- ---
7
-
8
- # AI prompt stability gate
9
-
10
- **When to run:** pre-execute (consultive default; blocking se `workflow.ai_prompt_gate=true`).
11
-
12
- **Skill canônica:** [`ai-prompt-characterization`](../kit/skills/ai-prompt-characterization/SKILL.md)
13
-
14
- **Agent invocado:** [`legacy-characterizer`](../kit/agents/legacy-characterizer.md) (modo prompt)
15
-
16
- ## Check
17
-
18
- ```bash
19
- #!/usr/bin/env bash
20
- # PT-BR: validar que prompts em prod têm characterization tests
21
- set -e
22
-
23
- # detectar prompts em prod (heurística — paths canônicos)
24
- PROMPT_FILES=""
25
- for d in prompts src/prompts supabase/functions/*/prompts; do
26
- [ -d "$d" ] && PROMPT_FILES="$PROMPT_FILES $(find "$d" -type f \( -name "*.md" -o -name "*.txt" -o -name "*.prompt" \) 2>/dev/null)"
27
- done
28
-
29
- if [ -z "$PROMPT_FILES" ]; then
30
- echo "INFO: nenhum prompt em prod detectado — gate skip."
31
- exit 0
32
- fi
33
-
34
- # detectar gate mode
35
- GATE_BLOCKING=false
36
- if [ -f ".planning/config.json" ] && command -v jq >/dev/null; then
37
- CFG=$(jq -r '.workflow.ai_prompt_gate // empty' .planning/config.json 2>/dev/null)
38
- [ "$CFG" = "true" ] && GATE_BLOCKING=true
39
- fi
40
-
41
- # para cada prompt, verificar characterization tests
42
- PROMPTS_OK=()
43
- PROMPTS_MISSING=()
44
-
45
- for prompt in $PROMPT_FILES; do
46
- STEM=$(basename "$prompt" | sed 's/\.[^.]*$//')
47
- HAS_CHAR=false
48
- for chardir in tests/characterization/prompts test/characterization/prompts __tests__/characterization/prompts; do
49
- if find "$chardir" -path "*${STEM}*" 2>/dev/null | head -1 | grep -q . ; then
50
- HAS_CHAR=true
51
- break
52
- fi
53
- done
54
-
55
- if [ "$HAS_CHAR" = "true" ]; then
56
- PROMPTS_OK+=("$prompt")
57
- else
58
- LINES=$(wc -l < "$prompt" 2>/dev/null | tr -d ' ')
59
- if [ "${LINES:-0}" -gt 50 ]; then # threshold: prompts > 50 linhas requerem char
60
- PROMPTS_MISSING+=("$prompt (lines=$LINES)")
61
- fi
62
- fi
63
- done
64
-
65
- if [ ${#PROMPTS_MISSING[@]} -eq 0 ]; then
66
- echo "✓ ai-prompt-stability — todos os prompts > 50 linhas têm characterization tests."
67
- exit 0
68
- fi
69
-
70
- echo ""
71
- echo "⚠ ai-prompt-stability — prompts sem characterization detectados:"
72
- echo ""
73
- for p in "${PROMPTS_MISSING[@]}"; do
74
- echo " - $p"
75
- done
76
- echo ""
77
- echo "Skill canônica: kit/skills/ai-prompt-characterization/SKILL.md"
78
- echo ""
79
- echo "Caminhos para resolver:"
80
- echo " /caracterizar-prompt <prompt-file> (gera characterization tests)"
81
- echo " /caracterizar-prompt <prompt> --num-intents 5 (5 intents canônicas)"
82
- echo ""
83
-
84
- if [ "$GATE_BLOCKING" = "true" ]; then
85
- echo "MODE: blocking (workflow.ai_prompt_gate=true)"
86
- echo "Resolve antes de prosseguir."
87
- exit 1
88
- else
89
- echo "MODE: consultive (warning apenas)"
90
- echo "Para tornar blocking: setar workflow.ai_prompt_gate=true em .planning/config.json"
91
- exit 0
92
- fi
93
- ```
94
-
95
- ## Configuração
96
-
97
- ```json
98
- {
99
- "workflow": {
100
- "ai_prompt_gate": false,
101
- "ai_prompt_min_lines": 50,
102
- "ai_prompt_paths": ["prompts/**", "src/prompts/**", "supabase/functions/*/prompts/**"]
103
- }
104
- }
105
- ```
106
-
107
- **Default:** `ai_prompt_gate` = false (consultive). Promove para blocking se projeto tem ≥ 5 prompts em prod.
108
-
109
- ## Quando NÃO rodar
110
-
111
- - Projeto não usa LLM em produção
112
- - Prompts são apenas para dev tooling (não prod)
113
- - Prompts < 50 linhas (threshold default)
114
-
115
- ## Ver também
116
-
117
- - [`ai-prompt-characterization`](../kit/skills/ai-prompt-characterization/SKILL.md) — knowledge base
118
- - [`legacy-characterization-tests`](../kit/skills/legacy-characterization-tests/SKILL.md) — characterization clássico
119
- - [`legacy-refactor-safety`](./legacy-refactor-safety.md) — gate análogo para refactor de código
120
- - [`llm-as-dependency`](../kit/skills/llm-as-dependency/SKILL.md) — fakear LLM em business logic tests
1
+ ---
2
+ id: ai-prompt-stability
3
+ stage: pre-execute
4
+ blocking: false
5
+ description: Valida que prompts/tools LLM em produção (qualquer arquivo em `prompts/` ou referenciado por código de produção como prompt) têm characterization tests linkados. Skip se projeto não usa LLM. Opt-in via workflow.ai_prompt_gate.
6
+ ---
7
+
8
+ # AI prompt stability gate
9
+
10
+ **When to run:** pre-execute (consultive default; blocking se `workflow.ai_prompt_gate=true`).
11
+
12
+ **Skill canônica:** [`ai-prompt-characterization`](../kit/skills/ai-prompt-characterization/SKILL.md)
13
+
14
+ **Agent invocado:** [`legacy-characterizer`](../kit/agents/legacy-characterizer.md) (modo prompt)
15
+
16
+ ## Check
17
+
18
+ ```bash
19
+ #!/usr/bin/env bash
20
+ # PT-BR: validar que prompts em prod têm characterization tests
21
+ set -e
22
+
23
+ # detectar prompts em prod (heurística — paths canônicos)
24
+ PROMPT_FILES=""
25
+ for d in prompts src/prompts supabase/functions/*/prompts; do
26
+ [ -d "$d" ] && PROMPT_FILES="$PROMPT_FILES $(find "$d" -type f \( -name "*.md" -o -name "*.txt" -o -name "*.prompt" \) 2>/dev/null)"
27
+ done
28
+
29
+ if [ -z "$PROMPT_FILES" ]; then
30
+ echo "INFO: nenhum prompt em prod detectado — gate skip."
31
+ exit 0
32
+ fi
33
+
34
+ # detectar gate mode
35
+ GATE_BLOCKING=false
36
+ if [ -f ".planning/config.json" ] && command -v jq >/dev/null; then
37
+ CFG=$(jq -r '.workflow.ai_prompt_gate // empty' .planning/config.json 2>/dev/null)
38
+ [ "$CFG" = "true" ] && GATE_BLOCKING=true
39
+ fi
40
+
41
+ # para cada prompt, verificar characterization tests
42
+ PROMPTS_OK=()
43
+ PROMPTS_MISSING=()
44
+
45
+ for prompt in $PROMPT_FILES; do
46
+ STEM=$(basename "$prompt" | sed 's/\.[^.]*$//')
47
+ HAS_CHAR=false
48
+ for chardir in tests/characterization/prompts test/characterization/prompts __tests__/characterization/prompts; do
49
+ if find "$chardir" -path "*${STEM}*" 2>/dev/null | head -1 | grep -q . ; then
50
+ HAS_CHAR=true
51
+ break
52
+ fi
53
+ done
54
+
55
+ if [ "$HAS_CHAR" = "true" ]; then
56
+ PROMPTS_OK+=("$prompt")
57
+ else
58
+ LINES=$(wc -l < "$prompt" 2>/dev/null | tr -d ' ')
59
+ if [ "${LINES:-0}" -gt 50 ]; then # threshold: prompts > 50 linhas requerem char
60
+ PROMPTS_MISSING+=("$prompt (lines=$LINES)")
61
+ fi
62
+ fi
63
+ done
64
+
65
+ if [ ${#PROMPTS_MISSING[@]} -eq 0 ]; then
66
+ echo "✓ ai-prompt-stability — todos os prompts > 50 linhas têm characterization tests."
67
+ exit 0
68
+ fi
69
+
70
+ echo ""
71
+ echo "⚠ ai-prompt-stability — prompts sem characterization detectados:"
72
+ echo ""
73
+ for p in "${PROMPTS_MISSING[@]}"; do
74
+ echo " - $p"
75
+ done
76
+ echo ""
77
+ echo "Skill canônica: kit/skills/ai-prompt-characterization/SKILL.md"
78
+ echo ""
79
+ echo "Caminhos para resolver:"
80
+ echo " /caracterizar-prompt <prompt-file> (gera characterization tests)"
81
+ echo " /caracterizar-prompt <prompt> --num-intents 5 (5 intents canônicas)"
82
+ echo ""
83
+
84
+ if [ "$GATE_BLOCKING" = "true" ]; then
85
+ echo "MODE: blocking (workflow.ai_prompt_gate=true)"
86
+ echo "Resolve antes de prosseguir."
87
+ exit 1
88
+ else
89
+ echo "MODE: consultive (warning apenas)"
90
+ echo "Para tornar blocking: setar workflow.ai_prompt_gate=true em .planning/config.json"
91
+ exit 0
92
+ fi
93
+ ```
94
+
95
+ ## Configuração
96
+
97
+ ```json
98
+ {
99
+ "workflow": {
100
+ "ai_prompt_gate": false,
101
+ "ai_prompt_min_lines": 50,
102
+ "ai_prompt_paths": ["prompts/**", "src/prompts/**", "supabase/functions/*/prompts/**"]
103
+ }
104
+ }
105
+ ```
106
+
107
+ **Default:** `ai_prompt_gate` = false (consultive). Promove para blocking se projeto tem ≥ 5 prompts em prod.
108
+
109
+ ## Quando NÃO rodar
110
+
111
+ - Projeto não usa LLM em produção
112
+ - Prompts são apenas para dev tooling (não prod)
113
+ - Prompts < 50 linhas (threshold default)
114
+
115
+ ## Ver também
116
+
117
+ - [`ai-prompt-characterization`](../kit/skills/ai-prompt-characterization/SKILL.md) — knowledge base
118
+ - [`legacy-characterization-tests`](../kit/skills/legacy-characterization-tests/SKILL.md) — characterization clássico
119
+ - [`legacy-refactor-safety`](./legacy-refactor-safety.md) — gate análogo para refactor de código
120
+ - [`llm-as-dependency`](../kit/skills/llm-as-dependency/SKILL.md) — fakear LLM em business logic tests
@@ -1,68 +1,68 @@
1
- ---
2
- id: budget-description
3
- stage: pre-verify
4
- blocking: true
5
- description: Valida que cada agent/command/skill tem `description:` ≤ 200 chars no frontmatter (anti-pitfall A2 — CLAUDE.md inflation).
6
- ---
7
-
8
- # Budget description gate
9
-
10
- **When to run:** pre-verify, antes de commit final do milestone.
11
-
12
- ## Check
13
-
14
- ```bash
15
- #!/usr/bin/env bash
16
- # PT-BR: itera por todos os agent/command/skill, valida frontmatter description ≤ 200 chars
17
- set -e
18
-
19
- VIOLATIONS=0
20
-
21
- # function que extrai description do YAML frontmatter
22
- check_description() {
23
- local file="$1"
24
- local desc
25
- desc=$(awk '/^description:/{sub(/^description: ?/, ""); print; exit}' "$file" 2>/dev/null || true)
26
- if [ -z "$desc" ]; then
27
- echo "WARN: $file — sem description: no frontmatter"
28
- return 0
29
- fi
30
- local len=${#desc}
31
- if [ "$len" -gt 200 ]; then
32
- echo "FAIL: $file — description tem $len chars (max 200)"
33
- VIOLATIONS=$((VIOLATIONS + 1))
34
- fi
35
- }
36
-
37
- # itera agents
38
- for f in kit/agents/*.md; do
39
- [ -f "$f" ] && check_description "$f"
40
- done
41
-
42
- # itera commands
43
- for f in kit/commands/*.md; do
44
- [ -f "$f" ] && check_description "$f"
45
- done
46
-
47
- # itera skills (SKILL.md em subdirs)
48
- for f in kit/skills/*/SKILL.md; do
49
- [ -f "$f" ] && check_description "$f"
50
- done
51
-
52
- if [ "$VIOLATIONS" -gt 0 ]; then
53
- echo "Total violations: $VIOLATIONS (max description length 200 chars)"
54
- exit 1
55
- fi
56
-
57
- echo "✓ Todos os agents/commands/skills têm description ≤ 200 chars"
58
- exit 0
59
- ```
60
-
61
- ## Verdict
62
-
63
- - **passed** — todas as descriptions ≤ 200 chars
64
- - **block** — pelo menos uma description > 200 chars (CLAUDE.md inflation)
65
-
66
- ## Notes
67
-
68
- Anti-pitfall A2 da v1.8: cluster `supabase-*` adiciona 19+ entradas em CLAUDE.md. Sem este budget, descriptions verbosas inflam CLAUDE.md em ~3-4 KB+ — desfaz otimização de v1.6/v1.7.
1
+ ---
2
+ id: budget-description
3
+ stage: pre-verify
4
+ blocking: true
5
+ description: Valida que cada agent/command/skill tem `description:` ≤ 200 chars no frontmatter (anti-pitfall A2 — CLAUDE.md inflation).
6
+ ---
7
+
8
+ # Budget description gate
9
+
10
+ **When to run:** pre-verify, antes de commit final do milestone.
11
+
12
+ ## Check
13
+
14
+ ```bash
15
+ #!/usr/bin/env bash
16
+ # PT-BR: itera por todos os agent/command/skill, valida frontmatter description ≤ 200 chars
17
+ set -e
18
+
19
+ VIOLATIONS=0
20
+
21
+ # function que extrai description do YAML frontmatter
22
+ check_description() {
23
+ local file="$1"
24
+ local desc
25
+ desc=$(awk '/^description:/{sub(/^description: ?/, ""); print; exit}' "$file" 2>/dev/null || true)
26
+ if [ -z "$desc" ]; then
27
+ echo "WARN: $file — sem description: no frontmatter"
28
+ return 0
29
+ fi
30
+ local len=${#desc}
31
+ if [ "$len" -gt 200 ]; then
32
+ echo "FAIL: $file — description tem $len chars (max 200)"
33
+ VIOLATIONS=$((VIOLATIONS + 1))
34
+ fi
35
+ }
36
+
37
+ # itera agents
38
+ for f in kit/agents/*.md; do
39
+ [ -f "$f" ] && check_description "$f"
40
+ done
41
+
42
+ # itera commands
43
+ for f in kit/commands/*.md; do
44
+ [ -f "$f" ] && check_description "$f"
45
+ done
46
+
47
+ # itera skills (SKILL.md em subdirs)
48
+ for f in kit/skills/*/SKILL.md; do
49
+ [ -f "$f" ] && check_description "$f"
50
+ done
51
+
52
+ if [ "$VIOLATIONS" -gt 0 ]; then
53
+ echo "Total violations: $VIOLATIONS (max description length 200 chars)"
54
+ exit 1
55
+ fi
56
+
57
+ echo "✓ Todos os agents/commands/skills têm description ≤ 200 chars"
58
+ exit 0
59
+ ```
60
+
61
+ ## Verdict
62
+
63
+ - **passed** — todas as descriptions ≤ 200 chars
64
+ - **block** — pelo menos uma description > 200 chars (CLAUDE.md inflation)
65
+
66
+ ## Notes
67
+
68
+ Anti-pitfall A2 da v1.8: cluster `supabase-*` adiciona 19+ entradas em CLAUDE.md. Sem este budget, descriptions verbosas inflam CLAUDE.md em ~3-4 KB+ — desfaz otimização de v1.6/v1.7.
@@ -1,29 +1,29 @@
1
- ---
2
- id: confidence
3
- stage: pre-plan
4
- blocking: false
5
- description: After discovery, gate on the discovery confidence level before planning.
6
- ---
7
-
8
- # Confidence gate
9
-
10
- **When to run:** end of `discovery-phase` workflow, before handing off to `plan-phase`.
11
-
12
- ## Inputs
13
-
14
- - `DISCOVERY.md` of the current phase (must contain `confidence: low | medium | high`)
15
-
16
- ## Verdict
17
-
18
- - **passed (high)** — proceed silently
19
- - **warn (medium)** — log "discovery completed with medium confidence" and proceed
20
- - **block (low)** — present options to the user:
21
- - "Aprofundar" — run discovery deeper
22
- - "Prosseguir mesmo assim" — accept and plan with caveats noted
23
- - "Pausar" — exit workflow
24
-
25
- ## Notes
26
-
27
- Low-confidence discovery is a smell. It usually means the chosen library is too new,
28
- the integration surface is poorly documented, or the requirements are still vague.
29
- Forcing this gate prevents planning on shaky ground.
1
+ ---
2
+ id: confidence
3
+ stage: pre-plan
4
+ blocking: false
5
+ description: After discovery, gate on the discovery confidence level before planning.
6
+ ---
7
+
8
+ # Confidence gate
9
+
10
+ **When to run:** end of `discovery-phase` workflow, before handing off to `plan-phase`.
11
+
12
+ ## Inputs
13
+
14
+ - `DISCOVERY.md` of the current phase (must contain `confidence: low | medium | high`)
15
+
16
+ ## Verdict
17
+
18
+ - **passed (high)** — proceed silently
19
+ - **warn (medium)** — log "discovery completed with medium confidence" and proceed
20
+ - **block (low)** — present options to the user:
21
+ - "Aprofundar" — run discovery deeper
22
+ - "Prosseguir mesmo assim" — accept and plan with caveats noted
23
+ - "Pausar" — exit workflow
24
+
25
+ ## Notes
26
+
27
+ Low-confidence discovery is a smell. It usually means the chosen library is too new,
28
+ the integration surface is poorly documented, or the requirements are still vague.
29
+ Forcing this gate prevents planning on shaky ground.