sedum-cli 0.1.0-alpha.12 → 0.1.0-alpha.18
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/dist/{affected-selection-WV5WY5NQ.js → affected-selection-DAQPGKOZ.js} +6 -6
- package/dist/{chunk-AWBC7NOM.js → chunk-6ILFLNDI.js} +50 -2
- package/dist/{chunk-HT6BIET2.js → chunk-EPXLY5Q4.js} +188 -38
- package/dist/chunk-FG46OUHT.js +538 -0
- package/dist/{chunk-FAGJCNV7.js → chunk-KZF4NZ6M.js} +348 -49
- package/dist/chunk-N5CTUO2A.js +27 -0
- package/dist/{chunk-HXQDSNLL.js → chunk-SI2F6MBN.js} +26 -47
- package/dist/cli.js +4 -3
- package/dist/{doctor-command-F4Y5KW36.js → doctor-command-7IBKI5YO.js} +2 -2
- package/dist/explore-command-QZCKFDYM.js +25 -0
- package/dist/index.d.ts +21 -11
- package/dist/index.js +4 -3
- package/dist/{init-command-62IUO5LA.js → init-command-MBTLGU5J.js} +80 -38
- package/dist/{run-command-ZEIANJWZ.js → run-command-P55TKTX3.js} +76 -50
- package/package.json +5 -5
- package/dist/chunk-S7OB3JEF.js +0 -208
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
discoverRunTests
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-6ILFLNDI.js";
|
|
4
4
|
import {
|
|
5
|
-
createCliProvider
|
|
6
|
-
|
|
7
|
-
} from "./chunk-S7OB3JEF.js";
|
|
5
|
+
createCliProvider
|
|
6
|
+
} from "./chunk-N5CTUO2A.js";
|
|
8
7
|
import {
|
|
9
8
|
affectedPathIgnored,
|
|
10
9
|
loadProjectConfig,
|
|
10
|
+
providerDiagnostic,
|
|
11
11
|
validAffectedGlob
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-KZF4NZ6M.js";
|
|
13
13
|
|
|
14
14
|
// src/affected-selection.ts
|
|
15
15
|
import { realpath } from "fs/promises";
|
|
@@ -355,7 +355,7 @@ async function selectAffectedTests(options) {
|
|
|
355
355
|
) : { probabilities: candidates.map(() => 0), calls: [], chunkCount: 0 };
|
|
356
356
|
} catch (error) {
|
|
357
357
|
if (error instanceof ProviderError && (error.code === "authentication" || error.code === "configuration")) {
|
|
358
|
-
const diagnostic = providerDiagnostic(config
|
|
358
|
+
const diagnostic = providerDiagnostic(config, error.code);
|
|
359
359
|
throw new AffectedSelectionError(
|
|
360
360
|
`${diagnostic.message}
|
|
361
361
|
Fix: ${diagnostic.fix}`
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
2
|
discoverConfiguredTests
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-KZF4NZ6M.js";
|
|
4
4
|
|
|
5
5
|
// src/run-selection.ts
|
|
6
6
|
import { lstat, realpath } from "fs/promises";
|
|
7
7
|
import path from "path";
|
|
8
8
|
import { minimatch } from "minimatch";
|
|
9
9
|
import {
|
|
10
|
+
classifyParsedFlow,
|
|
11
|
+
displayPath,
|
|
12
|
+
FileClassificationCache,
|
|
10
13
|
listTests,
|
|
11
14
|
loadListingEntries,
|
|
15
|
+
NOT_CHECKED_OFFLINE_CODE,
|
|
16
|
+
resolveFlowModules,
|
|
12
17
|
TEST_SUFFIXES,
|
|
13
18
|
walkSuiteFiles
|
|
14
19
|
} from "@sedum-dev/core";
|
|
@@ -122,10 +127,53 @@ async function discoverRunTests(config, paths, filters = {}) {
|
|
|
122
127
|
const listing = listTests(parsed, { repoRoot: root });
|
|
123
128
|
return {
|
|
124
129
|
tests: selectRunTests(listing.tests, filters),
|
|
125
|
-
invalid: listing.invalid,
|
|
130
|
+
invalid: await withSentenceErrors(listing.invalid, parsed, {
|
|
131
|
+
root,
|
|
132
|
+
cache: await FileClassificationCache.load(
|
|
133
|
+
path.join(root, ".sedum", "classifications.json"),
|
|
134
|
+
config.providerModel,
|
|
135
|
+
config.providerName
|
|
136
|
+
)
|
|
137
|
+
}),
|
|
126
138
|
problems
|
|
127
139
|
};
|
|
128
140
|
}
|
|
141
|
+
var diagnosticKey = (item) => `${item.code}:${item.line}:${item.col}`;
|
|
142
|
+
async function withSentenceErrors(invalid, parsed, options) {
|
|
143
|
+
return Promise.all(
|
|
144
|
+
invalid.map(async (entry) => {
|
|
145
|
+
const found = parsed.find(
|
|
146
|
+
(item) => item.result.candidate !== void 0 && displayPath(options.root, item.file) === entry.file
|
|
147
|
+
);
|
|
148
|
+
if (!found) return entry;
|
|
149
|
+
const resolved = await resolveFlowModules(found.result, {
|
|
150
|
+
repoRoot: options.root,
|
|
151
|
+
partial: true
|
|
152
|
+
});
|
|
153
|
+
const classified = await classifyParsedFlow(resolved, {
|
|
154
|
+
mode: "offline",
|
|
155
|
+
cache: options.cache
|
|
156
|
+
});
|
|
157
|
+
const seen = new Set(entry.diagnostics.map(diagnosticKey));
|
|
158
|
+
const extra = classified.diagnostics.filter(
|
|
159
|
+
(item) => item.severity === "error" && item.code !== NOT_CHECKED_OFFLINE_CODE && item.source.file === found.file
|
|
160
|
+
).map((item) => ({
|
|
161
|
+
severity: item.severity,
|
|
162
|
+
code: item.code,
|
|
163
|
+
line: item.source.line,
|
|
164
|
+
col: item.source.col,
|
|
165
|
+
message: item.message,
|
|
166
|
+
fix: item.fix
|
|
167
|
+
})).filter((item) => !seen.has(diagnosticKey(item)));
|
|
168
|
+
return {
|
|
169
|
+
file: entry.file,
|
|
170
|
+
diagnostics: [...entry.diagnostics, ...extra].sort(
|
|
171
|
+
(a, b) => a.line - b.line || a.col - b.col
|
|
172
|
+
)
|
|
173
|
+
};
|
|
174
|
+
})
|
|
175
|
+
);
|
|
176
|
+
}
|
|
129
177
|
|
|
130
178
|
export {
|
|
131
179
|
discoverRunTests
|
|
@@ -1,19 +1,26 @@
|
|
|
1
|
+
import {
|
|
2
|
+
collectText,
|
|
3
|
+
exploreMode,
|
|
4
|
+
seedValue,
|
|
5
|
+
startUrl,
|
|
6
|
+
watchOrigin
|
|
7
|
+
} from "./chunk-FG46OUHT.js";
|
|
1
8
|
import {
|
|
2
9
|
MAX_PARALLEL,
|
|
3
10
|
clearLocatorCache,
|
|
4
11
|
parseParallel
|
|
5
12
|
} from "./chunk-EFRMSNBD.js";
|
|
6
13
|
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
renderDiagnostic
|
|
10
|
-
} from "./chunk-S7OB3JEF.js";
|
|
14
|
+
createCliProvider
|
|
15
|
+
} from "./chunk-N5CTUO2A.js";
|
|
11
16
|
import {
|
|
12
17
|
ProjectConfigError,
|
|
18
|
+
configDiagnostic,
|
|
13
19
|
discoverConfiguredTests,
|
|
14
20
|
loadProjectConfig,
|
|
21
|
+
renderDiagnostic,
|
|
15
22
|
validAffectedGlob
|
|
16
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-KZF4NZ6M.js";
|
|
17
24
|
|
|
18
25
|
// src/invocation.ts
|
|
19
26
|
function sedumCommand(env = process.env, script = process.argv[1] ?? "") {
|
|
@@ -125,15 +132,9 @@ function visionExecutionLines(value, steps) {
|
|
|
125
132
|
const attempts = steps.flatMap(
|
|
126
133
|
(step) => step.locator?.vision ? [step.locator.vision] : []
|
|
127
134
|
);
|
|
128
|
-
const warnings = {
|
|
129
|
-
accepted: null,
|
|
130
|
-
rejected: "vision warning: OpenRouter rejected OPEN_ROUTER_API_KEY, so vision fallback cannot work. Check it with `sedum doctor --vision`.",
|
|
131
|
-
unreachable: "vision warning: OpenRouter could not be reached to check OPEN_ROUTER_API_KEY."
|
|
132
|
-
};
|
|
133
135
|
return compact([
|
|
134
136
|
visionOutcomeLine(vision.model, attempts),
|
|
135
|
-
failedClickVisionLine(steps)
|
|
136
|
-
warnings[vision.key]
|
|
137
|
+
failedClickVisionLine(steps)
|
|
137
138
|
]);
|
|
138
139
|
}
|
|
139
140
|
function rateLimitLine(value) {
|
|
@@ -168,6 +169,16 @@ function cacheLine(step) {
|
|
|
168
169
|
const changed = cache.targetChanged ? ", target changed" : "";
|
|
169
170
|
return ` step ${step.index}: cache ${cache.outcome}${reason}${fallback}${changed}`;
|
|
170
171
|
}
|
|
172
|
+
function detectionLines(step) {
|
|
173
|
+
return (step.detections ?? []).map(
|
|
174
|
+
(detection) => ` step ${step.index}: suspected bug, ${detection.check}${detection.source ? ` (${detection.source}${detection.probability === void 0 ? "" : ` p=${detection.probability.toFixed(2)}`})` : ""}: ${detection.message}`.replace(
|
|
175
|
+
// Page text and URLs must not move the terminal cursor.
|
|
176
|
+
// eslint-disable-next-line no-control-regex
|
|
177
|
+
/[\u0000-\u001f\u007f-\u009f]/g,
|
|
178
|
+
" "
|
|
179
|
+
)
|
|
180
|
+
);
|
|
181
|
+
}
|
|
171
182
|
function testDetailLines(test, flagCounts) {
|
|
172
183
|
const retry = test.attempts.length > 1 ? ` attempts ${test.attempts.length} (${test.attempts.map((attempt) => attempt.verdict ?? attempt.state).join(" -> ")})` : null;
|
|
173
184
|
const selected = test.attempts.find(
|
|
@@ -176,7 +187,7 @@ function testDetailLines(test, flagCounts) {
|
|
|
176
187
|
const caches = (selected?.steps ?? []).flatMap((step) => {
|
|
177
188
|
for (const flag of step.flags) flagCounts[flag] += 1;
|
|
178
189
|
const line = cacheLine(step);
|
|
179
|
-
return line ? [line] : [];
|
|
190
|
+
return [...line ? [line] : [], ...detectionLines(step)];
|
|
180
191
|
});
|
|
181
192
|
const details = [...compact([retry]), ...caches];
|
|
182
193
|
return details.length ? [testLabel(test), ...details] : [];
|
|
@@ -199,7 +210,8 @@ function flagCountLine(value, counts) {
|
|
|
199
210
|
const flaky = value.tests.filter(
|
|
200
211
|
(test) => test.flags.includes("flaky")
|
|
201
212
|
).length;
|
|
202
|
-
|
|
213
|
+
const suspected = counts.suspected_bug ? `, suspected_bug ${counts.suspected_bug}` : "";
|
|
214
|
+
return `flags ${value.totals.flaggedSteps} flagged step(s), low_confidence ${counts.low_confidence}, contradiction ${counts.contradiction}${suspected}, flaky ${flaky} test(s)`;
|
|
203
215
|
}
|
|
204
216
|
function visionDetailLines(value) {
|
|
205
217
|
return value.tests.flatMap(
|
|
@@ -238,7 +250,7 @@ function renderRunSummary(result, capabilities, artifacts, showCosts) {
|
|
|
238
250
|
const value = validateRunResult2(result);
|
|
239
251
|
const color = capabilities.stdoutIsTTY && capabilities.color;
|
|
240
252
|
const lines = [];
|
|
241
|
-
const flagCounts = { low_confidence: 0, contradiction: 0 };
|
|
253
|
+
const flagCounts = { low_confidence: 0, contradiction: 0, suspected_bug: 0 };
|
|
242
254
|
for (const test of value.tests)
|
|
243
255
|
lines.push(...testDetailLines(test, flagCounts));
|
|
244
256
|
if (hasOutsideGitStep(value))
|
|
@@ -396,20 +408,24 @@ function emptyProjectProblem(paths, testDirectory) {
|
|
|
396
408
|
fix: paths.length ? "Pass paths relative to the project root that contain tests or modules." : "Add tests under tests.directory, or correct tests.directory/include/exclude in sedum.config.yaml."
|
|
397
409
|
};
|
|
398
410
|
}
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
411
|
+
function missingKey(config) {
|
|
412
|
+
const credentials = config?.apiKeyEnv ? `${config.apiKeyEnv}${config.providerName === "clef" ? " and CLOUDFLARE_ACCOUNT_ID" : ""}` : "the selected provider's credentials (TYPESAFE_API_KEY, OPENROUTER_API_KEY, or CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_AUTH_TOKEN/CLOUDFLARE_API_TOKEN)";
|
|
413
|
+
return {
|
|
414
|
+
code: "missing_key",
|
|
415
|
+
message: "`sedum validate --online` needs a configured model provider.",
|
|
416
|
+
fix: `Set ${credentials} and rerun; otherwise omit --online.`
|
|
417
|
+
};
|
|
418
|
+
}
|
|
404
419
|
async function onlineProvider(options) {
|
|
420
|
+
let config;
|
|
405
421
|
try {
|
|
406
|
-
|
|
422
|
+
config = await loadProjectConfig(options.cwd);
|
|
407
423
|
return {
|
|
408
424
|
provider: await options.createProvider({
|
|
409
425
|
...config.apiKey ? { apiKey: config.apiKey } : {},
|
|
410
426
|
baseURL: config.providerBaseUrl,
|
|
411
427
|
model: config.providerModel,
|
|
412
|
-
...config.providerName
|
|
428
|
+
...config.providerName !== "typesafe" ? {
|
|
413
429
|
providerName: config.providerName,
|
|
414
430
|
...config.cloudflareAccountId ? { accountId: config.cloudflareAccountId } : {}
|
|
415
431
|
} : {}
|
|
@@ -419,7 +435,7 @@ async function onlineProvider(options) {
|
|
|
419
435
|
} catch (error) {
|
|
420
436
|
if (error instanceof ProjectConfigError) return configDiagnostic(error);
|
|
421
437
|
if (error instanceof ProviderError && error.code === "configuration")
|
|
422
|
-
return missingKey;
|
|
438
|
+
return missingKey(config);
|
|
423
439
|
return {
|
|
424
440
|
code: "setup_error",
|
|
425
441
|
message: "The classification provider could not be prepared.",
|
|
@@ -597,6 +613,7 @@ function renderListJson(listing) {
|
|
|
597
613
|
|
|
598
614
|
// src/cli-arguments.ts
|
|
599
615
|
import { InvalidArgumentError } from "commander";
|
|
616
|
+
import { parseAllowRule } from "@sedum-dev/core";
|
|
600
617
|
var RawOptionText = class {
|
|
601
618
|
constructor(value) {
|
|
602
619
|
this.value = value;
|
|
@@ -649,6 +666,45 @@ var ValueCollector = class {
|
|
|
649
666
|
return [...previous, text.value];
|
|
650
667
|
}
|
|
651
668
|
};
|
|
669
|
+
var AllowRuleCollector = class {
|
|
670
|
+
parse(text, previous) {
|
|
671
|
+
try {
|
|
672
|
+
parseAllowRule(text.value);
|
|
673
|
+
} catch (error) {
|
|
674
|
+
invalid(
|
|
675
|
+
`Invalid allow rule ${JSON.stringify(text.value)}: ${error instanceof Error ? error.message : String(error)}`
|
|
676
|
+
);
|
|
677
|
+
}
|
|
678
|
+
return [...previous, text.value];
|
|
679
|
+
}
|
|
680
|
+
};
|
|
681
|
+
var DETECT_MODES = ["off", "browser", "semantic"];
|
|
682
|
+
var DetectModeParser = class {
|
|
683
|
+
parse(text) {
|
|
684
|
+
const mode = DETECT_MODES.find((item) => item === text.trimmed);
|
|
685
|
+
return mode ?? invalid(
|
|
686
|
+
`Unknown detector mode ${JSON.stringify(text.value)}. Use off, browser, or semantic.`
|
|
687
|
+
);
|
|
688
|
+
}
|
|
689
|
+
};
|
|
690
|
+
var EXPLORE_DETECT_MODES = ["browser", "semantic"];
|
|
691
|
+
var ExploreDetectParser = class {
|
|
692
|
+
parse(text) {
|
|
693
|
+
const mode = EXPLORE_DETECT_MODES.find((item) => item === text.trimmed);
|
|
694
|
+
return mode ?? invalid(
|
|
695
|
+
`Unknown detector mode ${JSON.stringify(text.value)}. Use browser or semantic.`
|
|
696
|
+
);
|
|
697
|
+
}
|
|
698
|
+
};
|
|
699
|
+
var EXPLORE_SAFE_MODES = ["on", "strict"];
|
|
700
|
+
var ExploreSafeParser = class {
|
|
701
|
+
parse(text) {
|
|
702
|
+
const mode = EXPLORE_SAFE_MODES.find((item) => item === text.trimmed);
|
|
703
|
+
return mode ?? invalid(
|
|
704
|
+
`Unknown safety mode ${JSON.stringify(text.value)}. Use --safe or --safe strict.`
|
|
705
|
+
);
|
|
706
|
+
}
|
|
707
|
+
};
|
|
652
708
|
var REPORTERS = ["list", "steps", "terminal", "json", "markdown", "junit"];
|
|
653
709
|
var ReporterCollector = class {
|
|
654
710
|
parse(text, previous) {
|
|
@@ -713,6 +769,10 @@ function rangedNumber(range) {
|
|
|
713
769
|
}
|
|
714
770
|
var collectOrigin = collector(new OriginCollector());
|
|
715
771
|
var collectValue = collector(new ValueCollector());
|
|
772
|
+
var collectAllowRule = collector(new AllowRuleCollector());
|
|
773
|
+
var detectMode = scalar(new DetectModeParser());
|
|
774
|
+
var exploreDetect = scalar(new ExploreDetectParser());
|
|
775
|
+
var exploreSafe = scalar(new ExploreSafeParser());
|
|
716
776
|
var collectReporter = collector(new ReporterCollector());
|
|
717
777
|
var collectGlob = collector(new GlobCollector());
|
|
718
778
|
function collectAffectedGlob(value, previous) {
|
|
@@ -796,7 +856,7 @@ async function runCli(args, version, runtime = {}) {
|
|
|
796
856
|
const writeOut = (value) => rawOut(withCommand(value, command));
|
|
797
857
|
const writeErr = (value) => rawErr(withCommand(value, command));
|
|
798
858
|
const capabilities = runtime.capabilities ?? plainOutput;
|
|
799
|
-
const executeRun = runtime.executeRun ?? (async (options) => (await import("./run-command-
|
|
859
|
+
const executeRun = runtime.executeRun ?? (async (options) => (await import("./run-command-P55TKTX3.js")).executeRunCommand(options));
|
|
800
860
|
const cwd = runtime.cwd ?? process.cwd();
|
|
801
861
|
let exitCode = 3;
|
|
802
862
|
const program = new Command2().name("sedum").description(
|
|
@@ -814,7 +874,7 @@ async function runCli(args, version, runtime = {}) {
|
|
|
814
874
|
"after",
|
|
815
875
|
"\nCreates a config, a SauceDemo example, .env.example, and ignore rules.\nExisting files are never replaced.\n"
|
|
816
876
|
).action(async () => {
|
|
817
|
-
const { executeInitCommand } = await import("./init-command-
|
|
877
|
+
const { executeInitCommand } = await import("./init-command-MBTLGU5J.js");
|
|
818
878
|
const interactive = capabilities.stdoutIsTTY && (process.stdin.isTTY === true || runtime.confirmInit !== void 0);
|
|
819
879
|
const confirm = runtime.confirmInit ?? (interactive ? async (question) => {
|
|
820
880
|
const { createInterface } = await import("readline/promises");
|
|
@@ -885,7 +945,10 @@ async function runCli(args, version, runtime = {}) {
|
|
|
885
945
|
"select a test by its exact id (repeatable)",
|
|
886
946
|
collectValue,
|
|
887
947
|
[]
|
|
888
|
-
).option("--env <name>", "select a named environment").option("--browser <kind>", "chrome or chromium").option("--vision", "enable vision fallback for ambiguous clicks").option("--no-vision", "disable vision fallback").option(
|
|
948
|
+
).option("--env <name>", "select a named environment").option("--browser <kind>", "chrome or chromium").option("--vision", "enable vision fallback for ambiguous clicks").option("--no-vision", "disable vision fallback").option(
|
|
949
|
+
"--screenshots",
|
|
950
|
+
"send screenshots to TypeSafe to check targets and judge claims (default for the TypeSafe API)"
|
|
951
|
+
).option("--no-screenshots", "send page text only, never screenshots").option(
|
|
889
952
|
"--url-override <url>",
|
|
890
953
|
"replace entry URL origin for preview deployments"
|
|
891
954
|
).option("--output-dir <path>", "run output directory").option("--reporter-dir <path>", "reporter artifact directory").option("--headed", "show the browser", false).option(
|
|
@@ -922,6 +985,15 @@ async function runCli(args, version, runtime = {}) {
|
|
|
922
985
|
"omit sensitive page details and frames (repeatable)",
|
|
923
986
|
collectOrigin,
|
|
924
987
|
[]
|
|
988
|
+
).option(
|
|
989
|
+
"--detect <mode>",
|
|
990
|
+
"flag steps whose page reported console errors, uncaught exceptions, unhandled rejections, or HTTP errors: off, browser, or semantic (also asks Jev whether each new page looks broken)",
|
|
991
|
+
detectMode
|
|
992
|
+
).option(
|
|
993
|
+
"--detect-allow <rule>",
|
|
994
|
+
"ignore a known detector finding: [check:]substring or [check:]re:regex (repeatable)",
|
|
995
|
+
collectAllowRule,
|
|
996
|
+
[]
|
|
925
997
|
).option("--strict", "exit 2 when a passed run has uncertainty flags", false).option(
|
|
926
998
|
"--reporter <name>",
|
|
927
999
|
"reporter: list, steps, terminal, json, markdown, or junit (repeatable or comma-separated; default list)",
|
|
@@ -933,7 +1005,7 @@ async function runCli(args, version, runtime = {}) {
|
|
|
933
1005
|
false
|
|
934
1006
|
).addHelpText(
|
|
935
1007
|
"after",
|
|
936
|
-
"\nPrerequisites:\n Install Chromium with `sedum browsers install chromium` and
|
|
1008
|
+
"\nPrerequisites:\n Install Chromium with `sedum browsers install chromium` and configure the selected provider's credentials. TypeSafe uses TYPESAFE_API_KEY (and TYPESAFE_BASE_URL for a compatible gateway); OpenRouter uses OPENROUTER_API_KEY; Clef uses CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_AUTH_TOKEN.\n\nExamples:\n sedum run tests/login.test.ts\n sedum run tests/login.test.ts --id 'tests/login.test.ts#signs in'\n sedum run tests/login.test.yaml --strict --costs\n"
|
|
937
1009
|
).action(
|
|
938
1010
|
async (paths, options) => {
|
|
939
1011
|
if (options.shardIndex === void 0 !== (options.shardCount === void 0) || options.shardIndex !== void 0 && options.shardIndex > options.shardCount) {
|
|
@@ -966,7 +1038,7 @@ async function runCli(args, version, runtime = {}) {
|
|
|
966
1038
|
return;
|
|
967
1039
|
}
|
|
968
1040
|
if (options.affected) {
|
|
969
|
-
const { selectAffectedTests, AffectedSelectionError } = await import("./affected-selection-
|
|
1041
|
+
const { selectAffectedTests, AffectedSelectionError } = await import("./affected-selection-DAQPGKOZ.js");
|
|
970
1042
|
const { ProviderError: ProviderError2 } = await import("@sedum-dev/core");
|
|
971
1043
|
writeErr(
|
|
972
1044
|
"Experimental selection sends the committed Git diff and complete test/module sources to the configured provider. Tracked local edits are refused. Full CI is still recommended.\n"
|
|
@@ -1069,12 +1141,14 @@ No tests were run. Fix the selection error or run without --affected.
|
|
|
1069
1141
|
...options.env ? { environment: options.env } : {},
|
|
1070
1142
|
...options.browser ? { browser: options.browser } : {},
|
|
1071
1143
|
...options.vision !== void 0 ? { vision: options.vision } : {},
|
|
1072
|
-
...options.
|
|
1144
|
+
...options.screenshots !== void 0 ? { screenshots: options.screenshots } : {},
|
|
1073
1145
|
...options.urlOverride ? { urlOverride: options.urlOverride } : {},
|
|
1074
1146
|
...options.outputDir ? { outputDir: options.outputDir } : {},
|
|
1075
1147
|
...options.reporterDir ? { reporterDir: options.reporterDir } : {},
|
|
1076
1148
|
reporters: options.reporter,
|
|
1077
1149
|
strict: options.strict,
|
|
1150
|
+
...options.detect ? { detect: options.detect } : {},
|
|
1151
|
+
detectAllow: options.detectAllow,
|
|
1078
1152
|
headed: options.headed,
|
|
1079
1153
|
...options.slow !== void 0 ? { slowMoMs: options.slow } : {},
|
|
1080
1154
|
retries: options.retries,
|
|
@@ -1142,6 +1216,84 @@ No tests were run. Fix the selection error or run without --affected.
|
|
|
1142
1216
|
exitCode = runExitCode(execution.result, options.strict);
|
|
1143
1217
|
}
|
|
1144
1218
|
);
|
|
1219
|
+
program.command("explore").description(
|
|
1220
|
+
"explore a site by a seeded random walk guided by Jev (experimental)"
|
|
1221
|
+
).argument(
|
|
1222
|
+
"[url]",
|
|
1223
|
+
"absolute start URL; the walk stays on its origin",
|
|
1224
|
+
startUrl
|
|
1225
|
+
).option("--steps <count>", "actions to take", positiveCount(1e4), 100).option(
|
|
1226
|
+
"--seed <seed>",
|
|
1227
|
+
"seed for a reproducible walk (default: random)",
|
|
1228
|
+
seedValue
|
|
1229
|
+
).option(
|
|
1230
|
+
"--mode <mode>",
|
|
1231
|
+
"guided (Jev), heuristic (no model) or random (blind walk)",
|
|
1232
|
+
exploreMode,
|
|
1233
|
+
"guided"
|
|
1234
|
+
).option(
|
|
1235
|
+
"--out <dir>",
|
|
1236
|
+
"directory for traces and emitted tests",
|
|
1237
|
+
".sedum/explore"
|
|
1238
|
+
).option(
|
|
1239
|
+
"--shrink",
|
|
1240
|
+
"shrink each failure and write it as a plain-English test",
|
|
1241
|
+
false
|
|
1242
|
+
).option(
|
|
1243
|
+
"--rerun <trace>",
|
|
1244
|
+
"run a recorded trace.jsonl again instead of exploring"
|
|
1245
|
+
).option(
|
|
1246
|
+
"--replay",
|
|
1247
|
+
"capture a frame per step and embed them in report.html",
|
|
1248
|
+
false
|
|
1249
|
+
).option(
|
|
1250
|
+
"--sensitive-origin <url>",
|
|
1251
|
+
"capture no frames on this origin (repeatable)",
|
|
1252
|
+
collectOrigin,
|
|
1253
|
+
[]
|
|
1254
|
+
).option(
|
|
1255
|
+
"--safe [mode]",
|
|
1256
|
+
"skip targets Jev judges destructive and leave settings forms alone; strict also skips names like delete, send or pay. Off by default: only log-out and account-closing targets are skipped",
|
|
1257
|
+
exploreSafe
|
|
1258
|
+
).option(
|
|
1259
|
+
"--watch-origin <origin>",
|
|
1260
|
+
"also report HTTP 5xx from this origin, such as an API host (repeatable)",
|
|
1261
|
+
watchOrigin,
|
|
1262
|
+
[]
|
|
1263
|
+
).option(
|
|
1264
|
+
"--ignore-console <regex>",
|
|
1265
|
+
"ignore console errors matching this regular expression (repeatable)",
|
|
1266
|
+
collectText,
|
|
1267
|
+
[]
|
|
1268
|
+
).option(
|
|
1269
|
+
"--detect <mode>",
|
|
1270
|
+
"browser (console errors, exceptions, rejections, failed requests; always on) or semantic (also asks Jev whether each new page looks broken, in the same call; guided mode)",
|
|
1271
|
+
exploreDetect,
|
|
1272
|
+
"browser"
|
|
1273
|
+
).option(
|
|
1274
|
+
"--detect-allow <rule>",
|
|
1275
|
+
"ignore a known finding: [check:]substring or [check:]re:regex (repeatable)",
|
|
1276
|
+
collectAllowRule,
|
|
1277
|
+
[]
|
|
1278
|
+
).option(
|
|
1279
|
+
"--cookies <storage-state.json>",
|
|
1280
|
+
"sign the browser in with the cookies of a Playwright storage-state file"
|
|
1281
|
+
).option(
|
|
1282
|
+
"--rejected-submits",
|
|
1283
|
+
"also report a 4xx answer to a form submission: the UI let you send something the server refuses",
|
|
1284
|
+
false
|
|
1285
|
+
).option("--headed", "show the browser", false).addHelpText(
|
|
1286
|
+
"after",
|
|
1287
|
+
"\nGuided mode and --shrink make billable TypeSafe calls (TYPESAFE_API_KEY).\nSafety is off by default, for disposable staging: exploration clicks real buttons\nand completes forms. Use --safe on shared or production-like data.\n\nWrites trace.jsonl, result.json, report.md and report.html into --out/<run-id>/.\n\nExamples:\n sedum explore https://staging.example.com --steps 200 --seed 7 --replay\n sedum explore https://staging.example.com --safe --shrink\n sedum explore --rerun .sedum/explore/<run>/trace.jsonl\n\nExit codes:\n 0 no failures observed\n 1 console errors, page exceptions or HTTP 5xx observed\n 3 command or operational error\n"
|
|
1288
|
+
).action(async (url, options) => {
|
|
1289
|
+
const { exploreAction } = await import("./explore-command-QZCKFDYM.js");
|
|
1290
|
+
exitCode = await exploreAction(url, options, {
|
|
1291
|
+
cwd,
|
|
1292
|
+
write: writeOut,
|
|
1293
|
+
writeErr,
|
|
1294
|
+
...runtime.signal ? { signal: runtime.signal } : {}
|
|
1295
|
+
});
|
|
1296
|
+
});
|
|
1145
1297
|
const cache = program.command("cache").description("manage the local locator cache");
|
|
1146
1298
|
cache.action(() => commandHelp(cache, writeErr));
|
|
1147
1299
|
cache.command("clear").description("remove the current worktree's locator cache and digest key").action(async () => {
|
|
@@ -1151,18 +1303,16 @@ No tests were run. Fix the selection error or run without --affected.
|
|
|
1151
1303
|
);
|
|
1152
1304
|
exitCode = 0;
|
|
1153
1305
|
});
|
|
1154
|
-
program.command("doctor").description("check whether this environment can run Sedum").option("--json", "print versioned JSON checks on stdout", false).
|
|
1155
|
-
"--vision",
|
|
1156
|
-
"also check the vision fallback's OPEN_ROUTER_API_KEY (automatic when vision.enabled is true)",
|
|
1157
|
-
false
|
|
1158
|
-
).addHelpText(
|
|
1306
|
+
program.command("doctor").description("check whether this environment can run Sedum").option("--env <name>", "select a named environment").option("--json", "print versioned JSON checks on stdout", false).addHelpText(
|
|
1159
1307
|
"after",
|
|
1160
1308
|
"\nThe authenticated API check makes one small, potentially billable request.\n\nExit codes:\n 0 all checks passed\n 3 one or more prerequisites failed\n"
|
|
1161
1309
|
).action(async (options) => {
|
|
1162
|
-
const { executeDoctorCommand, renderDoctorText } = await import("./doctor-command-
|
|
1163
|
-
const result = await executeDoctorCommand(
|
|
1164
|
-
|
|
1165
|
-
|
|
1310
|
+
const { executeDoctorCommand, renderDoctorText } = await import("./doctor-command-7IBKI5YO.js");
|
|
1311
|
+
const result = await executeDoctorCommand(
|
|
1312
|
+
cwd,
|
|
1313
|
+
runtime.doctorProbes,
|
|
1314
|
+
options.env ? { environment: options.env } : {}
|
|
1315
|
+
);
|
|
1166
1316
|
writeOut(
|
|
1167
1317
|
options.json ? `${JSON.stringify(result)}
|
|
1168
1318
|
` : renderDoctorText(result)
|