@h-rig/cli 0.0.6-alpha.81 → 0.0.6-alpha.83
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/build-rig-binaries.js +40 -8
- package/dist/bin/rig.js +2807 -1443
- package/dist/src/app/board.js +62 -13
- package/dist/src/app-opentui/adapters/command.d.ts +2 -0
- package/dist/src/app-opentui/adapters/command.js +329 -0
- package/dist/src/app-opentui/adapters/common.js +2 -2
- package/dist/src/app-opentui/adapters/doctor.js +63 -14
- package/dist/src/app-opentui/adapters/fleet.js +84 -20
- package/dist/src/app-opentui/adapters/inbox.js +83 -19
- package/dist/src/app-opentui/adapters/init.js +87 -23
- package/dist/src/app-opentui/adapters/pi-attach.js +102 -36
- package/dist/src/app-opentui/adapters/run-detail.js +83 -19
- package/dist/src/app-opentui/adapters/server.js +100 -23
- package/dist/src/app-opentui/adapters/tasks.d.ts +11 -0
- package/dist/src/app-opentui/adapters/tasks.js +742 -94
- package/dist/src/app-opentui/bootstrap.d.ts +1 -6
- package/dist/src/app-opentui/bootstrap.js +13776 -12369
- package/dist/src/app-opentui/command-pty-host.d.ts +62 -0
- package/dist/src/app-opentui/command-pty-host.js +248 -0
- package/dist/src/app-opentui/events.js +1 -1
- package/dist/src/app-opentui/focus-manager.d.ts +14 -0
- package/dist/src/app-opentui/focus-manager.js +24 -0
- package/dist/src/app-opentui/index.js +3806 -2878
- package/dist/src/app-opentui/intent.js +154 -48
- package/dist/src/app-opentui/keymap.d.ts +20 -0
- package/dist/src/app-opentui/keymap.js +707 -0
- package/dist/src/app-opentui/launch-routing.d.ts +16 -0
- package/dist/src/app-opentui/launch-routing.js +55 -0
- package/dist/src/app-opentui/layout.js +2 -2
- package/dist/src/app-opentui/pi-host-child.js +66 -16
- package/dist/src/app-opentui/pi-pty-host.d.ts +9 -0
- package/dist/src/app-opentui/pi-pty-host.js +15 -13
- package/dist/src/app-opentui/registry.js +3228 -2396
- package/dist/src/app-opentui/render/ascii-fleet.d.ts +15 -0
- package/dist/src/app-opentui/render/ascii-fleet.js +82 -0
- package/dist/src/app-opentui/render/graphics.d.ts +1 -1
- package/dist/src/app-opentui/render/graphics.js +131 -16
- package/dist/src/app-opentui/render/image-visual-layer-worker.js +413 -958
- package/dist/src/app-opentui/render/image-visual-layer.d.ts +19 -10
- package/dist/src/app-opentui/render/image-visual-layer.js +391 -357
- package/dist/src/app-opentui/render/panel-layout.d.ts +38 -0
- package/dist/src/app-opentui/render/panel-layout.js +48 -0
- package/dist/src/app-opentui/render/panels.d.ts +2 -0
- package/dist/src/app-opentui/render/panels.js +62 -29
- package/dist/src/app-opentui/render/preloader.d.ts +10 -0
- package/dist/src/app-opentui/render/preloader.js +163 -0
- package/dist/src/app-opentui/render/scene.d.ts +3 -0
- package/dist/src/app-opentui/render/scene.js +12 -0
- package/dist/src/app-opentui/render/text.js +5 -1
- package/dist/src/app-opentui/render/type-bar.d.ts +2 -1
- package/dist/src/app-opentui/render/type-bar.js +51 -16
- package/dist/src/app-opentui/runtime-resources.d.ts +16 -0
- package/dist/src/app-opentui/runtime-resources.js +62 -0
- package/dist/src/app-opentui/runtime.js +2329 -1512
- package/dist/src/app-opentui/scenes/command.d.ts +3 -0
- package/dist/src/app-opentui/scenes/command.js +103 -0
- package/dist/src/app-opentui/scenes/doctor.d.ts +2 -1
- package/dist/src/app-opentui/scenes/doctor.js +53 -14
- package/dist/src/app-opentui/scenes/error.js +44 -14
- package/dist/src/app-opentui/scenes/fleet.js +40 -21
- package/dist/src/app-opentui/scenes/handoff.js +142 -27
- package/dist/src/app-opentui/scenes/help.js +63 -48
- package/dist/src/app-opentui/scenes/inbox.d.ts +2 -1
- package/dist/src/app-opentui/scenes/inbox.js +64 -17
- package/dist/src/app-opentui/scenes/init.d.ts +2 -1
- package/dist/src/app-opentui/scenes/init.js +62 -21
- package/dist/src/app-opentui/scenes/main.d.ts +2 -1
- package/dist/src/app-opentui/scenes/main.js +80 -24
- package/dist/src/app-opentui/scenes/run-detail.d.ts +2 -1
- package/dist/src/app-opentui/scenes/run-detail.js +39 -25
- package/dist/src/app-opentui/scenes/server.d.ts +2 -1
- package/dist/src/app-opentui/scenes/server.js +71 -20
- package/dist/src/app-opentui/scenes/tasks.js +44 -22
- package/dist/src/app-opentui/state.js +70 -30
- package/dist/src/app-opentui/terminal-capabilities.d.ts +7 -0
- package/dist/src/app-opentui/terminal-capabilities.js +15 -0
- package/dist/src/app-opentui/types.d.ts +10 -2
- package/dist/src/commands/_doctor-checks.js +62 -13
- package/dist/src/commands/_operator-view.js +63 -13
- package/dist/src/commands/_pi-frontend.js +63 -13
- package/dist/src/commands/_preflight.js +64 -14
- package/dist/src/commands/_server-client.js +82 -18
- package/dist/src/commands/_snapshot-upload.js +62 -13
- package/dist/src/commands/connect.js +7 -1
- package/dist/src/commands/doctor.js +62 -13
- package/dist/src/commands/github.js +144 -23
- package/dist/src/commands/inbox.js +62 -13
- package/dist/src/commands/init.js +82 -18
- package/dist/src/commands/inspect.js +62 -13
- package/dist/src/commands/run.js +66 -13
- package/dist/src/commands/server.js +69 -14
- package/dist/src/commands/setup.js +62 -13
- package/dist/src/commands/stats.js +62 -13
- package/dist/src/commands/task-run-driver.js +62 -13
- package/dist/src/commands/task.js +65 -14
- package/dist/src/commands.js +227 -92
- package/dist/src/index.js +234 -99
- package/package.json +8 -9
- package/dist/src/app-opentui/render/image-visual-layer-native-canvas.d.ts +0 -2
- package/dist/src/app-opentui/render/image-visual-layer-native-canvas.js +0 -1480
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
// packages/cli/src/app-opentui/intent.ts
|
|
3
3
|
var NAV_SCENES = new Map([
|
|
4
|
-
["", "
|
|
5
|
-
["main", "
|
|
6
|
-
["home", "
|
|
4
|
+
["", "main"],
|
|
5
|
+
["main", "main"],
|
|
6
|
+
["home", "main"],
|
|
7
7
|
["fleet", "fleet"],
|
|
8
8
|
["runs", "fleet"],
|
|
9
9
|
["run", "fleet"],
|
|
10
10
|
["tasks", "tasks"],
|
|
11
11
|
["task", "tasks"],
|
|
12
|
+
["inbox", "inbox"],
|
|
13
|
+
["server", "server"],
|
|
14
|
+
["init", "init"],
|
|
15
|
+
["doctor", "doctor"],
|
|
12
16
|
["help", "help"]
|
|
13
17
|
]);
|
|
14
18
|
var TASK_VIEW_COMMANDS = new Set([
|
|
@@ -30,8 +34,11 @@ var TASK_VIEW_COMMANDS = new Set([
|
|
|
30
34
|
"search",
|
|
31
35
|
"q"
|
|
32
36
|
]);
|
|
37
|
+
function isHelpCommand(command) {
|
|
38
|
+
return command === "help" || command === "--help" || command === "-h";
|
|
39
|
+
}
|
|
33
40
|
function isTaskViewCommand(command) {
|
|
34
|
-
return !command || TASK_VIEW_COMMANDS.has(command) || command.startsWith("-");
|
|
41
|
+
return !command || TASK_VIEW_COMMANDS.has(command) || command.startsWith("-") && !isHelpCommand(command);
|
|
35
42
|
}
|
|
36
43
|
function intent(scene, argv, kind, payload, label, raw) {
|
|
37
44
|
return {
|
|
@@ -45,9 +52,12 @@ function intent(scene, argv, kind, payload, label, raw) {
|
|
|
45
52
|
}
|
|
46
53
|
};
|
|
47
54
|
}
|
|
48
|
-
function
|
|
49
|
-
const command = argv.join(" ").trim()
|
|
50
|
-
return intent("
|
|
55
|
+
function commandRunIntent(argv, raw, reason) {
|
|
56
|
+
const command = argv.join(" ").trim();
|
|
57
|
+
return intent("command", argv, "command-run", { argv: [...argv], ...reason ? { reason } : {} }, command ? `Running rig ${command}` : "Running rig", raw);
|
|
58
|
+
}
|
|
59
|
+
function unsupportedPlainCliIntent(argv, raw, reason) {
|
|
60
|
+
return commandRunIntent(argv, raw, reason);
|
|
51
61
|
}
|
|
52
62
|
function firstValueAfter(args, option) {
|
|
53
63
|
const index = args.indexOf(option);
|
|
@@ -56,11 +66,54 @@ function firstValueAfter(args, option) {
|
|
|
56
66
|
function firstNonOption(args) {
|
|
57
67
|
return args.find((part) => part.trim() && !part.startsWith("-"));
|
|
58
68
|
}
|
|
59
|
-
function
|
|
60
|
-
const
|
|
61
|
-
if (
|
|
62
|
-
return
|
|
63
|
-
|
|
69
|
+
function inboxActionIntent(argv, command, rest, raw) {
|
|
70
|
+
const requestId = firstNonOption(rest);
|
|
71
|
+
if (command === "approve" || command === "approvals") {
|
|
72
|
+
return requestId ? intent("inbox", argv, "inbox-approve", { requestId }, `Approving ${requestId}`, raw) : intent("inbox", argv, "refresh", undefined, "Loading approvals", raw);
|
|
73
|
+
}
|
|
74
|
+
if (command === "reject") {
|
|
75
|
+
return requestId ? intent("inbox", argv, "inbox-reject", { requestId }, `Rejecting ${requestId}`, raw) : intent("inbox", argv, "refresh", undefined, "Loading approvals", raw);
|
|
76
|
+
}
|
|
77
|
+
if (command === "answer" || command === "inputs" || command === "respond") {
|
|
78
|
+
const answer = rest.slice(requestId ? 1 : 0).join(" ").trim();
|
|
79
|
+
return requestId && answer ? intent("inbox", argv, "inbox-answer", { requestId, answer }, `Answering ${requestId}`, raw) : intent("inbox", argv, "refresh", undefined, "Loading inbox", raw);
|
|
80
|
+
}
|
|
81
|
+
return intent("inbox", argv, "refresh", undefined, "Loading inbox", raw);
|
|
82
|
+
}
|
|
83
|
+
function parseSimpleTaskRunArgs(args) {
|
|
84
|
+
let next = false;
|
|
85
|
+
let task;
|
|
86
|
+
let detach = false;
|
|
87
|
+
for (let index = 0;index < args.length; index += 1) {
|
|
88
|
+
const arg = args[index];
|
|
89
|
+
if (arg === "next" || arg === "--next") {
|
|
90
|
+
next = true;
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
if (arg === "--detach") {
|
|
94
|
+
detach = true;
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
if (arg === "--task") {
|
|
98
|
+
const value = args[index + 1];
|
|
99
|
+
if (!value || value.startsWith("-"))
|
|
100
|
+
return { ok: false, reason: "task run --task needs an id" };
|
|
101
|
+
if (task)
|
|
102
|
+
return { ok: false, reason: "task run received more than one task id" };
|
|
103
|
+
task = value;
|
|
104
|
+
index += 1;
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
if (arg.startsWith("-")) {
|
|
108
|
+
return { ok: false, reason: `task run option ${arg} is not implemented in the shell` };
|
|
109
|
+
}
|
|
110
|
+
if (task)
|
|
111
|
+
return { ok: false, reason: "task run received more than one task id" };
|
|
112
|
+
task = arg;
|
|
113
|
+
}
|
|
114
|
+
if (next && task)
|
|
115
|
+
return { ok: false, reason: "task run cannot combine next with a task id" };
|
|
116
|
+
return { ok: true, next, ...task ? { task } : {}, detach };
|
|
64
117
|
}
|
|
65
118
|
function taskViewPayload(command, rest) {
|
|
66
119
|
const normalized = command.toLowerCase();
|
|
@@ -119,22 +172,15 @@ function intentFromArgv(argv) {
|
|
|
119
172
|
const normalizedGroup = group.toLowerCase();
|
|
120
173
|
const normalizedCommand = command.toLowerCase();
|
|
121
174
|
if (!normalizedGroup)
|
|
122
|
-
return intent("
|
|
175
|
+
return intent("main", argv, "none", undefined, "Project menu");
|
|
123
176
|
if (normalizedGroup === "--help" || normalizedGroup === "-h" || normalizedGroup === "help") {
|
|
124
177
|
return argv.length === 1 ? intent("help", argv, "none", undefined, "Help") : unsupportedPlainCliIntent(argv);
|
|
125
178
|
}
|
|
126
179
|
if (normalizedGroup === "task") {
|
|
127
|
-
if (normalizedCommand === "run")
|
|
128
|
-
|
|
129
|
-
return intent("tasks", argv, "task-run-next", undefined, "Dispatching next task");
|
|
130
|
-
}
|
|
131
|
-
const task = explicitTaskIdArg(rest);
|
|
132
|
-
if (task)
|
|
133
|
-
return intent("tasks", argv, "task-run-id", { task }, `Dispatching ${task}`);
|
|
134
|
-
return intent("tasks", argv, "refresh", undefined, "Select a task, then press Enter; or use run next");
|
|
135
|
-
}
|
|
180
|
+
if (normalizedCommand === "run" || normalizedCommand === "ready" || normalizedCommand === "status")
|
|
181
|
+
return commandRunIntent(argv);
|
|
136
182
|
if (!isTaskViewCommand(normalizedCommand))
|
|
137
|
-
return
|
|
183
|
+
return commandRunIntent(argv);
|
|
138
184
|
return taskViewIntent(argv, normalizedCommand, rest);
|
|
139
185
|
}
|
|
140
186
|
if (normalizedGroup === "tasks") {
|
|
@@ -145,54 +191,114 @@ function intentFromArgv(argv) {
|
|
|
145
191
|
if (normalizedGroup === "run") {
|
|
146
192
|
if (normalizedCommand === "attach") {
|
|
147
193
|
const runId = firstNonOption(rest);
|
|
148
|
-
|
|
194
|
+
const nativeOnly = Boolean(runId) && rest.filter((part) => part.trim()).length === 1;
|
|
195
|
+
return nativeOnly ? intent("handoff", argv, "run-attach", { runId }, `Attaching ${runId}`) : commandRunIntent(argv);
|
|
149
196
|
}
|
|
150
|
-
if (!normalizedCommand)
|
|
197
|
+
if (!normalizedCommand || normalizedCommand === "list" || normalizedCommand === "status")
|
|
151
198
|
return intent("fleet", argv, "refresh", undefined, "Loading fleet");
|
|
152
|
-
|
|
199
|
+
if (normalizedCommand === "stop") {
|
|
200
|
+
const runId = firstNonOption(rest);
|
|
201
|
+
return runId && rest.filter((part) => part.trim()).length === 1 ? intent("fleet", argv, "run-stop", { runId }, "Stopping run") : commandRunIntent(argv);
|
|
202
|
+
}
|
|
203
|
+
return commandRunIntent(argv);
|
|
204
|
+
}
|
|
205
|
+
if (normalizedGroup === "server") {
|
|
206
|
+
if (!normalizedCommand || normalizedCommand === "status")
|
|
207
|
+
return intent("server", argv, "refresh", undefined, normalizedCommand ? "Checking server" : "Loading server");
|
|
208
|
+
return unsupportedPlainCliIntent(argv, undefined, `server ${normalizedCommand} is not executed in the shell; exit and run it in plain mode.`);
|
|
209
|
+
}
|
|
210
|
+
if (normalizedGroup === "github") {
|
|
211
|
+
if (normalizedCommand === "auth" && (rest[0]?.toLowerCase() ?? "status") === "status" && rest.length <= 1) {
|
|
212
|
+
return intent("server", argv, "refresh", undefined, "Checking GitHub auth");
|
|
213
|
+
}
|
|
214
|
+
return unsupportedPlainCliIntent(argv, undefined, "github auth mutations are not executed in the shell; exit and run them in plain mode.");
|
|
215
|
+
}
|
|
216
|
+
if (normalizedGroup === "init")
|
|
217
|
+
return commandRunIntent(argv);
|
|
218
|
+
if (normalizedGroup === "doctor") {
|
|
219
|
+
return normalizedCommand ? commandRunIntent(argv) : intent("doctor", argv, "doctor-run", undefined, "Running doctor");
|
|
220
|
+
}
|
|
221
|
+
if (normalizedGroup === "inbox") {
|
|
222
|
+
if (normalizedCommand === "watch")
|
|
223
|
+
return commandRunIntent(argv);
|
|
224
|
+
if ((normalizedCommand === "approvals" || normalizedCommand === "inputs") && rest.length > 0)
|
|
225
|
+
return commandRunIntent(argv);
|
|
226
|
+
return normalizedCommand && normalizedCommand !== "approvals" && normalizedCommand !== "inputs" ? commandRunIntent(argv) : inboxActionIntent(argv, normalizedCommand, rest);
|
|
153
227
|
}
|
|
154
228
|
if (normalizedGroup === "attach") {
|
|
155
|
-
const
|
|
156
|
-
|
|
229
|
+
const attachArgs = [command, ...rest].filter((part) => part.trim());
|
|
230
|
+
const runId = firstNonOption(attachArgs);
|
|
231
|
+
return runId && attachArgs.length === 1 ? intent("handoff", argv, "run-attach", { runId }, `Attaching ${runId}`) : commandRunIntent(argv);
|
|
157
232
|
}
|
|
158
233
|
const nav = NAV_SCENES.get(normalizedGroup);
|
|
159
|
-
if (nav)
|
|
234
|
+
if (nav && argv.length === 1)
|
|
160
235
|
return intent(nav, argv, "navigate", undefined, `Opening ${nav}`);
|
|
161
|
-
return
|
|
236
|
+
return commandRunIntent(argv);
|
|
162
237
|
}
|
|
163
238
|
function intentFromTypeBar(value) {
|
|
164
239
|
const raw = value.trim();
|
|
165
240
|
if (!raw)
|
|
166
|
-
return intent("
|
|
241
|
+
return intent("main", [], "none", undefined, "Project menu", value);
|
|
167
242
|
const parts = raw.split(/\s+/).filter(Boolean);
|
|
168
243
|
const [first = "", second = "", ...rest] = parts;
|
|
169
244
|
const firstScene = NAV_SCENES.get(first.toLowerCase());
|
|
170
245
|
if (first === "tasks" || first === "task") {
|
|
171
|
-
if (second === "run")
|
|
172
|
-
|
|
173
|
-
if (rest.includes("--next") || task === "next")
|
|
174
|
-
return intent("tasks", parts, "task-run-next", undefined, "Dispatching next task", value);
|
|
175
|
-
if (task)
|
|
176
|
-
return intent("tasks", parts, "task-run-id", { task }, `Dispatching ${task}`, value);
|
|
177
|
-
return intent("tasks", parts, "refresh", undefined, "Select a task, then press Enter; or use run next", value);
|
|
178
|
-
}
|
|
246
|
+
if (second === "run" || first === "task" && (second === "ready" || second === "status"))
|
|
247
|
+
return commandRunIntent(parts, value);
|
|
179
248
|
if (!isTaskViewCommand(second.toLowerCase()))
|
|
180
|
-
return
|
|
249
|
+
return commandRunIntent(parts, value);
|
|
181
250
|
return taskViewIntent(parts, second, rest, value);
|
|
182
251
|
}
|
|
183
252
|
if (first === "run") {
|
|
184
|
-
if (second === "
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
253
|
+
if (second === "attach") {
|
|
254
|
+
const runId = firstNonOption(rest);
|
|
255
|
+
return runId && rest.filter((part) => part.trim()).length === 1 ? intent("handoff", parts, "run-attach", { runId }, "Attaching run", value) : commandRunIntent(parts, value);
|
|
256
|
+
}
|
|
257
|
+
if (second === "stop") {
|
|
258
|
+
const runId = firstNonOption(rest);
|
|
259
|
+
return runId && rest.filter((part) => part.trim()).length === 1 ? intent("fleet", parts, "run-stop", { runId }, "Stopping run", value) : commandRunIntent(parts, value);
|
|
260
|
+
}
|
|
261
|
+
if (second === "next" || second === "--next" || second === "--task") {
|
|
262
|
+
const parsed = parseSimpleTaskRunArgs([second, ...rest]);
|
|
263
|
+
if (!parsed.ok)
|
|
264
|
+
return unsupportedPlainCliIntent(parts, value, parsed.reason);
|
|
265
|
+
const payload = parsed.detach ? { detach: true } : undefined;
|
|
266
|
+
if (parsed.next)
|
|
267
|
+
return intent("tasks", parts, "task-run-next", payload, parsed.detach ? "Dispatching next task detached" : "Dispatching next task", value);
|
|
268
|
+
if (parsed.task)
|
|
269
|
+
return intent("tasks", parts, "task-run-id", { ...payload ?? {}, task: parsed.task }, parsed.detach ? `Dispatching ${parsed.task} detached` : `Dispatching ${parsed.task}`, value);
|
|
190
270
|
return intent("tasks", parts, "refresh", undefined, "Select a task, then press Enter; or use run next", value);
|
|
191
271
|
}
|
|
192
|
-
if (second && !second.startsWith("-"))
|
|
272
|
+
if (second && !second.startsWith("-")) {
|
|
273
|
+
if (rest.length > 0)
|
|
274
|
+
return unsupportedPlainCliIntent(parts, value, "run <task> options are not implemented in the shell; use task run in plain mode for advanced flags.");
|
|
193
275
|
return intent("tasks", parts, "task-run-id", { task: second }, `Dispatching ${second}`, value);
|
|
276
|
+
}
|
|
277
|
+
if (second?.startsWith("-"))
|
|
278
|
+
return unsupportedPlainCliIntent(parts, value, `run option ${second} is not implemented in the shell`);
|
|
194
279
|
return intent("tasks", parts, "refresh", undefined, "Select a task, then press Enter; or use run next", value);
|
|
195
280
|
}
|
|
281
|
+
if (first === "init")
|
|
282
|
+
return commandRunIntent(parts, value);
|
|
283
|
+
if (first === "doctor")
|
|
284
|
+
return second ? commandRunIntent(parts, value) : intent("doctor", parts, "doctor-run", undefined, "Running doctor", value);
|
|
285
|
+
if (first === "server") {
|
|
286
|
+
if (!second || second === "status")
|
|
287
|
+
return intent("server", parts, "refresh", undefined, "Loading server", value);
|
|
288
|
+
return commandRunIntent(parts, value);
|
|
289
|
+
}
|
|
290
|
+
if (first === "github") {
|
|
291
|
+
if (second === "auth" && (rest[0]?.toLowerCase() ?? "status") === "status" && rest.length <= 1)
|
|
292
|
+
return intent("server", parts, "refresh", undefined, "Checking GitHub auth", value);
|
|
293
|
+
return commandRunIntent(parts, value);
|
|
294
|
+
}
|
|
295
|
+
if (first === "inbox") {
|
|
296
|
+
if (second === "watch")
|
|
297
|
+
return commandRunIntent(parts, value);
|
|
298
|
+
if ((second === "approvals" || second === "inputs") && rest.length > 0)
|
|
299
|
+
return commandRunIntent(parts, value);
|
|
300
|
+
return second && second !== "approvals" && second !== "inputs" ? commandRunIntent(parts, value) : inboxActionIntent(parts, second, rest, value);
|
|
301
|
+
}
|
|
196
302
|
if (firstScene && parts.length === 1) {
|
|
197
303
|
return intent(firstScene, parts, "navigate", undefined, `Opening ${firstScene}`, value);
|
|
198
304
|
}
|
|
@@ -201,7 +307,7 @@ function intentFromTypeBar(value) {
|
|
|
201
307
|
if (first === "attach") {
|
|
202
308
|
if (!second)
|
|
203
309
|
return intent("handoff", parts, "navigate", undefined, "Select a run to attach", value);
|
|
204
|
-
return intent("handoff", parts, "run-attach", { runId: second }, `Attaching ${second}`, value);
|
|
310
|
+
return parts.length === 2 ? intent("handoff", parts, "run-attach", { runId: second }, `Attaching ${second}`, value) : commandRunIntent(parts, value);
|
|
205
311
|
}
|
|
206
312
|
return intentFromArgv(parts);
|
|
207
313
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { CliRenderer, KeyEvent } from "@opentui/core";
|
|
2
|
+
import type { TypeBarRenderables } from "./render/type-bar";
|
|
3
|
+
import type { AppIntent, AppRuntime, AppSceneId, AppSelectableItem, AppState } from "./types";
|
|
4
|
+
export type AppKeymapContext = {
|
|
5
|
+
readonly renderer: () => CliRenderer | null;
|
|
6
|
+
readonly runtime: AppRuntime;
|
|
7
|
+
readonly getState: () => AppState;
|
|
8
|
+
readonly getTypeBar: () => TypeBarRenderables | null;
|
|
9
|
+
readonly getRenderedSelectableItems: () => readonly AppSelectableItem[];
|
|
10
|
+
readonly emitTypeBarPatch: (patch: {
|
|
11
|
+
readonly value?: string;
|
|
12
|
+
readonly message?: string | undefined;
|
|
13
|
+
}) => void;
|
|
14
|
+
readonly runAppAction: (label: string, action: () => Promise<unknown>) => void;
|
|
15
|
+
readonly primaryNavIntent: (scene: AppSceneId) => AppIntent;
|
|
16
|
+
readonly nextPrimaryScene: (scene: AppSceneId, delta: number) => AppSceneId;
|
|
17
|
+
readonly moveSelection: (delta: number, renderedItems?: readonly AppSelectableItem[]) => boolean;
|
|
18
|
+
readonly activateSelection: (renderedItems?: readonly AppSelectableItem[]) => Promise<boolean>;
|
|
19
|
+
};
|
|
20
|
+
export declare function handleAppKeyPress(context: AppKeymapContext, key: KeyEvent): void;
|