@h-rig/cli 0.0.6-alpha.83 → 0.0.6-alpha.84

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 (163) hide show
  1. package/dist/bin/rig.js +22085 -14618
  2. package/dist/src/app/board.js +155 -28
  3. package/dist/src/app-opentui/adapters/doctor.d.ts +0 -2
  4. package/dist/src/app-opentui/adapters/doctor.js +1 -25
  5. package/dist/src/app-opentui/adapters/family.d.ts +62 -0
  6. package/dist/src/app-opentui/adapters/family.js +14305 -0
  7. package/dist/src/app-opentui/adapters/fleet.d.ts +0 -2
  8. package/dist/src/app-opentui/adapters/fleet.js +6 -40
  9. package/dist/src/app-opentui/adapters/inbox.d.ts +12 -2
  10. package/dist/src/app-opentui/adapters/inbox.js +54 -59
  11. package/dist/src/app-opentui/adapters/init.d.ts +0 -2
  12. package/dist/src/app-opentui/adapters/init.js +0 -26
  13. package/dist/src/app-opentui/adapters/inspect.d.ts +52 -0
  14. package/dist/src/app-opentui/adapters/inspect.js +1024 -0
  15. package/dist/src/app-opentui/adapters/pi-attach.d.ts +15 -6
  16. package/dist/src/app-opentui/adapters/pi-attach.js +348 -93
  17. package/dist/src/app-opentui/adapters/pi.d.ts +23 -0
  18. package/dist/src/app-opentui/adapters/pi.js +363 -0
  19. package/dist/src/app-opentui/adapters/plugin.d.ts +84 -0
  20. package/dist/src/app-opentui/adapters/plugin.js +544 -0
  21. package/dist/src/app-opentui/adapters/repo.d.ts +37 -0
  22. package/dist/src/app-opentui/adapters/repo.js +186 -0
  23. package/dist/src/app-opentui/adapters/run-detail.d.ts +9 -2
  24. package/dist/src/app-opentui/adapters/run-detail.js +97 -44
  25. package/dist/src/app-opentui/adapters/server.d.ts +10 -2
  26. package/dist/src/app-opentui/adapters/server.js +96 -27
  27. package/dist/src/app-opentui/adapters/tasks.d.ts +0 -2
  28. package/dist/src/app-opentui/adapters/tasks.js +437 -105
  29. package/dist/src/app-opentui/adapters/workspace.d.ts +49 -0
  30. package/dist/src/app-opentui/adapters/workspace.js +333 -0
  31. package/dist/src/app-opentui/autocomplete.d.ts +20 -0
  32. package/dist/src/app-opentui/autocomplete.js +576 -0
  33. package/dist/src/app-opentui/bootstrap.js +24296 -16919
  34. package/dist/src/app-opentui/command-palette.d.ts +3 -0
  35. package/dist/src/app-opentui/command-palette.js +1010 -0
  36. package/dist/src/app-opentui/drone.js +8 -6
  37. package/dist/src/app-opentui/fleet-stats.d.ts +32 -0
  38. package/dist/src/app-opentui/fleet-stats.js +114 -0
  39. package/dist/src/app-opentui/index.js +3438 -1724
  40. package/dist/src/app-opentui/intent.js +71 -48
  41. package/dist/src/app-opentui/keymap.d.ts +6 -5
  42. package/dist/src/app-opentui/keymap.js +1064 -23
  43. package/dist/src/app-opentui/layout.d.ts +7 -0
  44. package/dist/src/app-opentui/layout.js +13 -6
  45. package/dist/src/app-opentui/list-search.d.ts +24 -0
  46. package/dist/src/app-opentui/list-search.js +88 -1
  47. package/dist/src/app-opentui/pi-host-child.js +33 -1
  48. package/dist/src/app-opentui/pi-pty-host.d.ts +5 -0
  49. package/dist/src/app-opentui/pi-pty-host.js +21 -3
  50. package/dist/src/app-opentui/react/App.d.ts +9 -0
  51. package/dist/src/app-opentui/react/App.js +5144 -0
  52. package/dist/src/app-opentui/react/Backdrop.d.ts +5 -0
  53. package/dist/src/app-opentui/react/Backdrop.js +1834 -0
  54. package/dist/src/app-opentui/react/ChromeHost.d.ts +5 -0
  55. package/dist/src/app-opentui/react/ChromeHost.js +2942 -0
  56. package/dist/src/app-opentui/react/SceneFrameView.d.ts +7 -0
  57. package/dist/src/app-opentui/react/SceneFrameView.js +529 -0
  58. package/dist/src/app-opentui/react/context.d.ts +17 -0
  59. package/dist/src/app-opentui/react/context.js +37 -0
  60. package/dist/src/app-opentui/react/launch.d.ts +2 -0
  61. package/dist/src/app-opentui/react/launch.js +5743 -0
  62. package/dist/src/app-opentui/react/nav.d.ts +18 -0
  63. package/dist/src/app-opentui/react/nav.js +54 -0
  64. package/dist/src/app-opentui/react/scroll.d.ts +12 -0
  65. package/dist/src/app-opentui/react/scroll.js +21 -0
  66. package/dist/src/app-opentui/react/syntax.d.ts +2 -0
  67. package/dist/src/app-opentui/react/syntax.js +64 -0
  68. package/dist/src/app-opentui/registry.js +19923 -5151
  69. package/dist/src/app-opentui/render/constants.d.ts +31 -0
  70. package/dist/src/app-opentui/render/constants.js +66 -0
  71. package/dist/src/app-opentui/render/graphics.d.ts +2 -1
  72. package/dist/src/app-opentui/render/graphics.js +106 -39
  73. package/dist/src/app-opentui/render/image-visual-layer-worker.js +108 -20
  74. package/dist/src/app-opentui/render/image-visual-layer.d.ts +7 -0
  75. package/dist/src/app-opentui/render/image-visual-layer.js +109 -20
  76. package/dist/src/app-opentui/render/native-host.d.ts +37 -0
  77. package/dist/src/app-opentui/render/native-host.js +179 -0
  78. package/dist/src/app-opentui/render/panels.js +18 -11
  79. package/dist/src/app-opentui/render/preloader.js +8 -6
  80. package/dist/src/app-opentui/render/scene.d.ts +50 -1
  81. package/dist/src/app-opentui/render/scene.js +183 -6
  82. package/dist/src/app-opentui/render/text.d.ts +7 -1
  83. package/dist/src/app-opentui/render/text.js +10 -7
  84. package/dist/src/app-opentui/render/type-bar.js +69 -30
  85. package/dist/src/app-opentui/runtime.d.ts +44 -1
  86. package/dist/src/app-opentui/runtime.js +3231 -1363
  87. package/dist/src/app-opentui/scenes/command.js +20 -6
  88. package/dist/src/app-opentui/scenes/doctor.js +176 -11
  89. package/dist/src/app-opentui/scenes/error.js +20 -10
  90. package/dist/src/app-opentui/scenes/family-domains/agent.d.ts +2 -0
  91. package/dist/src/app-opentui/scenes/family-domains/agent.js +348 -0
  92. package/dist/src/app-opentui/scenes/family-domains/browser.d.ts +2 -0
  93. package/dist/src/app-opentui/scenes/family-domains/browser.js +195 -0
  94. package/dist/src/app-opentui/scenes/family-domains/dist.d.ts +2 -0
  95. package/dist/src/app-opentui/scenes/family-domains/dist.js +243 -0
  96. package/dist/src/app-opentui/scenes/family-domains/git.d.ts +2 -0
  97. package/dist/src/app-opentui/scenes/family-domains/git.js +195 -0
  98. package/dist/src/app-opentui/scenes/family-domains/github.d.ts +2 -0
  99. package/dist/src/app-opentui/scenes/family-domains/github.js +274 -0
  100. package/dist/src/app-opentui/scenes/family-domains/harness.d.ts +2 -0
  101. package/dist/src/app-opentui/scenes/family-domains/harness.js +152 -0
  102. package/dist/src/app-opentui/scenes/family-domains/index.d.ts +4 -0
  103. package/dist/src/app-opentui/scenes/family-domains/index.js +1679 -0
  104. package/dist/src/app-opentui/scenes/family-domains/kit.d.ts +76 -0
  105. package/dist/src/app-opentui/scenes/family-domains/kit.js +305 -0
  106. package/dist/src/app-opentui/scenes/family-domains/profile.d.ts +2 -0
  107. package/dist/src/app-opentui/scenes/family-domains/profile.js +212 -0
  108. package/dist/src/app-opentui/scenes/family-domains/queue.d.ts +2 -0
  109. package/dist/src/app-opentui/scenes/family-domains/queue.js +146 -0
  110. package/dist/src/app-opentui/scenes/family-domains/remote.d.ts +2 -0
  111. package/dist/src/app-opentui/scenes/family-domains/remote.js +518 -0
  112. package/dist/src/app-opentui/scenes/family-domains/review.d.ts +2 -0
  113. package/dist/src/app-opentui/scenes/family-domains/review.js +280 -0
  114. package/dist/src/app-opentui/scenes/family-domains/setup.d.ts +2 -0
  115. package/dist/src/app-opentui/scenes/family-domains/setup.js +267 -0
  116. package/dist/src/app-opentui/scenes/family-domains/stats.d.ts +2 -0
  117. package/dist/src/app-opentui/scenes/family-domains/stats.js +370 -0
  118. package/dist/src/app-opentui/scenes/family.d.ts +3 -0
  119. package/dist/src/app-opentui/scenes/family.js +2144 -0
  120. package/dist/src/app-opentui/scenes/fleet.js +521 -31
  121. package/dist/src/app-opentui/scenes/handoff.js +204 -12
  122. package/dist/src/app-opentui/scenes/help.js +609 -40
  123. package/dist/src/app-opentui/scenes/inbox.js +278 -17
  124. package/dist/src/app-opentui/scenes/init.js +84 -39
  125. package/dist/src/app-opentui/scenes/inspect.d.ts +3 -0
  126. package/dist/src/app-opentui/scenes/inspect.js +793 -0
  127. package/dist/src/app-opentui/scenes/main.js +218 -39
  128. package/dist/src/app-opentui/scenes/pi.d.ts +3 -0
  129. package/dist/src/app-opentui/scenes/pi.js +508 -0
  130. package/dist/src/app-opentui/scenes/plugin.d.ts +3 -0
  131. package/dist/src/app-opentui/scenes/plugin.js +486 -0
  132. package/dist/src/app-opentui/scenes/repo.d.ts +3 -0
  133. package/dist/src/app-opentui/scenes/repo.js +424 -0
  134. package/dist/src/app-opentui/scenes/run-detail.js +333 -20
  135. package/dist/src/app-opentui/scenes/server.js +181 -15
  136. package/dist/src/app-opentui/scenes/tasks.js +486 -31
  137. package/dist/src/app-opentui/scenes/workspace.d.ts +3 -0
  138. package/dist/src/app-opentui/scenes/workspace.js +426 -0
  139. package/dist/src/app-opentui/selectable.d.ts +19 -0
  140. package/dist/src/app-opentui/selectable.js +79 -0
  141. package/dist/src/app-opentui/state.js +83 -30
  142. package/dist/src/app-opentui/surface-catalog.d.ts +20 -0
  143. package/dist/src/app-opentui/surface-catalog.js +540 -0
  144. package/dist/src/app-opentui/theme.d.ts +28 -6
  145. package/dist/src/app-opentui/theme.js +61 -8
  146. package/dist/src/app-opentui/types.d.ts +121 -4
  147. package/dist/src/commands/_authority-runs.d.ts +1 -1
  148. package/dist/src/commands/_authority-runs.js +2 -12
  149. package/dist/src/commands/_help-catalog.js +95 -15
  150. package/dist/src/commands/_operator-view.js +34 -2
  151. package/dist/src/commands/_pi-frontend.d.ts +2 -0
  152. package/dist/src/commands/_pi-frontend.js +34 -0
  153. package/dist/src/commands/_server-events.d.ts +26 -0
  154. package/dist/src/commands/_server-events.js +310 -0
  155. package/dist/src/commands/agent.js +2 -12
  156. package/dist/src/commands/run.js +34 -2
  157. package/dist/src/commands/server.js +2 -12
  158. package/dist/src/commands/stats.js +95 -15
  159. package/dist/src/commands/task-run-driver.js +2 -12
  160. package/dist/src/commands/task.js +131 -29
  161. package/dist/src/commands.js +192 -31
  162. package/dist/src/index.js +192 -31
  163. package/package.json +11 -9
