glimmervoid 0.48.2-next.320 → 0.48.2-next.322

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 (93) hide show
  1. package/dist/bin/glimmervoid.js +53 -28
  2. package/dist/chunks/{agent-api-cli-DD9EE5Ab.js → agent-api-cli-7a-qwVK2.js} +68 -75
  3. package/dist/chunks/{agent-api-cli-Wsuo3vry.js → agent-api-cli-IszLDyTY.js} +1 -1
  4. package/dist/chunks/{agent-api-core-CRjUWPzJ.js → agent-api-core-BHcWVTPO.js} +396 -14
  5. package/dist/chunks/{agent-setup-cli-C3R5_hr1.js → agent-setup-cli-C4VZliUA.js} +2 -5
  6. package/dist/chunks/{git-version-jHhRrdeV.js → git-version-xS1GFU8P.js} +51 -52
  7. package/dist/chunks/{main-BqEQOvDt.js → main-BsxukuSb.js} +3 -3
  8. package/dist/chunks/{pair-cli-KGg8V1HG.js → pair-cli-Bdn1AOva.js} +4 -16
  9. package/dist/chunks/{settings-cli-KJt7HSxn.js → settings-cli-H3UxJLZo.js} +27 -63
  10. package/dist/chunks/{settings-readout-core-d9Tj5jwO.js → settings-readout-core-CPPzHMNL.js} +3 -10
  11. package/dist/chunks/{ssh-sign-cli-CCE8l4Ed.js → ssh-sign-cli-BtTvxMEu.js} +1 -1
  12. package/dist/client/assets/{benchmark-panel-pFL_ZXRq.js → benchmark-panel-CiNkBRS4.js} +1 -1
  13. package/dist/client/assets/benchmark-panel-CiNkBRS4.js.br +0 -0
  14. package/dist/client/assets/{boards-view-B6XcY8Es.js → boards-view-D1d_Jeh2.js} +1 -1
  15. package/dist/client/assets/boards-view-D1d_Jeh2.js.br +0 -0
  16. package/dist/client/assets/{community-panel-CtG4tzFI.js → community-panel-Cm9HnXDd.js} +1 -1
  17. package/dist/client/assets/community-panel-Cm9HnXDd.js.br +0 -0
  18. package/dist/client/assets/{dialogs-CzpAY8Nq.js → dialogs-DWcur78f.js} +1 -1
  19. package/dist/client/assets/dialogs-DWcur78f.js.br +0 -0
  20. package/dist/client/assets/{doc-editor-ui-BYcNpH6-.js → doc-editor-ui-NGbnywAB.js} +1 -1
  21. package/dist/client/assets/doc-editor-ui-NGbnywAB.js.br +0 -0
  22. package/dist/client/assets/{feature-hint-BsCfpypK.js → feature-hint-BPITXLNF.js} +1 -1
  23. package/dist/client/assets/feature-hint-BPITXLNF.js.br +0 -0
  24. package/dist/client/assets/{first-run-checklist-C82KMpwg.js → first-run-checklist-C_qQ8RA8.js} +1 -1
  25. package/dist/client/assets/first-run-checklist-C_qQ8RA8.js.br +0 -0
  26. package/dist/client/assets/{hooks-panel-DtiNBBaX.js → hooks-panel-B8s0WX5_.js} +1 -1
  27. package/dist/client/assets/hooks-panel-B8s0WX5_.js.br +0 -0
  28. package/dist/client/assets/{index-0vbw-xeU.js → index-CEACcf33.js} +5 -5
  29. package/dist/client/assets/index-CEACcf33.js.br +0 -0
  30. package/dist/client/assets/{issues-panel-YeHM4pir.js → issues-panel-Cc06Bgsi.js} +1 -1
  31. package/dist/client/assets/issues-panel-Cc06Bgsi.js.br +0 -0
  32. package/dist/client/assets/{my-prs-panel-DQJ-zpBI.js → my-prs-panel-Ck43NtDT.js} +1 -1
  33. package/dist/client/assets/my-prs-panel-Ck43NtDT.js.br +0 -0
  34. package/dist/client/assets/{nyan-cat-D7Ygthre.js → nyan-cat-BWGtd4eG.js} +1 -1
  35. package/dist/client/assets/nyan-cat-BWGtd4eG.js.br +0 -0
  36. package/dist/client/assets/{phone-shell-gHLW4-Dr.js → phone-shell-BO3n6oG8.js} +1 -1
  37. package/dist/client/assets/phone-shell-BO3n6oG8.js.br +0 -0
  38. package/dist/client/assets/{plan-face-c0-JGSVu.js → plan-face-CRL-SLAn.js} +1 -1
  39. package/dist/client/assets/plan-face-CRL-SLAn.js.br +0 -0
  40. package/dist/client/assets/{plan-render-Dx_VJZGs.js → plan-render-BDtI7Wsb.js} +1 -1
  41. package/dist/client/assets/plan-render-BDtI7Wsb.js.br +0 -0
  42. package/dist/client/assets/{pr-queue-columns-DnRL1H6r.js → pr-queue-columns-C93KRGpe.js} +1 -1
  43. package/dist/client/assets/pr-queue-columns-C93KRGpe.js.br +0 -0
  44. package/dist/client/assets/{radar-panel-BQVEo5mr.js → radar-panel-CHn9u2qd.js} +1 -1
  45. package/dist/client/assets/radar-panel-CHn9u2qd.js.br +0 -0
  46. package/dist/client/assets/{repo-roots-adder-CFNNM2WJ.js → repo-roots-adder-CqiH197r.js} +1 -1
  47. package/dist/client/assets/repo-roots-adder-CqiH197r.js.br +0 -0
  48. package/dist/client/assets/{resume-dialog-DYzfPxV6.js → resume-dialog-BCbNwxkR.js} +1 -1
  49. package/dist/client/assets/resume-dialog-BCbNwxkR.js.br +0 -0
  50. package/dist/client/assets/{review-queue-panel-C4v1whXA.js → review-queue-panel-ByaEF2nY.js} +1 -1
  51. package/dist/client/assets/review-queue-panel-ByaEF2nY.js.br +0 -0
  52. package/dist/client/assets/{settings-panel-Dnbb479q.js → settings-panel-BqCGzUKq.js} +2 -2
  53. package/dist/client/assets/settings-panel-BqCGzUKq.js.br +0 -0
  54. package/dist/client/assets/{shown-lightbox-B9zPGrQP.js → shown-lightbox-C7i8y4gs.js} +1 -1
  55. package/dist/client/assets/shown-lightbox-C7i8y4gs.js.br +0 -0
  56. package/dist/client/assets/{team-review-panel-CIhBhZKT.js → team-review-panel-DZ4FF985.js} +1 -1
  57. package/dist/client/assets/team-review-panel-DZ4FF985.js.br +0 -0
  58. package/dist/client/assets/{trace-panel-BhXPkGsF.js → trace-panel-CAA0R9vJ.js} +1 -1
  59. package/dist/client/assets/trace-panel-CAA0R9vJ.js.br +0 -0
  60. package/dist/client/assets/{usage-panel-ChRf0OEC.js → usage-panel-B6DaIaan.js} +1 -1
  61. package/dist/client/assets/usage-panel-B6DaIaan.js.br +0 -0
  62. package/dist/client/assets/{your-day-tip-uAwBcPLp.js → your-day-tip-X3qp4x_t.js} +1 -1
  63. package/dist/client/assets/your-day-tip-X3qp4x_t.js.br +0 -0
  64. package/dist/client/index.html +1 -1
  65. package/dist/client/index.html.br +0 -0
  66. package/dist/server/index.js +1 -1
  67. package/package.json +1 -1
  68. package/dist/client/assets/benchmark-panel-pFL_ZXRq.js.br +0 -0
  69. package/dist/client/assets/boards-view-B6XcY8Es.js.br +0 -0
  70. package/dist/client/assets/community-panel-CtG4tzFI.js.br +0 -0
  71. package/dist/client/assets/dialogs-CzpAY8Nq.js.br +0 -0
  72. package/dist/client/assets/doc-editor-ui-BYcNpH6-.js.br +0 -0
  73. package/dist/client/assets/feature-hint-BsCfpypK.js.br +0 -0
  74. package/dist/client/assets/first-run-checklist-C82KMpwg.js.br +0 -0
  75. package/dist/client/assets/hooks-panel-DtiNBBaX.js.br +0 -0
  76. package/dist/client/assets/index-0vbw-xeU.js.br +0 -0
  77. package/dist/client/assets/issues-panel-YeHM4pir.js.br +0 -0
  78. package/dist/client/assets/my-prs-panel-DQJ-zpBI.js.br +0 -0
  79. package/dist/client/assets/nyan-cat-D7Ygthre.js.br +0 -0
  80. package/dist/client/assets/phone-shell-gHLW4-Dr.js.br +0 -0
  81. package/dist/client/assets/plan-face-c0-JGSVu.js.br +0 -0
  82. package/dist/client/assets/plan-render-Dx_VJZGs.js.br +0 -0
  83. package/dist/client/assets/pr-queue-columns-DnRL1H6r.js.br +0 -0
  84. package/dist/client/assets/radar-panel-BQVEo5mr.js.br +0 -0
  85. package/dist/client/assets/repo-roots-adder-CFNNM2WJ.js.br +0 -0
  86. package/dist/client/assets/resume-dialog-DYzfPxV6.js.br +0 -0
  87. package/dist/client/assets/review-queue-panel-C4v1whXA.js.br +0 -0
  88. package/dist/client/assets/settings-panel-Dnbb479q.js.br +0 -0
  89. package/dist/client/assets/shown-lightbox-B9zPGrQP.js.br +0 -0
  90. package/dist/client/assets/team-review-panel-CIhBhZKT.js.br +0 -0
  91. package/dist/client/assets/trace-panel-BhXPkGsF.js.br +0 -0
  92. package/dist/client/assets/usage-panel-ChRf0OEC.js.br +0 -0
  93. package/dist/client/assets/your-day-tip-uAwBcPLp.js.br +0 -5
