gm-copilot-cli 2.0.158 → 2.0.159
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/agents/gm.md +8 -4
- package/copilot-profile.md +1 -1
- package/hooks/pre-tool-use-hook.js +29 -0
- package/manifest.yml +1 -1
- package/package.json +1 -1
- package/tools.json +1 -1
package/agents/gm.md
CHANGED
|
@@ -50,6 +50,8 @@ Scope: All available skills and their mandatory usage rules. Every skill listed
|
|
|
50
50
|
|
|
51
51
|
**`gm` agent** — Subagent orchestration. MANDATORY for parallel work waves. Launch via Task tool with subagent_type gm:gm. Maximum 3 per wave. Independent items run simultaneously; dependent items wait. Sequential execution of independent items is forbidden.
|
|
52
52
|
|
|
53
|
+
**`exec` tool** — Transparent code execution via pre-tool-use hook interception. Call as a native tool with params: `lang` (nodejs|python|bash|sh|cmd|go|rust|c|cpp|java|deno|typescript, default nodejs), `code` (the code or command to run), `cmd` (alias for code, preferred for bash/cmd langs), `cwd` (optional working directory). Returns stdout+stderr of execution as the tool response. The hook intercepts the call, runs it via gm-exec, and returns the output synchronously. Use instead of Bash tool for all code and shell execution.
|
|
54
|
+
|
|
53
55
|
|
|
54
56
|
|
|
55
57
|
## CHARTER 1: PRD
|
|
@@ -183,7 +185,8 @@ Server + client split:
|
|
|
183
185
|
|
|
184
186
|
**BASH WHITELIST** — environment blocks all bash except:
|
|
185
187
|
- `git` — version control only
|
|
186
|
-
- `
|
|
188
|
+
- `exec` tool — preferred over Bash for all code execution and shell commands (intercepted by hook, runs via gm-exec, returns output as tool response)
|
|
189
|
+
- `bun x gm-exec` — fallback when exec tool is unavailable:
|
|
187
190
|
- `bun x gm-exec bash [--cwd=<dir>] <cmd>` — run shell commands
|
|
188
191
|
- `bun x gm-exec exec [--lang=<lang>] [--cwd=<dir>] [--file=<path>] <code>` — execute code (nodejs default; langs: nodejs, python, go, rust, c, cpp, java, deno, bash, cmd)
|
|
189
192
|
- `bun x gm-exec status <task_id>` — poll status + drain output of background task
|
|
@@ -364,9 +367,10 @@ SYSTEM_INVARIANTS = {
|
|
|
364
367
|
}
|
|
365
368
|
|
|
366
369
|
TOOL_INVARIANTS = {
|
|
367
|
-
default: `
|
|
368
|
-
|
|
369
|
-
|
|
370
|
+
default: `exec` tool (not raw bash, not grep, not glob),
|
|
371
|
+
exec_tool: use exec tool for all code execution when available (lang=nodejs|python|bash|etc, code=..., cwd=...),
|
|
372
|
+
code_execution: `exec` tool with lang param, fallback to `bun x gm-exec exec <code>`,
|
|
373
|
+
file_operations: `exec` tool with lang=nodejs and inline fs, fallback to `bun x gm-exec exec` with inline fs,
|
|
370
374
|
exploration: codesearch ONLY (Glob=blocked, Grep=blocked, Explore=blocked, Read-for-discovery=blocked),
|
|
371
375
|
overview: `code-search` skill,
|
|
372
376
|
process_lifecycle: `process-management` skill (PM2 mandatory for all servers/workers/daemons),
|
package/copilot-profile.md
CHANGED
|
@@ -18,6 +18,35 @@ const run = () => {
|
|
|
18
18
|
|
|
19
19
|
if (!tool_name) return { allow: true };
|
|
20
20
|
|
|
21
|
+
if (tool_name === 'exec') {
|
|
22
|
+
const { lang = 'nodejs', code, cmd, cwd } = tool_input || {};
|
|
23
|
+
const actualCode = code || cmd;
|
|
24
|
+
if (!actualCode) {
|
|
25
|
+
return { block: true, reason: 'exec tool requires code or cmd parameter' };
|
|
26
|
+
}
|
|
27
|
+
try {
|
|
28
|
+
let args;
|
|
29
|
+
if (lang === 'bash' || lang === 'cmd' || lang === 'sh') {
|
|
30
|
+
args = ['x', 'gm-exec', 'bash'];
|
|
31
|
+
if (cwd) args.push(`--cwd=${cwd}`);
|
|
32
|
+
args.push(actualCode);
|
|
33
|
+
} else {
|
|
34
|
+
args = ['x', 'gm-exec', 'exec', `--lang=${lang}`];
|
|
35
|
+
if (cwd) args.push(`--cwd=${cwd}`);
|
|
36
|
+
args.push(actualCode);
|
|
37
|
+
}
|
|
38
|
+
const result = execSync('bun ' + args.map(a => JSON.stringify(a)).join(' '), {
|
|
39
|
+
encoding: 'utf-8',
|
|
40
|
+
timeout: 30000,
|
|
41
|
+
stdio: ['ignore', 'pipe', 'pipe']
|
|
42
|
+
});
|
|
43
|
+
return { block: true, reason: result || '(no output)' };
|
|
44
|
+
} catch (e) {
|
|
45
|
+
const err = (e.stdout || '') + (e.stderr || '') || e.message;
|
|
46
|
+
return { block: true, reason: `exec error: ${err}` };
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
21
50
|
if (forbiddenTools.includes(tool_name)) {
|
|
22
51
|
return { block: true, reason: 'Use the code-search skill for codebase exploration instead of Grep/Glob/find. Describe what you need in plain language — it understands intent, not just patterns.' };
|
|
23
52
|
}
|
package/manifest.yml
CHANGED
package/package.json
CHANGED