@h-rig/cli 0.0.6-alpha.88 → 0.0.6-alpha.89

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 (70) hide show
  1. package/dist/bin/rig.js +1159 -292
  2. package/dist/src/app/board.js +462 -48
  3. package/dist/src/app-opentui/adapters/doctor.js +458 -46
  4. package/dist/src/app-opentui/adapters/family.js +670 -147
  5. package/dist/src/app-opentui/adapters/fleet.js +477 -46
  6. package/dist/src/app-opentui/adapters/inbox.js +477 -46
  7. package/dist/src/app-opentui/adapters/init.js +497 -74
  8. package/dist/src/app-opentui/adapters/inspect.js +477 -46
  9. package/dist/src/app-opentui/adapters/pi-attach.js +484 -53
  10. package/dist/src/app-opentui/adapters/run-detail.js +477 -46
  11. package/dist/src/app-opentui/adapters/server.d.ts +26 -0
  12. package/dist/src/app-opentui/adapters/server.js +676 -59
  13. package/dist/src/app-opentui/adapters/tasks.js +539 -81
  14. package/dist/src/app-opentui/autocomplete.js +4 -2
  15. package/dist/src/app-opentui/bootstrap.js +1155 -288
  16. package/dist/src/app-opentui/command-palette.js +37 -10
  17. package/dist/src/app-opentui/index.js +566 -89
  18. package/dist/src/app-opentui/intent.js +33 -8
  19. package/dist/src/app-opentui/keymap.js +43 -29
  20. package/dist/src/app-opentui/pi-host-child.js +465 -53
  21. package/dist/src/app-opentui/react/App.js +104 -44
  22. package/dist/src/app-opentui/react/ChromeHost.js +16 -4
  23. package/dist/src/app-opentui/react/launch.js +555 -88
  24. package/dist/src/app-opentui/react/nav.js +1 -1
  25. package/dist/src/app-opentui/registry.js +1062 -237
  26. package/dist/src/app-opentui/remote-link.d.ts +10 -0
  27. package/dist/src/app-opentui/remote-link.js +47 -0
  28. package/dist/src/app-opentui/runtime.js +566 -89
  29. package/dist/src/app-opentui/scenes/doctor.js +1 -1
  30. package/dist/src/app-opentui/scenes/error.js +50 -4
  31. package/dist/src/app-opentui/scenes/family.js +60 -6
  32. package/dist/src/app-opentui/scenes/fleet.js +65 -13
  33. package/dist/src/app-opentui/scenes/help.js +4 -2
  34. package/dist/src/app-opentui/scenes/init.js +12 -12
  35. package/dist/src/app-opentui/scenes/main.js +7 -7
  36. package/dist/src/app-opentui/scenes/server.js +83 -11
  37. package/dist/src/app-opentui/scenes/tasks.js +79 -16
  38. package/dist/src/app-opentui/state.js +25 -5
  39. package/dist/src/app-opentui/surface-catalog.js +4 -2
  40. package/dist/src/app-opentui/types.d.ts +1 -1
  41. package/dist/src/commands/_cli-format.d.ts +10 -1
  42. package/dist/src/commands/_cli-format.js +5 -2
  43. package/dist/src/commands/_connection-state.d.ts +11 -1
  44. package/dist/src/commands/_connection-state.js +50 -5
  45. package/dist/src/commands/_doctor-checks.js +458 -46
  46. package/dist/src/commands/_help-catalog.js +4 -2
  47. package/dist/src/commands/_json-output.js +4 -0
  48. package/dist/src/commands/_operator-view.js +465 -53
  49. package/dist/src/commands/_pi-frontend.js +465 -53
  50. package/dist/src/commands/_preflight.js +509 -72
  51. package/dist/src/commands/_server-client.d.ts +33 -0
  52. package/dist/src/commands/_server-client.js +477 -46
  53. package/dist/src/commands/_server-events.js +446 -41
  54. package/dist/src/commands/_snapshot-upload.js +460 -48
  55. package/dist/src/commands/connect.js +620 -15
  56. package/dist/src/commands/doctor.js +458 -46
  57. package/dist/src/commands/github.js +462 -50
  58. package/dist/src/commands/inbox.js +458 -46
  59. package/dist/src/commands/init.js +497 -74
  60. package/dist/src/commands/inspect.js +458 -46
  61. package/dist/src/commands/run.js +465 -53
  62. package/dist/src/commands/server.js +647 -163
  63. package/dist/src/commands/setup.js +463 -51
  64. package/dist/src/commands/stats.js +462 -48
  65. package/dist/src/commands/task-run-driver.js +464 -52
  66. package/dist/src/commands/task.js +520 -81
  67. package/dist/src/commands.js +670 -147
  68. package/dist/src/index.js +674 -147
  69. package/dist/src/launcher.js +4 -0
  70. package/package.json +8 -8
