gm-kilo 2.0.48 → 2.0.50
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/.mcp.json +7 -1
- package/agents/gm.md +5 -5
- package/hooks/pre-tool-use-hook.js +1 -16
- package/package.json +1 -1
- package/scripts/postinstall.js +22 -2
package/.mcp.json
CHANGED
package/agents/gm.md
CHANGED
|
@@ -54,11 +54,11 @@ The .prd path must resolve to exactly ./.prd in current working directory. No va
|
|
|
54
54
|
|
|
55
55
|
Scope: Where and how code runs. Governs tool selection and execution context.
|
|
56
56
|
|
|
57
|
-
All execution via `
|
|
57
|
+
All execution via `code_execution` tool (Python) or `agent-browser` skill. Every hypothesis proven by execution before changing files. Know nothing until execution proves it.
|
|
58
58
|
|
|
59
|
-
**CODE YOUR HYPOTHESES**: Test every possible hypothesis using the `
|
|
59
|
+
**CODE YOUR HYPOTHESES**: Test every possible hypothesis using the `code_execution` tool with Python or `agent-browser` skill. Each run must be under 15 seconds and must densely pack every possible related hypothesis. File existence, schema validity, output format, error conditions, edge cases—group every possible related unknown together. The goal is every possible hypothesis per run. Use `agent-browser` skill for cross-client UI testing and browser-based hypothesis validation.
|
|
60
60
|
|
|
61
|
-
**DEFAULT IS
|
|
61
|
+
**DEFAULT IS code_execution WITH PYTHON**: Call the `code_execution` tool with Python code. The PreToolUse hook intercepts it, runs python3, and returns the output. Bash is blocked except for git, npm publish, and docker. If you find yourself writing a bash command, stop and ask: can this be done in Python? The answer is almost always yes. Use `subprocess.run()` for shell operations that truly can't be done otherwise.
|
|
62
62
|
|
|
63
63
|
**TOOL POLICY**: All code execution via `dev` skill. Use `code-search` skill for exploration. Reference TOOL_INVARIANTS for enforcement.
|
|
64
64
|
|
|
@@ -74,8 +74,8 @@ All execution via `dev` skill or `agent-browser` skill. Every hypothesis proven
|
|
|
74
74
|
|
|
75
75
|
**REQUIRED TOOL MAPPING**:
|
|
76
76
|
- Code exploration: `code-search` skill — THE ONLY exploration tool. Semantic search 102 file types. Natural language queries with line numbers. No glob, no grep, no find, no explore agent, no Read for discovery.
|
|
77
|
-
- Code execution: `
|
|
78
|
-
- File operations: `
|
|
77
|
+
- Code execution: call the `code_execution` tool directly with Python code — the PreToolUse hook intercepts it, runs python3, and returns `[CODE EXECUTION RESULT]\nstdout: ...\nstderr: ...\nexit_code: N` as the result. Use Python's `subprocess` module for shell operations, `pathlib`/`os` for files, `requests` for HTTP.
|
|
78
|
+
- File operations: `code_execution` tool with Python `pathlib`/`os`/`open()` — read, write, stat files
|
|
79
79
|
- Bash: ONLY git, npm publish/pack, docker, system daemons
|
|
80
80
|
- Browser: Use **`agent-browser` skill** instead of puppeteer/playwright - same power, cleaner syntax, built for AI agents
|
|
81
81
|
|
|
@@ -59,25 +59,10 @@ const run = () => {
|
|
|
59
59
|
const command = (tool_input?.command || '').trim();
|
|
60
60
|
const allowed = /^(git |npm publish|npm pack|docker |sudo systemctl|systemctl )/.test(command);
|
|
61
61
|
if (!allowed) {
|
|
62
|
-
return { block: true, reason: 'Bash is blocked. Use the code_execution tool
|
|
62
|
+
return { block: true, reason: 'Bash is blocked. Use the code_execution MCP tool instead. It supports Python, JS/TS, Go, Rust, C/C++ and bash via the language parameter. Example: code_execution({ code: "print(1+1)", language: "python", workingDirectory: process.cwd() })' };
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
if (tool_name === 'code_execution') {
|
|
67
|
-
const code = tool_input?.code || '';
|
|
68
|
-
const { spawnSync } = require('child_process');
|
|
69
|
-
const proc = spawnSync('python3', ['-'], {
|
|
70
|
-
input: code,
|
|
71
|
-
encoding: 'utf-8',
|
|
72
|
-
timeout: 30000
|
|
73
|
-
});
|
|
74
|
-
const stdout = proc.stdout || '';
|
|
75
|
-
const stderr = proc.stderr || '';
|
|
76
|
-
const exitCode = proc.status !== null ? proc.status : 1;
|
|
77
|
-
const result = `[CODE EXECUTION RESULT]\nstdout: ${stdout}\nstderr: ${stderr}\nexit_code: ${exitCode}`;
|
|
78
|
-
return { block: true, reason: result };
|
|
79
|
-
}
|
|
80
|
-
|
|
81
66
|
return { allow: true };
|
|
82
67
|
} catch (error) {
|
|
83
68
|
return { allow: true };
|
package/package.json
CHANGED
package/scripts/postinstall.js
CHANGED
|
@@ -127,11 +127,31 @@ function install() {
|
|
|
127
127
|
// Copy files
|
|
128
128
|
safeCopyDirectory(path.join(sourceDir, 'agents'), path.join(claudeDir, 'agents'));
|
|
129
129
|
safeCopyDirectory(path.join(sourceDir, 'hooks'), path.join(claudeDir, 'hooks'));
|
|
130
|
+
safeCopyDirectory(path.join(sourceDir, 'skills'), path.join(claudeDir, 'skills'));
|
|
130
131
|
safeCopyFile(path.join(sourceDir, '.mcp.json'), path.join(claudeDir, '.mcp.json'));
|
|
131
|
-
|
|
132
|
+
|
|
133
|
+
// Write settings.json with autoUpdates and hooks wired up
|
|
134
|
+
const settingsPath = path.join(claudeDir, 'settings.json');
|
|
135
|
+
let settings = {};
|
|
136
|
+
if (fs.existsSync(settingsPath)) {
|
|
137
|
+
try { settings = JSON.parse(fs.readFileSync(settingsPath, 'utf-8')); } catch (e) {}
|
|
138
|
+
}
|
|
139
|
+
settings.autoUpdates = true;
|
|
140
|
+
settings.hooks = settings.hooks || {};
|
|
141
|
+
const hookCmd = `node ${path.join(claudeDir, 'hooks', 'pre-tool-use-hook.js')}`;
|
|
142
|
+
settings.hooks.PreToolUse = settings.hooks.PreToolUse || [{ matcher: '*', hooks: [{ type: 'command', command: hookCmd }] }];
|
|
143
|
+
const sessionHookCmd = `node ${path.join(claudeDir, 'hooks', 'session-start-hook.js')}`;
|
|
144
|
+
settings.hooks.SessionStart = settings.hooks.SessionStart || [{ hooks: [{ type: 'command', command: sessionHookCmd }] }];
|
|
145
|
+
const stopHookCmd = `node ${path.join(claudeDir, 'hooks', 'stop-hook.js')}`;
|
|
146
|
+
const stopGitCmd = `node ${path.join(claudeDir, 'hooks', 'stop-hook-git.js')}`;
|
|
147
|
+
settings.hooks.Stop = settings.hooks.Stop || [{ hooks: [{ type: 'command', command: stopHookCmd }, { type: 'command', command: stopGitCmd }] }];
|
|
148
|
+
const promptHookCmd = `node ${path.join(claudeDir, 'hooks', 'prompt-submit-hook.js')}`;
|
|
149
|
+
settings.hooks.UserPromptSubmit = settings.hooks.UserPromptSubmit || [{ hooks: [{ type: 'command', command: promptHookCmd }] }];
|
|
150
|
+
fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2), 'utf-8');
|
|
151
|
+
|
|
132
152
|
// Update .gitignore
|
|
133
153
|
updateGitignore(projectRoot);
|
|
134
|
-
|
|
154
|
+
|
|
135
155
|
// Silent success
|
|
136
156
|
}
|
|
137
157
|
|