gm-kilo 1.0.0 ā 1.0.2
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/bin/gm-kilo.js +72 -82
- package/package.json +1 -2
package/bin/gm-kilo.js
CHANGED
|
@@ -2,102 +2,92 @@
|
|
|
2
2
|
|
|
3
3
|
import fs from 'fs';
|
|
4
4
|
import path from 'path';
|
|
5
|
-
import {
|
|
6
|
-
import { execSync } from 'child_process';
|
|
5
|
+
import { spawnSync } from 'child_process';
|
|
7
6
|
|
|
8
7
|
const homeDir = process.env.HOME || process.env.USERPROFILE;
|
|
9
|
-
const
|
|
8
|
+
const configPath = path.join(homeDir, '.config', 'kilo', 'kilo.jsonc');
|
|
10
9
|
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
// Equivocal-to-Claude settings ported into Kilo's schema (OpenCode-derived).
|
|
11
|
+
// permission.{bash,read,edit} glob rules ā Claude permissions.allow
|
|
12
|
+
// compaction.threshold (percent) ā CLAUDE_AUTOCOMPACT_PCT_OVERRIDE=62
|
|
13
|
+
// thinking/effortLevel: no global config-level analog ā skipped.
|
|
14
|
+
const COMPACTION_THRESHOLD = 62;
|
|
15
|
+
const PERMISSION_RULES = {
|
|
16
|
+
bash: { '*plugkit*': 'allow', '*gm-plugkit*': 'allow', '*gm-tools*': 'allow' },
|
|
17
|
+
read: { '.gm/**': 'allow' },
|
|
18
|
+
edit: { '.gm/**': 'allow' }
|
|
19
|
+
};
|
|
13
20
|
|
|
14
|
-
|
|
15
|
-
console.log('
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
21
|
+
function installSkill() {
|
|
22
|
+
console.log('Installing gm-skill via skills CLI (--agent kilo)...');
|
|
23
|
+
const r = spawnSync('bun', ['x', 'skills', 'add', 'AnEntrypoint/gm-skill', '-y', '-g', '--agent', 'kilo'],
|
|
24
|
+
{ stdio: 'inherit', shell: process.platform === 'win32' });
|
|
25
|
+
if (r.status === 0) { console.log('ā
Skill installed\n'); return; }
|
|
26
|
+
console.log('bun not available or failed; trying npx fallback...');
|
|
27
|
+
const r2 = spawnSync('npx', ['-y', 'skills', 'add', 'AnEntrypoint/gm-skill', '-y', '-g', '--agent', 'kilo'],
|
|
28
|
+
{ stdio: 'inherit', shell: process.platform === 'win32' });
|
|
29
|
+
if (r2.status === 0) { console.log('ā
Skill installed\n'); return; }
|
|
30
|
+
console.error('ā ļø Skill install failed; install manually: bun x skills add AnEntrypoint/gm-skill -y -g --agent kilo\n');
|
|
31
|
+
}
|
|
26
32
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
33
|
+
function stripJsonc(text) {
|
|
34
|
+
// Conservative: strip // and /* */ comments so JSON.parse can read jsonc.
|
|
35
|
+
return text
|
|
36
|
+
.replace(/\/\*[\s\S]*?\*\//g, '')
|
|
37
|
+
.replace(/(^|[^:])\/\/.*$/gm, '$1');
|
|
38
|
+
}
|
|
34
39
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
configContent = fs.readFileSync(kiloConfigPath, 'utf8');
|
|
38
|
-
}
|
|
40
|
+
async function setup() {
|
|
41
|
+
console.log('š Setting up gm-kilo (Kilo)...\n');
|
|
39
42
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
orchestrator: plugkit
|
|
48
|
-
permissions:
|
|
49
|
-
- Read(.gm)
|
|
50
|
-
- Write(.gm)
|
|
51
|
-
- Bash(*plugkit*)
|
|
52
|
-
`;
|
|
53
|
-
configContent += gmConfig;
|
|
54
|
-
fs.writeFileSync(kiloConfigPath, configContent);
|
|
43
|
+
fs.mkdirSync(path.dirname(configPath), { recursive: true });
|
|
44
|
+
let config = {};
|
|
45
|
+
if (fs.existsSync(configPath)) {
|
|
46
|
+
const raw = fs.readFileSync(configPath, 'utf8').trim();
|
|
47
|
+
if (raw) {
|
|
48
|
+
try { config = JSON.parse(stripJsonc(raw)); }
|
|
49
|
+
catch (e) { console.error('ā ļø Existing kilo.jsonc unparseable; aborting to avoid clobber:', e.message); process.exit(1); }
|
|
55
50
|
}
|
|
56
|
-
console.log('ā
Kilo CLI configured\n');
|
|
57
|
-
} catch (e) {
|
|
58
|
-
console.error('ā Failed to configure Kilo CLI:', e.message);
|
|
59
|
-
process.exit(1);
|
|
60
51
|
}
|
|
61
52
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
53
|
+
// Compaction
|
|
54
|
+
config.compaction = config.compaction || {};
|
|
55
|
+
config.compaction.threshold = COMPACTION_THRESHOLD;
|
|
56
|
+
|
|
57
|
+
// Permissions
|
|
58
|
+
config.permission = config.permission || {};
|
|
59
|
+
for (const [tool, rules] of Object.entries(PERMISSION_RULES)) {
|
|
60
|
+
const existing = (typeof config.permission[tool] === 'object' && config.permission[tool]) ? config.permission[tool] : {};
|
|
61
|
+
config.permission[tool] = { ...existing, ...rules };
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
|
|
65
|
+
console.log('ā
Configured ~/.config/kilo/kilo.jsonc');
|
|
66
|
+
console.log(` compaction.threshold = ${COMPACTION_THRESHOLD}`);
|
|
67
|
+
console.log(` permission.bash, .read, .edit allow plugkit/.gm/**\n`);
|
|
68
|
+
|
|
69
|
+
installSkill();
|
|
70
|
+
|
|
71
|
+
console.log('š gm-kilo setup complete!\n');
|
|
66
72
|
}
|
|
67
73
|
|
|
68
74
|
async function verify() {
|
|
69
75
|
console.log('š Verifying gm-kilo installation...\n');
|
|
70
|
-
|
|
71
|
-
if (fs.existsSync(
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
76
|
+
let ok = true;
|
|
77
|
+
if (fs.existsSync(configPath)) {
|
|
78
|
+
const raw = fs.readFileSync(configPath, 'utf8');
|
|
79
|
+
const c = JSON.parse(stripJsonc(raw));
|
|
80
|
+
if (c.compaction?.threshold === COMPACTION_THRESHOLD) console.log('ā
compaction.threshold set');
|
|
81
|
+
else { console.log('ā compaction.threshold not set'); ok = false; }
|
|
82
|
+
for (const [tool, rules] of Object.entries(PERMISSION_RULES)) {
|
|
83
|
+
for (const [pat, val] of Object.entries(rules)) {
|
|
84
|
+
if (c.permission?.[tool]?.[pat] === val) console.log(`ā
permission.${tool}["${pat}"] = ${val}`);
|
|
85
|
+
else { console.log(`ā permission.${tool}["${pat}"] missing`); ok = false; }
|
|
86
|
+
}
|
|
77
87
|
}
|
|
78
|
-
} else {
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
async function main() {
|
|
84
|
-
const cmd = process.argv[2] || 'setup';
|
|
85
|
-
|
|
86
|
-
switch (cmd) {
|
|
87
|
-
case 'setup':
|
|
88
|
-
case 'install':
|
|
89
|
-
await setup();
|
|
90
|
-
break;
|
|
91
|
-
case 'verify':
|
|
92
|
-
await verify();
|
|
93
|
-
break;
|
|
94
|
-
default:
|
|
95
|
-
console.log('Usage: gm-kilo <setup|verify>');
|
|
96
|
-
process.exit(1);
|
|
97
|
-
}
|
|
88
|
+
} else { console.log('ā ļø Kilo config not found'); ok = false; }
|
|
89
|
+
console.log(ok ? '\nš All checks passed!' : '\nā ļø Some checks failed.');
|
|
98
90
|
}
|
|
99
91
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
process.exit(1);
|
|
103
|
-
});
|
|
92
|
+
const cmd = process.argv[2] || 'setup';
|
|
93
|
+
({ setup, install: setup, verify })[cmd]?.() ?? (console.log('Usage: gm-kilo <setup|verify>'), process.exit(1));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gm-kilo",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Kilo CLI integration for GM orchestration engine",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
10
|
"setup": "node bin/gm-kilo.js setup",
|
|
11
|
-
"install": "node bin/gm-kilo.js install",
|
|
12
11
|
"verify": "node bin/gm-kilo.js verify"
|
|
13
12
|
},
|
|
14
13
|
"keywords": ["gm", "kilo-cli", "agent", "orchestration"],
|