gm-kilo 2.0.146 → 2.0.147
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/hooks/prompt-submit-hook.js +24 -1
- package/package.json +1 -1
|
@@ -7,6 +7,7 @@ if (process.env.AGENTGUI_SUBPROCESS === '1') {
|
|
|
7
7
|
|
|
8
8
|
const fs = require('fs');
|
|
9
9
|
const path = require('path');
|
|
10
|
+
const { execSync } = require('child_process');
|
|
10
11
|
|
|
11
12
|
const pluginRoot = process.env.CLAUDE_PLUGIN_ROOT || process.env.GEMINI_PROJECT_DIR || process.env.OC_PLUGIN_ROOT || process.env.KILO_PLUGIN_ROOT || path.join(__dirname, '..');
|
|
12
13
|
const projectDir = process.env.CLAUDE_PROJECT_DIR || process.env.GEMINI_PROJECT_DIR || process.env.OC_PROJECT_DIR || process.env.KILO_PROJECT_DIR;
|
|
@@ -32,6 +33,24 @@ const ensureGitignore = () => {
|
|
|
32
33
|
} catch (e) {}
|
|
33
34
|
};
|
|
34
35
|
|
|
36
|
+
const runThorns = () => {
|
|
37
|
+
if (!projectDir || !fs.existsSync(projectDir)) return '';
|
|
38
|
+
const localThorns = path.join(process.env.HOME || '/root', 'mcp-thorns', 'index.js');
|
|
39
|
+
const thornsBin = fs.existsSync(localThorns) ? `node ${localThorns}` : 'bun x mcp-thorns@latest';
|
|
40
|
+
try {
|
|
41
|
+
const out = execSync(`${thornsBin} ${projectDir}`, {
|
|
42
|
+
encoding: 'utf-8',
|
|
43
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
44
|
+
timeout: 15000,
|
|
45
|
+
killSignal: 'SIGTERM'
|
|
46
|
+
});
|
|
47
|
+
return `=== mcp-thorns ===\n${out.trim()}`;
|
|
48
|
+
} catch (e) {
|
|
49
|
+
if (e.killed) return '=== mcp-thorns ===\nSkipped (timeout)';
|
|
50
|
+
return '';
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
|
|
35
54
|
const emit = (additionalContext) => {
|
|
36
55
|
const isGemini = process.env.GEMINI_PROJECT_DIR !== undefined;
|
|
37
56
|
const isOpenCode = process.env.OC_PROJECT_DIR !== undefined;
|
|
@@ -48,7 +67,11 @@ const emit = (additionalContext) => {
|
|
|
48
67
|
|
|
49
68
|
try {
|
|
50
69
|
ensureGitignore();
|
|
51
|
-
|
|
70
|
+
const parts = [];
|
|
71
|
+
const thorns = runThorns();
|
|
72
|
+
if (thorns) parts.push(thorns);
|
|
73
|
+
parts.push('use gm agent | ' + COMPACT_CONTEXT + ' | ' + PLAN_MODE_BLOCK);
|
|
74
|
+
emit(parts.join('\n\n'));
|
|
52
75
|
} catch (error) {
|
|
53
76
|
emit('use gm agent | hook error: ' + error.message);
|
|
54
77
|
process.exit(0);
|