effect-ci 0.1.1 → 0.1.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.
@@ -1,4 +1,23 @@
1
1
  // ../ci/src/vite-plus.ts
2
+ import { createHash } from "node:crypto";
3
+ import { existsSync, readFileSync } from "node:fs";
4
+ import { join } from "node:path";
5
+ var parseRunPlan = (body) => {
6
+ const start = body.startsWith("{") ? 0 : body.indexOf("\n{") + 1;
7
+ let plan;
8
+ try {
9
+ plan = JSON.parse(body.slice(start));
10
+ } catch (error) {
11
+ throw new Error(
12
+ `Expected a JSON run plan from \`vp run --dry-run --json\`, got: ${JSON.stringify(body.slice(0, 200))}`,
13
+ { cause: error }
14
+ );
15
+ }
16
+ if (plan?.version !== 1 || typeof plan.plan !== "object" || plan.plan === null) {
17
+ throw new Error("Expected a version 1 Vite+ run plan from `vp run --dry-run --json`");
18
+ }
19
+ return plan;
20
+ };
2
21
  var marker = (change) => change === "added" ? "+" : change === "removed" ? "-" : "\xB1";
3
22
  var describeChange = (change) => {
4
23
  switch (change.kind) {
@@ -31,10 +50,7 @@ var describeStatus = (cache) => {
31
50
  }
32
51
  };
33
52
  var cacheLog = (body) => {
34
- const plan = JSON.parse(body);
35
- if (plan.version !== 1 || typeof plan.plan !== "object" || plan.plan === null) {
36
- throw new Error("Expected a version 1 Vite+ run plan from `vp run --dry-run --json`");
37
- }
53
+ const plan = parseRunPlan(body);
38
54
  const lines = [];
39
55
  const visit = (tasks, prefix) => {
40
56
  for (const [id, task] of Object.entries(tasks)) {
@@ -59,7 +75,7 @@ var cacheLog = (body) => {
59
75
  return lines;
60
76
  };
61
77
  var untracedHits = (body) => {
62
- const plan = JSON.parse(body);
78
+ const plan = parseRunPlan(body);
63
79
  const labels = [];
64
80
  const visit = (tasks, prefix) => {
65
81
  for (const [id, task] of Object.entries(tasks)) {
@@ -77,8 +93,42 @@ var untracedHits = (body) => {
77
93
  visit(plan.plan, "");
78
94
  return labels;
79
95
  };
96
+ var synthesizedConfigMarker = "// Generated by effect-ci for one command. Safe to delete.";
97
+ var configFiles = ["vite.config.mjs", "vite.config.ts", "vite.config.cjs", "vite.config.mts", "vite.config.cts"];
98
+ var commandTaskName = (command) => `effect-ci:${createHash("sha256").update(command).digest("hex").slice(0, 12)}`;
99
+ var synthesizedConfig = (cwd, name, command) => {
100
+ if (!existsSync(join(cwd, "package.json")) || !existsSync(join(cwd, "node_modules"))) return void 0;
101
+ const own = join(cwd, "vite.config.js");
102
+ if (existsSync(own) && !readFileSync(own, "utf8").startsWith(synthesizedConfigMarker)) return void 0;
103
+ const task = JSON.stringify({ command, cache: { env: ["CLOUDFLARE_*", "NODE_ENV", "VITE_*"], untrackedEnv: ["*"] } });
104
+ const user = configFiles.find((file) => existsSync(join(cwd, file)));
105
+ if (!user) return `${synthesizedConfigMarker}
106
+ export default { run: { tasks: { ${JSON.stringify(name)}: ${task} } } }
107
+ `;
108
+ return `${synthesizedConfigMarker}
109
+ import config from ${JSON.stringify(`./${user}`)}
110
+ export default async env => {
111
+ const base = (typeof config === "function" ? await config(env) : await config) ?? {}
112
+ return { ...base, run: { ...base.run, tasks: { ...base.run?.tasks, ${JSON.stringify(name)}: ${task} } } }
113
+ }
114
+ `;
115
+ };
116
+ var packageScript = (cwd, command) => {
117
+ const [, runner, script] = /^(npm run|npm|pnpm run|pnpm|yarn run|yarn|bun run) ([\w:.-]+)$/.exec(command.trim()) ?? [];
118
+ if (!script || !existsSync(join(cwd, "package.json"))) return void 0;
119
+ if (runner === "npm" && !["test", "start", "stop", "restart"].includes(script)) return void 0;
120
+ if (!runner?.endsWith(" run") && ["install", "add", "remove", "update", "publish", "pack", "link", "exec"].includes(script))
121
+ return void 0;
122
+ const { scripts } = JSON.parse(readFileSync(join(cwd, "package.json"), "utf8"));
123
+ return typeof scripts?.[script] === "string" ? script : void 0;
124
+ };
80
125
 
81
126
  export {
127
+ parseRunPlan,
82
128
  cacheLog,
83
- untracedHits
129
+ untracedHits,
130
+ synthesizedConfigMarker,
131
+ commandTaskName,
132
+ synthesizedConfig,
133
+ packageScript
84
134
  };
@@ -0,0 +1,169 @@
1
+ import {
2
+ untracedHits
3
+ } from "./chunk-Q5USMIJ3.js";
4
+
5
+ // ../ci/src/input-evidence.ts
6
+ import { execFileSync } from "node:child_process";
7
+ import { createHash, sign, verify } from "node:crypto";
8
+ import { existsSync, readdirSync, readFileSync, realpathSync, statSync } from "node:fs";
9
+ import { relative, resolve } from "node:path";
10
+ import * as Effect from "effect/Effect";
11
+ var inputEvidenceKey = (request) => JSON.stringify({
12
+ command: request.command,
13
+ repository: request.event.source?.kind === "git" ? request.event.source.repository : void 0,
14
+ scope: request.policy.scope,
15
+ stepId: request.stepId,
16
+ task: request.trace?.task,
17
+ workflowId: request.workflowId
18
+ });
19
+ var maximumRecords = 20;
20
+ var sha256 = (value) => createHash("sha256").update(value).digest("hex");
21
+ var git = (cwd, args, input) => execFileSync("git", args, {
22
+ cwd,
23
+ encoding: "utf8",
24
+ input,
25
+ // Notes hold every traced file's digest: often several MB, past the 1 MB default.
26
+ maxBuffer: 256 * 1024 * 1024,
27
+ stdio: ["pipe", "pipe", "ignore"]
28
+ }).trim();
29
+ var keyObject = (cwd, key) => git(cwd, ["hash-object", "--stdin"], key);
30
+ var canonical = (evidence) => JSON.stringify(evidence, (_key, value) => value && typeof value === "object" && !Array.isArray(value) ? Object.fromEntries(Object.entries(value).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0)) : value);
31
+ var leafSteps = (plan) => Object.values(plan).flatMap((task) => task.steps.flatMap((step) => step.plan ? leafSteps(step.plan) : [step]));
32
+ var digestFile = (path) => sha256(readFileSync(path));
33
+ var traceRun = (cwd, task) => {
34
+ const body = execFileSync("sh", ["-c", 'PATH="$PATH:$PWD/node_modules/.bin" exec vp run --dry-run --json --cache -vv "$1"', "sh", task], {
35
+ cwd,
36
+ encoding: "utf8",
37
+ stdio: ["ignore", "pipe", "ignore"],
38
+ maxBuffer: 16 * 1024 * 1024
39
+ });
40
+ const plan = JSON.parse(body);
41
+ if (plan.version !== 1 || untracedHits(body).length > 0) return void 0;
42
+ const steps = leafSteps(plan.plan);
43
+ if (steps.length === 0) return void 0;
44
+ const written = [];
45
+ let writtenKnown = true;
46
+ for (const step of steps) {
47
+ const baseline = step.cache?.baseline;
48
+ if (step.cache?.status === "unknown") {
49
+ const reads = Object.entries(baseline?.fingerprint?.inputs ?? {});
50
+ if (!writtenKnown || reads.length === 0) return void 0;
51
+ const readsWritten = ([path, input]) => written.some((output) => {
52
+ if (output === path) return true;
53
+ const below = path === "." ? output : output.startsWith(`${path}/`) ? output.slice(path.length + 1) : void 0;
54
+ if (below === void 0) return false;
55
+ if (input.type !== "dir") return true;
56
+ const [child] = below.split("/");
57
+ return input.entries !== void 0 && !input.entries.includes(child);
58
+ });
59
+ if (reads.some(readsWritten)) return void 0;
60
+ } else if (step.cache?.status !== "hit") return void 0;
61
+ if (Array.isArray(baseline?.outputs)) written.push(...baseline.outputs);
62
+ else writtenKnown = false;
63
+ }
64
+ const inputs = {};
65
+ const env = {};
66
+ for (const step of steps) {
67
+ const fingerprint = step.cache?.baseline?.fingerprint;
68
+ for (const [path, input] of Object.entries(fingerprint?.inputs ?? {})) {
69
+ const absolute = resolve(plan.workspaceRoot, path);
70
+ if (input.type === "file") {
71
+ if (!existsSync(absolute)) {
72
+ if (!input.mayBeMissing) return void 0;
73
+ inputs[path] = { type: "missing" };
74
+ } else inputs[path] = { type: "file", sha256: digestFile(absolute), ...input.mayBeMissing ? { mayBeMissing: true } : {} };
75
+ } else inputs[path] = input;
76
+ }
77
+ for (const name of fingerprint?.env ?? []) {
78
+ const value = process.env[name];
79
+ env[name] = value === void 0 ? null : sha256(value);
80
+ }
81
+ }
82
+ return { root: relative(realpathSync(cwd), realpathSync(plan.workspaceRoot)) || ".", inputs, env };
83
+ };
84
+ var matchesInputEvidence = (cwd, evidence) => {
85
+ const root = resolve(cwd, evidence.root);
86
+ for (const [path, input] of Object.entries(evidence.inputs)) {
87
+ const absolute = resolve(root, path);
88
+ const relativePath = relative(root, absolute);
89
+ if (relativePath.startsWith("..")) return false;
90
+ const exists = existsSync(absolute);
91
+ switch (input.type) {
92
+ case "missing":
93
+ if (exists) return false;
94
+ break;
95
+ case "file":
96
+ if (!exists) {
97
+ if (!input.mayBeMissing) return false;
98
+ break;
99
+ }
100
+ if (!statSync(absolute).isFile() || digestFile(absolute) !== input.sha256) return false;
101
+ break;
102
+ case "dir": {
103
+ if (!exists) {
104
+ if (!input.mayBeMissing) return false;
105
+ break;
106
+ }
107
+ if (!statSync(absolute).isDirectory()) return false;
108
+ if (input.entries) {
109
+ const entries = readdirSync(absolute).filter((entry) => entry !== ".git").sort();
110
+ if (entries.join("\0") !== [...input.entries].sort().join("\0")) return false;
111
+ }
112
+ }
113
+ }
114
+ }
115
+ for (const [name, digest] of Object.entries(evidence.env)) {
116
+ const value = process.env[name];
117
+ if ((value === void 0 ? null : sha256(value)) !== digest) return false;
118
+ }
119
+ return true;
120
+ };
121
+ var notesRef = (options) => `--ref=${options.ref ?? "effect-ci-inputs"}`;
122
+ var readInputEvidenceRecords = (options, key) => {
123
+ try {
124
+ return JSON.parse(git(options.cwd, ["notes", notesRef(options), "show", keyObject(options.cwd, key)]));
125
+ } catch {
126
+ return [];
127
+ }
128
+ };
129
+ var writeInputEvidenceRecords = (options, key, records) => {
130
+ const identity = (() => {
131
+ try {
132
+ git(options.cwd, ["var", "GIT_COMMITTER_IDENT"]);
133
+ return [];
134
+ } catch {
135
+ return ["-c", "user.name=Effect CI", "-c", "user.email=effect-ci@localhost"];
136
+ }
137
+ })();
138
+ git(
139
+ options.cwd,
140
+ [...identity, "notes", notesRef(options), "add", "--force", "--file", "-", keyObject(options.cwd, key)],
141
+ JSON.stringify(records)
142
+ );
143
+ };
144
+ var inputEvidenceCheckCache = (options) => ({
145
+ lookup: (request) => Effect.sync(() => {
146
+ if (request.policy.scope !== "inputs" || !request.trace || request.workspace.kind !== "local") return false;
147
+ return readInputEvidenceRecords(options, inputEvidenceKey(request)).some(({ evidence, signature }) => verify(null, Buffer.from(canonical(evidence)), options.publicKey, Buffer.from(signature, "base64url")) && matchesInputEvidence(request.workspace.cwd, evidence));
148
+ }),
149
+ record: (request) => Effect.sync(() => {
150
+ if (request.policy.scope !== "inputs" || !request.trace || !options.privateKey || request.workspace.kind !== "local") return;
151
+ const evidence = traceRun(request.workspace.cwd, request.trace.task);
152
+ if (!evidence) return;
153
+ const signature = Buffer.from(sign(null, Buffer.from(canonical(evidence)), options.privateKey)).toString("base64url");
154
+ const key = inputEvidenceKey(request);
155
+ writeInputEvidenceRecords(options, key, [
156
+ { evidence, signature },
157
+ ...readInputEvidenceRecords(options, key).filter((record) => canonical(record.evidence) !== canonical(evidence))
158
+ ].slice(0, maximumRecords));
159
+ })
160
+ });
161
+
162
+ export {
163
+ inputEvidenceKey,
164
+ canonical,
165
+ matchesInputEvidence,
166
+ readInputEvidenceRecords,
167
+ writeInputEvidenceRecords,
168
+ inputEvidenceCheckCache
169
+ };
@@ -9,13 +9,18 @@ import {
9
9
  } from "./chunk-U3DVQKHN.js";
10
10
  import {
11
11
  cacheLog,
12
+ commandTaskName,
13
+ packageScript,
14
+ synthesizedConfig,
15
+ synthesizedConfigMarker,
12
16
  untracedHits
13
- } from "./chunk-WOG7K3QJ.js";
17
+ } from "./chunk-Q5USMIJ3.js";
14
18
 
15
19
  // ../ci/src/index.ts
16
- import { spawn } from "node:child_process";
17
- import { existsSync, readFileSync, writeSync } from "node:fs";
20
+ import { execFile, spawn } from "node:child_process";
21
+ import { existsSync, readFileSync, rmSync, writeFileSync, writeSync } from "node:fs";
18
22
  import { dirname, join, relative } from "node:path";
23
+ import { promisify } from "node:util";
19
24
  import picomatch from "picomatch";
20
25
  import * as Cache from "effect/Cache";
21
26
  import * as Cause from "effect/Cause";
@@ -24,6 +29,7 @@ import * as Effect2 from "effect/Effect";
24
29
  import * as Exit from "effect/Exit";
25
30
  import * as Redacted from "effect/Redacted";
26
31
  import * as Schedule from "effect/Schedule";
32
+ import * as Semaphore from "effect/Semaphore";
27
33
  import * as Context from "effect/Context";
28
34
 
29
35
  // ../ci/src/turbo.ts
@@ -250,7 +256,7 @@ var makeTurboToolchain = (workspace, namespace, prerequisites) => ({
250
256
  const planFile = ".effect-ci/turbo/plan.json";
251
257
  const discover = action(`${prefix}:plan`, function* () {
252
258
  yield* prerequisites;
253
- return () => workspace.exec(command({ operation: "plan", file: planFile, tags }));
259
+ return () => workspace.exec(command({ operation: "plan", file: planFile, tags }), { cache: false });
254
260
  });
255
261
  return Effect.gen(function* () {
256
262
  const planned = yield* discover();
@@ -290,7 +296,7 @@ var makeTurboToolchain = (workspace, namespace, prerequisites) => ({
290
296
  task,
291
297
  hashes,
292
298
  files: files2
293
- }));
299
+ }), { cache: false });
294
300
  });
295
301
  factories.set(id, run2);
296
302
  return run2;
@@ -300,7 +306,7 @@ var makeTurboToolchain = (workspace, namespace, prerequisites) => ({
300
306
  yield* parallel(sinks.map((task) => factory(task.taskId)()));
301
307
  const outputs = yield* Effect.all(sinks.map((task) => factory(task.taskId)()));
302
308
  const files = yield* filesFrom(sinks.map((task, index) => ({ task, workspace: outputs[index] })));
303
- return yield* planned.exec(command({ operation: "restore", file: planFile, files }));
309
+ return yield* planned.exec(command({ operation: "restore", file: planFile, files }), { cache: false });
304
310
  });
305
311
  })
306
312
  });
