@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,23 +0,0 @@
|
|
|
1
|
-
import { type AppAdapterContext } from "./common";
|
|
2
|
-
export type AppPiProjectPackage = {
|
|
3
|
-
readonly source: string;
|
|
4
|
-
readonly managedByRigConfig: boolean;
|
|
5
|
-
};
|
|
6
|
-
/** One npm search hit from `rig pi search` (details.results[]): a real
|
|
7
|
-
* installable package, rendered as a selectable row that installs inline. */
|
|
8
|
-
export type AppPiSearchResult = {
|
|
9
|
-
readonly name: string;
|
|
10
|
-
readonly version: string;
|
|
11
|
-
readonly description: string;
|
|
12
|
-
};
|
|
13
|
-
export type AppPiSnapshot = {
|
|
14
|
-
readonly projectPackages: readonly AppPiProjectPackage[];
|
|
15
|
-
readonly userPackages: readonly string[];
|
|
16
|
-
/** The term the current search results were produced for (undefined = no
|
|
17
|
-
* search has run this session). */
|
|
18
|
-
readonly searchTerm?: string;
|
|
19
|
-
/** Results of the last `rig pi search` — each is installable inline. */
|
|
20
|
-
readonly searchResults: readonly AppPiSearchResult[];
|
|
21
|
-
readonly refreshedAt: number;
|
|
22
|
-
};
|
|
23
|
-
export declare function refreshPi(ctx: AppAdapterContext): Promise<AppPiSnapshot>;
|
|
@@ -1,363 +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 requireNoExtraArgs(args, usage) {
|
|
24
|
-
if (args.length > 0) {
|
|
25
|
-
throw new CliError(`Unexpected arguments: ${args.join(" ")}
|
|
26
|
-
Usage: ${usage}`);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
var CliError;
|
|
30
|
-
var init_runner = __esm(() => {
|
|
31
|
-
CliError = class CliError extends RuntimeCliError {
|
|
32
|
-
hint;
|
|
33
|
-
constructor(message, exitCode = 1, options = {}) {
|
|
34
|
-
super(message, exitCode);
|
|
35
|
-
if (options.hint?.trim()) {
|
|
36
|
-
this.hint = options.hint.trim();
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
// packages/cli/src/commands/pi.ts
|
|
43
|
-
var exports_pi = {};
|
|
44
|
-
__export(exports_pi, {
|
|
45
|
-
executePi: () => executePi
|
|
46
|
-
});
|
|
47
|
-
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
48
|
-
import { homedir } from "os";
|
|
49
|
-
import { dirname, resolve } from "path";
|
|
50
|
-
function settingsPath(root) {
|
|
51
|
-
return resolve(root, ".pi", "settings.json");
|
|
52
|
-
}
|
|
53
|
-
function userSettingsPath() {
|
|
54
|
-
return resolve(homedir(), ".pi", "agent", "settings.json");
|
|
55
|
-
}
|
|
56
|
-
function readJson(path, fallback) {
|
|
57
|
-
if (!existsSync(path))
|
|
58
|
-
return fallback;
|
|
59
|
-
try {
|
|
60
|
-
return JSON.parse(readFileSync(path, "utf-8"));
|
|
61
|
-
} catch {
|
|
62
|
-
return fallback;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
function packageKey(entry) {
|
|
66
|
-
if (typeof entry === "string")
|
|
67
|
-
return entry;
|
|
68
|
-
if (entry && typeof entry === "object" && typeof entry.source === "string") {
|
|
69
|
-
return entry.source;
|
|
70
|
-
}
|
|
71
|
-
return JSON.stringify(entry);
|
|
72
|
-
}
|
|
73
|
-
function writeSettings(path, settings) {
|
|
74
|
-
mkdirSync(dirname(path), { recursive: true });
|
|
75
|
-
writeFileSync(path, `${JSON.stringify(settings, null, 2)}
|
|
76
|
-
`, "utf-8");
|
|
77
|
-
}
|
|
78
|
-
async function searchNpmForPiExtensions(term) {
|
|
79
|
-
const query = encodeURIComponent(term ? `${term} pi extension` : "pi extension");
|
|
80
|
-
const url = `https://registry.npmjs.org/-/v1/search?text=${query}&size=20`;
|
|
81
|
-
const response = await fetch(url);
|
|
82
|
-
if (!response.ok) {
|
|
83
|
-
throw new CliError(`npm registry search failed (${response.status}).`, 2, { hint: "Check network access to registry.npmjs.org, then retry `rig pi search <term>`." });
|
|
84
|
-
}
|
|
85
|
-
const payload = await response.json();
|
|
86
|
-
const results = [];
|
|
87
|
-
for (const entry of payload.objects ?? []) {
|
|
88
|
-
const pkg = entry.package;
|
|
89
|
-
if (!pkg?.name)
|
|
90
|
-
continue;
|
|
91
|
-
const keywords = (pkg.keywords ?? []).map((k) => k.toLowerCase());
|
|
92
|
-
const piLike = pkg.name.startsWith("pi-") || pkg.name.includes("-pi") || keywords.includes("pi") || keywords.includes("pi-extension") || (pkg.description ?? "").toLowerCase().includes("pi extension") || (pkg.description ?? "").toLowerCase().includes("pi coding agent");
|
|
93
|
-
if (!piLike)
|
|
94
|
-
continue;
|
|
95
|
-
results.push({ name: pkg.name, version: pkg.version ?? "", description: pkg.description ?? "" });
|
|
96
|
-
}
|
|
97
|
-
return results;
|
|
98
|
-
}
|
|
99
|
-
async function executePi(context, args) {
|
|
100
|
-
const [command = "list", ...rest] = args;
|
|
101
|
-
const projectSettingsPath = settingsPath(context.projectRoot);
|
|
102
|
-
const managedRecordPath = resolve(context.projectRoot, ".rig", "state", "pi-managed-packages.json");
|
|
103
|
-
switch (command) {
|
|
104
|
-
case "list": {
|
|
105
|
-
requireNoExtraArgs(rest, "rig pi list");
|
|
106
|
-
const project = readJson(projectSettingsPath, {});
|
|
107
|
-
const managed = new Set(readJson(managedRecordPath, []));
|
|
108
|
-
const user = readJson(userSettingsPath(), {});
|
|
109
|
-
const projectPackages = (Array.isArray(project.packages) ? project.packages : []).map((entry) => ({
|
|
110
|
-
source: packageKey(entry),
|
|
111
|
-
managedByRigConfig: managed.has(packageKey(entry))
|
|
112
|
-
}));
|
|
113
|
-
const userPackages = (Array.isArray(user.packages) ? user.packages : []).map(packageKey);
|
|
114
|
-
if (context.outputMode === "text") {
|
|
115
|
-
console.log("Project Pi packages (.pi/settings.json):");
|
|
116
|
-
if (projectPackages.length === 0)
|
|
117
|
-
console.log(" (none)");
|
|
118
|
-
for (const pkg of projectPackages) {
|
|
119
|
-
console.log(` ${pkg.source}${pkg.managedByRigConfig ? " [from rig.config runtime.pi.packages]" : ""}`);
|
|
120
|
-
}
|
|
121
|
-
console.log("User Pi packages (~/.pi/agent/settings.json):");
|
|
122
|
-
if (userPackages.length === 0)
|
|
123
|
-
console.log(" (none)");
|
|
124
|
-
for (const pkg of userPackages)
|
|
125
|
-
console.log(` ${pkg}`);
|
|
126
|
-
console.log("Add more: `rig pi add <npm-package>` \xB7 discover: `rig pi search <term>`");
|
|
127
|
-
}
|
|
128
|
-
return { ok: true, group: "pi", command, details: { projectPackages, userPackages } };
|
|
129
|
-
}
|
|
130
|
-
case "add": {
|
|
131
|
-
const [source, ...extra] = rest;
|
|
132
|
-
requireNoExtraArgs(extra, "rig pi add <package-source>");
|
|
133
|
-
if (!source) {
|
|
134
|
-
throw new CliError("Usage: rig pi add <package-source> (npm name, name@version, or git URL)", 2);
|
|
135
|
-
}
|
|
136
|
-
const settings = readJson(projectSettingsPath, {});
|
|
137
|
-
const packages = Array.isArray(settings.packages) ? settings.packages : [];
|
|
138
|
-
if (packages.some((entry) => packageKey(entry) === source)) {
|
|
139
|
-
throw new CliError(`"${source}" is already in ${projectSettingsPath}.`, 2, { hint: "Run `rig pi list` to see installed extensions." });
|
|
140
|
-
}
|
|
141
|
-
writeSettings(projectSettingsPath, { ...settings, packages: [...packages, source] });
|
|
142
|
-
if (context.outputMode === "text") {
|
|
143
|
-
console.log(`Added ${source} to ${projectSettingsPath}.`);
|
|
144
|
-
console.log("Pi installs missing packages automatically at the next session start (local and worker).");
|
|
145
|
-
}
|
|
146
|
-
return { ok: true, group: "pi", command, details: { source, settingsPath: projectSettingsPath } };
|
|
147
|
-
}
|
|
148
|
-
case "remove": {
|
|
149
|
-
const [source, ...extra] = rest;
|
|
150
|
-
requireNoExtraArgs(extra, "rig pi remove <package-source>");
|
|
151
|
-
if (!source) {
|
|
152
|
-
throw new CliError("Usage: rig pi remove <package-source>", 2);
|
|
153
|
-
}
|
|
154
|
-
const managed = new Set(readJson(managedRecordPath, []));
|
|
155
|
-
if (managed.has(source)) {
|
|
156
|
-
throw new CliError(`"${source}" is managed by rig.config.ts (runtime.pi.packages); remove it there instead.`, 2);
|
|
157
|
-
}
|
|
158
|
-
const settings = readJson(projectSettingsPath, {});
|
|
159
|
-
const packages = Array.isArray(settings.packages) ? settings.packages : [];
|
|
160
|
-
const next = packages.filter((entry) => packageKey(entry) !== source);
|
|
161
|
-
if (next.length === packages.length) {
|
|
162
|
-
throw new CliError(`"${source}" is not in ${projectSettingsPath}.`, 2, { hint: "Run `rig pi list` to see what is installed, then `rig pi remove <source>` with an exact entry." });
|
|
163
|
-
}
|
|
164
|
-
const nextSettings = { ...settings };
|
|
165
|
-
if (next.length > 0)
|
|
166
|
-
nextSettings.packages = next;
|
|
167
|
-
else
|
|
168
|
-
delete nextSettings.packages;
|
|
169
|
-
writeSettings(projectSettingsPath, nextSettings);
|
|
170
|
-
if (context.outputMode === "text") {
|
|
171
|
-
console.log(`Removed ${source} from ${projectSettingsPath}.`);
|
|
172
|
-
}
|
|
173
|
-
return { ok: true, group: "pi", command, details: { source } };
|
|
174
|
-
}
|
|
175
|
-
case "search": {
|
|
176
|
-
const term = rest.join(" ").trim();
|
|
177
|
-
const results = await searchNpmForPiExtensions(term);
|
|
178
|
-
if (context.outputMode === "text") {
|
|
179
|
-
if (results.length === 0) {
|
|
180
|
-
console.log(`No Pi extension packages found on npm${term ? ` for "${term}"` : ""}.`);
|
|
181
|
-
} else {
|
|
182
|
-
console.log(`Pi extension packages on npm${term ? ` matching "${term}"` : ""}:`);
|
|
183
|
-
for (const pkg of results) {
|
|
184
|
-
console.log(` ${pkg.name}@${pkg.version} ${pkg.description.slice(0, 80)}`);
|
|
185
|
-
}
|
|
186
|
-
console.log("Install one: `rig pi add <name>`");
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
return { ok: true, group: "pi", command, details: { term, results } };
|
|
190
|
-
}
|
|
191
|
-
default:
|
|
192
|
-
throw new CliError(`Unknown pi command: ${command}. Use list|add|remove|search.`, 1, { hint: "Run `rig pi --help` for usage." });
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
var init_pi = __esm(() => {
|
|
196
|
-
init_runner();
|
|
197
|
-
});
|
|
198
|
-
|
|
199
|
-
// packages/cli/src/app-opentui/adapters/common.ts
|
|
200
|
-
async function runtimeOf(ctx) {
|
|
201
|
-
if (ctx.rig && "runId" in ctx.rig && ctx.ensureRuntime === undefined) {
|
|
202
|
-
return ctx.rig;
|
|
203
|
-
}
|
|
204
|
-
if (ctx.ensureRuntime)
|
|
205
|
-
return ctx.ensureRuntime();
|
|
206
|
-
throw new Error("App adapter requires ensureRuntime() before this action can run.");
|
|
207
|
-
}
|
|
208
|
-
function normalizeAppError(error) {
|
|
209
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
210
|
-
const rawHint = error instanceof Error ? error.hint : undefined;
|
|
211
|
-
return {
|
|
212
|
-
message,
|
|
213
|
-
...typeof rawHint === "string" && rawHint.trim() ? { hint: rawHint.trim() } : {}
|
|
214
|
-
};
|
|
215
|
-
}
|
|
216
|
-
function emitStarted(ctx, label, optimistic) {
|
|
217
|
-
ctx.emit({ type: "action.started", label, ...optimistic ? { optimistic } : {} });
|
|
218
|
-
}
|
|
219
|
-
function emitProgress(ctx, label, detail, data) {
|
|
220
|
-
ctx.emit({ type: "action.progress", label, ...detail ? { detail } : {}, ...data ? { data } : {} });
|
|
221
|
-
}
|
|
222
|
-
function emitCompleted(ctx, label, data) {
|
|
223
|
-
ctx.emit({ type: "action.completed", label, ...data ? { data } : {} });
|
|
224
|
-
}
|
|
225
|
-
function emitFailed(ctx, label, error, data) {
|
|
226
|
-
if (data)
|
|
227
|
-
patchData(ctx, data);
|
|
228
|
-
const normalized = normalizeAppError(error);
|
|
229
|
-
ctx.emit({
|
|
230
|
-
type: "action.failed",
|
|
231
|
-
label,
|
|
232
|
-
message: normalized.message,
|
|
233
|
-
...normalized.hint ? { hint: normalized.hint } : {},
|
|
234
|
-
cause: error
|
|
235
|
-
});
|
|
236
|
-
}
|
|
237
|
-
function patchData(ctx, data) {
|
|
238
|
-
ctx.emit({ type: "data.patch", data });
|
|
239
|
-
}
|
|
240
|
-
function patchFooter(ctx, footer) {
|
|
241
|
-
ctx.emit({ type: "footer.patch", footer });
|
|
242
|
-
}
|
|
243
|
-
async function captureConsole(fn) {
|
|
244
|
-
const output = [];
|
|
245
|
-
const original = {
|
|
246
|
-
log: console.log,
|
|
247
|
-
info: console.info,
|
|
248
|
-
warn: console.warn,
|
|
249
|
-
error: console.error
|
|
250
|
-
};
|
|
251
|
-
const capture = (...parts) => {
|
|
252
|
-
output.push(parts.map((part) => typeof part === "string" ? part : JSON.stringify(part)).join(" "));
|
|
253
|
-
};
|
|
254
|
-
console.log = capture;
|
|
255
|
-
console.info = capture;
|
|
256
|
-
console.warn = capture;
|
|
257
|
-
console.error = capture;
|
|
258
|
-
try {
|
|
259
|
-
const result = await fn();
|
|
260
|
-
return { result, output };
|
|
261
|
-
} finally {
|
|
262
|
-
console.log = original.log;
|
|
263
|
-
console.info = original.info;
|
|
264
|
-
console.warn = original.warn;
|
|
265
|
-
console.error = original.error;
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
// packages/cli/src/app-opentui/adapters/pi.ts
|
|
270
|
-
function asProjectPackages(value) {
|
|
271
|
-
if (!Array.isArray(value))
|
|
272
|
-
return [];
|
|
273
|
-
return value.flatMap((entry) => {
|
|
274
|
-
if (!entry || typeof entry !== "object" || Array.isArray(entry))
|
|
275
|
-
return [];
|
|
276
|
-
const record = entry;
|
|
277
|
-
const source = typeof record.source === "string" ? record.source : undefined;
|
|
278
|
-
if (!source)
|
|
279
|
-
return [];
|
|
280
|
-
return [{ source, managedByRigConfig: record.managedByRigConfig === true }];
|
|
281
|
-
});
|
|
282
|
-
}
|
|
283
|
-
function asUserPackages(value) {
|
|
284
|
-
if (!Array.isArray(value))
|
|
285
|
-
return [];
|
|
286
|
-
return value.filter((entry) => typeof entry === "string");
|
|
287
|
-
}
|
|
288
|
-
function asSearchResults(value) {
|
|
289
|
-
if (!Array.isArray(value))
|
|
290
|
-
return [];
|
|
291
|
-
return value.flatMap((entry) => {
|
|
292
|
-
if (!entry || typeof entry !== "object" || Array.isArray(entry))
|
|
293
|
-
return [];
|
|
294
|
-
const record = entry;
|
|
295
|
-
const name = typeof record.name === "string" ? record.name : undefined;
|
|
296
|
-
if (!name)
|
|
297
|
-
return [];
|
|
298
|
-
return [{
|
|
299
|
-
name,
|
|
300
|
-
version: typeof record.version === "string" ? record.version : "",
|
|
301
|
-
description: typeof record.description === "string" ? record.description : ""
|
|
302
|
-
}];
|
|
303
|
-
});
|
|
304
|
-
}
|
|
305
|
-
function priorSnapshot(ctx) {
|
|
306
|
-
const value = ctx.getState().data?.pi;
|
|
307
|
-
return value && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
308
|
-
}
|
|
309
|
-
function searchRequest(ctx) {
|
|
310
|
-
const state = ctx.getState();
|
|
311
|
-
const intent = state.intent;
|
|
312
|
-
const payload = intent?.action?.payload;
|
|
313
|
-
if (!payload || !("piSearch" in payload))
|
|
314
|
-
return { kind: "none" };
|
|
315
|
-
const value = payload.piSearch;
|
|
316
|
-
if (typeof value === "string" && value.trim())
|
|
317
|
-
return { kind: "search", term: value.trim() };
|
|
318
|
-
return { kind: "clear" };
|
|
319
|
-
}
|
|
320
|
-
async function refreshPi(ctx) {
|
|
321
|
-
const request = searchRequest(ctx);
|
|
322
|
-
const label = request.kind === "search" ? `Searching Pi extensions for "${request.term}"` : "Loading Pi extensions";
|
|
323
|
-
emitStarted(ctx, label);
|
|
324
|
-
try {
|
|
325
|
-
const runtime = await runtimeOf(ctx);
|
|
326
|
-
const { executePi: executePi2 } = await Promise.resolve().then(() => (init_pi(), exports_pi));
|
|
327
|
-
emitProgress(ctx, label, "reading project + user Pi settings");
|
|
328
|
-
const { result: listResult } = await captureConsole(() => executePi2(runtime, ["list"]));
|
|
329
|
-
const listDetails = listResult.details ?? {};
|
|
330
|
-
const prior = priorSnapshot(ctx);
|
|
331
|
-
let searchResults = request.kind === "clear" ? [] : prior?.searchResults ?? [];
|
|
332
|
-
let resolvedTerm = request.kind === "clear" ? undefined : prior?.searchTerm;
|
|
333
|
-
if (request.kind === "search") {
|
|
334
|
-
emitProgress(ctx, label, "searching npm for Pi extensions");
|
|
335
|
-
const { result: searchResult } = await captureConsole(() => executePi2(runtime, ["search", request.term]));
|
|
336
|
-
const searchDetails = searchResult.details ?? {};
|
|
337
|
-
searchResults = asSearchResults(searchDetails.results);
|
|
338
|
-
resolvedTerm = typeof searchDetails.term === "string" && searchDetails.term.trim() ? searchDetails.term.trim() : request.term;
|
|
339
|
-
}
|
|
340
|
-
const snapshot = {
|
|
341
|
-
projectPackages: asProjectPackages(listDetails.projectPackages),
|
|
342
|
-
userPackages: asUserPackages(listDetails.userPackages),
|
|
343
|
-
...resolvedTerm !== undefined ? { searchTerm: resolvedTerm } : {},
|
|
344
|
-
searchResults,
|
|
345
|
-
refreshedAt: Date.now()
|
|
346
|
-
};
|
|
347
|
-
patchData(ctx, { pi: snapshot, lastRefreshError: undefined });
|
|
348
|
-
const footerSuffix = searchResults.length > 0 ? ` \xB7 ${searchResults.length} search hits` : "";
|
|
349
|
-
patchFooter(ctx, { message: `${snapshot.projectPackages.length} project \xB7 ${snapshot.userPackages.length} user Pi packages${footerSuffix}` });
|
|
350
|
-
emitCompleted(ctx, label, {
|
|
351
|
-
project: snapshot.projectPackages.length,
|
|
352
|
-
user: snapshot.userPackages.length,
|
|
353
|
-
...request.kind === "search" ? { searchHits: searchResults.length } : {}
|
|
354
|
-
});
|
|
355
|
-
return snapshot;
|
|
356
|
-
} catch (error) {
|
|
357
|
-
emitFailed(ctx, label, error);
|
|
358
|
-
throw error;
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
export {
|
|
362
|
-
refreshPi
|
|
363
|
-
};
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { type AppAdapterContext } from "./common";
|
|
2
|
-
export type AppPluginRecord = {
|
|
3
|
-
readonly name: string;
|
|
4
|
-
readonly version: string;
|
|
5
|
-
readonly validators: readonly string[];
|
|
6
|
-
readonly hooks: readonly string[];
|
|
7
|
-
readonly agentRoles: readonly string[];
|
|
8
|
-
readonly repoSources: readonly string[];
|
|
9
|
-
readonly taskSources: readonly string[];
|
|
10
|
-
readonly skills: readonly string[];
|
|
11
|
-
readonly taskFieldExtensions: readonly string[];
|
|
12
|
-
readonly cliCommands: readonly string[];
|
|
13
|
-
};
|
|
14
|
-
/** A validator's static registration metadata (id + category + optional
|
|
15
|
-
* description), harvested from the live validator registry so the scene can
|
|
16
|
-
* enrich the otherwise-bare contribution ids with category/scope/description. */
|
|
17
|
-
export type AppValidatorMeta = {
|
|
18
|
-
readonly id: string;
|
|
19
|
-
readonly category: string;
|
|
20
|
-
readonly description?: string;
|
|
21
|
-
};
|
|
22
|
-
/** Enrichment for ONE contribution id, harvested from the live plugin host.
|
|
23
|
-
* `tag` is the scope-/kind-bearing label (validator category, hook event ·
|
|
24
|
-
* matcher, agent-role model, task-source kind, etc.); `description` is the
|
|
25
|
-
* optional registration description. The declarative `plugin list` slice only
|
|
26
|
-
* carries bare ids — these come from `pluginHost.list*()`. */
|
|
27
|
-
export type AppContributionMeta = {
|
|
28
|
-
readonly id: string;
|
|
29
|
-
readonly tag?: string;
|
|
30
|
-
readonly description?: string;
|
|
31
|
-
};
|
|
32
|
-
/** Registry-resolved metadata for every contribution group, keyed by id within
|
|
33
|
-
* each group, so the detail view can enrich every row (not just validators). */
|
|
34
|
-
export type AppPluginContributionMeta = {
|
|
35
|
-
readonly validators: readonly AppContributionMeta[];
|
|
36
|
-
readonly hooks: readonly AppContributionMeta[];
|
|
37
|
-
readonly agentRoles: readonly AppContributionMeta[];
|
|
38
|
-
readonly repoSources: readonly AppContributionMeta[];
|
|
39
|
-
readonly taskSources: readonly AppContributionMeta[];
|
|
40
|
-
readonly skills: readonly AppContributionMeta[];
|
|
41
|
-
readonly taskFieldExtensions: readonly AppContributionMeta[];
|
|
42
|
-
readonly cliCommands: readonly AppContributionMeta[];
|
|
43
|
-
};
|
|
44
|
-
export type AppPluginSnapshot = {
|
|
45
|
-
readonly plugins: readonly AppPluginRecord[];
|
|
46
|
-
/** Registry-resolved validator metadata, keyed by validator id. Empty when the
|
|
47
|
-
* project has no rig.config (validators only resolve through the plugin host). */
|
|
48
|
-
readonly validatorMeta: readonly AppValidatorMeta[];
|
|
49
|
-
/** Registry-resolved metadata for EVERY contribution group. Empty groups when
|
|
50
|
-
* the project has no rig.config. */
|
|
51
|
-
readonly contributionMeta: AppPluginContributionMeta;
|
|
52
|
-
readonly refreshedAt: number;
|
|
53
|
-
};
|
|
54
|
-
/** One row of a validate run: the structured result the validator registry
|
|
55
|
-
* produced (`details.results[]` shape) for a single validator. */
|
|
56
|
-
export type AppValidatorResult = {
|
|
57
|
-
readonly id: string;
|
|
58
|
-
readonly passed: boolean;
|
|
59
|
-
readonly summary: string;
|
|
60
|
-
readonly details?: string;
|
|
61
|
-
};
|
|
62
|
-
/** A captured `rig plugin validate --task <id>` run, rendered in-app as a
|
|
63
|
-
* pass/fail board (NOT a PTY). Populated by {@link validatePluginTask}. */
|
|
64
|
-
export type AppPluginValidation = {
|
|
65
|
-
readonly taskId: string;
|
|
66
|
-
readonly passed: number;
|
|
67
|
-
readonly failed: number;
|
|
68
|
-
readonly results: readonly AppValidatorResult[];
|
|
69
|
-
readonly ranAt: number;
|
|
70
|
-
};
|
|
71
|
-
export declare function refreshPlugin(ctx: AppAdapterContext): Promise<AppPluginSnapshot>;
|
|
72
|
-
/**
|
|
73
|
-
* Run plugin validators against a task id IN-PROCESS and capture the structured
|
|
74
|
-
* `results[]` (`{id, passed, summary, details}`) into `state.data.pluginValidation`
|
|
75
|
-
* so the scene renders an in-app pass/fail board — NOT a PTY.
|
|
76
|
-
*
|
|
77
|
-
* Why the registry walk and not `executePlugin(runtime, ["validate", ...])`:
|
|
78
|
-
* the command computes `details.results` but, on any failure, throws a CliError
|
|
79
|
-
* *before* returning — so the structured results never surface to a caller on
|
|
80
|
-
* the failure path, which is exactly the case the board most needs to render.
|
|
81
|
-
* We reuse the same validator registry the command uses (identical code path,
|
|
82
|
-
* identical results), collecting every validator's result regardless of pass/fail.
|
|
83
|
-
*/
|
|
84
|
-
export declare function validatePluginTask(ctx: AppAdapterContext, taskId: string): Promise<AppPluginValidation>;
|