@plune-ai/cairn 0.2.1 → 0.3.2
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/LICENSE +201 -674
- package/README.md +275 -181
- package/dist/agent/finalize.d.ts +20 -0
- package/dist/agent/finalize.d.ts.map +1 -0
- package/dist/agent/finalize.js +42 -0
- package/dist/agent/finalize.js.map +1 -0
- package/dist/agent/graph.d.ts +40 -0
- package/dist/agent/graph.d.ts.map +1 -1
- package/dist/agent/graph.js +0 -0
- package/dist/agent/graph.js.map +1 -1
- package/dist/agent/index.d.ts +18 -0
- package/dist/agent/index.d.ts.map +1 -1
- package/dist/agent/index.js +166 -64
- package/dist/agent/index.js.map +1 -1
- package/dist/agent/observe-guard.d.ts +14 -0
- package/dist/agent/observe-guard.d.ts.map +1 -0
- package/dist/agent/observe-guard.js +46 -0
- package/dist/agent/observe-guard.js.map +1 -0
- package/dist/agent/progress.d.ts +22 -0
- package/dist/agent/progress.d.ts.map +1 -0
- package/dist/agent/progress.js +25 -0
- package/dist/agent/progress.js.map +1 -0
- package/dist/agent/repair-loop.d.ts +26 -0
- package/dist/agent/repair-loop.d.ts.map +1 -0
- package/dist/agent/repair-loop.js +42 -0
- package/dist/agent/repair-loop.js.map +1 -0
- package/dist/agent/summary.d.ts +53 -0
- package/dist/agent/summary.d.ts.map +1 -0
- package/dist/agent/summary.js +103 -0
- package/dist/agent/summary.js.map +1 -0
- package/dist/agent/testcase-docs.d.ts +20 -0
- package/dist/agent/testcase-docs.d.ts.map +1 -0
- package/dist/agent/testcase-docs.js +30 -0
- package/dist/agent/testcase-docs.js.map +1 -0
- package/dist/artifacts/report.d.ts +10 -0
- package/dist/artifacts/report.d.ts.map +1 -1
- package/dist/artifacts/report.js +16 -0
- package/dist/artifacts/report.js.map +1 -1
- package/dist/browser/backends/playwright-lib.d.ts.map +1 -1
- package/dist/browser/backends/playwright-lib.js +17 -6
- package/dist/browser/backends/playwright-lib.js.map +1 -1
- package/dist/browser/preflight.d.ts +46 -0
- package/dist/browser/preflight.d.ts.map +1 -0
- package/dist/browser/preflight.js +73 -0
- package/dist/browser/preflight.js.map +1 -0
- package/dist/cli/index.d.ts +10 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +327 -266
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/is-main.d.ts +10 -0
- package/dist/cli/is-main.d.ts.map +1 -0
- package/dist/cli/is-main.js +21 -0
- package/dist/cli/is-main.js.map +1 -0
- package/dist/codegen/index.d.ts +3 -1
- package/dist/codegen/index.d.ts.map +1 -1
- package/dist/codegen/index.js +7 -2
- package/dist/codegen/index.js.map +1 -1
- package/dist/config/index.d.ts +1 -1
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +80 -2
- package/dist/config/index.js.map +1 -1
- package/dist/config/profiles.d.ts +14 -1
- package/dist/config/profiles.d.ts.map +1 -1
- package/dist/config/profiles.js +30 -0
- package/dist/config/profiles.js.map +1 -1
- package/dist/config/schema.d.ts +23 -1
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/schema.js +7 -2
- package/dist/config/schema.js.map +1 -1
- package/dist/core/config.d.ts +18 -0
- package/dist/core/config.d.ts.map +1 -0
- package/dist/core/config.js +23 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/index.d.ts +15 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +13 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/modalities/explore.d.ts +3 -0
- package/dist/core/modalities/explore.d.ts.map +1 -0
- package/dist/core/modalities/explore.js +82 -0
- package/dist/core/modalities/explore.js.map +1 -0
- package/dist/core/modality.d.ts +49 -0
- package/dist/core/modality.d.ts.map +1 -0
- package/dist/core/modality.js +24 -0
- package/dist/core/modality.js.map +1 -0
- package/dist/core/registry.d.ts +11 -0
- package/dist/core/registry.d.ts.map +1 -0
- package/dist/core/registry.js +43 -0
- package/dist/core/registry.js.map +1 -0
- package/dist/core/reporting.d.ts +11 -0
- package/dist/core/reporting.d.ts.map +1 -0
- package/dist/core/reporting.js +13 -0
- package/dist/core/reporting.js.map +1 -0
- package/dist/index.d.ts +6 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/dist/llm/cost.d.ts +53 -0
- package/dist/llm/cost.d.ts.map +1 -0
- package/dist/llm/cost.js +99 -0
- package/dist/llm/cost.js.map +1 -0
- package/dist/llm/factory.d.ts +18 -0
- package/dist/llm/factory.d.ts.map +1 -1
- package/dist/llm/factory.js +24 -0
- package/dist/llm/factory.js.map +1 -1
- package/dist/llm/index.d.ts +6 -1
- package/dist/llm/index.d.ts.map +1 -1
- package/dist/llm/index.js +5 -1
- package/dist/llm/index.js.map +1 -1
- package/dist/llm/routing.d.ts +40 -0
- package/dist/llm/routing.d.ts.map +1 -0
- package/dist/llm/routing.js +52 -0
- package/dist/llm/routing.js.map +1 -0
- package/dist/llm/structured.d.ts +28 -5
- package/dist/llm/structured.d.ts.map +1 -1
- package/dist/llm/structured.js +42 -9
- package/dist/llm/structured.js.map +1 -1
- package/dist/prompts/local/identify-elements.js +15 -15
- package/dist/prompts/local/judge-checklist-coverage.js +8 -8
- package/dist/prompts/local/judge-test-cases.js +8 -8
- package/dist/prompts/local/pilot-review.js +10 -10
- package/dist/prompts/local/qa-manual-test-designer.d.ts +1 -1
- package/dist/prompts/local/qa-manual-test-designer.js +7 -7
- package/dist/prompts/local/qa-playwright-ts-writer.d.ts +1 -1
- package/dist/prompts/local/qa-playwright-ts-writer.js +35 -35
- package/dist/prompts/local/qa-testcase-from-ui.d.ts +1 -1
- package/dist/prompts/local/qa-testcase-from-ui.js +47 -47
- package/dist/session/capture.d.ts +31 -0
- package/dist/session/capture.d.ts.map +1 -0
- package/dist/session/capture.js +84 -0
- package/dist/session/capture.js.map +1 -0
- package/dist/session/index.d.ts +16 -0
- package/dist/session/index.d.ts.map +1 -1
- package/dist/session/index.js +52 -2
- package/dist/session/index.js.map +1 -1
- package/dist/tui/screens/summary-screen.d.ts.map +1 -1
- package/dist/tui/screens/summary-screen.js +13 -1
- package/dist/tui/screens/summary-screen.js.map +1 -1
- package/dist/validate/runner.d.ts +6 -0
- package/dist/validate/runner.d.ts.map +1 -1
- package/dist/validate/runner.js +28 -9
- package/dist/validate/runner.js.map +1 -1
- package/package.json +98 -97
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import { chromium } from "playwright";
|
|
3
|
+
/**
|
|
4
|
+
* Browser preflight (onboarding guardrail).
|
|
5
|
+
*
|
|
6
|
+
* `npm install @plune-ai/cairn` pulls the `playwright` *library* but NOT the browser
|
|
7
|
+
* *binaries* — those are a separate `npx playwright install` download. On a fresh machine
|
|
8
|
+
* `chromium.launch()` (observe/design) and the `@playwright/test` runner (automate --validate)
|
|
9
|
+
* therefore die with a raw "Executable doesn't exist …" deep inside the run, which surfaces to
|
|
10
|
+
* the user as a misleading "0% green · N failed" with the real cause buried in a child's stderr.
|
|
11
|
+
*
|
|
12
|
+
* This module turns that into one clear, actionable message — and lets callers fail fast BEFORE
|
|
13
|
+
* spending any LLM calls. Two layers cooperate (defense in depth):
|
|
14
|
+
* 1. {@link ensureBrowsersInstalled} — a cheap up-front check (is the bundled Chromium on disk?).
|
|
15
|
+
* 2. {@link isMissingBrowserError} — a string/error detector used as a backstop where a launch
|
|
16
|
+
* actually fails (e.g. the headless-shell binary is missing while full Chromium is present).
|
|
17
|
+
*/
|
|
18
|
+
/** The single source of truth for the install command we point users at. */
|
|
19
|
+
export const INSTALL_BROWSERS_HINT = "Playwright browsers are not installed.\n" +
|
|
20
|
+
"Cairn drives a Chromium build that ships separately from the npm package.\n" +
|
|
21
|
+
"Install it once, then re-run your command:\n\n" +
|
|
22
|
+
" npx playwright install chromium\n";
|
|
23
|
+
/**
|
|
24
|
+
* True when an error (or raw stderr/stdout text) is Playwright's "browser binary is missing"
|
|
25
|
+
* signature. Deliberately broad: matches the launch error, the executablePath() error, and the
|
|
26
|
+
* "please run … playwright install" banner — so it catches both the full-Chromium and the
|
|
27
|
+
* headless-shell variants regardless of which surface raised it.
|
|
28
|
+
*/
|
|
29
|
+
export function isMissingBrowserError(err) {
|
|
30
|
+
const msg = typeof err === "string" ? err : err instanceof Error ? err.message : err == null ? "" : String(err);
|
|
31
|
+
if (!msg)
|
|
32
|
+
return false;
|
|
33
|
+
return (/Executable doesn't exist/i.test(msg) ||
|
|
34
|
+
/please run the following command to download/i.test(msg) ||
|
|
35
|
+
/playwright install/i.test(msg));
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* A clean, actionable Error for the missing-browser case — no stack trace is needed because the
|
|
39
|
+
* fix is a copy-paste command. The CLI prints `error.message` verbatim (see cli/index.ts).
|
|
40
|
+
*/
|
|
41
|
+
export function missingBrowsersError(detail) {
|
|
42
|
+
const e = new Error(detail ? `${INSTALL_BROWSERS_HINT}\n(${detail})` : INSTALL_BROWSERS_HINT);
|
|
43
|
+
e.name = "BrowsersNotInstalledError";
|
|
44
|
+
return e;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Is the bundled Chromium that `chromium.launch()` and the `@playwright/test` runner use by
|
|
48
|
+
* default actually present on disk? `executablePath()` returns the computed path (and throws on
|
|
49
|
+
* some Playwright versions when nothing is installed) — we treat both "throws" and "path absent"
|
|
50
|
+
* as not-installed.
|
|
51
|
+
*/
|
|
52
|
+
export function chromiumInstalled() {
|
|
53
|
+
try {
|
|
54
|
+
const p = chromium.executablePath();
|
|
55
|
+
return Boolean(p) && existsSync(p);
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Preflight gate: throw an actionable error if the bundled Chromium is missing.
|
|
63
|
+
*
|
|
64
|
+
* Skipped when a browser `channel` (system Chrome/Edge — e.g. for OAuth) is configured, because
|
|
65
|
+
* that path drives the *system* browser, not the bundled build, so the bundle's absence is moot.
|
|
66
|
+
*/
|
|
67
|
+
export function ensureBrowsersInstalled(opts = {}) {
|
|
68
|
+
if (opts.channel)
|
|
69
|
+
return; // system browser — not the bundled Chromium
|
|
70
|
+
if (!chromiumInstalled())
|
|
71
|
+
throw missingBrowsersError();
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=preflight.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preflight.js","sourceRoot":"","sources":["../../src/browser/preflight.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC;;;;;;;;;;;;;;GAcG;AAEH,4EAA4E;AAC5E,MAAM,CAAC,MAAM,qBAAqB,GAChC,0CAA0C;IAC1C,6EAA6E;IAC7E,gDAAgD;IAChD,uCAAuC,CAAC;AAE1C;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CAAC,GAAY;IAChD,MAAM,GAAG,GACP,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACtG,IAAI,CAAC,GAAG;QAAE,OAAO,KAAK,CAAC;IACvB,OAAO,CACL,2BAA2B,CAAC,IAAI,CAAC,GAAG,CAAC;QACrC,+CAA+C,CAAC,IAAI,CAAC,GAAG,CAAC;QACzD,qBAAqB,CAAC,IAAI,CAAC,GAAG,CAAC,CAChC,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAe;IAClD,MAAM,CAAC,GAAG,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,qBAAqB,MAAM,MAAM,GAAG,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC;IAC9F,CAAC,CAAC,IAAI,GAAG,2BAA2B,CAAC;IACrC,OAAO,CAAC,CAAC;AACX,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB;IAC/B,IAAI,CAAC;QACH,MAAM,CAAC,GAAG,QAAQ,CAAC,cAAc,EAAE,CAAC;QACpC,OAAO,OAAO,CAAC,CAAC,CAAC,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC;IACrC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,uBAAuB,CAAC,OAA6B,EAAE;IACrE,IAAI,IAAI,CAAC,OAAO;QAAE,OAAO,CAAC,4CAA4C;IACtE,IAAI,CAAC,iBAAiB,EAAE;QAAE,MAAM,oBAAoB,EAAE,CAAC;AACzD,CAAC"}
|
package/dist/cli/index.d.ts
CHANGED
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
* CLI `cairn`. Commands: observe · explore · design · automate · dataset-add · experiment
|
|
3
|
+
* CLI `cairn`. Commands: observe · explore · design · automate · dataset-add · experiment ·
|
|
4
|
+
* promote · session · login, plus GATED modality stubs (ui|e2e / api / unit / docs — C1-01).
|
|
5
|
+
* The umbrella router is thin: each modality command dispatches through the shared core
|
|
6
|
+
* (`runModality`), so a future modality is a thin add, not a fork.
|
|
4
7
|
* `lex-bot` stays as a hidden, deprecated alias (see ./lex-bot.ts) → same code path.
|
|
5
8
|
*/
|
|
6
9
|
import "dotenv/config";
|
|
10
|
+
import { Command } from "commander";
|
|
11
|
+
/**
|
|
12
|
+
* Build the `cairn` commander program. Exported (C1-02) so tests can drive commands and snapshot
|
|
13
|
+
* `--help` without running the process entry point. Each call returns a fresh, independent program.
|
|
14
|
+
*/
|
|
15
|
+
export declare function buildProgram(): Command;
|
|
7
16
|
/**
|
|
8
17
|
* Run the CLI. Shared by the primary `cairn` entry (this file) and the deprecated
|
|
9
18
|
* `lex-bot` alias shim (./lex-bot.ts), so both go through the exact same code path.
|
package/dist/cli/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";AACA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";AACA;;;;;;GAMG;AACH,OAAO,eAAe,CAAC;AAGvB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAuCpC;;;GAGG;AACH,wBAAgB,YAAY,IAAI,OAAO,CA8VtC;AAED;;;GAGG;AACH,wBAAsB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAiB5C"}
|