@@ -373,6 +379,7 @@ function makeRuntimeObservers(input, timeoutMs = 2e4) {
373
379
  }
374
380
 
375
381
  // ../ci/src/index.ts
382
+ var displayedCommand = /* @__PURE__ */ Symbol("effect-ci/displayedCommand");
376
383
  var WorkflowPlanError = class extends Error {
377
384
  _tag = "WorkflowPlanError";
378
385
  constructor(message) {
@@ -587,6 +594,9 @@ var Workspace = class _Workspace {
587
594
  return Effect2.gen(function* () {
588
595
  const runtime = yield* Runtime;
589
596
  const stepId = yield* CurrentStep;
597
+ const reuse = runtime.definitions.get(stepId)?.options.reuse;
598
+ const reusedByCommit = typeof reuse === "object" && reuse.scope === "commit";
599
+ if (options?.cache !== false && !options?.diagnostic && !options?.trace && !reusedByCommit && workspace.kind === "local" && (yield* VitePlusAvailable)(workspace)) return yield* vitePlusExec(workspace, command2);
590
600
  return yield* runtime.execute(stepId, workspace, command2, options);
591
601
  });
592
602
  }
@@ -716,7 +726,8 @@ var Apt = (workspace) => Effect2.gen(function* () {
716
726
  const names = packages.join(" ");
717
727
  const install = `apt-get install --yes --no-install-recommends ${names}`;
718
728
  return workspace.exec(
719
- `if [ "$(id -u)" -eq 0 ]; then apt-get update && DEBIAN_FRONTEND=noninteractive ${install}; else sudo apt-get update && sudo env DEBIAN_FRONTEND=noninteractive ${install}; fi`
729
+ `if [ "$(id -u)" -eq 0 ]; then apt-get update && DEBIAN_FRONTEND=noninteractive ${install}; else sudo apt-get update && sudo env DEBIAN_FRONTEND=noninteractive ${install}; fi`,
730
+ { cache: false }
720
731
  );
721
732
  }
722
733
  };
@@ -726,32 +737,63 @@ var VitePlusAvailable = Context.Reference(
726
737
  { defaultValue: () => () => false }
727
738
  );
728
739
  var shellQuote = (value) => `'${value.replaceAll("'", "'\\''")}'`;
729
- var vp = `PATH="$PATH:$PWD/node_modules/.bin" vp`;
730
- var vitePlusRun = (workspace, name, cache) => Effect2.gen(function* () {
740
+ var vp = `PATH="$PWD/node_modules/.bin:$PATH" vp`;
741
+ var vitePlusRun = (workspace, name, cache, adHoc) => Effect2.gen(function* () {
731
742
  let noCache = (yield* force) ? " --no-cache" : cache ? " --cache" : "";
732
743
  let traced = !(yield* force);
733
744
  if ((yield* executionMode) === "execute") {
734
745
  const file = `node_modules/.effect-ci-vite-plus-run-plan-${name.replaceAll(/[^\w-]/g, "_")}.json`;
735
- yield* workspace.exec(
736
- `mkdir -p node_modules && ${vp} run --dry-run --json${noCache} -vv ${shellQuote(name)} > ${file}`,
737
- { diagnostic: true }
738
- );
739
- const body = yield* workspace.readFile(file);
746
+ const dryRun = `${vp} run --dry-run --json${noCache} -vv ${shellQuote(name)}`;
747
+ const body = adHoc ? yield* Effect2.tryPromise(async () => (await promisify(execFile)("sh", ["-c", dryRun], {
748
+ cwd: workspace.cwd,
749
+ encoding: "utf8",
750
+ maxBuffer: 16 * 1024 * 1024,
751
+ env: (({ EFFECT_CI_EVENT_FD: _eventPipe, ...env }) => env)(process.env)
752
+ })).stdout) : yield* workspace.exec(`mkdir -p node_modules && ${dryRun} > ${file}`, { diagnostic: true }).pipe(Effect2.andThen(workspace.readFile(file)));
740
753
  if (body === void 0) return yield* Effect2.fail(new Error(`Vite+ wrote no run plan to ${file}`));
741
- const lines = yield* Effect2.try({ try: () => cacheLog(body), catch: (error) => error });
754
+ const lines = yield* Effect2.try({ try: () => cacheLog(body), catch: (error) => error }).pipe(
755
+ // Log which vp ran: a stale global one is the usual cause of an unreadable plan.
756
+ Effect2.tapError(() => workspace.exec(
757
+ `PATH="$PWD/node_modules/.bin:$PATH"; command -v vp; vp --version`,
758
+ { diagnostic: true, cache: false }
759
+ ).pipe(Effect2.ignore)),
760
+ Effect2.mapError((error) => new Error(`${error.message}. effect-ci runs node_modules/.bin/vp, else the global vp, and needs Vite+ 1.8 or later; the diagnostic log shows which vp ran`, { cause: error }))
761
+ );
742
762
  for (const line of lines) yield* line.level === "Info" ? Effect2.logInfo(line.message) : Effect2.logDebug(line.message);
743
763
  const untraced = traced ? untracedHits(body) : [];
744
764
  if (untraced.length > 0) {
745
- yield* Effect2.logWarning(`vite+ ${untraced.join(", ")}: the cached run read no project files, so running without the cache`);
765
+ const message = `vite+ ${untraced.join(", ")}: the cached run read no project files, so running without the cache. Once Vite+ can trace the tool (TypeScript 7.1 or later for \`tsc\` on macOS), run \`vp cache clean\` once to cache it again`;
766
+ yield* adHoc?.synthesized ? Effect2.logDebug(message) : Effect2.logWarning(message);
746
767
  noCache = " --no-cache";
747
768
  traced = false;
748
769
  }
749
770
  }
750
- return yield* workspace.exec(
751
- `${vp} run -v${noCache} ${shellQuote(name)}`,
752
- traced ? { trace: { tool: "vite-plus", task: name } } : void 0
753
- );
771
+ const run2 = (flags, trace) => workspace.exec(`${vp} run -v${flags} ${shellQuote(name)}`, {
772
+ ...trace ? { trace: { tool: "vite-plus", task: name } } : { cache: false },
773
+ ...adHoc ? { [displayedCommand]: adHoc.command } : {}
774
+ });
775
+ if (!adHoc || noCache === " --no-cache") return yield* run2(noCache, traced);
776
+ return yield* run2(noCache, traced).pipe(Effect2.catch((error) => error instanceof CommandError && /Failed to spawn process: underlying os error: Invalid argument/.test(`${error.output?.stdout}${error.output?.stderr}`) ? Effect2.logWarning(`vite+ ${adHoc.command}: Vite+ can't trace a command that starts another cached \`vp run\`, so running it without the cache`).pipe(Effect2.andThen(run2(" --no-cache", false))) : Effect2.fail(error)));
754
777
  });
778
+ var synthesizedConfigLocks = /* @__PURE__ */ new Map();
779
+ var vitePlusExec = (workspace, command2) => Effect2.gen(function* () {
780
+ if ((yield* executionMode) !== "execute") return yield* workspace.exec(command2, { cache: false });
781
+ const script = packageScript(workspace.cwd, command2);
782
+ if (script) return yield* vitePlusRun(workspace, script, true, { command: command2, synthesized: false });
783
+ const name = commandTaskName(command2);
784
+ const config = synthesizedConfig(workspace.cwd, name, command2);
785
+ if (config === void 0) return yield* workspace.exec(command2, { cache: false });
786
+ const path = join(workspace.cwd, "vite.config.js");
787
+ let lock = synthesizedConfigLocks.get(workspace.cwd);
788
+ if (!lock) synthesizedConfigLocks.set(workspace.cwd, lock = Semaphore.makeUnsafe(1));
789
+ return yield* lock.withPermits(1)(Effect2.acquireUseRelease(
790
+ Effect2.sync(() => writeFileSync(path, config)),
791
+ () => vitePlusRun(workspace, name, true, { command: command2, synthesized: true }),
792
+ () => Effect2.sync(() => {
793
+ if (existsSync(path) && readFileSync(path, "utf8").startsWith(synthesizedConfigMarker)) rmSync(path);
794
+ })
795
+ ));
796
+ }).pipe(Effect2.catch((error) => error instanceof CommandError || error instanceof CommandCheckpointError || error instanceof CommandExecutionError ? Effect2.fail(error) : Effect2.die(error)));
755
797
  var withVitePlus = (manager, vitePlus) => ({
756
798
  ...manager,
757
799
  vitePlus,
@@ -816,8 +858,8 @@ var detectJavaScript = (workspace) => Effect2.gen(function* () {
816
858
  ...owner,
817
859
  workspace,
818
860
  install: (options) => owner.install(options).pipe(Effect2.as(workspace)),
819
- run: (script) => workspace.exec(`${owner.name} run ${JSON.stringify(script)}`),
820
- exec: (command3) => workspace.exec(`${owner.name === "bun" ? "bunx" : owner.name === "npm" ? "npm exec --" : `${owner.name} exec`} ${command3}`)
861
+ run: (script) => workspace.exec(`${owner.name} run ${JSON.stringify(script)}`, { cache: false }),
862
+ exec: (command3) => workspace.exec(`${owner.name === "bun" ? "bunx" : owner.name === "npm" ? "npm exec --" : `${owner.name} exec`} ${command3}`, { cache: false })
821
863
  };
822
864
  }
823
865
  }
@@ -885,10 +927,10 @@ var detectJavaScript = (workspace) => Effect2.gen(function* () {
885
927
  frozenLockfile,
886
928
  options?.offline ?? false,
887
929
  workspace.kind === "remote" || runtime.ci
888
- ));
930
+ ), { cache: false });
889
931
  }),
890
- run: (script) => workspace.exec(command2("run", script)),
891
- exec: (executable2) => workspace.exec(command2("exec", executable2))
932
+ run: (script) => workspace.exec(command2("run", script), { cache: false }),
933
+ exec: (executable2) => workspace.exec(command2("exec", executable2), { cache: false })
892
934
  };