@@ -2,7 +2,285 @@ 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
+ }
42
+ if (!spec.subcommands) {
43
+ const options = [...spec.options ?? [], HELP_OPTION];
44
+ sections.push(["Options:", ...options.map((option) => `${padColumn(optionLabel(option))}${option.summary}`)].join("\n"));
45
+ }
46
+ if (spec.notes) sections.push(spec.notes);
47
+ return sections.join("\n\n");
48
+ }
49
+ function refusal(spec, commandPath, reason) {
50
+ return {
51
+ kind: "refused",
52
+ text: `${commandLabel(commandPath)}: ${reason}\n${usageLine(spec, commandPath)}`
53
+ };
54
+ }
55
+ function parseOptionsConfig(spec) {
56
+ const options = [...spec.options ?? [], HELP_OPTION];
57
+ return Object.fromEntries(options.map((option) => [option.name, option.short ? {
58
+ type: option.type,
59
+ short: option.short
60
+ } : { type: option.type }]));
61
+ }
62
+ function firstUnknownOption(spec, args) {
63
+ const declared = parseOptionsConfig(spec);
64
+ const { tokens } = parseArgs({
65
+ args: [...args],
66
+ options: declared,
67
+ strict: false,
68
+ allowPositionals: true,
69
+ tokens: true
70
+ });
71
+ const unknown = tokens.find((token) => token.kind === "option" && !(token.name in declared));
72
+ if (unknown?.kind !== "option") return null;
73
+ return unknown.rawName;
74
+ }
75
+ function hasHelpBeforeTerminator(args) {
76
+ const terminatorIndex = args.indexOf("--");
77
+ const flagArguments = terminatorIndex === -1 ? args : args.slice(0, terminatorIndex);
78
+ return flagArguments.includes("--help") || flagArguments.includes("-h");
79
+ }
80
+ function positionalCountProblem(spec, positionals) {
81
+ const bounds = spec.positionals ?? {
82
+ usage: "",
83
+ min: 0,
84
+ max: 0
85
+ };
86
+ if (positionals.length < bounds.min) return spec.missingArgumentHint ?? `this command needs ${bounds.usage}`;
87
+ if (bounds.max === null || positionals.length <= bounds.max) return null;
88
+ const extraWords = positionals.slice(bounds.max).join(" ");
89
+ if (bounds.max === 0) return `this command takes no arguments, so ${extraWords} is not understood`;
90
+ return `this command takes ${bounds.usage}, so ${extraWords} is not understood`;
91
+ }
92
+ function unknownOptionReason(spec, commandPath, unknownOption) {
93
+ if (!(spec.positionals !== void 0 && spec.positionals.max !== 0)) return `unknown option ${unknownOption}`;
94
+ return `unknown option ${unknownOption}. Text that starts with a dash goes after --, as in ${commandLabel(commandPath)} -- ${unknownOption}`;
95
+ }
96
+ function strictlyParse(spec, args) {
97
+ try {
98
+ return parseArgs({
99
+ args: [...args],
100
+ options: parseOptionsConfig(spec),
101
+ strict: true,
102
+ allowPositionals: true
103
+ });
104
+ } catch (error) {
105
+ return { error: error instanceof Error ? error.message : String(error) };
106
+ }
107
+ }
108
+ function parseLeaf(spec, args, commandPath) {
109
+ if (hasHelpBeforeTerminator(args)) return {
110
+ kind: "help",
111
+ text: renderHelp(spec, commandPath)
112
+ };
113
+ const unknownOption = firstUnknownOption(spec, args);
114
+ if (unknownOption) return refusal(spec, commandPath, unknownOptionReason(spec, commandPath, unknownOption));
115
+ const parsed = strictlyParse(spec, args);
116
+ if ("error" in parsed) return refusal(spec, commandPath, parsed.error);
117
+ const countProblem = positionalCountProblem(spec, parsed.positionals);
118
+ if (countProblem) return refusal(spec, commandPath, countProblem);
119
+ return {
120
+ kind: "run",
121
+ commandPath,
122
+ values: parsed.values,
123
+ positionals: parsed.positionals,
124
+ rawArgs: [...args]
125
+ };
126
+ }
127
+ function parseCommand(spec, args, commandPath = [spec.name]) {
128
+ if (spec.isPassthrough) return {
129
+ kind: "run",
130
+ commandPath,
131
+ values: {},
132
+ positionals: [...args],
133
+ rawArgs: [...args]
134
+ };
135
+ if (!spec.subcommands) return parseLeaf(spec, args, commandPath);
136
+ const [subcommandName, ...rest] = args;
137
+ if (subcommandName === void 0) return {
138
+ kind: "refused",
139
+ text: `${commandLabel(commandPath)}: this command needs a subcommand\n\n${renderHelp(spec, commandPath)}`
140
+ };
141
+ if (subcommandName === "--help" || subcommandName === "-h") return {
142
+ kind: "help",
143
+ text: renderHelp(spec, commandPath)
144
+ };
145
+ const subcommand = spec.subcommands.find((candidate) => candidate.name === subcommandName);
146
+ if (!subcommand) return {
147
+ kind: "refused",
148
+ text: `${commandLabel(commandPath)}: unknown command ${subcommandName}\n\n${renderHelp(spec, commandPath)}`
149
+ };
150
+ return parseCommand(subcommand, rest, [...commandPath, subcommand.name]);
151
+ }
152
+ var CONFIG_OPTION = {
153
+ name: "config",
154
+ type: "string",
155
+ valueName: "path",
156
+ summary: "Config file (default: ~/.glimmervoid/config.json)"
157
+ };
158
+ var PORT_OPTION = {
159
+ name: "port",
160
+ type: "string",
161
+ valueName: "number",
162
+ summary: "Server port (default: 3000)"
163
+ };
164
+ var JSON_OPTION = {
165
+ name: "json",
166
+ type: "boolean",
167
+ summary: "Machine-readable output"
168
+ };
169
+ var SETTING_PATH = {
170
+ usage: "<path>",
171
+ min: 1,
172
+ max: 1
173
+ };
174
+ var OWNED_COMMAND_SPECS = {
175
+ doctor: {
176
+ name: "doctor",
177
+ summary: "Check the install, PATH, agent CLIs and native module, then exit",
178
+ options: [CONFIG_OPTION, PORT_OPTION]
179
+ },
180
+ pair: {
181
+ name: "pair",
182
+ summary: "Mint a single-use pairing link for a remote device, or list and revoke paired devices",
183
+ options: [
184
+ {
185
+ name: "name",
186
+ type: "string",
187
+ valueName: "label",
188
+ summary: "Name for the device being paired"
189
+ },
190
+ {
191
+ name: "list",
192
+ type: "boolean",
193
+ summary: "List paired devices"
194
+ },
195
+ {
196
+ name: "revoke",
197
+ type: "string",
198
+ valueName: "id",
199
+ summary: "Revoke a paired device"
200
+ },
201
+ CONFIG_OPTION,
202
+ PORT_OPTION
203
+ ]
204
+ },
205
+ agent: {
206
+ name: "agent",
207
+ summary: "Set up an agent CLI to report to Glimmervoid",
208
+ subcommands: [{
209
+ name: "setup",
210
+ summary: "Install an agent hook relay",
211
+ subcommands: [{
212
+ name: "grok",
213
+ summary: "Install the Grok hook relay, which does nothing outside Glimmervoid"
214
+ }]
215
+ }]
216
+ },
217
+ settings: {
218
+ name: "settings",
219
+ summary: "Read and change config.json from the command line",
220
+ notes: `<path> is a config.json key path such as posthog.trafficSpikeEnabled, or a setting id such as posthog-traffic-enabled.
221
+ <value> is true or false for a toggle, a number, text, a comma-separated or JSON list, or JSON for a structured value.
222
+ A number is in the unit config.json stores, as schema's Stored unit column names: set branchGc.intervalMs 21600000 means 21600000 ms.
223
+ Where the dashboard shows another unit, get, list and set add it in parentheses, such as 30000 (30 seconds).
224
+ A secret (a bot token or API key) is never set or unset here, since a value on the command line lands in shell history;
225
+ change it in the dashboard settings or through its environment variable.`,
226
+ subcommands: [
227
+ {
228
+ name: "list",
229
+ summary: "Every config.json setting with its value and where the value comes from",
230
+ options: [JSON_OPTION]
231
+ },
232
+ {
233
+ name: "get",
234
+ summary: "One setting; a secret shows as configured or not configured, never its value",
235
+ positionals: SETTING_PATH,
236
+ options: [JSON_OPTION]
237
+ },
238
+ {
239
+ name: "set",
240
+ summary: "Validate the whole file and write it; a running Glimmervoid reloads it",
241
+ positionals: {
242
+ usage: "<path> <value>",
243
+ min: 2,
244
+ max: 2
245
+ },
246
+ options: [JSON_OPTION]
247
+ },
248
+ {
249
+ name: "unset",
250
+ summary: "Remove the key from config.json so the default applies",
251
+ positionals: SETTING_PATH,
252
+ options: [JSON_OPTION]
253
+ },
254
+ {
255
+ name: "search",
256
+ summary: "Find settings by title, keyword, key path or section",
257
+ positionals: {
258
+ usage: "<text>",
259
+ min: 1,
260
+ max: null
261
+ },
262
+ options: [JSON_OPTION]
263
+ },
264
+ {
265
+ name: "schema",
266
+ summary: "Every setting: id, path, type, default, unit, effect and section (needs no config file)",
267
+ options: [JSON_OPTION]
268
+ }
269
+ ]
270
+ },
271
+ "ssh-sign": {
272
+ name: "ssh-sign",
273
+ summary: "Sign a commit with the operator's forwarded ssh agent (git runs this)",
274
+ isPassthrough: true
275
+ }
276
+ };
277
+ function isOwnedCommandName(name) {
278
+ return Object.hasOwn(OWNED_COMMAND_SPECS, name);
279
+ }
280
+ function renderOverviewLine(usage, summary) {
281
+ return `${padColumn(usage)}${summary}`;
282
+ }
283
+ //#endregion
6
284
  //#region shared/session-naming.ts
