gm-gc 2.0.238 → 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
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') {
|
|
@@ -445,12 +429,12 @@ const run = () => {
|
|
|
445
429
|
}
|
|
446
430
|
}
|
|
447
431
|
|
|
448
|
-
if (
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
return deny(`Bash is restricted to exec:<lang> and git.\n\nexec:<lang> syntax (lang auto-detected if omitted):\n exec:nodejs / exec:python / exec:bash / exec:typescript\n exec:go / exec:rust / exec:java / exec:c / exec:cpp\n exec:cmd ← runs cmd.exe /c on Windows\n exec:agent-browser ← browser CLI (open, click, snapshot, wait, tab, console...)\n OR JS eval when body is not a CLI command\n exec ← auto-detects language\n\nexec:agent-browser examples:\n open http://localhost:3001 ← navigate\n snapshot -i ← get element refs\n wait 2000 ← wait ms\n console ← read browser console\n close ← ALWAYS close when done\n document.title ← JS eval (not a CLI command)\n\nMultiple CLI commands in one block run as batch:\n exec:agent-browser\n open http://localhost:3001\n wait 2000\n snapshot -i\n\nTask management shortcuts (body = args):\n exec:status\n <task_id>\n\n exec:sleep\n <task_id> [seconds] [--next-output]\n\n exec:type\n <task_id>\n <input to send to stdin>\n\n exec:close\n <task_id>\n\n exec:runner\n start|stop|status\n\nCode search shortcut:\n exec:codesearch\n <natural language query>\n\
|
|
432
|
+
if (/^bun\s+x\s+(gm-exec|codebasesearch)/.test(command)) {
|
|
433
|
+
return deny(`Do not call ${command.match(/^bun\s+x\s+(\S+)/)[1]} directly. Use exec:<lang> syntax instead.\n\nExamples:\n exec:nodejs\n console.log("hello")\n\n exec:codesearch\n find all database queries\n\n exec:bash\n ls -la\n\nThe exec: prefix routes through the hook dispatcher which handles language detection, background tasks, and tool management automatically.`);
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
if (!/^exec(\s|:)/.test(command) && !/^git /.test(command) && !/(\bclaude\b)/.test(command) && !/^npm install .* \/config\/.gmweb/.test(command) && !/^bun install --cwd \/config\/.gmweb/.test(command)) {
|
|
437
|
+
return deny(`Bash is restricted to exec:<lang> and git.\n\nexec:<lang> syntax (lang auto-detected if omitted):\n exec:nodejs / exec:python / exec:bash / exec:typescript\n exec:go / exec:rust / exec:java / exec:c / exec:cpp\n exec:cmd ← runs cmd.exe /c on Windows\n exec:agent-browser ← browser CLI (open, click, snapshot, wait, tab, console...)\n OR JS eval when body is not a CLI command\n exec ← auto-detects language\n\nexec:agent-browser examples:\n open http://localhost:3001 ← navigate\n snapshot -i ← get element refs\n wait 2000 ← wait ms\n console ← read browser console\n close ← ALWAYS close when done\n document.title ← JS eval (not a CLI command)\n\nMultiple CLI commands in one block run as batch:\n exec:agent-browser\n open http://localhost:3001\n wait 2000\n snapshot -i\n\nTask management shortcuts (body = args):\n exec:status\n <task_id>\n\n exec:sleep\n <task_id> [seconds] [--next-output]\n\n exec:type\n <task_id>\n <input to send to stdin>\n\n exec:close\n <task_id>\n\n exec:runner\n start|stop|status\n\nCode search shortcut:\n exec:codesearch\n <natural language query>\n\nAll other Bash commands are blocked.`);
|
|
454
438
|
}
|
|
455
439
|
}
|
|
456
440
|
|
|
@@ -92,7 +92,7 @@ ensureGitignore();
|
|
|
92
92
|
try {
|
|
93
93
|
let outputs = [];
|
|
94
94
|
|
|
95
|
-
outputs.push('Use the Skill tool with skill: "gm" to begin — do NOT use the Agent tool to load skills. Skills are invoked via the Skill tool only, never as agents. All code execution uses exec:<lang> via the Bash tool — never direct Bash(node ...) or Bash(npm ...) or Bash(npx ...).');
|
|
95
|
+
outputs.push('Use the Skill tool with skill: "gm" to begin — do NOT use the Agent tool to load skills. Skills are invoked via the Skill tool only, never as agents. All code execution uses exec:<lang> via the Bash tool — never direct Bash(node ...) or Bash(npm ...) or Bash(npx ...) or Bash(bun x gm-exec ...).');
|
|
96
96
|
|
|
97
97
|
if (projectDir && fs.existsSync(projectDir)) {
|
|
98
98
|
try {
|