@@ -187,16 +187,31 @@ function taskViewIntent(argv, command = "", rest = [], raw) {
187
187
  const { payload, label } = taskViewPayload(command, rest);
188
188
  return intent("tasks", argv, "refresh", payload, label, raw);
189
189
  }
190
- function routeServer(argv, command, raw, checkingLabel) {
191
- if (!command || command === "status") {
190
+ function routeServer(argv, command, rest, raw, checkingLabel) {
191
+ if (!command || command === "status" || command === "list") {
192
192
  return intent("server", argv, "refresh", undefined, command ? checkingLabel : "Loading server", raw);
193
193
  }
194
+ if (command === "use") {
195
+ const alias = firstNonOption(rest);
196
+ if (alias === "local")
197
+ return intent("server", argv, "server-use-local", undefined, "Use local server", raw);
198
+ if (alias)
199
+ return intent("server", argv, "server-use-remote", { alias }, `Use ${alias}`, raw);
200
+ return intent("server", argv, "refresh", undefined, "Select a remote alias in Server", raw);
201
+ }
202
+ if (command === "add")
203
+ return intent("server", argv, "server-add-remote", { argv: [...argv] }, "Add remote server", raw);
204
+ if (command === "repair-link")
205
+ return intent("server", argv, "remote-link-repair", undefined, "Repair remote link", raw);
194
206
  return commandRunIntent(argv, raw);
195
207
  }
196
208
  function routeGithub(argv, command, rest, raw) {
197
209
  if (command === "auth" && (rest[0]?.toLowerCase() ?? "status") === "status" && rest.length <= 1) {
198
210
  return intent("server", argv, "refresh", undefined, "Checking GitHub auth", raw);
199
211
  }
212
+ if (command === "auth" && rest[0]?.toLowerCase() === "import-gh" && rest.length <= 1) {
213
+ return intent("server", argv, "github-auth-import", undefined, "Import GitHub auth", raw);
214
+ }
200
215
  return commandRunIntent(argv, raw);
201
216
  }
202
217
  function routeDoctor(argv, command, raw) {
@@ -245,11 +260,16 @@ function intentFromArgv(argv) {
245
260
  return commandRunIntent(argv);
246
261
  }
247
262
  if (normalizedGroup === "server")
248
- return routeServer(argv, normalizedCommand, undefined, "Checking server");
263
+ return routeServer(argv, normalizedCommand, rest, undefined, "Checking server");
249
264
  if (normalizedGroup === "github")
250
265
  return routeGithub(argv, normalizedCommand, rest);
251
- if (normalizedGroup === "init")
252
- return commandRunIntent(argv);
266
+ if (normalizedGroup === "init") {
267
+ if (!normalizedCommand)
268
+ return intent("init", argv, "refresh", undefined, "Open init");
269
+ if (rest.includes("--yes") || normalizedCommand === "--yes")
270
+ return intent("init", argv, "init-start", undefined, "Run init");
271
+ return intent("init", argv, "refresh", undefined, "Open init");
272
+ }
253
273
  if (normalizedGroup === "doctor")
254
274
  return routeDoctor(argv, normalizedCommand);
255
275
  if (normalizedGroup === "inbox")
@@ -312,12 +332,17 @@ function intentFromTypeBar(value) {
312
332
  return commandRunIntent(parts, value);
313
333
  return intent("tasks", parts, "refresh", undefined, "Select a task, then press Enter; or use run next", value);
314
334
  }
315
- if (first === "init")
316
- return commandRunIntent(parts, value);
335
+ if (first === "init") {
336
+ if (!second)
337
+ return intent("init", parts, "refresh", undefined, "Open init", value);
338
+ if (parts.includes("--yes"))
339
+ return intent("init", parts, "init-start", undefined, "Run init", value);
340
+ return intent("init", parts, "refresh", undefined, "Open init", value);
341
+ }
317
342
  if (first === "doctor")
318
343
  return routeDoctor(parts, second, value);
319
344
  if (first === "server")
320
- return routeServer(parts, second, value, "Loading server");
345
+ return routeServer(parts, second, rest, value, "Loading server");
321
346
  if (first === "github")
322
347
  return routeGithub(parts, second, rest, value);
323
348
  if (first === "inbox")
@@ -67,12 +67,13 @@ var PRIMARY_GROUPS = [
67
67
  {
68
68
  name: "server",
69
69
  summary: "Choose, inspect, and start the Rig server that owns tasks and runs.",
70
- usage: ["rig server <status|list|add|use|start> [options]"],
70
+ usage: ["rig server <status|list|add|use|repair-link|start> [options]"],
71
71
  commands: [
72
- { command: "status", description: "Show the selected server for this repo.", primary: true },
72
+ { command: "status", description: "Show the selected server and remote project-root link for this repo.", primary: true },
73
73
  { command: "use local", description: "Switch this repo to the local Rig server.", primary: true },
74
74
  { command: "add <alias> <url>", description: "Save a remote Rig server URL.", primary: true },
75
75
  { command: "use <alias>", description: "Select a saved remote server alias.", primary: true },
76
+ { command: "repair-link [--prepare|--backfill-only] [--repo owner/repo]", description: "Backfill or prepare the selected remote's server-host checkout link.", primary: true },
76
77
  { command: "list", description: "List saved local/remote server aliases.", primary: true },
77
78
  { command: "start [--host <host>] [--port <n>]", description: "Start a local rig-server process." }
78
79
  ],
@@ -80,6 +81,7 @@ var PRIMARY_GROUPS = [
80
81
  "rig server status",
81
82
  "rig server add prod https://where.rig-does.work",
82
83
  "rig server use prod",
84
+ "rig server repair-link --repo owner/repo",
83
85
  "rig server use local",
84
86
  "rig server start --port 3773"
85
87
  ],
@@ -976,16 +978,31 @@ function taskViewIntent(argv, command = "", rest = [], raw) {
976
978
  const { payload, label } = taskViewPayload(command, rest);
977
979
  return intent("tasks", argv, "refresh", payload, label, raw);
978
980
  }
979
- function routeServer(argv, command, raw, checkingLabel) {
980
- if (!command || command === "status") {
981
+ function routeServer(argv, command, rest, raw, checkingLabel) {
982
+ if (!command || command === "status" || command === "list") {
981
983
  return intent("server", argv, "refresh", undefined, command ? checkingLabel : "Loading server", raw);
982
984
  }
985
+ if (command === "use") {
986
+ const alias = firstNonOption(rest);
987
+ if (alias === "local")
988
+ return intent("server", argv, "server-use-local", undefined, "Use local server", raw);
989
+ if (alias)
990
+ return intent("server", argv, "server-use-remote", { alias }, `Use ${alias}`, raw);
991
+ return intent("server", argv, "refresh", undefined, "Select a remote alias in Server", raw);
992
+ }
993
+ if (command === "add")
994
+ return intent("server", argv, "server-add-remote", { argv: [...argv] }, "Add remote server", raw);
995
+ if (command === "repair-link")
996
+ return intent("server", argv, "remote-link-repair", undefined, "Repair remote link", raw);
983
997
  return commandRunIntent(argv, raw);
984
998
  }
985
999
  function routeGithub(argv, command, rest, raw) {
986
1000
  if (command === "auth" && (rest[0]?.toLowerCase() ?? "status") === "status" && rest.length <= 1) {
987
1001
  return intent("server", argv, "refresh", undefined, "Checking GitHub auth", raw);
988
1002
  }
1003
+ if (command === "auth" && rest[0]?.toLowerCase() === "import-gh" && rest.length <= 1) {
1004
+ return intent("server", argv, "github-auth-import", undefined, "Import GitHub auth", raw);
1005
+ }
989
1006
  return commandRunIntent(argv, raw);
990
1007
  }
991
1008
  function routeDoctor(argv, command, raw) {
@@ -1034,11 +1051,16 @@ function intentFromArgv(argv) {
1034
1051
  return commandRunIntent(argv);
1035
1052
  }
1036
1053
  if (normalizedGroup === "server")
1037
- return routeServer(argv, normalizedCommand, undefined, "Checking server");
1054
+ return routeServer(argv, normalizedCommand, rest, undefined, "Checking server");
1038
1055
  if (normalizedGroup === "github")
1039
1056
  return routeGithub(argv, normalizedCommand, rest);
1040
- if (normalizedGroup === "init")
1041
- return commandRunIntent(argv);
1057
+ if (normalizedGroup === "init") {
1058
+ if (!normalizedCommand)
1059
+ return intent("init", argv, "refresh", undefined, "Open init");
1060
+ if (rest.includes("--yes") || normalizedCommand === "--yes")
1061
+ return intent("init", argv, "init-start", undefined, "Run init");
1062
+ return intent("init", argv, "refresh", undefined, "Open init");
1063
+ }
1042
1064
  if (normalizedGroup === "doctor")
1043
1065
  return routeDoctor(argv, normalizedCommand);
1044
1066
  if (normalizedGroup === "inbox")
@@ -1101,12 +1123,17 @@ function intentFromTypeBar(value) {
1101
1123
  return commandRunIntent(parts, value);
1102
1124
  return intent("tasks", parts, "refresh", undefined, "Select a task, then press Enter; or use run next", value);
1103
1125
  }
1104
- if (first === "init")
1105
- return commandRunIntent(parts, value);
1126
+ if (first === "init") {
1127
+ if (!second)
1128
+ return intent("init", parts, "refresh", undefined, "Open init", value);
1129
+ if (parts.includes("--yes"))
1130
+ return intent("init", parts, "init-start", undefined, "Run init", value);
1131
+ return intent("init", parts, "refresh", undefined, "Open init", value);
1132
+ }
1106
1133
  if (first === "doctor")
1107
1134
  return routeDoctor(parts, second, value);
1108
1135
  if (first === "server")
1109
- return routeServer(parts, second, value, "Loading server");
1136
+ return routeServer(parts, second, rest, value, "Loading server");
1110
1137
  if (first === "github")
1111
1138
  return routeGithub(parts, second, rest, value);
1112
1139
  if (first === "inbox")
@@ -1124,12 +1151,6 @@ function intentFromTypeBar(value) {
1124
1151
  return intentFromArgv(parts);
1125
1152
  }
1126
1153
 
1127
- // packages/cli/src/app-opentui/pi-pty-host.ts
1128
- function getActivePiHost() {
1129
- return null;
1130
- }
1131
- function stopActivePiHost(_reason) {}
1132
-
1133
1154
  // packages/cli/src/app-opentui/keymap.ts
1134
1155
  var autocompleteState;
1135
1156
  function clearTypeBar(context, message) {
@@ -1139,22 +1160,15 @@ function clearTypeBar(context, message) {
1139
1160
  context.emitTypeBarPatch({ value: "", mode: "nav", prompt: undefined, message });
1140
1161
  }
1141
1162
  function handleEmbeddedTerminalKey(context, key) {
1142
- const state = context.getState();
1143
- const piHost = getActivePiHost();
1144
- const commandHost = getActiveCommandHost();
1145
- const host = state.scene === "handoff" ? piHost : state.scene === "command" ? commandHost : null;
1163
+ if (context.getState().scene !== "command")
1164
+ return false;
1165
+ const host = getActiveCommandHost();
1146
1166
  if (!host)
1147
1167
  return false;
1148
1168
  if (key.ctrl && key.name === "]") {
1149
- if (state.scene === "handoff") {
1150
- stopActivePiHost("operator detach");
1151
- clearTypeBar(context, "detached from Pi");
1152
- context.runAppAction("Opening runs", () => context.runtime.runIntent({ scene: "fleet", argv: ["runs"], action: { kind: "refresh", label: "Opening runs" } }));
1153
- } else {
1154
- stopActiveCommandHost("operator detach");
1155
- clearTypeBar(context, "closed command");
1156
- context.runAppAction("Project menu", () => context.runtime.runIntent({ scene: "main", argv: ["main"], action: { kind: "none", label: "Project menu" } }));
1157
- }
1169
+ stopActiveCommandHost("operator detach");
1170
+ clearTypeBar(context, "closed command");
1171
+ context.runAppAction("Project menu", () => context.runtime.runIntent({ scene: "main", argv: ["main"], action: { kind: "none", label: "Project menu" } }));
1158
1172
  return true;
1159
1173
  }
1160
1174
  const sequence = key.raw || key.sequence;