gm-oc 2.0.249 → 2.0.251

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/hooks/hooks.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "hooks": [
8
8
  {
9
9
  "type": "command",
10
- "command": "bun ${OC_PLUGIN_ROOT}/hooks/pre-tool-use-hook.js",
10
+ "command": "${OC_PLUGIN_ROOT}/bin/plugkit hook pre-tool-use",
11
11
  "timeout": 3600
12
12
  }
13
13
  ]
@@ -19,8 +19,13 @@
19
19
  "hooks": [
20
20
  {
21
21
  "type": "command",
22
- "command": "bun ${OC_PLUGIN_ROOT}/hooks/session-start-hook.js",
23
- "timeout": 10000
22
+ "command": "node ${OC_PLUGIN_ROOT}/scripts/bootstrap.js",
23
+ "timeout": 60000
24
+ },
25
+ {
26
+ "type": "command",
27
+ "command": "${OC_PLUGIN_ROOT}/bin/plugkit hook session-start",
28
+ "timeout": 180000
24
29
  }
25
30
  ]
26
31
  }
@@ -31,8 +36,8 @@
31
36
  "hooks": [
32
37
  {
33
38
  "type": "command",
34
- "command": "bun ${OC_PLUGIN_ROOT}/hooks/prompt-submit-hook.js",
35
- "timeout": 3600
39
+ "command": "${OC_PLUGIN_ROOT}/bin/plugkit hook prompt-submit",
40
+ "timeout": 60000
36
41
  }
37
42
  ]
38
43
  }
@@ -43,12 +48,12 @@
43
48
  "hooks": [
44
49
  {
45
50
  "type": "command",
46
- "command": "bun ${OC_PLUGIN_ROOT}/hooks/stop-hook.js",
51
+ "command": "${OC_PLUGIN_ROOT}/bin/plugkit hook stop",
47
52
  "timeout": 300000
48
53
  },
49
54
  {
50
55
  "type": "command",
51
- "command": "bun ${OC_PLUGIN_ROOT}/hooks/stop-hook-git.js",
56
+ "command": "${OC_PLUGIN_ROOT}/bin/plugkit hook stop-git",
52
57
  "timeout": 60000
53
58
  }
54
59
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm-oc",
3
- "version": "2.0.249",
3
+ "version": "2.0.251",
4
4
  "description": "State machine agent with hooks, skills, and automated git enforcement",
5
5
  "author": "AnEntrypoint",
6
6
  "license": "MIT",
@@ -0,0 +1,45 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+ const fs = require('fs');
4
+ const path = require('path');
5
+ const https = require('https');
6
+
7
+ const pluginRoot = process.env.CLAUDE_PLUGIN_ROOT;
8
+ if (!pluginRoot) process.exit(0);
9
+
10
+ const IS_WIN = process.platform === 'win32';
11
+ const binPath = path.join(pluginRoot, 'bin', IS_WIN ? 'plugkit.exe' : 'plugkit');
12
+
13
+ if (fs.existsSync(binPath)) process.exit(0);
14
+
15
+ function getVersion() {
16
+ try {
17
+ return JSON.parse(fs.readFileSync(path.join(pluginRoot, 'gm.json'), 'utf8')).plugkitVersion || null;
18
+ } catch { return null; }
19
+ }
20
+
21
+ function download(version, dest, cb) {
22
+ const asset = IS_WIN ? 'plugkit.exe' : 'plugkit';
23
+ const urlPath = version
24
+ ? `/AnEntrypoint/rs-plugkit/releases/download/v${version}/${asset}`
25
+ : `/AnEntrypoint/rs-plugkit/releases/latest/download/${asset}`;
26
+ const destDir = path.dirname(dest);
27
+ if (!fs.existsSync(destDir)) fs.mkdirSync(destDir, { recursive: true });
28
+ const follow = (url) => {
29
+ const mod = url.startsWith('https') ? https : require('http');
30
+ const opts = { ...require('url').parse(url), headers: { 'User-Agent': 'gm-bootstrap' } };
31
+ mod.get(opts, res => {
32
+ if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) return follow(res.headers.location);
33
+ if (res.statusCode !== 200) return cb(new Error(`HTTP ${res.statusCode}`));
34
+ const chunks = [];
35
+ res.on('data', c => chunks.push(c));
36
+ res.on('end', () => { try { fs.writeFileSync(dest, Buffer.concat(chunks)); try { fs.chmodSync(dest, 0o755); } catch {} cb(null); } catch (e) { cb(e); } });
37
+ }).on('error', cb);
38
+ };
39
+ follow(`https://github.com${urlPath}`);
40
+ }
41
+
42
+ download(getVersion(), binPath, (err) => {
43
+ if (err) { process.stderr.write(`bootstrap: ${err.message}\n`); process.exit(1); }
44
+ process.exit(0);
45
+ });