@h-rig/cli 0.0.6-alpha.89 → 0.0.6-alpha.90
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 +8 -40
- package/dist/bin/rig.js +12519 -26675
- package/dist/src/app/board.js +74 -693
- package/dist/src/app/drone-ui.js +1 -1
- package/dist/src/app/theme.js +0 -1
- package/dist/src/commands/_async-ui.js +1 -1
- package/dist/src/commands/_authority-runs.d.ts +1 -1
- package/dist/src/commands/_authority-runs.js +12 -2
- package/dist/src/commands/_cli-format.d.ts +1 -10
- package/dist/src/commands/_cli-format.js +2 -5
- package/dist/src/commands/_connection-state.d.ts +1 -11
- package/dist/src/commands/_connection-state.js +5 -50
- package/dist/src/commands/_doctor-checks.js +40 -501
- package/dist/src/commands/_help-catalog.js +17 -99
- package/dist/src/commands/_json-output.js +0 -4
- package/dist/src/commands/_operator-view.js +54 -575
- package/dist/src/commands/_pi-frontend.d.ts +0 -27
- package/dist/src/commands/_pi-frontend.js +52 -576
- package/dist/src/commands/_preflight.js +66 -553
- package/dist/src/commands/_server-client.d.ts +0 -33
- package/dist/src/commands/_server-client.js +46 -541
- package/dist/src/commands/_snapshot-upload.js +42 -503
- package/dist/src/commands/_spinner.js +1 -1
- package/dist/src/commands/agent.js +12 -2
- package/dist/src/commands/browser.js +1 -1
- package/dist/src/commands/connect.js +15 -626
- package/dist/src/commands/doctor.js +41 -502
- package/dist/src/commands/github.js +51 -584
- package/dist/src/commands/inbox.js +41 -502
- package/dist/src/commands/init.js +74 -561
- package/dist/src/commands/inspect.js +41 -502
- package/dist/src/commands/run.js +54 -578
- package/dist/src/commands/server.js +163 -692
- package/dist/src/commands/setup.js +46 -507
- package/dist/src/commands/stats.js +58 -601
- package/dist/src/commands/task-run-driver.js +58 -509
- package/dist/src/commands/task.js +110 -729
- package/dist/src/commands.js +237 -1112
- package/dist/src/index.js +244 -1123
- package/dist/src/launcher.js +0 -4
- package/package.json +9 -13
- package/dist/src/app-opentui/adapters/command.d.ts +0 -2
- package/dist/src/app-opentui/adapters/command.js +0 -329
- package/dist/src/app-opentui/adapters/common.d.ts +0 -56
- package/dist/src/app-opentui/adapters/common.js +0 -153
- package/dist/src/app-opentui/adapters/doctor.d.ts +0 -9
- package/dist/src/app-opentui/adapters/doctor.js +0 -1217
- package/dist/src/app-opentui/adapters/family.d.ts +0 -62
- package/dist/src/app-opentui/adapters/family.js +0 -14855
- package/dist/src/app-opentui/adapters/fleet.d.ts +0 -14
- package/dist/src/app-opentui/adapters/fleet.js +0 -1335
- package/dist/src/app-opentui/adapters/inbox.d.ts +0 -43
- package/dist/src/app-opentui/adapters/inbox.js +0 -1944
- package/dist/src/app-opentui/adapters/init.d.ts +0 -11
- package/dist/src/app-opentui/adapters/init.js +0 -2818
- package/dist/src/app-opentui/adapters/inspect.d.ts +0 -52
- package/dist/src/app-opentui/adapters/inspect.js +0 -1455
- package/dist/src/app-opentui/adapters/pi-attach.d.ts +0 -32
- package/dist/src/app-opentui/adapters/pi-attach.js +0 -2101
- package/dist/src/app-opentui/adapters/pi.d.ts +0 -23
- package/dist/src/app-opentui/adapters/pi.js +0 -363
- package/dist/src/app-opentui/adapters/plugin.d.ts +0 -84
- package/dist/src/app-opentui/adapters/plugin.js +0 -544
- package/dist/src/app-opentui/adapters/repo.d.ts +0 -37
- package/dist/src/app-opentui/adapters/repo.js +0 -186
- package/dist/src/app-opentui/adapters/run-detail.d.ts +0 -27
- package/dist/src/app-opentui/adapters/run-detail.js +0 -1441
- package/dist/src/app-opentui/adapters/server.d.ts +0 -48
- package/dist/src/app-opentui/adapters/server.js +0 -1561
- package/dist/src/app-opentui/adapters/tasks.d.ts +0 -64
- package/dist/src/app-opentui/adapters/tasks.js +0 -4524
- package/dist/src/app-opentui/adapters/workspace.d.ts +0 -49
- package/dist/src/app-opentui/adapters/workspace.js +0 -333
- package/dist/src/app-opentui/autocomplete.d.ts +0 -20
- package/dist/src/app-opentui/autocomplete.js +0 -578
- package/dist/src/app-opentui/bootstrap.d.ts +0 -11
- package/dist/src/app-opentui/bootstrap.js +0 -27833
- package/dist/src/app-opentui/command-palette.d.ts +0 -3
- package/dist/src/app-opentui/command-palette.js +0 -1038
- package/dist/src/app-opentui/command-pty-host.d.ts +0 -62
- package/dist/src/app-opentui/command-pty-host.js +0 -248
- package/dist/src/app-opentui/drone.d.ts +0 -12
- package/dist/src/app-opentui/drone.js +0 -230
- package/dist/src/app-opentui/events.d.ts +0 -7
- package/dist/src/app-opentui/events.js +0 -28
- package/dist/src/app-opentui/fleet-stats.d.ts +0 -32
- package/dist/src/app-opentui/fleet-stats.js +0 -114
- package/dist/src/app-opentui/focus-manager.d.ts +0 -14
- package/dist/src/app-opentui/focus-manager.js +0 -24
- package/dist/src/app-opentui/index.d.ts +0 -8
- package/dist/src/app-opentui/index.js +0 -5260
- package/dist/src/app-opentui/intent.d.ts +0 -3
- package/dist/src/app-opentui/intent.js +0 -365
- package/dist/src/app-opentui/keymap.d.ts +0 -21
- package/dist/src/app-opentui/keymap.js +0 -1377
- package/dist/src/app-opentui/launch-routing.d.ts +0 -16
- package/dist/src/app-opentui/launch-routing.js +0 -55
- package/dist/src/app-opentui/layout.d.ts +0 -22
- package/dist/src/app-opentui/layout.js +0 -51
- package/dist/src/app-opentui/list-search.d.ts +0 -36
- package/dist/src/app-opentui/list-search.js +0 -130
- package/dist/src/app-opentui/pi-host-child.d.ts +0 -2
- package/dist/src/app-opentui/pi-host-child.js +0 -1299
- package/dist/src/app-opentui/pi-pty-host.d.ts +0 -28
- package/dist/src/app-opentui/pi-pty-host.js +0 -10
- package/dist/src/app-opentui/react/App.d.ts +0 -9
- package/dist/src/app-opentui/react/App.js +0 -3866
- package/dist/src/app-opentui/react/Backdrop.d.ts +0 -5
- package/dist/src/app-opentui/react/Backdrop.js +0 -823
- package/dist/src/app-opentui/react/ChromeHost.d.ts +0 -5
- package/dist/src/app-opentui/react/ChromeHost.js +0 -1539
- package/dist/src/app-opentui/react/SceneFrameView.d.ts +0 -7
- package/dist/src/app-opentui/react/SceneFrameView.js +0 -579
- package/dist/src/app-opentui/react/context.d.ts +0 -17
- package/dist/src/app-opentui/react/context.js +0 -37
- package/dist/src/app-opentui/react/launch.d.ts +0 -2
- package/dist/src/app-opentui/react/launch.js +0 -4897
- package/dist/src/app-opentui/react/nav.d.ts +0 -18
- package/dist/src/app-opentui/react/nav.js +0 -54
- package/dist/src/app-opentui/react/scroll.d.ts +0 -12
- package/dist/src/app-opentui/react/scroll.js +0 -21
- package/dist/src/app-opentui/react/syntax.d.ts +0 -2
- package/dist/src/app-opentui/react/syntax.js +0 -65
- package/dist/src/app-opentui/registry.d.ts +0 -4
- package/dist/src/app-opentui/registry.js +0 -22876
- package/dist/src/app-opentui/remote-link.d.ts +0 -10
- package/dist/src/app-opentui/remote-link.js +0 -47
- package/dist/src/app-opentui/render/ascii-fleet.d.ts +0 -15
- package/dist/src/app-opentui/render/ascii-fleet.js +0 -82
- package/dist/src/app-opentui/render/constants.d.ts +0 -30
- package/dist/src/app-opentui/render/constants.js +0 -64
- package/dist/src/app-opentui/render/graphics.d.ts +0 -40
- package/dist/src/app-opentui/render/graphics.js +0 -713
- package/dist/src/app-opentui/render/hover.d.ts +0 -11
- package/dist/src/app-opentui/render/hover.js +0 -34
- package/dist/src/app-opentui/render/native-host.d.ts +0 -37
- package/dist/src/app-opentui/render/native-host.js +0 -180
- package/dist/src/app-opentui/render/panel-layout.d.ts +0 -38
- package/dist/src/app-opentui/render/panel-layout.js +0 -48
- package/dist/src/app-opentui/render/panels.d.ts +0 -12
- package/dist/src/app-opentui/render/panels.js +0 -288
- package/dist/src/app-opentui/render/preloader.d.ts +0 -10
- package/dist/src/app-opentui/render/preloader.js +0 -166
- package/dist/src/app-opentui/render/scene.d.ts +0 -68
- package/dist/src/app-opentui/render/scene.js +0 -300
- package/dist/src/app-opentui/render/terminal-handoff.d.ts +0 -16
- package/dist/src/app-opentui/render/terminal-handoff.js +0 -14
- package/dist/src/app-opentui/render/text.d.ts +0 -29
- package/dist/src/app-opentui/render/text.js +0 -177
- package/dist/src/app-opentui/render/type-bar.d.ts +0 -15
- package/dist/src/app-opentui/render/type-bar.js +0 -212
- package/dist/src/app-opentui/runtime-resources.d.ts +0 -16
- package/dist/src/app-opentui/runtime-resources.js +0 -62
- package/dist/src/app-opentui/runtime.d.ts +0 -45
- package/dist/src/app-opentui/runtime.js +0 -5232
- package/dist/src/app-opentui/scenes/command.d.ts +0 -3
- package/dist/src/app-opentui/scenes/command.js +0 -118
- package/dist/src/app-opentui/scenes/doctor.d.ts +0 -3
- package/dist/src/app-opentui/scenes/doctor.js +0 -296
- package/dist/src/app-opentui/scenes/error.d.ts +0 -2
- package/dist/src/app-opentui/scenes/error.js +0 -277
- package/dist/src/app-opentui/scenes/family-domains/agent.d.ts +0 -2
- package/dist/src/app-opentui/scenes/family-domains/agent.js +0 -349
- package/dist/src/app-opentui/scenes/family-domains/browser.d.ts +0 -2
- package/dist/src/app-opentui/scenes/family-domains/browser.js +0 -196
- package/dist/src/app-opentui/scenes/family-domains/dist.d.ts +0 -2
- package/dist/src/app-opentui/scenes/family-domains/dist.js +0 -244
- package/dist/src/app-opentui/scenes/family-domains/git.d.ts +0 -2
- package/dist/src/app-opentui/scenes/family-domains/git.js +0 -196
- package/dist/src/app-opentui/scenes/family-domains/github.d.ts +0 -2
- package/dist/src/app-opentui/scenes/family-domains/github.js +0 -275
- package/dist/src/app-opentui/scenes/family-domains/harness.d.ts +0 -2
- package/dist/src/app-opentui/scenes/family-domains/harness.js +0 -153
- package/dist/src/app-opentui/scenes/family-domains/index.d.ts +0 -4
- package/dist/src/app-opentui/scenes/family-domains/index.js +0 -1680
- package/dist/src/app-opentui/scenes/family-domains/kit.d.ts +0 -76
- package/dist/src/app-opentui/scenes/family-domains/kit.js +0 -306
- package/dist/src/app-opentui/scenes/family-domains/profile.d.ts +0 -2
- package/dist/src/app-opentui/scenes/family-domains/profile.js +0 -213
- package/dist/src/app-opentui/scenes/family-domains/queue.d.ts +0 -2
- package/dist/src/app-opentui/scenes/family-domains/queue.js +0 -147
- package/dist/src/app-opentui/scenes/family-domains/remote.d.ts +0 -2
- package/dist/src/app-opentui/scenes/family-domains/remote.js +0 -519
- package/dist/src/app-opentui/scenes/family-domains/review.d.ts +0 -2
- package/dist/src/app-opentui/scenes/family-domains/review.js +0 -281
- package/dist/src/app-opentui/scenes/family-domains/setup.d.ts +0 -2
- package/dist/src/app-opentui/scenes/family-domains/setup.js +0 -268
- package/dist/src/app-opentui/scenes/family-domains/stats.d.ts +0 -2
- package/dist/src/app-opentui/scenes/family-domains/stats.js +0 -371
- package/dist/src/app-opentui/scenes/family.d.ts +0 -3
- package/dist/src/app-opentui/scenes/family.js +0 -2199
- package/dist/src/app-opentui/scenes/fleet.d.ts +0 -3
- package/dist/src/app-opentui/scenes/fleet.js +0 -766
- package/dist/src/app-opentui/scenes/handoff.d.ts +0 -2
- package/dist/src/app-opentui/scenes/handoff.js +0 -455
- package/dist/src/app-opentui/scenes/help.d.ts +0 -3
- package/dist/src/app-opentui/scenes/help.js +0 -725
- package/dist/src/app-opentui/scenes/inbox.d.ts +0 -3
- package/dist/src/app-opentui/scenes/inbox.js +0 -427
- package/dist/src/app-opentui/scenes/init.d.ts +0 -3
- package/dist/src/app-opentui/scenes/init.js +0 -181
- package/dist/src/app-opentui/scenes/inspect.d.ts +0 -3
- package/dist/src/app-opentui/scenes/inspect.js +0 -794
- package/dist/src/app-opentui/scenes/main.d.ts +0 -3
- package/dist/src/app-opentui/scenes/main.js +0 -332
- package/dist/src/app-opentui/scenes/pi.d.ts +0 -3
- package/dist/src/app-opentui/scenes/pi.js +0 -509
- package/dist/src/app-opentui/scenes/plugin.d.ts +0 -3
- package/dist/src/app-opentui/scenes/plugin.js +0 -487
- package/dist/src/app-opentui/scenes/repo.d.ts +0 -3
- package/dist/src/app-opentui/scenes/repo.js +0 -425
- package/dist/src/app-opentui/scenes/run-detail.d.ts +0 -3
- package/dist/src/app-opentui/scenes/run-detail.js +0 -467
- package/dist/src/app-opentui/scenes/server.d.ts +0 -3
- package/dist/src/app-opentui/scenes/server.js +0 -378
- package/dist/src/app-opentui/scenes/tasks.d.ts +0 -3
- package/dist/src/app-opentui/scenes/tasks.js +0 -768
- package/dist/src/app-opentui/scenes/workspace.d.ts +0 -3
- package/dist/src/app-opentui/scenes/workspace.js +0 -427
- package/dist/src/app-opentui/selectable.d.ts +0 -19
- package/dist/src/app-opentui/selectable.js +0 -80
- package/dist/src/app-opentui/state.d.ts +0 -4
- package/dist/src/app-opentui/state.js +0 -399
- package/dist/src/app-opentui/surface-catalog.d.ts +0 -20
- package/dist/src/app-opentui/surface-catalog.js +0 -542
- package/dist/src/app-opentui/theme.d.ts +0 -59
- package/dist/src/app-opentui/theme.js +0 -142
- package/dist/src/app-opentui/types.d.ts +0 -313
- package/dist/src/app-opentui/types.js +0 -1
- package/dist/src/commands/_server-events.d.ts +0 -26
- package/dist/src/commands/_server-events.js +0 -715
|
@@ -1,365 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
// packages/cli/src/app-opentui/intent.ts
|
|
3
|
-
var NAV_SCENES = new Map([
|
|
4
|
-
["", "main"],
|
|
5
|
-
["main", "main"],
|
|
6
|
-
["home", "main"],
|
|
7
|
-
["fleet", "fleet"],
|
|
8
|
-
["runs", "fleet"],
|
|
9
|
-
["run", "fleet"],
|
|
10
|
-
["tasks", "tasks"],
|
|
11
|
-
["task", "tasks"],
|
|
12
|
-
["inbox", "inbox"],
|
|
13
|
-
["server", "server"],
|
|
14
|
-
["init", "init"],
|
|
15
|
-
["doctor", "doctor"],
|
|
16
|
-
["pi", "pi"],
|
|
17
|
-
["plugin", "plugin"],
|
|
18
|
-
["repo", "repo"],
|
|
19
|
-
["workspace", "workspace"],
|
|
20
|
-
["inspect", "inspect"],
|
|
21
|
-
["help", "help"]
|
|
22
|
-
]);
|
|
23
|
-
var TASK_VIEW_COMMANDS = new Set([
|
|
24
|
-
"",
|
|
25
|
-
"all",
|
|
26
|
-
"open",
|
|
27
|
-
"ready",
|
|
28
|
-
"blocked",
|
|
29
|
-
"closed",
|
|
30
|
-
"done",
|
|
31
|
-
"mine",
|
|
32
|
-
"me",
|
|
33
|
-
"sort",
|
|
34
|
-
"status",
|
|
35
|
-
"state",
|
|
36
|
-
"assignee",
|
|
37
|
-
"assigned",
|
|
38
|
-
"label",
|
|
39
|
-
"search",
|
|
40
|
-
"q"
|
|
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
|
-
}
|
|
60
|
-
function isHelpCommand(command) {
|
|
61
|
-
return command === "help" || command === "--help" || command === "-h";
|
|
62
|
-
}
|
|
63
|
-
function isTaskViewCommand(command) {
|
|
64
|
-
return !command || TASK_VIEW_COMMANDS.has(command) || command.startsWith("-") && !isHelpCommand(command);
|
|
65
|
-
}
|
|
66
|
-
function intent(scene, argv, kind, payload, label, raw) {
|
|
67
|
-
return {
|
|
68
|
-
scene,
|
|
69
|
-
argv,
|
|
70
|
-
...raw ? { raw } : {},
|
|
71
|
-
action: {
|
|
72
|
-
kind,
|
|
73
|
-
...label ? { label } : {},
|
|
74
|
-
...payload ? { payload } : {}
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
function commandRunIntent(argv, raw, reason) {
|
|
79
|
-
const command = argv.join(" ").trim();
|
|
80
|
-
return intent("command", argv, "command-run", { argv: [...argv], ...reason ? { reason } : {} }, command ? `Running rig ${command}` : "Running rig", raw);
|
|
81
|
-
}
|
|
82
|
-
function firstValueAfter(args, option) {
|
|
83
|
-
const index = args.indexOf(option);
|
|
84
|
-
return index >= 0 ? args[index + 1] : undefined;
|
|
85
|
-
}
|
|
86
|
-
function firstNonOption(args) {
|
|
87
|
-
return args.find((part) => part.trim() && !part.startsWith("-"));
|
|
88
|
-
}
|
|
89
|
-
function inboxActionIntent(argv, command, rest, raw) {
|
|
90
|
-
const requestId = firstNonOption(rest);
|
|
91
|
-
if (command === "approve" || command === "approvals") {
|
|
92
|
-
return requestId ? intent("inbox", argv, "inbox-approve", { requestId }, `Approving ${requestId}`, raw) : intent("inbox", argv, "refresh", undefined, "Loading approvals", raw);
|
|
93
|
-
}
|
|
94
|
-
if (command === "reject") {
|
|
95
|
-
return requestId ? intent("inbox", argv, "inbox-reject", { requestId }, `Rejecting ${requestId}`, raw) : intent("inbox", argv, "refresh", undefined, "Loading approvals", raw);
|
|
96
|
-
}
|
|
97
|
-
if (command === "answer" || command === "inputs" || command === "respond") {
|
|
98
|
-
const answer = rest.slice(requestId ? 1 : 0).join(" ").trim();
|
|
99
|
-
return requestId && answer ? intent("inbox", argv, "inbox-answer", { requestId, answer }, `Answering ${requestId}`, raw) : intent("inbox", argv, "refresh", undefined, "Loading inbox", raw);
|
|
100
|
-
}
|
|
101
|
-
return intent("inbox", argv, "refresh", undefined, "Loading inbox", raw);
|
|
102
|
-
}
|
|
103
|
-
function parseSimpleTaskRunArgs(args) {
|
|
104
|
-
let next = false;
|
|
105
|
-
let task;
|
|
106
|
-
let detach = false;
|
|
107
|
-
for (let index = 0;index < args.length; index += 1) {
|
|
108
|
-
const arg = args[index];
|
|
109
|
-
if (arg === "next" || arg === "--next") {
|
|
110
|
-
next = true;
|
|
111
|
-
continue;
|
|
112
|
-
}
|
|
113
|
-
if (arg === "--detach") {
|
|
114
|
-
detach = true;
|
|
115
|
-
continue;
|
|
116
|
-
}
|
|
117
|
-
if (arg === "--task") {
|
|
118
|
-
const value = args[index + 1];
|
|
119
|
-
if (!value || value.startsWith("-"))
|
|
120
|
-
return { ok: false, reason: "task run --task needs an id" };
|
|
121
|
-
if (task)
|
|
122
|
-
return { ok: false, reason: "task run received more than one task id" };
|
|
123
|
-
task = value;
|
|
124
|
-
index += 1;
|
|
125
|
-
continue;
|
|
126
|
-
}
|
|
127
|
-
if (arg.startsWith("-")) {
|
|
128
|
-
return { ok: false, reason: `task run option ${arg} uses the command workspace` };
|
|
129
|
-
}
|
|
130
|
-
if (task)
|
|
131
|
-
return { ok: false, reason: "task run received more than one task id" };
|
|
132
|
-
task = arg;
|
|
133
|
-
}
|
|
134
|
-
if (next && task)
|
|
135
|
-
return { ok: false, reason: "task run cannot combine next with a task id" };
|
|
136
|
-
return { ok: true, next, ...task ? { task } : {}, detach };
|
|
137
|
-
}
|
|
138
|
-
function taskViewPayload(command, rest) {
|
|
139
|
-
const normalized = command.toLowerCase();
|
|
140
|
-
const args = command ? [command, ...rest] : rest;
|
|
141
|
-
const sort = firstValueAfter(args, "--sort") ?? firstValueAfter(args, "-s");
|
|
142
|
-
const state = firstValueAfter(args, "--state");
|
|
143
|
-
const status = firstValueAfter(args, "--status");
|
|
144
|
-
const assignee = firstValueAfter(args, "--assignee") ?? firstValueAfter(args, "--assigned");
|
|
145
|
-
const label = firstValueAfter(args, "--label");
|
|
146
|
-
const search = firstValueAfter(args, "--search") ?? firstValueAfter(args, "-q");
|
|
147
|
-
const optionPayload = {
|
|
148
|
-
...sort ? { taskSort: sort } : {},
|
|
149
|
-
...state ? { taskState: state, taskFilterPreset: "custom" } : {},
|
|
150
|
-
...status ? { taskStatus: status, taskFilterPreset: "custom" } : {},
|
|
151
|
-
...assignee ? { taskAssignee: assignee, taskFilterPreset: "custom" } : {},
|
|
152
|
-
...label ? { taskLabel: label, taskFilterPreset: "custom" } : {},
|
|
153
|
-
...search ? { taskSearch: search, taskFilterPreset: "custom" } : {}
|
|
154
|
-
};
|
|
155
|
-
if (normalized === "sort") {
|
|
156
|
-
const value = firstNonOption(rest) ?? sort ?? "priority";
|
|
157
|
-
return { payload: { ...optionPayload, taskSort: value }, label: `Sorting tasks by ${value}` };
|
|
158
|
-
}
|
|
159
|
-
if (normalized === "status") {
|
|
160
|
-
const value = firstNonOption(rest) ?? status ?? "open";
|
|
161
|
-
return { payload: { ...optionPayload, taskStatus: value, taskFilterPreset: "custom" }, label: `Filtering tasks by status ${value}` };
|
|
162
|
-
}
|
|
163
|
-
if (normalized === "state") {
|
|
164
|
-
const value = firstNonOption(rest) ?? state ?? "open";
|
|
165
|
-
return { payload: { ...optionPayload, taskState: value, taskFilterPreset: "custom" }, label: `Filtering tasks by state ${value}` };
|
|
166
|
-
}
|
|
167
|
-
if (normalized === "assignee" || normalized === "assigned" || normalized === "mine" || normalized === "me") {
|
|
168
|
-
const value = normalized === "mine" || normalized === "me" ? "me" : firstNonOption(rest) ?? assignee ?? "me";
|
|
169
|
-
return { payload: { ...optionPayload, taskAssignee: value, taskState: "open", taskFilterPreset: value === "me" ? "mine" : "custom" }, label: value === "me" ? "Filtering my tasks" : `Filtering tasks for ${value}` };
|
|
170
|
-
}
|
|
171
|
-
if (normalized === "label") {
|
|
172
|
-
const value = firstNonOption(rest) ?? label;
|
|
173
|
-
return { payload: { ...optionPayload, ...value ? { taskLabel: value } : {}, taskFilterPreset: "custom" }, label: value ? `Filtering tasks labeled ${value}` : "Filtering tasks by label" };
|
|
174
|
-
}
|
|
175
|
-
if (normalized === "search" || normalized === "q") {
|
|
176
|
-
const value = rest.join(" ").trim() || search;
|
|
177
|
-
return { payload: { ...optionPayload, ...value ? { taskSearch: value } : {}, taskFilterPreset: "custom" }, label: value ? `Searching tasks for ${value}` : "Searching tasks" };
|
|
178
|
-
}
|
|
179
|
-
if (["all", "open", "ready", "blocked", "closed", "done"].includes(normalized)) {
|
|
180
|
-
return { payload: { ...optionPayload, taskFilterPreset: normalized === "done" ? "closed" : normalized }, label: `Filtering tasks: ${normalized}` };
|
|
181
|
-
}
|
|
182
|
-
if (Object.keys(optionPayload).length > 0)
|
|
183
|
-
return { payload: optionPayload, label: "Filtering tasks" };
|
|
184
|
-
return { label: "Loading tasks" };
|
|
185
|
-
}
|
|
186
|
-
function taskViewIntent(argv, command = "", rest = [], raw) {
|
|
187
|
-
const { payload, label } = taskViewPayload(command, rest);
|
|
188
|
-
return intent("tasks", argv, "refresh", payload, label, raw);
|
|
189
|
-
}
|
|
190
|
-
function routeServer(argv, command, rest, raw, checkingLabel) {
|
|
191
|
-
if (!command || command === "status" || command === "list") {
|
|
192
|
-
return intent("server", argv, "refresh", undefined, command ? checkingLabel : "Loading server", raw);
|
|
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);
|
|
206
|
-
return commandRunIntent(argv, raw);
|
|
207
|
-
}
|
|
208
|
-
function routeGithub(argv, command, rest, raw) {
|
|
209
|
-
if (command === "auth" && (rest[0]?.toLowerCase() ?? "status") === "status" && rest.length <= 1) {
|
|
210
|
-
return intent("server", argv, "refresh", undefined, "Checking GitHub auth", raw);
|
|
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
|
-
}
|
|
215
|
-
return commandRunIntent(argv, raw);
|
|
216
|
-
}
|
|
217
|
-
function routeDoctor(argv, command, raw) {
|
|
218
|
-
return command ? commandRunIntent(argv, raw) : intent("doctor", argv, "doctor-run", undefined, "Running doctor", raw);
|
|
219
|
-
}
|
|
220
|
-
function routeInbox(argv, command, rest, raw) {
|
|
221
|
-
if (command === "watch")
|
|
222
|
-
return commandRunIntent(argv, raw);
|
|
223
|
-
if ((command === "approvals" || command === "inputs") && rest.length > 0)
|
|
224
|
-
return commandRunIntent(argv, raw);
|
|
225
|
-
return command && command !== "approvals" && command !== "inputs" ? commandRunIntent(argv, raw) : inboxActionIntent(argv, command, rest, raw);
|
|
226
|
-
}
|
|
227
|
-
function intentFromArgv(argv) {
|
|
228
|
-
const [group = "", command = "", ...rest] = argv;
|
|
229
|
-
const normalizedGroup = group.toLowerCase();
|
|
230
|
-
const normalizedCommand = command.toLowerCase();
|
|
231
|
-
if (!normalizedGroup)
|
|
232
|
-
return intent("main", argv, "none", undefined, "Project menu");
|
|
233
|
-
if (normalizedGroup === "--help" || normalizedGroup === "-h" || normalizedGroup === "help") {
|
|
234
|
-
return argv.length === 1 ? intent("help", argv, "none", undefined, "Help") : commandRunIntent(argv);
|
|
235
|
-
}
|
|
236
|
-
if (normalizedGroup === "task") {
|
|
237
|
-
if (normalizedCommand === "run" || normalizedCommand === "ready" || normalizedCommand === "status")
|
|
238
|
-
return commandRunIntent(argv);
|
|
239
|
-
if (!isTaskViewCommand(normalizedCommand))
|
|
240
|
-
return commandRunIntent(argv);
|
|
241
|
-
return taskViewIntent(argv, normalizedCommand, rest);
|
|
242
|
-
}
|
|
243
|
-
if (normalizedGroup === "tasks") {
|
|
244
|
-
if (!isTaskViewCommand(normalizedCommand))
|
|
245
|
-
return commandRunIntent(argv);
|
|
246
|
-
return taskViewIntent(argv, normalizedCommand, rest);
|
|
247
|
-
}
|
|
248
|
-
if (normalizedGroup === "run") {
|
|
249
|
-
if (normalizedCommand === "attach") {
|
|
250
|
-
const runId = firstNonOption(rest);
|
|
251
|
-
const nativeOnly = Boolean(runId) && rest.filter((part) => part.trim()).length === 1;
|
|
252
|
-
return nativeOnly ? intent("handoff", argv, "run-attach", { runId }, `Attaching ${runId}`) : commandRunIntent(argv);
|
|
253
|
-
}
|
|
254
|
-
if (!normalizedCommand || normalizedCommand === "list" || normalizedCommand === "status")
|
|
255
|
-
return intent("fleet", argv, "refresh", undefined, "Loading fleet");
|
|
256
|
-
if (normalizedCommand === "stop") {
|
|
257
|
-
const runId = firstNonOption(rest);
|
|
258
|
-
return runId && rest.filter((part) => part.trim()).length === 1 ? intent("fleet", argv, "run-stop", { runId }, "Stopping run") : commandRunIntent(argv);
|
|
259
|
-
}
|
|
260
|
-
return commandRunIntent(argv);
|
|
261
|
-
}
|
|
262
|
-
if (normalizedGroup === "server")
|
|
263
|
-
return routeServer(argv, normalizedCommand, rest, undefined, "Checking server");
|
|
264
|
-
if (normalizedGroup === "github")
|
|
265
|
-
return routeGithub(argv, normalizedCommand, rest);
|
|
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
|
-
}
|
|
273
|
-
if (normalizedGroup === "doctor")
|
|
274
|
-
return routeDoctor(argv, normalizedCommand);
|
|
275
|
-
if (normalizedGroup === "inbox")
|
|
276
|
-
return routeInbox(argv, normalizedCommand, rest);
|
|
277
|
-
if (normalizedGroup === "attach") {
|
|
278
|
-
const attachArgs = [command, ...rest].filter((part) => part.trim());
|
|
279
|
-
const runId = firstNonOption(attachArgs);
|
|
280
|
-
return runId && attachArgs.length === 1 ? intent("handoff", argv, "run-attach", { runId }, `Attaching ${runId}`) : commandRunIntent(argv);
|
|
281
|
-
}
|
|
282
|
-
if (HOLLOW_FAMILIES.has(normalizedGroup)) {
|
|
283
|
-
if (!normalizedCommand || isHelpCommand(normalizedCommand))
|
|
284
|
-
return familyIntent(normalizedGroup, argv);
|
|
285
|
-
return commandRunIntent(argv);
|
|
286
|
-
}
|
|
287
|
-
const nav = NAV_SCENES.get(normalizedGroup);
|
|
288
|
-
if (nav && argv.length === 1)
|
|
289
|
-
return intent(nav, argv, "navigate", undefined, `Opening ${nav}`);
|
|
290
|
-
return commandRunIntent(argv);
|
|
291
|
-
}
|
|
292
|
-
function intentFromTypeBar(value) {
|
|
293
|
-
const raw = value.trim();
|
|
294
|
-
if (!raw)
|
|
295
|
-
return intent("main", [], "none", undefined, "Project menu", value);
|
|
296
|
-
const parts = raw.split(/\s+/).filter(Boolean);
|
|
297
|
-
const [first = "", second = "", ...rest] = parts;
|
|
298
|
-
const firstScene = NAV_SCENES.get(first.toLowerCase());
|
|
299
|
-
if (first === "tasks" || first === "task") {
|
|
300
|
-
if (second === "run" || first === "task" && (second === "ready" || second === "status"))
|
|
301
|
-
return commandRunIntent(parts, value);
|
|
302
|
-
if (!isTaskViewCommand(second.toLowerCase()))
|
|
303
|
-
return commandRunIntent(parts, value);
|
|
304
|
-
return taskViewIntent(parts, second, rest, value);
|
|
305
|
-
}
|
|
306
|
-
if (first === "run") {
|
|
307
|
-
if (second === "attach") {
|
|
308
|
-
const runId = firstNonOption(rest);
|
|
309
|
-
return runId && rest.filter((part) => part.trim()).length === 1 ? intent("handoff", parts, "run-attach", { runId }, "Attaching run", value) : commandRunIntent(parts, value);
|
|
310
|
-
}
|
|
311
|
-
if (second === "stop") {
|
|
312
|
-
const runId = firstNonOption(rest);
|
|
313
|
-
return runId && rest.filter((part) => part.trim()).length === 1 ? intent("fleet", parts, "run-stop", { runId }, "Stopping run", value) : commandRunIntent(parts, value);
|
|
314
|
-
}
|
|
315
|
-
if (second === "next" || second === "--next" || second === "--task") {
|
|
316
|
-
const parsed = parseSimpleTaskRunArgs([second, ...rest]);
|
|
317
|
-
if (!parsed.ok)
|
|
318
|
-
return commandRunIntent(parts, value, parsed.reason);
|
|
319
|
-
const payload = parsed.detach ? { detach: true } : undefined;
|
|
320
|
-
if (parsed.next)
|
|
321
|
-
return intent("tasks", parts, "task-run-next", payload, parsed.detach ? "Dispatching next task detached" : "Dispatching next task", value);
|
|
322
|
-
if (parsed.task)
|
|
323
|
-
return intent("tasks", parts, "task-run-id", { ...payload ?? {}, task: parsed.task }, parsed.detach ? `Dispatching ${parsed.task} detached` : `Dispatching ${parsed.task}`, value);
|
|
324
|
-
return intent("tasks", parts, "refresh", undefined, "Select a task, then press Enter; or use run next", value);
|
|
325
|
-
}
|
|
326
|
-
if (second && !second.startsWith("-")) {
|
|
327
|
-
if (rest.length > 0)
|
|
328
|
-
return commandRunIntent(parts, value);
|
|
329
|
-
return intent("tasks", parts, "task-run-id", { task: second }, `Dispatching ${second}`, value);
|
|
330
|
-
}
|
|
331
|
-
if (second?.startsWith("-"))
|
|
332
|
-
return commandRunIntent(parts, value);
|
|
333
|
-
return intent("tasks", parts, "refresh", undefined, "Select a task, then press Enter; or use run next", value);
|
|
334
|
-
}
|
|
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
|
-
}
|
|
342
|
-
if (first === "doctor")
|
|
343
|
-
return routeDoctor(parts, second, value);
|
|
344
|
-
if (first === "server")
|
|
345
|
-
return routeServer(parts, second, rest, value, "Loading server");
|
|
346
|
-
if (first === "github")
|
|
347
|
-
return routeGithub(parts, second, rest, value);
|
|
348
|
-
if (first === "inbox")
|
|
349
|
-
return routeInbox(parts, second, rest, value);
|
|
350
|
-
if (firstScene && parts.length === 1) {
|
|
351
|
-
return intent(firstScene, parts, "navigate", undefined, `Opening ${firstScene}`, value);
|
|
352
|
-
}
|
|
353
|
-
if (first === "stop")
|
|
354
|
-
return intent("fleet", parts, "run-stop", { runId: second || undefined }, second ? `Stopping ${second}` : "Stopping run", value);
|
|
355
|
-
if (first === "attach") {
|
|
356
|
-
if (!second)
|
|
357
|
-
return intent("handoff", parts, "navigate", undefined, "Select a run to attach", value);
|
|
358
|
-
return parts.length === 2 ? intent("handoff", parts, "run-attach", { runId: second }, `Attaching ${second}`, value) : commandRunIntent(parts, value);
|
|
359
|
-
}
|
|
360
|
-
return intentFromArgv(parts);
|
|
361
|
-
}
|
|
362
|
-
export {
|
|
363
|
-
intentFromTypeBar,
|
|
364
|
-
intentFromArgv
|
|
365
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { CliRenderer, KeyEvent } from "@opentui/core";
|
|
2
|
-
import type { TypeBarRenderables } from "./render/type-bar";
|
|
3
|
-
import type { AppIntent, AppRuntime, AppSceneId, AppSelectableItem, AppState, AppTypeBarState } 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: Partial<AppTypeBarState>) => void;
|
|
11
|
-
readonly runAppAction: (label: string, action: () => Promise<unknown>) => void;
|
|
12
|
-
readonly primaryNavIntent: (scene: AppSceneId) => AppIntent;
|
|
13
|
-
readonly nextPrimaryScene: (scene: AppSceneId, delta: number) => AppSceneId;
|
|
14
|
-
readonly moveSelection: (delta: number, renderedItems?: readonly AppSelectableItem[]) => boolean;
|
|
15
|
-
readonly activateSelection: (renderedItems?: readonly AppSelectableItem[]) => Promise<boolean>;
|
|
16
|
-
/** Scroll the active content body (the visible scroll panel AND the native
|
|
17
|
-
* code/diff/table overlay) by `delta` rows — keyboard scroll for long content
|
|
18
|
-
* (PageUp/Down/Home/End/Ctrl-D/U) that selection nav can't reach. */
|
|
19
|
-
readonly scrollActiveBody: (delta: number) => void;
|
|
20
|
-
};
|
|
21
|
-
export declare function handleAppKeyPress(context: AppKeymapContext, key: KeyEvent): void;
|