agent-dag 1.35.39 → 1.35.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.
package/README.md CHANGED
@@ -120,8 +120,13 @@ ccdeck [options]
120
120
  no Accounts panel (Codex only)
121
121
  --uninstall Remove ccdeck's hooks from settings files
122
122
  -h, --help Show this help
123
+ -v, --version Print the version and exit
123
124
  ```
124
125
 
126
+ Anything else on the command line is reported as an unknown option and then
127
+ ignored — the deck still starts, so a typo costs you a warning rather than a
128
+ dashboard.
129
+
125
130
  ccdeck looks for each CLI before it does anything on that CLI's behalf. Claude
126
131
  Code counts as present when its binary is on `PATH` (or in one of the places its
127
132
  installers put it), or when its config dir carries traces of having been used;
package/bin/deck.js CHANGED
@@ -8,6 +8,7 @@ import { resolve, dirname, join } from "node:path";
8
8
  import { fileURLToPath, pathToFileURL } from "node:url";
9
9
  import { existsSync, readFileSync } from "node:fs";
10
10
  import { dieOfSignal } from "../src/server/supervisor.mjs";
11
+ import { parseArgs } from "../src/server/args.mjs";
11
12
  import {
12
13
  CURSOR_HIDE, CURSOR_SHOW, colorProfile, fit, glyphs, labelColumn, link, motionOK, oneLine,
13
14
  palette, pulseText, spinnerFrames, statusLine, supportsHyperlinks, termColumns, unicodeOK,
@@ -45,6 +46,22 @@ if (flags.help) {
45
46
  process.exit(0);
46
47
  }
47
48
 
49
+ // The version, on stdout, and then nothing — no hooks, no port, no browser.
50
+ //
51
+ // This is the first thing anyone types at a CLI they do not know and the second
52
+ // thing anyone types when filing a bug, and until now it was the one question
53
+ // the deck answered by starting a server and never exiting. The banner has
54
+ // always carried the number, but only underneath a running deck, which is not
55
+ // an answer: it cannot be piped, and the process it comes with has to be killed.
56
+ //
57
+ // Bare, unprefixed, one line: `ccdeck --version` is read by scripts as often as
58
+ // by people, and `node --version` style ornamentation is what those scripts
59
+ // then have to strip. PKG_VERSION is the same read the banner uses.
60
+ if (flags.version) {
61
+ console.log(PKG_VERSION);
62
+ process.exit(0);
63
+ }
64
+
48
65
  if (flags.uninstall) {
49
66
  const { uninstallHooks, hasCodexInstalled } = await import(pathToFileURL(join(PKG_ROOT, "src/server/installer.mjs")).href);
50
67
  const claude = await uninstallHooks({ provider: "claude" });
@@ -195,7 +212,7 @@ process.on("SIGHUP", () => { showCursor(); dieOfSignal("SIGHUP"); });
195
212
  // longer, silently broke the alignment of every other one.
196
213
  const LABELS = [
197
214
  "workspace", "Claude hooks", "Codex sessions", "claude-swap", "accounts",
198
- "ccusage", "update", "name", "server ready", "log",
215
+ "ccusage", "update", "name", "server ready", "log", "unknown option",
199
216
  ];
200
217
  const LABEL_W = labelColumn(LABELS);
201
218
 
@@ -633,6 +650,11 @@ try { process.send?.({ type: "listening", port: realPort }); } catch { /* not su
633
650
 
634
651
  if (RESPAWN) {
635
652
  write(` ${P.ok}${G.restart}${P.reset} ${P.muted}restarted ${G.arrow} ${P.reset}v${PKG_VERSION}${P.muted} ${G.bullet} ${link(url, url, LINKS)}${P.reset}\n`);
653
+ // A respawn skips the whole startup report, but not this: the argv is the
654
+ // same argv, the typo in it is still there, and a deck that mentioned it once
655
+ // and then went quiet for every restart afterwards is back to hiding it from
656
+ // anyone who was not watching the first boot.
657
+ reportUnknownFlags(flags.unknown);
636
658
  } else {
637
659
  // The URL is the one detail an ellipsis would destroy — half an address is
638
660
  // not a shorter address — so it keeps its own line when the terminal is too
@@ -642,6 +664,8 @@ if (RESPAWN) {
642
664
  detail: link(url, url, LINKS), detailTone: `${P.accent}${P.bold}`, keep: true,
643
665
  }));
644
666
  if (persist) write(row({ label: "log", detail: fileLink(persist) }));
667
+ // Last of the rows, on purpose — see reportUnknownFlags.
668
+ reportUnknownFlags(flags.unknown);
645
669
  // Only when one is actually being opened. Under --no-open — which is how an
646
670
  // npx update relaunches, with a tab already waiting — this was announcing
647
671
  // something that never happened.
@@ -806,25 +830,34 @@ function reportReregistered({ file }) {
806
830
  write(`\n ${P.ok}${G.ok}${P.reset} ${P.muted}registered again ${G.arrow} ${fileLink(file)}${P.reset}\n`);
807
831
  }
808
832
 
809
- function parseArgs(args) {
810
- const out = {};
811
- for (let i = 0; i < args.length; i++) {
812
- const a = args[i];
813
- if (a === "-h" || a === "--help") out.help = true;
814
- else if (a === "-p" || a === "--port") out.port = args[++i];
815
- else if (a === "--no-open") out.noOpen = true;
816
- else if (a === "--uninstall") out.uninstall = true;
817
- else if (a === "--workspace") out.workspace = args[++i];
818
- else if (a === "--scope") out.scope = true;
819
- else if (a === "--all") out.all = true; // legacy no-op (now default)
820
- else if (a === "--no-persist") out.noPersist = true;
821
- else if (a === "--history") out.history = args[++i];
822
- else if (a === "--codex") out.codex = true;
823
- else if (a === "--no-codex") out.noCodex = true;
824
- else if (a === "--claude") out.claude = true;
825
- else if (a === "--no-claude") out.noClaude = true;
833
+ /**
834
+ * Every token the parser did not recognise, named, one row each.
835
+ *
836
+ * Said rather than acted on: the deck goes on booting and still exits 0. It is
837
+ * not a one-shot command that can afford the usual contract. `bin/agent-dag.js`
838
+ * hands its own argv to every worker it spawns — including the npx relaunch,
839
+ * which starts a NEWER version of the package on the argv the user typed
840
+ * against an older one and the README recommends running it from a wrapper.
841
+ * Refusing to boot over one token would turn a typo into a dark dashboard, and
842
+ * an argument the newer build no longer knows into a failed upgrade that costs
843
+ * the port and the session. The file already holds that position once, in the
844
+ * `--all` branch: a flag the deck stopped needing is still accepted rather than
845
+ * made fatal.
846
+ *
847
+ * So it goes where the deck puts everything else it decided on your behalf
848
+ * the startup report — and it goes at the END of it. reportStartup writes its
849
+ * rows in a fixed order and three more land underneath them (the server, the
850
+ * log, the browser), so a warning printed among those rows is a warning the
851
+ * rows scroll over. Here it is the last line before the pulse indicator takes
852
+ * the bottom of the screen and stops repainting anything above it.
853
+ */
854
+ function reportUnknownFlags(unknown) {
855
+ for (const token of unknown) {
856
+ write(row({
857
+ mark: G.warn, tone: P.warn, label: "unknown option",
858
+ detail: `${token} ${G.dash} see \`${PRODUCT} --help\``,
859
+ }));
826
860
  }
827
- return out;
828
861
  }
829
862
 
830
863
  function printHelp() {
@@ -850,5 +883,9 @@ Options:
850
883
  Hook entries only: the forwarder script, ~/.claude/agent-dag/,
851
884
  the events log, ~/.agents-deck/ and claude-swap all stay
852
885
  -h, --help Show this help
886
+ -v, --version Print the version and exit
887
+
888
+ Anything else on the command line is reported as an unknown option and then
889
+ ignored: the deck still starts.
853
890
  `);
854
891
  }