@plune-ai/cairn 0.2.1 → 0.3.0
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 +256 -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 +156 -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/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +125 -10
- 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/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.js +8 -8
- package/package.json +98 -97
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** Build a {@link ProgressSnapshot} from a validation report (or zero/empty when there is none). */
|
|
2
|
+
export function progressSnapshot(v) {
|
|
3
|
+
if (!v)
|
|
4
|
+
return { greenRatio: 0, failSignature: "" };
|
|
5
|
+
const failing = v.results
|
|
6
|
+
.filter((r) => r.status !== "passed")
|
|
7
|
+
.map((r) => r.test)
|
|
8
|
+
.sort();
|
|
9
|
+
return { greenRatio: v.greenRatio, failSignature: failing.join("|") };
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Did a repair attempt make progress over the previous one?
|
|
13
|
+
* Progress = a higher green ratio OR a different set of failing tests (the repair changed *something*).
|
|
14
|
+
* No progress = the same green ratio AND an identical failure signature → the loop is stuck and should
|
|
15
|
+
* bail early instead of burning the rest of `maxRepair`. Together with the `maxRepair` cap this makes the
|
|
16
|
+
* repair loop provably converge.
|
|
17
|
+
*/
|
|
18
|
+
export function madeProgress(prev, next) {
|
|
19
|
+
if (!prev)
|
|
20
|
+
return true; // first attempt — nothing to compare against
|
|
21
|
+
if (next.greenRatio > prev.greenRatio)
|
|
22
|
+
return true;
|
|
23
|
+
return next.failSignature !== prev.failSignature;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=progress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress.js","sourceRoot":"","sources":["../../src/agent/progress.ts"],"names":[],"mappings":"AAaA,oGAAoG;AACpG,MAAM,UAAU,gBAAgB,CAAC,CAA+B;IAC9D,IAAI,CAAC,CAAC;QAAE,OAAO,EAAE,UAAU,EAAE,CAAC,EAAE,aAAa,EAAE,EAAE,EAAE,CAAC;IACpD,MAAM,OAAO,GAAG,CAAC,CAAC,OAAO;SACtB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,QAAQ,CAAC;SACpC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;SAClB,IAAI,EAAE,CAAC;IACV,OAAO,EAAE,UAAU,EAAE,CAAC,CAAC,UAAU,EAAE,aAAa,EAAE,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;AACxE,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAAC,IAAkC,EAAE,IAAsB;IACrF,IAAI,CAAC,IAAI;QAAE,OAAO,IAAI,CAAC,CAAC,6CAA6C;IACrE,IAAI,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU;QAAE,OAAO,IAAI,CAAC;IACnD,OAAO,IAAI,CAAC,aAAa,KAAK,IAAI,CAAC,aAAa,CAAC;AACnD,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { GeneratedSuite } from "../codegen/index.js";
|
|
2
|
+
import type { ValidationReport } from "../validate/index.js";
|
|
3
|
+
export interface RepairLoopDeps {
|
|
4
|
+
/** Produce AND write a suite (so `validate` can run it). `repairHint` = failing test names on a repair pass. */
|
|
5
|
+
generate: (repairHint?: string) => Promise<GeneratedSuite>;
|
|
6
|
+
/** Run the written suite and classify it. */
|
|
7
|
+
validate: () => Promise<ValidationReport>;
|
|
8
|
+
/** Max repair attempts after the initial generation. */
|
|
9
|
+
maxRepair: number;
|
|
10
|
+
onProgress?: (event: string) => void;
|
|
11
|
+
}
|
|
12
|
+
export interface RepairLoopResult {
|
|
13
|
+
bestSuite: GeneratedSuite;
|
|
14
|
+
bestValidation: ValidationReport;
|
|
15
|
+
/** Repair attempts actually run (0 = green on the first try, or maxRepair=0). */
|
|
16
|
+
attempts: number;
|
|
17
|
+
/** Stopped before maxRepair because an attempt made no progress (Box 2). */
|
|
18
|
+
stoppedEarly: boolean;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Shared validate ⇄ repair ⇄ keep-best loop with no-progress early-stop (L1-04, #40). The same
|
|
22
|
+
* convergence logic the explore graph uses, factored so the decoupled `automate` flow repairs too.
|
|
23
|
+
* Pure orchestration over injected `generate`/`validate` — unit-testable without a browser or LLM.
|
|
24
|
+
*/
|
|
25
|
+
export declare function runRepairLoop(deps: RepairLoopDeps): Promise<RepairLoopResult>;
|
|
26
|
+
//# sourceMappingURL=repair-loop.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repair-loop.d.ts","sourceRoot":"","sources":["../../src/agent/repair-loop.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAG7D,MAAM,WAAW,cAAc;IAC7B,gHAAgH;IAChH,QAAQ,EAAE,CAAC,UAAU,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;IAC3D,6CAA6C;IAC7C,QAAQ,EAAE,MAAM,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAC1C,wDAAwD;IACxD,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACtC;AAED,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,cAAc,CAAC;IAC1B,cAAc,EAAE,gBAAgB,CAAC;IACjC,iFAAiF;IACjF,QAAQ,EAAE,MAAM,CAAC;IACjB,4EAA4E;IAC5E,YAAY,EAAE,OAAO,CAAC;CACvB;AAED;;;;GAIG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAuCnF"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { progressSnapshot, madeProgress } from "./progress.js";
|
|
2
|
+
/**
|
|
3
|
+
* Shared validate ⇄ repair ⇄ keep-best loop with no-progress early-stop (L1-04, #40). The same
|
|
4
|
+
* convergence logic the explore graph uses, factored so the decoupled `automate` flow repairs too.
|
|
5
|
+
* Pure orchestration over injected `generate`/`validate` — unit-testable without a browser or LLM.
|
|
6
|
+
*/
|
|
7
|
+
export async function runRepairLoop(deps) {
|
|
8
|
+
let suite = await deps.generate();
|
|
9
|
+
let validation = await deps.validate();
|
|
10
|
+
// keep-best: only accept a regeneration that is BETTER and not broken (≥1 test).
|
|
11
|
+
let bestSuite = suite;
|
|
12
|
+
let bestValidation = validation;
|
|
13
|
+
let bestGreen = validation.results.length > 0 ? validation.greenRatio : -1;
|
|
14
|
+
let prevSnapshot = progressSnapshot(validation);
|
|
15
|
+
let attempts = 0;
|
|
16
|
+
let stoppedEarly = false;
|
|
17
|
+
while (bestGreen < 1 && attempts < deps.maxRepair) {
|
|
18
|
+
attempts += 1;
|
|
19
|
+
const failed = validation.results
|
|
20
|
+
.filter((r) => r.status !== "passed")
|
|
21
|
+
.map((r) => r.test)
|
|
22
|
+
.join(", ");
|
|
23
|
+
deps.onProgress?.(`repair — attempt ${attempts}`);
|
|
24
|
+
suite = await deps.generate(failed);
|
|
25
|
+
validation = await deps.validate();
|
|
26
|
+
if (validation.results.length > 0 && validation.greenRatio > bestGreen) {
|
|
27
|
+
bestSuite = suite;
|
|
28
|
+
bestValidation = validation;
|
|
29
|
+
bestGreen = validation.greenRatio;
|
|
30
|
+
}
|
|
31
|
+
// No-progress detection (Box 2): same green ratio AND the same failing tests → bail early.
|
|
32
|
+
const snap = progressSnapshot(validation);
|
|
33
|
+
if (!madeProgress(prevSnapshot, snap)) {
|
|
34
|
+
stoppedEarly = true;
|
|
35
|
+
deps.onProgress?.("repair — stopped early: no progress vs the previous attempt (same failing tests).");
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
prevSnapshot = snap;
|
|
39
|
+
}
|
|
40
|
+
return { bestSuite, bestValidation, attempts, stoppedEarly };
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=repair-loop.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repair-loop.js","sourceRoot":"","sources":["../../src/agent/repair-loop.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAqB/D;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,IAAoB;IACtD,IAAI,KAAK,GAAG,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;IAClC,IAAI,UAAU,GAAG,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;IAEvC,iFAAiF;IACjF,IAAI,SAAS,GAAG,KAAK,CAAC;IACtB,IAAI,cAAc,GAAG,UAAU,CAAC;IAChC,IAAI,SAAS,GAAG,UAAU,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3E,IAAI,YAAY,GAAG,gBAAgB,CAAC,UAAU,CAAC,CAAC;IAChD,IAAI,QAAQ,GAAG,CAAC,CAAC;IACjB,IAAI,YAAY,GAAG,KAAK,CAAC;IAEzB,OAAO,SAAS,GAAG,CAAC,IAAI,QAAQ,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;QAClD,QAAQ,IAAI,CAAC,CAAC;QACd,MAAM,MAAM,GAAG,UAAU,CAAC,OAAO;aAC9B,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,QAAQ,CAAC;aACpC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;aAClB,IAAI,CAAC,IAAI,CAAC,CAAC;QACd,IAAI,CAAC,UAAU,EAAE,CAAC,oBAAoB,QAAQ,EAAE,CAAC,CAAC;QAClD,KAAK,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QACpC,UAAU,GAAG,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;QAEnC,IAAI,UAAU,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,UAAU,CAAC,UAAU,GAAG,SAAS,EAAE,CAAC;YACvE,SAAS,GAAG,KAAK,CAAC;YAClB,cAAc,GAAG,UAAU,CAAC;YAC5B,SAAS,GAAG,UAAU,CAAC,UAAU,CAAC;QACpC,CAAC;QAED,2FAA2F;QAC3F,MAAM,IAAI,GAAG,gBAAgB,CAAC,UAAU,CAAC,CAAC;QAC1C,IAAI,CAAC,YAAY,CAAC,YAAY,EAAE,IAAI,CAAC,EAAE,CAAC;YACtC,YAAY,GAAG,IAAI,CAAC;YACpB,IAAI,CAAC,UAAU,EAAE,CAAC,mFAAmF,CAAC,CAAC;YACvG,MAAM;QACR,CAAC;QACD,YAAY,GAAG,IAAI,CAAC;IACtB,CAAC;IAED,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC;AAC/D,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { ValidationReport } from "../validate/index.js";
|
|
2
|
+
import type { CostReport } from "../llm/cost.js";
|
|
3
|
+
/** What of the per-run LLM-call budget was consumed (L1-04, Box 3). */
|
|
4
|
+
export interface BudgetReport {
|
|
5
|
+
used: number;
|
|
6
|
+
max: number;
|
|
7
|
+
}
|
|
8
|
+
export interface RunSummaryInput {
|
|
9
|
+
/** Where the artifacts landed (runs/<id>). */
|
|
10
|
+
runDir: string;
|
|
11
|
+
validation?: ValidationReport;
|
|
12
|
+
cost?: CostReport;
|
|
13
|
+
budget?: BudgetReport;
|
|
14
|
+
testCaseCount?: number;
|
|
15
|
+
/** The repair loop bailed early because it stopped making progress (Box 2). */
|
|
16
|
+
stoppedEarly?: boolean;
|
|
17
|
+
/** The run ended on a failure path → only partial artifacts were produced (Box 1/3). */
|
|
18
|
+
partial?: boolean;
|
|
19
|
+
/** A free-form note (e.g. the degrade reason) appended to the summary. */
|
|
20
|
+
note?: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Render the final, non-maintainer-friendly run summary as lines (L1-04, Box 4):
|
|
24
|
+
* pass/fail counts, per-role cost+tokens (#6), CallBudget used, and the artifact path.
|
|
25
|
+
* Pure — shared by the CLI, the library, and the failure path.
|
|
26
|
+
*/
|
|
27
|
+
export declare function renderRunSummary(s: RunSummaryInput): string[];
|
|
28
|
+
export type RunErrorKind = "navigation" | "session" | "budget" | "config" | "unknown";
|
|
29
|
+
export interface RunErrorInfo {
|
|
30
|
+
kind: RunErrorKind;
|
|
31
|
+
/** A one-line, user-facing description (keeps the keyword so the TUI classifier still matches). */
|
|
32
|
+
line: string;
|
|
33
|
+
/** An actionable next step (e.g. where the partial results were saved). */
|
|
34
|
+
hint: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Classify a thrown run error into a friendly {kind, line, hint} (L1-04, Box 1/3) so the user
|
|
38
|
+
* sees a readable message + actionable next step instead of a raw stack trace.
|
|
39
|
+
*/
|
|
40
|
+
export declare function classifyRunError(err: unknown, ctx?: {
|
|
41
|
+
sessionName?: string;
|
|
42
|
+
runDir?: string;
|
|
43
|
+
}): RunErrorInfo;
|
|
44
|
+
export interface PartialReportInput {
|
|
45
|
+
runId: string;
|
|
46
|
+
url: string;
|
|
47
|
+
error: string;
|
|
48
|
+
cost?: CostReport;
|
|
49
|
+
budget?: BudgetReport;
|
|
50
|
+
}
|
|
51
|
+
/** Build the report.json payload for a failed/partial run (L1-04, Box 1/3). Pure. */
|
|
52
|
+
export declare function partialReportPayload(i: PartialReportInput): Record<string, unknown>;
|
|
53
|
+
//# sourceMappingURL=summary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"summary.d.ts","sourceRoot":"","sources":["../../src/agent/summary.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD,uEAAuE;AACvE,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,eAAe;IAC9B,8CAA8C;IAC9C,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,+EAA+E;IAC/E,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,wFAAwF;IACxF,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,0EAA0E;IAC1E,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAKD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,eAAe,GAAG,MAAM,EAAE,CA4B7D;AAED,MAAM,MAAM,YAAY,GAAG,YAAY,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEtF,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,YAAY,CAAC;IACnB,mGAAmG;IACnG,IAAI,EAAE,MAAM,CAAC;IACb,2EAA2E;IAC3E,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,OAAO,EACZ,GAAG,GAAE;IAAE,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAO,GAClD,YAAY,CAwDd;AAED,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB;AAED,qFAAqF;AACrF,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,kBAAkB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CASnF"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/** 80% of the budget → warn the user the run is close to the cost guardrail. */
|
|
2
|
+
const BUDGET_WARN_RATIO = 0.8;
|
|
3
|
+
/**
|
|
4
|
+
* Render the final, non-maintainer-friendly run summary as lines (L1-04, Box 4):
|
|
5
|
+
* pass/fail counts, per-role cost+tokens (#6), CallBudget used, and the artifact path.
|
|
6
|
+
* Pure — shared by the CLI, the library, and the failure path.
|
|
7
|
+
*/
|
|
8
|
+
export function renderRunSummary(s) {
|
|
9
|
+
const lines = [s.partial ? "=== Run summary (partial) ===" : "=== Run summary ==="];
|
|
10
|
+
if (s.validation) {
|
|
11
|
+
const r = s.validation.results;
|
|
12
|
+
const passed = r.filter((x) => x.status === "passed").length;
|
|
13
|
+
const failed = r.filter((x) => x.status === "failed").length;
|
|
14
|
+
const flaky = r.filter((x) => x.status === "flaky").length;
|
|
15
|
+
const green = Math.round(s.validation.greenRatio * 100);
|
|
16
|
+
lines.push(` Tests: ${passed} passed · ${failed} failed · ${flaky} flaky (${green}% green)`);
|
|
17
|
+
}
|
|
18
|
+
if (typeof s.testCaseCount === "number")
|
|
19
|
+
lines.push(` Test cases: ${s.testCaseCount}`);
|
|
20
|
+
if (s.budget) {
|
|
21
|
+
const remaining = Math.max(0, s.budget.max - s.budget.used);
|
|
22
|
+
lines.push(` LLM calls: ${s.budget.used} / ${s.budget.max} used · ${remaining} remaining`);
|
|
23
|
+
if (!s.partial && s.budget.max > 0 && s.budget.used / s.budget.max >= BUDGET_WARN_RATIO) {
|
|
24
|
+
lines.push(" ⚠ approaching the LLM-call budget (cost guardrail)");
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
if (s.cost) {
|
|
28
|
+
const usd = s.cost.totalCostUsd === null ? "$— (some prices unknown)" : `$${s.cost.totalCostUsd.toFixed(4)}`;
|
|
29
|
+
lines.push(` Cost: ${s.cost.totalTokens} tokens · ${usd}`);
|
|
30
|
+
}
|
|
31
|
+
if (s.stoppedEarly)
|
|
32
|
+
lines.push(" ⚠ stopped early: no progress across repair attempts");
|
|
33
|
+
if (s.note)
|
|
34
|
+
lines.push(` ${s.note}`);
|
|
35
|
+
lines.push(` Artifacts: ${s.runDir}`);
|
|
36
|
+
return lines;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Classify a thrown run error into a friendly {kind, line, hint} (L1-04, Box 1/3) so the user
|
|
40
|
+
* sees a readable message + actionable next step instead of a raw stack trace.
|
|
41
|
+
*/
|
|
42
|
+
export function classifyRunError(err, ctx = {}) {
|
|
43
|
+
const raw = err instanceof Error ? err.message : String(err);
|
|
44
|
+
const first = (raw.split(/\r?\n/)[0] ?? "").trim();
|
|
45
|
+
const m = first.toLowerCase();
|
|
46
|
+
const where = ctx.runDir ? ` Partial results saved to ${ctx.runDir}.` : "";
|
|
47
|
+
if (m.includes("budget") || m.includes("call cap") || m.includes("callbudget")) {
|
|
48
|
+
return {
|
|
49
|
+
kind: "budget",
|
|
50
|
+
line: "Call budget reached — the run hit the cost guardrail and stopped early.",
|
|
51
|
+
hint: `Increase maxLlmCalls if this is expected, or check for a loop.${where}`,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
if (m.includes("storagestate") ||
|
|
55
|
+
m.includes("session") ||
|
|
56
|
+
m.includes("expired") ||
|
|
57
|
+
m.includes("login") ||
|
|
58
|
+
m.includes("sign in")) {
|
|
59
|
+
return {
|
|
60
|
+
kind: "session",
|
|
61
|
+
line: "The login session looks expired or missing.",
|
|
62
|
+
hint: `Re-capture it: cairn session capture --url <loginUrl>${ctx.sessionName ? ` --name ${ctx.sessionName}` : ""}.${where}`,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
if (m.includes("api key") ||
|
|
66
|
+
m.includes("api_key") ||
|
|
67
|
+
m.includes("apikey") ||
|
|
68
|
+
(m.includes("anthropic") && m.includes("required")) ||
|
|
69
|
+
(m.includes("openrouter") && m.includes("required"))) {
|
|
70
|
+
return {
|
|
71
|
+
kind: "config",
|
|
72
|
+
line: "An API key looks missing or invalid.",
|
|
73
|
+
hint: `Set ANTHROPIC_API_KEY / OPENROUTER_API_KEY in your environment.${where}`,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
if (m.includes("timeout") ||
|
|
77
|
+
m.includes("timed out") ||
|
|
78
|
+
m.includes("navigation") ||
|
|
79
|
+
m.includes("net::err") ||
|
|
80
|
+
m.includes("could not load") ||
|
|
81
|
+
m.includes("could not reach") ||
|
|
82
|
+
m.includes("page.goto") ||
|
|
83
|
+
m.includes("err_name_not_resolved")) {
|
|
84
|
+
return {
|
|
85
|
+
kind: "navigation",
|
|
86
|
+
line: first.startsWith("Could not") ? first : "Could not load the page (navigation failed or timed out).",
|
|
87
|
+
hint: `Check the URL is correct and reachable, then try again.${where}`,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
return { kind: "unknown", line: first || "The run failed.", hint: `See the message above.${where}` };
|
|
91
|
+
}
|
|
92
|
+
/** Build the report.json payload for a failed/partial run (L1-04, Box 1/3). Pure. */
|
|
93
|
+
export function partialReportPayload(i) {
|
|
94
|
+
return {
|
|
95
|
+
runId: i.runId,
|
|
96
|
+
url: i.url,
|
|
97
|
+
partial: true,
|
|
98
|
+
error: i.error,
|
|
99
|
+
...(i.cost ? { cost: i.cost } : {}),
|
|
100
|
+
...(i.budget ? { budget: i.budget } : {}),
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=summary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"summary.js","sourceRoot":"","sources":["../../src/agent/summary.ts"],"names":[],"mappings":"AAwBA,gFAAgF;AAChF,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAE9B;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,CAAkB;IACjD,MAAM,KAAK,GAAa,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,+BAA+B,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC;IAE9F,IAAI,CAAC,CAAC,UAAU,EAAE,CAAC;QACjB,MAAM,CAAC,GAAG,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC;QAC/B,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,MAAM,CAAC;QAC7D,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,MAAM,CAAC;QAC7D,MAAM,KAAK,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,OAAO,CAAC,CAAC,MAAM,CAAC;QAC3D,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,UAAU,GAAG,GAAG,CAAC,CAAC;QACxD,KAAK,CAAC,IAAI,CAAC,gBAAgB,MAAM,aAAa,MAAM,aAAa,KAAK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AE,KAAK,IAAI,iBAAiB,EAAE,IAAI,EAAE,yBAAyB,KAAK,EAAE,EAAE,CAAC;AACvG,CAAC;AAUD,qFAAqF;AACrF,MAAM,UAAU,oBAAoB,CAAC,CAAqB;IACxD,OAAO;QACL,KAAK,EAAE,CAAC,CAAC,KAAK;QACd,GAAG,EAAE,CAAC,CAAC,GAAG;QACV,OAAO,EAAE,IAAI;QACb,KAAK,EAAE,CAAC,CAAC,KAAK;QACd,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACnC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC1C,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { TestCase } from "../design/index.js";
|
|
2
|
+
import type { VerifiedElement } from "../browser/types.js";
|
|
3
|
+
export interface TestCaseDocsResult {
|
|
4
|
+
/** id + rendered ATC/MTC markdown, in input order. */
|
|
5
|
+
docs: {
|
|
6
|
+
id: string;
|
|
7
|
+
md: string;
|
|
8
|
+
}[];
|
|
9
|
+
/** Count of auto (ATC) cases. */
|
|
10
|
+
autoN: number;
|
|
11
|
+
/** Count of manual (MTC) cases. */
|
|
12
|
+
manualN: number;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Build ATC/MTC case docs (.md, with selectors) from designed cases — the shared logic behind both
|
|
16
|
+
* `design` (cases-only) and `explore` (#39: explore now emits these too, so manual MTC cases are
|
|
17
|
+
* visible deliverables and the auto/manual split is explicit). Pure — no I/O.
|
|
18
|
+
*/
|
|
19
|
+
export declare function buildTestCaseDocs(testCases: TestCase[], verified: VerifiedElement[], suite: string, hasChecklist: boolean): TestCaseDocsResult;
|
|
20
|
+
//# sourceMappingURL=testcase-docs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testcase-docs.d.ts","sourceRoot":"","sources":["../../src/agent/testcase-docs.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3D,MAAM,WAAW,kBAAkB;IACjC,sDAAsD;IACtD,IAAI,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACnC,iCAAiC;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,mCAAmC;IACnC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,QAAQ,EAAE,EACrB,QAAQ,EAAE,eAAe,EAAE,EAC3B,KAAK,EAAE,MAAM,EACb,YAAY,EAAE,OAAO,GACpB,kBAAkB,CAqBpB"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { locatorFor } from "../artifacts/report.js";
|
|
2
|
+
import { renderTestCaseMd } from "../artifacts/testcase-md.js";
|
|
3
|
+
/**
|
|
4
|
+
* Build ATC/MTC case docs (.md, with selectors) from designed cases — the shared logic behind both
|
|
5
|
+
* `design` (cases-only) and `explore` (#39: explore now emits these too, so manual MTC cases are
|
|
6
|
+
* visible deliverables and the auto/manual split is explicit). Pure — no I/O.
|
|
7
|
+
*/
|
|
8
|
+
export function buildTestCaseDocs(testCases, verified, suite, hasChecklist) {
|
|
9
|
+
const verifiedByRef = new Map(verified.map((v) => [v.ref, v]));
|
|
10
|
+
let autoN = 0;
|
|
11
|
+
let manualN = 0;
|
|
12
|
+
const docs = testCases.map((tc) => {
|
|
13
|
+
const manual = tc.execution === "manual";
|
|
14
|
+
const n = manual ? (manualN += 1) : (autoN += 1);
|
|
15
|
+
const id = `${manual ? "MTC" : "ATC"}-${suite}-${String(n).padStart(3, "0")}`;
|
|
16
|
+
const automationPath = manual
|
|
17
|
+
? "— (manual, not automated)"
|
|
18
|
+
: `tests/ui/${suite.toLowerCase()}/${id.toLowerCase()}.spec.ts`;
|
|
19
|
+
const status = manual ? "📋 Manual" : "❌ Not implemented";
|
|
20
|
+
const selectors = tc.elementRefs
|
|
21
|
+
.map((r) => verifiedByRef.get(r))
|
|
22
|
+
.filter((v) => Boolean(v))
|
|
23
|
+
.map((v) => ({ label: v.name ?? v.role, locator: locatorFor(v) }));
|
|
24
|
+
const traceability = hasChecklist ? [{ source: "Checklist", reference: "provided plan" }] : [];
|
|
25
|
+
const doc = { id, suite, status, automationPath, selectors, traceability };
|
|
26
|
+
return { id, md: renderTestCaseMd(tc, doc) };
|
|
27
|
+
});
|
|
28
|
+
return { docs, autoN, manualN };
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=testcase-docs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testcase-docs.js","sourceRoot":"","sources":["../../src/agent/testcase-docs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAoB,MAAM,6BAA6B,CAAC;AAajF;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAC/B,SAAqB,EACrB,QAA2B,EAC3B,KAAa,EACb,YAAqB;IAErB,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/D,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,OAAO,GAAG,CAAC,CAAC;IAChB,MAAM,IAAI,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE;QAChC,MAAM,MAAM,GAAG,EAAE,CAAC,SAAS,KAA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AE,EAAE,EAAE,EAAE,EAAE,gBAAgB,CAAC,EAAE,EAAE,GAAG,CAAC,EAAE,CAAC;IAC/C,CAAC,CAAC,CAAC;IACH,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;AAClC,CAAC"}
|
|
@@ -2,6 +2,7 @@ import type { ElementRef } from "../browser/types.js";
|
|
|
2
2
|
import type { TestCase } from "../design/index.js";
|
|
3
3
|
import type { ValidationReport } from "../validate/index.js";
|
|
4
4
|
import type { Score } from "../eval/scorers.js";
|
|
5
|
+
import type { CostReport } from "../llm/cost.js";
|
|
5
6
|
/** Generate a Playwright locator for an element (ref → getByRole). */
|
|
6
7
|
export declare function locatorFor(el: ElementRef): string;
|
|
7
8
|
export interface ReportInput {
|
|
@@ -15,6 +16,15 @@ export interface ReportInput {
|
|
|
15
16
|
validation?: ValidationReport;
|
|
16
17
|
scores?: Score[];
|
|
17
18
|
consoleErrors?: string[];
|
|
19
|
+
/** Per-role cost + tokens (L1-01); rendered as a table when present. */
|
|
20
|
+
cost?: CostReport;
|
|
21
|
+
/** Per-run LLM-call budget usage (L1-04, Box 3) — rendered as a header bullet when present. */
|
|
22
|
+
budget?: {
|
|
23
|
+
used: number;
|
|
24
|
+
max: number;
|
|
25
|
+
};
|
|
26
|
+
/** The repair loop bailed early because it stopped making progress (L1-04, Box 2). */
|
|
27
|
+
stoppedEarly?: boolean;
|
|
18
28
|
}
|
|
19
29
|
/** Human-readable Markdown run report: semantics, elements+selectors, cases, validation. */
|
|
20
30
|
export declare function renderReportMd(r: ReportInput): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../../src/artifacts/report.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAA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 +16,13 @@ export function renderReportMd(r) {
|
|
|
16
16
|
if (r.validation) {
|
|
17
17
|
lines.push(`- **Validation:** ${Math.round(r.validation.greenRatio * 100)}% green (flaky: ${r.validation.flakyCount})`);
|
|
18
18
|
}
|
|
19
|
+
if (r.budget) {
|
|
20
|
+
const remaining = Math.max(0, r.budget.max - r.budget.used);
|
|
21
|
+
lines.push(`- **LLM calls:** ${r.budget.used} / ${r.budget.max} (${remaining} remaining — cost guardrail)`);
|
|
22
|
+
}
|
|
23
|
+
if (r.stoppedEarly) {
|
|
24
|
+
lines.push("- **⚠ Repair:** stopped early — no progress across attempts (best-so-far suite kept)");
|
|
25
|
+
}
|
|
19
26
|
lines.push("");
|
|
20
27
|
if (r.scores && r.scores.length > 0) {
|
|
21
28
|
lines.push("## Metrics (scores)", "", "| metric | value |", "|---|---|");
|
|
@@ -24,6 +31,15 @@ export function renderReportMd(r) {
|
|
|
24
31
|
}
|
|
25
32
|
lines.push("");
|
|
26
33
|
}
|
|
34
|
+
if (r.cost && r.cost.perRole.length > 0) {
|
|
35
|
+
lines.push("## Cost (per role)", "", "| role | model(s) | calls | input tok | output tok | cost (USD) |", "|---|---|---|---|---|---|");
|
|
36
|
+
for (const c of r.cost.perRole) {
|
|
37
|
+
const usd = c.costUsd === null ? "—" : `$${c.costUsd.toFixed(4)}`;
|
|
38
|
+
lines.push(`| ${c.role} | ${c.models.join(", ")} | ${c.calls} | ${c.inputTokens} | ${c.outputTokens} | ${usd} |`);
|
|
39
|
+
}
|
|
40
|
+
const total = r.cost.totalCostUsd === null ? "— (some prices unknown)" : `$${r.cost.totalCostUsd.toFixed(4)}`;
|
|
41
|
+
lines.push(`| **total** | | | | ${r.cost.totalTokens} | ${total} |`, "");
|
|
42
|
+
}
|
|
27
43
|
if (r.consoleErrors && r.consoleErrors.length > 0) {
|
|
28
44
|
lines.push(`## Page JS errors (${r.consoleErrors.length})`, "");
|
|
29
45
|
for (const e of r.consoleErrors.slice(0, 20))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"report.js","sourceRoot":"","sources":["../../src/artifacts/report.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"report.js","sourceRoot":"","sources":["../../src/artifacts/report.ts"],"names":[],"mappings":"AAMA,sEAAsE;AACtE,MAAM,UAAU,UAAU,CAAC,EAAc;IACvC,MAAM,IAAI,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;IAC5E,OAAO,mBAAmB,EAAE,CAAC,IAAI,IAAI,IAAI,GAAG,CAAC;AAC/C,CAAC;AAqBD,SAAS,IAAI,CAAC,MAAc;IAC1B,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;AACpE,CAAC;AAED,4FAA4F;AAC5F,MAAM,UAAU,cAAc,CAAC,CAAc;IAC3C,MAAM,KAAK,GAAa,CAAC,4BAA4B,EAAE,EAAE,CAAC,CAAC;IAC3D,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;IAClC,KAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC;IACvC,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,OAAO,mBAAmB,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;IACtE,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,aAAa,EAAE,CAAC,CAAC;IAChD,IAAI,CAAC,CAAC,UAAU,EAAE,CAAC;QACjB,KAAK,CAAC,IAAI,CACR,qBAAqB,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,UAAU,GAAG,GAAG,CAAC,mB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,CAAC,aAAa,CAAC,MAAM;YAAE,KAAK,CAAC,IAAI,CAAC,oBAAoB,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC3F,KAAK,MAAM,CAAC,IAAI,EAAE,CAAC,KAAK;YAAE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAC/C,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC;QACjC,IAAI,EAAE,CAAC,WAAW,CAAC,MAAM;YAAE,KAAK,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC9E,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACjB,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
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;;;GAGG;AACH,OAAO,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";AACA;;;GAGG;AACH,OAAO,eAAe,CAAC;AAwdvB;;;GAGG;AACH,wBAAsB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAgB5C"}
|