gm-cc 2.0.287 → 2.0.289
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/.claude-plugin/marketplace.json +1 -1
- package/package.json +1 -1
- package/plugin.json +1 -1
- package/scripts/bootstrap.js +33 -22
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"name": "AnEntrypoint"
|
|
5
5
|
},
|
|
6
6
|
"description": "State machine agent with hooks, skills, and automated git enforcement",
|
|
7
|
-
"version": "2.0.
|
|
7
|
+
"version": "2.0.289",
|
|
8
8
|
"metadata": {
|
|
9
9
|
"description": "State machine agent with hooks, skills, and automated git enforcement"
|
|
10
10
|
},
|
package/package.json
CHANGED
package/plugin.json
CHANGED
package/scripts/bootstrap.js
CHANGED
|
@@ -3,28 +3,37 @@
|
|
|
3
3
|
const fs = require('fs');
|
|
4
4
|
const path = require('path');
|
|
5
5
|
const https = require('https');
|
|
6
|
+
const { execFileSync } = require('child_process');
|
|
6
7
|
|
|
7
8
|
const pluginRoot = process.env.CLAUDE_PLUGIN_ROOT;
|
|
8
9
|
if (!pluginRoot) process.exit(0);
|
|
9
10
|
|
|
10
11
|
const IS_WIN = process.platform === 'win32';
|
|
11
|
-
const
|
|
12
|
+
const binDir = path.join(pluginRoot, 'bin');
|
|
13
|
+
const binPath = path.join(binDir, IS_WIN ? 'plugkit.exe' : 'plugkit');
|
|
12
14
|
const pendingPath = binPath + '.pending';
|
|
13
|
-
const versionFile = path.join(
|
|
15
|
+
const versionFile = path.join(binDir, '.plugkit-version');
|
|
16
|
+
const pendingVersionFile = pendingPath + '.version';
|
|
14
17
|
|
|
15
18
|
function getAssetName() {
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const cpu = arch === 'arm64' ? 'arm64' : 'x64';
|
|
20
|
-
const ext = platform === 'win32' ? '.exe' : '';
|
|
19
|
+
const os = process.platform === 'win32' ? 'win32' : process.platform === 'darwin' ? 'darwin' : 'linux';
|
|
20
|
+
const cpu = process.arch === 'arm64' ? 'arm64' : 'x64';
|
|
21
|
+
const ext = process.platform === 'win32' ? '.exe' : '';
|
|
21
22
|
return `plugkit-${os}-${cpu}${ext}`;
|
|
22
23
|
}
|
|
23
24
|
|
|
24
|
-
|
|
25
|
+
function killDaemon() {
|
|
26
|
+
try {
|
|
27
|
+
execFileSync(binPath, ['runner', 'stop'], { timeout: 5000, stdio: 'ignore' });
|
|
28
|
+
} catch {}
|
|
29
|
+
if (IS_WIN) {
|
|
30
|
+
try { execFileSync('taskkill', ['/F', '/IM', 'plugkit.exe'], { timeout: 3000, stdio: 'ignore' }); } catch {}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
25
33
|
|
|
26
34
|
function applyPending() {
|
|
27
35
|
if (!fs.existsSync(pendingPath)) return;
|
|
36
|
+
killDaemon();
|
|
28
37
|
try {
|
|
29
38
|
if (fs.existsSync(binPath)) fs.unlinkSync(binPath);
|
|
30
39
|
fs.renameSync(pendingPath, binPath);
|
|
@@ -36,30 +45,24 @@ function applyPending() {
|
|
|
36
45
|
|
|
37
46
|
applyPending();
|
|
38
47
|
|
|
39
|
-
function
|
|
48
|
+
function getRequiredVersion() {
|
|
40
49
|
try {
|
|
41
50
|
return JSON.parse(fs.readFileSync(path.join(pluginRoot, 'gm.json'), 'utf8')).plugkitVersion || null;
|
|
42
51
|
} catch { return null; }
|
|
43
52
|
}
|
|
44
53
|
|
|
45
54
|
function getCurrentVersion() {
|
|
46
|
-
|
|
47
|
-
try {
|
|
48
|
-
return fs.readFileSync(versionFile, 'utf8').trim() || null;
|
|
49
|
-
} catch { return null; }
|
|
55
|
+
try { return fs.readFileSync(versionFile, 'utf8').trim() || null; } catch { return null; }
|
|
50
56
|
}
|
|
51
57
|
|
|
52
|
-
const required =
|
|
58
|
+
const required = getRequiredVersion();
|
|
53
59
|
const current = getCurrentVersion();
|
|
54
60
|
if (current && current === required) process.exit(0);
|
|
55
61
|
|
|
56
62
|
function download(version, dest, cb) {
|
|
57
63
|
const asset = getAssetName();
|
|
58
|
-
const urlPath = version
|
|
59
|
-
|
|
60
|
-
: `/AnEntrypoint/rs-plugkit/releases/latest/download/${asset}`;
|
|
61
|
-
const destDir = path.dirname(dest);
|
|
62
|
-
if (!fs.existsSync(destDir)) fs.mkdirSync(destDir, { recursive: true });
|
|
64
|
+
const urlPath = `/AnEntrypoint/rs-plugkit/releases/download/v${version}/${asset}`;
|
|
65
|
+
if (!fs.existsSync(path.dirname(dest))) fs.mkdirSync(path.dirname(dest), { recursive: true });
|
|
63
66
|
const follow = (url) => {
|
|
64
67
|
const mod = url.startsWith('https') ? https : require('http');
|
|
65
68
|
const opts = { ...require('url').parse(url), headers: { 'User-Agent': 'gm-bootstrap' } };
|
|
@@ -68,17 +71,25 @@ function download(version, dest, cb) {
|
|
|
68
71
|
if (res.statusCode !== 200) return cb(new Error(`HTTP ${res.statusCode}`));
|
|
69
72
|
const chunks = [];
|
|
70
73
|
res.on('data', c => chunks.push(c));
|
|
71
|
-
res.on('end', () => {
|
|
74
|
+
res.on('end', () => {
|
|
75
|
+
try {
|
|
76
|
+
fs.writeFileSync(dest, Buffer.concat(chunks));
|
|
77
|
+
try { fs.chmodSync(dest, 0o755); } catch {}
|
|
78
|
+
cb(null);
|
|
79
|
+
} catch (e) { cb(e); }
|
|
80
|
+
});
|
|
72
81
|
}).on('error', cb);
|
|
73
82
|
};
|
|
74
83
|
follow(`https://github.com${urlPath}`);
|
|
75
84
|
}
|
|
76
85
|
|
|
86
|
+
killDaemon();
|
|
87
|
+
|
|
77
88
|
download(required, binPath, (err) => {
|
|
78
|
-
if (err && err.
|
|
89
|
+
if (err && err.code === 'EBUSY') {
|
|
79
90
|
download(required, pendingPath, (err2) => {
|
|
80
91
|
if (err2) {
|
|
81
|
-
process.stderr.write(`bootstrap: ${err2.message}\n`);
|
|
92
|
+
process.stderr.write(`bootstrap: pending failed: ${err2.message}\n`);
|
|
82
93
|
process.exit(fs.existsSync(binPath) ? 0 : 1);
|
|
83
94
|
}
|
|
84
95
|
try { fs.writeFileSync(pendingVersionFile, required); } catch {}
|