gm-gc 2.0.372 → 2.0.374
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/cli.js +1 -3
- package/gemini-extension.json +1 -1
- package/hooks/pre-tool-use-hook.js +1 -1
- package/hooks/prompt-submit-hook.js +3 -10
- package/hooks/session-start-hook.js +2 -4
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -4,9 +4,7 @@ const path = require('path');
|
|
|
4
4
|
const os = require('os');
|
|
5
5
|
|
|
6
6
|
const homeDir = process.env.HOME || process.env.USERPROFILE || os.homedir();
|
|
7
|
-
const destDir =
|
|
8
|
-
? path.join(homeDir, 'AppData', 'Roaming', 'gemini', 'extensions', 'gm')
|
|
9
|
-
: path.join(homeDir, '.gemini', 'extensions', 'gm');
|
|
7
|
+
const destDir = path.join(homeDir, '.gemini', 'extensions', 'gm');
|
|
10
8
|
|
|
11
9
|
const srcDir = __dirname;
|
|
12
10
|
const isUpgrade = fs.existsSync(destDir);
|
package/gemini-extension.json
CHANGED
|
@@ -32,7 +32,7 @@ const run = () => {
|
|
|
32
32
|
const isExec = command.startsWith('exec:');
|
|
33
33
|
const isGit = /^(git |gh )/.test(command);
|
|
34
34
|
if (!isExec && !isGit) {
|
|
35
|
-
return { deny: true, reason: 'run_shell_command
|
|
35
|
+
return { deny: true, reason: 'run_shell_command requires exec:<lang> format with a NEWLINE between the lang and code. Example: exec:bash\nnpm --version\n(newline after exec:bash, not a space). Allowed: exec:nodejs, exec:bash, exec:python, exec:typescript, git, gh.' };
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
return { allow: true };
|
|
@@ -13,10 +13,9 @@ const readGmAgent = () => {
|
|
|
13
13
|
const runMcpThorns = () => {
|
|
14
14
|
if (!projectDir || !fs.existsSync(projectDir)) return '';
|
|
15
15
|
try {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return '=== Repository analysis ===\n' + out;
|
|
16
|
+
const out = execSync('plugkit codeinsight ' + JSON.stringify(projectDir), { encoding: 'utf-8', stdio: 'pipe', cwd: projectDir, timeout: 55000 });
|
|
17
|
+
if (!out || out.startsWith('Error')) return '';
|
|
18
|
+
return '=== This is your initial insight of the repository, look at every possible aspect of this for initial opinionation and to offset the need for code exploration ===\n' + out;
|
|
20
19
|
} catch (e) { return ''; }
|
|
21
20
|
};
|
|
22
21
|
const runCodeSearch = (query) => {
|
|
@@ -36,13 +35,7 @@ try {
|
|
|
36
35
|
const parts = [];
|
|
37
36
|
const gm = readGmAgent();
|
|
38
37
|
if (gm) parts.push(gm);
|
|
39
|
-
const thorns = runMcpThorns();
|
|
40
|
-
if (thorns) parts.push(thorns);
|
|
41
38
|
parts.push('use gm agent | ref: TOOL_INVARIANTS | codesearch for exploration | exec: for execution');
|
|
42
|
-
if (prompt) {
|
|
43
|
-
const sr = runCodeSearch(prompt);
|
|
44
|
-
if (sr) parts.push('=== Semantic code search results ===\n' + sr);
|
|
45
|
-
}
|
|
46
39
|
console.log(JSON.stringify({ systemMessage: parts.join('\n\n') }, null, 2));
|
|
47
40
|
} catch (e) {
|
|
48
41
|
console.log(JSON.stringify({ systemMessage: 'use gm agent' }, null, 2));
|
|
@@ -9,10 +9,8 @@ try {
|
|
|
9
9
|
try { parts.push(fs.readFileSync(path.join(pluginRoot, 'agents/gm.md'), 'utf-8')); } catch (e) {}
|
|
10
10
|
if (projectDir && fs.existsSync(projectDir)) {
|
|
11
11
|
try {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
catch (e) { out = execSync('npx -y mcp-thorns@latest', { encoding: 'utf-8', stdio: 'pipe', cwd: projectDir, timeout: 180000 }); }
|
|
15
|
-
parts.push('=== This is your initial insight of the repository ===\n' + out);
|
|
12
|
+
const out = execSync('plugkit codeinsight ' + JSON.stringify(projectDir), { encoding: 'utf-8', stdio: 'pipe', cwd: projectDir, timeout: 55000 });
|
|
13
|
+
if (out && !out.startsWith('Error')) parts.push('=== This is your initial insight of the repository, look at every possible aspect of this for initial opinionation and to offset the need for code exploration ===\n' + out);
|
|
16
14
|
} catch (e) {}
|
|
17
15
|
}
|
|
18
16
|
parts.push('Use gm as a philosophy to coordinate all plans and the gm subagent to create and execute all plans');
|