@luanpdd/kit-mcp 1.34.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.
- package/README.md +1 -1
- package/bin/cli.js +2 -2
- package/bin/mcp.js +6 -6
- package/bin/ui.js +74 -74
- package/gates/ai-prompt-stability.md +120 -120
- package/gates/budget-description.md +68 -68
- package/gates/confidence.md +29 -29
- package/gates/dependency-check.md +33 -33
- package/gates/dept-cycle-prevention.md +179 -179
- package/gates/golden-signals-coverage.md +133 -133
- package/gates/legacy-refactor-safety.md +178 -178
- package/gates/multi-tenant-rls-coverage.md +102 -102
- package/gates/no-personal-uuid.md +72 -72
- package/gates/obs-agents-mcp-supabase.md +86 -86
- package/gates/obs-skills-frontmatter.md +76 -76
- package/gates/observability-coverage.md +151 -151
- package/gates/omm-no-regression.md +83 -83
- package/gates/postmortem-template-required.md +127 -127
- package/gates/prr-checklist-coverage.md +128 -128
- package/gates/regression.md +32 -32
- package/gates/release-pipeline-policy.md +132 -132
- package/gates/secrets-scan.md +33 -33
- package/gates/service-role-not-in-user-facing.md +113 -113
- package/gates/skill-must-include.md +71 -71
- package/gates/sync-idempotent.md +62 -62
- package/gates/verify-phase-goal.md +34 -34
- package/kit/agents/designer-ui.md +216 -216
- package/kit/agents/workflow-generator.md +537 -0
- package/kit/commands/adicionar-backlog.md +1 -1
- package/kit/commands/adicionar-fase.md +1 -1
- package/kit/commands/adicionar-tarefa.md +1 -1
- package/kit/commands/auditar-observabilidade.md +103 -103
- package/kit/commands/auditar-toil.md +129 -129
- package/kit/commands/caracterizar-prompt.md +195 -195
- package/kit/commands/criar-workflow.md +158 -0
- package/kit/commands/definir-perfil.md +1 -1
- package/kit/commands/definir-slo.md +108 -108
- package/kit/commands/fio.md +1 -1
- package/kit/commands/golden-signals.md +142 -142
- package/kit/commands/instrumentar-fase.md +200 -200
- package/kit/commands/investigar-producao.md +162 -162
- package/kit/commands/observabilidade.md +118 -118
- package/kit/commands/postmortem.md +179 -179
- package/kit/commands/prr.md +205 -205
- package/kit/commands/publicar-rapido.md +207 -207
- package/kit/commands/risk-budget.md +220 -220
- package/kit/commands/sre.md +230 -230
- package/kit/file-manifest.json +5 -2
- package/kit/framework/references/output-style.md +22 -22
- package/kit/hooks/post-apply-migration.js +199 -199
- package/kit/hooks/sidecar-tool-publisher.js +210 -210
- package/kit/skills/_shared-dados-distribuidos/glossary.md +224 -224
- package/kit/skills/_shared-legacy/glossary.md +389 -389
- package/kit/skills/_shared-multi-tenant/glossary.md +186 -186
- package/kit/skills/_shared-observability/glossary.md +396 -396
- package/kit/skills/_shared-sre/glossary.md +712 -712
- package/kit/skills/_shared-supabase/glossary.md +234 -234
- package/kit/skills/blameless-postmortems/SKILL.md +340 -340
- package/kit/skills/burn-rate-alerting/SKILL.md +258 -258
- package/kit/skills/cascading-failures/SKILL.md +311 -311
- package/kit/skills/core-analysis-loop/SKILL.md +352 -352
- package/kit/skills/distributed-tracing/SKILL.md +362 -362
- package/kit/skills/dynamic-workflow-authoring/SKILL.md +327 -0
- package/kit/skills/eliminating-toil/SKILL.md +243 -243
- package/kit/skills/event-based-slos/SKILL.md +296 -296
- package/kit/skills/four-golden-signals/SKILL.md +314 -314
- package/kit/skills/hermetic-builds/SKILL.md +323 -323
- package/kit/skills/legacy-monster-methods/SKILL.md +444 -444
- package/kit/skills/llm-as-dependency/SKILL.md +436 -436
- package/kit/skills/load-shedding-graceful-degradation/SKILL.md +396 -396
- package/kit/skills/observability-driven-development/SKILL.md +315 -315
- package/kit/skills/observability-maturity-model/SKILL.md +222 -222
- package/kit/skills/opentelemetry-standard/SKILL.md +351 -351
- package/kit/skills/production-readiness-review/SKILL.md +305 -305
- package/kit/skills/release-engineering/SKILL.md +367 -367
- package/kit/skills/retry-strategies/SKILL.md +372 -372
- package/kit/skills/sre-risk-management/SKILL.md +221 -221
- package/kit/skills/structured-events/SKILL.md +265 -265
- package/kit/skills/supabase-cron-queues/SKILL.md +275 -275
- package/kit/skills/supabase-database-functions/SKILL.md +332 -332
- package/kit/skills/supabase-declarative-schema/SKILL.md +183 -183
- package/kit/skills/supabase-pgvector-rag/SKILL.md +253 -253
- package/kit/skills/supabase-postgres-style/SKILL.md +138 -138
- package/kit/skills/supabase-storage/SKILL.md +234 -234
- package/kit/skills/telemetry-pipelines/SKILL.md +259 -259
- package/kit/skills/telemetry-sampling/SKILL.md +256 -256
- package/kit/skills/ui-anti-padroes-ia/SKILL.md +261 -261
- package/kit/skills/ui-contexto-produto/SKILL.md +248 -248
- package/kit/skills/ui-cor-estrategia/SKILL.md +213 -213
- package/kit/skills/ui-critica-auditoria/SKILL.md +260 -260
- package/kit/skills/ui-motion-funcional/SKILL.md +264 -264
- package/kit/skills/ui-ritmo-espacial/SKILL.md +259 -259
- package/kit/skills/ui-tipografia/SKILL.md +211 -211
- package/package.json +1 -1
- package/src/cli/index.js +1114 -1114
- package/src/cli/render.js +194 -194
- package/src/cli/upgrade-check.js +135 -135
- package/src/core/error-redaction.js +76 -76
- package/src/core/failures.js +153 -153
- package/src/core/gate-runner.js +205 -205
- package/src/core/gates.js +82 -82
- package/src/core/logger.js +170 -170
- package/src/core/manifest-verify.js +174 -174
- package/src/core/metrics.js +268 -268
- package/src/core/notify.js +60 -60
- package/src/core/path-safety.js +141 -141
- package/src/core/replays.js +120 -120
- package/src/core/ui.js +185 -185
- package/src/mcp-server/install.js +149 -149
- package/src/mcp-server/roots.js +124 -124
- package/src/ui/auto-spawn.js +113 -113
- package/src/ui/browser.js +78 -78
- package/src/ui/client.js +130 -130
- package/src/ui/events.js +65 -65
- package/src/ui/lockfile.js +191 -191
- package/src/ui/port.js +67 -67
- package/src/ui/server.js +547 -547
- package/src/ui/wrapper.js +129 -129
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
> Entregue como **MCP server**. Você usa direto via `npx`, sem instalar nada.
|
|
11
11
|
|
|
12
12
|
<!-- AUTOGEN-COUNTS-START -->
|
|
13
|
-
**Bundled workflow:**
|
|
13
|
+
**Bundled workflow:** 74 agents · 91 commands · 99 skills · 23 gates
|
|
14
14
|
<!-- AUTOGEN-COUNTS-END -->
|
|
15
15
|
|
|
16
16
|
---
|
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.
|
package/gates/confidence.md
CHANGED
|
@@ -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.
|