glimmervoid 0.48.2-next.318 → 0.48.2-next.321

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.
Files changed (96) hide show
  1. package/dist/bin/glimmervoid.js +13 -8
  2. package/dist/chunks/{agent-api-cli-DD9EE5Ab.js → agent-api-cli-DGJ38W5Q.js} +68 -75
  3. package/dist/chunks/{agent-api-cli-Wsuo3vry.js → agent-api-cli-DIHuV81M.js} +1 -1
  4. package/dist/chunks/{agent-api-core-CRjUWPzJ.js → agent-api-core-CVleheDx.js} +262 -14
  5. package/dist/chunks/{config-store-DDyjZ3_N.js → config-store-C-aX7XDc.js} +10 -6
  6. package/dist/chunks/config-store-C6SoQ3iD.js +1 -0
  7. package/dist/chunks/{git-version-jHhRrdeV.js → git-version-CkHaTbB0.js} +65 -48
  8. package/dist/chunks/{main-Bd-H2U7t.js → main-jbvejCOW.js} +18 -42
  9. package/dist/chunks/{pair-cli-tUavzZpc.js → pair-cli-KGg8V1HG.js} +2 -2
  10. package/dist/chunks/{remote-config-BHAebIxM.js → remote-config-BmRf7ZgF.js} +1 -1
  11. package/dist/chunks/{settings-cli-tATjhUS6.js → settings-cli-Dzzh4V3t.js} +3 -3
  12. package/dist/chunks/{settings-readout-core-CDAv-bJS.js → settings-readout-core-d9Tj5jwO.js} +1 -1
  13. package/dist/chunks/{ssh-sign-cli-CCE8l4Ed.js → ssh-sign-cli-upCmSfR0.js} +1 -1
  14. package/dist/client/assets/{benchmark-panel-DPGrtLN_.js → benchmark-panel-DGErp-9P.js} +1 -1
  15. package/dist/client/assets/benchmark-panel-DGErp-9P.js.br +0 -0
  16. package/dist/client/assets/{boards-view-BhN8980T.js → boards-view-zGGSvSeR.js} +1 -1
  17. package/dist/client/assets/boards-view-zGGSvSeR.js.br +0 -0
  18. package/dist/client/assets/{community-panel-Cpt4Y0nl.js → community-panel-7LNSI7f9.js} +1 -1
  19. package/dist/client/assets/community-panel-7LNSI7f9.js.br +0 -0
  20. package/dist/client/assets/{dialogs-wx9D2gIo.js → dialogs-BAiB8PAI.js} +1 -1
  21. package/dist/client/assets/dialogs-BAiB8PAI.js.br +0 -0
  22. package/dist/client/assets/{doc-editor-ui-B5ZaOx3o.js → doc-editor-ui-C8jXl10R.js} +1 -1
  23. package/dist/client/assets/doc-editor-ui-C8jXl10R.js.br +0 -0
  24. package/dist/client/assets/{feature-hint-CSJLTiDY.js → feature-hint-e3hklcnu.js} +1 -1
  25. package/dist/client/assets/feature-hint-e3hklcnu.js.br +0 -0
  26. package/dist/client/assets/{first-run-checklist-D5145KuI.js → first-run-checklist-DvbK1fFl.js} +1 -1
  27. package/dist/client/assets/first-run-checklist-DvbK1fFl.js.br +0 -0
  28. package/dist/client/assets/{hooks-panel-CaMKiYcn.js → hooks-panel-BWOHyo2k.js} +1 -1
  29. package/dist/client/assets/hooks-panel-BWOHyo2k.js.br +0 -0
  30. package/dist/client/assets/{index-bt4ITP8T.js → index-B1lOI6hU.js} +5 -5
  31. package/dist/client/assets/index-B1lOI6hU.js.br +0 -0
  32. package/dist/client/assets/{issues-panel-BwXKL3R3.js → issues-panel-DtNwqaue.js} +1 -1
  33. package/dist/client/assets/issues-panel-DtNwqaue.js.br +0 -0
  34. package/dist/client/assets/{my-prs-panel-DplMRHbZ.js → my-prs-panel-n4G0PNue.js} +1 -1
  35. package/dist/client/assets/my-prs-panel-n4G0PNue.js.br +0 -0
  36. package/dist/client/assets/{nyan-cat-BhxOl8i1.js → nyan-cat-CP1vsKe1.js} +1 -1
  37. package/dist/client/assets/nyan-cat-CP1vsKe1.js.br +0 -0
  38. package/dist/client/assets/{phone-shell-C_cDOU1f.js → phone-shell-BIkINQQQ.js} +1 -1
  39. package/dist/client/assets/phone-shell-BIkINQQQ.js.br +0 -0
  40. package/dist/client/assets/{plan-face-D9SLMgDM.js → plan-face-DnLDMJy6.js} +1 -1
  41. package/dist/client/assets/plan-face-DnLDMJy6.js.br +0 -0
  42. package/dist/client/assets/{plan-render-R72Sn3GC.js → plan-render-BkviPv-c.js} +1 -1
  43. package/dist/client/assets/plan-render-BkviPv-c.js.br +0 -0
  44. package/dist/client/assets/{pr-queue-columns-DV4JVAwS.js → pr-queue-columns-DOCENcbT.js} +1 -1
  45. package/dist/client/assets/pr-queue-columns-DOCENcbT.js.br +0 -0
  46. package/dist/client/assets/{radar-panel-DwJfa_h9.js → radar-panel-Btzp3-7Y.js} +1 -1
  47. package/dist/client/assets/radar-panel-Btzp3-7Y.js.br +0 -0
  48. package/dist/client/assets/{repo-roots-adder-cm4iEiso.js → repo-roots-adder-2vUcylJi.js} +1 -1
  49. package/dist/client/assets/repo-roots-adder-2vUcylJi.js.br +0 -0
  50. package/dist/client/assets/{resume-dialog-TR4cA2vx.js → resume-dialog-DWEQuftz.js} +1 -1
  51. package/dist/client/assets/resume-dialog-DWEQuftz.js.br +0 -0
  52. package/dist/client/assets/{review-queue-panel-CoYgcwOR.js → review-queue-panel-JpOe78JU.js} +1 -1
  53. package/dist/client/assets/review-queue-panel-JpOe78JU.js.br +0 -0
  54. package/dist/client/assets/{settings-panel-BSdxXFqT.js → settings-panel-BxnlEQP9.js} +2 -2
  55. package/dist/client/assets/settings-panel-BxnlEQP9.js.br +0 -0
  56. package/dist/client/assets/{shown-lightbox-Gaw9Tqjj.js → shown-lightbox-C_Lyt9bP.js} +1 -1
  57. package/dist/client/assets/shown-lightbox-C_Lyt9bP.js.br +0 -0
  58. package/dist/client/assets/{team-review-panel-DLEnvOBy.js → team-review-panel-COM1WLXF.js} +1 -1
  59. package/dist/client/assets/team-review-panel-COM1WLXF.js.br +0 -0
  60. package/dist/client/assets/{trace-panel-BSAUYymF.js → trace-panel-CQ3QE8RY.js} +1 -1
  61. package/dist/client/assets/trace-panel-CQ3QE8RY.js.br +0 -0
  62. package/dist/client/assets/{usage-panel-Coe7wkGQ.js → usage-panel-OJJDj-iW.js} +1 -1
  63. package/dist/client/assets/usage-panel-OJJDj-iW.js.br +0 -0
  64. package/dist/client/assets/{your-day-tip-BFfsyUHg.js → your-day-tip-rN7N7ogp.js} +1 -1
  65. package/dist/client/assets/your-day-tip-rN7N7ogp.js.br +0 -0
  66. package/dist/client/index.html +1 -1
  67. package/dist/client/index.html.br +0 -0
  68. package/dist/server/index.js +1 -1
  69. package/package.json +1 -1
  70. package/dist/chunks/config-store-Cwj6Cw4J.js +0 -1
  71. package/dist/client/assets/benchmark-panel-DPGrtLN_.js.br +0 -0
  72. package/dist/client/assets/boards-view-BhN8980T.js.br +0 -0
  73. package/dist/client/assets/community-panel-Cpt4Y0nl.js.br +0 -0
  74. package/dist/client/assets/dialogs-wx9D2gIo.js.br +0 -0
  75. package/dist/client/assets/doc-editor-ui-B5ZaOx3o.js.br +0 -0
  76. package/dist/client/assets/feature-hint-CSJLTiDY.js.br +0 -0
  77. package/dist/client/assets/first-run-checklist-D5145KuI.js.br +0 -0
  78. package/dist/client/assets/hooks-panel-CaMKiYcn.js.br +0 -0
  79. package/dist/client/assets/index-bt4ITP8T.js.br +0 -0
  80. package/dist/client/assets/issues-panel-BwXKL3R3.js.br +0 -0
  81. package/dist/client/assets/my-prs-panel-DplMRHbZ.js.br +0 -0
  82. package/dist/client/assets/nyan-cat-BhxOl8i1.js.br +0 -0
  83. package/dist/client/assets/phone-shell-C_cDOU1f.js.br +0 -0
  84. package/dist/client/assets/plan-face-D9SLMgDM.js.br +0 -0
  85. package/dist/client/assets/plan-render-R72Sn3GC.js.br +0 -0
  86. package/dist/client/assets/pr-queue-columns-DV4JVAwS.js.br +0 -0
  87. package/dist/client/assets/radar-panel-DwJfa_h9.js.br +0 -0
  88. package/dist/client/assets/repo-roots-adder-cm4iEiso.js.br +0 -0
  89. package/dist/client/assets/resume-dialog-TR4cA2vx.js.br +0 -0
  90. package/dist/client/assets/review-queue-panel-CoYgcwOR.js.br +0 -0
  91. package/dist/client/assets/settings-panel-BSdxXFqT.js.br +0 -0
  92. package/dist/client/assets/shown-lightbox-Gaw9Tqjj.js.br +0 -0
  93. package/dist/client/assets/team-review-panel-DLEnvOBy.js.br +0 -0
  94. package/dist/client/assets/trace-panel-BSAUYymF.js.br +0 -0
  95. package/dist/client/assets/usage-panel-Coe7wkGQ.js.br +0 -0
  96. package/dist/client/assets/your-day-tip-BFfsyUHg.js.br +0 -0
