sedum-cli 0.1.0-alpha.0 → 0.1.0-alpha.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.
@@ -0,0 +1,182 @@
1
+ import {
2
+ discoverRunTests
3
+ } from "./chunk-3MCSCE7X.js";
4
+ import {
5
+ loadProjectConfig
6
+ } from "./chunk-YXSAX7E3.js";
7
+
8
+ // src/affected-selection.ts
9
+ import { execFile } from "child_process";
10
+ import { readFile, realpath } from "fs/promises";
11
+ import path from "path";
12
+ import { promisify } from "util";
13
+ import { loadFlowFile, resolveFlowModules } from "@sedum-dev/core";
14
+ import {
15
+ TypeSafeAdapter
16
+ } from "@sedum-dev/provider-typesafe";
17
+ var exec = promisify(execFile);
18
+ var AffectedSelectionError = class extends Error {
19
+ };
20
+ async function readBranchDiff(cwd, base, signal) {
21
+ const git = async (...args) => (await exec("git", args, {
22
+ cwd,
23
+ maxBuffer: 2 * 1024 * 1024,
24
+ ...signal ? { signal } : {}
25
+ })).stdout;
26
+ try {
27
+ const root = (await git("rev-parse", "--show-toplevel")).trim();
28
+ let reference = base;
29
+ if (!reference) {
30
+ for (const candidate of [
31
+ "refs/heads/main",
32
+ "refs/remotes/origin/main",
33
+ "refs/heads/master",
34
+ "refs/remotes/origin/master"
35
+ ]) {
36
+ try {
37
+ await git(
38
+ "rev-parse",
39
+ "--verify",
40
+ "--end-of-options",
41
+ `${candidate}^{commit}`
42
+ );
43
+ reference = candidate;
44
+ break;
45
+ } catch {
46
+ signal?.throwIfAborted();
47
+ }
48
+ }
49
+ }
50
+ if (!reference)
51
+ throw new AffectedSelectionError(
52
+ "No main or master ref found. Fetch the base branch or pass --base <ref>."
53
+ );
54
+ const commit = (await git(
55
+ "rev-parse",
56
+ "--verify",
57
+ "--end-of-options",
58
+ `${reference}^{commit}`
59
+ )).trim();
60
+ const mergeBase = (await git("merge-base", commit, "HEAD")).trim();
61
+ if ((await git("ls-files", "--others", "--exclude-standard", "--", ":/")).length)
62
+ throw new AffectedSelectionError(
63
+ "Untracked files are not represented in git diff. Stage intended files or ignore unrelated files before using --affected."
64
+ );
65
+ const diff = await git(
66
+ "diff",
67
+ "--no-ext-diff",
68
+ "--no-textconv",
69
+ "--no-color",
70
+ "--no-renames",
71
+ "--no-relative",
72
+ "--ignore-submodules=none",
73
+ "--submodule=short",
74
+ mergeBase,
75
+ "--",
76
+ ":/"
77
+ );
78
+ if (/^Binary files .* differ$/mu.test(diff) || /^[+ -]Subproject commit /mu.test(diff))
79
+ throw new AffectedSelectionError(
80
+ "Binary or submodule changes cannot be scored reliably. Run the full suite without --affected."
81
+ );
82
+ const changed = (await git(
83
+ "diff",
84
+ "--no-ext-diff",
85
+ "--no-textconv",
86
+ "--name-only",
87
+ "--no-renames",
88
+ "--no-relative",
89
+ "--ignore-submodules=none",
90
+ "-z",
91
+ mergeBase,
92
+ "--",
93
+ ":/"
94
+ )).split("\0").filter(Boolean);
95
+ return { root, base: reference, mergeBase, diff, changed };
96
+ } catch (error) {
97
+ if (error instanceof AffectedSelectionError) throw error;
98
+ throw new AffectedSelectionError(
99
+ "Could not read a complete Git diff. Check the base ref and merge-base history (fetch deeper for shallow clones), or run without --affected."
100
+ );
101
+ }
102
+ }
103
+ async function selectAffectedTests(options) {
104
+ const config = await loadProjectConfig(options.cwd, process.env, {
105
+ ...options.environment ? { environment: options.environment } : {}
106
+ });
107
+ const canonicalProjectRoot = await realpath(config.projectRoot);
108
+ const selection = await discoverRunTests(
109
+ config,
110
+ options.paths,
111
+ options.filters
112
+ );
113
+ if (selection.invalid.length || selection.problems.length || !selection.tests.length)
114
+ throw new AffectedSelectionError(
115
+ "Test discovery is empty or invalid. Run sedum validate and fix discovery before using --affected."
116
+ );
117
+ const branch = await readBranchDiff(
118
+ config.projectRoot,
119
+ options.base,
120
+ options.signal
121
+ );
122
+ const changed = new Set(
123
+ branch.changed.map((file) => path.resolve(branch.root, file))
124
+ );
125
+ for (const file of [...changed])
126
+ changed.add(await realpath(file).catch(() => file));
127
+ const tests = [];
128
+ const forced = [];
129
+ for (const test of selection.tests) {
130
+ const file = path.join(config.projectRoot, test.file);
131
+ const parsed = await loadFlowFile(file, {
132
+ repoRoot: config.projectRoot,
133
+ rejectSymlinks: true
134
+ });
135
+ const resolved = await resolveFlowModules(parsed, {
136
+ repoRoot: config.projectRoot
137
+ });
138
+ if (!resolved.value || resolved.diagnostics.some((item) => item.severity === "error"))
139
+ throw new AffectedSelectionError(
140
+ "A test or module is invalid. Run sedum validate before using --affected."
141
+ );
142
+ const files = [await realpath(file), ...resolved.moduleFiles];
143
+ forced.push(files.some((source) => changed.has(source)));
144
+ tests.push({
145
+ file: test.file,
146
+ source: await readFile(file, "utf8"),
147
+ modules: await Promise.all(
148
+ resolved.moduleFiles.map(async (module) => ({
149
+ file: path.relative(canonicalProjectRoot, module).split(path.sep).join("/"),
150
+ source: await readFile(module, "utf8")
151
+ }))
152
+ )
153
+ });
154
+ }
155
+ options.signal?.throwIfAborted();
156
+ const scores = branch.diff ? await (options.createProvider?.(config) ?? new TypeSafeAdapter({
157
+ ...config.apiKey ? { apiKey: config.apiKey } : {},
158
+ baseURL: config.providerBaseUrl,
159
+ model: config.providerModel
160
+ })).scoreRelevance(
161
+ branch.diff,
162
+ tests,
163
+ options.signal ? { signal: options.signal } : void 0
164
+ ) : { probabilities: tests.map(() => 0), calls: [] };
165
+ return {
166
+ base: branch.base,
167
+ mergeBase: branch.mergeBase,
168
+ threshold: options.threshold,
169
+ calls: scores.calls,
170
+ tests: tests.map((test, index) => ({
171
+ file: test.file,
172
+ probability: scores.probabilities[index],
173
+ selected: branch.diff !== "" && (forced[index] || scores.probabilities[index] >= options.threshold),
174
+ reason: forced[index] ? "test-or-module-changed" : branch.diff ? "model" : "no-diff"
175
+ }))
176
+ };
177
+ }
178
+ export {
179
+ AffectedSelectionError,
180
+ readBranchDiff,
181
+ selectAffectedTests
182
+ };
@@ -0,0 +1,136 @@
1
+ import {
2
+ discoverConfiguredTests
3
+ } from "./chunk-YXSAX7E3.js";
4
+
5
+ // src/run-selection.ts
6
+ import { lstat, realpath } from "fs/promises";
7
+ import path from "path";
8
+ import { minimatch } from "minimatch";
9
+ import {
10
+ listTests,
11
+ loadFlowFile,
12
+ walkSuiteFiles
13
+ } from "@sedum-dev/core";
14
+ function contained(root, target) {
15
+ const relative = path.relative(root, target);
16
+ return relative === "" || relative !== ".." && !relative.startsWith(`..${path.sep}`) && !path.isAbsolute(relative);
17
+ }
18
+ function selectRunTests(tests, filters) {
19
+ const includes = filters.include ?? [];
20
+ const excludes = filters.exclude ?? [];
21
+ const labels = filters.labels ?? [];
22
+ const names = filters.names ?? [];
23
+ return tests.filter(
24
+ (test) => (includes.length === 0 || includes.some((glob) => minimatch(test.file, glob))) && !excludes.some((glob) => minimatch(test.file, glob)) && labels.every((label) => test.tags.includes(label)) && (names.length === 0 || names.some(
25
+ (name) => `${test.id}
26
+ ${test.description ?? ""}`.toLowerCase().includes(name.toLowerCase())
27
+ ))
28
+ );
29
+ }
30
+ async function discoverRunTests(config, paths, filters = {}) {
31
+ const problems = [];
32
+ const files = /* @__PURE__ */ new Set();
33
+ const root = await realpath(config.projectRoot);
34
+ if (paths.length === 0) {
35
+ for (const file of await discoverConfiguredTests(config)) {
36
+ const target = await realpath(file);
37
+ if (contained(root, target)) files.add(target);
38
+ else
39
+ problems.push({
40
+ file: "<outside-project>",
41
+ code: "outside_root",
42
+ message: "A configured test is outside the project root.",
43
+ fix: "Keep the test directory inside the project."
44
+ });
45
+ }
46
+ } else {
47
+ for (const requested of paths) {
48
+ const candidate = path.resolve(config.projectRoot, requested);
49
+ const namedInside = contained(config.projectRoot, candidate);
50
+ const file = namedInside ? path.relative(config.projectRoot, candidate).split(path.sep).join("/") : "<outside-project>";
51
+ if (!namedInside) {
52
+ problems.push({
53
+ file,
54
+ code: "outside_root",
55
+ message: "Path is outside the project root.",
56
+ fix: "Choose a path inside the project."
57
+ });
58
+ continue;
59
+ }
60
+ let info;
61
+ try {
62
+ info = await lstat(candidate);
63
+ } catch {
64
+ problems.push({
65
+ file,
66
+ code: "missing_path",
67
+ message: "Path does not exist.",
68
+ fix: "Check the path and rerun."
69
+ });
70
+ continue;
71
+ }
72
+ if (info.isSymbolicLink()) {
73
+ problems.push({
74
+ file,
75
+ code: "symlinked_path",
76
+ message: "Symlinked test paths are not supported.",
77
+ fix: "Name the regular file."
78
+ });
79
+ continue;
80
+ }
81
+ const target = await realpath(candidate).catch(() => candidate);
82
+ if (!contained(root, target)) {
83
+ problems.push({
84
+ file,
85
+ code: "outside_root",
86
+ message: "Path is outside the project root.",
87
+ fix: "Choose a path inside the project."
88
+ });
89
+ continue;
90
+ }
91
+ if (info.isDirectory()) {
92
+ for (const file2 of await walkSuiteFiles(
93
+ target,
94
+ [".test.yaml"],
95
+ (folder) => {
96
+ problems.push({
97
+ file: path.relative(root, folder),
98
+ code: "unreadable_directory",
99
+ message: "Directory could not be read.",
100
+ fix: "Check permissions."
101
+ });
102
+ }
103
+ ))
104
+ files.add(file2);
105
+ } else if (info.isFile() && candidate.endsWith(".test.yaml"))
106
+ files.add(target);
107
+ else
108
+ problems.push({
109
+ file,
110
+ code: "unsupported_file",
111
+ message: "Expected a *.test.yaml file or directory.",
112
+ fix: "Choose a test path."
113
+ });
114
+ }
115
+ }
116
+ const parsed = [];
117
+ for (const file of [...files].sort()) {
118
+ parsed.push({
119
+ file,
120
+ result: await loadFlowFile(file, {
121
+ repoRoot: root,
122
+ rejectSymlinks: true
123
+ })
124
+ });
125
+ }
126
+ const listing = listTests(parsed, { repoRoot: root });
127
+ return {
128
+ tests: selectRunTests(listing.tests, filters),
129
+ invalid: listing.invalid,
130
+ problems
131
+ };
132
+ }
133
+
134
+ export {
135
+ discoverRunTests
136
+ };
@@ -3,12 +3,12 @@ import {
3
3
  clearLocatorCache,
4
4
  parseParallel,
5
5
  renderDiagnostic
6
- } from "./chunk-BEV24G7S.js";
6
+ } from "./chunk-BI32AXS7.js";
7
7
  import {
8
8
  ProjectConfigError,
9
9
  discoverConfiguredTests,
10
10
  loadProjectConfig
11
- } from "./chunk-TZGSCV23.js";
11
+ } from "./chunk-YXSAX7E3.js";
12
12
 
