gm-gc 2.0.481 → 2.0.483
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/gemini-extension.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
const fs = require('fs');
|
|
3
3
|
const path = require('path');
|
|
4
|
-
const writeTools = ['write_file'];
|
|
4
|
+
const writeTools = ['write_file', 'edit_file'];
|
|
5
5
|
const forbiddenTools = ['find', 'Find', 'Glob', 'Grep', 'glob', 'search_file_content'];
|
|
6
6
|
const run = () => {
|
|
7
7
|
try {
|
|
@@ -22,8 +22,11 @@ const run = () => {
|
|
|
22
22
|
return { deny: true, reason: 'Cannot create documentation files. Only AGENTS.md, CLAUDE.md and readme.md are maintained.' };
|
|
23
23
|
}
|
|
24
24
|
if (/\.(test|spec)\.(js|ts|jsx|tsx|mjs|cjs)$/.test(base) ||
|
|
25
|
+
/^(jest|vitest|mocha|ava|jasmine|tap)\.(config|setup)/.test(base) ||
|
|
26
|
+
/\.(snap|stub|mock|fixture)\.(js|ts|json)$/.test(base) ||
|
|
25
27
|
file_path.includes('/__tests__/') || file_path.includes('/test/') ||
|
|
26
|
-
file_path.includes('/tests/') || file_path.includes('/
|
|
28
|
+
file_path.includes('/tests/') || file_path.includes('/fixtures/') ||
|
|
29
|
+
file_path.includes('/test-data/') || file_path.includes('/__mocks__/')) {
|
|
27
30
|
return { deny: true, reason: 'Test files forbidden on disk. Use real services for all testing.' };
|
|
28
31
|
}
|
|
29
32
|
}
|
|
@@ -1,42 +1,40 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
const fs = require('fs');
|
|
3
3
|
const path = require('path');
|
|
4
|
-
const {
|
|
4
|
+
const { spawnSync } = require('child_process');
|
|
5
5
|
const pluginRoot = process.env.GEMINI_PROJECT_DIR ? path.join(__dirname, '..') : (process.env.CLAUDE_PLUGIN_ROOT || path.join(__dirname, '..'));
|
|
6
|
+
const plugkitBin = path.join(pluginRoot, 'bin', 'plugkit.js');
|
|
6
7
|
const projectDir = process.env.GEMINI_PROJECT_DIR || process.cwd();
|
|
7
8
|
const readStdinPrompt = () => {
|
|
8
9
|
try { return JSON.parse(fs.readFileSync(0, 'utf-8')).prompt || ''; } catch (e) { return ''; }
|
|
9
10
|
};
|
|
10
|
-
const
|
|
11
|
-
try { return fs.readFileSync(path.join(pluginRoot, 'agents/gm.md'), 'utf-8'); } catch (e) { return ''; }
|
|
12
|
-
};
|
|
13
|
-
const runMcpThorns = () => {
|
|
11
|
+
const runCodeinsight = () => {
|
|
14
12
|
if (!projectDir || !fs.existsSync(projectDir)) return '';
|
|
15
13
|
try {
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
const r = spawnSync('node', [plugkitBin, 'codeinsight', projectDir], { encoding: 'utf-8', stdio: 'pipe', cwd: projectDir, timeout: 10000 });
|
|
15
|
+
const out = (r.stdout || '').trim();
|
|
16
|
+
if (!out || out.startsWith('Error') || r.status !== 0) return '';
|
|
17
|
+
return out;
|
|
19
18
|
} catch (e) { return ''; }
|
|
20
19
|
};
|
|
21
|
-
const
|
|
20
|
+
const runSearch = (query) => {
|
|
22
21
|
if (!query || !projectDir) return '';
|
|
23
22
|
try {
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const lines = out.split('\n');
|
|
29
|
-
const start = lines.findIndex(l => l.includes('Searching for:'));
|
|
30
|
-
return start >= 0 ? lines.slice(start).join('\n').trim() : out.trim();
|
|
23
|
+
const r = spawnSync('node', [plugkitBin, 'search', '--path', projectDir, query.substring(0, 200)], { encoding: 'utf-8', stdio: 'pipe', cwd: projectDir, timeout: 5000 });
|
|
24
|
+
const out = (r.stdout || '').trim();
|
|
25
|
+
if (!out || r.status !== 0) return '';
|
|
26
|
+
return out;
|
|
31
27
|
} catch (e) { return ''; }
|
|
32
28
|
};
|
|
33
29
|
try {
|
|
34
30
|
const prompt = readStdinPrompt();
|
|
35
|
-
const
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
31
|
+
const insight = runCodeinsight();
|
|
32
|
+
const search = runSearch(prompt);
|
|
33
|
+
const sections = ['Invoke the gm skill to begin. DO NOT use EnterPlanMode.'];
|
|
34
|
+
if (insight) sections.push('=== codeinsight ===\n' + insight);
|
|
35
|
+
if (search) sections.push('=== search ===\n' + search);
|
|
36
|
+
const injection = '<system-reminder>\n' + sections.join('\n\n') + '\n</system-reminder>';
|
|
37
|
+
console.log(JSON.stringify({ decision: 'deny', reason: injection }, null, 2));
|
|
40
38
|
} catch (e) {
|
|
41
|
-
console.log(JSON.stringify({
|
|
39
|
+
console.log(JSON.stringify({ decision: 'deny', reason: '<system-reminder>\nInvoke the gm skill to begin. DO NOT use EnterPlanMode.\n</system-reminder>' }, null, 2));
|
|
42
40
|
}
|