gm-cc 1.0.1 → 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.
Files changed (2) hide show
  1. package/bin/gm-cc.js +48 -86
  2. package/package.json +1 -2
package/bin/gm-cc.js CHANGED
@@ -2,107 +2,69 @@
2
2
 
3
3
  import fs from 'fs';
4
4
  import path from 'path';
5
- import { fileURLToPath } from 'url';
6
- import { execSync } from 'child_process';
5
+ import { spawnSync } from 'child_process';
7
6
 
8
- const __dirname = path.dirname(fileURLToPath(import.meta.url));
9
7
  const homeDir = process.env.HOME || process.env.USERPROFILE;
10
8
  const claudeSettingsPath = path.join(homeDir, '.claude', 'settings.json');
11
9
 
10
+ const GM_PERMISSIONS = [
11
+ 'Read(.gm)',
12
+ 'Write(.gm)',
13
+ 'Edit(.gm)',
14
+ 'Bash(*gm-plugkit*)',
15
+ 'Bash(*gm-tools*)',
16
+ 'Bash(*plugkit*)'
17
+ ];
18
+
19
+ function installSkill() {
20
+ console.log('Installing gm-skill via skills CLI (--agent claude-code)...');
21
+ const args = ['x', 'skills', 'add', 'AnEntrypoint/gm-skill', '-y', '-g', '--agent', 'claude-code'];
22
+ const r = spawnSync('bun', args, { stdio: 'inherit', shell: process.platform === 'win32' });
23
+ if (r.status === 0) { console.log('✅ Skill installed\n'); return; }
24
+ console.log('bun not available or failed; trying npx fallback...');
25
+ const r2 = spawnSync('npx', ['-y', 'skills', 'add', 'AnEntrypoint/gm-skill', '-y', '-g', '--agent', 'claude-code'],
26
+ { stdio: 'inherit', shell: process.platform === 'win32' });
27
+ if (r2.status === 0) { console.log('✅ Skill installed\n'); return; }
28
+ console.error('⚠️ Skill install failed; install manually: bun x skills add AnEntrypoint/gm-skill -y -g --agent claude-code\n');
29
+ }
30
+
12
31
  async function setup() {
13
32
  console.log('🚀 Setting up gm-cc (Claude Code)...\n');
14
33
 
15
- // Add permissions to Claude Code settings
16
34
  console.log('Configuring permissions in Claude Code...');
17
- try {
18
- let settings = {};
19
- if (fs.existsSync(claudeSettingsPath)) {
20
- const content = fs.readFileSync(claudeSettingsPath, 'utf8');
21
- settings = JSON.parse(content);
22
- }
23
-
24
- if (!settings.permissions) {
25
- settings.permissions = { allow: [] };
26
- }
27
- if (!settings.permissions.allow) {
28
- settings.permissions.allow = [];
29
- }
30
-
31
- const gmPermissions = [
32
- 'Read(.gm)',
33
- 'Write(.gm)',
34
- 'Edit(.gm)',
35
- 'Bash(*gm-plugkit*)',
36
- 'Bash(*gm-tools*)',
37
- 'Bash(*plugkit*)'
38
- ];
39
-
40
- gmPermissions.forEach(perm => {
41
- if (!settings.permissions.allow.includes(perm)) {
42
- settings.permissions.allow.push(perm);
43
- }
44
- });
45
-
46
- fs.writeFileSync(claudeSettingsPath, JSON.stringify(settings, null, 2));
47
- console.log('✅ Permissions configured\n');
48
- } catch (e) {
49
- console.error('❌ Failed to configure permissions:', e.message);
50
- process.exit(1);
35
+ let settings = {};
36
+ if (fs.existsSync(claudeSettingsPath)) {
37
+ settings = JSON.parse(fs.readFileSync(claudeSettingsPath, 'utf8'));
38
+ }
39
+ settings.permissions = settings.permissions || {};
40
+ settings.permissions.allow = settings.permissions.allow || [];
41
+ for (const perm of GM_PERMISSIONS) {
42
+ if (!settings.permissions.allow.includes(perm)) settings.permissions.allow.push(perm);
51
43
  }
44
+ fs.mkdirSync(path.dirname(claudeSettingsPath), { recursive: true });
45
+ fs.writeFileSync(claudeSettingsPath, JSON.stringify(settings, null, 2));
46
+ console.log('✅ Permissions configured in ~/.claude/settings.json\n');
52
47
 
53
- console.log('🎉 gm-cc setup complete!');
54
- console.log('\nPermissions added to ~/.claude/settings.json:');
55
- console.log(' - Read(.gm)');
56
- console.log(' - Write(.gm)');
57
- console.log(' - Edit(.gm)');
58
- console.log(' - Bash(*gm-plugkit*)');
59
- console.log(' - Bash(*gm-tools*)');
60
- console.log(' - Bash(*plugkit*)\n');
61
- console.log('These permissions allow Claude Code to work with plugkit\n');
48
+ installSkill();
49
+
50
+ console.log('🎉 gm-cc setup complete!\n');
62
51
  }
63
52
 
64
53
  async function verify() {
65
54
  console.log('🔍 Verifying gm-cc installation...\n');
66
- let allGood = true;
67
-
68
- console.log('Checking Claude Code settings...');
55
+ let ok = true;
69
56
  if (fs.existsSync(claudeSettingsPath)) {
70
57
  const settings = JSON.parse(fs.readFileSync(claudeSettingsPath, 'utf8'));
71
- if (settings.permissions?.allow?.includes('Read(.gm)')) {
72
- console.log('✅ GM permissions configured\n');
73
- } else {
74
- console.log('❌ GM permissions not found\n');
75
- allGood = false;
76
- }
77
- } else {
78
- console.log('⚠️ Claude Code settings not found\n');
79
- }
80
-
81
- if (allGood) {
82
- console.log('🎉 All checks passed!\n');
83
- } else {
84
- console.log('⚠️ Some checks failed. Run setup again.\n');
85
- }
86
- }
87
-
88
- async function main() {
89
- const cmd = process.argv[2] || 'setup';
90
-
91
- switch (cmd) {
92
- case 'setup':
93
- case 'install':
94
- await setup();
95
- break;
96
- case 'verify':
97
- await verify();
98
- break;
99
- default:
100
- console.log('Usage: gm-cc <setup|verify>');
101
- process.exit(1);
102
- }
58
+ const have = new Set(settings.permissions?.allow || []);
59
+ const missing = GM_PERMISSIONS.filter(p => !have.has(p));
60
+ if (missing.length === 0) console.log('✅ All GM permissions present');
61
+ else { console.log('❌ Missing permissions:', missing.join(', ')); ok = false; }
62
+ } else { console.log('⚠️ Claude settings not found'); ok = false; }
63
+ const skillPath = path.join(homeDir, '.claude', 'skills', 'gm-skill', 'SKILL.md');
64
+ if (fs.existsSync(skillPath)) console.log('✅ Skill installed at', skillPath);
65
+ else { console.log(' Skill not found at', skillPath); ok = false; }
66
+ console.log(ok ? '\n🎉 All checks passed!' : '\n⚠️ Some checks failed.');
103
67
  }
104
68
 
105
- main().catch(e => {
106
- console.error('Error:', e);
107
- process.exit(1);
108
- });
69
+ const cmd = process.argv[2] || 'setup';
70
+ ({ setup, install: setup, verify })[cmd]?.() ?? (console.log('Usage: gm-cc <setup|verify>'), process.exit(1));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm-cc",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Claude Code 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-cc.js setup",
11
- "install": "node bin/gm-cc.js install",
12
11
  "verify": "node bin/gm-cc.js verify"
13
12
  },
14
13
  "keywords": ["gm", "claude-code", "agent", "orchestration"],