gm-copilot-cli 2.0.168 → 2.0.171
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/copilot-profile.md +1 -1
- package/hooks/pre-tool-use-hook.js +26 -13
- package/index.html +1 -1
- package/manifest.yml +1 -1
- package/package.json +1 -1
- package/tools.json +1 -1
package/copilot-profile.md
CHANGED
|
@@ -99,15 +99,22 @@ const run = () => {
|
|
|
99
99
|
if (cwd) opts.cwd = cwd;
|
|
100
100
|
if (input !== undefined) opts.input = input;
|
|
101
101
|
const r = spawnSync(bin, args, opts);
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
return
|
|
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);
|
|
106
107
|
};
|
|
107
108
|
try {
|
|
108
109
|
let result;
|
|
109
110
|
if (lang === 'bash' || lang === 'cmd') {
|
|
110
|
-
|
|
111
|
+
const shFile = path.join(os.tmpdir(), `gm-exec-${Date.now()}.ps1`);
|
|
112
|
+
fs.writeFileSync(shFile, code, 'utf-8');
|
|
113
|
+
result = spawnDirect('powershell', ['-NoProfile', '-NonInteractive', '-File', shFile]);
|
|
114
|
+
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
|
+
}
|
|
111
118
|
} else if (lang === 'python' || lang === 'py') {
|
|
112
119
|
result = spawnDirect('python3', ['-c', code]);
|
|
113
120
|
if (!result || result.startsWith('[spawn error:')) result = spawnDirect('python', ['-c', code]);
|
|
@@ -115,16 +122,17 @@ const run = () => {
|
|
|
115
122
|
const extMap = { typescript: 'ts', deno: 'ts' };
|
|
116
123
|
const ext = extMap[lang] || 'mjs';
|
|
117
124
|
const tmpFile = path.join(os.tmpdir(), `gm-exec-${Date.now()}.${ext}`);
|
|
118
|
-
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
|
|
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); } }`;
|
|
119
126
|
fs.writeFileSync(tmpFile, wrapped, 'utf-8');
|
|
120
127
|
result = spawnDirect('bun', ['run', tmpFile]);
|
|
121
128
|
try { fs.unlinkSync(tmpFile); } catch (e) {}
|
|
129
|
+
if (result) result = result.split(tmpFile).join('<script>');
|
|
122
130
|
} else {
|
|
123
131
|
result = runExec(['x', 'gm-exec', 'exec', `--lang=${lang}`, ...(cwd ? [`--cwd=${cwd}`] : []), code]);
|
|
124
132
|
}
|
|
125
|
-
return { block: true, reason: `
|
|
133
|
+
return { block: true, reason: `exec ran successfully. Output:\n\n${result || '(no output)'}` };
|
|
126
134
|
} catch (e) {
|
|
127
|
-
return { block: true, reason: (e.stdout || '') + (e.stderr || '') || e.message || '(exec failed)' };
|
|
135
|
+
return { block: true, reason: `exec ran. Error:\n\n${(e.stdout || '') + (e.stderr || '') || e.message || '(exec failed)'}` };
|
|
128
136
|
}
|
|
129
137
|
}
|
|
130
138
|
|
|
@@ -139,13 +147,18 @@ const run = () => {
|
|
|
139
147
|
const input = tool_input || {};
|
|
140
148
|
const script = input.script || input.code || '';
|
|
141
149
|
if (script && !input.url && !input.navigate) {
|
|
142
|
-
const
|
|
150
|
+
const sFooter = (s) => s.replace(/\n\[Running tools\][\s\S]*$/, '').trimEnd();
|
|
143
151
|
try {
|
|
144
|
-
const
|
|
145
|
-
|
|
146
|
-
|
|
152
|
+
const tmpFile = path.join(os.tmpdir(), `gm-exec-${Date.now()}.mjs`);
|
|
153
|
+
fs.writeFileSync(tmpFile, script, 'utf-8');
|
|
154
|
+
const r = spawnSync('bun', ['run', tmpFile], { encoding: 'utf-8', timeout: 65000 });
|
|
155
|
+
try { fs.unlinkSync(tmpFile); } catch (e) {}
|
|
156
|
+
const stdout = (r.stdout || '').trimEnd();
|
|
157
|
+
const stderr = sFooter(r.stderr || '').trimEnd();
|
|
158
|
+
const out = stdout && stderr ? stdout + '\n[stderr]\n' + stderr : sFooter(stdout || stderr);
|
|
159
|
+
return { block: true, reason: `exec ran successfully. Output:\n\n${out || '(no output)'}` };
|
|
147
160
|
} catch (e) {
|
|
148
|
-
return { block: true, reason: (e.stdout || '') + (e.stderr || '') || e.message || '(exec failed)' };
|
|
161
|
+
return { block: true, reason: `exec ran. Error:\n\n${(e.stdout || '') + (e.stderr || '') || e.message || '(exec failed)'}` };
|
|
149
162
|
}
|
|
150
163
|
}
|
|
151
164
|
}
|
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.
|
|
21
|
+
const DESCRIPTION="State machine agent with hooks, skills, and automated git enforcement",VERSION="2.0.171";
|
|
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
package/package.json
CHANGED