gm-kilo 2.0.456 → 2.0.458
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/gm-kilo.mjs +31 -0
- package/package.json +1 -1
- package/scripts/bootstrap.js +1 -1
- package/scripts/postinstall-kilo.js +5 -7
- package/scripts/postinstall-oc.js +5 -6
package/gm-kilo.mjs
CHANGED
|
@@ -47,6 +47,13 @@ function runExecSync(rawLang, code, cwd) {
|
|
|
47
47
|
const lang = LANG_ALIASES[rawLang] || rawLang || 'nodejs';
|
|
48
48
|
const opts = { encoding: 'utf-8', timeout: 30000, ...(cwd && { cwd }) };
|
|
49
49
|
const out = (r) => { const o = (r.stdout||'').trimEnd(), e = stripFooter(r.stderr||'').trimEnd(); return o && e ? o+'\n[stderr]\n'+e : o||e||'(no output)'; };
|
|
50
|
+
if (lang === 'codesearch' || lang === 'search') return runPlugkit(['search', '--path', cwd || process.cwd(), code.trim()]);
|
|
51
|
+
if (lang === 'runner') return runPlugkit(['runner', code.trim()]);
|
|
52
|
+
if (lang === 'status') return runPlugkit(['status', code.trim()]);
|
|
53
|
+
if (lang === 'sleep') return runPlugkit(['sleep', code.trim()]);
|
|
54
|
+
if (lang === 'close') return runPlugkit(['close', code.trim()]);
|
|
55
|
+
if (lang === 'browser') return runPlugkit(['exec', '--lang', 'browser', '--code', code.trim(), '--cwd', cwd || process.cwd()]);
|
|
56
|
+
if (lang === 'cmd') return out(spawnSync('cmd',['/c',code],opts));
|
|
50
57
|
const pluginResult = tryLangPlugin(lang, code, cwd);
|
|
51
58
|
if (pluginResult !== null) return pluginResult;
|
|
52
59
|
if (lang === 'python') return out(spawnSync('python3',['-c',code],opts));
|
|
@@ -68,6 +75,14 @@ function runExecSync(rawLang, code, cwd) {
|
|
|
68
75
|
return result;
|
|
69
76
|
}
|
|
70
77
|
|
|
78
|
+
const BANNED_BASH = ['grep','rg','find','glob','awk','sed','cat','head','tail'];
|
|
79
|
+
function bashBannedTool(code) {
|
|
80
|
+
for (const t of BANNED_BASH) { if (new RegExp('(^|\\||;|&&|\\$\\()\\s*'+t+'(\\s|$)').test(code)) return t; }
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
let sessionStarted = false;
|
|
85
|
+
|
|
71
86
|
export async function GmPlugin({ directory }) {
|
|
72
87
|
const agentMd = join(__dirname, '..', 'agents', 'gm.md');
|
|
73
88
|
const prdFile = join(directory, '.prd');
|
|
@@ -86,6 +101,11 @@ export async function GmPlugin({ directory }) {
|
|
|
86
101
|
}
|
|
87
102
|
} catch(e) {}
|
|
88
103
|
} catch(e) {}
|
|
104
|
+
if (!sessionStarted) {
|
|
105
|
+
sessionStarted = true;
|
|
106
|
+
try { runPlugkit(['hook', 'session-start']); } catch(e) {}
|
|
107
|
+
try { runPlugkit(['bootstrap', directory]); } catch(e) {}
|
|
108
|
+
}
|
|
89
109
|
try { const rules = readFileSync(agentMd,'utf-8'); if (rules) output.system.unshift(rules); } catch(e) {}
|
|
90
110
|
try {
|
|
91
111
|
if (existsSync(prdFile)) {
|
|
@@ -128,6 +148,12 @@ export async function GmPlugin({ directory }) {
|
|
|
128
148
|
if (input.tool === 'Task' && input.args?.subagent_type === 'Explore') {
|
|
129
149
|
throw new Error('The Explore agent is blocked. Use exec:codesearch in the Bash tool instead.\n\nexec:codesearch\n<natural language description of what to find>');
|
|
130
150
|
}
|
|
151
|
+
if (input.tool === 'Skill') {
|
|
152
|
+
const skill = ((input.args && input.args.skill) || '').toLowerCase().replace(/^gm:/,'');
|
|
153
|
+
if (skill === 'explore' || skill === 'search') {
|
|
154
|
+
throw new Error('The search/explore skill is blocked. Use exec:codesearch instead.\n\nexec:codesearch\n<natural language description>');
|
|
155
|
+
}
|
|
156
|
+
}
|
|
131
157
|
if (input.tool === 'write' || input.tool === 'Write' || input.tool === 'edit') {
|
|
132
158
|
const fp = (output.args && output.args.file_path) || (input.args && input.args.file_path) || '';
|
|
133
159
|
const base = basename(fp).toLowerCase();
|
|
@@ -147,6 +173,11 @@ export async function GmPlugin({ directory }) {
|
|
|
147
173
|
output.args.command = "echo 'Bash tool can only be used with exec syntax:\n\nexec[:lang]\n<command>\n\nExamples:\nexec\nls -la\n\nexec:nodejs\nconsole.log(\"hello\")' 1>&2 && false";
|
|
148
174
|
return;
|
|
149
175
|
}
|
|
176
|
+
const rawLang = (m[1]||'').toLowerCase();
|
|
177
|
+
if (rawLang === 'bash' || rawLang === 'sh' || rawLang === '') {
|
|
178
|
+
const banned = bashBannedTool(m[2]);
|
|
179
|
+
if (banned) throw new Error('`'+banned+'` is blocked in exec:bash. Use exec:codesearch instead.');
|
|
180
|
+
}
|
|
150
181
|
const result = runExecSync(m[1]||'', m[2], output.args.workdir || directory);
|
|
151
182
|
output.args = { ...output.args, command: safePrintf('exec:'+(m[1]||'nodejs')+' output:\n\n'+result) };
|
|
152
183
|
}
|
package/package.json
CHANGED
package/scripts/bootstrap.js
CHANGED
|
@@ -5,7 +5,7 @@ const path = require('path');
|
|
|
5
5
|
const https = require('https');
|
|
6
6
|
const { execFileSync } = require('child_process');
|
|
7
7
|
|
|
8
|
-
const pluginRoot = process.env.CLAUDE_PLUGIN_ROOT || process.env.CODEX_PLUGIN_ROOT;
|
|
8
|
+
const pluginRoot = process.env.CLAUDE_PLUGIN_ROOT || process.env.CODEX_PLUGIN_ROOT || process.env.KILO_PLUGIN_ROOT || process.env.OC_PLUGIN_ROOT || process.env.extensionPath;
|
|
9
9
|
if (!pluginRoot) process.exit(0);
|
|
10
10
|
|
|
11
11
|
const IS_WIN = process.platform === 'win32';
|
|
@@ -102,19 +102,17 @@ function install() {
|
|
|
102
102
|
safeCopyDirectory(path.join(sourceDir, 'skills'), path.join(kiloDir, 'skills'));
|
|
103
103
|
safeCopyFile(path.join(sourceDir, 'kilocode.json'), path.join(kiloDir, 'kilocode.json'));
|
|
104
104
|
safeCopyFile(path.join(sourceDir, '.mcp.json'), path.join(kiloDir, '.mcp.json'));
|
|
105
|
-
safeCopyFile(path.join(sourceDir, 'gm.mjs'), path.join(kiloDir, 'gm.mjs'));
|
|
106
|
-
safeCopyFile(path.join(sourceDir, '
|
|
105
|
+
safeCopyFile(path.join(sourceDir, 'gm-kilo.mjs'), path.join(kiloDir, 'plugins', 'gm-kilo.mjs'));
|
|
106
|
+
safeCopyFile(path.join(sourceDir, 'gm.json'), path.join(kiloDir, 'gm.json'));
|
|
107
107
|
safeCopyFile(path.join(sourceDir, 'README.md'), path.join(kiloDir, 'README.md'));
|
|
108
108
|
safeCopyFile(path.join(sourceDir, 'LICENSE'), path.join(kiloDir, 'LICENSE'));
|
|
109
109
|
safeCopyFile(path.join(sourceDir, 'CONTRIBUTING.md'), path.join(kiloDir, 'CONTRIBUTING.md'));
|
|
110
110
|
safeCopyFile(path.join(sourceDir, '.gitignore'), path.join(kiloDir, '.gitignore'));
|
|
111
111
|
safeCopyFile(path.join(sourceDir, '.editorconfig'), path.join(kiloDir, '.editorconfig'));
|
|
112
112
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
if (fs.existsSync(gmMjsSrc)) safeCopyFile(gmMjsSrc, path.join(pluginDir, 'gm.mjs'));
|
|
117
|
-
fs.writeFileSync(path.join(pluginDir, 'index.js'), "export { default } from './gm.mjs';\n", 'utf-8');
|
|
113
|
+
safeCopyDirectory(path.join(sourceDir, 'skills'), path.join(kiloDir, 'skills'));
|
|
114
|
+
safeCopyDirectory(path.join(sourceDir, 'lang'), path.join(kiloDir, 'lang'));
|
|
115
|
+
safeCopyDirectory(path.join(sourceDir, 'bin'), path.join(kiloDir, 'bin'));
|
|
118
116
|
|
|
119
117
|
updateGitignore(projectRoot);
|
|
120
118
|
|
|
@@ -104,18 +104,17 @@ function install() {
|
|
|
104
104
|
safeCopyDirectory(path.join(sourceDir, 'skills'), path.join(ocDir, 'skills'));
|
|
105
105
|
safeCopyFile(path.join(sourceDir, 'opencode.json'), path.join(ocDir, 'opencode.json'));
|
|
106
106
|
safeCopyFile(path.join(sourceDir, '.mcp.json'), path.join(ocDir, '.mcp.json'));
|
|
107
|
-
safeCopyFile(path.join(sourceDir, 'gm.mjs'), path.join(ocDir, 'gm.mjs'));
|
|
108
|
-
safeCopyFile(path.join(sourceDir, '
|
|
107
|
+
safeCopyFile(path.join(sourceDir, 'gm-oc.mjs'), path.join(ocDir, 'plugins', 'gm-oc.mjs'));
|
|
108
|
+
safeCopyFile(path.join(sourceDir, 'gm.json'), path.join(ocDir, 'gm.json'));
|
|
109
109
|
safeCopyFile(path.join(sourceDir, 'README.md'), path.join(ocDir, 'README.md'));
|
|
110
110
|
safeCopyFile(path.join(sourceDir, 'LICENSE'), path.join(ocDir, 'LICENSE'));
|
|
111
111
|
safeCopyFile(path.join(sourceDir, 'CONTRIBUTING.md'), path.join(ocDir, 'CONTRIBUTING.md'));
|
|
112
112
|
safeCopyFile(path.join(sourceDir, '.gitignore'), path.join(ocDir, '.gitignore'));
|
|
113
113
|
safeCopyFile(path.join(sourceDir, '.editorconfig'), path.join(ocDir, '.editorconfig'));
|
|
114
114
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
if (fs.existsSync(gmMjsSrc)) safeCopyFile(gmMjsSrc, path.join(pluginsDir, 'gm-oc.mjs'));
|
|
115
|
+
safeCopyDirectory(path.join(sourceDir, 'skills'), path.join(ocDir, 'skills'));
|
|
116
|
+
safeCopyDirectory(path.join(sourceDir, 'lang'), path.join(ocDir, 'lang'));
|
|
117
|
+
safeCopyDirectory(path.join(sourceDir, 'bin'), path.join(ocDir, 'bin'));
|
|
119
118
|
|
|
120
119
|
updateGitignore(projectRoot);
|
|
121
120
|
|