@point-seven-studio/jq-deck 0.3.2 → 0.3.3

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/dist/jq-deck.mjs CHANGED
@@ -3,21 +3,149 @@
3
3
  // src/cli.ts
4
4
  import { spawn } from "child_process";
5
5
  import { createServer } from "http";
6
+
7
+ // src/presence.ts
8
+ import { existsSync, mkdirSync, readdirSync, readFileSync, unlinkSync, writeFileSync } from "fs";
9
+ import os from "os";
10
+ import path from "path";
11
+ var TOOLS = [
12
+ { id: "deck", name: "JQ Deck", what: "sessions, setup and mail on one page", port: 4316, run: "npx @point-seven-studio/jq-deck" },
13
+ { id: "agents", name: "JQ Agents", what: "every session, and which wait on a person", port: 4319, run: "npx @point-seven-studio/jq-agents" },
14
+ { id: "groundcrew", name: "JQ Groundcrew", what: "the setup check for one project", port: 4317, run: "npx @point-seven-studio/jq-groundcrew" },
15
+ { id: "crosstalk", name: "JQ Crosstalk", what: "the mailbox between sessions", port: 4318, run: "npx @point-seven-studio/jq-crosstalk view" }
16
+ ];
17
+ var esc = (s) => String(s ?? "").replace(/[&<>"']/g, (c) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" })[c]);
18
+ function runningDir(env = process.env) {
19
+ return env.JQ_RUNNING_DIR || path.join(os.homedir(), ".jq", "running");
20
+ }
21
+ var isTool = (id) => TOOLS.some((t) => t.id === id);
22
+ var validPort = (n) => typeof n === "number" && Number.isInteger(n) && n >= 1 && n <= 65535;
23
+ function alive(pid) {
24
+ try {
25
+ process.kill(pid, 0);
26
+ return true;
27
+ } catch (e) {
28
+ return e?.code === "EPERM";
29
+ }
30
+ }
31
+ function readRunning(dir = runningDir(), isAlive = alive) {
32
+ const found = { deck: null, groundcrew: null, crosstalk: null, agents: null };
33
+ if (!existsSync(dir)) return found;
34
+ let files;
35
+ try {
36
+ files = readdirSync(dir).filter((f) => f.endsWith(".json"));
37
+ } catch {
38
+ return found;
39
+ }
40
+ for (const file of files) {
41
+ try {
42
+ const entry = JSON.parse(readFileSync(path.join(dir, file), "utf-8"));
43
+ if (!isTool(entry?.tool) || !validPort(entry.port) || typeof entry.pid !== "number" || !isAlive(entry.pid)) continue;
44
+ const usual = TOOLS.find((t) => t.id === entry.tool).port;
45
+ if (found[entry.tool] === null || entry.port === usual) found[entry.tool] = entry.port;
46
+ } catch {
47
+ }
48
+ }
49
+ return found;
50
+ }
51
+ function announce(tool, port, dir = runningDir()) {
52
+ const file = path.join(dir, `${tool}.${process.pid}.json`);
53
+ let removed = false;
54
+ const remove = () => {
55
+ if (removed) return;
56
+ removed = true;
57
+ try {
58
+ unlinkSync(file);
59
+ } catch {
60
+ }
61
+ };
62
+ try {
63
+ mkdirSync(dir, { recursive: true });
64
+ for (const f of readdirSync(dir).filter((n) => n.endsWith(".json"))) {
65
+ try {
66
+ const pid = JSON.parse(readFileSync(path.join(dir, f), "utf-8"))?.pid;
67
+ if (typeof pid !== "number" || !alive(pid)) unlinkSync(path.join(dir, f));
68
+ } catch {
69
+ }
70
+ }
71
+ writeFileSync(file, JSON.stringify({ tool, port, pid: process.pid, started_at: (/* @__PURE__ */ new Date()).toISOString() }) + "\n", { mode: 384 });
72
+ } catch {
73
+ return remove;
74
+ }
75
+ process.once("exit", remove);
76
+ for (const signal of ["SIGINT", "SIGTERM", "SIGHUP"]) {
77
+ process.once(signal, () => {
78
+ remove();
79
+ process.exit(signal === "SIGINT" ? 130 : 143);
80
+ });
81
+ }
82
+ return remove;
83
+ }
84
+ function readTeamUrl(file = process.env.JQ_CONFIG || path.join(os.homedir(), ".jq", "config.json")) {
85
+ try {
86
+ const team = JSON.parse(readFileSync(file, "utf-8"))?.team;
87
+ if (typeof team !== "string") return null;
88
+ const url = new URL(team);
89
+ if (url.protocol !== "https:" && url.protocol !== "http:") return null;
90
+ if (url.username || url.password) return null;
91
+ return url.href;
92
+ } catch {
93
+ return null;
94
+ }
95
+ }
96
+ var TOOLBAR_CSS = `
97
+ body{padding-bottom:64px}
98
+ .jqbar{position:fixed;left:0;right:0;bottom:0;z-index:5;display:flex;flex-wrap:wrap;align-items:center;gap:4px 14px;padding:8px 16px;font:13px/1.4 system-ui,sans-serif;background:var(--card,Canvas);color:var(--fg,CanvasText);border-top:1px solid var(--line,GrayText)}
99
+ .jqbar a{color:var(--link,LinkText)}
100
+ .jqbar .here{font-weight:700}
101
+ .jqbar details[open]{order:-1;flex-basis:100%}
102
+ .jqbar summary{cursor:pointer;color:var(--mut,GrayText);list-style:none;display:inline-block;padding:2px 0}
103
+ .jqbar summary::-webkit-details-marker{display:none}
104
+ .jqbar summary::after{content:" \u25B8"}
105
+ .jqbar details[open] summary::after{content:" \u25BE"}
106
+ .jqbar summary small,.jqbar a small{font-size:11px;font-weight:400}
107
+ .jqbar details>div{margin:4px 0 6px;padding:8px 10px;max-width:640px;border:1px solid var(--line,GrayText);border-radius:8px;background:var(--well,Canvas)}
108
+ .jqbar details>div p{margin:0 0 4px}
109
+ .jqbar code{font:12px ui-monospace,Menlo,monospace;word-break:break-all}
110
+ .jqbar a:focus-visible,.jqbar summary:focus-visible{outline:2px solid var(--link,LinkText);outline-offset:2px}
111
+ @media print{.jqbar{display:none}body{padding-bottom:0}}
112
+ `;
113
+ var local = (port) => `http://127.0.0.1:${port}`;
114
+ function toolItem(t, o) {
115
+ if (o.here === t.id) return `<span class="here" aria-current="page">${esc(t.name)}</span>`;
116
+ const start = `<p>To start it: <code>${esc(t.run)}</code></p>`;
117
+ if (o.running === null) {
118
+ return `<details><summary>${esc(t.name)} <small>on your computer</small></summary><div><p>${esc(t.name)} shows ${esc(t.what)}. It runs on your own computer, and this page cannot see whether it is running there.</p><p>If it is, it is at <a href="${local(t.port)}">${local(t.port)}</a>.</p>${start}</div></details>`;
119
+ }
120
+ const port = o.running[t.id];
121
+ if (port !== null) return `<a href="${local(port)}" title="${esc(t.what)}">${esc(t.name)}</a>`;
122
+ return `<details><summary>${esc(t.name)} <small>not running</small></summary><div><p>${esc(t.name)} shows ${esc(t.what)}. It is not running on this machine.</p>${start}<p>Then refresh this page.</p></div></details>`;
123
+ }
124
+ function teamItem(o) {
125
+ if (o.here === "team") return '<span class="here" aria-current="page">Team board</span>';
126
+ if (o.team) return `<a href="${esc(o.team)}" title="every machine on the team, on one page">Team board</a>`;
127
+ return '<details><summary>Team board <small>not set up</small></summary><div><p>A team board shows every machine on a team on one page. This machine has no address for one.</p><p>If your team has one, add a <code>"team"</code> line holding its address to <code>~/.jq/config.json</code>.</p><p>To host one: <code>npx @point-seven-studio/jq-deck-server</code></p></div></details>';
128
+ }
129
+ function toolbar(o) {
130
+ return `<nav class="jqbar" aria-label="JQ tools">${TOOLS.map((t) => toolItem(t, o)).join("")}${teamItem(o)}</nav>`;
131
+ }
132
+
133
+ // src/cli.ts
6
134
  import path7 from "path";
7
135
 
8
136
  // ../agents/dist/index.mjs
9
137
  import { execFile as execFile2 } from "child_process";
10
- import { existsSync } from "fs";
138
+ import { existsSync as existsSync2 } from "fs";
11
139
  import { open, readdir, stat } from "fs/promises";
12
140
  import os2 from "os";
13
- import path from "path";
141
+ import path2 from "path";
14
142
  import { promisify as promisify2 } from "util";
15
143
  import { execFile } from "child_process";
16
144
  import { promisify } from "util";
17
- import os from "os";
18
- import { existsSync as existsSync2, mkdirSync, readFileSync, renameSync, writeFileSync } from "fs";
19
145
  import os3 from "os";
20
- import path2 from "path";
146
+ import { existsSync as existsSync22, mkdirSync as mkdirSync2, readFileSync as readFileSync2, renameSync, writeFileSync as writeFileSync2 } from "fs";
147
+ import os32 from "os";
148
+ import path22 from "path";
21
149
  var EDIT_TOOLS = /* @__PURE__ */ new Set(["Edit", "Write", "MultiEdit", "NotebookEdit"]);
