gm-copilot-cli 2.0.243 → 2.0.245
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 +23 -6
- package/hooks/session-start-hook.js +60 -2
- 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
|
@@ -13,7 +13,7 @@ const projectDir = process.env.CLAUDE_PROJECT_DIR || process.env.GEMINI_PROJECT_
|
|
|
13
13
|
const TOOLS_DIR = path.join(os.homedir(), '.claude', 'gm-tools');
|
|
14
14
|
const CHECK_STAMP = path.join(TOOLS_DIR, '.last-check');
|
|
15
15
|
const PKG_JSON = path.join(TOOLS_DIR, 'package.json');
|
|
16
|
-
const MANAGED_PKGS = ['
|
|
16
|
+
const MANAGED_PKGS = ['codebasesearch', 'mcp-thorns', 'agent-browser'];
|
|
17
17
|
const CHECK_INTERVAL_MS = 60 * 1000; // 60 seconds
|
|
18
18
|
|
|
19
19
|
function ensureToolsDir() {
|
|
@@ -124,12 +124,27 @@ function loadLangPlugins(projectDir) {
|
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
// Helper: run a local binary (falls back to bunx if not installed)
|
|
127
|
+
function pkgEntry(name) {
|
|
128
|
+
try {
|
|
129
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(TOOLS_DIR, 'node_modules', name, 'package.json'), 'utf8'));
|
|
130
|
+
const binVal = pkg.bin;
|
|
131
|
+
const rel = typeof binVal === 'string' ? binVal : (binVal?.[name] || Object.values(binVal || {})[0]);
|
|
132
|
+
if (rel) return path.join(TOOLS_DIR, 'node_modules', name, rel);
|
|
133
|
+
} catch {}
|
|
134
|
+
return null;
|
|
135
|
+
}
|
|
136
|
+
|
|
127
137
|
function runLocal(name, args, opts = {}) {
|
|
138
|
+
if (IS_WIN) {
|
|
139
|
+
const entry = pkgEntry(name);
|
|
140
|
+
if (entry && fs.existsSync(entry)) {
|
|
141
|
+
return spawnSync('bun', [entry, ...args], { encoding: 'utf8', windowsHide: true, timeout: 65000, ...opts });
|
|
142
|
+
}
|
|
143
|
+
}
|
|
128
144
|
const bin = localBin(name);
|
|
129
145
|
if (fs.existsSync(bin)) {
|
|
130
146
|
return spawnSync(bin, args, { encoding: 'utf8', windowsHide: true, timeout: 65000, ...opts });
|
|
131
147
|
}
|
|
132
|
-
// Fallback to bunx
|
|
133
148
|
return spawnSync('bun', ['x', name, ...args], { encoding: 'utf8', windowsHide: true, timeout: 65000, ...opts });
|
|
134
149
|
}
|
|
135
150
|
|
|
@@ -163,13 +178,15 @@ const allowWithNoop = (context) => {
|
|
|
163
178
|
};
|
|
164
179
|
};
|
|
165
180
|
|
|
166
|
-
// ───
|
|
181
|
+
// ─── rs-exec runner helper ────────────────────────────────────────────────────
|
|
182
|
+
function rsExecBin() { return path.join(TOOLS_DIR, IS_WIN ? 'rs-exec.exe' : 'rs-exec'); }
|
|
183
|
+
|
|
167
184
|
function runGmExec(args, opts = {}) {
|
|
168
|
-
const bin =
|
|
185
|
+
const bin = rsExecBin();
|
|
169
186
|
if (fs.existsSync(bin)) {
|
|
170
187
|
return spawnSync(bin, args, { encoding: 'utf8', windowsHide: true, timeout: 65000, ...opts });
|
|
171
188
|
}
|
|
172
|
-
return spawnSync('
|
|
189
|
+
return spawnSync('rs-exec', args, { encoding: 'utf8', windowsHide: true, timeout: 65000, ...opts });
|
|
173
190
|
}
|
|
174
191
|
|
|
175
192
|
// ─── Main hook ────────────────────────────────────────────────────────────────
|
|
@@ -460,7 +477,7 @@ const run = () => {
|
|
|
460
477
|
}
|
|
461
478
|
}
|
|
462
479
|
|
|
463
|
-
if (/^bun\s+x\s+(gm-exec|codebasesearch)/.test(command)) {
|
|
480
|
+
if (/^bun\s+x\s+(gm-exec|rs-exec|codebasesearch)/.test(command)) {
|
|
464
481
|
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.`);
|
|
465
482
|
}
|
|
466
483
|
|
|
@@ -13,7 +13,23 @@ function localBin(name) {
|
|
|
13
13
|
return path.join(TOOLS_DIR, 'node_modules', '.bin', name + ext);
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
+
function pkgEntry(name) {
|
|
17
|
+
try {
|
|
18
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(TOOLS_DIR, 'node_modules', name, 'package.json'), 'utf8'));
|
|
19
|
+
const binVal = pkg.bin;
|
|
20
|
+
const rel = typeof binVal === 'string' ? binVal : (binVal?.[name] || Object.values(binVal || {})[0]);
|
|
21
|
+
if (rel) return path.join(TOOLS_DIR, 'node_modules', name, rel);
|
|
22
|
+
} catch {}
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
|
|
16
26
|
function runLocal(name, args, opts = {}) {
|
|
27
|
+
if (IS_WIN) {
|
|
28
|
+
const entry = pkgEntry(name);
|
|
29
|
+
if (entry && fs.existsSync(entry)) {
|
|
30
|
+
return spawnSync('bun', [entry, ...args], { encoding: 'utf8', windowsHide: true, timeout: 30000, ...opts });
|
|
31
|
+
}
|
|
32
|
+
}
|
|
17
33
|
const bin = localBin(name);
|
|
18
34
|
if (fs.existsSync(bin)) {
|
|
19
35
|
return spawnSync(bin, args, { encoding: 'utf8', windowsHide: true, timeout: 30000, ...opts });
|
|
@@ -21,9 +37,50 @@ function runLocal(name, args, opts = {}) {
|
|
|
21
37
|
return spawnSync('bun', ['x', name, ...args], { encoding: 'utf8', windowsHide: true, timeout: 30000, ...opts });
|
|
22
38
|
}
|
|
23
39
|
|
|
24
|
-
const MANAGED_PKGS = ['
|
|
40
|
+
const MANAGED_PKGS = ['codebasesearch', 'mcp-thorns', 'agent-browser'];
|
|
25
41
|
const PKG_JSON = path.join(TOOLS_DIR, 'package.json');
|
|
26
42
|
|
|
43
|
+
const RS_EXEC_REPO = 'AnEntrypoint/rs-exec';
|
|
44
|
+
const archMap = { x64: 'x86_64', arm64: 'aarch64', ia32: 'x86_64' };
|
|
45
|
+
const osTargets = {
|
|
46
|
+
win32: a => `rs-exec-${a}-pc-windows-msvcexe`,
|
|
47
|
+
darwin: a => `rs-exec-${a}-apple-darwin`,
|
|
48
|
+
linux: a => `rs-exec-${a}-unknown-linux-gnu`,
|
|
49
|
+
};
|
|
50
|
+
const osProcTargets = {
|
|
51
|
+
win32: a => `rs-exec-process-${a}-pc-windows-msvcexe`,
|
|
52
|
+
darwin: a => `rs-exec-process-${a}-apple-darwin`,
|
|
53
|
+
linux: a => `rs-exec-process-${a}-unknown-linux-gnu`,
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
function rsExecBin() { return path.join(TOOLS_DIR, IS_WIN ? 'rs-exec.exe' : 'rs-exec'); }
|
|
57
|
+
function rsExecProcessBin() { return path.join(TOOLS_DIR, IS_WIN ? 'rs-exec-process.exe' : 'rs-exec-process'); }
|
|
58
|
+
|
|
59
|
+
function downloadBin(assetName, dest) {
|
|
60
|
+
const https = require('https');
|
|
61
|
+
const url = `https://github.com/${RS_EXEC_REPO}/releases/latest/download/${assetName}`;
|
|
62
|
+
return new Promise((resolve) => {
|
|
63
|
+
const follow = (u) => https.get(u, { headers: { 'User-Agent': 'gm' } }, res => {
|
|
64
|
+
if (res.statusCode >= 300 && res.statusCode < 400) return follow(res.headers.location);
|
|
65
|
+
const chunks = [];
|
|
66
|
+
res.on('data', c => chunks.push(c));
|
|
67
|
+
res.on('end', () => { try { fs.writeFileSync(dest, Buffer.concat(chunks)); fs.chmodSync(dest, 0o755); } catch {} resolve(); });
|
|
68
|
+
}).on('error', () => resolve());
|
|
69
|
+
follow(url);
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
async function ensureRsExec() {
|
|
74
|
+
const arch = archMap[process.arch] || 'x86_64';
|
|
75
|
+
const plat = process.platform;
|
|
76
|
+
const mainBin = rsExecBin();
|
|
77
|
+
const procBin = rsExecProcessBin();
|
|
78
|
+
const downloads = [];
|
|
79
|
+
if (!fs.existsSync(mainBin)) downloads.push(downloadBin(osTargets[plat]?.(arch) || osTargets.linux(arch), mainBin));
|
|
80
|
+
if (!fs.existsSync(procBin)) downloads.push(downloadBin(osProcTargets[plat]?.(arch) || osProcTargets.linux(arch), procBin));
|
|
81
|
+
if (downloads.length) await Promise.all(downloads);
|
|
82
|
+
}
|
|
83
|
+
|
|
27
84
|
function ensureTools() {
|
|
28
85
|
try { fs.mkdirSync(TOOLS_DIR, { recursive: true }); } catch {}
|
|
29
86
|
if (!fs.existsSync(PKG_JSON)) {
|
|
@@ -40,6 +97,7 @@ function ensureTools() {
|
|
|
40
97
|
}
|
|
41
98
|
|
|
42
99
|
ensureTools();
|
|
100
|
+
ensureRsExec().catch(() => {});
|
|
43
101
|
|
|
44
102
|
const projectDir = process.env.CLAUDE_PROJECT_DIR || process.env.GEMINI_PROJECT_DIR || process.env.OC_PROJECT_DIR || process.env.KILO_PROJECT_DIR;
|
|
45
103
|
|
|
@@ -92,7 +150,7 @@ ensureGitignore();
|
|
|
92
150
|
try {
|
|
93
151
|
let outputs = [];
|
|
94
152
|
|
|
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
|
|
153
|
+
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 rs-exec ...).');
|
|
96
154
|
|
|
97
155
|
if (projectDir && fs.existsSync(projectDir)) {
|
|
98
156
|
try {
|
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.245";
|
|
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