@@ -5,9 +5,9 @@ import { a as packageRoot } from "../chunks/runtime-paths-D_ZjJLE0.js";
5
5
  import { n as glimmervoidHomeDir, t as decideConfigPath } from "../chunks/config-path-core-DUWk0Lui.js";
6
6
  import { t as AGENT_API_VERBS } from "../chunks/session-CcJLn3EZ.js";
7
7
  import { a as execSync } from "../chunks/child-process-safe-BCOoKfxG.js";
8
- import { r as agentCommandHelpLines } from "../chunks/agent-api-core-CRjUWPzJ.js";
8
+ import { r as agentCommandHelpLines } from "../chunks/agent-api-core-CVleheDx.js";
9
9
  import { t as renderTable } from "../chunks/ascii-figure-core-pDAwtlKO.js";
10
- import { i as parseCommandLine, r as gitDoctorRows, t as probeGitVersion } from "../chunks/git-version-jHhRrdeV.js";
10
+ import { i as parseCommandLine, r as gitDoctorRows, t as probeGitVersion } from "../chunks/git-version-CkHaTbB0.js";
11
11
  import { i as pnpmGlobalBinDir, n as npmGlobalBinDir, r as onPath, t as formatPathNotice } from "../chunks/path-doctor-C23VAqeu.js";
12
12
  import fs from "node:fs";
13
13
  import path from "node:path";
