@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,49 +0,0 @@
|
|
|
1
|
-
import { type AppAdapterContext } from "./common";
|
|
2
|
-
export type AppWorkspaceTaskCounts = {
|
|
3
|
-
readonly total: number;
|
|
4
|
-
readonly ready: number;
|
|
5
|
-
readonly running: number;
|
|
6
|
-
readonly blocked: number;
|
|
7
|
-
readonly completed: number;
|
|
8
|
-
readonly unknown: number;
|
|
9
|
-
};
|
|
10
|
-
export type AppWorkspaceSection = {
|
|
11
|
-
readonly status: string;
|
|
12
|
-
readonly count: number;
|
|
13
|
-
readonly detail: string;
|
|
14
|
-
};
|
|
15
|
-
/** One row in the SERVICE table — drawn from `workspace topology` details. */
|
|
16
|
-
export type AppWorkspaceService = {
|
|
17
|
-
readonly name: string;
|
|
18
|
-
readonly runtime: string;
|
|
19
|
-
readonly port: string;
|
|
20
|
-
readonly healthcheck: string;
|
|
21
|
-
readonly rootPath: string;
|
|
22
|
-
};
|
|
23
|
-
/** One row in the REMOTE-HOST table — drawn from `workspace remote-hosts`
|
|
24
|
-
* details. `online` is derived from the host's reachable-status set so the
|
|
25
|
-
* scene can paint an online/offline glyph without re-deriving the rule. */
|
|
26
|
-
export type AppWorkspaceRemoteHost = {
|
|
27
|
-
readonly name: string;
|
|
28
|
-
readonly status: string;
|
|
29
|
-
readonly online: boolean;
|
|
30
|
-
readonly baseUrl: string;
|
|
31
|
-
readonly workspacePath: string;
|
|
32
|
-
};
|
|
33
|
-
export type AppWorkspaceSnapshot = {
|
|
34
|
-
readonly rootPath: string;
|
|
35
|
-
readonly taskCounts: AppWorkspaceTaskCounts;
|
|
36
|
-
readonly runtimeCount: number;
|
|
37
|
-
readonly artifactTaskCount: number;
|
|
38
|
-
readonly failedApproachesPresent: boolean;
|
|
39
|
-
readonly topology: AppWorkspaceSection;
|
|
40
|
-
readonly remoteFleet: AppWorkspaceSection;
|
|
41
|
-
readonly serviceFabric: AppWorkspaceSection | null;
|
|
42
|
-
/** Per-service rows (the topology arrays the summary used to throw away). */
|
|
43
|
-
readonly services: readonly AppWorkspaceService[];
|
|
44
|
-
/** Per-host rows (the remote-fleet arrays the summary used to throw away). */
|
|
45
|
-
readonly hosts: readonly AppWorkspaceRemoteHost[];
|
|
46
|
-
readonly warnings: readonly string[];
|
|
47
|
-
readonly refreshedAt: number;
|
|
48
|
-
};
|
|
49
|
-
export declare function refreshWorkspace(ctx: AppAdapterContext): Promise<AppWorkspaceSnapshot>;
|
|
@@ -1,333 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __returnValue = (v) => v;
|
|
4
|
-
function __exportSetter(name, newValue) {
|
|
5
|
-
this[name] = __returnValue.bind(null, newValue);
|
|
6
|
-
}
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, {
|
|
10
|
-
get: all[name],
|
|
11
|
-
enumerable: true,
|
|
12
|
-
configurable: true,
|
|
13
|
-
set: __exportSetter.bind(all, name)
|
|
14
|
-
});
|
|
15
|
-
};
|
|
16
|
-
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
17
|
-
|
|
18
|
-
// packages/cli/src/runner.ts
|
|
19
|
-
import { EventBus } from "@rig/runtime/control-plane/runtime/events";
|
|
20
|
-
import { CliError as RuntimeCliError } from "@rig/runtime/control-plane/errors";
|
|
21
|
-
import { evaluate, loadPolicy, resolveAction } from "@rig/runtime/control-plane/runtime/guard";
|
|
22
|
-
import { buildBinary } from "@rig/runtime/control-plane/runtime/isolation";
|
|
23
|
-
function takeOption(args, option) {
|
|
24
|
-
const rest = [];
|
|
25
|
-
let value;
|
|
26
|
-
for (let index = 0;index < args.length; index += 1) {
|
|
27
|
-
const current = args[index];
|
|
28
|
-
if (current === option) {
|
|
29
|
-
const next = args[index + 1];
|
|
30
|
-
if (!next || next.startsWith("-")) {
|
|
31
|
-
throw new CliError(`Missing value for ${option}`, 1, { hint: `Provide a value after ${option}, e.g. \`${option} <value>\`.` });
|
|
32
|
-
}
|
|
33
|
-
value = next;
|
|
34
|
-
index += 1;
|
|
35
|
-
continue;
|
|
36
|
-
}
|
|
37
|
-
if (current !== undefined) {
|
|
38
|
-
rest.push(current);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
return { value, rest };
|
|
42
|
-
}
|
|
43
|
-
function requireNoExtraArgs(args, usage) {
|
|
44
|
-
if (args.length > 0) {
|
|
45
|
-
throw new CliError(`Unexpected arguments: ${args.join(" ")}
|
|
46
|
-
Usage: ${usage}`);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
var CliError;
|
|
50
|
-
var init_runner = __esm(() => {
|
|
51
|
-
CliError = class CliError extends RuntimeCliError {
|
|
52
|
-
hint;
|
|
53
|
-
constructor(message, exitCode = 1, options = {}) {
|
|
54
|
-
super(message, exitCode);
|
|
55
|
-
if (options.hint?.trim()) {
|
|
56
|
-
this.hint = options.hint.trim();
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
// packages/cli/src/commands/workspace.ts
|
|
63
|
-
var exports_workspace = {};
|
|
64
|
-
__export(exports_workspace, {
|
|
65
|
-
executeWorkspace: () => executeWorkspace
|
|
66
|
-
});
|
|
67
|
-
import {
|
|
68
|
-
mutateWorkspaceServiceFabric,
|
|
69
|
-
readWorkspaceRemoteFleet,
|
|
70
|
-
readWorkspaceSummary,
|
|
71
|
-
readWorkspaceTopology
|
|
72
|
-
} from "@rig/runtime/control-plane/native/workspace-ops";
|
|
73
|
-
async function executeWorkspace(context, args) {
|
|
74
|
-
const [command = "summary", ...rest] = args;
|
|
75
|
-
switch (command) {
|
|
76
|
-
case "summary": {
|
|
77
|
-
requireNoExtraArgs(rest, "rig workspace summary");
|
|
78
|
-
const summary = await readWorkspaceSummary(context.projectRoot);
|
|
79
|
-
if (context.outputMode === "text") {
|
|
80
|
-
console.log("Workspace Summary");
|
|
81
|
-
console.log(` root: ${summary.rootPath}`);
|
|
82
|
-
console.log(` tasks: ${summary.taskCounts.total} total \xB7 ${summary.taskCounts.ready} ready \xB7 ${summary.taskCounts.running} running \xB7 ${summary.taskCounts.blocked} blocked \xB7 ${summary.taskCounts.completed} completed \xB7 ${summary.taskCounts.unknown} unknown`);
|
|
83
|
-
console.log(` runtimes: ${summary.runtimeCount}`);
|
|
84
|
-
console.log(` artifact tasks: ${summary.artifactTaskCount}`);
|
|
85
|
-
console.log(` topology: ${summary.topology.status} \xB7 ${summary.topology.serviceCount} services from ${summary.topology.manifestCount} manifests`);
|
|
86
|
-
console.log(` remote hosts: ${summary.remoteFleet.status} \xB7 ${summary.remoteFleet.onlineHostCount} online of ${summary.remoteFleet.hostCount}`);
|
|
87
|
-
if (summary.serviceFabric) {
|
|
88
|
-
console.log(` service fabric: ${String(summary.serviceFabric.status ?? "unknown")} \xB7 ${String(summary.serviceFabric.healthyServiceCount ?? 0)} healthy of ${String(summary.serviceFabric.serviceCount ?? 0)}`);
|
|
89
|
-
}
|
|
90
|
-
console.log(` failures log: ${summary.failedApproachesPresent ? "present" : "missing"}`);
|
|
91
|
-
if (summary.warnings.length > 0) {
|
|
92
|
-
console.log(`
|
|
93
|
-
Warnings:`);
|
|
94
|
-
for (const warning of summary.warnings) {
|
|
95
|
-
console.log(` - ${warning}`);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
return { ok: true, group: "workspace", command, details: summary };
|
|
100
|
-
}
|
|
101
|
-
case "topology": {
|
|
102
|
-
requireNoExtraArgs(rest, "rig workspace topology");
|
|
103
|
-
const topology = readWorkspaceTopology(context.projectRoot);
|
|
104
|
-
if (context.outputMode === "text") {
|
|
105
|
-
console.log(`Topology: ${topology.status}`);
|
|
106
|
-
for (const service of topology.services) {
|
|
107
|
-
const suffix = [service.runtime, service.port != null ? `:${service.port}` : null, service.healthcheck].filter(Boolean).join(" \xB7 ");
|
|
108
|
-
console.log(`- ${service.name}${suffix ? ` (${suffix})` : ""}`);
|
|
109
|
-
console.log(` ${service.relativeRootPath}`);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
return { ok: true, group: "workspace", command, details: topology };
|
|
113
|
-
}
|
|
114
|
-
case "remote-hosts": {
|
|
115
|
-
requireNoExtraArgs(rest, "rig workspace remote-hosts");
|
|
116
|
-
const fleet = readWorkspaceRemoteFleet(context.projectRoot);
|
|
117
|
-
if (context.outputMode === "text") {
|
|
118
|
-
console.log(`Remote Hosts: ${fleet.status}`);
|
|
119
|
-
for (const host of fleet.hosts) {
|
|
120
|
-
console.log(`- ${host.name} \xB7 ${host.status} \xB7 ${host.baseUrl}${host.workspacePath ? ` \xB7 ${host.workspacePath}` : ""}`);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
return { ok: true, group: "workspace", command, details: fleet };
|
|
124
|
-
}
|
|
125
|
-
case "service-fabric": {
|
|
126
|
-
const [action = "status", ...serviceRest] = rest;
|
|
127
|
-
let pending = serviceRest;
|
|
128
|
-
const services = takeOption(pending, "--service");
|
|
129
|
-
pending = services.rest;
|
|
130
|
-
requireNoExtraArgs(pending, "rig workspace service-fabric <status|up|verify|down> [--service <name>]");
|
|
131
|
-
if (action !== "status" && action !== "up" && action !== "verify" && action !== "down") {
|
|
132
|
-
throw new CliError(`Unknown workspace service-fabric action: ${action}`, 1, { hint: "Use one of: `rig workspace service-fabric status|up|verify|down`." });
|
|
133
|
-
}
|
|
134
|
-
const selectedServices = services.value ? services.value.split(",").map((entry) => entry.trim()).filter(Boolean) : [];
|
|
135
|
-
const summary = action === "status" ? await mutateWorkspaceServiceFabric(context.projectRoot, "verify", selectedServices) : await mutateWorkspaceServiceFabric(context.projectRoot, action, selectedServices);
|
|
136
|
-
if (context.outputMode === "text") {
|
|
137
|
-
console.log(JSON.stringify(summary, null, 2));
|
|
138
|
-
}
|
|
139
|
-
return {
|
|
140
|
-
ok: true,
|
|
141
|
-
group: "workspace",
|
|
142
|
-
command: `service-fabric:${action}`,
|
|
143
|
-
details: summary
|
|
144
|
-
};
|
|
145
|
-
}
|
|
146
|
-
default:
|
|
147
|
-
throw new CliError(`Unknown workspace command: ${command}`, 1, { hint: "Run `rig workspace --help` \u2014 commands are summary|topology|remote-hosts|service-fabric." });
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
var init_workspace = __esm(() => {
|
|
151
|
-
init_runner();
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
// packages/cli/src/app-opentui/adapters/common.ts
|
|
155
|
-
async function runtimeOf(ctx) {
|
|
156
|
-
if (ctx.rig && "runId" in ctx.rig && ctx.ensureRuntime === undefined) {
|
|
157
|
-
return ctx.rig;
|
|
158
|
-
}
|
|
159
|
-
if (ctx.ensureRuntime)
|
|
160
|
-
return ctx.ensureRuntime();
|
|
161
|
-
throw new Error("App adapter requires ensureRuntime() before this action can run.");
|
|
162
|
-
}
|
|
163
|
-
function normalizeAppError(error) {
|
|
164
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
165
|
-
const rawHint = error instanceof Error ? error.hint : undefined;
|
|
166
|
-
return {
|
|
167
|
-
message,
|
|
168
|
-
...typeof rawHint === "string" && rawHint.trim() ? { hint: rawHint.trim() } : {}
|
|
169
|
-
};
|
|
170
|
-
}
|
|
171
|
-
function emitStarted(ctx, label, optimistic) {
|
|
172
|
-
ctx.emit({ type: "action.started", label, ...optimistic ? { optimistic } : {} });
|
|
173
|
-
}
|
|
174
|
-
function emitProgress(ctx, label, detail, data) {
|
|
175
|
-
ctx.emit({ type: "action.progress", label, ...detail ? { detail } : {}, ...data ? { data } : {} });
|
|
176
|
-
}
|
|
177
|
-
function emitCompleted(ctx, label, data) {
|
|
178
|
-
ctx.emit({ type: "action.completed", label, ...data ? { data } : {} });
|
|
179
|
-
}
|
|
180
|
-
function emitFailed(ctx, label, error, data) {
|
|
181
|
-
if (data)
|
|
182
|
-
patchData(ctx, data);
|
|
183
|
-
const normalized = normalizeAppError(error);
|
|
184
|
-
ctx.emit({
|
|
185
|
-
type: "action.failed",
|
|
186
|
-
label,
|
|
187
|
-
message: normalized.message,
|
|
188
|
-
...normalized.hint ? { hint: normalized.hint } : {},
|
|
189
|
-
cause: error
|
|
190
|
-
});
|
|
191
|
-
}
|
|
192
|
-
function patchData(ctx, data) {
|
|
193
|
-
ctx.emit({ type: "data.patch", data });
|
|
194
|
-
}
|
|
195
|
-
function patchFooter(ctx, footer) {
|
|
196
|
-
ctx.emit({ type: "footer.patch", footer });
|
|
197
|
-
}
|
|
198
|
-
async function captureConsole(fn) {
|
|
199
|
-
const output = [];
|
|
200
|
-
const original = {
|
|
201
|
-
log: console.log,
|
|
202
|
-
info: console.info,
|
|
203
|
-
warn: console.warn,
|
|
204
|
-
error: console.error
|
|
205
|
-
};
|
|
206
|
-
const capture = (...parts) => {
|
|
207
|
-
output.push(parts.map((part) => typeof part === "string" ? part : JSON.stringify(part)).join(" "));
|
|
208
|
-
};
|
|
209
|
-
console.log = capture;
|
|
210
|
-
console.info = capture;
|
|
211
|
-
console.warn = capture;
|
|
212
|
-
console.error = capture;
|
|
213
|
-
try {
|
|
214
|
-
const result = await fn();
|
|
215
|
-
return { result, output };
|
|
216
|
-
} finally {
|
|
217
|
-
console.log = original.log;
|
|
218
|
-
console.info = original.info;
|
|
219
|
-
console.warn = original.warn;
|
|
220
|
-
console.error = original.error;
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
// packages/cli/src/app-opentui/adapters/workspace.ts
|
|
225
|
-
var ONLINE_HOST_STATUSES = new Set(["ready", "busy", "degraded", "draining"]);
|
|
226
|
-
function record(value) {
|
|
227
|
-
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
228
|
-
}
|
|
229
|
-
function num(value) {
|
|
230
|
-
return typeof value === "number" && Number.isFinite(value) ? value : 0;
|
|
231
|
-
}
|
|
232
|
-
function str(value, fallback = "unknown") {
|
|
233
|
-
return typeof value === "string" && value.trim() ? value.trim() : fallback;
|
|
234
|
-
}
|
|
235
|
-
function taskCounts(value) {
|
|
236
|
-
const counts = record(value);
|
|
237
|
-
return {
|
|
238
|
-
total: num(counts.total),
|
|
239
|
-
ready: num(counts.ready),
|
|
240
|
-
running: num(counts.running),
|
|
241
|
-
blocked: num(counts.blocked),
|
|
242
|
-
completed: num(counts.completed),
|
|
243
|
-
unknown: num(counts.unknown)
|
|
244
|
-
};
|
|
245
|
-
}
|
|
246
|
-
function topologySection(value) {
|
|
247
|
-
const topology = record(value);
|
|
248
|
-
return {
|
|
249
|
-
status: str(topology.status),
|
|
250
|
-
count: num(topology.serviceCount),
|
|
251
|
-
detail: `${num(topology.serviceCount)} services from ${num(topology.manifestCount)} manifests`
|
|
252
|
-
};
|
|
253
|
-
}
|
|
254
|
-
function remoteSection(value) {
|
|
255
|
-
const fleet = record(value);
|
|
256
|
-
return {
|
|
257
|
-
status: str(fleet.status),
|
|
258
|
-
count: num(fleet.hostCount),
|
|
259
|
-
detail: `${num(fleet.onlineHostCount)} online of ${num(fleet.hostCount)} hosts`
|
|
260
|
-
};
|
|
261
|
-
}
|
|
262
|
-
function fabricSection(value) {
|
|
263
|
-
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
264
|
-
return null;
|
|
265
|
-
const fabric = value;
|
|
266
|
-
return {
|
|
267
|
-
status: str(fabric.status),
|
|
268
|
-
count: num(fabric.serviceCount),
|
|
269
|
-
detail: `${num(fabric.healthyServiceCount)} healthy of ${num(fabric.serviceCount)} services`
|
|
270
|
-
};
|
|
271
|
-
}
|
|
272
|
-
function warnings(value) {
|
|
273
|
-
return Array.isArray(value) ? value.map((entry) => String(entry)) : [];
|
|
274
|
-
}
|
|
275
|
-
function recordArray(value) {
|
|
276
|
-
return Array.isArray(value) ? value.filter((entry) => Boolean(entry && typeof entry === "object" && !Array.isArray(entry))) : [];
|
|
277
|
-
}
|
|
278
|
-
function services(value) {
|
|
279
|
-
return recordArray(value).map((service) => ({
|
|
280
|
-
name: str(service.name, "service"),
|
|
281
|
-
runtime: str(service.runtime),
|
|
282
|
-
port: typeof service.port === "number" && Number.isFinite(service.port) ? String(service.port) : "\u2014",
|
|
283
|
-
healthcheck: str(service.healthcheck, "\u2014"),
|
|
284
|
-
rootPath: str(service.relativeRootPath, ".")
|
|
285
|
-
}));
|
|
286
|
-
}
|
|
287
|
-
function hosts(value) {
|
|
288
|
-
return recordArray(value).map((host) => {
|
|
289
|
-
const status = str(host.status, "offline");
|
|
290
|
-
return {
|
|
291
|
-
name: str(host.name, "host"),
|
|
292
|
-
status,
|
|
293
|
-
online: ONLINE_HOST_STATUSES.has(status),
|
|
294
|
-
baseUrl: str(host.baseUrl, "\u2014"),
|
|
295
|
-
workspacePath: str(host.workspacePath, "\u2014")
|
|
296
|
-
};
|
|
297
|
-
});
|
|
298
|
-
}
|
|
299
|
-
async function refreshWorkspace(ctx) {
|
|
300
|
-
const label = "Loading workspace";
|
|
301
|
-
emitStarted(ctx, label);
|
|
302
|
-
try {
|
|
303
|
-
const runtime = await runtimeOf(ctx);
|
|
304
|
-
emitProgress(ctx, label, "reading topology, remotes, and service fabric");
|
|
305
|
-
const { executeWorkspace: executeWorkspace2 } = await Promise.resolve().then(() => (init_workspace(), exports_workspace));
|
|
306
|
-
const { result } = await captureConsole(() => executeWorkspace2(runtime, ["summary"]));
|
|
307
|
-
const details = record(result.details);
|
|
308
|
-
const snapshot = {
|
|
309
|
-
rootPath: str(details.rootPath, runtime.projectRoot),
|
|
310
|
-
taskCounts: taskCounts(details.taskCounts),
|
|
311
|
-
runtimeCount: num(details.runtimeCount),
|
|
312
|
-
artifactTaskCount: num(details.artifactTaskCount),
|
|
313
|
-
failedApproachesPresent: details.failedApproachesPresent === true,
|
|
314
|
-
topology: topologySection(details.topology),
|
|
315
|
-
remoteFleet: remoteSection(details.remoteFleet),
|
|
316
|
-
serviceFabric: fabricSection(details.serviceFabric),
|
|
317
|
-
services: services(record(details.topology).services),
|
|
318
|
-
hosts: hosts(record(details.remoteFleet).hosts),
|
|
319
|
-
warnings: warnings(details.warnings),
|
|
320
|
-
refreshedAt: Date.now()
|
|
321
|
-
};
|
|
322
|
-
patchData(ctx, { workspace: snapshot, lastRefreshError: undefined });
|
|
323
|
-
patchFooter(ctx, { message: `${snapshot.taskCounts.total} tasks \xB7 ${snapshot.topology.count} services \xB7 ${snapshot.remoteFleet.count} hosts` });
|
|
324
|
-
emitCompleted(ctx, label, { services: snapshot.topology.count, hosts: snapshot.remoteFleet.count, warnings: snapshot.warnings.length });
|
|
325
|
-
return snapshot;
|
|
326
|
-
} catch (error) {
|
|
327
|
-
emitFailed(ctx, label, error);
|
|
328
|
-
throw error;
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
export {
|
|
332
|
-
refreshWorkspace
|
|
333
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/** All command strings tab can complete to, de-duplicated and sorted. */
|
|
2
|
-
export declare function commandCandidates(): readonly string[];
|
|
3
|
-
/** One-line description for a command string (from the help catalog), for the
|
|
4
|
-
* palette to show alongside each command. */
|
|
5
|
-
export declare function commandDetail(command: string): string | undefined;
|
|
6
|
-
export type CompletionState = {
|
|
7
|
-
readonly base: string;
|
|
8
|
-
readonly index: number;
|
|
9
|
-
};
|
|
10
|
-
/** Candidates that start with `base` (case-insensitive), preserving order. */
|
|
11
|
-
export declare function matchesFor(base: string, candidates?: readonly string[]): string[];
|
|
12
|
-
/**
|
|
13
|
-
* Tab-cycle completion. `state` carries the user's original typed `base` and the
|
|
14
|
-
* current cycle index so repeated tabs walk through matches; pass `null` (or a
|
|
15
|
-
* stale state) to start a fresh cycle from the current value.
|
|
16
|
-
*/
|
|
17
|
-
export declare function cycleCompletion(value: string, state: CompletionState | undefined, candidates?: readonly string[]): {
|
|
18
|
-
value: string;
|
|
19
|
-
state: CompletionState | undefined;
|
|
20
|
-
};
|