gm-cc 1.0.0

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 +126 -0
  2. package/package.json +20 -0
package/bin/gm-cc.js ADDED
@@ -0,0 +1,126 @@
1
+ #!/usr/bin/env node
2
+
3
+ import fs from 'fs';
4
+ import path from 'path';
5
+ import { fileURLToPath } from 'url';
6
+ import { execSync } from 'child_process';
7
+
8
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
9
+ const homeDir = process.env.HOME || process.env.USERPROFILE;
10
+ const claudeSettingsPath = path.join(homeDir, '.claude', 'settings.json');
11
+
12
+ async function setup() {
13
+ console.log('🚀 Setting up gm-cc (Claude Code)...\n');
14
+
15
+ // Step 1: Ensure plugkit is running
16
+ console.log('1️⃣ Bootstrapping plugkit...');
17
+ try {
18
+ const plugkitCmd = process.platform === 'win32'
19
+ ? `bun x gm-plugkit@latest spool > /dev/null 2>&1 &`
20
+ : `bun x gm-plugkit@latest spool > /dev/null 2>&1 &`;
21
+ execSync(plugkitCmd, { stdio: 'inherit' });
22
+ await new Promise(r => setTimeout(r, 2000));
23
+ console.log('✅ plugkit started\n');
24
+ } catch (e) {
25
+ console.log('⚠️ plugkit may already be running\n');
26
+ }
27
+
28
+ // Step 2: Add gm-skill to Claude Code
29
+ console.log('2️⃣ Installing gm-skill for Claude Code...');
30
+ try {
31
+ execSync('bun x gm-skill add AnEntrypoint/gm-skill -y -g', { stdio: 'inherit' });
32
+ console.log('✅ gm-skill installed\n');
33
+ } catch (e) {
34
+ console.error('❌ Failed to install gm-skill:', e.message);
35
+ process.exit(1);
36
+ }
37
+
38
+ // Step 3: Add permissions to Claude Code settings
39
+ console.log('3️⃣ Configuring permissions in Claude Code...');
40
+ try {
41
+ let settings = {};
42
+ if (fs.existsSync(claudeSettingsPath)) {
43
+ const content = fs.readFileSync(claudeSettingsPath, 'utf8');
44
+ settings = JSON.parse(content);
45
+ }
46
+
47
+ if (!settings.permissions) {
48
+ settings.permissions = { allow: [] };
49
+ }
50
+ if (!settings.permissions.allow) {
51
+ settings.permissions.allow = [];
52
+ }
53
+
54
+ const gmPermissions = [
55
+ 'Read(.gm)',
56
+ 'Write(.gm)',
57
+ 'Edit(.gm)',
58
+ 'Bash(*gm-plugkit*)',
59
+ 'Bash(*gm-tools*)',
60
+ 'Bash(*plugkit*)'
61
+ ];
62
+
63
+ gmPermissions.forEach(perm => {
64
+ if (!settings.permissions.allow.includes(perm)) {
65
+ settings.permissions.allow.push(perm);
66
+ }
67
+ });
68
+
69
+ fs.writeFileSync(claudeSettingsPath, JSON.stringify(settings, null, 2));
70
+ console.log('✅ Permissions configured\n');
71
+ } catch (e) {
72
+ console.error('❌ Failed to configure permissions:', e.message);
73
+ process.exit(1);
74
+ }
75
+
76
+ console.log('🎉 gm-cc setup complete!');
77
+ console.log('\nNext steps:');
78
+ console.log(' 1. Reload Claude Code: /hooks');
79
+ console.log(' 2. Start using gm-skill in Claude Code\n');
80
+ }
81
+
82
+ async function verify() {
83
+ console.log('🔍 Verifying gm-cc installation...\n');
84
+ let allGood = true;
85
+
86
+ console.log('Checking Claude Code settings...');
87
+ if (fs.existsSync(claudeSettingsPath)) {
88
+ const settings = JSON.parse(fs.readFileSync(claudeSettingsPath, 'utf8'));
89
+ if (settings.permissions?.allow?.includes('Read(.gm)')) {
90
+ console.log('✅ GM permissions configured\n');
91
+ } else {
92
+ console.log('❌ GM permissions not found\n');
93
+ allGood = false;
94
+ }
95
+ } else {
96
+ console.log('⚠️ Claude Code settings not found\n');
97
+ }
98
+
99
+ if (allGood) {
100
+ console.log('🎉 All checks passed!\n');
101
+ } else {
102
+ console.log('⚠️ Some checks failed. Run setup again.\n');
103
+ }
104
+ }
105
+
106
+ async function main() {
107
+ const cmd = process.argv[2] || 'setup';
108
+
109
+ switch (cmd) {
110
+ case 'setup':
111
+ case 'install':
112
+ await setup();
113
+ break;
114
+ case 'verify':
115
+ await verify();
116
+ break;
117
+ default:
118
+ console.log('Usage: gm-cc <setup|verify>');
119
+ process.exit(1);
120
+ }
121
+ }
122
+
123
+ main().catch(e => {
124
+ console.error('Error:', e);
125
+ process.exit(1);
126
+ });
package/package.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "gm-cc",
3
+ "version": "1.0.0",
4
+ "description": "Claude Code integration for GM orchestration engine",
5
+ "type": "module",
6
+ "bin": {
7
+ "gm-cc": "./bin/gm-cc.js"
8
+ },
9
+ "scripts": {
10
+ "setup": "node bin/gm-cc.js setup",
11
+ "install": "node bin/gm-cc.js install",
12
+ "verify": "node bin/gm-cc.js verify"
13
+ },
14
+ "keywords": ["gm", "claude-code", "agent", "orchestration"],
15
+ "author": "admin@coas.co.za",
16
+ "license": "MIT",
17
+ "engines": {
18
+ "node": ">=18.0.0"
19
+ }
20
+ }