@ishlabs/cli 0.8.1 → 0.8.3
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 +323 -21
- package/dist/auth.d.ts +17 -1
- package/dist/auth.js +62 -9
- package/dist/commands/ask.d.ts +5 -0
- package/dist/commands/ask.js +722 -0
- package/dist/commands/config.js +25 -1
- package/dist/commands/docs.d.ts +17 -0
- package/dist/commands/docs.js +147 -0
- package/dist/commands/init.d.ts +16 -0
- package/dist/commands/init.js +182 -0
- package/dist/commands/iteration.d.ts +5 -1
- package/dist/commands/iteration.js +243 -31
- package/dist/commands/profile.d.ts +5 -0
- package/dist/commands/profile.js +313 -0
- package/dist/commands/source.d.ts +10 -0
- package/dist/commands/source.js +78 -0
- package/dist/commands/study-run.d.ts +11 -0
- package/dist/commands/study-run.js +552 -0
- package/dist/commands/study-tester.d.ts +8 -0
- package/dist/commands/study-tester.js +149 -0
- package/dist/commands/study.js +145 -70
- package/dist/commands/workspace.js +193 -7
- package/dist/config.d.ts +3 -1
- package/dist/config.js +10 -10
- package/dist/connect.d.ts +4 -1
- package/dist/connect.js +127 -94
- package/dist/index.js +82 -34
- package/dist/lib/alias-store.d.ts +3 -0
- package/dist/lib/alias-store.js +9 -7
- package/dist/lib/api-client.d.ts +9 -6
- package/dist/lib/api-client.js +87 -26
- package/dist/lib/ask-questions.d.ts +9 -0
- package/dist/lib/ask-questions.js +35 -0
- package/dist/lib/ask-variants.d.ts +48 -0
- package/dist/lib/ask-variants.js +236 -0
- package/dist/lib/auth.d.ts +1 -1
- package/dist/lib/auth.js +24 -8
- package/dist/lib/colors.d.ts +30 -0
- package/dist/lib/colors.js +48 -0
- package/dist/lib/command-helpers.d.ts +74 -0
- package/dist/lib/command-helpers.js +232 -6
- package/dist/lib/docs.d.ts +32 -0
- package/dist/lib/docs.js +930 -0
- package/dist/lib/local-sim/browser.d.ts +0 -1
- package/dist/lib/local-sim/browser.js +0 -2
- package/dist/lib/local-sim/install.d.ts +2 -12
- package/dist/lib/local-sim/install.js +22 -30
- package/dist/lib/output.d.ts +25 -3
- package/dist/lib/output.js +465 -20
- package/dist/lib/paths.d.ts +14 -0
- package/dist/lib/paths.js +36 -0
- package/dist/lib/profile-sources.d.ts +55 -0
- package/dist/lib/profile-sources.js +157 -0
- package/dist/lib/site-access.d.ts +80 -0
- package/dist/lib/site-access.js +188 -0
- package/dist/lib/skill-content.d.ts +31 -0
- package/dist/lib/skill-content.js +462 -0
- package/dist/lib/study-inputs.d.ts +20 -0
- package/dist/lib/study-inputs.js +72 -0
- package/dist/lib/types.d.ts +207 -9
- package/dist/lib/types.js +7 -0
- package/dist/lib/upload.js +2 -2
- package/dist/upgrade.js +11 -1
- package/package.json +3 -2
- package/dist/commands/simulation.d.ts +0 -10
- package/dist/commands/simulation.js +0 -647
- package/dist/commands/tester-profile.d.ts +0 -5
- package/dist/commands/tester-profile.js +0 -109
- package/dist/commands/tester.d.ts +0 -5
- package/dist/commands/tester.js +0 -73
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { type Browser, type BrowserContext, type Page } from "playwright-core";
|
|
9
9
|
import type { LocalSimBrowserOptions, TreeData } from "./types.js";
|
|
10
|
-
import "./install.js";
|
|
11
10
|
export interface BrowserSession {
|
|
12
11
|
browser: Browser;
|
|
13
12
|
context: BrowserContext;
|
|
@@ -6,8 +6,6 @@
|
|
|
6
6
|
* with single-space indentation per level.
|
|
7
7
|
*/
|
|
8
8
|
import { chromium } from "playwright-core";
|
|
9
|
-
// Import install module for side-effect: sets PLAYWRIGHT_BROWSERS_PATH
|
|
10
|
-
import "./install.js";
|
|
11
9
|
// Viewport presets matching backend (app/simulation/computers/config.py)
|
|
12
10
|
const VIEWPORT_PRESETS = {
|
|
13
11
|
desktop: { width: 1440, height: 900 },
|
|
@@ -1,19 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Browser installation management for local simulations.
|
|
3
|
-
* Uses playwright-core to download and manage Chromium
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Get the Playwright browsers path for ish.
|
|
7
|
-
*/
|
|
8
|
-
export declare function getBrowsersPath(): string;
|
|
9
|
-
/**
|
|
10
|
-
* Check if Chromium is installed in the ish browsers directory.
|
|
3
|
+
* Uses playwright-core to download and manage Chromium in Playwright's
|
|
4
|
+
* default cache (`~/Library/Caches/ms-playwright` on macOS, etc.).
|
|
11
5
|
*/
|
|
12
6
|
export declare function isBrowserInstalled(): boolean;
|
|
13
|
-
/**
|
|
14
|
-
* Install Chromium browser for local simulations.
|
|
15
|
-
* Downloads ~120 MB on first use.
|
|
16
|
-
*/
|
|
17
7
|
export declare function installBrowser(quiet?: boolean): Promise<void>;
|
|
18
8
|
/**
|
|
19
9
|
* Ensure Chromium is available, installing if needed.
|
|
@@ -1,27 +1,28 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Browser installation management for local simulations.
|
|
3
|
-
* Uses playwright-core to download and manage Chromium
|
|
3
|
+
* Uses playwright-core to download and manage Chromium in Playwright's
|
|
4
|
+
* default cache (`~/Library/Caches/ms-playwright` on macOS, etc.).
|
|
4
5
|
*/
|
|
5
|
-
import { execSync } from "node:child_process";
|
|
6
6
|
import { existsSync } from "node:fs";
|
|
7
|
-
import { join } from "node:path";
|
|
8
|
-
import { homedir } from "node:os";
|
|
9
7
|
import { chromium } from "playwright-core";
|
|
10
|
-
|
|
11
|
-
//
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
// Deep-import the bundled registry so this works in both the npm-install path
|
|
9
|
+
// and the standalone bun binary (which has no `npx` to spawn).
|
|
10
|
+
import { registry } from "playwright-core/lib/server/registry/index";
|
|
11
|
+
// playwright-core's userAgent module does `require("../../../package.json")`
|
|
12
|
+
// at runtime to read its version. bun's --compile bundler is unreliable about
|
|
13
|
+
// embedding that JSON, which causes install to crash in the standalone binary
|
|
14
|
+
// with "Cannot find module ../../../package.json". Setting PW_VERSION_OVERRIDE
|
|
15
|
+
// makes that code path skip the require entirely.
|
|
16
|
+
//
|
|
17
|
+
// Keep this string in sync with the playwright-core dep in package.json. It
|
|
18
|
+
// only feeds the User-Agent string sent to download CDN, so a slight mismatch
|
|
19
|
+
// is harmless.
|
|
20
|
+
const PLAYWRIGHT_CORE_VERSION = "1.59.1";
|
|
21
|
+
if (!process.env.PW_VERSION_OVERRIDE) {
|
|
22
|
+
process.env.PW_VERSION_OVERRIDE = PLAYWRIGHT_CORE_VERSION;
|
|
18
23
|
}
|
|
19
|
-
/**
|
|
20
|
-
* Check if Chromium is installed in the ish browsers directory.
|
|
21
|
-
*/
|
|
22
24
|
export function isBrowserInstalled() {
|
|
23
25
|
try {
|
|
24
|
-
// Try to get the executable path - if it throws, browser isn't installed
|
|
25
26
|
const execPath = chromium.executablePath();
|
|
26
27
|
return existsSync(execPath);
|
|
27
28
|
}
|
|
@@ -29,27 +30,18 @@ export function isBrowserInstalled() {
|
|
|
29
30
|
return false;
|
|
30
31
|
}
|
|
31
32
|
}
|
|
32
|
-
/**
|
|
33
|
-
* Install Chromium browser for local simulations.
|
|
34
|
-
* Downloads ~120 MB on first use.
|
|
35
|
-
*/
|
|
36
33
|
export async function installBrowser(quiet = false) {
|
|
37
34
|
const log = (msg) => { if (!quiet)
|
|
38
35
|
console.error(msg); };
|
|
39
36
|
log("Installing Chromium for local simulations (~120 MB)...");
|
|
40
37
|
try {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
env: {
|
|
44
|
-
...process.env,
|
|
45
|
-
PLAYWRIGHT_BROWSERS_PATH: BROWSERS_DIR,
|
|
46
|
-
},
|
|
47
|
-
});
|
|
38
|
+
const executables = registry.resolveBrowsers(["chromium"], {});
|
|
39
|
+
await registry.install(executables, { force: false });
|
|
48
40
|
log("Chromium installed successfully.");
|
|
49
41
|
}
|
|
50
42
|
catch (err) {
|
|
51
|
-
|
|
52
|
-
|
|
43
|
+
const detail = err instanceof Error ? err.message : String(err);
|
|
44
|
+
throw new Error(`Failed to install Chromium: ${detail}`);
|
|
53
45
|
}
|
|
54
46
|
}
|
|
55
47
|
/**
|
|
@@ -65,7 +57,7 @@ export async function ensureBrowser(opts = {}) {
|
|
|
65
57
|
const answer = await rl.question("Chromium browser not found. Download (~120 MB) for local simulations? [Y/n] ");
|
|
66
58
|
rl.close();
|
|
67
59
|
if (answer && !["y", "yes", ""].includes(answer.toLowerCase().trim())) {
|
|
68
|
-
throw new Error("Local simulation requires Chromium.
|
|
60
|
+
throw new Error("Local simulation requires Chromium. Re-run `ish study run --local` to install and retry.");
|
|
69
61
|
}
|
|
70
62
|
}
|
|
71
63
|
await installBrowser(opts.quiet);
|
package/dist/lib/output.d.ts
CHANGED
|
@@ -9,7 +9,22 @@
|
|
|
9
9
|
/** Set by withClient() based on global flags. */
|
|
10
10
|
export declare function setVerbose(v: boolean): void;
|
|
11
11
|
export declare function setFields(fields?: string[]): void;
|
|
12
|
-
|
|
12
|
+
/** Per-call output options for stable JSON contracts. */
|
|
13
|
+
export interface OutputOptions {
|
|
14
|
+
/**
|
|
15
|
+
* Write-path responses (create/update/delete) preserve canonical identifiers
|
|
16
|
+
* (id, *_id) regardless of --verbose. Agents need the UUID handle to chain
|
|
17
|
+
* follow-up calls without having to discover --verbose.
|
|
18
|
+
*/
|
|
19
|
+
writePath?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Set when the formatter has already projected the data to a known field
|
|
22
|
+
* set. Skips the lean-JSON pass (which would strip e.g. `created_at`) but
|
|
23
|
+
* still applies `--fields` so callers can narrow the projection further.
|
|
24
|
+
*/
|
|
25
|
+
preProjected?: boolean;
|
|
26
|
+
}
|
|
27
|
+
export declare function output(data: unknown, json: boolean, options?: OutputOptions): void;
|
|
13
28
|
export declare function outputList(rows: unknown[], json: boolean): void;
|
|
14
29
|
/**
|
|
15
30
|
* Error with valid options — used for content_type and similar validation.
|
|
@@ -23,12 +38,19 @@ export declare function outputError(err: unknown, json: boolean): void;
|
|
|
23
38
|
export declare function printTable(headers: string[], rows: string[][]): void;
|
|
24
39
|
export declare function printKeyValue(obj: Record<string, unknown>, indent?: string): void;
|
|
25
40
|
export declare function formatWorkspaceList(workspaces: Record<string, unknown>[], json: boolean): void;
|
|
26
|
-
export declare function formatWorkspaceDetail(workspace: Record<string, unknown>, json: boolean): void;
|
|
41
|
+
export declare function formatWorkspaceDetail(workspace: Record<string, unknown>, json: boolean, options?: OutputOptions): void;
|
|
42
|
+
export declare function formatSiteAccessStatus(summary: import("./site-access.js").SiteAccessSummary, json: boolean): void;
|
|
27
43
|
export declare function formatStudyList(studies: Record<string, unknown>[], json: boolean): void;
|
|
28
|
-
export declare function formatStudyDetail(study: Record<string, unknown>, json: boolean): void;
|
|
44
|
+
export declare function formatStudyDetail(study: Record<string, unknown>, json: boolean, options?: OutputOptions): void;
|
|
29
45
|
export declare function formatStudyResults(study: Record<string, unknown>, json: boolean): void;
|
|
30
46
|
export declare function formatIterationList(iterations: Record<string, unknown>[], json: boolean): void;
|
|
31
47
|
export declare function formatTesterDetail(tester: Record<string, unknown>, json: boolean): void;
|
|
32
48
|
export declare function formatTesterProfileList(profiles: unknown, json: boolean, limit?: number): void;
|
|
49
|
+
export declare function formatAudienceSource(source: Record<string, unknown>, json: boolean): void;
|
|
50
|
+
export declare function formatGeneratedProfileList(profiles: unknown, json: boolean): void;
|
|
33
51
|
export declare function formatSimulationPoll(results: Record<string, unknown>[], json: boolean, isMedia?: boolean): void;
|
|
52
|
+
export declare function formatAskList(asks: Record<string, unknown>[], json: boolean): void;
|
|
53
|
+
export declare function formatAskDetail(ask: Record<string, unknown>, json: boolean): void;
|
|
54
|
+
export declare function formatRoundDetail(round: Record<string, unknown>, json: boolean): void;
|
|
55
|
+
export declare function formatAskResults(ask: Record<string, unknown>, json: boolean, roundFilter?: number): void;
|
|
34
56
|
export declare function formatConfigList(configs: Record<string, unknown>[], json: boolean): void;
|