22
150
  function looksLikeACheck(command) {
23
151
  return /\b(test|tests|jest|vitest|pytest|mocha|lint|eslint|ruff|tsc|typecheck|type-check|mypy|pyright|check|build|cargo (test|check|clippy)|go (test|vet))\b/i.test(command);
@@ -247,16 +375,16 @@ function lastActivityAt(records) {
247
375
  }
248
376
  return null;
249
377
  }
250
- function deriveState(alive, lastActivityIso, now) {
251
- if (!alive) return "dead";
378
+ function deriveState(alive2, lastActivityIso, now) {
379
+ if (!alive2) return "dead";
252
380
  if (!lastActivityIso) return "stale";
253
381
  const ageS = Math.max(0, (now - Date.parse(lastActivityIso)) / 1e3);
254
382
  if (ageS <= LIVE_WITHIN_S) return "live";
255
383
  if (ageS <= IDLE_WITHIN_S) return "idle";
256
384
  return "stale";
257
385
  }
258
- function deriveWaiting(rec, alive) {
259
- if (!alive || !rec || rec.type !== "assistant") return false;
386
+ function deriveWaiting(rec, alive2) {
387
+ if (!alive2 || !rec || rec.type !== "assistant") return false;
260
388
  return rec.message?.stop_reason === "end_turn";
261
389
  }
262
390
  function deriveAttention(state, waiting) {
@@ -270,7 +398,7 @@ function isTreeAllowed(workingTree, allowlist) {
270
398
  return allowlist.some((t) => t && (workingTree === t || workingTree.startsWith(t.replace(/\/+$/, "") + "/")));
271
399
  }
272
400
  function buildStatusRow(opts) {
273
- const { machine, records, sessionIdFallback, alive, pid, allowlist, now, workingTreeOverride } = opts;
401
+ const { machine, records, sessionIdFallback, alive: alive2, pid, allowlist, now, workingTreeOverride } = opts;
274
402
  const withCwd = [...records].reverse().find((r) => r?.cwd);
275
403
  const workingTree = workingTreeOverride || withCwd?.cwd || "";
276
404
  if (!workingTree) return null;
@@ -280,8 +408,8 @@ function buildStatusRow(opts) {
280
408
  const substantive = lastSubstantive(records);
281
409
  const assistant = lastAssistant(records);
282
410
  const activity = lastActivityAt(records);
283
- const state = deriveState(alive, activity, now);
284
- const waiting = deriveWaiting(substantive, alive);
411
+ const state = deriveState(alive2, activity, now);
412
+ const waiting = deriveWaiting(substantive, alive2);
285
413
  const rawText = assistant ? messageText(assistant) : "";
286
414
  const allowed = isTreeAllowed(workingTree, allowlist);
287
415
  let blocked_question = null;
@@ -478,9 +606,9 @@ async function sampleHost(probe = false) {
478
606
  ]);
479
607
  const disk = parseIostat(iostat);
480
608
  return {
481
- cpuCount: os.cpus()?.length || 0,
482
- load1: parseLoadAvg(load) || os.loadavg()[0] || 0,
483
- memUsedPct: parseVmStat(vmstat, os.totalmem()),
609
+ cpuCount: os3.cpus()?.length || 0,
610
+ load1: parseLoadAvg(load) || os3.loadavg()[0] || 0,
611
+ memUsedPct: parseVmStat(vmstat, os3.totalmem()),
484
612
  swapUsedMb: parseSwapUsedMb(swap),
485
613
  diskReadMbs: disk?.readMbs ?? null,
486
614
  diskWriteMbs: disk?.writeMbs ?? null,
@@ -504,7 +632,7 @@ async function sampleProcs(pids) {
504
632
  }
505
633
  var execFileAsync2 = promisify2(execFile2);
506
634
  function defaultProjectsDir() {
507
- return path.join(process.env.CLAUDE_CONFIG_DIR || path.join(os2.homedir(), ".claude"), "projects");
635
+ return path2.join(process.env.CLAUDE_CONFIG_DIR || path2.join(os2.homedir(), ".claude"), "projects");
508
636
  }
509
637
  var TAIL_RECORDS = 200;
510
638
  async function findTranscripts(dir, out = []) {
@@ -515,7 +643,7 @@ async function findTranscripts(dir, out = []) {
515
643
  return out;
516
644
  }
517
645
  for (const e of entries) {
518
- const full = path.join(dir, e.name);
646
+ const full = path2.join(dir, e.name);
519
647
  if (e.isDirectory()) await findTranscripts(full, out);
520
648
  else if (e.isFile() && e.name.endsWith(".jsonl")) out.push(full);
521
649
  }
@@ -529,10 +657,10 @@ async function repoRoot(dir) {
529
657
  let cur = dir;
530
658
  for (let i = 0; i < 12; i++) {
531
659
  try {
532
- await stat(path.join(cur, ".git"));
660
+ await stat(path2.join(cur, ".git"));
533
661
  break;
534
662
  } catch {
535
- const parent = path.dirname(cur);
663
+ const parent = path2.dirname(cur);
536
664
  if (parent === cur) {
537
665
  cur = dir;
538
666
  break;
@@ -591,7 +719,7 @@ async function pidCwds(pids) {
591
719
  const byCwd = /* @__PURE__ */ new Map();
592
720
  if (pids.length === 0) return byCwd;
593
721
  try {
594
- const lsof = existsSync("/usr/sbin/lsof") ? "/usr/sbin/lsof" : "lsof";
722
+ const lsof = existsSync2("/usr/sbin/lsof") ? "/usr/sbin/lsof" : "lsof";
595
723
  const { stdout } = await execFileAsync2(lsof, ["-a", "-p", pids.join(","), "-d", "cwd", "-Fn"], { maxBuffer: 4 * 1024 * 1024 });
596
724
  let current = null;
597
725
  for (const line of stdout.split("\n")) {
@@ -623,12 +751,12 @@ async function collectRows(opts = {}) {
623
751
  const config = opts.turnCheck;
624
752
  let evidence = null;
625
753
  const row3 = buildStatusRow({
626
- turnCheck: config ? { ...rulesFor(config, tree), muted: config.muted.includes(tree), dismissedAt: config.dismissed[path.basename(file, ".jsonl")] ?? null } : void 0,
754
+ turnCheck: config ? { ...rulesFor(config, tree), muted: config.muted.includes(tree), dismissedAt: config.dismissed[path2.basename(file, ".jsonl")] ?? null } : void 0,
627
755
  onTurnDetail: (detail) => evidence = detail.evidence,
628
756
  machine,
629
757
  records,
630
758
  workingTreeOverride: tree || void 0,
631
- sessionIdFallback: path.basename(file, ".jsonl"),
759
+ sessionIdFallback: path2.basename(file, ".jsonl"),
632
760
  alive: pid !== null,
633
761
  pid,
634
762
  allowlist: opts.questionTrees ?? [],
@@ -687,7 +815,24 @@ async function snapshot(opts = {}) {
687
815
  if (opts.evidence) snap.local = { turn_check };
688
816
  return snap;
689
817
  }
690
- var esc = (s) => String(s ?? "").replace(/[&<>"']/g, (c) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" })[c]);
818
+ var TOOLBAR_CSS2 = `
819
+ body{padding-bottom:64px}
820
+ .jqbar{position:fixed;left:0;right:0;bottom:0;z-index:5;display:flex;flex-wrap:wrap;align-items:center;gap:4px 14px;padding:8px 16px;font:13px/1.4 system-ui,sans-serif;background:var(--card,Canvas);color:var(--fg,CanvasText);border-top:1px solid var(--line,GrayText)}
821
+ .jqbar a{color:var(--link,LinkText)}
822
+ .jqbar .here{font-weight:700}
823
+ .jqbar details[open]{order:-1;flex-basis:100%}
824
+ .jqbar summary{cursor:pointer;color:var(--mut,GrayText);list-style:none;display:inline-block;padding:2px 0}
825
+ .jqbar summary::-webkit-details-marker{display:none}
826
+ .jqbar summary::after{content:" \u25B8"}
827
+ .jqbar details[open] summary::after{content:" \u25BE"}
828
+ .jqbar summary small,.jqbar a small{font-size:11px;font-weight:400}
829
+ .jqbar details>div{margin:4px 0 6px;padding:8px 10px;max-width:640px;border:1px solid var(--line,GrayText);border-radius:8px;background:var(--well,Canvas)}
830
+ .jqbar details>div p{margin:0 0 4px}
831
+ .jqbar code{font:12px ui-monospace,Menlo,monospace;word-break:break-all}
832
+ .jqbar a:focus-visible,.jqbar summary:focus-visible{outline:2px solid var(--link,LinkText);outline-offset:2px}
833
+ @media print{.jqbar{display:none}body{padding-bottom:0}}
834
+ `;
835
+ var esc2 = (s) => String(s ?? "").replace(/[&<>"']/g, (c) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" })[c]);
691
836
  function ago(iso, now) {
692
837
  if (!iso) return "unknown";
693
838
  const s = Math.max(0, Math.floor((now - Date.parse(iso)) / 1e3));
@@ -719,14 +864,14 @@ function groupByTree(rows) {
719
864
  rows: list2.sort((a, b) => (b.last_activity_at || "").localeCompare(a.last_activity_at || ""))
720
865
  })).sort((a, b) => Number(needs(b.rows)) - Number(needs(a.rows)) || latest(b.rows).localeCompare(latest(a.rows)));
721
866
  }
722
- var hidden = (fields) => Object.entries(fields).map(([name, value]) => `<input type="hidden" name="${name}" value="${esc(value)}">`).join("");
723
- var form = (m, fields, label) => `<form method="post" action="/turn-check">${hidden({ token: m.token, ...fields })}<button type="submit">${esc(label)}</button></form>`;
867
+ var hidden = (fields) => Object.entries(fields).map(([name, value]) => `<input type="hidden" name="${name}" value="${esc2(value)}">`).join("");
868
+ var form = (m, fields, label) => `<form method="post" action="/turn-check">${hidden({ token: m.token, ...fields })}<button type="submit">${esc2(label)}</button></form>`;
724
869
  function whyPanel(r, evidence, m) {
725
- const how = evidence.via === "shell" ? `<code>${esc(evidence.edit)}</code>, a shell command` : `the ${esc(evidence.edit)} tool`;
870
+ const how = evidence.via === "shell" ? `<code>${esc2(evidence.edit)}</code>, a shell command` : `the ${esc2(evidence.edit)} tool`;
726
871
  const verdict = r.turn_check === "failed" ? "The last check after it failed." : "No check ran after it.";
727
872
  const after = evidence.after.length ? `<p>It ran these afterwards. If one of them is how this project checks its work, say so:</p><ul class="cmds">${evidence.after.map((command) => {
728
873
  const text = ruleText(command);
729
- return `<li><code>${esc(command)}</code>${text.length >= 2 ? form(m, { action: "add-rule", kind: "check", tree: r.working_tree, text }, `Count "${text}" as a check here`) : ""}</li>`;
874
+ return `<li><code>${esc2(command)}</code>${text.length >= 2 ? form(m, { action: "add-rule", kind: "check", tree: r.working_tree, text }, `Count "${text}" as a check here`) : ""}</li>`;
730
875
  }).join("")}</ul>` : "";
731
876
  const notEdit = evidence.via === "shell" && ruleText(evidence.edit).length >= 2 ? form(m, { action: "add-rule", kind: "not-edit", tree: r.working_tree, text: ruleText(evidence.edit) }, `"${ruleText(evidence.edit)}" does not edit code here`) : "";
732
877
  return `<details class="why"><summary>Why, and is it wrong?</summary><p>The last edit was ${how}. ${verdict}</p>${after}<div class="acts">${notEdit}` + form(m, { action: "dismiss", session: r.session_id }, "Dismiss this one") + form(m, { action: "mute", tree: r.working_tree }, "Never label this tree") + "</div></details>";
@@ -736,27 +881,27 @@ function sessionRow(r, now, evidence, manage) {
736
881
  const badge = attention === "needs-you" ? '<span class="b need">waiting on a person</span>' : attention === "abandoned" ? '<span class="b old">asked, then left</span>' : "";
737
882
  const check = r.turn_check === "unchecked" ? '<span class="b need">stopped without running a check</span>' : r.turn_check === "failed" ? '<span class="b bad">stopped after a failed check</span>' : "";
738
883
  const res = r.cpu_pct != null || r.rss_mb != null ? `<span class="mut">${r.cpu_pct ?? "?"}% cpu \xB7 ${r.rss_mb ?? "?"} MB</span>` : "";
739
- const question = r.blocked_question ? `<pre>${esc(r.blocked_question)}${r.question_redacted ? "\n[a secret-shaped string was removed]" : ""}</pre>` : attention !== "none" && !r.question_allowed ? '<p class="mut q">Question text is off for this tree.</p>' : "";
884
+ const question = r.blocked_question ? `<pre>${esc2(r.blocked_question)}${r.question_redacted ? "\n[a secret-shaped string was removed]" : ""}</pre>` : attention !== "none" && !r.question_allowed ? '<p class="mut q">Question text is off for this tree.</p>' : "";
740
885
  const why = check && evidence && manage ? whyPanel(r, evidence, manage) : "";
741
- return `<li><span class="s ${r.state}">${r.state}</span> <span class="mut">${esc(r.branch || "no branch")} \xB7 active ${ago(r.last_activity_at, now)} ago</span> ${[badge, check].filter(Boolean).join('<span class="mut"> \xB7 </span>')} ${res}${question}${why}</li>`;
886
+ return `<li><span class="s ${r.state}">${r.state}</span> <span class="mut">${esc2(r.branch || "no branch")} \xB7 active ${ago(r.last_activity_at, now)} ago</span> ${[badge, check].filter(Boolean).join('<span class="mut"> \xB7 </span>')} ${res}${question}${why}</li>`;
742
887
  }
743
888
  function correctionsPanel(snap, m) {
744
889
  const { rules, muted, dismissed } = m.config;
745
890
  const items = [
746
- ...rules.map((rule, index) => `<li><span>${rule.kind === "check" ? "Counts as a check" : "Does not edit code"}: <code>${esc(rule.text)}</code> <span class="mut">in ${esc(rule.tree === "*" ? "every tree" : rule.tree)}</span></span>${form(m, { action: "remove-rule", index: String(index) }, "Remove")}</li>`),
747
- ...muted.map((tree) => `<li><span>Never labelled: <span class="mut">${esc(tree)}</span></span>${form(m, { action: "unmute", tree }, "Label it again")}</li>`),
891
+ ...rules.map((rule, index) => `<li><span>${rule.kind === "check" ? "Counts as a check" : "Does not edit code"}: <code>${esc2(rule.text)}</code> <span class="mut">in ${esc2(rule.tree === "*" ? "every tree" : rule.tree)}</span></span>${form(m, { action: "remove-rule", index: String(index) }, "Remove")}</li>`),
892
+ ...muted.map((tree) => `<li><span>Never labelled: <span class="mut">${esc2(tree)}</span></span>${form(m, { action: "unmute", tree }, "Label it again")}</li>`),
748
893
  ...Object.keys(dismissed).map((session) => {
749
894
  const row3 = snap.sessions.find((r) => r.session_id === session);
750
- return `<li><span>Dismissed: <span class="mut">${esc(row3 ? `${row3.product} \xB7 ${row3.branch || "no branch"}` : `session ${session.slice(0, 8)}`)}</span></span>${form(m, { action: "undismiss", session }, "Undo")}</li>`;
895
+ return `<li><span>Dismissed: <span class="mut">${esc2(row3 ? `${row3.product} \xB7 ${row3.branch || "no branch"}` : `session ${session.slice(0, 8)}`)}</span></span>${form(m, { action: "undismiss", session }, "Undo")}</li>`;
751
896
  })
752
897
  ];
753
- return '<section class="card fix"><h2>Your corrections to the check label</h2>' + (items.length ? `<ul>${items.join("")}</ul>` : '<p class="mut pad">None yet. A label you think is wrong has a "Why, and is it wrong?" link under it.</p>') + '<p class="mut pad">Saved in <code>~/.jq/config.json</code> on this machine. This is the only file JQ Agents writes.</p></section>';
898
+ return '<section class="card fix"><h2>Your corrections to the check label</h2>' + (items.length ? `<ul>${items.join("")}</ul>` : '<p class="mut pad">None yet. A label you think is wrong has a "Why, and is it wrong?" link under it.</p>') + '<p class="mut pad">Saved in <code>~/.jq/config.json</code> on this machine. Apart from its own running note in <code>~/.jq/running/</code>, this is the only file JQ Agents writes.</p></section>';
754
899
  }
755
- function renderPage(snap, now = Date.now(), manage) {
900
+ function renderPage(snap, now = Date.now(), manage, bar = "") {
756
901
  const t = totals(snap.sessions);
757
902
  const b = snap.bottleneck;
758
- const chip = !b ? '<p class="mut">Host not sampled.</p>' : b.kind === "none" ? "" : `<p class="chip">${b.kind === "unknown" ? "Could not tell what this machine is short of." : `Bottleneck: ${esc(b.kind)}${b.reason ? ` (${esc(b.reason)})` : ""}`}</p>`;
759
- const trees = groupByTree(snap.sessions).map((g) => `<section class="card"><h2>${esc(g.product)} <span class="mut">${esc(g.tree)}</span></h2><ul>${g.rows.map((r) => sessionRow(r, now, snap.local?.turn_check[r.session_id], manage)).join("")}</ul></section>`).join("");
903
+ const chip = !b ? '<p class="mut">Host not sampled.</p>' : b.kind === "none" ? "" : `<p class="chip">${b.kind === "unknown" ? "Could not tell what this machine is short of." : `Bottleneck: ${esc2(b.kind)}${b.reason ? ` (${esc2(b.reason)})` : ""}`}</p>`;
904
+ const trees = groupByTree(snap.sessions).map((g) => `<section class="card"><h2>${esc2(g.product)} <span class="mut">${esc2(g.tree)}</span></h2><ul>${g.rows.map((r) => sessionRow(r, now, snap.local?.turn_check[r.session_id], manage)).join("")}</ul></section>`).join("");
760
905
  return `<!doctype html>
761
906
  <html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
762
907
  <title>JQ Agents</title>
@@ -780,21 +925,21 @@ code{font:12px ui-monospace,Menlo,monospace;background:var(--well);border-radius
780
925
  button{font:600 12px system-ui,sans-serif;color:var(--fg);background:var(--card);border:1px solid var(--line);border-radius:6px;padding:5px 10px;min-height:30px;cursor:pointer}
781
926
  button:hover{border-color:var(--mut)}button:focus-visible{outline:2px solid var(--fg);outline-offset:2px}.pad{margin:0;padding:8px 12px}
782
927
  pre{white-space:pre-wrap;word-break:break-word;background:var(--well);margin:8px 0 2px;padding:10px;border-radius:8px;font-size:12px}.q{margin:6px 0 0}
783
- </style></head><body><main>
928
+ ${bar ? TOOLBAR_CSS2 : ""}</style></head><body><main>
784
929
  <h1>JQ Agents</h1>
785
- <p class="mut">${esc(snap.machine)} \xB7 read ${esc(snap.generated_at)}. Refresh to read again. Read-only: answer a session where it is running.</p>
930
+ <p class="mut">${esc2(snap.machine)} \xB7 read ${esc2(snap.generated_at)}. Refresh to read again. Read-only: answer a session where it is running.</p>
786
931
  <div class="tot"><div><b>${t.needs_you}</b><span class="mut">waiting on a person</span></div><div><b>${t.abandoned}</b><span class="mut">asked, then left</span></div><div><b>${t.live}</b><span class="mut">live</span></div><div><b>${t.sessions}</b><span class="mut">sessions in ${t.trees} ${t.trees === 1 ? "tree" : "trees"}</span></div></div>
787
932
  ${chip}
788
933
  ${trees || '<p class="mut">No session has been active in the window read.</p>'}
789
934
  ${manage ? correctionsPanel(snap, manage) : ""}
790
- </main></body></html>`;
935
+ </main>${bar}</body></html>`;
791
936
  }
792
937
  function defaultConfigFile() {
793
- return process.env.JQ_CONFIG || path2.join(os3.homedir(), ".jq", "config.json");
938
+ return process.env.JQ_CONFIG || path22.join(os32.homedir(), ".jq", "config.json");
794
939
  }
795
940
  function readAll(file) {
796
- if (!existsSync2(file)) return {};
797
- const parsed = JSON.parse(readFileSync(file, "utf-8"));
941
+ if (!existsSync22(file)) return {};
942
+ const parsed = JSON.parse(readFileSync2(file, "utf-8"));
798
943
  if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) throw new Error(`${file} does not hold a JSON object`);
799
944
  return parsed;
800
945
  }
@@ -807,8 +952,9 @@ function readTurnCheckConfig(file = defaultConfigFile()) {
807
952
  }
808
953
 
809
954
  // ../crosstalk/dist/index.mjs
810
- import { existsSync as existsSync3, readdirSync, readFileSync as readFileSync2, statSync } from "fs";
955
+ import { existsSync as existsSync3, readdirSync as readdirSync2, readFileSync as readFileSync3, statSync } from "fs";
811
956
  import path3 from "path";
957
+ import { createHash, createPrivateKey, createPublicKey, generateKeyPairSync, sign, verify } from "crypto";
812
958
  var BOARD = "board";
813
959
  var DAY_MS = 864e5;
814
960
  function ageDays(sentAt, now) {
@@ -827,7 +973,9 @@ function summarize(m, now) {
827
973
  sent_at: m.sent_at,
828
974
  acked: m.acked,
829
975
  age_days: ageDays(m.sent_at, now),
830
- kind: m.kind ?? null
976
+ kind: m.kind ?? null,
977
+ author: m.author ?? null,
978
+ signature_state: m.signature_state ?? null
831
979
  };
832
980
  }
833
981
  var plural = (n, one, many) => n === 1 ? one : many;
@@ -996,6 +1144,7 @@ function parseMessage(filename, raw, recipient, acked) {
996
1144
  let kind = null;
997
1145
  let thread = null;
998
1146
  let replyTo = null;
1147
+ let author = null;
999
1148
  let from = "";
1000
1149
  let subject = null;
1001
1150
  let sent = null;
@@ -1018,6 +1167,7 @@ function parseMessage(filename, raw, recipient, acked) {
1018
1167
  } else if (m[1] === "expires") expires = /^\d{4}-\d{2}-\d{2}$/.test(m[2].trim()) ? m[2].trim() : null;
1019
1168
  else if (m[1] === "evidence") evidence = m[2].trim() || null;
1020
1169
  else if (m[1] === "settled_by") settledBy = m[2].trim() || null;
1170
+ else if (m[1] === "author") author = m[2].trim() || null;
1021
1171
  }
1022
1172
  }
1023
1173
  if (!from) from = "unknown";
@@ -1036,30 +1186,106 @@ function parseMessage(filename, raw, recipient, acked) {
1036
1186
  tags,
1037
1187
  expires_on: expires,
1038
1188
  evidence: evidence && ["verified", "assumed"].includes(evidence) ? evidence : null,
1039
- settled_by: settledBy && SETTLED_BY.includes(settledBy) ? settledBy : null
1189
+ settled_by: settledBy && SETTLED_BY.includes(settledBy) ? settledBy : null,
1190
+ author
1040
1191
  };
1041
1192
  }
1193
+ var VERSION = "jq-crosstalk-signed-v1";
1194
+ function signingPayload(f) {
1195
+ return Buffer.from(
1196
+ JSON.stringify([VERSION, f.filename, f.from, f.to, f.subject, f.sent, f.kind, f.thread, f.reply_to, f.author, f.body.trim()]),
1197
+ "utf8"
1198
+ );
1199
+ }
1200
+ function fingerprint(publicKey) {
1201
+ return createHash("sha256").update(Buffer.from(publicKey, "base64")).digest("hex").slice(0, 16);
1202
+ }
1203
+ function parseSigners(text) {
1204
+ const signers = /* @__PURE__ */ new Map();
1205
+ for (const line of text.split("\n")) {
1206
+ const m = line.match(/^([a-z0-9][a-z0-9-]*):\s*([A-Za-z0-9+/=]+)\s*$/);
1207
+ if (m) signers.set(m[1], m[2]);
1208
+ }
1209
+ return signers;
1210
+ }
1211
+ function splitMessage(filename, raw) {
1212
+ const fields = { filename, from: "", to: "", subject: "", sent: "", kind: "", thread: "", reply_to: "", author: "", body: raw };
1213
+ let signature = "";
1214
+ const fm = raw.match(/^---\n([\s\S]*?)\n---\n?([\s\S]*)$/);
1215
+ if (!fm) return { fields, signature };
1216
+ fields.body = fm[2];
1217
+ for (const line of fm[1].split("\n")) {
1218
+ const m = line.match(/^(\w+):\s*(.*)$/);
1219
+ if (!m) continue;
1220
+ const value = m[2].trim();
1221
+ if (m[1] === "signature") signature = value;
1222
+ else if (m[1] === "from" || m[1] === "to" || m[1] === "subject" || m[1] === "sent" || m[1] === "kind" || m[1] === "thread" || m[1] === "reply_to" || m[1] === "author") {
1223
+ fields[m[1]] = value;
1224
+ }
1225
+ }
1226
+ return { fields, signature };
1227
+ }
1228
+ function checkSignature(filename, raw, signers) {
1229
+ const { fields, signature } = splitMessage(filename, raw);
1230
+ const publicKey = signers.get(fields.from);
1231
+ const base = { from: fields.from, author: fields.author };
1232
+ if (!publicKey) return { ...base, state: signature ? "unknown-signer" : "not-required", key: "" };
1233
+ const key = fingerprint(publicKey);
1234
+ if (!signature) return { ...base, state: "unsigned", key };
1235
+ try {
1236
+ const ok = verify(
1237
+ null,
1238
+ signingPayload(fields),
1239
+ createPublicKey({ key: Buffer.from(publicKey, "base64"), format: "der", type: "spki" }),
1240
+ Buffer.from(signature, "base64")
1241
+ );
1242
+ return { ...base, state: ok ? "verified" : "failed", key };
1243
+ } catch {
1244
+ return { ...base, state: "failed", key };
1245
+ }
1246
+ }
1042
1247
  function names(dir) {
1043
1248
  if (!existsSync3(dir)) return [];
1044
- return readdirSync(dir).filter((n) => statSync(path3.join(dir, n)).isDirectory());
1249
+ return readdirSync2(dir).filter((n) => statSync(path3.join(dir, n)).isDirectory());
1045
1250
  }
1046
1251
  function readMailbox(root) {
1047
1252
  if (!existsSync3(path3.join(root, "inbox"))) throw new Error(`not a crosstalk mailbox (no inbox/ folder): ${root}`);
1253
+ const signersFile = path3.join(root, "registry", "signers.txt");
1254
+ const signers = existsSync3(signersFile) ? parseSigners(readFileSync3(signersFile, "utf8")) : /* @__PURE__ */ new Map();
1048
1255
  const byKey = /* @__PURE__ */ new Map();
1049
1256
  for (const [base, acked] of [["inbox", false], ["archive", true]]) {
1050
1257
  for (const name of names(path3.join(root, base))) {
1051
1258
  const dir = path3.join(root, base, name);
1052
- for (const file of readdirSync(dir).filter((f) => f.endsWith(".md"))) {
1053
- const row22 = parseMessage(file, readFileSync2(path3.join(dir, file), "utf8"), name, acked);
1259
+ for (const file of readdirSync2(dir).filter((f) => f.endsWith(".md"))) {
1260
+ const raw = readFileSync3(path3.join(dir, file), "utf8");
1261
+ const row22 = parseMessage(file, raw, name, acked);
1262
+ const state = checkSignature(file, raw, signers).state;
1054
1263
  const key = `${name}/${file}`;
1055
1264
  const prev = byKey.get(key);
1056
- if (!prev || acked && !prev.acked) byKey.set(key, { id: key, ...row22 });
1265
+ if (!prev || acked && !prev.acked) byKey.set(key, { id: key, ...row22, signature_state: state === "not-required" ? null : state });
1057
1266
  }
1058
1267
  }
1059
1268
  }
1060
1269
  return [...byKey.values()].sort((a, b) => a.id.localeCompare(b.id));
1061
1270
  }
1062
- var esc2 = (s) => String(s ?? "").replace(/[&<>"']/g, (c) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" })[c]);
1271
+ var TOOLBAR_CSS3 = `
1272
+ body{padding-bottom:64px}
1273
+ .jqbar{position:fixed;left:0;right:0;bottom:0;z-index:5;display:flex;flex-wrap:wrap;align-items:center;gap:4px 14px;padding:8px 16px;font:13px/1.4 system-ui,sans-serif;background:var(--card,Canvas);color:var(--fg,CanvasText);border-top:1px solid var(--line,GrayText)}
1274
+ .jqbar a{color:var(--link,LinkText)}
1275
+ .jqbar .here{font-weight:700}
1276
+ .jqbar details[open]{order:-1;flex-basis:100%}
1277
+ .jqbar summary{cursor:pointer;color:var(--mut,GrayText);list-style:none;display:inline-block;padding:2px 0}
1278
+ .jqbar summary::-webkit-details-marker{display:none}
1279
+ .jqbar summary::after{content:" \u25B8"}
1280
+ .jqbar details[open] summary::after{content:" \u25BE"}
1281
+ .jqbar summary small,.jqbar a small{font-size:11px;font-weight:400}
1282
+ .jqbar details>div{margin:4px 0 6px;padding:8px 10px;max-width:640px;border:1px solid var(--line,GrayText);border-radius:8px;background:var(--well,Canvas)}
1283
+ .jqbar details>div p{margin:0 0 4px}
1284
+ .jqbar code{font:12px ui-monospace,Menlo,monospace;word-break:break-all}
1285
+ .jqbar a:focus-visible,.jqbar summary:focus-visible{outline:2px solid var(--link,LinkText);outline-offset:2px}
1286
+ @media print{.jqbar{display:none}body{padding-bottom:0}}
1287
+ `;
1288
+ var esc3 = (s) => String(s ?? "").replace(/[&<>"']/g, (c) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" })[c]);
1063
1289
  var age = (d) => d === null ? "no date" : d === 0 ? "today" : d === 1 ? "1 day" : `${d} days`;
1064
1290
  var SETTLED = {
1065
1291
  source: "settled by checking the source",
@@ -1069,21 +1295,23 @@ var SETTLED = {
1069
1295
  nobody: "no one answered"
1070
1296
  };
1071
1297
  function row(m, bodies, note, showTo = false) {
1072
- const kind = m.kind && m.kind !== "brief" ? `<span class="kind">${esc2(m.kind)}</span> ` : "";
1073
- const to = showTo ? ` <span class="mut">to</span> <span class="chip">${esc2(m.to_session)}</span>` : "";
1074
- return `<details><summary><span class="chip">${esc2(m.from_session)}</span>${to} ${kind}<span class="subj">${esc2(m.subject || "(no subject)")}</span> <span class="note">${esc2(note)}</span></summary><p class="file">${esc2(m.filename)}</p><pre>${esc2(bodies[m.id] ?? "")}</pre></details>`;
1298
+ const kind = m.kind && m.kind !== "brief" ? `<span class="kind">${esc3(m.kind)}</span> ` : "";
1299
+ const to = showTo ? ` <span class="mut">to</span> <span class="chip">${esc3(m.to_session)}</span>` : "";
1300
+ const who = m.author ? ` <span class="mut">${esc3(m.author)}</span>` : "";
1301
+ const signed = m.signature_state === "verified" ? ' <span class="kind">signed</span>' : m.signature_state ? ` <span class="kind">${m.signature_state === "unknown-signer" ? "signature not checked" : "NOT VERIFIED"}</span>` : "";
1302
+ return `<details><summary><span class="chip">${esc3(m.from_session)}</span>${who}${signed}${to} ${kind}<span class="subj">${esc3(m.subject || "(no subject)")}</span> <span class="note">${esc3(note)}</span></summary><p class="file">${esc3(m.filename)}</p><pre>${esc3(bodies[m.id] ?? "")}</pre></details>`;
1075
1303
  }
1076
1304
  function post(p, bodies) {
1077
1305
  const state = p.state === "closed" ? SETTLED[p.settled_by ?? ""] ?? "closed" : p.state === "expired" ? `past its date (${p.expires_on})` : `open until ${p.expires_on ?? "closed"}`;
1078
1306
  const replies = p.replies.map((r) => row(r, bodies, r.evidence === "verified" ? "checked" : r.evidence === "assumed" ? "from memory, not checked" : "did not say how they know")).join("");
1079
- return `<section class="card"><h3>${esc2(p.title || "(no title)")} ${p.tags.map((t) => `<span class="tag">${esc2(t)}</span>`).join(" ")} <span class="state ${p.state}">${esc2(state)}</span></h3>${row(p.post, bodies, p.post.age_days ? `asked ${age(p.post.age_days)} ago` : "asked today")}${replies}${p.closing ? row(p.closing, bodies, "closing note") : ""}${p.replies.length === 0 && p.state !== "closed" ? '<p class="mut">No replies yet.</p>' : ""}</section>`;
1307
+ return `<section class="card"><h3>${esc3(p.title || "(no title)")} ${p.tags.map((t) => `<span class="tag">${esc3(t)}</span>`).join(" ")} <span class="state ${p.state}">${esc3(state)}</span></h3>${row(p.post, bodies, p.post.age_days ? `asked ${age(p.post.age_days)} ago` : "asked today")}${replies}${p.closing ? row(p.closing, bodies, "closing note") : ""}${p.replies.length === 0 && p.state !== "closed" ? '<p class="mut">No replies yet.</p>' : ""}</section>`;
1080
1308
  }
1081
- function renderPage2(r) {
1309
+ function renderPage2(r, bar = "") {
1082
1310
  const waiting = r.waiting.inboxes.map(
1083
- (i) => `<section class="card"><h3>${esc2(i.product)} inbox <span class="note">${i.unread} unread, oldest ${age(i.oldest_age_days)}</span></h3>${i.items.map((m) => row(m, r.bodies, `unread, ${age(m.age_days)}`)).join("")}</section>`
1311
+ (i) => `<section class="card"><h3>${esc3(i.product)} inbox <span class="note">${i.unread} unread, oldest ${age(i.oldest_age_days)}</span></h3>${i.items.map((m) => row(m, r.bodies, `unread, ${age(m.age_days)}`)).join("")}</section>`
1084
1312
  ).join("");
1085
1313
  const threads = r.threads.map(
1086
- (t) => `<section class="card"><h3>${esc2(t.subject || "(no subject)")} <span class="note">${t.count} ${t.count === 1 ? "message" : "messages"}${t.unread ? `, ${t.unread} unread` : ""} \xB7 ${t.participants.map(esc2).join(", ")}</span></h3>${t.messages.map((m) => row(m, r.bodies, m.acked ? age(m.age_days) : `unread, ${age(m.age_days)}`, true)).join("")}</section>`
1314
+ (t) => `<section class="card"><h3>${esc3(t.subject || "(no subject)")} <span class="note">${t.count} ${t.count === 1 ? "message" : "messages"}${t.unread ? `, ${t.unread} unread` : ""} \xB7 ${t.participants.map(esc3).join(", ")}</span></h3>${t.messages.map((m) => row(m, r.bodies, m.acked ? age(m.age_days) : `unread, ${age(m.age_days)}`, true)).join("")}</section>`
1087
1315
  ).join("");
1088
1316
  return `<!doctype html>
1089
1317
  <html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
@@ -1101,14 +1329,14 @@ details{border-top:1px solid var(--line)}summary{cursor:pointer;padding:8px 12px
1101
1329
  .subj{font-weight:500}.file{font-family:ui-monospace,monospace;margin:0;padding:0 12px;word-break:break-all}
1102
1330
  pre{white-space:pre-wrap;word-break:break-word;background:var(--well);margin:8px 12px 12px;padding:10px;border-radius:8px;font-size:12px;max-height:420px;overflow:auto}
1103
1331
  .state{font-size:12px}.state.open{color:var(--ok)}.state.expired{color:var(--bad)}.state.closed{color:var(--mut)}
1104
- </style></head><body><main>
1332
+ ${bar ? TOOLBAR_CSS3 : ""}</style></head><body><main>
1105
1333
  <h1>Crosstalk</h1>
1106
- <p class="note">${esc2(r.mailbox)} \xB7 ${r.total} messages \xB7 read ${esc2(r.generated_at)}. Refresh to read again. This page is read-only.</p>
1107
- <h2>Waiting</h2><p class="lead">${esc2(r.waiting.headline)}</p>${waiting}
1108
- <h2>Board</h2><p class="lead">${esc2(r.board.headline)}</p>${r.board.open.map((p) => post(p, r.bodies)).join("")}
1334
+ <p class="note">${esc3(r.mailbox)} \xB7 ${r.total} messages \xB7 read ${esc3(r.generated_at)}. Refresh to read again. This page is read-only.</p>
1335
+ <h2>Waiting</h2><p class="lead">${esc3(r.waiting.headline)}</p>${waiting}
1336
+ <h2>Board</h2><p class="lead">${esc3(r.board.headline)}</p>${r.board.open.map((p) => post(p, r.bodies)).join("")}
1109
1337
  ${r.board.closed.length ? `<details class="card"><summary>${r.board.closed.length} closed</summary>${r.board.closed.map((p) => post(p, r.bodies)).join("")}</details>` : ""}
1110
1338
  <h2>Threads</h2><p class="note">The ${r.threads.length} with the newest activity. Where a message carries no thread id, threads are worked out from replies that cite a message or reuse its subject, so some related mail shows as separate.</p>${threads}
1111
- </main></body></html>`;
1339
+ </main>${bar}</body></html>`;
1112
1340
  }
1113
1341
  var THREADS_SHOWN = 60;
1114
1342
  function buildReport(root, now = Date.now()) {
@@ -1130,7 +1358,7 @@ function buildReport(root, now = Date.now()) {
1130
1358
  }
1131
1359
 
1132
1360
  // ../groundcrew/dist/index.mjs
1133
- import { existsSync as existsSync4, readFileSync as readFileSync3, readdirSync as readdirSync2, statSync as statSync2 } from "fs";
1361
+ import { existsSync as existsSync4, readFileSync as readFileSync4, readdirSync as readdirSync3, statSync as statSync2 } from "fs";
1134
1362
  import os4 from "os";
1135
1363
  import path4 from "path";
1136
1364
  var DOCS = "https://code.claude.com/docs/en";
@@ -1632,7 +1860,7 @@ var configDir = () => process.env.CLAUDE_CONFIG_DIR || path4.join(home(), ".clau
1632
1860
  var tilde = (file) => file.startsWith(home()) ? `~${file.slice(home().length)}` : file;
1633
1861
  function canRead(project) {
1634
1862
  try {
1635
- readdirSync2(project);
1863
+ readdirSync3(project);
1636
1864
  return true;
1637
1865
  } catch {
1638
1866
  return false;
@@ -1640,7 +1868,7 @@ function canRead(project) {
1640
1868
  }
1641
1869
  function readJson(file) {
1642
1870
  try {
1643
- return JSON.parse(readFileSync3(file, "utf-8"));
1871
+ return JSON.parse(readFileSync4(file, "utf-8"));
1644
1872
  } catch {
1645
1873
  return null;
1646
1874
  }
@@ -1648,7 +1876,7 @@ function readJson(file) {
1648
1876
  function countFiles(dir, test) {
1649
1877
  if (!existsSync4(dir)) return 0;
1650
1878
  let total = 0;
1651
- for (const entry of readdirSync2(dir, { withFileTypes: true })) {
1879
+ for (const entry of readdirSync3(dir, { withFileTypes: true })) {
1652
1880
  if (entry.isDirectory()) total += countFiles(path4.join(dir, entry.name), test);
1653
1881
  else if (test(entry.name)) total += 1;
1654
1882
  }
@@ -1656,7 +1884,7 @@ function countFiles(dir, test) {
1656
1884
  }
1657
1885
  function markdownFiles(dir) {
1658
1886
  if (!existsSync4(dir)) return [];
1659
- return readdirSync2(dir, { withFileTypes: true }).flatMap(
1887
+ return readdirSync3(dir, { withFileTypes: true }).flatMap(
1660
1888
  (entry) => entry.isDirectory() ? markdownFiles(path4.join(dir, entry.name)) : entry.name.endsWith(".md") ? [path4.join(dir, entry.name)] : []
1661
1889
  );
1662
1890
  }
@@ -1664,7 +1892,7 @@ function findSecretFiles(root, relative, depth) {
1664
1892
  const dir = path4.join(root, relative);
1665
1893
  if (depth > SECRET_DEPTH || !existsSync4(dir)) return [];
1666
1894
  const found = [];
1667
- for (const entry of readdirSync2(dir, { withFileTypes: true })) {
1895
+ for (const entry of readdirSync3(dir, { withFileTypes: true })) {
1668
1896
  const here = relative ? `${relative}/${entry.name}` : entry.name;
1669
1897
  if (entry.isDirectory()) {
1670
1898
  if (!SKIP_DIRS.has(entry.name) && !entry.name.startsWith(".")) found.push(...findSecretFiles(root, here, depth + 1));
@@ -1688,11 +1916,11 @@ function hookCommands(hooks) {
1688
1916
  function subagentFiles(dir) {
1689
1917
  if (!existsSync4(dir)) return [];
1690
1918
  const found = [];
1691
- for (const entry of readdirSync2(dir, { withFileTypes: true })) {
1919
+ for (const entry of readdirSync3(dir, { withFileTypes: true })) {
1692
1920
  const file = path4.join(dir, entry.name);
1693
1921
  if (entry.isDirectory()) found.push(...subagentFiles(file));
1694
1922
  else if (entry.name.endsWith(".md")) {
1695
- const frontmatter = /^---\n([\s\S]*?)\n---/.exec(readFileSync3(file, "utf-8"))?.[1] ?? "";
1923
+ const frontmatter = /^---\n([\s\S]*?)\n---/.exec(readFileSync4(file, "utf-8"))?.[1] ?? "";
1696
1924
  found.push({ name: entry.name.replace(/\.md$/, ""), limitsTools: /^(tools|disallowedTools)\s*:/m.test(frontmatter) });
1697
1925
  }
1698
1926
  }
@@ -1706,7 +1934,7 @@ function gather(project) {
1706
1934
  const restricted = [];
1707
1935
  const memoryFile = (file, instructions = true) => {
1708
1936
  if (!existsSync4(file) || !statSync2(file).isFile()) return null;
1709
- const text = readFileSync3(file, "utf-8");
1937
+ const text = readFileSync4(file, "utf-8");
1710
1938
  filesRead.push(label(file));
1711
1939
  if (instructions) restricted.push(...findRestrictedCommands(text, label(file)));
1712
1940
  return { label: label(file), lines: text.split("\n").length - (text.endsWith("\n") ? 1 : 0), bytes: Buffer.byteLength(text) };
@@ -1719,7 +1947,7 @@ function gather(project) {
1719
1947
  path4.join(configDir(), "CLAUDE.md")
1720
1948
  ].map((file) => memoryFile(file)).filter((file) => file !== null);
1721
1949
  for (const dir of [path4.join(project, ".claude", "rules"), path4.join(configDir(), "rules")]) {
1722
- for (const file of markdownFiles(dir)) restricted.push(...findRestrictedCommands(readFileSync3(file, "utf-8"), label(file)));
1950
+ for (const file of markdownFiles(dir)) restricted.push(...findRestrictedCommands(readFileSync4(file, "utf-8"), label(file)));
1723
1951
  }
1724
1952
  const settingsFile = (scope, file) => {
1725
1953
  const json = readJson(file);
@@ -1778,7 +2006,24 @@ function gather(project) {
1778
2006
  }
1779
2007
  };
1780
2008
  }
1781
- var esc3 = (text) => text.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
2009
+ var TOOLBAR_CSS4 = `
2010
+ body{padding-bottom:64px}
2011
+ .jqbar{position:fixed;left:0;right:0;bottom:0;z-index:5;display:flex;flex-wrap:wrap;align-items:center;gap:4px 14px;padding:8px 16px;font:13px/1.4 system-ui,sans-serif;background:var(--card,Canvas);color:var(--fg,CanvasText);border-top:1px solid var(--line,GrayText)}
2012
+ .jqbar a{color:var(--link,LinkText)}
2013
+ .jqbar .here{font-weight:700}
2014
+ .jqbar details[open]{order:-1;flex-basis:100%}
2015
+ .jqbar summary{cursor:pointer;color:var(--mut,GrayText);list-style:none;display:inline-block;padding:2px 0}
2016
+ .jqbar summary::-webkit-details-marker{display:none}
2017
+ .jqbar summary::after{content:" \u25B8"}
2018
+ .jqbar details[open] summary::after{content:" \u25BE"}
2019
+ .jqbar summary small,.jqbar a small{font-size:11px;font-weight:400}
2020
+ .jqbar details>div{margin:4px 0 6px;padding:8px 10px;max-width:640px;border:1px solid var(--line,GrayText);border-radius:8px;background:var(--well,Canvas)}
2021
+ .jqbar details>div p{margin:0 0 4px}
2022
+ .jqbar code{font:12px ui-monospace,Menlo,monospace;word-break:break-all}
2023
+ .jqbar a:focus-visible,.jqbar summary:focus-visible{outline:2px solid var(--link,LinkText);outline-offset:2px}
2024
+ @media print{.jqbar{display:none}body{padding-bottom:0}}
2025
+ `;
2026
+ var esc22 = (text) => text.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
1782
2027
  var STATUS = {
1783
2028
  fail: { icon: "\u2715", word: "Fix" },
1784
2029
  warn: { icon: "!", word: "Look" },
@@ -1827,15 +2072,15 @@ function done(){b.textContent='Copied';setTimeout(function(){b.textContent='Copy
1827
2072
  function old(){var a=document.createElement('textarea');a.value=t;document.body.appendChild(a);a.select();document.execCommand('copy');a.remove();done()}
1828
2073
  if(navigator.clipboard&&window.isSecureContext){navigator.clipboard.writeText(t).then(done,old)}else{old()}});`;
1829
2074
  var dot = (status) => `<span class="dot s-${status}" aria-hidden="true">${STATUS[status].icon}</span>`;
1830
- var sourceLink = (check) => `<a href="${esc3(check.source)}" target="_blank" rel="noopener noreferrer">${esc3(check.source.replace(/^https:\/\/code\.claude\.com\/docs\/en\//, "docs: ").replace(/\.md$/, ""))}</a>`;
2075
+ var sourceLink = (check) => `<a href="${esc22(check.source)}" target="_blank" rel="noopener noreferrer">${esc22(check.source.replace(/^https:\/\/code\.claude\.com\/docs\/en\//, "docs: ").replace(/\.md$/, ""))}</a>`;
1831
2076
  function fixCard(check) {
1832
2077
  const status = STATUS[check.status];
1833
2078
  const id = anchor(check);
1834
2079
  const isCommand = check.prompt.startsWith("/");
1835
- const prompt = check.prompt ? `<div class="prompt"><header>${isCommand ? "Type this command in Claude Code" : "Paste this into Claude Code"}<button type="button" data-copy="${id}-prompt">Copy</button></header><pre id="${id}-prompt">${esc3(check.prompt)}</pre></div>` : "";
1836
- return `<section class="check s-${check.status}" id="${id}"><h3>${dot(check.status)}${esc3(check.title)}<span class="word">${status.word}</span></h3><p>${esc3(check.detail)}</p>${check.fix ? `<p class="fix"><b>What to change:</b> ${esc3(check.fix)}</p>` : ""}${prompt}<p class="src mut">Rests on ${sourceLink(check)}</p></section>`;
2080
+ const prompt = check.prompt ? `<div class="prompt"><header>${isCommand ? "Type this command in Claude Code" : "Paste this into Claude Code"}<button type="button" data-copy="${id}-prompt">Copy</button></header><pre id="${id}-prompt">${esc22(check.prompt)}</pre></div>` : "";
2081
+ return `<section class="check s-${check.status}" id="${id}"><h3>${dot(check.status)}${esc22(check.title)}<span class="word">${status.word}</span></h3><p>${esc22(check.detail)}</p>${check.fix ? `<p class="fix"><b>What to change:</b> ${esc22(check.fix)}</p>` : ""}${prompt}<p class="src mut">Rests on ${sourceLink(check)}</p></section>`;
1837
2082
  }
1838
- var row2 = (check) => `<li>${dot(check.status)}<b>${esc3(check.title)}<span class="mut"> \xB7 ${STATUS[check.status].word}</span></b><span class="d">${esc3(check.detail)}</span><span class="src mut">${sourceLink(check)}</span></li>`;
2083
+ var row2 = (check) => `<li>${dot(check.status)}<b>${esc22(check.title)}<span class="mut"> \xB7 ${STATUS[check.status].word}</span></b><span class="d">${esc22(check.detail)}</span><span class="src mut">${sourceLink(check)}</span></li>`;
1839
2084
  var LAYER_DOT = { fix: "fail", look: "warn", good: "pass", facts: "info", none: "info" };
1840
2085
  function layerCount(row22) {
1841
2086
  const judged = row22.pass + row22.warn + row22.fail;
@@ -1845,23 +2090,23 @@ function layerCount(row22) {
1845
2090
  function layerPanel(checks) {
1846
2091
  const rows = layerSummary(checks).map((row22) => {
1847
2092
  const about = LAYERS.find((l) => l.key === row22.layer);
1848
- return `<li>${dot(LAYER_DOT[row22.state])}<b>${about.title}<span class="mut"> \xB7 ${layerCount(row22)}</span></b><span class="d">${esc3(about.what)} <span class="mut">${esc3(about.unchecked)}</span></span></li>`;
2093
+ return `<li>${dot(LAYER_DOT[row22.state])}<b>${about.title}<span class="mut"> \xB7 ${layerCount(row22)}</span></b><span class="d">${esc22(about.what)} <span class="mut">${esc22(about.unchecked)}</span></span></li>`;
1849
2094
  });
1850
2095
  return `<h2>Your harness, layer by layer</h2><p class="mut">An agent is a model and what surrounds it. These are six parts of what surrounds it, with what the checks below found in each.</p><ul class="rows">${rows.join("")}</ul>`;
1851
2096
  }
1852
- function renderPage3(report2) {
2097
+ function renderPage3(report2, toolsBar = "") {
1853
2098
  const { summary } = report2;
1854
2099
  const judged = summary.pass + summary.warn + summary.fail;
1855
2100
  const bar = ["fail", "warn", "pass"].filter((s) => summary[s] > 0).map((s) => `<i class="b-${s}" style="flex:${summary[s]}"></i>`).join("");
1856
2101
  const sorted = [...report2.checks].sort((a, b) => ORDER.indexOf(a.status) - ORDER.indexOf(b.status));
1857
2102
  const fixes = sorted.filter(needsFix);
1858
- const todo = fixes.length ? `<h2>Do these first</h2><ul class="todo">${fixes.map((c) => `<li>${dot(c.status)}<a href="#${anchor(c)}">${esc3(c.title)}</a><span class="mut">${GROUP_TITLE[c.group]}</span></li>`).join("")}</ul>` : '<h2>Nothing to fix</h2><p class="mut">Every check that can fail passes.</p>';
2103
+ const todo = fixes.length ? `<h2>Do these first</h2><ul class="todo">${fixes.map((c) => `<li>${dot(c.status)}<a href="#${anchor(c)}">${esc22(c.title)}</a><span class="mut">${GROUP_TITLE[c.group]}</span></li>`).join("")}</ul>` : '<h2>Nothing to fix</h2><p class="mut">Every check that can fail passes.</p>';
1859
2104
  const groups = GROUPS.map((group) => {
1860
2105
  const mine = sorted.filter((c) => c.group === group.key);
1861
2106
  const rest = mine.filter((c) => !needsFix(c));
1862
2107
  return `<h2>${GROUP_TITLE[group.key]}</h2><p class="mut">${group.intro}</p>${mine.filter(needsFix).map(fixCard).join("")}` + (rest.length ? `<ul class="rows">${rest.map(row2).join("")}</ul>` : "");
1863
2108
  }).join("");
1864
- return `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>JQ Groundcrew: ${esc3(report2.project)}</title><style>${CSS}</style></head><body><main><h1>JQ Groundcrew</h1><p class="mut">The setup check for Claude Code. How it is set up for <code>${esc3(report2.project)}</code>. Read ${esc3(report2.generatedAt)}. Refresh to read again.</p><div class="score"><div class="tile"><b>${summary.fail}</b><span>to fix</span></div><div class="tile"><b>${summary.warn}</b><span>to look at</span></div><div class="tile"><b>${summary.pass}</b><span>good</span></div><div class="tile"><b>${summary.score}%</b><span>of ${judged} checks pass</span></div></div><div class="bar" role="img" aria-label="${summary.fail} to fix, ${summary.warn} to look at, ${summary.pass} good">${bar}</div>` + todo + layerPanel(report2.checks) + groups + `<footer><p>This page was made on your machine from the files below, and it loads nothing, so nothing left the machine. Its one script copies a prompt to your clipboard when you press Copy. It read settings and your instruction files, and counted the rest. It did not read the contents of any secret file, and it read no session transcript.</p><p>A suggested prompt asks Claude Code to show its plan or its diff first. Read that before you approve it.</p><ul>${report2.filesRead.map((file) => `<li><code>${esc3(file)}</code></li>`).join("")}</ul><p>Each check names the page of Anthropic\u2019s Claude Code documentation it rests on. The documentation was checked on 2026-11-14 and can change.</p></footer></main><script>${COPY_SCRIPT}</script></body></html>
2109
+ return `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>JQ Groundcrew: ${esc22(report2.project)}</title><style>${CSS}${toolsBar ? TOOLBAR_CSS4 : ""}</style></head><body><main><h1>JQ Groundcrew</h1><p class="mut">The setup check for Claude Code. How it is set up for <code>${esc22(report2.project)}</code>. Read ${esc22(report2.generatedAt)}. Refresh to read again.</p><div class="score"><div class="tile"><b>${summary.fail}</b><span>to fix</span></div><div class="tile"><b>${summary.warn}</b><span>to look at</span></div><div class="tile"><b>${summary.pass}</b><span>good</span></div><div class="tile"><b>${summary.score}%</b><span>of ${judged} checks pass</span></div></div><div class="bar" role="img" aria-label="${summary.fail} to fix, ${summary.warn} to look at, ${summary.pass} good">${bar}</div>` + todo + layerPanel(report2.checks) + groups + `<footer><p>This page was made on your machine from the files below, and it loads nothing, so nothing left the machine. Its one script copies a prompt to your clipboard when you press Copy. It read settings and your instruction files, and counted the rest. It did not read the contents of any secret file, and it read no session transcript.</p><p>A suggested prompt asks Claude Code to show its plan or its diff first. Read that before you approve it.</p><ul>${report2.filesRead.map((file) => `<li><code>${esc22(file)}</code></li>`).join("")}</ul><p>Each check names the page of Anthropic\u2019s Claude Code documentation it rests on. The documentation was checked on 2026-11-14 and can change.</p></footer></main>${toolsBar}<script>${COPY_SCRIPT}</script></body></html>
1865
2110
  `;
1866
2111
  }
1867
2112
  function report(project) {
@@ -1871,12 +2116,12 @@ function report(project) {
1871
2116
  }
1872
2117
 
1873
2118
  // src/collect.ts
1874
- import { existsSync as existsSync6, readdirSync as readdirSync3, readFileSync as readFileSync5, statSync as statSync3 } from "fs";
2119
+ import { existsSync as existsSync6, readdirSync as readdirSync4, readFileSync as readFileSync6, statSync as statSync3 } from "fs";
1875
2120
  import path6 from "path";
1876
2121
 
1877
2122
  // src/deck.ts
1878
- import { createHash } from "crypto";
1879
- import { existsSync as existsSync5, readFileSync as readFileSync4 } from "fs";
2123
+ import { createHash as createHash2 } from "crypto";
2124
+ import { existsSync as existsSync5, readFileSync as readFileSync5 } from "fs";
1880
2125
  import os5 from "os";
1881
2126
  import path5 from "path";
1882
2127
  var expandHome = (p) => p === "~" || p.startsWith("~/") ? path5.join(os5.homedir(), p.slice(1)) : p;
@@ -1887,7 +2132,7 @@ function loadConfig(file) {
1887
2132
  if (!existsSync5(file)) return {};
1888
2133
  let raw;
1889
2134
  try {
1890
- raw = JSON.parse(readFileSync4(file, "utf8"));
2135
+ raw = JSON.parse(readFileSync5(file, "utf8"));
1891
2136
  } catch (e) {
1892
2137
  throw new Error(`cannot read ${file}: ${e?.message || e}`);
1893
2138
  }
@@ -1915,7 +2160,7 @@ function findMailbox(opts) {
1915
2160
  dir = up;
1916
2161
  }
1917
2162
  }
1918
- var repoId = (tree) => createHash("sha1").update(tree).digest("hex").slice(0, 10);
2163
+ var repoId = (tree) => createHash2("sha1").update(tree).digest("hex").slice(0, 10);
1919
2164
  function matchInbox(folder, inboxes) {
1920
2165
  const f = folder.toLowerCase();
1921
2166
  const exact = inboxes.find((i) => i.toLowerCase() === f);
@@ -2058,13 +2303,13 @@ function remoteOf(tree) {
2058
2303
  try {
2059
2304
  let gitDir = path6.join(tree, ".git");
2060
2305
  if (statSync3(gitDir).isFile()) {
2061
- const m = /^gitdir:\s*(.+)$/m.exec(readFileSync5(gitDir, "utf8"));
2306
+ const m = /^gitdir:\s*(.+)$/m.exec(readFileSync6(gitDir, "utf8"));
2062
2307
  if (!m) return null;
2063
2308
  gitDir = path6.resolve(tree, m[1].trim());
2064
2309
  const common = path6.join(gitDir, "commondir");
2065
- if (existsSync6(common)) gitDir = path6.resolve(gitDir, readFileSync5(common, "utf8").trim());
2310
+ if (existsSync6(common)) gitDir = path6.resolve(gitDir, readFileSync6(common, "utf8").trim());
2066
2311
  }
2067
- return originIn(readFileSync5(path6.join(gitDir, "config"), "utf8"));
2312
+ return originIn(readFileSync6(path6.join(gitDir, "config"), "utf8"));
2068
2313
  } catch {
2069
2314
  return null;
2070
2315
  }
@@ -2084,7 +2329,7 @@ async function collectOverview(opts) {
2084
2329
  if (opts.mailbox) {
2085
2330
  try {
2086
2331
  waiting = waitingBoard(readMailbox(opts.mailbox), opts.now ?? Date.now());
2087
- inboxes = readdirSync3(path6.join(opts.mailbox, "inbox"), { withFileTypes: true }).filter((e) => e.isDirectory() && e.name !== BOARD).map((e) => e.name);
2332
+ inboxes = readdirSync4(path6.join(opts.mailbox, "inbox"), { withFileTypes: true }).filter((e) => e.isDirectory() && e.name !== BOARD).map((e) => e.name);
2088
2333
  } catch (e) {
2089
2334
  mailNote = String(e?.message || e);
2090
2335
  }
@@ -2146,7 +2391,7 @@ function mailTab(o) {
2146
2391
  }
2147
2392
  return '<iframe title="Mailbox" src="/raw/mail"></iframe>';
2148
2393
  }
2149
- function renderShell(o, tab, repo, version) {
2394
+ function renderShell(o, tab, repo, version, bar = "") {
2150
2395
  const body = tab === "overview" ? overview(o) : tab === "sessions" ? '<iframe title="Sessions" src="/raw/sessions"></iframe>' : tab === "setup" ? setupTab(o, repo) : mailTab(o);
2151
2396
  const needs = o.repos.reduce((n, r) => n + r.needs_you, 0);
2152
2397
  const failing = o.repos.filter((r) => r.setup && r.setup.fail > 0).length;
@@ -2182,7 +2427,7 @@ tbody th{font-weight:600}.path{display:block;font-weight:400;font-size:12px;colo
2182
2427
  .chip.on{border-color:var(--fg);font-weight:600}
2183
2428
  code,pre{font:12px ui-monospace,monospace;background:var(--well);border-radius:4px;padding:1px 4px}pre{padding:10px;overflow-x:auto}
2184
2429
  @media (max-width:640px){thead{display:none}tr{display:block;border-top:1px solid var(--line);padding:8px 0}th,td{display:block;border:0;padding:3px 12px}td::before{content:attr(data-l) ": ";color:var(--mut);font-size:12px}}
2185
- </style></head><body>
2430
+ ${bar ? TOOLBAR_CSS : ""}</style></head><body>
2186
2431
  <header>
2187
2432
  <h1>JQ Deck</h1>
2188
2433
  <p class="head">${esc4(o.headline)}</p>
@@ -2191,7 +2436,7 @@ code,pre{font:12px ui-monospace,monospace;background:var(--well);border-radius:4
2191
2436
  </header>
2192
2437
  <main>${body}</main>
2193
2438
  <footer class="mut" style="max-width:1000px;width:100%;margin:0 auto;padding:0 16px 16px">JQ Deck ${esc4(version)} \xB7 this machine only</footer>
2194
- </body></html>`;
2439
+ ${bar}</body></html>`;
2195
2440
  }
2196
2441
 
2197
2442
  // src/cli.ts
@@ -2255,6 +2500,7 @@ function reportList(a, fromConfig) {
2255
2500
  function buildContext(a, env, cwd, version) {
2256
2501
  const config = loadConfig(expandHome(a.config));
2257
2502
  return {
2503
+ runningDir: runningDir(env),
2258
2504
  configFile: expandHome(a.config),
2259
2505
  port: a.port,
2260
2506
  version,
@@ -2283,7 +2529,8 @@ async function handle(url, host, ctx, overview2 = collectOverview) {
2283
2529
  if (u.pathname === "/") {
2284
2530
  const asked = u.searchParams.get("tab");
2285
2531
  const tab = TABS.includes(asked ?? "") ? asked : "overview";
2286
- return html(renderShell(await overview2(ctx.deck), tab, u.searchParams.get("repo"), ctx.version));
2532
+ const bar = toolbar({ here: "deck", running: readRunning(ctx.runningDir), team: readTeamUrl(ctx.configFile) });
2533
+ return html(renderShell(await overview2(ctx.deck), tab, u.searchParams.get("repo"), ctx.version, bar));
2287
2534
  }
2288
2535
  if (u.pathname === "/raw/sessions") {
2289
2536
  return html(renderPage(await snapshot({ questionTrees: ctx.deck.questionTrees, maxAgeDays: ctx.deck.maxAgeDays, projectsDir: ctx.deck.projectsDir, sockDir: ctx.deck.sockDir, probe: ctx.probe, sample: ctx.sample, turnCheck: readTurnCheckConfig(ctx.configFile) })));
@@ -2349,14 +2596,15 @@ async function run2(argv, version) {
2349
2596
  });
2350
2597
  res.end(reply.body);
2351
2598
  }).listen(a.port, "127.0.0.1", () => {
2599
+ announce("deck", a.port, ctx.runningDir);
2352
2600
  console.log(`jq-deck: http://127.0.0.1:${a.port} (Ctrl-C to stop)`);
2353
2601
  console.log(ctx.deck.mailbox ? `jq-deck: mailbox ${ctx.deck.mailbox}` : "jq-deck: no mailbox found (pass --mailbox DIR to show mail)");
2354
2602
  });
2355
2603
  }
2356
2604
 
2357
2605
  // src/main.ts
2358
- var VERSION = true ? "0.3.2" : "dev";
2359
- var HELP = `JQ Deck ${VERSION}: one page for your Claude Code sessions, their setup and their mail.
2606
+ var VERSION2 = true ? "0.3.3" : "dev";
2607
+ var HELP = `JQ Deck ${VERSION2}: one page for your Claude Code sessions, their setup and their mail.
2360
2608
 
2361
2609
  jq-deck open the page at http://127.0.0.1:${DEFAULT_PORT}
2362
2610
  jq-deck --json print the overview
@@ -2385,9 +2633,9 @@ The page is served to this machine only. Nothing leaves it unless you pass --exe
2385
2633
  Unofficial. Not affiliated with or endorsed by Anthropic.`;
2386
2634
  var args = process.argv.slice(2);
2387
2635
  if (args.includes("--help") || args.includes("-h")) console.log(HELP);
2388
- else if (args.includes("--version") || args.includes("-v")) console.log(VERSION);
2636
+ else if (args.includes("--version") || args.includes("-v")) console.log(VERSION2);
2389
2637
  else
2390
- run2(args, VERSION).catch((error) => {
2638
+ run2(args, VERSION2).catch((error) => {
2391
2639
  console.error(error.message || error);
2392
2640
  process.exit(1);
2393
2641
  });