893
935
  }).pipe(
894
936
  Effect2.mapError((error) => error instanceof PackageManagerError ? error : new PackageManagerError(workspace.cwd, String(error)))
@@ -944,9 +986,10 @@ var Node = (workspace) => Effect2.gen(function* () {
944
986
  return {
945
987
  version,
946
988
  workspace,
947
- install: () => workspace.exec(`${miseEnvironment} mise --yes install ${tool}`),
989
+ install: () => workspace.exec(`${miseEnvironment} mise --yes install ${tool}`, { cache: false }),
948
990
  exec: (command2) => workspace.exec(
949
- `${miseEnvironment} mise exec ${tool} -- ${command2}`
991
+ `${miseEnvironment} mise exec ${tool} -- ${command2}`,
992
+ { cache: false }
950
993
  )
951
994
  };
952
995
  }).pipe(
@@ -970,10 +1013,12 @@ var Mise = (workspace) => Effect2.gen(function* () {
970
1013
  return {
971
1014
  workspace,
972
1015
  install: (options) => workspace.exec(
973
- `${miseEnvironment} mise --yes${options?.locked ? " --locked" : ""} install`
1016
+ `${miseEnvironment} mise --yes${options?.locked ? " --locked" : ""} install`,
1017
+ { cache: false }
974
1018
  ),
975
1019
  exec: (command2) => workspace.exec(
976
- `${miseEnvironment} mise exec -- ${command2}`
1020
+ `${miseEnvironment} mise exec -- ${command2}`,
1021
+ { cache: false }
977
1022
  )
978
1023
  };
979
1024
  }).pipe(
@@ -1701,7 +1746,7 @@ var makeRuntime = (workflowId, ci, mode, output, emitEvent, event, approvalHandl
1701
1746
  execute: (stepId, workspace, command2, execOptions) => {
1702
1747
  const node = nodes.get(stepId);
1703
1748
  if (!node) return Effect2.die(new Error(`Missing plan node for ${stepId}`));
1704
- node.commands.push({ command: command2, cwd: workspace.cwd });
1749
+ node.commands.push({ command: execOptions?.[displayedCommand] ?? command2, cwd: workspace.cwd });
1705
1750
  const commandIndex = node.commands.length;
1706
1751
  if (mode === "plan") {
1707
1752
  return Effect2.succeed(workspace);
@@ -1,3 +1,6 @@
1
+ import {
2
+ inputEvidenceCheckCache
3
+ } from "./chunk-QRAH3KJT.js";
1
4
  import {
2
5
  ApprovalError,
3
6
  CommandCheckpointError,
@@ -14,13 +17,13 @@ import {
14
17
  parallel,
15
18
  runPromise,
16
19
  workflow
17
- } from "./chunk-X4HGOXPL.js";
20
+ } from "./chunk-VWYQILHI.js";
18
21
  import {
19
22
  decodeCommandDiagnostics
20
23
  } from "./chunk-WGBTI7DS.js";
21
24
  import "./chunk-MZ5FQEN6.js";
22
25
  import "./chunk-U3DVQKHN.js";
23
- import "./chunk-WOG7K3QJ.js";
26
+ import "./chunk-Q5USMIJ3.js";
24
27
 
25
28
  // ../cli/src/workload-auth.ts
26
29
  var hasWorkloadIdentity = () => !!process.env.EFFECT_CI_OIDC_TOKEN || !!(process.env.ACTIONS_ID_TOKEN_REQUEST_URL && process.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN);
@@ -237,10 +240,10 @@ effect-ci oidc -- <deploy command> Deploy using temporary creden
237
240
  try {
238
241
  const env = { ...process.env, CLOUDFLARE_API_TOKEN: credential.token, CLOUDFLARE_ACCOUNT_ID: credential.accountId };
239
242
  delete env.EFFECT_CI_OIDC_TOKEN;
240
- process.exitCode = await new Promise((resolve3, reject) => {
243
+ process.exitCode = await new Promise((resolve4, reject) => {
241
244
  const child = spawn(command[0], command.slice(1), { cwd, env, stdio: "inherit" });
242
245
  child.on("error", reject);
243
- child.on("exit", (code) => resolve3(code ?? 1));
246
+ child.on("exit", (code) => resolve4(code ?? 1));
244
247
  });
245
248
  } finally {
246
249
  const revoked = await fetch(`${issuer}/revoke`, { method: "POST", headers: { authorization: `Bearer ${credential.receipt}` }, redirect: "error", signal: AbortSignal.timeout(15e3) });
@@ -366,27 +369,38 @@ var vitePlusTasks = (root) => {
366
369
  };
367
370
  var vitePlusAvailable = (cwd) => {
368
371
  try {
369
- execFileSync4("sh", ["-c", 'PATH="$PATH:$PWD/node_modules/.bin"; command -v vp'], { cwd, stdio: "ignore" });
372
+ execFileSync4("sh", ["-c", 'PATH="$PWD/node_modules/.bin:$PATH"; command -v vp'], { cwd, stdio: "ignore" });
370
373
  return true;
371
374
  } catch {
372
375
  return false;
373
376
  }
374
377
  };
375
378
 
379
+ // ../cli/src/check-evidence.ts
380
+ import { readFileSync as readFileSync3 } from "node:fs";
381
+ import { resolve } from "node:path";
382
+ var pem = (root, value) => !value ? void 0 : value.includes("-----BEGIN ") ? value : readFileSync3(resolve(root, value), "utf8");
383
+ var environmentCheckCache = (root, env = process.env) => {
384
+ const publicKey = pem(root, env.EFFECT_CI_CHECK_PUBLIC_KEY);
385
+ if (!publicKey) return void 0;
386
+ const privateKey = pem(root, env.EFFECT_CI_CHECK_PRIVATE_KEY);
387
+ return inputEvidenceCheckCache({ cwd: root, publicKey, ...privateKey ? { privateKey } : {} });
388
+ };
389
+
376
390
  // ../cli/src/index.ts
377
- import { existsSync as existsSync6, lstatSync as lstatSync4, mkdirSync as mkdirSync3, readFileSync as readFileSync6, realpathSync, writeFileSync as writeFileSync3 } from "node:fs";
391
+ import { existsSync as existsSync6, lstatSync as lstatSync4, mkdirSync as mkdirSync3, readFileSync as readFileSync7, realpathSync, writeFileSync as writeFileSync3 } from "node:fs";
378
392
  import { execFileSync as execFileSync5 } from "node:child_process";
379
- import { basename, dirname as dirname4, join as join6, relative, resolve as resolve2 } from "node:path";
393
+ import { basename, dirname as dirname4, join as join6, relative, resolve as resolve3 } from "node:path";
380
394
  import { pathToFileURL } from "node:url";
381
395
  import { parseArgs as parseArgs2, parseEnv as parseEnv3 } from "node:util";
382
396
 
383
397
  // ../cli/src/project-env.ts
384
- import { existsSync as existsSync3, readFileSync as readFileSync3 } from "node:fs";
385
- import { dirname as dirname2, join as join3, resolve } from "node:path";
398
+ import { existsSync as existsSync3, readFileSync as readFileSync4 } from "node:fs";
399
+ import { dirname as dirname2, join as join3, resolve as resolve2 } from "node:path";
386
400
  import { parseEnv } from "node:util";
387
401
  function projectEnvironment(cwd) {
388
402
  const directories = [];
389
- for (let directory = resolve(cwd); ; directory = dirname2(directory)) {
403
+ for (let directory = resolve2(cwd); ; directory = dirname2(directory)) {
390
404
  directories.unshift(directory);
391
405
  if (existsSync3(join3(directory, ".git")) || dirname2(directory) === directory) break;
392
406
  }
@@ -394,7 +408,7 @@ function projectEnvironment(cwd) {
394
408
  for (const directory of directories) {
395
409
  for (const name of [".env", ".env.local"]) {
396
410
  const path = join3(directory, name);
397
- if (existsSync3(path)) Object.assign(settings, parseEnv(readFileSync3(path, "utf8")));
411
+ if (existsSync3(path)) Object.assign(settings, parseEnv(readFileSync4(path, "utf8")));
398
412
  }
399
413
  }
400
414
  if (settings.EFFECT_CI_PUBLIC_URL) settings.EFFECT_CI_REMOTE_URL ??= settings.EFFECT_CI_PUBLIC_URL;
@@ -552,7 +566,7 @@ function makeLocalProjectChecks(options = {}) {
552
566
 
553
567
  // ../cli/src/login.ts
554
568
  import { spawnSync as spawnSync2 } from "node:child_process";
555
- import { chmodSync, existsSync as existsSync4, lstatSync as lstatSync2, mkdirSync as mkdirSync2, readFileSync as readFileSync4, writeFileSync as writeFileSync2 } from "node:fs";
569
+ import { chmodSync, existsSync as existsSync4, lstatSync as lstatSync2, mkdirSync as mkdirSync2, readFileSync as readFileSync5, writeFileSync as writeFileSync2 } from "node:fs";
556
570
  import { homedir as homedir2 } from "node:os";
557
571
  import { dirname as dirname3, join as join4 } from "node:path";
558
572
  var userConfigPath = () => process.env.EFFECT_CI_CONFIG || join4(homedir2(), ".config", "effect-ci", "config.json");
@@ -560,7 +574,7 @@ var readUserConfig = (path = userConfigPath()) => {
560
574
  if (!existsSync4(path)) return {};
561
575
  const file = lstatSync2(path);
562
576
  if (!file.isFile() || file.isSymbolicLink() || file.size > 8192) throw new Error(`Invalid Effect CI config: ${path}`);
563
- const value = JSON.parse(readFileSync4(path, "utf8"));
577
+ const value = JSON.parse(readFileSync5(path, "utf8"));
564
578
  if (value.version !== 1) throw new Error(`Invalid Effect CI config: ${path}`);
565
579
  return typeof value.remoteUrl === "string" ? { remoteUrl: remoteOrigin(value.remoteUrl) } : {};
566
580
  };
@@ -625,7 +639,7 @@ setting CF_ACCESS_CLIENT_ID and CF_ACCESS_CLIENT_SECRET (an Access service token
625
639
  };
626
640
 
627
641
  // ../cli/src/remote-config.ts
628
- import { existsSync as existsSync5, lstatSync as lstatSync3, readFileSync as readFileSync5 } from "node:fs";
642
+ import { existsSync as existsSync5, lstatSync as lstatSync3, readFileSync as readFileSync6 } from "node:fs";
629
643
  import { join as join5 } from "node:path";
630
644
  import { parseEnv as parseEnv2 } from "node:util";
631
645
  var readProjectRemote = (root) => {
@@ -635,7 +649,7 @@ var readProjectRemote = (root) => {
635
649
  const stat = lstatSync3(path);
636
650
  if (!stat.isFile() || stat.isSymbolicLink() || stat.size > 65536)
637
651
  throw new Error("Invalid remote configuration file");
638
- const values2 = parseEnv2(readFileSync5(path, "utf8"));
652
+ const values2 = parseEnv2(readFileSync6(path, "utf8"));
639
653
  return values2;
640
654
  };
641
655
  const shared = read(".env"), local = read(".env.local");
@@ -654,7 +668,7 @@ var readProjectOidc = (root) => {
654
668
  if (!existsSync5(path)) return void 0;
655
669
  const file = lstatSync3(path);
656
670
  if (!file.isFile() || file.isSymbolicLink() || file.size > 8192) throw new Error("Invalid OIDC configuration file");
657
- return JSON.parse(readFileSync5(path, "utf8"));
671
+ return JSON.parse(readFileSync6(path, "utf8"));
658
672
  };
659
673
 
660
674
  // ../cli/src/remote-diagnostics.ts
@@ -1110,7 +1124,7 @@ var followRemoteRun = async (connection, format, run) => {
1110
1124
  );
1111
1125
  }
1112
1126
  if (format === "text") console.log("Remote logs disconnected; reconnecting to the same Workflow\u2026");
1113
- await new Promise((resolve3) => setTimeout(resolve3, Math.min(1e3 * interruptions, 5e3)));
1127
+ await new Promise((resolve4) => setTimeout(resolve4, Math.min(1e3 * interruptions, 5e3)));
1114
1128
  }
1115
1129
  const terminal = events.at(-1);
1116
1130
  if (terminal?.type === "workflow_errored" || terminal?.type === "workflow_terminated") {
@@ -1224,7 +1238,7 @@ var runPush = async (input, cwd, detected) => {
1224
1238
  if (response?.status === 400)
1225
1239
  throw new CliFailure("CI_REMOTE_FAILED", ExitCode.providerUnavailable, `The push succeeded, but the host could not start its run: ${detail}`, { instanceId });
1226
1240
  if (response?.ok || response?.status === 404 || attempt === 4) break;
1227
- await new Promise((resolve3) => setTimeout(resolve3, 1e3 * (attempt + 1)));
1241
+ await new Promise((resolve4) => setTimeout(resolve4, 1e3 * (attempt + 1)));
1228
1242
  }
1229
1243
  const deadline = Date.now() + 6e4;
1230
1244
  while (true) {
@@ -1245,7 +1259,7 @@ var runPush = async (input, cwd, detected) => {
1245
1259
  `The push succeeded, but no run started for ${revision} within 60 seconds. Check the Artifacts event subscription for ${target.namespace}/${target.repo}.`,
1246
1260
  { instanceId }
1247
1261
  );
1248
- await new Promise((resolve3) => setTimeout(resolve3, 1e3));
1262
+ await new Promise((resolve4) => setTimeout(resolve4, 1e3));
1249
1263
  }
1250
1264
  if (format === "text") console.log(`Remote Workflow ${instanceId}`);
1251
1265
  const result = await followRemoteRun(connection, format, run);
@@ -1406,7 +1420,7 @@ var workflowNames = [
1406
1420
  "ci.mjs"
1407
1421
  ];
1408
1422
  var findWorkflow = (cwd) => {
1409
- let directory = resolve2(cwd);
1423
+ let directory = resolve3(cwd);
1410
1424
  while (true) {
1411
1425
  for (const name of workflowNames) {
1412
1426
  const candidate = join6(directory, ".cloudflare", "ci", name);
@@ -1450,12 +1464,12 @@ var extractWorkflow = (args, cwd) => {
1450
1464
  remaining.splice(positional, 1);
1451
1465
  }
1452
1466
  }
1453
- const path = explicit ? resolve2(cwd, explicit) : findWorkflow(cwd);
1467
+ const path = explicit ? resolve3(cwd, explicit) : findWorkflow(cwd);
1454
1468
  if (!path || !existsSync6(path)) {
1455
1469
  throw new CliFailure(
1456
1470
  "CI_WORKFLOW_NOT_FOUND",
1457
1471
  ExitCode.usage,
1458
- explicit ? `Workflow not found: ${resolve2(cwd, explicit)}` : `No .cloudflare/ci/workflow.ts found from ${resolve2(cwd)}`
1472
+ explicit ? `Workflow not found: ${resolve3(cwd, explicit)}` : `No .cloudflare/ci/workflow.ts found from ${resolve3(cwd)}`
1459
1473
  );
1460
1474
  }
1461
1475
  return { args: remaining, path };
@@ -1469,7 +1483,7 @@ var loadProgram = async (args = process.argv.slice(2), cwd = process.cwd()) => {
1469
1483
  program: inferJavaScriptProgram(selected.path)
1470
1484
  };
1471
1485
  }
1472
- if (basename(selected.path).startsWith("ci.") && readFileSync6(selected.path, "utf8").trim() === "") {
1486
+ if (basename(selected.path).startsWith("ci.") && readFileSync7(selected.path, "utf8").trim() === "") {
1473
1487
  return {
1474
1488
  args: selected.args,
1475
1489
  path: selected.path,
@@ -1511,7 +1525,7 @@ var inferJavaScriptProgram = (root) => {
1511
1525
  `Zero-config CI requires a package.json at ${manifestPath}`
1512
1526
  );
1513
1527
  }
1514
- const manifest = JSON.parse(readFileSync6(manifestPath, "utf8"));
1528
+ const manifest = JSON.parse(readFileSync7(manifestPath, "utf8"));
1515
1529
  let tasks = { names: [], dependencies: {} };
1516
1530
  if (manifest.dependencies?.["vite-plus"] || manifest.devDependencies?.["vite-plus"]) {
1517
1531
  try {
@@ -1544,7 +1558,7 @@ var initializeJavaScriptProject = (args, cwd) => {
1544
1558
  const invocation = parseInvocation(args, void 0, cwd);
1545
1559
  if (invocation.help || invocation.command !== "run" || invocation.location !== "local") return void 0;
1546
1560
  requireAction(invocation.targets);
1547
- const program = inferJavaScriptProgram(resolve2(cwd));
1561
+ const program = inferJavaScriptProgram(resolve3(cwd));
1548
1562
  selectedWorkflow(program, invocation.targets);
1549
1563
  for (const directory of [join6(cwd, ".cloudflare"), join6(cwd, ".cloudflare", "ci")]) {
1550
1564
  if (existsSync6(directory)) {
@@ -1568,7 +1582,7 @@ var printJson = (value) => {
1568
1582
  process.stdout.write(`${JSON.stringify(value, null, 2)}
1569
1583
  `);
1570
1584
  };
1571
- var projectRoot = (workflowPath) => basename(dirname4(workflowPath)) === "ci" && basename(dirname4(dirname4(workflowPath))) === ".cloudflare" ? resolve2(dirname4(workflowPath), "../..") : dirname4(workflowPath);
1585
+ var projectRoot = (workflowPath) => basename(dirname4(workflowPath)) === "ci" && basename(dirname4(dirname4(workflowPath))) === ".cloudflare" ? resolve3(dirname4(workflowPath), "../..") : dirname4(workflowPath);
1572
1586
  var defaultLocalOptions = (workflowPath) => {
1573
1587
  const event = process.env.EFFECT_CI_EVENT ?? process.env.GITHUB_EVENT_NAME;
1574
1588
  const revision = process.env.EFFECT_CI_REVISION ?? process.env.GITHUB_SHA;
@@ -1578,13 +1592,15 @@ var defaultLocalOptions = (workflowPath) => {
1578
1592
  try {
1579
1593
  const path = process.env.GITHUB_EVENT_PATH;
1580
1594
  if (path && lstatSync4(path).isFile() && lstatSync4(path).size <= 4194304)
1581
- payload = JSON.parse(readFileSync6(path, "utf8"));
1595
+ payload = JSON.parse(readFileSync7(path, "utf8"));
1582
1596
  } catch {
1583
1597
  }
1584
1598
  const comparison = process.env.EFFECT_CI_BASE_REVISION ? { base: process.env.EFFECT_CI_BASE_REVISION, ...revision ? { head: revision } : {} } : githubSourceComparison(event ?? "workflow_dispatch", payload, revision);
1585
1599
  const approval = decision === "approved" || decision === "rejected" ? { request: () => Effect2.succeed({ decision }) } : void 0;
1600
+ const checkCache = environmentCheckCache(projectRoot(workflowPath));
1586
1601
  return {
1587
1602
  ...approval ? { approval } : {},
1603
+ ...checkCache ? { checkCache } : {},
1588
1604
  env: process.env.NODE_ENV ?? (process.env.CI ? "test" : "development"),
1589
1605
  event: {
1590
1606
  type: event ?? "workflow_dispatch",
@@ -1706,7 +1722,7 @@ var list = (program, format) => {
1706
1722
  if (!program.requiresTarget) console.log(` effect-ci run (whole workflow)`);
1707
1723
  for (const target of targets) console.log(` effect-ci run ${target}`);
1708
1724
  };
1709
- var main = async (program, args = process.argv.slice(2), workflowPath = resolve2(process.cwd(), ".cloudflare/ci/workflow.ts")) => {
1725
+ var main = async (program, args = process.argv.slice(2), workflowPath = resolve3(process.cwd(), ".cloudflare/ci/workflow.ts")) => {
1710
1726
  let format = detectedFormat();
1711
1727
  const logs = [];
1712
1728
  try {
@@ -1866,7 +1882,7 @@ var runCli = async (args = process.argv.slice(2), cwd = process.cwd()) => {
1866
1882
  }
1867
1883
  let settings;
1868
1884
  try {
1869
- settings = parseEnv3(readFileSync6(resolve2(cwd, path), "utf8"));
1885
+ settings = parseEnv3(readFileSync7(resolve3(cwd, path), "utf8"));
1870
1886
  } catch {
1871
1887
  throw new CliFailure("CI_USAGE_ERROR", ExitCode.usage, `Cannot read environment file: ${path}`);
1872
1888
  }
@@ -1907,7 +1923,7 @@ var runCli = async (args = process.argv.slice(2), cwd = process.cwd()) => {
1907
1923
  { workflow: workflow("hosted", function* () {
1908
1924
  }) },
1909
1925
  args,
1910
- resolve2(cwd, ".cloudflare/ci/workflow.ts")
1926
+ resolve3(cwd, ".cloudflare/ci/workflow.ts")
1911
1927
  );
1912
1928
  return;
1913
1929
  }
@@ -1920,7 +1936,7 @@ var runCli = async (args = process.argv.slice(2), cwd = process.cwd()) => {
1920
1936
  }, cwd);
1921
1937
  if (!invocation.help && invocation.command === "run" && !invocation.targets.length) {
1922
1938
  const path = findWorkflow(cwd);
1923
- if (!path || basename(path).startsWith("ci.") && readFileSync6(path, "utf8").trim() === "") {
1939
+ if (!path || basename(path).startsWith("ci.") && readFileSync7(path, "utf8").trim() === "") {
1924
1940
  requireAction(invocation.targets);
1925
1941
  }
1926
1942
  }
@@ -1929,7 +1945,7 @@ var runCli = async (args = process.argv.slice(2), cwd = process.cwd()) => {
1929
1945
  { workflow: workflow("hosted", function* () {
1930
1946
  }) },
1931
1947
  args,
1932
- resolve2(cwd, ".cloudflare/ci/workflow.ts")
1948
+ resolve3(cwd, ".cloudflare/ci/workflow.ts")
1933
1949
  );
1934
1950
  return;
1935
1951
  }
@@ -1941,7 +1957,7 @@ var runCli = async (args = process.argv.slice(2), cwd = process.cwd()) => {
1941
1957
  if (invocation.location === "local" && (invocation.help || invocation.command !== "run")) {
1942
1958
  let program;
1943
1959
  try {
1944
- program = inferJavaScriptProgram(resolve2(cwd));
1960
+ program = inferJavaScriptProgram(resolve3(cwd));
1945
1961
  } catch (error) {
1946
1962
  if (invocation.help && error instanceof CliFailure && ["CI_ZERO_CONFIG_UNSUPPORTED", "CI_ZERO_CONFIG_NO_TASKS"].includes(error.code)) {
1947
1963
  console.log(help("no workflow selected"));
@@ -1950,7 +1966,7 @@ var runCli = async (args = process.argv.slice(2), cwd = process.cwd()) => {
1950
1966
  }
1951
1967
  throw error;
1952
1968
  }
1953
- process.exitCode = await main(program, args, resolve2(cwd, ".cloudflare/ci/ci.ts"));
1969
+ process.exitCode = await main(program, args, resolve3(cwd, ".cloudflare/ci/ci.ts"));
1954
1970
  return;
1955
1971
  }
1956
1972
  }
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  executionMode
3
- } from "./chunks/chunk-X4HGOXPL.js";
3
+ } from "./chunks/chunk-VWYQILHI.js";
4
4
  import "./chunks/chunk-WGBTI7DS.js";
5
5
  import "./chunks/chunk-MZ5FQEN6.js";
6
6
  import {
7
7
  pathPatterns,
8
8
  pathPrefixes
9
9
  } from "./chunks/chunk-U3DVQKHN.js";
10
- import "./chunks/chunk-WOG7K3QJ.js";
10
+ import "./chunks/chunk-Q5USMIJ3.js";
11
11
 
12
12
  // ../ci/src/directory-deployment.ts
13
13
  import { createHash, randomUUID } from "node:crypto";
package/dist/effect-ci.js CHANGED
@@ -39,5 +39,5 @@ registerHooks({
39
39
  });
40
40
 
41
41
  // ../cli/src/effect-ci.ts
42
- var { runCli } = await import("./chunks/src-FUJGARUK.js");
42
+ var { runCli } = await import("./chunks/src-L5DEQ3MF.js");
43
43
  await runCli();
package/dist/index.js CHANGED
@@ -42,7 +42,7 @@ import {
42
42
  step,
43
43
  when,
44
44
  workflow
45
- } from "./chunks/chunk-X4HGOXPL.js";
45
+ } from "./chunks/chunk-VWYQILHI.js";
46
46
  import {
47
47
  boundedCommandOutput,
48
48
  commandDiagnosticLimit,
@@ -51,7 +51,7 @@ import {
51
51
  } from "./chunks/chunk-WGBTI7DS.js";
52
52
  import "./chunks/chunk-MZ5FQEN6.js";
53
53
  import "./chunks/chunk-U3DVQKHN.js";
54
- import "./chunks/chunk-WOG7K3QJ.js";
54
+ import "./chunks/chunk-Q5USMIJ3.js";
55
55
  export {
56
56
  Approval,
57
57
  ApprovalError,
@@ -0,0 +1,17 @@
1
+ import {
2
+ canonical,
3
+ inputEvidenceCheckCache,
4
+ inputEvidenceKey,
5
+ matchesInputEvidence,
6
+ readInputEvidenceRecords,
7
+ writeInputEvidenceRecords
8
+ } from "./chunks/chunk-QRAH3KJT.js";
9
+ import "./chunks/chunk-Q5USMIJ3.js";
10
+ export {
11
+ canonical,
12
+ inputEvidenceCheckCache,
13
+ inputEvidenceKey,
14
+ matchesInputEvidence,
15
+ readInputEvidenceRecords,
16
+ writeInputEvidenceRecords
17
+ };
@@ -18,8 +18,8 @@ export declare function directoryDeployment(options: {
18
18
  changes: WorkspaceChangeProvider;
19
19
  publish: (workspace: Workspace) => Effect.Effect<DirectoryDeploymentReceipt | undefined, unknown, {
20
20
  readonly Service: import("./index.js").RuntimeShape;
21
- readonly "~effect/Context/Service": typeof import("effect/Context").ServiceTypeId;
22
21
  readonly key: "@effect-ci-testbed/Runtime";
22
+ readonly "~effect/Context/Service": typeof import("effect/Context").ServiceTypeId;
23
23
  }>;
24
24
  read: (path: string) => Effect.Effect<Buffer<ArrayBufferLike> | undefined, unknown, never>;
25
25
  };
@@ -47,7 +47,19 @@ export interface ExecOptions {
47
47
  /** A read-only command that only describes the step, such as a cache dry run.
48
48
  * It runs every time and never makes a reused check count as executed. */
49
49
  readonly diagnostic?: boolean;
50
+ /**
51
+ * With Vite+, `true` (the default) runs the command as a cached Vite+ task, like `run`
52
+ * caches package.json scripts. A cache hit replays the output and restores the files the
53
+ * command wrote, without running it. Set `false` for commands whose effect is outside the
54
+ * workspace, such as deploys, installs and pushes. `effect-ci run --force` runs every command.
55
+ * Ignored without Vite+, without a package.json and installed node_modules in the workspace,
56
+ * when the workspace has its own `vite.config.js`, or in a check reused by commit.
57
+ */
58
+ readonly cache?: boolean;
59
+ /** The command a plan shows instead. Set by `workspace.exec` with Vite+. */
60
+ readonly [displayedCommand]?: string;
50
61
  }
62
+ declare const displayedCommand: unique symbol;
51
63
  type InternalStepOptions = StepOptions & Pick<CheckOptions, "reuse">;
52
64
  export interface ActionOptions extends StepOptions {
53
65
  /**
@@ -471,7 +483,7 @@ export interface JavaScriptPackageManager {
471
483
  export declare const JavaScript: (workspace: Workspace) => Effect.Effect<JavaScriptPackageManager, PackageManagerError, Runtime | CurrentStep>;
472
484
  /**
473
485
  * The detected manager, with `run` always through Vite+. Use it for Vite+ tasks or wherever
474
- * a run must be cached. The global `vp` runs it, or the project's own from `node_modules/.bin`.
486
+ * a run must be cached. The project's own `vp` from `node_modules/.bin` runs it, or the global one.
475
487
  * Install and exec stay with the detected manager, which owns the lockfile.
476
488
  */
477
489
  export declare const VitePlus: (workspace: Workspace) => Effect.Effect<JavaScriptPackageManager, PackageManagerError, Runtime | CurrentStep>;
@@ -0,0 +1,48 @@
1
+ import type { CheckCache, CheckCacheRequest } from "./index.js";
2
+ /** What a passing run read, as Vite+ traced it, with content digests Effect CI computes. */
3
+ export type PathEvidence = {
4
+ readonly type: "file";
5
+ readonly sha256: string;
6
+ readonly mayBeMissing?: true;
7
+ } | {
8
+ readonly type: "dir";
9
+ readonly entries?: ReadonlyArray<string>;
10
+ readonly mayBeMissing?: true;
11
+ } | {
12
+ readonly type: "missing";
13
+ };
14
+ export interface InputEvidence {
15
+ /** The Vite+ workspace root, relative to the check's working directory. */
16
+ readonly root: string;
17
+ readonly inputs: Readonly<Record<string, PathEvidence>>;
18
+ /** SHA-256 of each env var value the run's cache key includes. */
19
+ readonly env: Readonly<Record<string, string | null>>;
20
+ }
21
+ export interface SignedInputEvidence {
22
+ readonly evidence: InputEvidence;
23
+ readonly signature: string;
24
+ }
25
+ export interface InputEvidenceCheckCacheOptions {
26
+ /** A Git checkout whose notes ref stores the evidence. Push the ref to share it. */
27
+ readonly cwd: string;
28
+ readonly privateKey?: string;
29
+ readonly publicKey: string;
30
+ readonly ref?: string;
31
+ }
32
+ /** Evidence is keyed by what ran, never by commit, so it survives rebases and squashes. */
33
+ export declare const inputEvidenceKey: (request: CheckCacheRequest) => string;
34
+ export declare const canonical: (evidence: InputEvidence) => string;
35
+ /** Whether the workspace still has every input exactly as the passing run read it. */
36
+ export declare const matchesInputEvidence: (cwd: string, evidence: InputEvidence) => boolean;
37
+ /** The signed records stored for one evidence key, newest first. */
38
+ export declare const readInputEvidenceRecords: (options: Pick<InputEvidenceCheckCacheOptions, "cwd" | "ref">, key: string) => ReadonlyArray<SignedInputEvidence>;
39
+ /** Replace the records for one evidence key. Records go on stdin, never argv: a traced
40
+ * `node_modules` makes each one hundreds of KB, past Linux's 128 KB per-argument limit
41
+ * and, after a few records, macOS's 1 MB ARG_MAX. */
42
+ export declare const writeInputEvidenceRecords: (options: Pick<InputEvidenceCheckCacheOptions, "cwd" | "ref">, key: string, records: ReadonlyArray<SignedInputEvidence>) => void;
43
+ /**
44
+ * Reuses a passing Vite+ check when every file and env var it read is unchanged, on any
45
+ * commit. A trusted writer signs what Vite+ traced; a reader recomputes each digest.
46
+ * Commands without a Vite+ trace and checks reused by commit always run.
47
+ */
48
+ export declare const inputEvidenceCheckCache: (options: InputEvidenceCheckCacheOptions) => CheckCache;
@@ -1,3 +1,47 @@
1
+ /** The parts of a `vp run --dry-run --json` run plan (version 1, Vite+ 1.8) that the log uses. */
2
+ interface RunPlanStep {
3
+ readonly plan?: RunPlan["plan"];
4
+ readonly cache?: {
5
+ readonly status: "hit" | "changed" | "unknown" | "noBaseline" | "error" | "disabled";
6
+ readonly baseline?: {
7
+ readonly durationMs: number;
8
+ readonly fingerprint?: {
9
+ readonly env?: ReadonlyArray<string>;
10
+ readonly inputs?: Readonly<Record<string, {
11
+ readonly type: string;
12
+ }>>;
13
+ };
14
+ readonly outputs?: ReadonlyArray<string> | "notDownloaded";
15
+ };
16
+ readonly changes?: ReadonlyArray<{
17
+ readonly kind: "program" | "args" | "cwd";
18
+ } | {
19
+ readonly kind: "config";
20
+ readonly setting: string;
21
+ } | {
22
+ readonly kind: "env";
23
+ readonly name: string;
24
+ readonly change: string;
25
+ } | {
26
+ readonly kind: "file";
27
+ readonly path: string;
28
+ readonly change: string;
29
+ }>;
30
+ readonly changesPartial?: true;
31
+ readonly message?: string;
32
+ };
33
+ }
34
+ interface RunPlan {
35
+ readonly version: number;
36
+ readonly plan: Readonly<Record<string, {
37
+ readonly steps: ReadonlyArray<RunPlanStep>;
38
+ }>>;
39
+ }
40
+ /**
41
+ * Parses `vp run --dry-run --json`. Some `vp` builds print a banner or warning to stdout
42
+ * before the plan, so anything before the first line that starts with `{` is skipped.
43
+ */
44
+ export declare const parseRunPlan: (body: string) => RunPlan;
1
45
  export interface CacheLogLine {
2
46
  readonly level: "Info" | "Debug";
3
47
  readonly message: string;
@@ -9,7 +53,25 @@ export interface CacheLogLine {
9
53
  export declare const cacheLog: (body: string) => CacheLogLine[];
10
54
  /**
11
55
  * Cache hits whose run read no project file. fspy can miss every read of some native tools,
12
- * such as TypeScript 7's `tsc` on macOS (voidzero-dev/vite-task#587). Such a hit would replay
56
+ * such as TypeScript 7.0's `tsc` on macOS (voidzero-dev/vite-task#587). Such a hit would replay
13
57
  * a stale result forever, so it must not be trusted. Needs a `-vv` plan.
14
58
  */
15
59
  export declare const untracedHits: (body: string) => string[];
60
+ /** The first line of a config effect-ci writes. A file that starts with it is safe to replace or delete. */
61
+ export declare const synthesizedConfigMarker = "// Generated by effect-ci for one command. Safe to delete.";
62
+ /** The Vite+ task that runs an ad-hoc command. The same command always gets the same task, on any machine. */
63
+ export declare const commandTaskName: (command: string) => string;
64
+ /**
65
+ * A `vite.config.js` for `cwd` that declares `command` as the Vite+ task `name` and keeps the
66
+ * project's own config. Changes to `CLOUDFLARE_*`, `NODE_ENV` and `VITE_*` variables miss the
67
+ * cache; every other variable still reaches the command but doesn't change the cache key.
68
+ * Undefined when `cwd` has no package.json or node_modules, or has its own `vite.config.js`,
69
+ * which Vite+ would load instead.
70
+ */
71
+ export declare const synthesizedConfig: (cwd: string, name: string, command: string) => string | undefined;
72
+ /**
73
+ * The package.json script that `command` runs, such as `lint` for `pnpm lint` or `npm run lint`,
74
+ * when the script exists in `cwd`. Arguments or anything else make it an ordinary command.
75
+ */
76
+ export declare const packageScript: (cwd: string, command: string) => string | undefined;
77
+ export {};
package/dist/vite-plus.js CHANGED
@@ -1,8 +1,18 @@
1
1
  import {
2
2
  cacheLog,
3
+ commandTaskName,
4
+ packageScript,
5
+ parseRunPlan,
6
+ synthesizedConfig,
7
+ synthesizedConfigMarker,
3
8
  untracedHits
4
- } from "./chunks/chunk-WOG7K3QJ.js";
9
+ } from "./chunks/chunk-Q5USMIJ3.js";
5
10
  export {
6
11
  cacheLog,
12
+ commandTaskName,
13
+ packageScript,
14
+ parseRunPlan,
15
+ synthesizedConfig,
16
+ synthesizedConfigMarker,
7
17
  untracedHits
8
18
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "effect-ci",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "Effect CI: typed CI workflows you run locally, in agents, or on your own Cloudflare host",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -41,6 +41,10 @@
41
41
  "types": "./dist/types/vite-plus.d.ts",
42
42
  "default": "./dist/vite-plus.js"
43
43
  },
44
+ "./input-evidence": {
45
+ "types": "./dist/types/input-evidence.d.ts",
46
+ "default": "./dist/input-evidence.js"
47
+ },
44
48
  "./package.json": "./package.json"
45
49
  },
46
50
  "files": [
@@ -82,7 +86,7 @@
82
86
  "@effect-ci-testbed/cloudflare-dynamic-worker": "0.0.0",
83
87
  "@types/node": "^26.6.3",
84
88
  "esbuild": "0.28.2",
85
- "typescript": "7.1.0-beta"
89
+ "typescript": "7.1.1-rc"
86
90
  },
87
91
  "scripts": {
88
92
  "build": "node build.ts",