7
285
  function isAutoNameOf(name, baseName) {
8
286
  if (name === baseName) return true;
@@ -789,37 +1067,116 @@ function deriveChildSessionName({ requestedName, brief, parentName }, existingNa
789
1067
  }
790
1068
  return candidate;
791
1069
  }
792
- var USAGE_COLUMN_WIDTH = 20;
1070
+ function requiredText(usage) {
1071
+ return {
1072
+ usage,
1073
+ min: 1,
1074
+ max: null
1075
+ };
1076
+ }
1077
+ function optionalText(usage) {
1078
+ return {
1079
+ usage,
1080
+ min: 0,
1081
+ max: null
1082
+ };
1083
+ }
1084
+ var BOARD_REFERENCE = requiredText("<board>");
1085
+ var WHITEBOARD_SUBCOMMANDS = [
1086
+ {
1087
+ name: "new",
1088
+ summary: "Create a board; this session is its creator and gets summaries of its changes",
1089
+ positionals: requiredText("<title>"),
1090
+ missingArgumentHint: "a new board needs a title, for example \"glimmervoid whiteboard new release plan\""
1091
+ },
1092
+ {
1093
+ name: "list",
1094
+ summary: "List the boards with their connected sessions"
1095
+ },
1096
+ {
1097
+ name: "connect",
1098
+ summary: "Get summaries of changes to a board in this session",
1099
+ positionals: BOARD_REFERENCE
1100
+ },
1101
+ {
1102
+ name: "disconnect",
1103
+ summary: "Stop getting summaries of changes to a board",
1104
+ positionals: BOARD_REFERENCE
1105
+ },
1106
+ {
1107
+ name: "get",
1108
+ summary: "Read a board and the changes since this session last read it",
1109
+ positionals: BOARD_REFERENCE
1110
+ },
1111
+ {
1112
+ name: "put",
1113
+ summary: "Apply a JSON op or array of ops to a board; - reads them from stdin",
1114
+ positionals: {
1115
+ usage: "<board> <ops-json|->",
1116
+ min: 2,
1117
+ max: null
1118
+ }
1119
+ },
1120
+ {
1121
+ name: "resolve",
1122
+ summary: "Mark a note on a board resolved",
1123
+ positionals: {
1124
+ usage: "<board> <note>",
1125
+ min: 2,
1126
+ max: null
1127
+ }
1128
+ }
1129
+ ];
793
1130
  var AGENT_COMMAND_HELP = Object.freeze({
794
1131
  spawn: {
795
1132
  usage: "spawn <prompt>",
1133
+ positionals: requiredText("<prompt>"),
796
1134
  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\""
1135
+ missingArgumentHint: "this command needs text, for example \"glimmervoid spawn check the failing test\""
798
1136
  },
799
1137
  send: {
800
1138
  usage: "send [child] <text>",
1139
+ positionals: requiredText("[child] <text>"),
801
1140
  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\""
1141
+ 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
1142
  },
804
1143
  read: {
805
1144
  usage: "read [child]",
1145
+ positionals: optionalText("[child]"),
806
1146
  summary: "Read what this session's spawned sessions sent; a spawned session reads its parent's messages",
807
1147
  missingArgumentHint: null
808
1148
  },
809
1149
  close: {
810
1150
  usage: "close <child>",
1151
+ positionals: requiredText("<child>"),
1152
+ options: [{
1153
+ name: "discard",
1154
+ type: "boolean",
1155
+ summary: "Close it even though it holds unpushed work, which is lost"
1156
+ }],
811
1157
  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>\""
1158
+ missingArgumentHint: "this command needs the spawned session, for example \"glimmervoid close <child>\""
813
1159
  },
814
1160
  answer: {
815
1161
  usage: "answer <child> <json>|--operator",
1162
+ positionals: {
1163
+ usage: "<child> [json]",
1164
+ min: 1,
1165
+ max: 2
1166
+ },
1167
+ options: [{
1168
+ name: "operator",
1169
+ type: "boolean",
1170
+ summary: "Pass the question to the operator instead of answering it"
1171
+ }],
816
1172
  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"
1173
+ missingArgumentHint: "this command needs a child and a JSON object of answers, or --operator"
818
1174
  },
819
1175
  attention: {
820
1176
  usage: "attention <note>",
1177
+ positionals: requiredText("<note>"),
821
1178
  summary: "Flag this session as needing the operator",
822
- missingArgumentHint: "glimmervoid attention: this command needs text, for example \"glimmervoid attention check the failing test\""
1179
+ missingArgumentHint: "this command needs text, for example \"glimmervoid attention check the failing test\""
823
1180
  },
824
1181
  board: {
825
1182
  usage: "board",
@@ -833,21 +1190,31 @@ var AGENT_COMMAND_HELP = Object.freeze({
833
1190
  },
834
1191
  edit: {
835
1192
  usage: "edit <path>",
1193
+ positionals: requiredText("<path>"),
836
1194
  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\""
1195
+ missingArgumentHint: "this command needs a file path, for example \"glimmervoid edit drafts/post.md\""
838
1196
  },
839
1197
  show: {
840
1198
  usage: "show <path>... [--caption <text>]",
1199
+ positionals: requiredText("<path>..."),
1200
+ options: [{
1201
+ name: "caption",
1202
+ type: "string",
1203
+ valueName: "text",
1204
+ summary: "A caption shown with the files"
1205
+ }],
841
1206
  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'\""
1207
+ missingArgumentHint: "this command needs a file path, for example \"glimmervoid show out/diagram.png --caption 'the new layout'\""
843
1208
  },
844
1209
  review: {
845
1210
  usage: "review <pr>",
1211
+ positionals: requiredText("<pr>"),
846
1212
  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\""
1213
+ 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
1214
  },
849
1215
  reviews: {
850
1216
  usage: "reviews [pr]",
1217
+ positionals: optionalText("[pr]"),
851
1218
  summary: "List the Reviews tab: reviews running, queued and drafted; with a pull request, read its draft in full",
852
1219
  missingArgumentHint: null
853
1220
  },
@@ -858,18 +1225,21 @@ var AGENT_COMMAND_HELP = Object.freeze({
858
1225
  },
859
1226
  "link-pr": {
860
1227
  usage: "link-pr <pr>",
1228
+ positionals: requiredText("<pr>"),
861
1229
  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\""
1230
+ missingArgumentHint: "this command needs a pull request, for example \"glimmervoid link-pr acme/app#12\""
863
1231
  },
864
1232
  settings: {
865
1233
  usage: "settings list|get",
866
1234
  summary: "Read Glimmervoid's settings; a secret shows only as configured or not",
867
- missingArgumentHint: null
1235
+ missingArgumentHint: null,
1236
+ isPassthrough: true
868
1237
  },
869
1238
  whiteboard: {
870
1239
  usage: "whiteboard new|list|connect|disconnect|get|put|resolve",
1240
+ subcommands: WHITEBOARD_SUBCOMMANDS,
871
1241
  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>\""
1242
+ missingArgumentHint: null
873
1243
  },
874
1244
  limits: {
875
1245
  usage: "limits",
@@ -878,7 +1248,19 @@ var AGENT_COMMAND_HELP = Object.freeze({
878
1248
  }
879
1249
  });
880
1250
  function agentCommandHelpLines() {
881
- return Object.values(AGENT_COMMAND_HELP).map(({ usage, summary }) => ` ${usage.padEnd(Math.max(USAGE_COLUMN_WIDTH, usage.length + 1))}${summary}`);
1251
+ return Object.values(AGENT_COMMAND_HELP).map(({ usage, summary }) => renderOverviewLine(usage, summary));
1252
+ }
1253
+ function agentCommandSpec(verb) {
1254
+ const { summary, missingArgumentHint, positionals, options, subcommands, isPassthrough } = AGENT_COMMAND_HELP[verb];
1255
+ return {
1256
+ name: verb,
1257
+ summary,
1258
+ missingArgumentHint,
1259
+ positionals,
1260
+ options,
1261
+ subcommands,
1262
+ isPassthrough
1263
+ };
882
1264
  }
883
1265
  //#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 };
1266
+ 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, isOwnedCommandName as J, 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, parseCommand as Y, 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, OWNED_COMMAND_SPECS 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 };
@@ -4,7 +4,6 @@ import { p as writeTextAtomicSync } from "./json-file-AKRVPqG1.js";
4
4
  import fs from "node:fs";
5
5
  import path from "node:path";
6
6
  //#region server/agent-setup-cli.ts
7
- var USAGE = "Usage: glimmervoid agent setup grok";
8
7
  function setupInputs(env = process.env) {
9
8
  return {
10
9
  filePath: grok.hooksFilePath(env),
@@ -110,16 +109,14 @@ function runGrokSetup({ env, fileSystem, log, error }) {
110
109
  log(`Installed Grok hooks at ${inputs.filePath}`);
111
110
  return 0;
112
111
  }
113
- function runAgentSetupCli(args, deps = {}) {
112
+ function runAgentSetupCli(deps = {}) {
114
113
  const { env = process.env, fileSystem = fs, log = console.log, error = console.error } = deps;
115
- if (args[0] === "setup" && args[1] === "grok" && args.length === 2) return runGrokSetup({
114
+ return runGrokSetup({
116
115
  env,
117
116
  fileSystem,
118
117
  log,
119
118
  error
120
119
  });
121
- error(USAGE);
122
- return 1;
123
120
  }
124
121
  //#endregion
125
122
  export { inspectGrokAgentSetup, runAgentSetupCli };
@@ -1,64 +1,63 @@
1
- import { t as AGENT_API_VERBS } from "./session-CcJLn3EZ.js";
2
1
  import { i as execFileSync } from "./child-process-safe-BCOoKfxG.js";
2
+ import { parseArgs } from "node:util";
3
3
  //#region server/core/command-line-core.ts
4
- var SUBCOMMANDS_HONORING_TRAILING_GLOBAL_OPTIONS = /* @__PURE__ */ new Set(["doctor", "pair"]);
5
- var AGENT_VERBS_HONORING_HELP_OR_VERSION = new Set(AGENT_API_VERBS);
6
- var OPTIONS_TAKING_A_VALUE = {
7
- "--config": "configPath",
8
- "--port": "port"
4
+ var GLOBAL_OPTIONS = {
5
+ config: { type: "string" },
6
+ port: { type: "string" },
7
+ help: {
8
+ type: "boolean",
9
+ short: "h"
10
+ },
11
+ version: { type: "boolean" },
12
+ doctor: { type: "boolean" },
13
+ "no-open": { type: "boolean" }
9
14
  };
10
- function scanGlobalOption(argv, index, state) {
11
- const token = argv[index];
12
- const valueKey = OPTIONS_TAKING_A_VALUE[token];
13
- if (valueKey) {
14
- const value = argv[index + 1];
15
- if (value !== void 0) state[valueKey] = value;
16
- return index + 2;
17
- }
18
- if (token === "--help" || token === "-h") state.wantsHelp = true;
19
- if (token === "--version") state.wantsVersion = true;
20
- if (token === "--doctor") state.wantsDoctor = true;
21
- if (token === "--no-open") state.wantsNoOpen = true;
22
- return index + 1;
15
+ function commandNameIndex(argv) {
16
+ const { tokens } = parseArgs({
17
+ args: [...argv],
18
+ options: GLOBAL_OPTIONS,
19
+ strict: false,
20
+ allowPositionals: true,
21
+ tokens: true
22
+ });
23
+ const firstPositional = tokens.find((token) => token.kind === "positional");
24
+ return firstPositional ? firstPositional.index : argv.length;
23
25
  }
24
- function scanTrailingGlobalOptions(subcommandArgs, state) {
25
- let index = 0;
26
- while (index < subcommandArgs.length) {
27
- if (!subcommandArgs[index].startsWith("-")) {
28
- index += 1;
29
- continue;
30
- }
31
- index = scanGlobalOption(subcommandArgs, index, state);
26
+ function parseGlobalValues(leadingArgs) {
27
+ try {
28
+ return {
29
+ ok: true,
30
+ values: parseArgs({
31
+ args: leadingArgs,
32
+ options: GLOBAL_OPTIONS,
33
+ strict: true,
34
+ allowPositionals: false
35
+ }).values
36
+ };
37
+ } catch (error) {
38
+ return {
39
+ ok: false,
40
+ text: `glimmervoid: ${error instanceof Error ? error.message : String(error)}\nRun glimmervoid --help for the commands and options.`
41
+ };
32
42
  }
33
43
  }
34
- function scanHelpOrVersionBeforeTerminator(subcommandArgs, state) {
35
- const terminatorIndex = subcommandArgs.indexOf("--");
36
- const flagArguments = terminatorIndex === -1 ? subcommandArgs : subcommandArgs.slice(0, terminatorIndex);
37
- if (flagArguments.includes("--help") || flagArguments.includes("-h")) state.wantsHelp = true;
38
- if (flagArguments.includes("--version")) state.wantsVersion = true;
39
- }
40
44
  function parseCommandLine(argv) {
41
- const state = {
42
- configPath: null,
43
- port: null,
44
- wantsHelp: false,
45
- wantsVersion: false,
46
- wantsDoctor: false,
47
- wantsNoOpen: false
45
+ const nameIndex = commandNameIndex(argv);
46
+ const parsedGlobals = parseGlobalValues(argv.slice(0, nameIndex));
47
+ if (!parsedGlobals.ok) return {
48
+ kind: "refused",
49
+ text: parsedGlobals.text
48
50
  };
49
- let index = 0;
50
- while (index < argv.length && argv[index].startsWith("-")) index = scanGlobalOption(argv, index, state);
51
- const name = argv[index];
52
- const subcommandArgs = argv.slice(index + 1);
53
- if (name !== void 0 && SUBCOMMANDS_HONORING_TRAILING_GLOBAL_OPTIONS.has(name)) scanTrailingGlobalOptions(subcommandArgs, state);
54
- if (name !== void 0 && AGENT_VERBS_HONORING_HELP_OR_VERSION.has(name)) scanHelpOrVersionBeforeTerminator(subcommandArgs, state);
55
- if (state.wantsHelp) return { kind: "help" };
56
- if (state.wantsVersion) return { kind: "version" };
51
+ const { values } = parsedGlobals;
52
+ const name = argv[nameIndex];
53
+ const subcommandArgs = argv.slice(nameIndex + 1);
54
+ if (values.help) return { kind: "help" };
55
+ if (values.version) return { kind: "version" };
57
56
  const globalOptions = {
58
- configPath: state.configPath,
59
- port: state.port
57
+ configPath: values.config ?? null,
58
+ port: values.port ?? null
60
59
  };
61
- if (state.wantsDoctor) return {
60
+ if (values.doctor) return {
62
61
  kind: "subcommand",
63
62
  name: "doctor",
64
63
  subcommandArgs: [],
@@ -67,7 +66,7 @@ function parseCommandLine(argv) {
67
66
  if (name === void 0) return {
68
67
  kind: "server",
69
68
  globalOptions,
70
- isBrowserOpenSkipped: state.wantsNoOpen
69
+ isBrowserOpenSkipped: values["no-open"] === true
71
70
  };
72
71
  return {
73
72
  kind: "subcommand",