@yaag/cli 0.2.0 → 0.2.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yaag/cli",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -21,8 +21,8 @@
21
21
  },
22
22
  "dependencies": {
23
23
  "@earendil-works/pi-tui": "^0.84.0",
24
- "@yaag/runtime": "0.2.0",
25
- "@yaag/tui": "0.2.0",
24
+ "@yaag/runtime": "0.2.1",
25
+ "@yaag/tui": "0.2.1",
26
26
  "typebox": "1.3.7"
27
27
  }
28
28
  }
@@ -1,9 +1,9 @@
1
1
  /**
2
- * The read-only half of `RunTreeViewHost` for the standalone CLI (spec §4).
2
+ * The read-only half of `RunTreeViewHost` for the standalone CLI (ADR-0008).
3
3
  *
4
4
  * The Host Session gets the same shape from `packages/extension`; here the pi
5
5
  * services are replaced by pi-tui primitives, so `apps/yaag` needs no pi. The
6
- * caller adds `stop`, `detach`, and `done`: nothing in this module can prompt
6
+ * caller adds `stop` and `done`: nothing in this module can prompt
7
7
  * an Agent (ADR — a Peek observes, it never sends).
8
8
  */
9
9
  import { readFile, writeFile } from "node:fs/promises";
@@ -26,7 +26,7 @@ export interface CliTreeHostOptions {
26
26
  }
27
27
 
28
28
  /** The read-only capabilities the CLI Run view has. */
29
- export type ReadOnlyCliHost = Omit<RunTreeViewHost, "stop" | "detach" | "done">;
29
+ export type ReadOnlyCliHost = Omit<RunTreeViewHost, "stop" | "done">;
30
30
 
31
31
  /** Builds the CLI's read-only host; it never writes to an Agent or to the Run. */
32
32
  export function createCliTreeHost(options: CliTreeHostOptions): ReadOnlyCliHost {
@@ -1,8 +1,8 @@
1
1
  /**
2
- * The `yaag run` path that opens the alt-screen Run tree (spec §4).
2
+ * The `yaag run` path that opens the alt-screen Run tree (architecture §9).
3
3
  *
4
4
  * `orchestrateInteractiveRun` is process-free: every collaborator arrives as a
5
- * parameter, so each exit path — settle, detach, fatal render, signal — is
5
+ * parameter, so each exit path — settle, close, fatal render, signal — is
6
6
  * driven in tests without a TTY. `runInteractive` is the thin production edge
7
7
  * that binds it to the real terminal, the real signals, and the real streams.
8
8
  *
@@ -63,9 +63,10 @@ export interface InteractiveRunDeps {
63
63
  * exit code of the Run.
64
64
  *
65
65
  * The terminal is restored before this resolves or rejects, on every path: the
66
- * settle-then-`q` path, a confirmed stop, a detach, and a render throw. A
67
- * detach closes the alt-screen and keeps awaiting the Run on the plain lines,
68
- * so the process never exits with a Run still running. A fatal render error is
66
+ * settle-then-`esc` path, a confirmed stop, an `esc` over a live Run, and a
67
+ * render throw. Closing the view over a live Run closes the alt-screen and
68
+ * keeps awaiting the Run on the plain lines, so the process never exits with a
69
+ * Run still running. A fatal render error is
69
70
  * reported only after the terminal is restored and the Run is aborted and
70
71
  * reaped, so no Run is abandoned pending. A fatal accepted at any point while
71
72
  * the handlers are installed is rethrown, never converted into a normal return.
@@ -118,7 +119,7 @@ export async function orchestrateInteractiveRun(deps: InteractiveRunDeps): Promi
118
119
  }
119
120
  const settled = await running;
120
121
  app.settle(viewResult(settled));
121
- // The settled view stays interactive until the reader presses `q` (spec §1).
122
+ // The settled view stays interactive until the reader presses `esc`.
122
123
  const exit = await Promise.race([app.exit, signal.wait]);
123
124
  let fatal = exit.kind === "fatal" ? exit : signal.taken();
124
125
  const closing = app.close();
package/src/tree-app.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * The standalone CLI's interactive Run view: the same `@yaag/tui` tree the Host
3
- * Session opens, hosted in an alt-screen pi-tui app (spec §4).
3
+ * Session opens, hosted in an alt-screen pi-tui app (architecture §9).
4
4
  *
5
5
  * Every collaborator arrives as a parameter, so the app is driven in tests over
6
6
  * a recording terminal; `alt-screen.ts` owns the real `ProcessTerminal`.
@@ -28,7 +28,6 @@ export interface TreeAppDeps {
28
28
  /** How the app ended. A fatal exit still restored the terminal. */
29
29
  export type TreeAppExit =
30
30
  | { readonly kind: "dismissed" }
31
- | { readonly kind: "detached" }
32
31
  | { readonly kind: "fatal"; readonly error: unknown };
33
32
 
34
33
  /** What `finish` writes after the alt-screen closes (architecture §9). */
@@ -43,7 +42,7 @@ export interface FinalOutput {
43
42
  export interface TreeApp {
44
43
  /** The projection the view reads; the caller renders the final frame from it. */
45
44
  readonly state: TreeState;
46
- /** Resolves when the reader dismisses or detaches, or a render throws. */
45
+ /** Resolves when the reader closes the view, or a render throws. */
47
46
  readonly exit: Promise<TreeAppExit>;
48
47
  /** Folds one Lifecycle Event into the projection and redraws. */
49
48
  present(event: LifecycleEvent): void;
@@ -54,7 +53,7 @@ export interface TreeApp {
54
53
  /**
55
54
  * Drains input and leaves the alt-screen, writing no channel. Once.
56
55
  *
57
- * A detach closes the alt-screen while the Run is still live, so this step is
56
+ * `esc` closes the alt-screen while the Run is still live, so this step is
58
57
  * separate from the final channel emission.
59
58
  */
60
59
  close(): Promise<void>;
@@ -98,13 +97,11 @@ export function startTreeApp(deps: TreeAppDeps): TreeApp {
98
97
  host: {
99
98
  ...host,
100
99
  stop: deps.stop,
101
- // A CLI has no background surface, so a detach closes the alt-screen and
102
- // the caller keeps awaiting the Run on the plain line presenter.
103
- detach: () => resolveExit({ kind: "detached" }),
104
- done: (kind) => resolveExit({ kind: kind === "detached" ? "detached" : "dismissed" }),
100
+ // A CLI has no background surface, so closing the view closes the
101
+ // alt-screen and the caller keeps awaiting the Run on the plain lines.
102
+ done: () => resolveExit({ kind: "dismissed" }),
105
103
  },
106
104
  ...(deps.label === undefined ? {} : { label: deps.label }),
107
- surface: "foreground",
108
105
  ...(deps.now === undefined ? {} : { now: deps.now }),
109
106
  });
110
107