@@ -45,6 +45,11 @@ if (commandLine.kind === "help") {
45
45
  await drainOutput();
46
46
  process.exit(0);
47
47
  }
48
+ if (commandLine.kind === "refused") {
49
+ console.error(commandLine.text);
50
+ await drainOutput();
51
+ process.exit(1);
52
+ }
48
53
  if (commandLine.kind === "version") {
49
54
  console.log(pkg.version);
50
55
  process.exit(0);
@@ -57,7 +62,7 @@ var OWN_SUBCOMMAND_RUNNERS = [
57
62
  return 0;
58
63
  }],
59
64
  ["pair", async (subcommandArgs) => {
60
- const { runPairCli } = await import("../chunks/pair-cli-tUavzZpc.js");
65
+ const { runPairCli } = await import("../chunks/pair-cli-KGg8V1HG.js");
61
66
  return runPairCli(subcommandArgs);
62
67
  }],
63
68
  ["agent", async (subcommandArgs) => {
@@ -65,17 +70,17 @@ var OWN_SUBCOMMAND_RUNNERS = [
65
70
  return runAgentSetupCli(subcommandArgs);
66
71
  }],
67
72
  ["settings", async (subcommandArgs) => {
68
- const { runSettingsCli } = await import("../chunks/settings-cli-tATjhUS6.js");
73
+ const { runSettingsCli } = await import("../chunks/settings-cli-Dzzh4V3t.js");
69
74
  return runSettingsCli(subcommandArgs);
70
75
  }],
71
76
  ["ssh-sign", async (subcommandArgs) => {
72
- const { runSshSignCli } = await import("../chunks/ssh-sign-cli-CCE8l4Ed.js");
77
+ const { runSshSignCli } = await import("../chunks/ssh-sign-cli-upCmSfR0.js");
73
78
  return runSshSignCli(subcommandArgs);
74
79
  }]
75
80
  ];
76
81
  var ownSubcommandNames = new Set(OWN_SUBCOMMAND_RUNNERS.map(([name]) => name));
77
82
  var SUBCOMMAND_RUNNERS = new Map([...OWN_SUBCOMMAND_RUNNERS, ...AGENT_API_VERBS.filter((verb) => !ownSubcommandNames.has(verb)).map((verb) => [verb, async (subcommandArgs, subcommandName) => {
78
- const { runAgentApiCli } = await import("../chunks/agent-api-cli-Wsuo3vry.js");
83
+ const { runAgentApiCli } = await import("../chunks/agent-api-cli-DIHuV81M.js");
79
84
  return runAgentApiCli([subcommandName, ...subcommandArgs]);
80
85
  }])]);
