@av-pi-studio/cli 0.0.88 → 0.0.89
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/README.md
CHANGED
|
@@ -151,11 +151,11 @@ come before `pi` on the command line) redirects the bundled CLI's `.pi` config d
|
|
|
151
151
|
does for a locally-spawned daemon. Falls back to a global `pi` on `$PATH` if the bundled
|
|
152
152
|
dependency isn't installed. Never touches the daemon or the wire protocol.
|
|
153
153
|
|
|
154
|
-
### `
|
|
154
|
+
### `ui`
|
|
155
155
|
|
|
156
|
-
| Command
|
|
157
|
-
|
|
|
158
|
-
| `
|
|
156
|
+
| Command | Description |
|
|
157
|
+
| ------------------------------------------------------------------- | --------------------------------------------------- |
|
|
158
|
+
| `ui [--ui-host <host>] [--ui-port <port>] [--daemon-host <host>]` | Serve the prebuilt web-client SPA as a static site |
|
|
159
159
|
|
|
160
160
|
Serves the built `@av-pi-studio/web-client` UI (`dist/web`) via a minimal static file server with
|
|
161
161
|
SPA fallback — no vite/dev dependency at runtime, works from any install shape. `--daemon-host`
|
package/dist/program.js
CHANGED
|
@@ -7,7 +7,7 @@ import { registerExtensionsCommands } from "./extensions-commands.js";
|
|
|
7
7
|
import { registerFeatureCommands, runOpenProject } from "./feature-commands.js";
|
|
8
8
|
import { registerPiCommands } from "./pi-commands.js";
|
|
9
9
|
import { registerRelayCommands } from "./relay-commands.js";
|
|
10
|
-
import {
|
|
10
|
+
import { registerUiCommands } from "./ui-commands.js";
|
|
11
11
|
import { registerUpdateCommands } from "./update-commands.js";
|
|
12
12
|
import { defaultContext } from "./cli-core.js";
|
|
13
13
|
// Read our own package.json for the version, same relative layout in both `src/` (ts-node/tsx)
|
|
@@ -62,7 +62,7 @@ function registerCommands(program, ctx, setExit) {
|
|
|
62
62
|
registerFeatureCommands(program, ctx, setExit);
|
|
63
63
|
registerPiCommands(program, ctx, setExit);
|
|
64
64
|
registerRelayCommands(program, ctx, setExit);
|
|
65
|
-
|
|
65
|
+
registerUiCommands(program, ctx, setExit);
|
|
66
66
|
registerUpdateCommands(program, ctx, setExit);
|
|
67
67
|
}
|
|
68
68
|
/**
|
|
@@ -2,25 +2,25 @@ import type { Command } from "commander";
|
|
|
2
2
|
import { type CliContext } from "./cli-core.js";
|
|
3
3
|
import { type WebServerHandle } from "./web-server.js";
|
|
4
4
|
/**
|
|
5
|
-
* `
|
|
5
|
+
* `ui` command group (features/cli.md § Command tree — `ui`): serves the prebuilt
|
|
6
6
|
* `@av-pi-studio/web-client` SPA as a static site. Serving is intentionally decoupled from daemon
|
|
7
|
-
* lifecycle — `pi-studio
|
|
7
|
+
* lifecycle — `pi-studio ui` never starts/probes a daemon; `--daemon-host` only pre-fills the
|
|
8
8
|
* printed URL's `?host=&connect=1` query params so the browser tab auto-connects, mirroring the
|
|
9
9
|
* POC's `chat.html` quick-launch params.
|
|
10
10
|
*/
|
|
11
|
-
export interface
|
|
11
|
+
export interface UiCommandOptions {
|
|
12
12
|
host?: string;
|
|
13
13
|
port?: string;
|
|
14
14
|
daemonHost?: string;
|
|
15
15
|
}
|
|
16
|
-
export declare const
|
|
17
|
-
export declare const
|
|
16
|
+
export declare const DEFAULT_UI_HOST = "127.0.0.1";
|
|
17
|
+
export declare const DEFAULT_UI_PORT = 4173;
|
|
18
18
|
/** Build the browser-facing URL, optionally pre-filled with daemon connection query params. */
|
|
19
19
|
export declare function buildServeUrl(baseUrl: string, daemonHostArg?: string): string;
|
|
20
20
|
/** Serve the web-client UI; returns an exit code and (on success) the running server handle. */
|
|
21
|
-
export declare function
|
|
21
|
+
export declare function runServeUi(ctx: CliContext, opts: UiCommandOptions): Promise<{
|
|
22
22
|
code: number;
|
|
23
23
|
handle?: WebServerHandle;
|
|
24
24
|
}>;
|
|
25
|
-
export declare function
|
|
26
|
-
//# sourceMappingURL=
|
|
25
|
+
export declare function registerUiCommands(program: Command, ctx: CliContext, setExit: (code: number) => void): void;
|
|
26
|
+
//# sourceMappingURL=ui-commands.d.ts.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { EXIT_ERROR, EXIT_OK } from "./cli-core.js";
|
|
2
2
|
import { parseHost, hostToUrl } from "./connection.js";
|
|
3
3
|
import { resolveWebClientDist, startWebServer } from "./web-server.js";
|
|
4
|
-
export const
|
|
5
|
-
export const
|
|
4
|
+
export const DEFAULT_UI_HOST = "127.0.0.1";
|
|
5
|
+
export const DEFAULT_UI_PORT = 4173;
|
|
6
6
|
/** Build the browser-facing URL, optionally pre-filled with daemon connection query params. */
|
|
7
7
|
export function buildServeUrl(baseUrl, daemonHostArg) {
|
|
8
8
|
if (!daemonHostArg)
|
|
@@ -15,7 +15,7 @@ export function buildServeUrl(baseUrl, daemonHostArg) {
|
|
|
15
15
|
return url.toString();
|
|
16
16
|
}
|
|
17
17
|
/** Serve the web-client UI; returns an exit code and (on success) the running server handle. */
|
|
18
|
-
export async function
|
|
18
|
+
export async function runServeUi(ctx, opts) {
|
|
19
19
|
let dir;
|
|
20
20
|
try {
|
|
21
21
|
dir = resolveWebClientDist();
|
|
@@ -24,8 +24,8 @@ export async function runServeWeb(ctx, opts) {
|
|
|
24
24
|
ctx.sink.error(err instanceof Error ? err.message : String(err));
|
|
25
25
|
return { code: EXIT_ERROR };
|
|
26
26
|
}
|
|
27
|
-
const host = opts.host ??
|
|
28
|
-
const port = Number(opts.port ??
|
|
27
|
+
const host = opts.host ?? DEFAULT_UI_HOST;
|
|
28
|
+
const port = Number(opts.port ?? DEFAULT_UI_PORT);
|
|
29
29
|
let handle;
|
|
30
30
|
try {
|
|
31
31
|
handle = await startWebServer({ dir, host, port });
|
|
@@ -37,18 +37,18 @@ export async function runServeWeb(ctx, opts) {
|
|
|
37
37
|
ctx.sink.write(`serving Pi-Studio web UI at ${buildServeUrl(handle.url, opts.daemonHost)}`);
|
|
38
38
|
return { code: EXIT_OK, handle };
|
|
39
39
|
}
|
|
40
|
-
export function
|
|
40
|
+
export function registerUiCommands(program, ctx, setExit) {
|
|
41
41
|
const g = () => program.opts();
|
|
42
42
|
program
|
|
43
|
-
.command("
|
|
43
|
+
.command("ui")
|
|
44
44
|
.description("serve the Pi-Studio web UI (prebuilt static build)")
|
|
45
|
-
.option("--
|
|
46
|
-
.option("--
|
|
45
|
+
.option("--ui-host <host>", "interface to bind", DEFAULT_UI_HOST)
|
|
46
|
+
.option("--ui-port <port>", "port to bind", String(DEFAULT_UI_PORT))
|
|
47
47
|
.option("--daemon-host <host>", "daemon to auto-connect the served UI to (fills ?host=&connect=1)")
|
|
48
48
|
.action(async (cmdOpts) => {
|
|
49
|
-
const { code, handle } = await
|
|
50
|
-
host: cmdOpts.
|
|
51
|
-
port: cmdOpts.
|
|
49
|
+
const { code, handle } = await runServeUi(ctx, {
|
|
50
|
+
host: cmdOpts.uiHost,
|
|
51
|
+
port: cmdOpts.uiPort,
|
|
52
52
|
daemonHost: cmdOpts.daemonHost ?? g().host,
|
|
53
53
|
});
|
|
54
54
|
if (!handle) {
|
|
@@ -67,4 +67,4 @@ export function registerWebCommands(program, ctx, setExit) {
|
|
|
67
67
|
setExit(EXIT_OK);
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
|
-
//# sourceMappingURL=
|
|
70
|
+
//# sourceMappingURL=ui-commands.js.map
|
package/dist/web-server.js
CHANGED
|
@@ -4,7 +4,7 @@ import { readFile } from "node:fs/promises";
|
|
|
4
4
|
import { extname, join, normalize, sep } from "node:path";
|
|
5
5
|
/**
|
|
6
6
|
* Static file server for the prebuilt `@av-pi-studio/web-client` SPA (features/cli.md § Command
|
|
7
|
-
* tree — `
|
|
7
|
+
* tree — `ui`). The CLI ships no dev-server dependency (vite, etc.); it serves the already-built
|
|
8
8
|
* `dist/web` output from the `web-client` package and falls back to `index.html` for unknown
|
|
9
9
|
* paths (client-side routing via react-router).
|
|
10
10
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@av-pi-studio/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.89",
|
|
4
4
|
"bin": {
|
|
5
5
|
"pi-studio": "dist/cli.js"
|
|
6
6
|
},
|
|
@@ -23,11 +23,11 @@
|
|
|
23
23
|
"clean": "rm -rf dist *.tsbuildinfo"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@av-pi-studio/client": "^0.0.
|
|
27
|
-
"@av-pi-studio/protocol": "^0.0.
|
|
28
|
-
"@av-pi-studio/relay": "^0.0.
|
|
29
|
-
"@av-pi-studio/server": "^0.0.
|
|
30
|
-
"@av-pi-studio/web-client": "^0.0.
|
|
26
|
+
"@av-pi-studio/client": "^0.0.89",
|
|
27
|
+
"@av-pi-studio/protocol": "^0.0.89",
|
|
28
|
+
"@av-pi-studio/relay": "^0.0.89",
|
|
29
|
+
"@av-pi-studio/server": "^0.0.89",
|
|
30
|
+
"@av-pi-studio/web-client": "^0.0.89",
|
|
31
31
|
"@earendil-works/pi-coding-agent": "^0.84.1",
|
|
32
32
|
"@inquirer/prompts": "^8.5.2",
|
|
33
33
|
"bcryptjs": "^3.0.3",
|