gm-skill 2.0.1959 → 2.0.1960

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.
@@ -6,6 +6,7 @@ const path = require('path');
6
6
  const os = require('os');
7
7
  const crypto = require('crypto');
8
8
  const { spawn, spawnSync } = require('child_process');
9
+ const { logEvent: _sharedLogEvent } = require('./gm-log');
9
10
 
10
11
  function resolveWindowsExe(cmd) {
11
12
  if (process.platform !== 'win32') return cmd;
@@ -39,19 +40,7 @@ function log(msg) {
39
40
  }
40
41
 
41
42
  function obsEvent(subsystem, event, fields) {
42
- if (process.env.GM_LOG_DISABLE) return;
43
- try {
44
- const root = process.env.GM_LOG_DIR || path.join(os.homedir(), '.claude', 'gm-log');
45
- const day = new Date().toISOString().slice(0, 10);
46
- const dir = path.join(root, day);
47
- fs.mkdirSync(dir, { recursive: true });
48
- const line = JSON.stringify({
49
- ts: new Date().toISOString(), sub: subsystem, event,
50
- pid: process.pid, sess: process.env.CLAUDE_SESSION_ID || process.env.GM_SESSION_ID || '',
51
- ...fields,
52
- });
53
- fs.appendFileSync(path.join(dir, `${subsystem}.jsonl`), line + '\n');
54
- } catch (_) {}
43
+ _sharedLogEvent(subsystem, event, fields, { cwd: false });
55
44
  }
56
45
 
57
46
  function writeBootstrapError(spec) {
@@ -0,0 +1,38 @@
1
+ 'use strict';
2
+
3
+ const fs = require('fs');
4
+ const os = require('os');
5
+ const path = require('path');
6
+
7
+ const GM_LOG_ROOT = process.env.GM_LOG_DIR || path.join(os.homedir(), '.claude', 'gm-log');
8
+
9
+ function currentSess() {
10
+ return process.env.CLAUDE_SESSION_ID || process.env.GM_SESSION_ID || '';
11
+ }
12
+
13
+ function logEvent(sub, event, fields, opts) {
14
+ if (process.env.GM_LOG_DISABLE) return;
15
+ try {
16
+ const day = new Date().toISOString().slice(0, 10);
17
+ const dir = path.join(GM_LOG_ROOT, day);
18
+ fs.mkdirSync(dir, { recursive: true });
19
+ const safeFields = { ...(fields || {}) };
20
+ if (Object.prototype.hasOwnProperty.call(safeFields, 'pid')) {
21
+ safeFields.child_pid = safeFields.pid;
22
+ delete safeFields.pid;
23
+ }
24
+ const rec = {
25
+ ts: new Date().toISOString(),
26
+ sub,
27
+ event,
28
+ pid: process.pid,
29
+ sess: (opts && opts.sess) || currentSess(),
30
+ };
31
+ if (!opts || opts.cwd !== false) rec.cwd = process.cwd();
32
+ if (opts && opts.role) rec.role = opts.role;
33
+ Object.assign(rec, safeFields);
34
+ fs.appendFileSync(path.join(dir, `${sub}.jsonl`), JSON.stringify(rec) + '\n');
35
+ } catch (_) {}
36
+ }
37
+
38
+ module.exports = { GM_LOG_ROOT, currentSess, logEvent };
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm-plugkit",
3
- "version": "2.0.1959",
3
+ "version": "2.0.1960",
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": {
@@ -13,6 +13,7 @@
13
13
  "bootstrap.js",
14
14
  "supervisor.js",
15
15
  "plugkit-wasm-wrapper.js",
16
+ "gm-log.js",
16
17
  "plugkit.version",
17
18
  "plugkit.sha256",
18
19
  "instructions/"
@@ -12,6 +12,9 @@ const _netModule = net;
12
12
  const _httpModule = http;
13
13
  const _httpsModule = https;
14
14
  import { fileURLToPath } from 'url';
15
+ import _gmLog from './gm-log.js';
16
+ const _sharedLogEvent = _gmLog.logEvent;
17
+ const _sharedGmLogRoot = _gmLog.GM_LOG_ROOT;
15
18
 
16
19
  let _writeStatusBusy = () => {};
17
20
  let _lastBusyUntil = 0;
@@ -38,7 +41,7 @@ const GM_TOOLS_ROOT = resolveGmToolsRoot();
38
41
  const KV_DIR = path.join(GM_TOOLS_ROOT, 'kv');
39
42
  fs.mkdirSync(KV_DIR, { recursive: true });
40
43
 
41
- const GM_LOG_ROOT = process.env.GM_LOG_DIR || path.join(os.homedir(), '.claude', 'gm-log');
44
+ const GM_LOG_ROOT = _sharedGmLogRoot;
42
45
  const ORCHESTRATOR_VERBS = new Set(['instruction', 'transition', 'phase-status', 'prd-add', 'prd-resolve', 'prd-list', 'mutable-add', 'mutable-resolve', 'mutable-list', 'memorize-fire', 'residual-scan', 'auto-recall']);
43
46
 
44
47
  const TURN_IDLE_MS = 30_000;
@@ -472,27 +475,7 @@ const __lockRejectedEmitAt = new Map();
472
475
 
473
476
 
474
477
  function logEvent(sub, event, fields) {
475
- if (process.env.GM_LOG_DISABLE) return;
476
- try {
477
- const day = new Date().toISOString().slice(0, 10);
478
- const dir = path.join(GM_LOG_ROOT, day);
479
- fs.mkdirSync(dir, { recursive: true });
480
- const safeFields = { ...(fields || {}) };
481
- if (Object.prototype.hasOwnProperty.call(safeFields, 'pid')) {
482
- safeFields.child_pid = safeFields.pid;
483
- delete safeFields.pid;
484
- }
485
- const line = JSON.stringify({
486
- ts: new Date().toISOString(),
487
- sub,
488
- event,
489
- pid: process.pid,
490
- cwd: process.cwd(),
491
- sess: readCurrentSess(),
492
- ...safeFields,
493
- });
494
- fs.appendFileSync(path.join(dir, `${sub}.jsonl`), line + '\n');
495
- } catch (_) {}
478
+ _sharedLogEvent(sub, event, fields, { sess: readCurrentSess() });
496
479
  }
497
480
 
498
481
  function emitOrchestratorEvents(verb, taskBase, resultStr) {
@@ -7,6 +7,7 @@ const os = require('os');
7
7
  const crypto = require('crypto');
8
8
  const { spawn, spawnSync } = require('child_process');
9
9
  const { gmToolsDir } = require('./bootstrap');
10
+ const { logEvent: _sharedLogEvent, GM_LOG_ROOT: _sharedGmLogRoot } = require('./gm-log');
10
11
 
11
12
  function wrapperSha12OnDisk() {
12
13
  try {
@@ -24,7 +25,7 @@ const SHUTDOWN_REASON_PATH = path.join(spoolDir, '.shutdown-reason.json');
24
25
  const SUPERVISOR_PATH = path.join(spoolDir, '.supervisor.json');
25
26
  const SUPERVISOR_PID_PATH = path.join(spoolDir, '.supervisor.pid');
26
27
  const LOG_PATH = path.join(spoolDir, '.watcher.log');
27
- const GM_LOG_ROOT = process.env.GM_LOG_DIR || path.join(os.homedir(), '.claude', 'gm-log');
28
+ const GM_LOG_ROOT = _sharedGmLogRoot;
28
29
 
29
30
  const POLL_INTERVAL_MS = 10_000;
30
31
  const STATUS_STALE_MS = 30_000;
@@ -34,22 +35,7 @@ const BURST_BACKOFF_MS = 60_000;
34
35
  const VERSION_DRIFT_COOLDOWN_MS = 60_000;
35
36
 
36
37
  function logEvent(event, fields) {
37
- try {
38
- const day = new Date().toISOString().slice(0, 10);
39
- const dir = path.join(GM_LOG_ROOT, day);
40
- fs.mkdirSync(dir, { recursive: true });
41
- const line = JSON.stringify({
42
- ts: new Date().toISOString(),
43
- sub: 'plugkit',
44
- event,
45
- pid: process.pid,
46
- sess: process.env.CLAUDE_SESSION_ID || '',
47
- cwd: process.cwd(),
48
- role: 'supervisor',
49
- ...fields,
50
- }) + '\n';
51
- fs.appendFileSync(path.join(dir, 'plugkit.jsonl'), line);
52
- } catch (e) { try { console.error('[supervisor] logEvent write failed:', e); } catch (_) {} }
38
+ _sharedLogEvent('plugkit', event, fields, { sess: process.env.CLAUDE_SESSION_ID || '', role: 'supervisor' });
53
39
  }
54
40
 
55
41
  function writeSupervisorStatus(state, extra) {
package/gm.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm",
3
- "version": "2.0.1959",
3
+ "version": "2.0.1960",
4
4
  "description": "Spool-dispatch orchestration engine with unified state machine, skills, and automated git enforcement",
5
5
  "author": "AnEntrypoint",
6
6
  "license": "MIT",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm-skill",
3
- "version": "2.0.1959",
3
+ "version": "2.0.1960",
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",
@@ -43,6 +43,7 @@
43
43
  "gm-plugkit/package.json",
44
44
  "gm-plugkit/plugkit-wasm-wrapper.js",
45
45
  "gm-plugkit/supervisor.js",
46
+ "gm-plugkit/gm-log.js",
46
47
  "gm-plugkit/plugkit.version",
47
48
  "gm-plugkit/plugkit.sha256",
48
49
  "gm-plugkit/instructions/",