gm-copilot-cli 2.0.162 → 2.0.163
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 +12 -4
- package/manifest.yml +1 -1
- package/package.json +1 -1
- package/tools.json +1 -1
package/copilot-profile.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const fs = require('fs');
|
|
4
4
|
const path = require('path');
|
|
5
|
-
const { execSync } = require('child_process');
|
|
5
|
+
const { execSync, spawnSync } = require('child_process');
|
|
6
6
|
|
|
7
7
|
const isGemini = process.env.GEMINI_PROJECT_DIR !== undefined;
|
|
8
8
|
|
|
@@ -71,6 +71,7 @@ const run = () => {
|
|
|
71
71
|
const lang = execMatch[1] || 'nodejs';
|
|
72
72
|
const code = execMatch[2];
|
|
73
73
|
const cwd = tool_input?.cwd;
|
|
74
|
+
const stripFooter = (s) => s.replace(/\n\[Running tools\][\s\S]*$/, '').trimEnd();
|
|
74
75
|
try {
|
|
75
76
|
let args;
|
|
76
77
|
if (lang === 'bash' || lang === 'sh' || lang === 'cmd') {
|
|
@@ -82,9 +83,16 @@ const run = () => {
|
|
|
82
83
|
if (cwd) args.push(`--cwd=${cwd}`);
|
|
83
84
|
args.push(code);
|
|
84
85
|
}
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
|
|
86
|
+
const r = spawnSync('bun', args, { encoding: 'utf-8', timeout: 30000 });
|
|
87
|
+
let result = stripFooter((r.stdout || '') + (r.stderr || ''));
|
|
88
|
+
const bgMatch = result.match(/Command running in background with ID:\s*(\S+)/);
|
|
89
|
+
if (bgMatch) {
|
|
90
|
+
const taskId = bgMatch[1];
|
|
91
|
+
spawnSync('bun', ['x', 'gm-exec', 'sleep', taskId, '60'], { encoding: 'utf-8', timeout: 70000 });
|
|
92
|
+
const sr = spawnSync('bun', ['x', 'gm-exec', 'status', taskId], { encoding: 'utf-8', timeout: 15000 });
|
|
93
|
+
result = stripFooter((sr.stdout || '') + (sr.stderr || ''));
|
|
94
|
+
spawnSync('bun', ['x', 'gm-exec', 'close', taskId], { encoding: 'utf-8', timeout: 10000 });
|
|
95
|
+
}
|
|
88
96
|
return { block: true, reason: result || '(no output)' };
|
|
89
97
|
} catch (e) {
|
|
90
98
|
const err = (e.stdout || '') + (e.stderr || '') || e.message;
|
package/manifest.yml
CHANGED
package/package.json
CHANGED