@@ -13,6 +13,11 @@ var NAV_SCENES = new Map([
13
13
  ["server", "server"],
14
14
  ["init", "init"],
15
15
  ["doctor", "doctor"],
16
+ ["pi", "pi"],
17
+ ["plugin", "plugin"],
18
+ ["repo", "repo"],
19
+ ["workspace", "workspace"],
20
+ ["inspect", "inspect"],
16
21
  ["help", "help"]
17
22
  ]);
18
23
  var TASK_VIEW_COMMANDS = new Set([
@@ -34,6 +39,24 @@ var TASK_VIEW_COMMANDS = new Set([
34
39
  "search",
35
40
  "q"
36
41
  ]);
42
+ var HOLLOW_FAMILIES = new Set([
43
+ "browser",
44
+ "stats",
45
+ "dist",
46
+ "agent",
47
+ "queue",
48
+ "remote",
49
+ "harness",
50
+ "git",
51
+ "setup",
52
+ "profile",
53
+ "review",
54
+ "inspector",
55
+ "test"
56
+ ]);
57
+ function familyIntent(family, argv, raw) {
58
+ return intent("family", argv, "refresh", { family }, `Opening ${family}`, raw);
59
+ }
37
60
  function isHelpCommand(command) {
38
61
  return command === "help" || command === "--help" || command === "-h";
39
62
  }
@@ -56,9 +79,6 @@ function commandRunIntent(argv, raw, reason) {
56
79
  const command = argv.join(" ").trim();
57
80
  return intent("command", argv, "command-run", { argv: [...argv], ...reason ? { reason } : {} }, command ? `Running rig ${command}` : "Running rig", raw);
58
81
  }
59
- function unsupportedPlainCliIntent(argv, raw, reason) {
60
- return commandRunIntent(argv, raw, reason);
61
- }
62
82
  function firstValueAfter(args, option) {
63
83
  const index = args.indexOf(option);
64
84
  return index >= 0 ? args[index + 1] : undefined;
@@ -132,6 +152,28 @@ function taskViewIntent(argv, command = "", rest = [], raw) {
132
152
  const { payload, label } = taskViewPayload(command, rest);
133
153
  return intent("tasks", argv, "refresh", payload, label, raw);
134
154
  }
155
+ function routeServer(argv, command, raw, checkingLabel) {
156
+ if (!command || command === "status") {
157
+ return intent("server", argv, "refresh", undefined, command ? checkingLabel : "Loading server", raw);
158
+ }
159
+ return commandRunIntent(argv, raw);
160
+ }
161
+ function routeGithub(argv, command, rest, raw) {
162
+ if (command === "auth" && (rest[0]?.toLowerCase() ?? "status") === "status" && rest.length <= 1) {
163
+ return intent("server", argv, "refresh", undefined, "Checking GitHub auth", raw);
164
+ }
165
+ return commandRunIntent(argv, raw);
166
+ }
167
+ function routeDoctor(argv, command, raw) {
168
+ return command ? commandRunIntent(argv, raw) : intent("doctor", argv, "doctor-run", undefined, "Running doctor", raw);
169
+ }
170
+ function routeInbox(argv, command, rest, raw) {
171
+ if (command === "watch")
172
+ return commandRunIntent(argv, raw);
173
+ if ((command === "approvals" || command === "inputs") && rest.length > 0)
174
+ return commandRunIntent(argv, raw);
175
+ return command && command !== "approvals" && command !== "inputs" ? commandRunIntent(argv, raw) : inboxActionIntent(argv, command, rest, raw);
176
+ }
135
177
  function intentFromArgv(argv) {
136
178
  const [group = "", command = "", ...rest] = argv;
137
179
  const normalizedGroup = group.toLowerCase();
@@ -139,7 +181,7 @@ function intentFromArgv(argv) {
139
181
  if (!normalizedGroup)
140
182
  return intent("main", argv, "none", undefined, "Project menu");
141
183
  if (normalizedGroup === "--help" || normalizedGroup === "-h" || normalizedGroup === "help") {
142
- return argv.length === 1 ? intent("help", argv, "none", undefined, "Help") : unsupportedPlainCliIntent(argv);
184
+ return argv.length === 1 ? intent("help", argv, "none", undefined, "Help") : commandRunIntent(argv);
143
185
  }
144
186
  if (normalizedGroup === "task") {
145
187
  if (normalizedCommand === "run" || normalizedCommand === "ready" || normalizedCommand === "status")
@@ -150,7 +192,7 @@ function intentFromArgv(argv) {
150
192
  }
151
193
  if (normalizedGroup === "tasks") {
152
194
  if (!isTaskViewCommand(normalizedCommand))
153
- return unsupportedPlainCliIntent(argv);
195
+ return commandRunIntent(argv);
154
196
  return taskViewIntent(argv, normalizedCommand, rest);
155
197
  }
156
198
  if (normalizedGroup === "run") {
@@ -167,34 +209,26 @@ function intentFromArgv(argv) {
167
209
  }
168
210
  return commandRunIntent(argv);
169
211
  }
170
- if (normalizedGroup === "server") {
171
- if (!normalizedCommand || normalizedCommand === "status")
172
- return intent("server", argv, "refresh", undefined, normalizedCommand ? "Checking server" : "Loading server");
173
- return unsupportedPlainCliIntent(argv, undefined, `server ${normalizedCommand} is not executed in the shell; exit and run it in plain mode.`);
174
- }
175
- if (normalizedGroup === "github") {
176
- if (normalizedCommand === "auth" && (rest[0]?.toLowerCase() ?? "status") === "status" && rest.length <= 1) {
177
- return intent("server", argv, "refresh", undefined, "Checking GitHub auth");
178
- }
179
- return unsupportedPlainCliIntent(argv, undefined, "github auth mutations are not executed in the shell; exit and run them in plain mode.");
180
- }
212
+ if (normalizedGroup === "server")
213
+ return routeServer(argv, normalizedCommand, undefined, "Checking server");
214
+ if (normalizedGroup === "github")
215
+ return routeGithub(argv, normalizedCommand, rest);
181
216
  if (normalizedGroup === "init")
182
217
  return commandRunIntent(argv);
183
- if (normalizedGroup === "doctor") {
184
- return normalizedCommand ? commandRunIntent(argv) : intent("doctor", argv, "doctor-run", undefined, "Running doctor");
185
- }
186
- if (normalizedGroup === "inbox") {
187
- if (normalizedCommand === "watch")
188
- return commandRunIntent(argv);
189
- if ((normalizedCommand === "approvals" || normalizedCommand === "inputs") && rest.length > 0)
190
- return commandRunIntent(argv);
191
- return normalizedCommand && normalizedCommand !== "approvals" && normalizedCommand !== "inputs" ? commandRunIntent(argv) : inboxActionIntent(argv, normalizedCommand, rest);
192
- }
218
+ if (normalizedGroup === "doctor")
219
+ return routeDoctor(argv, normalizedCommand);
220
+ if (normalizedGroup === "inbox")
221
+ return routeInbox(argv, normalizedCommand, rest);
193
222
  if (normalizedGroup === "attach") {
194
223
  const attachArgs = [command, ...rest].filter((part) => part.trim());
195
224
  const runId = firstNonOption(attachArgs);
196
225
  return runId && attachArgs.length === 1 ? intent("handoff", argv, "run-attach", { runId }, `Attaching ${runId}`) : commandRunIntent(argv);
197
226
  }
227
+ if (HOLLOW_FAMILIES.has(normalizedGroup)) {
228
+ if (!normalizedCommand || isHelpCommand(normalizedCommand))
229
+ return familyIntent(normalizedGroup, argv);
230
+ return commandRunIntent(argv);
231
+ }
198
232
  const nav = NAV_SCENES.get(normalizedGroup);
199
233
  if (nav && argv.length === 1)
200
234
  return intent(nav, argv, "navigate", undefined, `Opening ${nav}`);
@@ -224,8 +258,10 @@ function createInitialAppState(options) {
224
258
  intent: initialIntent,
225
259
  typeBar: {
226
260
  value: "",
227
- placeholder: "runs \xB7 tasks \xB7 help \xB7 attach <run>"
261
+ placeholder: "/ search \xB7 : command \xB7 tab next \xB7 ? help",
262
+ mode: "nav"
228
263
  },
264
+ history: [],
229
265
  footer: {
230
266
  project: projectName,
231
267
  ...options.initialFooter ?? {}
@@ -271,13 +307,15 @@ function reduceAppEvent(state, event) {
271
307
  ...event.intent ? { intent: event.intent, actionLabel: event.intent.action.label } : {},
272
308
  status: "idle",
273
309
  error: undefined,
274
- typeBar: { message: undefined }
310
+ confirm: undefined,
311
+ typeBar: { message: undefined, value: "", mode: "nav", prompt: undefined }
275
312
  };
276
313
  case "action.started":
277
314
  return {
278
315
  status: "action",
279
316
  actionLabel: event.label,
280
317
  error: undefined,
318
+ confirm: undefined,
281
319
  data: event.optimistic ?? {},
282
320
  typeBar: { message: event.label }
283
321
  };
@@ -293,6 +331,7 @@ function reduceAppEvent(state, event) {
293
331
  status: "success",
294
332
  actionLabel: event.label,
295
333
  data: event.data ?? {},
334
+ dataUpdatedAtMs: Date.now(),
296
335
  typeBar: { message: `${event.label} complete` }
297
336
  };
298
337
  case "action.failed":
@@ -300,10 +339,24 @@ function reduceAppEvent(state, event) {
300
339
  status: "error",
301
340
  actionLabel: event.label,
302
341
  error: { message: event.message, hint: event.hint, cause: event.cause },
303
- typeBar: { message: event.message, placeholder: event.hint ?? "runs \xB7 tasks \xB7 help" }
342
+ typeBar: { message: event.message, placeholder: event.hint ?? "runs \xB7 tasks \xB7 help" },
343
+ data: {
344
+ optimisticRun: undefined,
345
+ pendingRunMessage: undefined,
346
+ inboxOptimistic: undefined,
347
+ dispatchingRun: undefined,
348
+ lastRefreshError: event.message
349
+ }
304
350
  };
305
351
  case "data.patch":
306
- return { data: event.data };
352
+ return { data: event.data, dataUpdatedAtMs: Date.now() };
353
+ case "confirm.request":
354
+ return {
355
+ confirm: event.confirm,
356
+ typeBar: { message: `${event.confirm.label} \u2014 enter to confirm \xB7 esc to cancel` }
357
+ };
358
+ case "confirm.cancel":
359
+ return { confirm: undefined, typeBar: { message: "cancelled" } };
307
360
  case "footer.patch":
308
361
  return { footer: event.footer };
309
362
  case "typebar.patch":
@@ -0,0 +1,20 @@
1
+ import type { AppActionKind, AppIntent, AppSceneId } from "./types";
2
+ export type TuiSurfaceAction = {
3
+ readonly id: string;
4
+ readonly family: string;
5
+ readonly label: string;
6
+ readonly detail: string;
7
+ readonly argv: readonly string[];
8
+ readonly scene: AppSceneId;
9
+ readonly kind: AppActionKind;
10
+ readonly primary?: boolean;
11
+ readonly template?: string;
12
+ /** This command needs arguments — activating it should collect them inline
13
+ * and execute, rather than opening `family --help` (#21). */
14
+ readonly needsArgs?: boolean;
15
+ /** The command words before the first placeholder, used as the base argv the
16
+ * inline-collected args are appended to. */
17
+ readonly promptArgv?: readonly string[];
18
+ };
19
+ export declare function tuiSurfaceActions(): readonly TuiSurfaceAction[];
20
+ export declare function intentForSurfaceAction(action: TuiSurfaceAction): AppIntent;