81
86
  var AGENT_INSTALL_COMMAND_BY_ID = {
@@ -89,7 +94,7 @@ function missingAgentText(agentId) {
89
94
  }
90
95
  async function printSessionLimits() {
91
96
  if (!process.env["GLIMMERVOID_AGENT_URL"]) return;
92
- const { sessionLimitsHelpLines } = await import("../chunks/agent-api-cli-Wsuo3vry.js");
97
+ const { sessionLimitsHelpLines } = await import("../chunks/agent-api-cli-DIHuV81M.js");
93
98
  const limitsLines = await sessionLimitsHelpLines();
94
99
  console.log(`\n${limitsLines.join("\n")}`);
95
100
  }
@@ -146,7 +151,7 @@ async function readDeclaredCustomAgents() {
146
151
  declared: [],
147
152
  error: null
148
153
  };
149
- const { loadConfigFile } = await import("../chunks/config-store-Cwj6Cw4J.js");
154
+ const { loadConfigFile } = await import("../chunks/config-store-C6SoQ3iD.js");
150
155
  try {
151
156
  const loaded = loadConfigFile(decided.path, { exitOnError: false });
152
157
  if (!loaded.config) return {
@@ -1,6 +1,6 @@
1
1
  import { l as AgentLimitsReply, r as AGENT_URL_ENV } from "./session-CcJLn3EZ.js";
2
+ import { i as agentCommandSpec, m as isAgentApiVerb, q as parseCommand, t as AGENT_COMMAND_HELP } from "./agent-api-core-CVleheDx.js";
2
3
  import { i as formatSessionLimits } from "./session-routes-BGK07awr.js";
3
- import { p as isAgentApiVerb, t as AGENT_COMMAND_HELP } from "./agent-api-core-CRjUWPzJ.js";
4
4
  import { i as resolveHookTarget } from "./hook-relay-core-DA_bz2KA.js";
5
5
  import { t as parseJsonOrNull } from "./json-core-If8h-Qgy.js";
6
6
  import { r as describeOverCap } from "./shown-files-core-hKeo7SMT.js";
@@ -12,33 +12,35 @@ import { pipeline } from "node:stream";
12
12
  var AGENT_PATH_PREFIX = "/agent/";
13
13
  var HELP_LIMITS_TIMEOUT_MS = 2e3;
14
14
  var HELP_LIMITS_UNKNOWN_LINE = "This session: Glimmervoid did not report its limits, so run glimmervoid limits to see why";
15
- function pullRequestBody(rest) {
16
- const pullRequest = rest.join(" ").trim();
15
+ function joinedText(words) {
16
+ return words.join(" ").trim();
17
+ }
18
+ function pullRequestBody({ positionals }) {
19
+ const pullRequest = joinedText(positionals);
17
20
  return pullRequest ? { pr: pullRequest } : null;
18
21
  }
19
22
  function readOpsArgument(opsText) {
20
23
  if (opsText === "-") return parseJsonOrNull(fs.readFileSync(0, "utf8"));
21
24
  return parseJsonOrNull(opsText);
22
25
  }
23
- function whiteboardBody([subcommand, ...rest]) {
24
- const joined = rest.join(" ").trim();
26
+ function whiteboardBody({ commandPath, positionals }) {
27
+ const subcommand = commandPath[1];
28
+ const joined = joinedText(positionals);
25
29
  if (subcommand === "list") return { sub: "list" };
26
- if (subcommand === "new" || subcommand === "connect" || subcommand === "disconnect" || subcommand === "get") {
27
- if (!joined) return null;
28
- return subcommand === "new" ? {
29
- sub: "new",
30
- title: joined
31
- } : {
32
- sub: subcommand,
33
- board: joined
34
- };
35
- }
36
- const [board, ...argumentWords] = rest;
30
+ if (subcommand === "new") return joined ? {
31
+ sub: "new",
32
+ title: joined
33
+ } : null;
34
+ if (subcommand === "connect" || subcommand === "disconnect" || subcommand === "get") return joined ? {
35
+ sub: subcommand,
36
+ board: joined
37
+ } : null;
38
+ const [board, ...argumentWords] = positionals;
37
39
  if (!board || argumentWords.length === 0) return null;
38
40
  if (subcommand === "resolve") return {
39
41
  sub: "resolve",
40
42
  board,
41
- note: argumentWords.join(" ").trim()
43
+ note: joinedText(argumentWords)
42
44
  };
43
45
  if (subcommand !== "put") return null;
44
46
  const ops = readOpsArgument(argumentWords.join(" "));
@@ -49,55 +51,57 @@ function whiteboardBody([subcommand, ...rest]) {
49
51
  ops: Array.isArray(ops) ? ops : [ops]
50
52
  };
51
53
  }
54
+ function answerBody({ values, positionals }) {
55
+ const [child, answerText, ...extra] = positionals;
56
+ if (!child?.trim() || extra.length > 0) return null;
57
+ if (values.operator === true) return answerText === void 0 ? {
58
+ child,
59
+ toOperator: true
60
+ } : null;
61
+ if (answerText === void 0) return null;
62
+ const answers = parseJsonOrNull(answerText);
63
+ if (typeof answers !== "object" || answers === null || Array.isArray(answers)) return null;
64
+ if (!Object.values(answers).every((answer) => typeof answer === "string")) return null;
65
+ return {
66
+ child,
67
+ answers
68
+ };
69
+ }
52
70
  var BODY_BUILDERS = {
53
- spawn: (rest) => {
54
- const prompt = rest.join(" ").trim();
71
+ spawn: ({ positionals }) => {
72
+ const prompt = joinedText(positionals);
55
73
  return prompt ? { prompt } : null;
56
74
  },
57
- send: (rest) => rest.join(" ").trim() ? { words: rest } : null,
58
- read: (rest) => {
59
- const child = rest.join(" ").trim();
75
+ send: ({ positionals }) => joinedText(positionals) ? { words: positionals } : null,
76
+ read: ({ positionals }) => {
77
+ const child = joinedText(positionals);
60
78
  return child ? { child } : {};
61
79
  },
62
- close: (rest) => {
63
- const discard = rest.includes("--discard");
64
- const child = rest.filter((word) => word !== "--discard").join(" ").trim();
80
+ close: ({ values, positionals }) => {
81
+ const child = joinedText(positionals);
65
82
  if (!child) return null;
66
- return discard ? {
83
+ return values.discard === true ? {
67
84
  child,
68
- discard
85
+ discard: true
69
86
  } : { child };
70
87
  },
71
- answer: ([child, answerText, ...extra]) => {
72
- if (!child?.trim() || !answerText || extra.length > 0) return null;
73
- if (answerText === "--operator") return {
74
- child,
75
- toOperator: true
76
- };
77
- const answers = parseJsonOrNull(answerText);
78
- if (typeof answers !== "object" || answers === null || Array.isArray(answers)) return null;
79
- if (!Object.values(answers).every((answer) => typeof answer === "string")) return null;
80
- return {
81
- child,
82
- answers
83
- };
84
- },
85
- attention: (rest) => {
86
- const note = rest.join(" ").trim();
88
+ answer: answerBody,
89
+ attention: ({ positionals }) => {
90
+ const note = joinedText(positionals);
87
91
  return note ? { note } : null;
88
92
  },
89
93
  board: () => ({}),
90
94
  push: () => ({}),
91
- edit: (rest) => {
92
- const docPath = rest.join(" ").trim();
95
+ edit: ({ positionals }) => {
96
+ const docPath = joinedText(positionals);
93
97
  return docPath ? { path: path.resolve(docPath) } : null;
94
98
  },
95
99
  limits: () => ({}),
96
100
  review: pullRequestBody,
97
- reviews: (rest) => pullRequestBody(rest) ?? {},
101
+ reviews: (parsed) => pullRequestBody(parsed) ?? {},
98
102
  prs: () => ({}),
99
103
  "link-pr": pullRequestBody,
100
- settings: ([command, settingPath]) => ({
104
+ settings: ({ positionals: [command, settingPath] }) => ({
101
105
  command,
102
106
  ...settingPath === void 0 ? {} : { path: settingPath }
103
107
  }),
@@ -194,26 +198,10 @@ async function sessionLimitsHelpLines({ timeoutMs = HELP_LIMITS_TIMEOUT_MS } = {
194
198
  return [HELP_LIMITS_UNKNOWN_LINE];
195
199
  }
196
200
  }
197
- function parseShowArguments(words) {
198
- const filePaths = [];
199
- let caption = null;
200
- for (let index = 0; index < words.length; index += 1) {
201
- const word = words[index];
202
- if (word === "--caption") {
203
- caption = words[index + 1] ?? "";
204
- index += 1;
205
- continue;
206
- }
207
- if (word.startsWith("--caption=")) {
208
- caption = word.slice(10);
209
- continue;
210
- }
211
- filePaths.push(word);
212
- }
213
- if (filePaths.length === 0) return null;
201
+ function showRequestOf({ values, positionals }) {
214
202
  return {
215
- filePaths,
216
- caption: caption?.trim().slice(0, 500) || null
203
+ filePaths: positionals,
204
+ caption: (typeof values.caption === "string" ? values.caption.trim().slice(0, 500) : "") || null
217
205
  };
218
206
  }
219
207
  async function statFileToShow(filePath) {
@@ -258,12 +246,8 @@ function replyError(replyText) {
258
246
  const error = typeof reply === "object" && reply !== null ? reply.error : null;
259
247
  return typeof error === "string" ? error : `Glimmervoid answered ${replyText || "nothing"}`;
260
248
  }
261
- async function runShowCommand(words) {
262
- const request = parseShowArguments(words);
263
- if (!request) {
264
- console.error(AGENT_COMMAND_HELP.show.missingArgumentHint ?? "glimmervoid show: this command needs a file path");
265
- return 1;
266
- }
249
+ async function runShowCommand(parsed) {
250
+ const request = showRequestOf(parsed);
267
251
  const target = sessionEndpoint("show");
268
252
  if (!target.ok) {
269
253
  console.error(target.error);
@@ -307,10 +291,19 @@ async function runAgentApiCli(args) {
307
291
  console.error(`glimmervoid: ${verb || "that"} is not an agent command`);
308
292
  return 1;
309
293
  }
310
- if (verb === "show") return runShowCommand(args.slice(1));
311
- const body = BODY_BUILDERS[verb](args.slice(1));
294
+ const parsed = parseCommand(agentCommandSpec(verb), args.slice(1));
295
+ if (parsed.kind === "help") {
296
+ console.log(parsed.text);
297
+ return 0;
298
+ }
299
+ if (parsed.kind === "refused") {
300
+ console.error(parsed.text);
301
+ return 1;
302
+ }
303
+ if (verb === "show") return runShowCommand(parsed);
304
+ const body = BODY_BUILDERS[verb](parsed);
312
305
  if (!body) {
313
- console.error(AGENT_COMMAND_HELP[verb].missingArgumentHint ?? `glimmervoid ${verb}: this command needs an argument`);
306
+ console.error(`glimmervoid ${parsed.commandPath.join(" ")}: ${AGENT_COMMAND_HELP[verb].missingArgumentHint ?? "those arguments are not understood"}; run it with --help for its usage`);
314
307
  return 1;
315
308
  }
316
309
  const target = sessionEndpoint(verb);
@@ -1 +1 @@
1
- export { t as askAgentApi, r as runAgentApiCli, i as sessionLimitsHelpLines } from "./agent-api-cli-DD9EE5Ab.js";
1
+ export { t as askAgentApi, r as runAgentApiCli, i as sessionLimitsHelpLines } from "./agent-api-cli-DGJ38W5Q.js";
@@ -2,7 +2,151 @@ import { C as RefinedTaskTitle, R as TASK_TITLE_CONTROL_CHARACTERS, Y as Whitebo
2
2
  import { D as pullRequestKeyFromReference, l as TASK_TITLE_SOURCE_PRIORITY, o as PersistedTaskTitle } from "./config-BIVF12fQ.js";
3
3
  import { n as NO_OWN_WORKTREE_REASON, t as COMMAND_ROUTES } from "./session-routes-BGK07awr.js";
4
4
  import path from "node:path";
5
+ import { parseArgs } from "node:util";
5
6
  import crypto from "node:crypto";
7
+ //#region server/core/cli-spec-core.ts
8
+ var PROGRAM_NAME = "glimmervoid";
9
+ var USAGE_COLUMN_WIDTH = 20;
10
+ var HELP_OPTION = {
11
+ name: "help",
12
+ short: "h",
13
+ type: "boolean",
14
+ summary: "Print this help"
15
+ };
16
+ function padColumn(label) {
17
+ return ` ${label.padEnd(Math.max(USAGE_COLUMN_WIDTH, label.length + 1))}`;
18
+ }
19
+ function commandLabel(commandPath) {
20
+ return [PROGRAM_NAME, ...commandPath].join(" ");
21
+ }
22
+ function usageLine(spec, commandPath) {
23
+ if (spec.subcommands) return `Usage: ${commandLabel(commandPath)} <command>`;
24
+ const positionalUsage = spec.positionals ? ` ${spec.positionals.usage}` : "";
25
+ return `Usage: ${commandLabel(commandPath)}${positionalUsage}`;
26
+ }
27
+ function optionLabel(option) {
28
+ const shortLabel = option.short ? `, -${option.short}` : "";
29
+ const valueLabel = option.type === "string" ? ` <${option.valueName ?? "value"}>` : "";
30
+ return `--${option.name}${valueLabel}${shortLabel}`;
31
+ }
32
+ function subcommandLine(subcommand) {
33
+ const positionalUsage = subcommand.positionals ? ` ${subcommand.positionals.usage}` : "";
34
+ return `${padColumn(`${subcommand.name}${positionalUsage}`)}${subcommand.summary}`;
35
+ }
36
+ function renderHelp(spec, commandPath) {
37
+ const sections = [usageLine(spec, commandPath), spec.summary];
38
+ if (spec.subcommands) {
39
+ sections.push(["Commands:", ...spec.subcommands.map(subcommandLine)].join("\n"));
40
+ sections.push(`Run "${commandLabel(commandPath)} <command> --help" for a command's options.`);
41
+ return sections.join("\n\n");
42
+ }
43
+ const options = [...spec.options ?? [], HELP_OPTION];
44
+ sections.push(["Options:", ...options.map((option) => `${padColumn(optionLabel(option))}${option.summary}`)].join("\n"));
45
+ return sections.join("\n\n");
46
+ }
47
+ function refusal(spec, commandPath, reason) {
48
+ return {
49
+ kind: "refused",
50
+ text: `${commandLabel(commandPath)}: ${reason}\n${usageLine(spec, commandPath)}`
51
+ };
52
+ }
53
+ function parseOptionsConfig(spec) {
54
+ const options = [...spec.options ?? [], HELP_OPTION];
55
+ return Object.fromEntries(options.map((option) => [option.name, option.short ? {
56
+ type: option.type,
57
+ short: option.short
58
+ } : { type: option.type }]));
59
+ }
60
+ function firstUnknownOption(spec, args) {
61
+ const declared = parseOptionsConfig(spec);
62
+ const { tokens } = parseArgs({
63
+ args: [...args],
64
+ options: declared,
65
+ strict: false,
66
+ allowPositionals: true,
67
+ tokens: true
68
+ });
69
+ const unknown = tokens.find((token) => token.kind === "option" && !(token.name in declared));
70
+ if (unknown?.kind !== "option") return null;
71
+ return unknown.rawName;
72
+ }
73
+ function hasHelpBeforeTerminator(args) {
74
+ const terminatorIndex = args.indexOf("--");
75
+ const flagArguments = terminatorIndex === -1 ? args : args.slice(0, terminatorIndex);
76
+ return flagArguments.includes("--help") || flagArguments.includes("-h");
77
+ }
78
+ function positionalCountProblem(spec, positionals) {
79
+ const bounds = spec.positionals ?? {
80
+ usage: "",
81
+ min: 0,
82
+ max: 0
83
+ };
84
+ if (positionals.length < bounds.min) return spec.missingArgumentHint ?? `this command needs ${bounds.usage}`;
85
+ if (bounds.max === null || positionals.length <= bounds.max) return null;
86
+ const extraWords = positionals.slice(bounds.max).join(" ");
87
+ if (bounds.max === 0) return `this command takes no arguments, so ${extraWords} is not understood`;
88
+ return `this command takes ${bounds.usage}, so ${extraWords} is not understood`;
89
+ }
90
+ function strictlyParse(spec, args) {
91
+ try {
92
+ return parseArgs({
93
+ args: [...args],
94
+ options: parseOptionsConfig(spec),
95
+ strict: true,
96
+ allowPositionals: true
97
+ });
98
+ } catch (error) {
99
+ return { error: error instanceof Error ? error.message : String(error) };
100
+ }
101
+ }
102
+ function parseLeaf(spec, args, commandPath) {
103
+ if (hasHelpBeforeTerminator(args)) return {
104
+ kind: "help",
105
+ text: renderHelp(spec, commandPath)
106
+ };
107
+ const unknownOption = firstUnknownOption(spec, args);
108
+ if (unknownOption) return refusal(spec, commandPath, `unknown option ${unknownOption}. Quote text that starts with a dash, or put it after --.`);
109
+ const parsed = strictlyParse(spec, args);
110
+ if ("error" in parsed) return refusal(spec, commandPath, parsed.error);
111
+ const countProblem = positionalCountProblem(spec, parsed.positionals);
112
+ if (countProblem) return refusal(spec, commandPath, countProblem);
113
+ return {
114
+ kind: "run",
115
+ commandPath,
116
+ values: parsed.values,
117
+ positionals: parsed.positionals,
118
+ rawArgs: [...args]
119
+ };
120
+ }
121
+ function parseCommand(spec, args, commandPath = [spec.name]) {
122
+ if (spec.isPassthrough) return {
123
+ kind: "run",
124
+ commandPath,
125
+ values: {},
126
+ positionals: [...args],
127
+ rawArgs: [...args]
128
+ };
129
+ if (!spec.subcommands) return parseLeaf(spec, args, commandPath);
130
+ const [subcommandName, ...rest] = args;
131
+ if (subcommandName === void 0) return {
132
+ kind: "refused",
133
+ text: `${commandLabel(commandPath)}: this command needs a subcommand\n\n${renderHelp(spec, commandPath)}`
134
+ };
135
+ if (subcommandName === "--help" || subcommandName === "-h") return {
136
+ kind: "help",
137
+ text: renderHelp(spec, commandPath)
138
+ };
139
+ const subcommand = spec.subcommands.find((candidate) => candidate.name === subcommandName);
140
+ if (!subcommand) return {
141
+ kind: "refused",
142
+ text: `${commandLabel(commandPath)}: unknown command ${subcommandName}\n\n${renderHelp(spec, commandPath)}`
143
+ };
144
+ return parseCommand(subcommand, rest, [...commandPath, subcommand.name]);
145
+ }
146
+ function renderOverviewLine(usage, summary) {
147
+ return `${padColumn(usage)}${summary}`;
148
+ }
149
+ //#endregion
6
150
  //#region shared/session-naming.ts
7
151
  function isAutoNameOf(name, baseName) {
8
152
  if (name === baseName) return true;
@@ -789,37 +933,116 @@ function deriveChildSessionName({ requestedName, brief, parentName }, existingNa
789
933
  }
790
934
  return candidate;
791
935
  }
792
- var USAGE_COLUMN_WIDTH = 20;
936
+ function requiredText(usage) {
937
+ return {
938
+ usage,
939
+ min: 1,
940
+ max: null
941
+ };
942
+ }
943
+ function optionalText(usage) {
944
+ return {
945
+ usage,
946
+ min: 0,
947
+ max: null
948
+ };
949
+ }
950
+ var BOARD_REFERENCE = requiredText("<board>");
951
+ var WHITEBOARD_SUBCOMMANDS = [
952
+ {
953
+ name: "new",
954
+ summary: "Create a board; this session is its creator and gets summaries of its changes",
955
+ positionals: requiredText("<title>"),
956
+ missingArgumentHint: "a new board needs a title, for example \"glimmervoid whiteboard new release plan\""
957
+ },
958
+ {
959
+ name: "list",
960
+ summary: "List the boards with their connected sessions"
961
+ },
962
+ {
963
+ name: "connect",
964
+ summary: "Get summaries of changes to a board in this session",
965
+ positionals: BOARD_REFERENCE
966
+ },
967
+ {
968
+ name: "disconnect",
969
+ summary: "Stop getting summaries of changes to a board",
970
+ positionals: BOARD_REFERENCE
971
+ },
972
+ {
973
+ name: "get",
974
+ summary: "Read a board and the changes since this session last read it",
975
+ positionals: BOARD_REFERENCE
976
+ },
977
+ {
978
+ name: "put",
979
+ summary: "Apply a JSON op or array of ops to a board; - reads them from stdin",
980
+ positionals: {
981
+ usage: "<board> <ops-json|->",
982
+ min: 2,
983
+ max: null
984
+ }
985
+ },
986
+ {
987
+ name: "resolve",
988
+ summary: "Mark a note on a board resolved",
989
+ positionals: {
990
+ usage: "<board> <note>",
991
+ min: 2,
992
+ max: null
993
+ }
994
+ }
995
+ ];
793
996
  var AGENT_COMMAND_HELP = Object.freeze({
794
997
  spawn: {
795
998
  usage: "spawn <prompt>",
999
+ positionals: requiredText("<prompt>"),
796
1000
  summary: "Start a session on that prompt, with its own dashboard card, that this session owns until its task is done",
797
- missingArgumentHint: "glimmervoid spawn: this command needs text, for example \"glimmervoid spawn check the failing test\""
1001
+ missingArgumentHint: "this command needs text, for example \"glimmervoid spawn check the failing test\""
798
1002
  },
799
1003
  send: {
800
1004
  usage: "send [child] <text>",
1005
+ positionals: requiredText("[child] <text>"),
801
1006
  summary: "Message a session this one spawned; a spawned session messages its parent with send <text>",
802
- missingArgumentHint: "glimmervoid send: this command needs text, for example \"glimmervoid send the tests pass\" or, to a spawned session, \"glimmervoid send <child> fix the failing test\""
1007
+ missingArgumentHint: "this command needs text, for example \"glimmervoid send the tests pass\" or, to a spawned session, \"glimmervoid send <child> fix the failing test\""
803
1008
  },
804
1009
  read: {
805
1010
  usage: "read [child]",
1011
+ positionals: optionalText("[child]"),
806
1012
  summary: "Read what this session's spawned sessions sent; a spawned session reads its parent's messages",
807
1013
  missingArgumentHint: null
808
1014
  },
809
1015
  close: {
810
1016
  usage: "close <child>",
1017
+ positionals: requiredText("<child>"),
1018
+ options: [{
1019
+ name: "discard",
1020
+ type: "boolean",
1021
+ summary: "Close it even though it holds unpushed work, which is lost"
1022
+ }],
811
1023
  summary: "End a session this one spawned and discard its worktree; refused while it holds unpushed work unless --discard",
812
- missingArgumentHint: "glimmervoid close: this command needs the spawned session, for example \"glimmervoid close <child>\""
1024
+ missingArgumentHint: "this command needs the spawned session, for example \"glimmervoid close <child>\""
813
1025
  },
814
1026
  answer: {
815
1027
  usage: "answer <child> <json>|--operator",
1028
+ positionals: {
1029
+ usage: "<child> [json]",
1030
+ min: 1,
1031
+ max: 2
1032
+ },
1033
+ options: [{
1034
+ name: "operator",
1035
+ type: "boolean",
1036
+ summary: "Pass the question to the operator instead of answering it"
1037
+ }],
816
1038
  summary: "Answer a spawned session's held question, or pass it to the operator with --operator",
817
- missingArgumentHint: "glimmervoid answer: this command needs a child and a JSON object of answers, or --operator"
1039
+ missingArgumentHint: "this command needs a child and a JSON object of answers, or --operator"
818
1040
  },
819
1041
  attention: {
820
1042
  usage: "attention <note>",
1043
+ positionals: requiredText("<note>"),
821
1044
  summary: "Flag this session as needing the operator",
822
- missingArgumentHint: "glimmervoid attention: this command needs text, for example \"glimmervoid attention check the failing test\""
1045
+ missingArgumentHint: "this command needs text, for example \"glimmervoid attention check the failing test\""
823
1046
  },
824
1047
  board: {
825
1048
  usage: "board",
@@ -833,21 +1056,31 @@ var AGENT_COMMAND_HELP = Object.freeze({
833
1056
  },
834
1057
  edit: {
835
1058
  usage: "edit <path>",
1059
+ positionals: requiredText("<path>"),
836
1060
  summary: "Open a text file for the operator to edit in the dashboard",
837
- missingArgumentHint: "glimmervoid edit: this command needs a file path, for example \"glimmervoid edit drafts/post.md\""
1061
+ missingArgumentHint: "this command needs a file path, for example \"glimmervoid edit drafts/post.md\""
838
1062
  },
839
1063
  show: {
840
1064
  usage: "show <path>... [--caption <text>]",
1065
+ positionals: requiredText("<path>..."),
1066
+ options: [{
1067
+ name: "caption",
1068
+ type: "string",
1069
+ valueName: "text",
1070
+ summary: "A caption shown with the files"
1071
+ }],
841
1072
  summary: "Show the operator an image, video or HTML page on this session's card",
842
- missingArgumentHint: "glimmervoid show: this command needs a file path, for example \"glimmervoid show out/diagram.png --caption 'the new layout'\""
1073
+ missingArgumentHint: "this command needs a file path, for example \"glimmervoid show out/diagram.png --caption 'the new layout'\""
843
1074
  },
844
1075
  review: {
845
1076
  usage: "review <pr>",
1077
+ positionals: requiredText("<pr>"),
846
1078
  summary: "Queue a team review of a pull request; the draft waits in the Reviews tab for the operator to post",
847
- missingArgumentHint: "glimmervoid review: this command needs a pull request, for example \"glimmervoid review https://github.com/acme/app/pull/12\" or \"glimmervoid review acme/app#12\""
1079
+ missingArgumentHint: "this command needs a pull request, for example \"glimmervoid review https://github.com/acme/app/pull/12\" or \"glimmervoid review acme/app#12\""
848
1080
  },
849
1081
  reviews: {
850
1082
  usage: "reviews [pr]",
1083
+ positionals: optionalText("[pr]"),
851
1084
  summary: "List the Reviews tab: reviews running, queued and drafted; with a pull request, read its draft in full",
852
1085
  missingArgumentHint: null
853
1086
  },
@@ -858,18 +1091,21 @@ var AGENT_COMMAND_HELP = Object.freeze({
858
1091
  },
859
1092
  "link-pr": {
860
1093
  usage: "link-pr <pr>",
1094
+ positionals: requiredText("<pr>"),
861
1095
  summary: "Link a pull request to this session's card",
862
- missingArgumentHint: "glimmervoid link-pr: this command needs a pull request, for example \"glimmervoid link-pr acme/app#12\""
1096
+ missingArgumentHint: "this command needs a pull request, for example \"glimmervoid link-pr acme/app#12\""
863
1097
  },
864
1098
  settings: {
865
1099
  usage: "settings list|get",
866
1100
  summary: "Read Glimmervoid's settings; a secret shows only as configured or not",
867
- missingArgumentHint: null
1101
+ missingArgumentHint: null,
1102
+ isPassthrough: true
868
1103
  },
869
1104
  whiteboard: {
870
1105
  usage: "whiteboard new|list|connect|disconnect|get|put|resolve",
1106
+ subcommands: WHITEBOARD_SUBCOMMANDS,
871
1107
  summary: "Create, connect to, read and edit a shared whiteboard the operator and connected sessions edit together",
872
- missingArgumentHint: "glimmervoid whiteboard: run \"glimmervoid whiteboard new <title>\", \"list\", \"connect <board>\", \"disconnect <board>\", \"get <board>\", \"put <board> <ops-json|->\" or \"resolve <board> <note>\""
1108
+ missingArgumentHint: null
873
1109
  },
874
1110
  limits: {
875
1111
  usage: "limits",
@@ -878,7 +1114,19 @@ var AGENT_COMMAND_HELP = Object.freeze({
878
1114
  }
879
1115
  });
880
1116
  function agentCommandHelpLines() {
881
- return Object.values(AGENT_COMMAND_HELP).map(({ usage, summary }) => ` ${usage.padEnd(Math.max(USAGE_COLUMN_WIDTH, usage.length + 1))}${summary}`);
1117
+ return Object.values(AGENT_COMMAND_HELP).map(({ usage, summary }) => renderOverviewLine(usage, summary));
1118
+ }
1119
+ function agentCommandSpec(verb) {
1120
+ const { summary, missingArgumentHint, positionals, options, subcommands, isPassthrough } = AGENT_COMMAND_HELP[verb];
1121
+ return {
1122
+ name: verb,
1123
+ summary,
1124
+ missingArgumentHint,
1125
+ positionals,
1126
+ options,
1127
+ subcommands,
1128
+ isPassthrough
1129
+ };
882
1130
  }
883
1131
  //#endregion
884
- export { parseRefinedTaskTitle as A, shouldAdoptReportedResumeId as B, extractAiTitle as C, isSelfWakePrompt as D, extractPromptTaskTitle as E, RESUME_ID_RE as F, nextSuggestedName as G, listRepoConversations as H, isConversationReplacedAtStartup as I, pickAutoResume as L, resolveTaskTitle as M, seedTaskTitleSources as N, isSubstantivePrompt as O, AUTO_CONTINUE_PROMPT as P, resolveResumeTarget as R, decideTaskTitleRefinement as S, extractOscTaskTitle as T, listRepoWorktreePaths as U, claudeProjectsDir as V, isAutoNameOf as W, projectReviews as _, decideAgentRequest as a, chooseRefinedSessionName as b, describeChildEndNote as c, describeRoleRefusal as d, describeUnpushedCloseRefusal as f, projectReviewDetail as g, projectMyPrs as h, checkAgentReply as i, resolveRefocusTaskTitle as j, parseRefinedSessionName as k, describeKeptChildAttention as l, parseAgentVerb as m, REFUSAL_REASON as n, decideSpawnAllowance as o, isAgentApiVerb as p, agentCommandHelpLines as r, deriveChildSessionName as s, AGENT_COMMAND_HELP as t, describePushLanding as u, buildPersistedTaskTitle as v, extractHookTaskTitle as w, cleanTaskPrompt as x, buildTaskTitleRefinementPrompt as y, resumePromptFor as z };
1132
+ export { parseRefinedSessionName as A, resumePromptFor as B, decideTaskTitleRefinement as C, extractPromptTaskTitle as D, extractOscTaskTitle as E, AUTO_CONTINUE_PROMPT as F, isAutoNameOf as G, claudeProjectsDir as H, RESUME_ID_RE as I, nextSuggestedName as K, isConversationReplacedAtStartup as L, resolveRefocusTaskTitle as M, resolveTaskTitle as N, isSelfWakePrompt as O, seedTaskTitleSources as P, pickAutoResume as R, cleanTaskPrompt as S, extractHookTaskTitle as T, listRepoConversations as U, shouldAdoptReportedResumeId as V, listRepoWorktreePaths as W, projectReviewDetail as _, checkAgentReply as a, buildTaskTitleRefinementPrompt as b, deriveChildSessionName as c, describePushLanding as d, describeRoleRefusal as f, projectMyPrs as g, parseAgentVerb as h, agentCommandSpec as i, parseRefinedTaskTitle as j, isSubstantivePrompt as k, describeChildEndNote as l, isAgentApiVerb as m, REFUSAL_REASON as n, decideAgentRequest as o, describeUnpushedCloseRefusal as p, parseCommand as q, agentCommandHelpLines as r, decideSpawnAllowance as s, AGENT_COMMAND_HELP as t, describeKeptChildAttention as u, projectReviews as v, extractAiTitle as w, chooseRefinedSessionName as x, buildPersistedTaskTitle as y, resolveResumeTarget as z };