gm-cc 2.0.242 → 2.0.244
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.
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"name": "AnEntrypoint"
|
|
5
5
|
},
|
|
6
6
|
"description": "State machine agent with hooks, skills, and automated git enforcement",
|
|
7
|
-
"version": "2.0.
|
|
7
|
+
"version": "2.0.244",
|
|
8
8
|
"metadata": {
|
|
9
9
|
"description": "State machine agent with hooks, skills, and automated git enforcement"
|
|
10
10
|
},
|
|
@@ -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() {
|
|
@@ -163,13 +163,15 @@ const allowWithNoop = (context) => {
|
|
|
163
163
|
};
|
|
164
164
|
};
|
|
165
165
|
|
|
166
|
-
// ───
|
|
166
|
+
// ─── rs-exec runner helper ────────────────────────────────────────────────────
|
|
167
|
+
function rsExecBin() { return path.join(TOOLS_DIR, IS_WIN ? 'rs-exec.exe' : 'rs-exec'); }
|
|
168
|
+
|
|
167
169
|
function runGmExec(args, opts = {}) {
|
|
168
|
-
const bin =
|
|
170
|
+
const bin = rsExecBin();
|
|
169
171
|
if (fs.existsSync(bin)) {
|
|
170
172
|
return spawnSync(bin, args, { encoding: 'utf8', windowsHide: true, timeout: 65000, ...opts });
|
|
171
173
|
}
|
|
172
|
-
return spawnSync('
|
|
174
|
+
return spawnSync('rs-exec', args, { encoding: 'utf8', windowsHide: true, timeout: 65000, ...opts });
|
|
173
175
|
}
|
|
174
176
|
|
|
175
177
|
// ─── Main hook ────────────────────────────────────────────────────────────────
|
|
@@ -258,7 +260,8 @@ const run = () => {
|
|
|
258
260
|
return { globalArgs, rest };
|
|
259
261
|
}
|
|
260
262
|
const spawnAb = (bin, args, stdin) => {
|
|
261
|
-
const
|
|
263
|
+
const headed = args.includes('--headed');
|
|
264
|
+
const opts = { encoding: 'utf-8', timeout: 60000, windowsHide: !headed, ...(IS_WIN && { shell: true }), cwd: process.cwd(), ...(stdin !== undefined && { input: stdin }) };
|
|
262
265
|
const r = spawnSync(bin, args, opts);
|
|
263
266
|
if (!r.stdout && !r.stderr && r.error) return `[spawn error: ${r.error.message}]`;
|
|
264
267
|
const out = (r.stdout || '').trimEnd(), err = stripFooter(r.stderr || '').trimEnd();
|
|
@@ -459,7 +462,7 @@ const run = () => {
|
|
|
459
462
|
}
|
|
460
463
|
}
|
|
461
464
|
|
|
462
|
-
if (/^bun\s+x\s+(gm-exec|codebasesearch)/.test(command)) {
|
|
465
|
+
if (/^bun\s+x\s+(gm-exec|rs-exec|codebasesearch)/.test(command)) {
|
|
463
466
|
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.`);
|
|
464
467
|
}
|
|
465
468
|
|
|
@@ -21,9 +21,50 @@ function runLocal(name, args, opts = {}) {
|
|
|
21
21
|
return spawnSync('bun', ['x', name, ...args], { encoding: 'utf8', windowsHide: true, timeout: 30000, ...opts });
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
const MANAGED_PKGS = ['
|
|
24
|
+
const MANAGED_PKGS = ['codebasesearch', 'mcp-thorns', 'agent-browser'];
|
|
25
25
|
const PKG_JSON = path.join(TOOLS_DIR, 'package.json');
|
|
26
26
|
|
|
27
|
+
const RS_EXEC_REPO = 'AnEntrypoint/rs-exec';
|
|
28
|
+
const archMap = { x64: 'x86_64', arm64: 'aarch64', ia32: 'x86_64' };
|
|
29
|
+
const osTargets = {
|
|
30
|
+
win32: a => `rs-exec-${a}-pc-windows-msvcexe`,
|
|
31
|
+
darwin: a => `rs-exec-${a}-apple-darwin`,
|
|
32
|
+
linux: a => `rs-exec-${a}-unknown-linux-gnu`,
|
|
33
|
+
};
|
|
34
|
+
const osProcTargets = {
|
|
35
|
+
win32: a => `rs-exec-process-${a}-pc-windows-msvcexe`,
|
|
36
|
+
darwin: a => `rs-exec-process-${a}-apple-darwin`,
|
|
37
|
+
linux: a => `rs-exec-process-${a}-unknown-linux-gnu`,
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
function rsExecBin() { return path.join(TOOLS_DIR, IS_WIN ? 'rs-exec.exe' : 'rs-exec'); }
|
|
41
|
+
function rsExecProcessBin() { return path.join(TOOLS_DIR, IS_WIN ? 'rs-exec-process.exe' : 'rs-exec-process'); }
|
|
42
|
+
|
|
43
|
+
function downloadBin(assetName, dest) {
|
|
44
|
+
const https = require('https');
|
|
45
|
+
const url = `https://github.com/${RS_EXEC_REPO}/releases/latest/download/${assetName}`;
|
|
46
|
+
return new Promise((resolve) => {
|
|
47
|
+
const follow = (u) => https.get(u, { headers: { 'User-Agent': 'gm' } }, res => {
|
|
48
|
+
if (res.statusCode >= 300 && res.statusCode < 400) return follow(res.headers.location);
|
|
49
|
+
const chunks = [];
|
|
50
|
+
res.on('data', c => chunks.push(c));
|
|
51
|
+
res.on('end', () => { try { fs.writeFileSync(dest, Buffer.concat(chunks)); fs.chmodSync(dest, 0o755); } catch {} resolve(); });
|
|
52
|
+
}).on('error', () => resolve());
|
|
53
|
+
follow(url);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
async function ensureRsExec() {
|
|
58
|
+
const arch = archMap[process.arch] || 'x86_64';
|
|
59
|
+
const plat = process.platform;
|
|
60
|
+
const mainBin = rsExecBin();
|
|
61
|
+
const procBin = rsExecProcessBin();
|
|
62
|
+
const downloads = [];
|
|
63
|
+
if (!fs.existsSync(mainBin)) downloads.push(downloadBin(osTargets[plat]?.(arch) || osTargets.linux(arch), mainBin));
|
|
64
|
+
if (!fs.existsSync(procBin)) downloads.push(downloadBin(osProcTargets[plat]?.(arch) || osProcTargets.linux(arch), procBin));
|
|
65
|
+
if (downloads.length) await Promise.all(downloads);
|
|
66
|
+
}
|
|
67
|
+
|
|
27
68
|
function ensureTools() {
|
|
28
69
|
try { fs.mkdirSync(TOOLS_DIR, { recursive: true }); } catch {}
|
|
29
70
|
if (!fs.existsSync(PKG_JSON)) {
|
|
@@ -40,6 +81,7 @@ function ensureTools() {
|
|
|
40
81
|
}
|
|
41
82
|
|
|
42
83
|
ensureTools();
|
|
84
|
+
ensureRsExec().catch(() => {});
|
|
43
85
|
|
|
44
86
|
const projectDir = process.env.CLAUDE_PROJECT_DIR || process.env.GEMINI_PROJECT_DIR || process.env.OC_PROJECT_DIR || process.env.KILO_PROJECT_DIR;
|
|
45
87
|
|
|
@@ -92,7 +134,7 @@ ensureGitignore();
|
|
|
92
134
|
try {
|
|
93
135
|
let outputs = [];
|
|
94
136
|
|
|
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
|
|
137
|
+
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
138
|
|
|
97
139
|
if (projectDir && fs.existsSync(projectDir)) {
|
|
98
140
|
try {
|
package/package.json
CHANGED