13
13
  // src/exit-policy.ts
14
14
  import {
@@ -285,12 +285,13 @@ import {
285
285
  validateProject
286
286
  } from "@sedum-dev/core";
287
287
  import path2 from "path";
288
- var CLASSIFICATION_MODEL = "jev-latest";
289
288
  var createTypeSafeClassifier = async ({
290
- apiKey
289
+ apiKey,
290
+ baseURL,
291
+ model
291
292
  }) => {
292
293
  const { TypeSafeAdapter } = await import("@sedum-dev/provider-typesafe");
293
- return new TypeSafeAdapter(apiKey ? { apiKey } : {});
294
+ return new TypeSafeAdapter({ ...apiKey ? { apiKey } : {}, baseURL, model });
294
295
  };
295
296
  function emptyProjectProblem(paths, testDirectory) {
296
297
  const shown = paths.length ? paths.join(", ") : testDirectory || ".";
@@ -303,13 +304,20 @@ function emptyProjectProblem(paths, testDirectory) {
303
304
  }
304
305
  var missingKey = {
305
306
  code: "missing_key",
306
- message: "`sedum validate --online` needs a configured TypeSafe provider.",
307
- fix: "Set TYPESAFE_API_KEY in the environment or the project-root .env and rerun, or omit --online to validate offline."
307
+ message: "`sedum validate --online` needs a configured model provider.",
308
+ fix: "Set TYPESAFE_API_KEY for the configured endpoint and rerun; otherwise omit --online."
308
309
  };
309
310
  async function onlineProvider(options) {
310
311
  try {
311
- const { apiKey } = await loadProjectConfig(options.cwd);
312
- return await options.createProvider(apiKey ? { apiKey } : {});
312
+ const config = await loadProjectConfig(options.cwd);
313
+ return {
314
+ provider: await options.createProvider({
315
+ ...config.apiKey ? { apiKey: config.apiKey } : {},
316
+ baseURL: config.providerBaseUrl,
317
+ model: config.providerModel
318
+ }),
319
+ model: config.providerModel
320
+ };
313
321
  } catch (error) {
314
322
  if (error instanceof ProviderError && error.code === "configuration")
315
323
  return missingKey;
@@ -351,14 +359,16 @@ async function executeValidateCommand(options) {
351
359
  null
352
360
  );
353
361
  let provider;
362
+ let classificationModel = config.providerModel;
354
363
  if (options.online) {
355
364
  const prepared = await onlineProvider(options);
356
365
  if ("code" in prepared) return stop(discovery, prepared);
357
- provider = prepared;
366
+ provider = prepared.provider;
367
+ classificationModel = prepared.model;
358
368
  }
359
369
  const cache = await FileClassificationCache.load(
360
370
  path2.join(discovery.root, ".sedum", "classifications.json"),
361
- CLASSIFICATION_MODEL
371
+ classificationModel
362
372
  );
363
373
  const result = await validateProject(discovery, {
364
374
  repoRoot: discovery.root,
@@ -393,7 +403,7 @@ function renderValidation(result, root, capabilities) {
393
403
  for (const item of result.diagnostics) {
394
404
  const where = `${displayPath(root, item.source.file)}:${item.source.line}:${item.source.col}`;
395
405
  const label = item.severity === "warning" ? paint2(`warning ${item.code}`, "yellow", capabilities) : item.code === NOT_CHECKED_OFFLINE_CODE ? paint2("not checked offline", "yellow", capabilities) : paint2(`error ${item.code}`, "red", capabilities);
396
- const fix = item.code === NOT_CHECKED_OFFLINE_CODE ? "Rephrase with a supported verb, or run `sedum validate --online` with TYPESAFE_API_KEY set and commit .sedum/classifications.json." : item.fix;
406
+ const fix = item.code === NOT_CHECKED_OFFLINE_CODE ? "Rephrase with a supported verb, or run `sedum validate --online` with a provider API key configured and commit .sedum/classifications.json." : item.fix;
397
407
  lines.push(`${where}: ${label}: ${item.message}`, ` Fix: ${fix}`);
398
408
  }
399
409
  const { counts } = result;
@@ -562,6 +572,12 @@ function positiveMinutes(value) {
562
572
  );
563
573
  return number;
564
574
  }
575
+ function relevanceThreshold(value) {
576
+ const number = Number(value);
577
+ if (!value.trim() || !Number.isFinite(number) || number < 0 || number > 1)
578
+ throw new InvalidArgumentError("Expected a probability from 0 to 1.");
579
+ return number;
580
+ }
565
581
  function commandHelp(command, writeErr) {
566
582
  command.outputHelp({ error: true });
567
583
  const commandPath = [];
@@ -579,7 +595,7 @@ async function runCli(args, version, runtime = {}) {
579
595
  const writeOut = runtime.stdout ?? ((value) => stdout.push(value));
580
596
  const writeErr = runtime.stderr ?? ((value) => stderr.push(value));
581
597
  const capabilities = runtime.capabilities ?? plainOutput;
582
- const executeRun = runtime.executeRun ?? (async (options) => (await import("./run-command-VAVFPCWG.js")).executeRunCommand(options));
598
+ const executeRun = runtime.executeRun ?? (async (options) => (await import("./run-command-P72XF5MI.js")).executeRunCommand(options));
583
599
  const cwd = runtime.cwd ?? process.cwd();
584
600
  let exitCode = 3;
585
601
  const program = new Command().name("sedum").description(
@@ -597,7 +613,7 @@ async function runCli(args, version, runtime = {}) {
597
613
  "after",
598
614
  "\nCreates a config, a SauceDemo example, .env.example, and ignore rules.\nExisting files are never replaced.\n"
599
615
  ).action(async () => {
600
- const { executeInitCommand } = await import("./init-command-54R2FQ2U.js");
616
+ const { executeInitCommand } = await import("./init-command-EOS2MSWW.js");
601
617
  const interactive = capabilities.stdoutIsTTY && (process.stdin.isTTY === true || runtime.confirmInit !== void 0);
602
618
  const confirm = runtime.confirmInit ?? (interactive ? async (question) => {
603
619
  const { createInterface } = await import("readline/promises");
@@ -626,6 +642,18 @@ async function runCli(args, version, runtime = {}) {
626
642
  program.command("run").description("run configured tests, files, or directories").argument(
627
643
  "[paths...]",
628
644
  "test files or directories relative to the project root"
645
+ ).option(
646
+ "--affected",
647
+ "experimental: send Git diff and test sources to Jev; run relevant tests",
648
+ false
649
+ ).option("--base <ref>", "base ref for --affected (default main or master)").option(
650
+ "--threshold <probability>",
651
+ "minimum relevance probability for --affected (default 0.1)",
652
+ relevanceThreshold
653
+ ).option(
654
+ "--selection-only",
655
+ "with --affected, print selection JSON without running tests (calls Jev)",
656
+ false
629
657
  ).option(
630
658
  "--include <glob>",
631
659
  "include matching project-relative paths (repeatable)",
@@ -694,7 +722,7 @@ async function runCli(args, version, runtime = {}) {
694
722
  false
695
723
  ).addHelpText(
696
724
  "after",
697
- "\nPrerequisites:\n Install Chromium with `sedum browsers install chromium` and set TYPESAFE_API_KEY.\n\nExamples:\n sedum run tests/login.test.yaml\n sedum run tests/login.test.yaml --strict --costs\n"
725
+ "\nPrerequisites:\n Install Chromium with `sedum browsers install chromium` and set TYPESAFE_API_KEY (and TYPESAFE_BASE_URL for a compatible provider).\n\nExamples:\n sedum run tests/login.test.yaml\n sedum run tests/login.test.yaml --strict --costs\n"
698
726
  ).action(
699
727
  async (paths, options) => {
700
728
  if (options.shardIndex === void 0 !== (options.shardCount === void 0) || options.shardIndex !== void 0 && options.shardIndex > options.shardCount) {
@@ -708,6 +736,77 @@ async function runCli(args, version, runtime = {}) {
708
736
  exitCode = 3;
709
737
  return;
710
738
  }
739
+ if (options.affected && (options.shardCount ?? 1) > 1) {
740
+ writeErr(
741
+ renderDiagnostic({
742
+ code: "affected_sharding_unsupported",
743
+ message: "--affected cannot be combined with multiple shards: independent relevance selections can leave tests unexecuted.",
744
+ fix: "Remove the shard options, or run without --affected. --parallel is supported."
745
+ })
746
+ );
747
+ exitCode = 3;
748
+ return;
749
+ }
750
+ if (!options.affected && (options.base !== void 0 || options.threshold !== void 0 || options.selectionOnly)) {
751
+ writeErr(
752
+ "--base, --threshold, and --selection-only require --affected.\n"
753
+ );
754
+ exitCode = 3;
755
+ return;
756
+ }
757
+ if (options.affected) {
758
+ const { selectAffectedTests, AffectedSelectionError } = await import("./affected-selection-YIHBKUST.js");
759
+ const { ProviderError: ProviderError2 } = await import("@sedum-dev/core");
760
+ writeErr(
761
+ "Experimental selection sends the tracked Git diff and test/module sources to the configured TypeSafe provider. Full CI is still recommended.\n"
762
+ );
763
+ try {
764
+ const selection = await selectAffectedTests({
765
+ cwd,
766
+ paths,
767
+ filters: {
768
+ include: options.include,
769
+ exclude: options.exclude,
770
+ labels: options.labels,
771
+ names: options.name
772
+ },
773
+ threshold: options.threshold ?? 0.1,
774
+ ...options.base !== void 0 ? { base: options.base } : {},
775
+ ...options.env ? { environment: options.env } : {},
776
+ ...runtime.signal ? { signal: runtime.signal } : {},
777
+ ...runtime.createRelevanceProvider ? { createProvider: runtime.createRelevanceProvider } : {}
778
+ });
779
+ paths = selection.tests.filter((test) => test.selected).map((test) => test.file);
780
+ if (options.selectionOnly) {
781
+ writeOut(`${JSON.stringify(selection, null, 2)}
782
+ `);
783
+ exitCode = 0;
784
+ return;
785
+ }
786
+ writeErr(
787
+ `Affected selection: ${paths.length}/${selection.tests.length} tests, threshold ${selection.threshold}, base ${selection.base}.
788
+ `
789
+ );
790
+ for (const test of selection.tests)
791
+ writeErr(
792
+ `${test.selected ? "RUN " : "SKIP"} ${test.probability.toFixed(4)} ${JSON.stringify(test.file)} (${test.reason})
793
+ `
794
+ );
795
+ if (!paths.length) {
796
+ writeErr("No relevant tests selected; no tests were executed.\n");
797
+ exitCode = 0;
798
+ return;
799
+ }
800
+ } catch (error) {
801
+ writeErr(
802
+ `${error instanceof AffectedSelectionError || error instanceof ProviderError2 ? error.message : "Affected selection could not complete."}
803
+ No tests were run. Fix the selection error or run without --affected.
804
+ `
805
+ );
806
+ exitCode = 3;
807
+ return;
808
+ }
809
+ }
711
810
  const lifecycle = new ReporterLifecycle();
712
811
  const terminalNames = options.reporter.length ? options.reporter.filter(
713
812
  (name) => name !== "json" && name !== "markdown" && name !== "junit"
@@ -838,7 +937,7 @@ async function runCli(args, version, runtime = {}) {
838
937
  "after",
839
938
  "\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"
840
939
  ).action(async (options) => {
841
- const { executeDoctorCommand, renderDoctorText } = await import("./doctor-command-2PMOA32Y.js");
940
+ const { executeDoctorCommand, renderDoctorText } = await import("./doctor-command-A4FTFRUH.js");
842
941
  const result = await executeDoctorCommand(cwd, runtime.doctorProbes);
843
942
  writeOut(
844
943
  options.json ? `${JSON.stringify(result)}
@@ -853,7 +952,7 @@ async function runCli(args, version, runtime = {}) {
853
952
  "test files, module files, or directories relative to the project root (default: configured tests)"
854
953
  ).option(
855
954
  "--online",
856
- "classify sentences the offline cache cannot, using TYPESAFE_API_KEY, and update .sedum/classifications.json",
955
+ "classify sentences the offline cache cannot, using the configured provider API key, and update .sedum/classifications.json",
857
956
  false
858
957
  ).addHelpText(
859
958
  "after",
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ProjectConfigError
3
- } from "./chunk-TZGSCV23.js";
3
+ } from "./chunk-YXSAX7E3.js";
4
4
 
5
5
  // src/diagnostics.ts
6
6
  import { BrowserDriverError, ProviderError } from "@sedum-dev/core";
@@ -9,8 +9,8 @@ function setupDiagnostic(error) {
9
9
  if (error instanceof ProviderError && error.code === "configuration")
10
10
  return {
11
11
  code: "missing_key",
12
- message: "The TypeSafe provider is not configured.",
13
- fix: "Set TYPESAFE_API_KEY and rerun the command."
12
+ message: "The model provider is not configured.",
13
+ fix: "Set TYPESAFE_API_KEY for the configured endpoint, then rerun the command."
14
14
  };
15
15
  if (error instanceof BrowserDriverError && error.code === "browser-missing")
16
16
  return {
@@ -113,7 +113,7 @@ function flowDiagnostic(result) {
113
113
  return {
114
114
  code: result.code,
115
115
  message: "The model provider could not complete the run safely.",
116
- fix: result.code === "provider_configuration" || result.code === "provider_authentication" ? "Check TYPESAFE_API_KEY and provider access, then rerun the test." : "Check provider availability and the test input, then rerun the test."
116
+ fix: result.code === "provider_configuration" || result.code === "provider_authentication" ? "Check the provider configuration and API access, then rerun the test." : "Check provider availability and the test input, then rerun the test."
117
117
  };
118
118
  return {
119
119
  code: "execution_error",
@@ -1,6 +1,8 @@
1
1
  import {
2
+ DEFAULT_PROVIDER_BASE_URL,
3
+ DEFAULT_PROVIDER_MODEL,
2
4
  loadProjectConfig
3
- } from "./chunk-TZGSCV23.js";
5
+ } from "./chunk-YXSAX7E3.js";
4
6
 
5
7
  // src/doctor-command.ts
6
8
  import { lstat, mkdir, mkdtemp, rm, rmdir, writeFile } from "fs/promises";
@@ -31,9 +33,9 @@ function browserAvailable(kind) {
31
33
  function keyPresent(config) {
32
34
  return Boolean(config.apiKey?.trim());
33
35
  }
34
- async function networkReachable() {
36
+ async function networkReachable(baseURL) {
35
37
  try {
36
- await fetch("https://api.typesafe.ai/", {
38
+ await fetch(baseURL, {
37
39
  method: "GET",
38
40
  redirect: "manual",
39
41
  signal: AbortSignal.timeout(5e3)
@@ -128,17 +130,19 @@ async function executeDoctorCommand(cwd, probes = {}) {
128
130
  )
129
131
  );
130
132
  }
133
+ const providerBaseUrl = config?.providerBaseUrl ?? DEFAULT_PROVIDER_BASE_URL;
134
+ const providerModel = config?.providerModel ?? DEFAULT_PROVIDER_MODEL;
131
135
  let network = false;
132
136
  try {
133
- network = await (probes.network ?? networkReachable)();
137
+ network = await (probes.network ?? networkReachable)(providerBaseUrl);
134
138
  } catch {
135
139
  network = false;
136
140
  }
137
141
  checks.push(
138
- network ? pass("api_network", "TypeSafe API is reachable.") : fail(
142
+ network ? pass("api_network", "Model provider API is reachable.") : fail(
139
143
  "api_network",
140
- "TypeSafe API could not be reached.",
141
- "Check DNS, TLS, proxy, firewall, and access to https://api.typesafe.ai."
144
+ "Model provider API could not be reached.",
145
+ `Check DNS, TLS, proxy, firewall, and access to ${providerBaseUrl}.`
142
146
  )
143
147
  );
144
148
  const key = config && keyPresent(config) ? config.apiKey?.trim() : void 0;
@@ -147,10 +151,10 @@ async function executeDoctorCommand(cwd, probes = {}) {
147
151
  "api_key",
148
152
  "API key source could not be read.",
149
153
  "Fix project configuration, then rerun doctor."
150
- ) : key ? pass("api_key", "TYPESAFE_API_KEY is present.") : fail(
154
+ ) : key ? pass("api_key", "Provider API key is present.") : fail(
151
155
  "api_key",
152
- "TYPESAFE_API_KEY is missing.",
153
- "Set TYPESAFE_API_KEY in the process environment or project-root .env."
156
+ "Provider API key is missing.",
157
+ "Set TYPESAFE_API_KEY for the configured endpoint."
154
158
  )
155
159
  );
156
160
  if (!config)
@@ -166,7 +170,7 @@ async function executeDoctorCommand(cwd, probes = {}) {
166
170
  fail(
167
171
  "api_auth",
168
172
  "API authentication could not be checked without a key.",
169
- "Set TYPESAFE_API_KEY, then rerun doctor."
173
+ "Set the provider API key, then rerun doctor."
170
174
  )
171
175
  );
172
176
  else if (!network)
@@ -174,28 +178,31 @@ async function executeDoctorCommand(cwd, probes = {}) {
174
178
  fail(
175
179
  "api_auth",
176
180
  "API authentication could not be checked without API access.",
177
- "Restore TypeSafe API network access, then rerun doctor."
181
+ "Restore model provider API network access, then rerun doctor."
178
182
  )
179
183
  );
180
184
  else {
181
185
  let result;
182
186
  try {
183
- result = await (probes.auth ?? probeTypeSafeApiKey)(key);
187
+ result = await (probes.auth ?? probeTypeSafeApiKey)(key, {
188
+ baseURL: providerBaseUrl,
189
+ model: providerModel
190
+ });
184
191
  } catch {
185
192
  result = "unavailable";
186
193
  }
187
194
  checks.push(
188
- result === "accepted" ? pass("api_auth", "TypeSafe API accepted the key.") : result === "rejected" ? fail(
195
+ result === "accepted" ? pass("api_auth", "Model provider API accepted the key.") : result === "rejected" ? fail(
189
196
  "api_auth",
190
- "TypeSafe API rejected the key.",
191
- "Replace TYPESAFE_API_KEY with a valid key and rerun doctor."
197
+ "Model provider API rejected the key.",
198
+ "Replace the provider API key with a valid key and rerun doctor."
192
199
  ) : result === "unreachable" ? fail(
193
200
  "api_auth",
194
- "Authenticated TypeSafe request could not reach the API.",
201
+ "Authenticated provider request could not reach the API.",
195
202
  "Check the API connection and retry."
196
203
  ) : fail(
197
204
  "api_auth",
198
- "TypeSafe could not complete the authentication probe.",
205
+ "The model provider could not complete the authentication probe.",
199
206
  "Check API availability and account access, then retry."
200
207
  )
201
208
  );
@@ -27,6 +27,8 @@ var DEFAULTS = {
27
27
  outputDir: ".sedum/runs",
28
28
  reporterDir: ".sedum/reports"
29
29
  };
30
+ var DEFAULT_PROVIDER_BASE_URL = "https://api.typesafe.ai";
31
+ var DEFAULT_PROVIDER_MODEL = "jev-latest";
30
32
  var allowed = {
31
33
  root: /* @__PURE__ */ new Set([
32
34
  "tests",
@@ -103,8 +105,8 @@ function scalarVariables(value, key, diagnostics, file, counter, node) {
103
105
  node,
104
106
  `${key}.${name}`,
105
107
  "api_key_in_config",
106
- "TYPESAFE_API_KEY must not be stored in sedum.config.yaml.",
107
- "Put TYPESAFE_API_KEY in the project-root .env or invoking process environment."
108
+ `${name} must not be stored in sedum.config.yaml.`,
109
+ `Put ${name} in the project-root .env or invoking process environment.`
108
110
  );
109
111
  continue;
110
112
  }
@@ -605,7 +607,32 @@ async function loadProjectConfig(start = process.cwd(), hostEnvironment = proces
605
607
  ...fileEnvironment,
606
608
  ...hostEnvironment
607
609
  };
608
- const apiKey = hostEnvironment.TYPESAFE_API_KEY?.trim() || fileEnvironment.TYPESAFE_API_KEY?.trim() || void 0;
610
+ const providerValue = (name) => hostEnvironment[name]?.trim() || fileEnvironment[name]?.trim() || void 0;
611
+ const customProvider = {
612
+ baseUrl: providerValue("TYPESAFE_BASE_URL"),
613
+ model: providerValue("TYPESAFE_DEFAULT_MODEL")
614
+ };
615
+ let providerBaseUrl = DEFAULT_PROVIDER_BASE_URL;
616
+ if (customProvider.baseUrl) {
617
+ try {
618
+ const parsed = new URL(customProvider.baseUrl);
619
+ if (parsed.protocol !== "https:" || parsed.username || parsed.password || parsed.search || parsed.hash)
620
+ throw new Error("unsafe provider URL");
621
+ providerBaseUrl = parsed.href.replace(/\/$/u, "");
622
+ } catch {
623
+ diagnostics.push({
624
+ code: "invalid_provider_url",
625
+ file: environmentFile,
626
+ line: 1,
627
+ col: 1,
628
+ key: "TYPESAFE_BASE_URL",
629
+ message: "TYPESAFE_BASE_URL must be an absolute HTTPS URL without credentials, query, or fragment.",
630
+ fix: "Use a base URL such as https://api.typesafe.ai."
631
+ });
632
+ }
633
+ }
634
+ const providerModel = customProvider.model ?? DEFAULT_PROVIDER_MODEL;
635
+ const apiKey = providerValue("TYPESAFE_API_KEY");
609
636
  const testDirectory = relativePath(
610
637
  found.root,
611
638
  tests.directory,
@@ -669,7 +696,9 @@ async function loadProjectConfig(start = process.cwd(), hostEnvironment = proces
669
696
  reporterDir,
670
697
  baseUrl,
671
698
  variables,
672
- apiKey
699
+ apiKey,
700
+ providerBaseUrl,
701
+ providerModel
673
702
  });
674
703
  }
675
704
  async function discoverConfiguredTests(config) {
@@ -699,6 +728,8 @@ async function discoverConfiguredTests(config) {
699
728
 
700
729
  export {
701
730
  ProjectConfigError,
731
+ DEFAULT_PROVIDER_BASE_URL,
732
+ DEFAULT_PROVIDER_MODEL,
702
733
  loadProjectConfig,
703
734
  discoverConfiguredTests
704
735
  };
package/dist/cli.js CHANGED
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  runCli
4
- } from "./chunk-TU5MIKGA.js";
5
- import "./chunk-BEV24G7S.js";
6
- import "./chunk-TZGSCV23.js";
4
+ } from "./chunk-AZJ7JJ6P.js";
5
+ import "./chunk-BI32AXS7.js";
6
+ import "./chunk-YXSAX7E3.js";
7
7
 
8
8
  // src/cli.ts
9
9
  import { createRequire } from "module";
@@ -5,8 +5,8 @@ import {
5
5
  keyPresent,
6
6
  renderDoctorText,
7
7
  supportedNode
8
- } from "./chunk-OB6ZUJ6X.js";
9
- import "./chunk-TZGSCV23.js";
8
+ } from "./chunk-CZDCGWWD.js";
9
+ import "./chunk-YXSAX7E3.js";
10
10
  export {
11
11
  browserAvailable,
12
12
  checkOutputWritable,
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { RunResult, BrowserKind, VerifyPolicy, ClassificationProvider, BrowserInstallResult } from '@sedum-dev/core';
2
- import { AuthProbeResult } from '@sedum-dev/provider-typesafe';
2
+ import { TypeSafeAdapter, AuthProbeResult } from '@sedum-dev/provider-typesafe';
3
3
 
4
4
  interface OutputCapabilities {
5
5
  readonly stdoutIsTTY: boolean;
@@ -61,6 +61,8 @@ interface ResolvedProjectConfig {
61
61
  readonly baseUrl: string | null;
62
62
  readonly variables: Readonly<Record<string, string | undefined>>;
63
63
  readonly apiKey: string | undefined;
64
+ readonly providerBaseUrl: string;
65
+ readonly providerModel: string;
64
66
  }
65
67
  interface ProjectConfigLoadOptions {
66
68
  /**
@@ -135,17 +137,24 @@ interface RunCommandExecution {
135
137
  readonly onReporterFailure?: () => Promise<RunCommandExecution>;
136
138
  }
137
139
 
140
+ type RelevanceProviderFactory = (config: ResolvedProjectConfig) => Pick<TypeSafeAdapter, "scoreRelevance">;
141
+
138
142
  interface DoctorProbes {
139
143
  readonly nodeVersion?: string;
140
144
  readonly loadConfig?: (cwd: string) => Promise<ResolvedProjectConfig>;
141
145
  readonly browser?: (kind: BrowserKind) => boolean;
142
- readonly network?: () => Promise<boolean>;
143
- readonly auth?: (apiKey: string) => Promise<AuthProbeResult>;
146
+ readonly network?: (baseURL: string) => Promise<boolean>;
147
+ readonly auth?: (apiKey: string, options: {
148
+ readonly baseURL: string;
149
+ readonly model: string;
150
+ }) => Promise<AuthProbeResult>;
144
151
  readonly output?: (config: ResolvedProjectConfig) => Promise<void>;
145
152
  }
146
153
 
147
154
  type ClassificationProviderFactory = (options: {
148
155
  readonly apiKey?: string;
156
+ readonly baseURL: string;
157
+ readonly model: string;
149
158
  }) => ClassificationProvider | Promise<ClassificationProvider>;
150
159
 
151
160
  interface CliOutput {
@@ -166,6 +175,7 @@ interface CliRuntime {
166
175
  readonly cwd?: string;
167
176
  /** Used only by `validate --online`. */
168
177
  readonly createClassificationProvider?: ClassificationProviderFactory;
178
+ readonly createRelevanceProvider?: RelevanceProviderFactory;
169
179
  readonly doctorProbes?: DoctorProbes;
170
180
  readonly confirmInit?: (question: string) => Promise<boolean>;
171
181
  }
package/dist/index.js CHANGED
@@ -2,13 +2,13 @@ import {
2
2
  renderRunSummary,
3
3
  runCli,
4
4
  runExitCode
5
- } from "./chunk-TU5MIKGA.js";
6
- import "./chunk-BEV24G7S.js";
5
+ } from "./chunk-AZJ7JJ6P.js";
6
+ import "./chunk-BI32AXS7.js";
7
7
  import {
8
8
  ProjectConfigError,
9
9
  discoverConfiguredTests,
10
10
  loadProjectConfig
11
- } from "./chunk-TZGSCV23.js";
11
+ } from "./chunk-YXSAX7E3.js";
12
12
  export {
13
13
  ProjectConfigError,
14
14
  discoverConfiguredTests,
@@ -2,11 +2,11 @@ import {
2
2
  browserAvailable,
3
3
  keyPresent,
4
4
  supportedNode
5
- } from "./chunk-OB6ZUJ6X.js";
5
+ } from "./chunk-CZDCGWWD.js";
6
6
  import {
7
7
  ProjectConfigError,
8
8
  loadProjectConfig
9
- } from "./chunk-TZGSCV23.js";
9
+ } from "./chunk-YXSAX7E3.js";
10
10
 
11
11
  // src/init-command.ts
12
12
  import { constants } from "fs";
@@ -31,6 +31,7 @@ steps:
31
31
  - verify a list of products with prices is shown
32
32
  `;
33
33
  var ENV_EXAMPLE = `# Get a TypeSafe key and put it in .env, or set it in your shell.
34
+ # For a compatible provider, also set TYPESAFE_BASE_URL and optionally TYPESAFE_DEFAULT_MODEL.
34
35
  TYPESAFE_API_KEY=
35
36
  # Public SauceDemo sample account; no Sauce Labs account is required.
36
37
  SAUCE_PASSWORD=secret_sauce
@@ -189,10 +190,11 @@ ${++step}. ${title}
189
190
  const hasBrowser = (options.browser ?? browserAvailable)(config.browser);
190
191
  const hasEnv = await pathExists(path.join(root, ".env"));
191
192
  if (!keyPresent(config))
192
- next("Add your TypeSafe API key", [
193
+ next("Add a provider API key", [
193
194
  "Get a key at https://typesafe.ai/.",
194
195
  ...hasEnv ? [] : ["cp .env.example .env"],
195
- "Open .env and set TYPESAFE_API_KEY to your key (or set it in your shell)."
196
+ "Open .env and set TYPESAFE_API_KEY to your key (or set it in your shell).",
197
+ "For a compatible provider, also set TYPESAFE_BASE_URL and use that provider's key as TYPESAFE_API_KEY."
196
198
  ]);
197
199
  if (!hasBrowser)
198
200
  next(
@@ -6,12 +6,14 @@ import {
6
6
  planLanes,
7
7
  runPool,
8
8
  setupDiagnostic
9
- } from "./chunk-BEV24G7S.js";
9
+ } from "./chunk-BI32AXS7.js";
10
+ import {
11
+ discoverRunTests
12
+ } from "./chunk-3MCSCE7X.js";
10
13
  import {
11
14
  ProjectConfigError,
12
- discoverConfiguredTests,
13
15
  loadProjectConfig
14
- } from "./chunk-TZGSCV23.js";
16
+ } from "./chunk-YXSAX7E3.js";
15
17
 
16
18
  // src/run-command.ts
17
19
  import {
@@ -28,7 +30,7 @@ import {
28
30
  ProviderGate,
29
31
  TypeSafeAdapter
30
32
  } from "@sedum-dev/provider-typesafe";
31
- import path4 from "path";
33
+ import path3 from "path";
32
34
  import { availableParallelism } from "os";
33
35
  import { randomBytes, randomUUID } from "crypto";
34
36
 
@@ -43,9 +45,9 @@ import {
43
45
  renderMarkdown
44
46
  } from "@sedum-dev/reporters";
45
47
  var ProgressWriterError = class extends Error {
46
- constructor(path5, options) {
47
- super(`Could not write run output at ${path5}.`, options);
48
- this.path = path5;
48
+ constructor(path4, options) {
49
+ super(`Could not write run output at ${path4}.`, options);
50
+ this.path = path4;
49
51
  this.name = "ProgressWriterError";
50
52
  }
51
53
  path;
@@ -364,135 +366,6 @@ async function junitEvidenceDirectory(runDirectory, projectRoot, env) {
364
366
  return relative && isEvidenceDirectory(relative) ? relative : null;
365
367
  }
366
368
 
367
- // src/run-selection.ts
368
- import { lstat as lstat2, realpath as realpath2 } from "fs/promises";
369
- import path3 from "path";
370
- import { minimatch } from "minimatch";
371
- import {
372
- listTests,
373
- loadFlowFile,
374
- walkSuiteFiles
375
- } from "@sedum-dev/core";
376
- function contained(root, target) {
377
- const relative = path3.relative(root, target);
378
- return relative === "" || relative !== ".." && !relative.startsWith(`..${path3.sep}`) && !path3.isAbsolute(relative);
379
- }
380
- function selectRunTests(tests, filters) {
381
- const includes = filters.include ?? [];
382
- const excludes = filters.exclude ?? [];
383
- const labels = filters.labels ?? [];
384
- const names = filters.names ?? [];
385
- return tests.filter(
386
- (test) => (includes.length === 0 || includes.some((glob) => minimatch(test.file, glob))) && !excludes.some((glob) => minimatch(test.file, glob)) && labels.every((label) => test.tags.includes(label)) && (names.length === 0 || names.some(
387
- (name) => `${test.id}
388
- ${test.description ?? ""}`.toLowerCase().includes(name.toLowerCase())
389
- ))
390
- );
391
- }
392
- async function discoverRunTests(config, paths, filters = {}) {
393
- const problems = [];
394
- const files = /* @__PURE__ */ new Set();
395
- const root = await realpath2(config.projectRoot);
396
- if (paths.length === 0) {
397
- for (const file of await discoverConfiguredTests(config)) {
398
- const target = await realpath2(file);
399
- if (contained(root, target)) files.add(target);
400
- else
401
- problems.push({
402
- file: "<outside-project>",
403
- code: "outside_root",
404
- message: "A configured test is outside the project root.",
405
- fix: "Keep the test directory inside the project."
406
- });
407
- }
408
- } else {
409
- for (const requested of paths) {
410
- const candidate = path3.resolve(config.projectRoot, requested);
411
- const namedInside = contained(config.projectRoot, candidate);
412
- const file = namedInside ? path3.relative(config.projectRoot, candidate).split(path3.sep).join("/") : "<outside-project>";
413
- if (!namedInside) {
414
- problems.push({
415
- file,
416
- code: "outside_root",
417
- message: "Path is outside the project root.",
418
- fix: "Choose a path inside the project."
419
- });
420
- continue;
421
- }
422
- let info;
423
- try {
424
- info = await lstat2(candidate);
425
- } catch {
426
- problems.push({
427
- file,
428
- code: "missing_path",
429
- message: "Path does not exist.",
430
- fix: "Check the path and rerun."
431
- });
432
- continue;
433
- }
434
- if (info.isSymbolicLink()) {
435
- problems.push({
436
- file,
437
- code: "symlinked_path",
438
- message: "Symlinked test paths are not supported.",
439
- fix: "Name the regular file."
440
- });
441
- continue;
442
- }
443
- const target = await realpath2(candidate).catch(() => candidate);
444
- if (!contained(root, target)) {
445
- problems.push({
446
- file,
447
- code: "outside_root",
448
- message: "Path is outside the project root.",
449
- fix: "Choose a path inside the project."
450
- });
451
- continue;
452
- }
453
- if (info.isDirectory()) {
454
- for (const file2 of await walkSuiteFiles(
455
- target,
456
- [".test.yaml"],
457
- (folder) => {
458
- problems.push({
459
- file: path3.relative(root, folder),
460
- code: "unreadable_directory",
461
- message: "Directory could not be read.",
462
- fix: "Check permissions."
463
- });
464
- }
465
- ))
466
- files.add(file2);
467
- } else if (info.isFile() && candidate.endsWith(".test.yaml"))
468
- files.add(target);
469
- else
470
- problems.push({
471
- file,
472
- code: "unsupported_file",
473
- message: "Expected a *.test.yaml file or directory.",
474
- fix: "Choose a test path."
475
- });
476
- }
477
- }
478
- const parsed = [];
479
- for (const file of [...files].sort()) {
480
- parsed.push({
481
- file,
482
- result: await loadFlowFile(file, {
483
- repoRoot: root,
484
- rejectSymlinks: true
485
- })
486
- });
487
- }
488
- const listing = listTests(parsed, { repoRoot: root });
489
- return {
490
- tests: selectRunTests(listing.tests, filters),
491
- invalid: listing.invalid,
492
- problems
493
- };
494
- }
495
-
496
369
  // src/run-shard.ts
497
370
  import { createHash as createHash2 } from "crypto";
498
371
  function hashKey(key) {
@@ -573,7 +446,7 @@ async function openReportCopy(root, runId, canonical, outputDir, reporterDir, se
573
446
  process.env
574
447
  )
575
448
  } : null;
576
- if (path4.resolve(reporterDir) === path4.resolve(outputDir)) {
449
+ if (path3.resolve(reporterDir) === path3.resolve(outputDir)) {
577
450
  if (junit) canonical.includeJunit(junit);
578
451
  return void 0;
579
452
  }
@@ -585,7 +458,7 @@ async function openReportCopy(root, runId, canonical, outputDir, reporterDir, se
585
458
  });
586
459
  }
587
460
  function reportFormat(target) {
588
- const name = path4.basename(target);
461
+ const name = path3.basename(target);
589
462
  return name === "report.html" ? "HTML" : name === "report.md" ? "Markdown" : "JUnit";
590
463
  }
591
464
  async function finishRun(canonical, copy, result, recordCopyFailure) {
@@ -661,8 +534,8 @@ async function resultWithoutSink(runId, diagnostic) {
661
534
  return recorder.snapshot;
662
535
  }
663
536
  async function preExecutionFailure(root, runId, outputDir, reporterDir, selection, strict, diagnostic, commit) {
664
- const base = outputDir ?? path4.join(root, ".sedum", "runs");
665
- const intended = path4.join(base, runId);
537
+ const base = outputDir ?? path3.join(root, ".sedum", "runs");
538
+ const intended = path3.join(base, runId);
666
539
  let writer;
667
540
  try {
668
541
  writer = await ProgressWriter.create(root, runId, base, {
@@ -673,8 +546,8 @@ async function preExecutionFailure(root, runId, outputDir, reporterDir, selectio
673
546
  return {
674
547
  result: await resultWithoutSink(runId, diagnostic),
675
548
  artifacts: {
676
- progressPath: path4.join(intended, "progress.json"),
677
- resultPath: path4.join(intended, "result.json"),
549
+ progressPath: path3.join(intended, "progress.json"),
550
+ resultPath: path3.join(intended, "result.json"),
678
551
  authoritative: false
679
552
  },
680
553
  diagnostic
@@ -736,7 +609,7 @@ async function executeRunCommand(options) {
736
609
  throw new ProjectConfigError([
737
610
  {
738
611
  code: "invalid_browser",
739
- file: path4.join(invocationRoot, "sedum.config.yaml"),
612
+ file: path3.join(invocationRoot, "sedum.config.yaml"),
740
613
  line: 1,
741
614
  col: 1,
742
615
  key: "browser",
@@ -755,7 +628,7 @@ async function executeRunCommand(options) {
755
628
  throw new ProjectConfigError([
756
629
  {
757
630
  code: "invalid_url_override",
758
- file: path4.join(invocationRoot, "sedum.config.yaml"),
631
+ file: path3.join(invocationRoot, "sedum.config.yaml"),
759
632
  line: 1,
760
633
  col: 1,
761
634
  key: "urlOverride",
@@ -772,12 +645,12 @@ async function executeRunCommand(options) {
772
645
  });
773
646
  } catch (error) {
774
647
  const diagnostic = setupDiagnostic(error);
775
- const fallbackRoot = error instanceof ProjectConfigError && error.diagnostics[0]?.file ? path4.dirname(error.diagnostics[0].file) : invocationRoot;
648
+ const fallbackRoot = error instanceof ProjectConfigError && error.diagnostics[0]?.file ? path3.dirname(error.diagnostics[0].file) : invocationRoot;
776
649
  return preExecutionFailure(
777
650
  fallbackRoot,
778
651
  runId,
779
652
  void 0,
780
- options.reporterDir ? path4.resolve(fallbackRoot, options.reporterDir) : path4.join(fallbackRoot, ".sedum", "reports"),
653
+ options.reporterDir ? path3.resolve(fallbackRoot, options.reporterDir) : path3.join(fallbackRoot, ".sedum", "reports"),
781
654
  reportFiles,
782
655
  options.strict ?? false,
783
656
  diagnostic,
@@ -826,13 +699,13 @@ async function executeRunCommand(options) {
826
699
  );
827
700
  } catch {
828
701
  commit();
829
- const intended = path4.join(config.outputDir, runId);
830
- const diagnostic = outputDiagnostic(path4.join(intended, "result.json"));
702
+ const intended = path3.join(config.outputDir, runId);
703
+ const diagnostic = outputDiagnostic(path3.join(intended, "result.json"));
831
704
  return {
832
705
  result: await resultWithoutSink(runId, diagnostic),
833
706
  artifacts: {
834
- progressPath: path4.join(intended, "progress.json"),
835
- resultPath: path4.join(intended, "result.json"),
707
+ progressPath: path3.join(intended, "progress.json"),
708
+ resultPath: path3.join(intended, "result.json"),
836
709
  authoritative: false
837
710
  },
838
711
  diagnostic
@@ -929,7 +802,7 @@ async function executeRunCommand(options) {
929
802
  );
930
803
  } catch {
931
804
  const diagnostic = outputDiagnostic(
932
- path4.join(config.reporterDir, runId, "result.json")
805
+ path3.join(config.reporterDir, runId, "result.json")
933
806
  );
934
807
  commit();
935
808
  await recorder.finish(canonicalDiagnosticError(diagnostic));
@@ -996,7 +869,7 @@ async function executeRunCommand(options) {
996
869
  );
997
870
  globalSelectedTests = selection.tests.length;
998
871
  const selected = options.shard ? shardTests(selection.tests, options.shard) : selection.tests;
999
- files = selected.map((test) => path4.join(config.projectRoot, test.file));
872
+ files = selected.map((test) => path3.join(config.projectRoot, test.file));
1000
873
  discoveryProblems = [
1001
874
  ...selection.problems,
1002
875
  ...selection.invalid.flatMap(
@@ -1065,7 +938,7 @@ async function executeRunCommand(options) {
1065
938
  const error = new ProjectConfigError([
1066
939
  {
1067
940
  code: "no_tests",
1068
- file: config.configPath ?? path4.join(config.projectRoot, "sedum.config.yaml"),
941
+ file: config.configPath ?? path3.join(config.projectRoot, "sedum.config.yaml"),
1069
942
  line: 1,
1070
943
  col: 1,
1071
944
  key: "tests.include",
@@ -1098,11 +971,13 @@ async function executeRunCommand(options) {
1098
971
  const gate = new ProviderGate({ concurrency: providerConcurrency });
1099
972
  const provider = new TypeSafeAdapter({
1100
973
  ...config.apiKey ? { apiKey: config.apiKey } : {},
974
+ baseURL: config.providerBaseUrl,
975
+ model: config.providerModel,
1101
976
  gate
1102
977
  });
1103
978
  const cache = await FileClassificationCache.load(
1104
- path4.join(config.projectRoot, ".sedum", "classifications.json"),
1105
- "jev-latest"
979
+ path3.join(config.projectRoot, ".sedum", "classifications.json"),
980
+ config.providerModel
1106
981
  );
1107
982
  const locatorCache = await openLocatorCache(config.projectRoot, {
1108
983
  disabled: options.locatorCacheDisabled ?? false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sedum-cli",
3
- "version": "0.1.0-alpha.0",
3
+ "version": "0.1.0-alpha.3",
4
4
  "repository": "https://github.com/sedum-dev/sedum",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -25,9 +25,9 @@
25
25
  "commander": "14.0.2",
26
26
  "minimatch": "10.2.6",
27
27
  "yaml": "2.9.1",
28
- "@sedum-dev/core": "0.1.0-alpha.0",
29
- "@sedum-dev/provider-typesafe": "0.1.0-alpha.0",
30
- "@sedum-dev/reporters": "0.1.0-alpha.0"
28
+ "@sedum-dev/core": "0.1.0-alpha.3",
29
+ "@sedum-dev/provider-typesafe": "0.1.0-alpha.3",
30
+ "@sedum-dev/reporters": "0.1.0-alpha.3"
31
31
  },
32
32
  "scripts": {
33
33
  "build": "tsup src/index.ts src/cli.ts --format esm --dts --clean --out-dir dist",