@luanpdd/kit-mcp 1.30.0 → 1.30.1

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.
@@ -1,6 +1,6 @@
1
1
  {
2
- "version": "1.30.0",
3
- "timestamp": "2026-05-13T09:16:42.372Z",
2
+ "version": "1.30.1",
3
+ "timestamp": "2026-05-14T07:27:25.436Z",
4
4
  "files": {
5
5
  "COMANDOS.md": "d24ec61a6ec35db314cc5f2ae287bfb927b794789c8f1d558c55862f5e6534b2",
6
6
  "COMPATIBILITY.md": "794e336a87045cdf0161785b9a7a0975a49abbd80bdd816b8852251fcc8126ca",
@@ -297,6 +297,7 @@
297
297
  "framework/workflows/verify-work.md": "219b2e45782b0b9ef042b69f02c92232947b8144ac4f472a6f5a6577f21de8df",
298
298
  "hooks/check-update.js": "927bb6394259b8547aad508580872c92d508f5886b29e9b3ae9603076baa2a5c",
299
299
  "hooks/context-monitor.js": "8ff9295c6ab769ca766e3e612c39d72d171a97bb082bde590bdf328d557249b9",
300
+ "hooks/kit-attribution-reminder.cjs": "7d0994c63714295c522158e0e4123429ffe65cae497d003de570c5d5e2deb6f4",
300
301
  "hooks/post-apply-migration.js": "cd67f24ca9ba0a064087b9abeacee094ae24baad0cdc06f776d7a2f8ccad9685",
301
302
  "hooks/prompt-guard.js": "426f0240e3ee383571a48e062e6819d8fc3df456171fbc7e2aafb17889a9a389",
302
303
  "hooks/sidecar-tool-publisher.js": "b8357ae80e82bfc875acb6c616cf82a943a2d77cf2ceba2f23a50b7d1f335f2d",
@@ -0,0 +1,98 @@
1
+ #!/usr/bin/env node
2
+ // hook-version: 1.30.1
3
+ // kit-mcp · Kit Attribution Reminder (UserPromptSubmit)
4
+ //
5
+ // Injeta `additionalContext` no envelope do prompt do usuário com diretiva
6
+ // canônica v1.30.1: sempre que Claude usar comandos/agents/skills do kit-mcp
7
+ // no turno corrente, deve abrir o sidecar (auto-spawn já cuida disso na 1ª
8
+ // tool call) e listar os recursos usados em bloco final do output.
9
+ //
10
+ // Objetivo: dar feedback visual + textual de uso real do kit-mcp para o
11
+ // usuário detectar bugs no fluxo precocemente.
12
+ //
13
+ // Pipeline: UserPromptSubmit hook → reads stdin envelope → writes JSON com
14
+ // `{ continue: true, hookSpecificOutput: { hookEventName: "UserPromptSubmit",
15
+ // additionalContext: "<diretiva>" } }` → exit 0.
16
+ //
17
+ // SOFT failure: qualquer erro → exit 0 sem bloquear. Skip se
18
+ // KIT_MCP_NO_ATTRIBUTION=1.
19
+ //
20
+ // Module format: CommonJS (.cjs) — compatível com qualquer setup Node.
21
+ //
22
+ // Enable em settings.json (project ou user):
23
+ // {
24
+ // "hooks": {
25
+ // "UserPromptSubmit": [{
26
+ // "matcher": "*",
27
+ // "hooks": [{
28
+ // "type": "command",
29
+ // "command": "node /abs/path/to/kit-attribution-reminder.cjs"
30
+ // }]
31
+ // }]
32
+ // }
33
+ // }
34
+
35
+ 'use strict';
36
+
37
+ // Opt-out via env var
38
+ if (process.env.KIT_MCP_NO_ATTRIBUTION === '1' || process.env.KIT_MCP_NO_ATTRIBUTION === 'true') {
39
+ process.exit(0);
40
+ }
41
+
42
+ const DIRECTIVE = [
43
+ '🔧 KIT-MCP ATTRIBUTION — directive ativa neste turno (v1.30.1):',
44
+ '',
45
+ 'Se ao responder este turno você usar QUALQUER recurso do kit-mcp (qualquer',
46
+ 'subagent_type listado em /agents kit-mcp, qualquer skill cujo nome começa',
47
+ 'com supabase-/legacy-/cascading-/etc. do kit, ou qualquer /slash-command',
48
+ 'do kit), SEMPRE faça duas coisas:',
49
+ '',
50
+ '1. **Sidecar visual:** o kit-mcp abre o sidecar automaticamente na primeira',
51
+ ' tool call do MCP server (browser tab em 127.0.0.1:<porta>). Você NÃO',
52
+ ' precisa abrir manualmente — é fire-and-forget no MCP. Apenas confirme',
53
+ ' que foi disparado e mencione se o usuário precisar conferir.',
54
+ '',
55
+ '2. **Bloco de atribuição no final do output** — adicione ao final da sua',
56
+ ' resposta um bloco markdown listando TODOS os recursos kit-mcp usados:',
57
+ '',
58
+ ' ```',
59
+ ' ---',
60
+ ' 🔧 **Kit-mcp resources usados neste turno:**',
61
+ ' - Commands: /<command> (motivo: ...)',
62
+ ' - Agents: <agent-name> (via Task — motivo: ...)',
63
+ ' - Skills: <skill-name> (auto-trigger / consultada — motivo: ...)',
64
+ ' - Sidecar: http://127.0.0.1:<porta>/ (opened on first MCP tool call)',
65
+ ' ```',
66
+ '',
67
+ ' Omita seções vazias. Se NÃO usou nenhum recurso kit-mcp neste turno,',
68
+ ' **não adicione o bloco** — silêncio é melhor que ruído.',
69
+ '',
70
+ 'Disable temporário: env KIT_MCP_NO_ATTRIBUTION=1.',
71
+ '',
72
+ ].join('\n');
73
+
74
+ let input = '';
75
+ const stdinTimeout = setTimeout(() => process.exit(0), 3000);
76
+ process.stdin.setEncoding('utf8');
77
+ process.stdin.on('data', (chunk) => { input += chunk; });
78
+ process.stdin.on('end', () => {
79
+ clearTimeout(stdinTimeout);
80
+ try {
81
+ // Aceita envelope vazio; só precisamos retornar o JSON com additionalContext.
82
+ JSON.parse(input || '{}');
83
+ } catch {
84
+ // Envelope inválido — não bloquear; sair sem inject.
85
+ process.exit(0);
86
+ }
87
+ const payload = JSON.stringify({
88
+ continue: true,
89
+ hookSpecificOutput: {
90
+ hookEventName: 'UserPromptSubmit',
91
+ additionalContext: DIRECTIVE,
92
+ },
93
+ });
94
+ // SEC-13-05 (category A): flush antes de exit
95
+ process.stdout.write(payload, () => process.exit(0));
96
+ });
97
+
98
+ process.stdin.on('error', () => process.exit(0));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luanpdd/kit-mcp",
3
- "version": "1.30.0",
3
+ "version": "1.30.1",
4
4
  "description": "Generic infrastructure to ship YOUR personal kit of agents/commands/skills as an MCP server, with cross-IDE sync (Claude Code, Cursor, Codex, Gemini, Windsurf, Antigravity, Copilot, Trae).",
5
5
  "type": "module",
6
6
  "bin": {
@@ -572,9 +572,31 @@ export async function createServer() {
572
572
 
573
573
  server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: TOOLS }));
574
574
 
575
+ // v1.30.1: open browser tab on FIRST kit-mcp tool invocation (not on boot —
576
+ // would spam tabs on IDE start). Provides visual feedback that kit-mcp is
577
+ // actively being used. Escape hatch: KIT_MCP_NO_UI=1 (same as auto-spawn) or
578
+ // KIT_MCP_NO_BROWSER=1 (sidecar runs but no browser open).
579
+ let kitFirstToolBrowserOpened = false;
575
580
  server.setRequestHandler(CallToolRequestSchema, async (req) => {
576
581
  const { name, arguments: args } = req.params;
577
582
  const handler = HANDLERS[name];
583
+
584
+ // v1.30.1: first-tool browser open — fire-and-forget; never blocks handler.
585
+ // Suppressed in same conditions as boot-time sidecar (test/CI/no-ui).
586
+ if (!kitFirstToolBrowserOpened) {
587
+ kitFirstToolBrowserOpened = true;
588
+ const noUi = process.env.KIT_MCP_NO_UI === '1' || process.env.KIT_MCP_NO_UI === 'true';
589
+ const noBrowser = process.env.KIT_MCP_NO_BROWSER === '1' || process.env.KIT_MCP_NO_BROWSER === 'true';
590
+ const isTestRun = (process.execArgv || []).some(
591
+ (a) => a === '--test' || a === '--experimental-test-coverage',
592
+ ) || process.env.NODE_TEST_CONTEXT !== undefined;
593
+ const isCi = process.env.CI === 'true' || process.env.CI === '1';
594
+ if (!noUi && !noBrowser && !isTestRun && !isCi) {
595
+ const projectRoot = args?.projectRoot || process.cwd();
596
+ ensureSidecar({ projectRoot, openBrowserOnSpawn: true }).catch(() => {});
597
+ }
598
+ }
599
+
578
600
  if (!handler) {
579
601
  // OBS-18 (Phase 94.01): unknown-tool path counts as an error against
580
602
  // the unknown name itself — useful signal if a client is mis-spelling