gm-skill 2.0.1916 → 2.0.1918
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/gm-plugkit/bootstrap.js +13 -0
- package/gm-plugkit/cli.js +55 -35
- package/gm-plugkit/package.json +1 -1
- package/gm.json +1 -1
- package/package.json +1 -1
package/gm-plugkit/bootstrap.js
CHANGED
|
@@ -798,11 +798,24 @@ function isReady() {
|
|
|
798
798
|
return fs.existsSync(wasm);
|
|
799
799
|
}
|
|
800
800
|
|
|
801
|
+
function runningFromGmSourceRepo() {
|
|
802
|
+
try {
|
|
803
|
+
const pkgPath = path.join(__dirname, '..', 'package.json');
|
|
804
|
+
if (!fs.existsSync(pkgPath)) return false;
|
|
805
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'));
|
|
806
|
+
return pkg && pkg.name === 'gm-skill';
|
|
807
|
+
} catch (_) { return false; }
|
|
808
|
+
}
|
|
809
|
+
|
|
801
810
|
function ensureWrapperFresh() {
|
|
802
811
|
try {
|
|
803
812
|
const wrapperSrc = path.join(__dirname, 'plugkit-wasm-wrapper.js');
|
|
804
813
|
const wrapperDst = path.join(gmToolsDir(), 'plugkit-wasm-wrapper.js');
|
|
805
814
|
if (!fs.existsSync(wrapperSrc)) return false;
|
|
815
|
+
if (runningFromGmSourceRepo() && process.env.GM_PLUGKIT_ALLOW_DEV_WRAPPER_OVERWRITE !== '1') {
|
|
816
|
+
log(`refusing to overwrite the shared ~/.gm-tools wrapper from the gm source repo (${wrapperSrc}) -- this machine-wide install is shared by every project's watcher; set GM_PLUGKIT_ALLOW_DEV_WRAPPER_OVERWRITE=1 to opt in, or use 'bun x gm-plugkit@latest' which fetches an isolated npm copy instead`);
|
|
817
|
+
return false;
|
|
818
|
+
}
|
|
806
819
|
let same = false;
|
|
807
820
|
if (fs.existsSync(wrapperDst)) {
|
|
808
821
|
try {
|
package/gm-plugkit/cli.js
CHANGED
|
@@ -5,7 +5,43 @@ const fs = require('fs');
|
|
|
5
5
|
const os = require('os');
|
|
6
6
|
const path = require('path');
|
|
7
7
|
const cp = require('child_process');
|
|
8
|
-
const { ensureReady, startSpoolDaemon, gmToolsDir, readVersionFile, ensureGmPlugkitVersionFresh, ensureSkillMdFresh, ensureWrapperFresh } = require('./bootstrap');
|
|
8
|
+
const { ensureReady, startSpoolDaemon, gmToolsDir, readVersionFile, ensureGmPlugkitVersionFresh, ensureSkillMdFresh, ensureWrapperFresh, isReady, getWasmPath } = require('./bootstrap');
|
|
9
|
+
|
|
10
|
+
function getWasmPathSafe() {
|
|
11
|
+
try { return getWasmPath(); } catch (_) { return null; }
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function spawnBackgroundFreshnessCheck(reason) {
|
|
15
|
+
try {
|
|
16
|
+
const child = cp.spawn(process.execPath, [__filename.replace(/cli\.js$/, 'bootstrap.js')], {
|
|
17
|
+
detached: true,
|
|
18
|
+
stdio: 'ignore',
|
|
19
|
+
windowsHide: true,
|
|
20
|
+
env: { ...process.env, GM_PLUGKIT_BACKGROUND_REFRESH: reason },
|
|
21
|
+
});
|
|
22
|
+
child.unref();
|
|
23
|
+
} catch (_) {}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function spawnDaemonOrExit(version, binaryPath, message) {
|
|
27
|
+
let daemon;
|
|
28
|
+
try {
|
|
29
|
+
daemon = startSpoolDaemon();
|
|
30
|
+
} catch (err) {
|
|
31
|
+
writeCliError('start-daemon', err);
|
|
32
|
+
console.error('Daemon start failed:', err.message);
|
|
33
|
+
process.exit(1);
|
|
34
|
+
}
|
|
35
|
+
if (!daemon || !daemon.ok) {
|
|
36
|
+
const errMsg = (daemon && daemon.error) || 'startSpoolDaemon returned non-ok';
|
|
37
|
+
writeCliError('start-daemon', new Error(errMsg));
|
|
38
|
+
console.error('Daemon start failed:', errMsg);
|
|
39
|
+
process.exit(1);
|
|
40
|
+
}
|
|
41
|
+
writeCliStatus({ phase: 'daemon-spawned', version, daemon_pid: daemon.pid, log: daemon.logPath });
|
|
42
|
+
console.log(JSON.stringify({ ok: true, binary: binaryPath, daemon, message }));
|
|
43
|
+
process.exit(0);
|
|
44
|
+
}
|
|
9
45
|
|
|
10
46
|
function readUpdateAvailableMarker(dir) {
|
|
11
47
|
try {
|
|
@@ -237,6 +273,19 @@ function writeCliError(phase, err) {
|
|
|
237
273
|
} catch (_) {}
|
|
238
274
|
}
|
|
239
275
|
|
|
276
|
+
const wrapperPath = path.join(gmToolsDir(), 'plugkit-wasm-wrapper.js');
|
|
277
|
+
if (isReady() && fs.existsSync(wrapperPath)) {
|
|
278
|
+
let installedVersion = null;
|
|
279
|
+
try { installedVersion = readVersionFile(); } catch (_) { installedVersion = null; }
|
|
280
|
+
writeCliStatus({ phase: 'bootstrapped', version: installedVersion, binary: getWasmPathSafe() });
|
|
281
|
+
spawnBackgroundFreshnessCheck(versionDrifted ? 'version-drift-respawn' : 'fast-path-spawn');
|
|
282
|
+
spawnDaemonOrExit(
|
|
283
|
+
installedVersion,
|
|
284
|
+
getWasmPathSafe(),
|
|
285
|
+
'plugkit daemon spawned from existing local install, not yet confirmed serving -- check .gm/exec-spool/.status.json for heartbeat freshness; remote freshness check running in background'
|
|
286
|
+
);
|
|
287
|
+
}
|
|
288
|
+
|
|
240
289
|
let bootstrapResult;
|
|
241
290
|
try {
|
|
242
291
|
bootstrapResult = await ensureReady();
|
|
@@ -254,40 +303,11 @@ function writeCliError(phase, err) {
|
|
|
254
303
|
}
|
|
255
304
|
|
|
256
305
|
writeCliStatus({ phase: 'bootstrapped', version: bootstrapResult.version, binary: bootstrapResult.binaryPath });
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
daemon
|
|
261
|
-
|
|
262
|
-
writeCliError('start-daemon', err);
|
|
263
|
-
console.error('Daemon start failed:', err.message);
|
|
264
|
-
process.exit(1);
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
if (!daemon || !daemon.ok) {
|
|
268
|
-
const errMsg = (daemon && daemon.error) || 'startSpoolDaemon returned non-ok';
|
|
269
|
-
writeCliError('start-daemon', new Error(errMsg));
|
|
270
|
-
console.error('Daemon start failed:', errMsg);
|
|
271
|
-
process.exit(1);
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
// Fire-and-forget: the daemon child is already detached+unref'd by
|
|
275
|
-
// startSpoolDaemon(), so the CLI process itself has nothing left to do.
|
|
276
|
-
// Waiting here for a heartbeat confirmation (removed) used to block the
|
|
277
|
-
// calling shell for the full bootstrap+first-heartbeat duration -- up to
|
|
278
|
-
// 30s on a healthy boot, worse on a slow/degraded one -- holding up every
|
|
279
|
-
// caller even though the daemon spawn itself is near-instant. A caller
|
|
280
|
-
// that needs serving-confirmation reads .gm/exec-spool/.status.json
|
|
281
|
-
// directly (ts freshness) rather than blocking this call on it.
|
|
282
|
-
writeCliStatus({ phase: 'daemon-spawned', version: bootstrapResult.version, daemon_pid: daemon.pid, log: daemon.logPath });
|
|
283
|
-
|
|
284
|
-
console.log(JSON.stringify({
|
|
285
|
-
ok: true,
|
|
286
|
-
binary: bootstrapResult.binaryPath,
|
|
287
|
-
daemon,
|
|
288
|
-
message: 'plugkit daemon spawned, not yet confirmed serving -- check .gm/exec-spool/.status.json for heartbeat freshness'
|
|
289
|
-
}));
|
|
290
|
-
process.exit(0);
|
|
306
|
+
spawnDaemonOrExit(
|
|
307
|
+
bootstrapResult.version,
|
|
308
|
+
bootstrapResult.binaryPath,
|
|
309
|
+
'plugkit daemon spawned, not yet confirmed serving -- check .gm/exec-spool/.status.json for heartbeat freshness'
|
|
310
|
+
);
|
|
291
311
|
})().catch((err) => {
|
|
292
312
|
writeCliError('uncaught', err);
|
|
293
313
|
console.error('gm-plugkit failed:', err && err.message ? err.message : err);
|
package/gm-plugkit/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gm-plugkit",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1918",
|
|
4
4
|
"description": "Bootstrap and daemon-spawn tool for gm plugkit binary. Downloads the correct platform binary, verifies SHA256, and starts the spool watcher daemon. Includes plugkit-wasm-wrapper for WASM-based spool watching.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
package/gm.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gm-skill",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1918",
|
|
4
4
|
"description": "Canonical universal harness — AI-native software engineering via skill-driven orchestration; bootstraps plugkit for task execution and session isolation. Install in any AI coding agent host.",
|
|
5
5
|
"author": "AnEntrypoint",
|
|
6
6
|
"license": "MIT",
|