@h-rig/cli 0.0.6-alpha.80 → 0.0.6-alpha.82

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/dist/bin/rig.js +17040 -11249
  2. package/dist/src/app/board.js +32 -3
  3. package/dist/src/app/drone-ui.js +1 -1
  4. package/dist/src/app/theme.js +1 -0
  5. package/dist/src/app-opentui/adapters/common.d.ts +53 -0
  6. package/dist/src/app-opentui/adapters/common.js +149 -0
  7. package/dist/src/app-opentui/adapters/doctor.d.ts +11 -0
  8. package/dist/src/app-opentui/adapters/doctor.js +780 -0
  9. package/dist/src/app-opentui/adapters/fleet.d.ts +16 -0
  10. package/dist/src/app-opentui/adapters/fleet.js +874 -0
  11. package/dist/src/app-opentui/adapters/inbox.d.ts +33 -0
  12. package/dist/src/app-opentui/adapters/inbox.js +1454 -0
  13. package/dist/src/app-opentui/adapters/init.d.ts +13 -0
  14. package/dist/src/app-opentui/adapters/init.js +2357 -0
  15. package/dist/src/app-opentui/adapters/pi-attach.d.ts +16 -0
  16. package/dist/src/app-opentui/adapters/pi-attach.js +1299 -0
  17. package/dist/src/app-opentui/adapters/run-detail.d.ts +20 -0
  18. package/dist/src/app-opentui/adapters/run-detail.js +893 -0
  19. package/dist/src/app-opentui/adapters/server.d.ts +14 -0
  20. package/dist/src/app-opentui/adapters/server.js +798 -0
  21. package/dist/src/app-opentui/adapters/tasks.d.ts +55 -0
  22. package/dist/src/app-opentui/adapters/tasks.js +3472 -0
  23. package/dist/src/app-opentui/bootstrap.d.ts +16 -0
  24. package/dist/src/app-opentui/bootstrap.js +19515 -0
  25. package/dist/src/app-opentui/drone.d.ts +12 -0
  26. package/dist/src/app-opentui/drone.js +227 -0
  27. package/dist/src/app-opentui/events.d.ts +7 -0
  28. package/dist/src/app-opentui/events.js +28 -0
  29. package/dist/src/app-opentui/index.d.ts +8 -0
  30. package/dist/src/app-opentui/index.js +3485 -0
  31. package/dist/src/app-opentui/intent.d.ts +3 -0
  32. package/dist/src/app-opentui/intent.js +211 -0
  33. package/dist/src/app-opentui/layout.d.ts +15 -0
  34. package/dist/src/app-opentui/layout.js +44 -0
  35. package/dist/src/app-opentui/list-search.d.ts +8 -0
  36. package/dist/src/app-opentui/list-search.js +43 -0
  37. package/dist/src/app-opentui/pi-host-child.d.ts +2 -0
  38. package/dist/src/app-opentui/pi-host-child.js +778 -0
  39. package/dist/src/app-opentui/pi-pty-host.d.ts +64 -0
  40. package/dist/src/app-opentui/pi-pty-host.js +388 -0
  41. package/dist/src/app-opentui/registry.d.ts +4 -0
  42. package/dist/src/app-opentui/registry.js +6839 -0
  43. package/dist/src/app-opentui/render/graphics.d.ts +39 -0
  44. package/dist/src/app-opentui/render/graphics.js +537 -0
  45. package/dist/src/app-opentui/render/image-visual-layer-native-canvas.d.ts +2 -0
  46. package/dist/src/app-opentui/render/image-visual-layer-native-canvas.js +1484 -0
  47. package/dist/src/app-opentui/render/image-visual-layer-worker.d.ts +1 -0
  48. package/dist/src/app-opentui/render/image-visual-layer-worker.js +1545 -0
  49. package/dist/src/app-opentui/render/image-visual-layer.d.ts +94 -0
  50. package/dist/src/app-opentui/render/image-visual-layer.js +949 -0
  51. package/dist/src/app-opentui/render/panels.d.ts +10 -0
  52. package/dist/src/app-opentui/render/panels.js +201 -0
  53. package/dist/src/app-opentui/render/scene.d.ts +16 -0
  54. package/dist/src/app-opentui/render/scene.js +110 -0
  55. package/dist/src/app-opentui/render/text.d.ts +10 -0
  56. package/dist/src/app-opentui/render/text.js +121 -0
  57. package/dist/src/app-opentui/render/type-bar.d.ts +14 -0
  58. package/dist/src/app-opentui/render/type-bar.js +137 -0
  59. package/dist/src/app-opentui/runtime.d.ts +2 -0
  60. package/dist/src/app-opentui/runtime.js +3414 -0
  61. package/dist/src/app-opentui/scenes/doctor.d.ts +2 -0
  62. package/dist/src/app-opentui/scenes/doctor.js +91 -0
  63. package/dist/src/app-opentui/scenes/error.d.ts +2 -0
  64. package/dist/src/app-opentui/scenes/error.js +190 -0
  65. package/dist/src/app-opentui/scenes/fleet.d.ts +3 -0
  66. package/dist/src/app-opentui/scenes/fleet.js +207 -0
  67. package/dist/src/app-opentui/scenes/handoff.d.ts +2 -0
  68. package/dist/src/app-opentui/scenes/handoff.js +147 -0
  69. package/dist/src/app-opentui/scenes/help.d.ts +3 -0
  70. package/dist/src/app-opentui/scenes/help.js +138 -0
  71. package/dist/src/app-opentui/scenes/inbox.d.ts +2 -0
  72. package/dist/src/app-opentui/scenes/inbox.js +118 -0
  73. package/dist/src/app-opentui/scenes/init.d.ts +2 -0
  74. package/dist/src/app-opentui/scenes/init.js +94 -0
  75. package/dist/src/app-opentui/scenes/main.d.ts +2 -0
  76. package/dist/src/app-opentui/scenes/main.js +96 -0
  77. package/dist/src/app-opentui/scenes/run-detail.d.ts +2 -0
  78. package/dist/src/app-opentui/scenes/run-detail.js +139 -0
  79. package/dist/src/app-opentui/scenes/server.d.ts +2 -0
  80. package/dist/src/app-opentui/scenes/server.js +88 -0
  81. package/dist/src/app-opentui/scenes/tasks.d.ts +3 -0
  82. package/dist/src/app-opentui/scenes/tasks.js +230 -0
  83. package/dist/src/app-opentui/state.d.ts +4 -0
  84. package/dist/src/app-opentui/state.js +286 -0
  85. package/dist/src/app-opentui/theme.d.ts +36 -0
  86. package/dist/src/app-opentui/theme.js +88 -0
  87. package/dist/src/app-opentui/types.d.ts +188 -0
  88. package/dist/src/app-opentui/types.js +1 -0
  89. package/dist/src/commands/_async-ui.js +1 -1
  90. package/dist/src/commands/_operator-view.js +1 -1
  91. package/dist/src/commands/_pi-frontend.js +1 -1
  92. package/dist/src/commands/_spinner.js +1 -1
  93. package/dist/src/commands/browser.js +1 -1
  94. package/dist/src/commands/doctor.js +1 -1
  95. package/dist/src/commands/github.js +1 -1
  96. package/dist/src/commands/inbox.js +1 -1
  97. package/dist/src/commands/init.js +1 -1
  98. package/dist/src/commands/inspect.js +1 -1
  99. package/dist/src/commands/run.js +1 -1
  100. package/dist/src/commands/setup.js +1 -1
  101. package/dist/src/commands/stats.js +1 -1
  102. package/dist/src/commands/task.js +1 -1
  103. package/dist/src/commands.js +33 -4
  104. package/dist/src/index.js +33 -4
  105. package/package.json +11 -8
