gm-copilot-cli 2.0.74 → 2.0.75
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/hooks/prompt-submit-hook.js +2 -2
- package/hooks/session-start-hook.js +2 -2
- package/package.json +10 -2
- package/scripts/postinstall.js +101 -0
|
@@ -31,7 +31,7 @@ const runCodeSearch = (query, cwd) => {
|
|
|
31
31
|
const escaped = query.replace(/"/g, '\\"').substring(0, 200);
|
|
32
32
|
let out;
|
|
33
33
|
try {
|
|
34
|
-
out = execSync(`bun x codebasesearch
|
|
34
|
+
out = execSync(`bun x codebasesearch "${escaped}"`, {
|
|
35
35
|
encoding: 'utf-8',
|
|
36
36
|
stdio: ['pipe', 'pipe', 'pipe'],
|
|
37
37
|
cwd,
|
|
@@ -40,7 +40,7 @@ const runCodeSearch = (query, cwd) => {
|
|
|
40
40
|
});
|
|
41
41
|
} catch (bunErr) {
|
|
42
42
|
if (bunErr.killed) return '';
|
|
43
|
-
out = execSync(`npx -y codebasesearch
|
|
43
|
+
out = execSync(`npx -y codebasesearch "${escaped}"`, {
|
|
44
44
|
encoding: 'utf-8',
|
|
45
45
|
stdio: ['pipe', 'pipe', 'pipe'],
|
|
46
46
|
cwd,
|
|
@@ -71,7 +71,7 @@ When exploring unfamiliar code, finding similar patterns, understanding integrat
|
|
|
71
71
|
try {
|
|
72
72
|
let thornOutput;
|
|
73
73
|
try {
|
|
74
|
-
thornOutput = execSync(`bun x mcp-thorns
|
|
74
|
+
thornOutput = execSync(`bun x mcp-thorns`, {
|
|
75
75
|
encoding: 'utf-8',
|
|
76
76
|
stdio: ['pipe', 'pipe', 'pipe'],
|
|
77
77
|
cwd: projectDir,
|
|
@@ -83,7 +83,7 @@ When exploring unfamiliar code, finding similar patterns, understanding integrat
|
|
|
83
83
|
thornOutput = '=== mcp-thorns ===\nSkipped (3min timeout)';
|
|
84
84
|
} else {
|
|
85
85
|
try {
|
|
86
|
-
thornOutput = execSync(`npx -y mcp-thorns
|
|
86
|
+
thornOutput = execSync(`npx -y mcp-thorns`, {
|
|
87
87
|
encoding: 'utf-8',
|
|
88
88
|
stdio: ['pipe', 'pipe', 'pipe'],
|
|
89
89
|
cwd: projectDir,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gm-copilot-cli",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.75",
|
|
4
4
|
"description": "State machine agent with hooks, skills, and automated git enforcement",
|
|
5
5
|
"author": "AnEntrypoint",
|
|
6
6
|
"license": "MIT",
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
"agents/",
|
|
29
29
|
"hooks/",
|
|
30
30
|
"skills/",
|
|
31
|
+
"scripts/",
|
|
31
32
|
".github/",
|
|
32
33
|
"copilot-profile.md",
|
|
33
34
|
"tools.json",
|
|
@@ -35,5 +36,12 @@
|
|
|
35
36
|
".mcp.json",
|
|
36
37
|
"README.md",
|
|
37
38
|
"COPILOT.md"
|
|
38
|
-
]
|
|
39
|
+
],
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"mcp-thorns": "latest",
|
|
42
|
+
"codebasesearch": "latest"
|
|
43
|
+
},
|
|
44
|
+
"scripts": {
|
|
45
|
+
"postinstall": "node scripts/postinstall.js"
|
|
46
|
+
}
|
|
39
47
|
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const { execSync } = require('child_process');
|
|
6
|
+
|
|
7
|
+
function isInsideNodeModules() {
|
|
8
|
+
return __dirname.includes(path.sep + 'node_modules' + path.sep);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function getProjectRoot() {
|
|
12
|
+
if (!isInsideNodeModules()) return null;
|
|
13
|
+
let current = __dirname;
|
|
14
|
+
while (current !== path.dirname(current)) {
|
|
15
|
+
current = path.dirname(current);
|
|
16
|
+
if (path.basename(current) === 'node_modules') {
|
|
17
|
+
return path.dirname(current);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function safeCopyFile(src, dst) {
|
|
24
|
+
try {
|
|
25
|
+
const content = fs.readFileSync(src, 'utf-8');
|
|
26
|
+
const dstDir = path.dirname(dst);
|
|
27
|
+
if (!fs.existsSync(dstDir)) fs.mkdirSync(dstDir, { recursive: true });
|
|
28
|
+
fs.writeFileSync(dst, content, 'utf-8');
|
|
29
|
+
return true;
|
|
30
|
+
} catch (err) {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function safeCopyDirectory(src, dst) {
|
|
36
|
+
try {
|
|
37
|
+
if (!fs.existsSync(src)) return false;
|
|
38
|
+
fs.mkdirSync(dst, { recursive: true });
|
|
39
|
+
fs.readdirSync(src, { withFileTypes: true }).forEach(entry => {
|
|
40
|
+
const srcPath = path.join(src, entry.name);
|
|
41
|
+
const dstPath = path.join(dst, entry.name);
|
|
42
|
+
if (entry.isDirectory()) safeCopyDirectory(srcPath, dstPath);
|
|
43
|
+
else if (entry.isFile()) safeCopyFile(srcPath, dstPath);
|
|
44
|
+
});
|
|
45
|
+
return true;
|
|
46
|
+
} catch (err) {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function updateGitignore(projectRoot) {
|
|
52
|
+
try {
|
|
53
|
+
const gitignorePath = path.join(projectRoot, '.gitignore');
|
|
54
|
+
const entry = '.gm-stop-verified';
|
|
55
|
+
let content = fs.existsSync(gitignorePath) ? fs.readFileSync(gitignorePath, 'utf-8') : '';
|
|
56
|
+
if (content.includes(entry)) return true;
|
|
57
|
+
if (content && !content.endsWith('\n')) content += '\n';
|
|
58
|
+
fs.writeFileSync(gitignorePath, content + entry + '\n', 'utf-8');
|
|
59
|
+
return true;
|
|
60
|
+
} catch (err) {
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function install() {
|
|
66
|
+
if (!isInsideNodeModules()) return;
|
|
67
|
+
const projectRoot = getProjectRoot();
|
|
68
|
+
if (!projectRoot) return;
|
|
69
|
+
const claudeDir = path.join(projectRoot, '.claude');
|
|
70
|
+
const sourceDir = __dirname.replace(/[/\\]scripts$/, '');
|
|
71
|
+
|
|
72
|
+
// Copy files
|
|
73
|
+
safeCopyDirectory(path.join(sourceDir, 'agents'), path.join(claudeDir, 'agents'));
|
|
74
|
+
safeCopyDirectory(path.join(sourceDir, 'hooks'), path.join(claudeDir, 'hooks'));
|
|
75
|
+
safeCopyFile(path.join(sourceDir, '.mcp.json'), path.join(claudeDir, '.mcp.json'));
|
|
76
|
+
|
|
77
|
+
// Update .gitignore
|
|
78
|
+
updateGitignore(projectRoot);
|
|
79
|
+
|
|
80
|
+
// Warm bun x cache for packages used by hooks
|
|
81
|
+
warmBunCache();
|
|
82
|
+
|
|
83
|
+
// Silent success
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function warmBunCache() {
|
|
87
|
+
const packages = ['mcp-thorns@latest', 'codebasesearch@latest'];
|
|
88
|
+
for (const pkg of packages) {
|
|
89
|
+
try {
|
|
90
|
+
execSync(`bun x ${pkg} --version`, {
|
|
91
|
+
encoding: 'utf-8',
|
|
92
|
+
stdio: 'pipe',
|
|
93
|
+
timeout: 60000
|
|
94
|
+
});
|
|
95
|
+
} catch (e) {
|
|
96
|
+
// Silent - cache warming is best-effort
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
install();
|