gm-copilot-cli 2.0.171 → 2.0.173

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.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: gm
3
- version: 2.0.171
3
+ version: 2.0.173
4
4
  description: State machine agent with hooks, skills, and automated git enforcement
5
5
  author: AnEntrypoint
6
6
  repository: https://github.com/AnEntrypoint/gm-copilot-cli
@@ -78,11 +78,28 @@ const run = () => {
78
78
  if (/^\s*(echo |ls |cd |mkdir |rm |cat |grep |find |export |source |#!)/.test(src)) return 'bash';
79
79
  return 'nodejs';
80
80
  };
81
- const langAliases = { js: 'nodejs', javascript: 'nodejs', ts: 'typescript', node: 'nodejs', py: 'python', sh: 'bash', shell: 'bash', zsh: 'bash' };
81
+ const langAliases = { js: 'nodejs', javascript: 'nodejs', ts: 'typescript', node: 'nodejs', py: 'python', sh: 'bash', shell: 'bash', zsh: 'bash', powershell: 'bash', ps1: 'bash', cmd: 'bash', browser: 'agent-browser', ab: 'agent-browser' };
82
82
  const lang = langAliases[rawLang] || rawLang || detectLang(code);
83
83
  const stripFooter = (s) => s.replace(/\n\[Running tools\][\s\S]*$/, '').trimEnd();
84
- const runExec = (args) => {
85
- const r = spawnSync('bun', args, { encoding: 'utf-8', timeout: 65000 });
84
+ const gmExecLangs = new Set(['go', 'rust', 'c', 'cpp', 'java']);
85
+ const langExts = { nodejs: 'mjs', typescript: 'ts', deno: 'ts', python: 'py', bash: 'ps1', go: 'go', rust: 'rs', c: 'c', cpp: 'cpp', java: 'java' };
86
+ const spawnDirect = (bin, args, input) => {
87
+ const opts = { encoding: 'utf-8', timeout: 60000 };
88
+ if (cwd) opts.cwd = cwd;
89
+ if (input !== undefined) opts.input = input;
90
+ const r = spawnSync(bin, args, opts);
91
+ if (!r.stdout && !r.stderr && r.error) return `[spawn error: ${r.error.message}]`;
92
+ const stdout = (r.stdout || '').trimEnd();
93
+ const stderr = stripFooter(r.stderr || '').trimEnd();
94
+ if (stdout && stderr) return stdout + '\n[stderr]\n' + stderr;
95
+ return stripFooter(stdout || stderr);
96
+ };
97
+ const runWithFile = (lang, code) => {
98
+ const ext = langExts[lang] || lang;
99
+ const tmpFile = path.join(os.tmpdir(), `gm-exec-${Date.now()}.${ext}`);
100
+ fs.writeFileSync(tmpFile, code, 'utf-8');
101
+ const r = spawnSync('bun', ['x', 'gm-exec', 'exec', `--lang=${lang}`, `--file=${tmpFile}`, ...(cwd ? [`--cwd=${cwd}`] : [])], { encoding: 'utf-8', timeout: 65000 });
102
+ try { fs.unlinkSync(tmpFile); } catch (e) {}
86
103
  let out = stripFooter((r.stdout || '') + (r.stderr || ''));
87
104
  const bgMatch = out.match(/Command running in background with ID:\s*(\S+)/);
88
105
  if (bgMatch) {
@@ -94,41 +111,31 @@ const run = () => {
94
111
  }
95
112
  return out;
96
113
  };
97
- const spawnDirect = (bin, args, input) => {
98
- const opts = { encoding: 'utf-8', timeout: 30000 };
99
- if (cwd) opts.cwd = cwd;
100
- if (input !== undefined) opts.input = input;
101
- const r = spawnSync(bin, args, opts);
102
- if (!r.stdout && !r.stderr && r.error) return `[spawn error: ${r.error.message}]`;
103
- const stdout = (r.stdout || '').trimEnd();
104
- const stderr = stripFooter(r.stderr || '').trimEnd();
105
- if (stdout && stderr) return stdout + '\n[stderr]\n' + stderr;
106
- return stripFooter(stdout || stderr);
107
- };
108
114
  try {
109
115
  let result;
110
- if (lang === 'bash' || lang === 'cmd') {
116
+ if (lang === 'bash') {
111
117
  const shFile = path.join(os.tmpdir(), `gm-exec-${Date.now()}.ps1`);
112
118
  fs.writeFileSync(shFile, code, 'utf-8');
113
119
  result = spawnDirect('powershell', ['-NoProfile', '-NonInteractive', '-File', shFile]);
114
120
  try { fs.unlinkSync(shFile); } catch (e) {}
115
- if (!result || result.startsWith('[spawn error:')) {
116
- result = runExec(['x', 'gm-exec', 'bash', ...(cwd ? [`--cwd=${cwd}`] : []), code]);
117
- }
118
- } else if (lang === 'python' || lang === 'py') {
121
+ if (!result || result.startsWith('[spawn error:')) result = runWithFile('bash', code);
122
+ } else if (lang === 'python') {
119
123
  result = spawnDirect('python3', ['-c', code]);
120
124
  if (!result || result.startsWith('[spawn error:')) result = spawnDirect('python', ['-c', code]);
121
125
  } else if (!lang || lang === 'nodejs' || lang === 'typescript' || lang === 'deno') {
122
- const extMap = { typescript: 'ts', deno: 'ts' };
123
- const ext = extMap[lang] || 'mjs';
126
+ const ext = lang === 'typescript' || lang === 'deno' ? 'ts' : 'mjs';
124
127
  const tmpFile = path.join(os.tmpdir(), `gm-exec-${Date.now()}.${ext}`);
125
- const wrapped = `const __result = await (async () => {\n${code}\n})();\nif (__result !== undefined) { const t = typeof __result; if (t === 'object' || Array.isArray(__result)) { console.log(JSON.stringify(__result, null, 2)); } else { console.log(__result); } }`;
128
+ const wrapped = `const __result = await (async () => {\n${code}\n})();\nif (__result !== undefined) { if (typeof __result === 'object') { console.log(JSON.stringify(__result, null, 2)); } else { console.log(__result); } }`;
126
129
  fs.writeFileSync(tmpFile, wrapped, 'utf-8');
127
130
  result = spawnDirect('bun', ['run', tmpFile]);
128
131
  try { fs.unlinkSync(tmpFile); } catch (e) {}
129
132
  if (result) result = result.split(tmpFile).join('<script>');
133
+ } else if (lang === 'agent-browser') {
134
+ result = spawnDirect('agent-browser', ['eval', '--stdin'], code);
135
+ } else if (gmExecLangs.has(lang)) {
136
+ result = runWithFile(lang, code);
130
137
  } else {
131
- result = runExec(['x', 'gm-exec', 'exec', `--lang=${lang}`, ...(cwd ? [`--cwd=${cwd}`] : []), code]);
138
+ result = runWithFile(lang, code);
132
139
  }
133
140
  return { block: true, reason: `exec ran successfully. Output:\n\n${result || '(no output)'}` };
134
141
  } catch (e) {
package/index.html CHANGED
@@ -18,7 +18,7 @@
18
18
  <script type="module">
19
19
  import { createElement as h, applyDiff, Fragment } from "webjsx";
20
20
  const PLATFORM_NAME="Copilot CLI",PLATFORM_TYPE="CLI Tool",PLATFORM_TYPE_COLOR="#3b82f6";
21
- const DESCRIPTION="State machine agent with hooks, skills, and automated git enforcement",VERSION="2.0.171";
21
+ const DESCRIPTION="State machine agent with hooks, skills, and automated git enforcement",VERSION="2.0.173";
22
22
  const GITHUB_URL="https://github.com/AnEntrypoint/gm-copilot-cli",BADGE_LABEL="copilot-cli";
23
23
  const FEATURES=[{"title":"State Machine","desc":"Immutable PLAN→EXECUTE→EMIT→VERIFY→COMPLETE phases with full mutable tracking"},{"title":"Semantic Search","desc":"Natural language codebase exploration via codesearch skill — no grep needed"},{"title":"Hooks","desc":"Pre-tool, session-start, prompt-submit, and stop hooks for full lifecycle control"},{"title":"Agents","desc":"gm, codesearch, and websearch agents pre-configured and ready to use"},{"title":"MCP Integration","desc":"Model Context Protocol server support built in"},{"title":"Auto-Recovery","desc":"Supervisor hierarchy ensures the system never crashes"}],INSTALL_STEPS=[{"desc":"Install via GitHub CLI","cmd":"gh extension install AnEntrypoint/gm-copilot-cli"},{"desc":"Restart your terminal — activates automatically"}];
24
24
  const CURRENT_PLATFORM="gm-copilot-cli";
package/manifest.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  name: gm
2
- version: 2.0.171
2
+ version: 2.0.173
3
3
  description: State machine agent with hooks, skills, and automated git enforcement
4
4
  author: AnEntrypoint
5
5
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm-copilot-cli",
3
- "version": "2.0.171",
3
+ "version": "2.0.173",
4
4
  "description": "State machine agent with hooks, skills, and automated git enforcement",
5
5
  "author": "AnEntrypoint",
6
6
  "license": "MIT",
package/tools.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm",
3
- "version": "2.0.171",
3
+ "version": "2.0.173",
4
4
  "description": "State machine agent with hooks, skills, and automated git enforcement",
5
5
  "tools": [
6
6
  {