gm-skill 2.0.1361 → 2.0.1363

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.
@@ -1 +1 @@
1
- 0.1.513
1
+ 0.1.514
@@ -1 +1 @@
1
- b426108ab7ca3eaf2bd344326ac7c607bf36cdf1ecbb507abd07e09f2e8eb918 plugkit.wasm
1
+ 0a0669150d455ad998cdfd7689ea65df92fbb15229cb3809ef3c0569919a7fa4 plugkit.wasm
package/gm-plugkit/cli.js CHANGED
@@ -2,20 +2,91 @@
2
2
  'use strict';
3
3
 
4
4
  const fs = require('fs');
5
+ const os = require('os');
5
6
  const path = require('path');
7
+ const cp = require('child_process');
6
8
  const { ensureReady, startSpoolDaemon } = require('./bootstrap');
7
9
 
8
10
  const usage = `gm-plugkit — Bootstrap and daemon-spawn for gm plugkit binary.
9
11
 
10
12
  Usage:
11
- bun x gm-plugkit@latest Bootstrap + start spool daemon
12
- bun x gm-plugkit@latest spool Same as default (explicit)
13
- bun x gm-plugkit@latest --daemon Same as default
14
- bun x gm-plugkit@latest --binary Print binary path only
15
- bun x gm-plugkit@latest --status JSON status check
16
- bun x gm-plugkit@latest --help Show this help
13
+ bun x gm-plugkit@latest Bootstrap + start spool daemon
14
+ bun x gm-plugkit@latest spool Same as default (explicit)
15
+ bun x gm-plugkit@latest --daemon Same as default
16
+ bun x gm-plugkit@latest --binary Print binary path only
17
+ bun x gm-plugkit@latest --status JSON status check
18
+ bun x gm-plugkit@latest --kill-stale-watchers
19
+ Kill plugkit watchers whose in-memory
20
+ wrapper sha differs from on-disk
21
+ (lets new wrapper code load on next bootstrap)
22
+ bun x gm-plugkit@latest --help Show this help
17
23
  `;
18
24
 
25
+ function killStaleWatchers() {
26
+ try {
27
+ const wrapperPath = path.join(os.homedir(), '.gm-tools', 'plugkit-wasm-wrapper.js');
28
+ if (!fs.existsSync(wrapperPath)) {
29
+ console.log(JSON.stringify({ ok: false, error: 'wrapper not installed at ~/.gm-tools/plugkit-wasm-wrapper.js' }));
30
+ return 1;
31
+ }
32
+ const diskMtime = fs.statSync(wrapperPath).mtimeMs;
33
+ const stale = [];
34
+ const fresh = [];
35
+ if (process.platform === 'win32') {
36
+ const ps = `Get-WmiObject Win32_Process -Filter "name='node.exe'" | Where-Object { $_.CommandLine -match 'plugkit-wasm-wrapper' } | ForEach-Object { $_.ProcessId.ToString() + '|' + $_.CreationDate }`;
37
+ const out = cp.execFileSync('powershell.exe', ['-NoProfile', '-NonInteractive', '-Command', ps], { encoding: 'utf-8', windowsHide: true });
38
+ for (const line of out.split(/\r?\n/).filter(Boolean)) {
39
+ const [pidStr, creation] = line.split('|');
40
+ const pid = parseInt(pidStr, 10);
41
+ if (!Number.isFinite(pid)) continue;
42
+ const m = creation && creation.match(/^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(?:\.(\d+))?(?:([+-])(\d+))?/);
43
+ if (!m) continue;
44
+ const localMs = new Date(+m[1], +m[2] - 1, +m[3], +m[4], +m[5], +m[6], m[7] ? Math.round(+('0.' + m[7]) * 1000) : 0).getTime();
45
+ if (localMs < diskMtime) stale.push({ pid, started_ms: localMs });
46
+ else fresh.push({ pid, started_ms: localMs });
47
+ }
48
+ } else {
49
+ const out = cp.execFileSync('ps', ['-eo', 'pid,lstart,command'], { encoding: 'utf-8' });
50
+ for (const line of out.split('\n').slice(1)) {
51
+ if (!line.includes('plugkit-wasm-wrapper')) continue;
52
+ const m = line.match(/^\s*(\d+)\s+(.+?\d{4})\s+/);
53
+ if (!m) continue;
54
+ const pid = parseInt(m[1], 10);
55
+ const start = Date.parse(m[2]);
56
+ if (!Number.isFinite(pid) || !Number.isFinite(start)) continue;
57
+ if (start < diskMtime) stale.push({ pid, started_ms: start });
58
+ else fresh.push({ pid, started_ms: start });
59
+ }
60
+ }
61
+ const killed = [];
62
+ const failed = [];
63
+ for (const s of stale) {
64
+ try {
65
+ if (process.platform === 'win32') {
66
+ cp.execFileSync('taskkill', ['/F', '/PID', String(s.pid)], { stdio: 'ignore', windowsHide: true });
67
+ } else {
68
+ process.kill(s.pid, 'SIGTERM');
69
+ }
70
+ killed.push(s.pid);
71
+ } catch (e) {
72
+ failed.push({ pid: s.pid, error: e.message });
73
+ }
74
+ }
75
+ console.log(JSON.stringify({
76
+ ok: true,
77
+ disk_wrapper_mtime_ms: diskMtime,
78
+ stale_found: stale.length,
79
+ fresh_found: fresh.length,
80
+ killed,
81
+ failed,
82
+ }, null, 2));
83
+ return 0;
84
+ } catch (e) {
85
+ console.log(JSON.stringify({ ok: false, error: e.message }));
86
+ return 1;
87
+ }
88
+ }
89
+
19
90
  function spoolDir() {
20
91
  const projectDir = process.env.CLAUDE_PROJECT_DIR || process.cwd();
21
92
  return path.join(projectDir, '.gm', 'exec-spool');
@@ -55,6 +126,10 @@ function writeCliError(phase, err) {
55
126
  process.exit(0);
56
127
  }
57
128
 
129
+ if (args.includes('--kill-stale-watchers')) {
130
+ process.exit(killStaleWatchers());
131
+ }
132
+
58
133
  ensureSpoolDir();
59
134
  writeCliStatus({ phase: 'starting', args });
60
135
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm-plugkit",
3
- "version": "2.0.1361",
3
+ "version": "2.0.1363",
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm",
3
- "version": "2.0.1361",
3
+ "version": "2.0.1363",
4
4
  "description": "Spool-dispatch orchestration engine with unified state machine, skills, and automated git enforcement",
5
5
  "author": "AnEntrypoint",
6
6
  "license": "MIT",
@@ -17,5 +17,5 @@
17
17
  "publishConfig": {
18
18
  "access": "public"
19
19
  },
20
- "plugkitVersion": "0.1.513"
20
+ "plugkitVersion": "0.1.514"
21
21
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm-skill",
3
- "version": "2.0.1361",
3
+ "version": "2.0.1363",
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",