@@ -0,0 +1,12 @@
1
+ import type { AppSceneLine } from "./types";
2
+ export declare function miniDroneLines(tick: number, align?: AppSceneLine["align"], phase?: number): AppSceneLine[];
3
+ export declare function leadMarkLines(tick: number, align?: AppSceneLine["align"], phase?: number): AppSceneLine[];
4
+ export declare function brandFleetLines(tick: number, align?: AppSceneLine["align"]): AppSceneLine[];
5
+ export declare function pipelineSignalLines(tick: number, align?: AppSceneLine["align"]): AppSceneLine[];
6
+ export declare function orbitSignalLines(tick: number, align?: AppSceneLine["align"]): AppSceneLine[];
7
+ export declare function dronePlainFrame(tick: number): string[];
8
+ export declare function bigDroneLines(tick: number, align?: AppSceneLine["align"]): AppSceneLine[];
9
+ export declare function actionDrone(tick: number, phase?: number): string;
10
+ export declare function actionDroneLine(tick: number, text: string, fg?: string): AppSceneLine;
11
+ export declare function errorDrone(tick: number): AppSceneLine[];
12
+ export declare function handoffDrone(tick: number): AppSceneLine[];
@@ -0,0 +1,227 @@
1
+ // @bun
2
+ // packages/cli/src/app-opentui/drone.ts
3
+ import { RGBA, StyledText, TextAttributes as TextAttributes2 } from "@opentui/core";
4
+
5
+ // packages/cli/src/app-opentui/theme.ts
6
+ import {
7
+ bold as otuiBold,
8
+ dim as otuiDim,
9
+ fg as otuiFg,
10
+ t,
11
+ TextAttributes
12
+ } from "@opentui/core";
13
+ var RIG_UI = {
14
+ bg: "#070809",
15
+ bg2: "#0b0c0e",
16
+ panel: "#101115",
17
+ panel2: "#101115",
18
+ glass: "#14161b",
19
+ ink: "#f2f3f6",
20
+ ink2: "#aeb0ba",
21
+ ink3: "#6c6e79",
22
+ ink4: "#44464f",
23
+ lime: "#ccff4d",
24
+ limeDim: "#a9d63f",
25
+ cyan: "#56d8ff",
26
+ red: "#ff5d5d",
27
+ yellow: "#ffd24d",
28
+ magenta: "#ff79b0"
29
+ };
30
+ var styles = {
31
+ ink: otuiFg(RIG_UI.ink),
32
+ ink2: otuiFg(RIG_UI.ink2),
33
+ ink3: otuiFg(RIG_UI.ink3),
34
+ ink4: otuiFg(RIG_UI.ink4),
35
+ lime: otuiFg(RIG_UI.lime),
36
+ limeDim: otuiFg(RIG_UI.limeDim),
37
+ cyan: otuiFg(RIG_UI.cyan),
38
+ red: otuiFg(RIG_UI.red),
39
+ yellow: otuiFg(RIG_UI.yellow),
40
+ magenta: otuiFg(RIG_UI.magenta)
41
+ };
42
+
43
+ // packages/cli/src/app-opentui/drone.ts
44
+ var MINI_DRONE = [
45
+ "(!!!) (!!!)",
46
+ " \\%==%/ ",
47
+ " %%?%% ",
48
+ " /%==%\\ ",
49
+ "(!!!) (!!!)"
50
+ ];
51
+ var LEAD_MARK = [
52
+ " .-=-. ",
53
+ "=%%?%%=",
54
+ " '-=-' "
55
+ ];
56
+ var BLADE_FRAMES = ["---", "\\\\\\", "|||", "///"];
57
+ var EYE_FRAMES = ["o", "@", "\u2022", "."];
58
+ var COLOR = {
59
+ body: RGBA.fromHex(RIG_UI.lime),
60
+ mini: RGBA.fromHex(RIG_UI.limeDim),
61
+ rotor: RGBA.fromHex(RIG_UI.cyan),
62
+ path: RGBA.fromHex(RIG_UI.cyan),
63
+ eye: RGBA.fromHex(RIG_UI.ink),
64
+ dim: RGBA.fromHex(RIG_UI.ink4),
65
+ ink: RGBA.fromHex(RIG_UI.ink2)
66
+ };
67
+ function bladeForTick(tick, phase = 0) {
68
+ return BLADE_FRAMES[(Math.floor(tick / 3) + phase) % BLADE_FRAMES.length];
69
+ }
70
+ function eyeForTick(tick, phase = 0) {
71
+ const pulse = Math.sin(tick * 0.09 + phase);
72
+ return pulse > 0.55 ? EYE_FRAMES[1] : pulse > 0.1 ? EYE_FRAMES[0] : pulse > -0.45 ? EYE_FRAMES[2] : EYE_FRAMES[3];
73
+ }
74
+ function chunk(text, fg, bold = false, dim = false) {
75
+ let attributes = TextAttributes2.NONE;
76
+ if (bold)
77
+ attributes |= TextAttributes2.BOLD;
78
+ if (dim)
79
+ attributes |= TextAttributes2.DIM;
80
+ return { __isChunk: true, text, fg, ...attributes !== TextAttributes2.NONE ? { attributes } : {} };
81
+ }
82
+ function styledLine(text, colorFor) {
83
+ const chunks = [];
84
+ let run = "";
85
+ let runColor = null;
86
+ const flush = () => {
87
+ if (!run || !runColor)
88
+ return;
89
+ chunks.push(chunk(run, COLOR[runColor], runColor === "body" || runColor === "eye", runColor === "dim"));
90
+ run = "";
91
+ };
92
+ for (const char of text) {
93
+ const next = colorFor(char);
94
+ if (next !== runColor) {
95
+ flush();
96
+ runColor = next;
97
+ }
98
+ run += char;
99
+ }
100
+ flush();
101
+ return new StyledText(chunks.length > 0 ? chunks : [chunk("", COLOR.ink)]);
102
+ }
103
+ function droneColor(char) {
104
+ if (char === "?" || char === "o" || char === "@" || char === "\u2022")
105
+ return "eye";
106
+ if (char === "%" || char === "=")
107
+ return "mini";
108
+ if (char === "$")
109
+ return "body";
110
+ if (char === "(" || char === ")" || char === "/" || char === "\\" || char === "|" || char === "-")
111
+ return "rotor";
112
+ if (char === "\xB7" || char === "\u2022" || char === "'" || char === ".")
113
+ return "path";
114
+ if (char.trim() === "")
115
+ return "dim";
116
+ return "ink";
117
+ }
118
+ function motionColor(char) {
119
+ if (char === "\u25CF" || char === "\u25C6" || char === "\u25C9")
120
+ return "body";
121
+ if (char === "\u2022" || char === "\xB7" || char === "\u2500" || char === "\u2502" || char === "\u2571" || char === "\u2572" || char === "\u256D" || char === "\u256E" || char === "\u2570" || char === "\u256F")
122
+ return "path";
123
+ if (char === "\u258C" || char === "\u2590" || char === "\u2581" || char === "\u2594")
124
+ return "mini";
125
+ return droneColor(char);
126
+ }
127
+ function materializeDrone(lines, tick, phase = 0) {
128
+ const blade = bladeForTick(tick, phase);
129
+ const eye = eyeForTick(tick, phase);
130
+ return lines.map((line) => line.replaceAll("!!!", blade).replaceAll("?", eye));
131
+ }
132
+ function miniDroneLines(tick, align = "left", phase = 0) {
133
+ return materializeDrone(MINI_DRONE, tick, phase).map((text) => ({
134
+ text,
135
+ styledText: styledLine(text, droneColor),
136
+ fg: RIG_UI.limeDim,
137
+ align
138
+ }));
139
+ }
140
+ function leadMarkLines(tick, align = "left", phase = 0) {
141
+ return materializeDrone(LEAD_MARK, tick, phase).map((text) => ({
142
+ text,
143
+ styledText: styledLine(text, droneColor),
144
+ fg: RIG_UI.lime,
145
+ bold: true,
146
+ align
147
+ }));
148
+ }
149
+ function brandFleetLines(tick, align = "center") {
150
+ const left = materializeDrone(MINI_DRONE, tick, 0);
151
+ const right = materializeDrone(MINI_DRONE, tick, 2);
152
+ const lead = materializeDrone(LEAD_MARK, tick, 1);
153
+ const packet = ["\xB7", "\u2022", "\u25CF", "\u2022"][Math.floor(tick / 2) % 4];
154
+ const bridge = [
155
+ ` ${left[0]} ${lead[0]} ${right[0]}`,
156
+ ` ${left[1]} \xB7\u2500\u2500${packet}\u2500\u2500\xB7 ${lead[1]} \xB7\u2500\u2500${packet}\u2500\u2500\xB7 ${right[1]}`,
157
+ ` ${left[2]} \xB7' '${lead[2]}' '\xB7 ${right[2]}`,
158
+ ` ${left[3]} \u2572 signal bus \u2571 ${right[3]}`,
159
+ ` ${left[4]} \xB7\u2500\u2500\u2500${packet}\u2500\u2500\u2500\u2500\u2500\u2500${packet}\u2500\u2500\u2500\xB7 ${right[4]}`
160
+ ];
161
+ return bridge.map((text) => ({
162
+ text,
163
+ styledText: styledLine(text, motionColor),
164
+ fg: RIG_UI.limeDim,
165
+ align
166
+ }));
167
+ }
168
+ function pipelineSignalLines(tick, align = "center") {
169
+ const stages = ["dispatch", "implement", "validate", "ship", "close"];
170
+ const active = Math.floor(tick / 12) % stages.length;
171
+ const packet = ["\u25CF", "\u2022", "\u25C6", "\u2022"][Math.floor(tick / 3) % 4];
172
+ const rail = stages.map((stage, index) => `${index === active ? packet : "\u2022"} ${stage}`).join(" \u2500\u2500 ");
173
+ const scan = stages.map((_stage, index) => index === active ? " \u258C\u258C " : " \u2502 ").join(" ");
174
+ return [
175
+ { text: scan, styledText: styledLine(scan, motionColor), fg: RIG_UI.limeDim, align },
176
+ { text: rail, styledText: styledLine(rail, motionColor), fg: RIG_UI.ink2, align }
177
+ ];
178
+ }
179
+ function orbitSignalLines(tick, align = "center") {
180
+ const p = Math.floor(tick / 5) % 8;
181
+ const dots = Array.from({ length: 8 }, (_, index) => index === p ? "\u25CF" : index === (p + 7) % 8 ? "\u2022" : "\xB7");
182
+ const top = ` ${dots[0]}\u2500\u2500\u2500\u2500${dots[1]}\u2500\u2500\u2500\u2500${dots[2]} `;
183
+ const mid = `${actionDrone(tick, 0)} ${dots[7]} operator bus ${dots[3]} ${actionDrone(tick, 2)}`;
184
+ const bot = ` ${dots[6]}\u2500\u2500\u2500\u2500${dots[5]}\u2500\u2500\u2500\u2500${dots[4]} `;
185
+ return [top, mid, bot].map((text) => ({ text, styledText: styledLine(text, motionColor), fg: RIG_UI.ink2, align }));
186
+ }
187
+ function dronePlainFrame(tick) {
188
+ return brandFleetLines(tick).map((entry) => entry.text);
189
+ }
190
+ function bigDroneLines(tick, align = "center") {
191
+ return brandFleetLines(tick, align);
192
+ }
193
+ function actionDrone(tick, phase = 0) {
194
+ const blade = bladeForTick(tick, phase);
195
+ const eye = eyeForTick(tick, phase);
196
+ return `(${blade})\u2572${eye}\u2571(${blade})`;
197
+ }
198
+ function actionDroneLine(tick, text, fg = RIG_UI.ink2) {
199
+ const prefix = actionDrone(tick);
200
+ const content = `${prefix} ${text}`;
201
+ return { text: content, styledText: styledLine(content, motionColor), fg, align: "center" };
202
+ }
203
+ function errorDrone(tick) {
204
+ return brandFleetLines(tick).map((line, index) => ({
205
+ ...line,
206
+ fg: index % 2 === 0 ? RIG_UI.red : line.fg
207
+ }));
208
+ }
209
+ function handoffDrone(tick) {
210
+ return orbitSignalLines(tick).map((line, index) => ({
211
+ ...line,
212
+ fg: index === 1 ? RIG_UI.cyan : line.fg
213
+ }));
214
+ }
215
+ export {
216
+ pipelineSignalLines,
217
+ orbitSignalLines,
218
+ miniDroneLines,
219
+ leadMarkLines,
220
+ handoffDrone,
221
+ errorDrone,
222
+ dronePlainFrame,
223
+ brandFleetLines,
224
+ bigDroneLines,
225
+ actionDroneLine,
226
+ actionDrone
227
+ };
@@ -0,0 +1,7 @@
1
+ import type { AppEventBus } from "./types";
2
+ export declare function createAppEventBus(): AppEventBus;
3
+ export declare function normalizeError(error: unknown): {
4
+ message: string;
5
+ hint?: string;
6
+ cause?: unknown;
7
+ };
@@ -0,0 +1,28 @@
1
+ // @bun
2
+ // packages/cli/src/app-opentui/events.ts
3
+ function createAppEventBus() {
4
+ const listeners = new Set;
5
+ return {
6
+ emit(event) {
7
+ for (const listener of [...listeners])
8
+ listener(event);
9
+ },
10
+ subscribe(listener) {
11
+ listeners.add(listener);
12
+ return () => listeners.delete(listener);
13
+ }
14
+ };
15
+ }
16
+ function normalizeError(error) {
17
+ const message = error instanceof Error ? error.message : String(error);
18
+ const rawHint = error instanceof Error ? error.hint : undefined;
19
+ return {
20
+ message: message || "Unknown Rig app error",
21
+ ...typeof rawHint === "string" && rawHint.trim() ? { hint: rawHint.trim() } : {},
22
+ cause: error
23
+ };
24
+ }
25
+ export {
26
+ normalizeError,
27
+ createAppEventBus
28
+ };
@@ -0,0 +1,8 @@
1
+ export { createAppEventBus, normalizeError } from "./events";
2
+ export { intentFromArgv, intentFromTypeBar } from "./intent";
3
+ export { computeStageLayout, type StageLayout } from "./layout";
4
+ export { launchRigOpenTuiApp } from "./runtime";
5
+ export { createInitialAppState, createAppStore, reduceAppEvent } from "./state";
6
+ export { RIG_SPINNER_FRAMES, RIG_UI, statusColor } from "./theme";
7
+ export { actionDrone, actionDroneLine, bigDroneLines, dronePlainFrame, errorDrone, handoffDrone } from "./drone";
8
+ export type { AppActionKind, AppAdapter, AppEvent, AppEventBus, AppFooterState, AppIntent, AppLaunchOptions, AppRuntime, AppSceneFrame, AppSceneId, AppSceneLine, AppSceneRenderer, AppState, AppStatePatch, AppStatus, AppStore, AppTypeBarState, } from "./types";