xtrm-tools 0.5.39 → 0.5.41

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,6 +1,6 @@
1
1
  {
2
2
  "name": "xtrm-tools",
3
- "version": "0.5.39",
3
+ "version": "0.5.41",
4
4
  "description": "xtrm-tools: dual-runtime workflow enforcement (Claude Code + Pi) — hooks, extensions, skills, and MCP servers",
5
5
  "author": {
6
6
  "name": "jaggers"
@@ -30319,10 +30319,10 @@ var require_stringify = __commonJS({
30319
30319
  replacer = null;
30320
30320
  indent2 = EMPTY;
30321
30321
  };
30322
- var join7 = (one, two, gap) => one ? two ? one + two.trim() + LF + gap : one.trimRight() + LF + gap : two ? two.trimRight() + LF + gap : EMPTY;
30322
+ var join8 = (one, two, gap) => one ? two ? one + two.trim() + LF + gap : one.trimRight() + LF + gap : two ? two.trimRight() + LF + gap : EMPTY;
30323
30323
  var join_content = (inside, value, gap) => {
30324
30324
  const comment = process_comments(value, PREFIX_BEFORE, gap + indent2, true);
30325
- return join7(comment, inside, gap);
30325
+ return join8(comment, inside, gap);
30326
30326
  };
30327
30327
  var array_stringify = (value, gap) => {
30328
30328
  const deeper_gap = gap + indent2;
@@ -30333,7 +30333,7 @@ var require_stringify = __commonJS({
30333
30333
  if (i !== 0) {
30334
30334
  inside += COMMA;
30335
30335
  }
30336
- const before = join7(
30336
+ const before = join8(
30337
30337
  after_comma,
30338
30338
  process_comments(value, BEFORE(i), deeper_gap),
30339
30339
  deeper_gap
@@ -30343,7 +30343,7 @@ var require_stringify = __commonJS({
30343
30343
  inside += process_comments(value, AFTER_VALUE(i), deeper_gap);
30344
30344
  after_comma = process_comments(value, AFTER(i), deeper_gap);
30345
30345
  }
30346
- inside += join7(
30346
+ inside += join8(
30347
30347
  after_comma,
30348
30348
  process_comments(value, PREFIX_AFTER, deeper_gap),
30349
30349
  deeper_gap
@@ -30368,7 +30368,7 @@ var require_stringify = __commonJS({
30368
30368
  inside += COMMA;
30369
30369
  }
30370
30370
  first = false;
30371
- const before = join7(
30371
+ const before = join8(
30372
30372
  after_comma,
30373
30373
  process_comments(value, BEFORE(key), deeper_gap),
30374
30374
  deeper_gap
@@ -30378,7 +30378,7 @@ var require_stringify = __commonJS({
30378
30378
  after_comma = process_comments(value, AFTER(key), deeper_gap);
30379
30379
  };
30380
30380
  keys.forEach(iteratee);
30381
- inside += join7(
30381
+ inside += join8(
30382
30382
  after_comma,
30383
30383
  process_comments(value, PREFIX_AFTER, deeper_gap),
30384
30384
  deeper_gap
@@ -33827,8 +33827,8 @@ var init_boxen = __esm({
33827
33827
  });
33828
33828
 
33829
33829
  // src/index.ts
33830
- var import_node_fs7 = require("fs");
33831
- var import_node_path8 = require("path");
33830
+ var import_node_fs8 = require("fs");
33831
+ var import_node_path9 = require("path");
33832
33832
 
33833
33833
  // ../node_modules/commander/esm.mjs
33834
33834
  var import_index = __toESM(require_commander(), 1);
@@ -57731,10 +57731,57 @@ function createDocsCommand() {
57731
57731
  return docs;
57732
57732
  }
57733
57733
 
57734
- // src/commands/debug.ts
57734
+ // src/commands/memory.ts
57735
57735
  var import_node_child_process12 = require("child_process");
57736
57736
  var import_node_fs6 = require("fs");
57737
57737
  var import_node_path7 = require("path");
57738
+ function createMemoryCommand() {
57739
+ return new Command("memory").description("Manage project memory (.xtrm/memory.md)").addCommand(createMemoryUpdateCommand());
57740
+ }
57741
+ function createMemoryUpdateCommand() {
57742
+ return new Command("update").description("Run memory-processor specialist to synthesize bd memories into .xtrm/memory.md").option("--dry-run", "Report only \u2014 do not modify memories or write memory.md", false).option("--no-beads", "Skip creating a tracking bead for this run", false).action((opts) => {
57743
+ const cwd = process.cwd();
57744
+ const check2 = (0, import_node_child_process12.spawnSync)("specialists", ["--version"], { encoding: "utf8", stdio: "pipe" });
57745
+ if (check2.status !== 0) {
57746
+ console.error(kleur_default.red(
57747
+ "\n \u2717 specialists CLI not found.\n Install with: npm install -g @jaggerxtrm/specialists\n"
57748
+ ));
57749
+ process.exit(1);
57750
+ }
57751
+ const list = (0, import_node_child_process12.spawnSync)("specialists", ["list", "--json"], { cwd, encoding: "utf8", stdio: "pipe" });
57752
+ if (list.status === 0) {
57753
+ try {
57754
+ const specialists = JSON.parse(list.stdout);
57755
+ if (!specialists.some((s) => s.name === "memory-processor")) {
57756
+ console.error(kleur_default.red(
57757
+ "\n \u2717 memory-processor specialist not found.\n Add specialists/memory-processor.specialist.yaml to this project.\n"
57758
+ ));
57759
+ process.exit(1);
57760
+ }
57761
+ } catch {
57762
+ }
57763
+ }
57764
+ const prompt = opts.dryRun ? "Dry run: classify all memories and show the full report. Do not call bd forget or write .xtrm/memory.md." : "Run the full memory processor workflow.";
57765
+ const args = ["run", "memory-processor", "--prompt", prompt];
57766
+ if (!opts.beads) args.push("--no-beads");
57767
+ console.log(kleur_default.bold(`
57768
+ xt memory update${opts.dryRun ? " (dry run)" : ""}
57769
+ `));
57770
+ if (!opts.dryRun) {
57771
+ const memPath = (0, import_node_path7.join)(cwd, ".xtrm", "memory.md");
57772
+ const action = (0, import_node_fs6.existsSync)(memPath) ? "Updating" : "Creating";
57773
+ console.log(kleur_default.dim(` ${action} .xtrm/memory.md...
57774
+ `));
57775
+ }
57776
+ const result = (0, import_node_child_process12.spawnSync)("specialists", args, { cwd, stdio: "inherit", encoding: "utf8" });
57777
+ process.exit(result.status ?? 0);
57778
+ });
57779
+ }
57780
+
57781
+ // src/commands/debug.ts
57782
+ var import_node_child_process13 = require("child_process");
57783
+ var import_node_fs7 = require("fs");
57784
+ var import_node_path8 = require("path");
57738
57785
  var KIND_LABELS = {
57739
57786
  "session.start": { label: "SESS+", color: kleur_default.green },
57740
57787
  "session.end": { label: "SESS-", color: kleur_default.white },
@@ -57834,14 +57881,14 @@ function buildDetail(event) {
57834
57881
  }
57835
57882
  if (event.kind === "tool.call") {
57836
57883
  if (d?.cmd) parts.push(kleur_default.dim(d.cmd.slice(0, 72)));
57837
- if (d?.file) parts.push(kleur_default.dim((0, import_node_path7.basename)(d.file)));
57884
+ if (d?.file) parts.push(kleur_default.dim((0, import_node_path8.basename)(d.file)));
57838
57885
  if (d?.pattern) parts.push(kleur_default.dim(`/${d.pattern}/`));
57839
57886
  if (d?.url) parts.push(kleur_default.dim(d.url.slice(0, 72)));
57840
57887
  if (d?.query) parts.push(kleur_default.dim(d.query.slice(0, 72)));
57841
57888
  if (d?.prompt) parts.push(kleur_default.dim(d.prompt.slice(0, 72)));
57842
57889
  } else {
57843
57890
  if (event.issue_id) parts.push(kleur_default.yellow(event.issue_id));
57844
- if (d?.file) parts.push(kleur_default.dim((0, import_node_path7.basename)(d.file)));
57891
+ if (d?.file) parts.push(kleur_default.dim((0, import_node_path8.basename)(d.file)));
57845
57892
  if (d?.reason_code) parts.push(kleur_default.dim(`[${d.reason_code}]`));
57846
57893
  if (event.worktree) parts.push(kleur_default.dim(`wt:${event.worktree}`));
57847
57894
  }
@@ -57858,8 +57905,8 @@ function formatLine(event, colorMap) {
57858
57905
  function findDbPath(cwd) {
57859
57906
  let dir = cwd;
57860
57907
  for (let i = 0; i < 10; i++) {
57861
- if ((0, import_node_fs6.existsSync)((0, import_node_path7.join)(dir, ".beads"))) return (0, import_node_path7.join)(dir, ".xtrm", "debug.db");
57862
- const parent = (0, import_node_path7.join)(dir, "..");
57908
+ if ((0, import_node_fs7.existsSync)((0, import_node_path8.join)(dir, ".beads"))) return (0, import_node_path8.join)(dir, ".xtrm", "debug.db");
57909
+ const parent = (0, import_node_path8.join)(dir, "..");
57863
57910
  if (parent === dir) break;
57864
57911
  dir = parent;
57865
57912
  }
@@ -57880,7 +57927,7 @@ function buildWhere(opts, base) {
57880
57927
  }
57881
57928
  function queryEvents(dbPath, where, limit) {
57882
57929
  const sql = `SELECT id,ts,session_id,runtime,worktree,kind,tool_name,outcome,issue_id,duration_ms,data FROM events${where ? ` WHERE ${where}` : ""} ORDER BY id ASC LIMIT ${limit}`;
57883
- const result = (0, import_node_child_process12.spawnSync)("sqlite3", [dbPath, "-json", sql], {
57930
+ const result = (0, import_node_child_process13.spawnSync)("sqlite3", [dbPath, "-json", sql], {
57884
57931
  stdio: ["pipe", "pipe", "pipe"],
57885
57932
  encoding: "utf8",
57886
57933
  timeout: 5e3
@@ -57920,7 +57967,7 @@ function createDebugCommand() {
57920
57967
  return new Command("debug").description("Watch xtrm events: tool calls, gate decisions, bd lifecycle").option("-f, --follow", "Follow new events (default)", false).option("--all", "Show full history and exit", false).option("--session <id>", "Filter by session ID (prefix match)").option("--type <domain>", "Filter by domain: tool | gate | bd | session").option("--json", "Output raw JSON lines", false).action((opts) => {
57921
57968
  const cwd = process.cwd();
57922
57969
  const dbPath = findDbPath(cwd);
57923
- if (!dbPath || !(0, import_node_fs6.existsSync)(dbPath)) return;
57970
+ if (!dbPath || !(0, import_node_fs7.existsSync)(dbPath)) return;
57924
57971
  if (opts.all) {
57925
57972
  const events = queryEvents(dbPath, buildWhere(opts, ""), 1e3);
57926
57973
  const colorMap = buildColorMap(events);
@@ -58105,7 +58152,7 @@ async function printBanner(version3) {
58105
58152
  // src/index.ts
58106
58153
  var version2 = "0.0.0";
58107
58154
  try {
58108
- version2 = JSON.parse((0, import_node_fs7.readFileSync)((0, import_node_path8.resolve)(__dirname, "../package.json"), "utf8")).version;
58155
+ version2 = JSON.parse((0, import_node_fs8.readFileSync)((0, import_node_path9.resolve)(__dirname, "../package.json"), "utf8")).version;
58109
58156
  } catch {
58110
58157
  }
58111
58158
  var program2 = new Command();
@@ -58132,6 +58179,7 @@ program2.addCommand(createEndCommand());
58132
58179
  program2.addCommand(createWorktreeCommand());
58133
58180
  program2.addCommand(createAttachCommand());
58134
58181
  program2.addCommand(createDocsCommand());
58182
+ program2.addCommand(createMemoryCommand());
58135
58183
  program2.addCommand(createDebugCommand());
58136
58184
  program2.addCommand(createHelpCommand());
58137
58185
  program2.action(async () => {