gm-kilo 2.0.49 → 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/hooks/pre-tool-use-hook.js +1 -16
- package/package.json +1 -1
- package/scripts/postinstall.js +22 -2
package/.mcp.json
CHANGED
|
@@ -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
|
|