gm-gc 2.0.239 → 2.0.240
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/gemini-extension.json +1 -1
- package/hooks/pre-tool-use-hook.js +2 -18
- package/package.json +1 -1
package/gemini-extension.json
CHANGED
|
@@ -225,17 +225,6 @@ const run = () => {
|
|
|
225
225
|
const command = (tool_input?.command || '').trim();
|
|
226
226
|
const stripFooter = (s) => s.replace(/\n\[Running tools\][\s\S]*$/, '').trimEnd();
|
|
227
227
|
|
|
228
|
-
if (/^exec:pm2list\s*$/.test(command)) {
|
|
229
|
-
const r = runGmExec(['pm2list']);
|
|
230
|
-
return allowWithNoop(`exec:pm2list output:\n\n${stripFooter((r.stdout || '') + (r.stderr || ''))}`);
|
|
231
|
-
}
|
|
232
|
-
if (/^exec:pm2logs(\s|$)/.test(command)) {
|
|
233
|
-
const args = command.replace(/^exec:pm2logs\s*/, '').trim();
|
|
234
|
-
const pmArgs = args ? ['logs', '--nostream', '--lines', '50', args] : ['logs', '--nostream', '--lines', '50'];
|
|
235
|
-
const r = spawnSync('pm2', pmArgs, { encoding: 'utf-8', timeout: 15000, windowsHide: true });
|
|
236
|
-
return allowWithNoop(`exec:pm2logs output:\n\n${stripFooter((r.stdout || '') + (r.stderr || '')) || '(no logs)'}`);
|
|
237
|
-
}
|
|
238
|
-
|
|
239
228
|
const execMatch = command.match(/^exec(?::(\S+))?\n([\s\S]+)$/);
|
|
240
229
|
if (execMatch) {
|
|
241
230
|
const rawLang = (execMatch[1] || '').toLowerCase();
|
|
@@ -247,7 +236,7 @@ const run = () => {
|
|
|
247
236
|
|
|
248
237
|
// ─── Lang plugin dispatch ─────────────────────────────────────────────
|
|
249
238
|
if (rawLang) {
|
|
250
|
-
const builtins = new Set(['js','javascript','ts','typescript','node','nodejs','py','python','sh','bash','shell','zsh','powershell','ps1','go','rust','c','cpp','java','deno','cmd','browser','ab','agent-browser','codesearch','search','status','sleep','close','runner','type'
|
|
239
|
+
const builtins = new Set(['js','javascript','ts','typescript','node','nodejs','py','python','sh','bash','shell','zsh','powershell','ps1','go','rust','c','cpp','java','deno','cmd','browser','ab','agent-browser','codesearch','search','status','sleep','close','runner','type']);
|
|
251
240
|
if (!builtins.has(rawLang)) {
|
|
252
241
|
const plugins = loadLangPlugins(projectDir);
|
|
253
242
|
const plugin = plugins.find(p => p.exec.match.test(`exec:${rawLang}\n${code}`));
|
|
@@ -274,7 +263,7 @@ const run = () => {
|
|
|
274
263
|
return 'nodejs';
|
|
275
264
|
};
|
|
276
265
|
// Note: 'cmd' is NOT aliased to 'bash' — it has its own handler below
|
|
277
|
-
const aliases = { js: 'nodejs', javascript: 'nodejs', ts: 'typescript', node: 'nodejs', py: 'python', sh: 'bash', shell: 'bash', zsh: 'bash', powershell: 'powershell', ps1: 'powershell', browser: 'agent-browser', ab: 'agent-browser', codesearch: 'codesearch', search: 'search', status: 'status', sleep: 'sleep', close: 'close', runner: 'runner', type: 'type'
|
|
266
|
+
const aliases = { js: 'nodejs', javascript: 'nodejs', ts: 'typescript', node: 'nodejs', py: 'python', sh: 'bash', shell: 'bash', zsh: 'bash', powershell: 'powershell', ps1: 'powershell', browser: 'agent-browser', ab: 'agent-browser', codesearch: 'codesearch', search: 'search', status: 'status', sleep: 'sleep', close: 'close', runner: 'runner', type: 'type' };
|
|
278
267
|
const lang = aliases[rawLang] || rawLang || detectLang(code);
|
|
279
268
|
const langExts = { nodejs: 'mjs', typescript: 'ts', deno: 'ts', python: 'py', bash: 'sh', powershell: 'ps1', go: 'go', rust: 'rs', c: 'c', cpp: 'cpp', java: 'java' };
|
|
280
269
|
|
|
@@ -343,11 +332,6 @@ const run = () => {
|
|
|
343
332
|
const r = runGmExec(['type', taskId, inputData], { timeout: 15000 });
|
|
344
333
|
return allowWithNoop(`exec:type output:\n\n${stripFooter((r.stdout || '') + (r.stderr || ''))}`);
|
|
345
334
|
}
|
|
346
|
-
if (lang === 'pm2list') {
|
|
347
|
-
const r = runGmExec(['pm2list'], { timeout: 15000 });
|
|
348
|
-
return allowWithNoop(`exec:pm2list output:\n\n${stripFooter((r.stdout || '') + (r.stderr || ''))}`);
|
|
349
|
-
}
|
|
350
|
-
|
|
351
335
|
try {
|
|
352
336
|
let result;
|
|
353
337
|
if (lang === 'bash') {
|