gm-kilo 2.0.456 → 2.0.457
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 +24 -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
|
@@ -68,6 +68,14 @@ function runExecSync(rawLang, code, cwd) {
|
|
|
68
68
|
return result;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
+
const BANNED_BASH = ['grep','rg','find','glob','awk','sed','cat','head','tail'];
|
|
72
|
+
function bashBannedTool(code) {
|
|
73
|
+
for (const t of BANNED_BASH) { if (new RegExp('(^|\\||;|&&|\\$\\()\\s*'+t+'(\\s|$)').test(code)) return t; }
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
let sessionStarted = false;
|
|
78
|
+
|
|
71
79
|
export async function GmPlugin({ directory }) {
|
|
72
80
|
const agentMd = join(__dirname, '..', 'agents', 'gm.md');
|
|
73
81
|
const prdFile = join(directory, '.prd');
|
|
@@ -86,6 +94,11 @@ export async function GmPlugin({ directory }) {
|
|
|
86
94
|
}
|
|
87
95
|
} catch(e) {}
|
|
88
96
|
} catch(e) {}
|
|
97
|
+
if (!sessionStarted) {
|
|
98
|
+
sessionStarted = true;
|
|
99
|
+
try { runPlugkit(['hook', 'session-start']); } catch(e) {}
|
|
100
|
+
try { runPlugkit(['bootstrap', directory]); } catch(e) {}
|
|
101
|
+
}
|
|
89
102
|
try { const rules = readFileSync(agentMd,'utf-8'); if (rules) output.system.unshift(rules); } catch(e) {}
|
|
90
103
|
try {
|
|
91
104
|
if (existsSync(prdFile)) {
|
|
@@ -128,6 +141,12 @@ export async function GmPlugin({ directory }) {
|
|
|
128
141
|
if (input.tool === 'Task' && input.args?.subagent_type === 'Explore') {
|
|
129
142
|
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
143
|
}
|
|
144
|
+
if (input.tool === 'Skill') {
|
|
145
|
+
const skill = ((input.args && input.args.skill) || '').toLowerCase().replace(/^gm:/,'');
|
|
146
|
+
if (skill === 'explore' || skill === 'search') {
|
|
147
|
+
throw new Error('The search/explore skill is blocked. Use exec:codesearch instead.\n\nexec:codesearch\n<natural language description>');
|
|
148
|
+
}
|
|
149
|
+
}
|
|
131
150
|
if (input.tool === 'write' || input.tool === 'Write' || input.tool === 'edit') {
|
|
132
151
|
const fp = (output.args && output.args.file_path) || (input.args && input.args.file_path) || '';
|
|
133
152
|
const base = basename(fp).toLowerCase();
|
|
@@ -147,6 +166,11 @@ export async function GmPlugin({ directory }) {
|
|
|
147
166
|
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
167
|
return;
|
|
149
168
|
}
|
|
169
|
+
const rawLang = (m[1]||'').toLowerCase();
|
|
170
|
+
if (rawLang === 'bash' || rawLang === 'sh' || rawLang === '') {
|
|
171
|
+
const banned = bashBannedTool(m[2]);
|
|
172
|
+
if (banned) throw new Error('`'+banned+'` is blocked in exec:bash. Use exec:codesearch instead.');
|
|
173
|
+
}
|
|
150
174
|
const result = runExecSync(m[1]||'', m[2], output.args.workdir || directory);
|
|
151
175
|
output.args = { ...output.args, command: safePrintf('exec:'+(m[1]||'nodejs')+' output:\n\n'+result) };
|
|
152
176
|
}
|
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
|
|