@ordewell/core 0.12.2 → 0.12.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ModeResolver-CA2fUU9h.d.mts → ModeResolver-CkZnbIqs.d.mts} +1 -1
- package/dist/{ModeResolver-B64aUZXJ.d.ts → ModeResolver-DS-aCVOP.d.ts} +1 -1
- package/dist/{Task-CxGgN6I0.d.mts → Task-D3O49EUo.d.mts} +43 -6
- package/dist/{Task-CxGgN6I0.d.ts → Task-D3O49EUo.d.ts} +43 -6
- package/dist/{chunk-RZ23BMVR.mjs → chunk-3S5IVTZM.mjs} +80 -22
- package/dist/chunk-3S5IVTZM.mjs.map +1 -0
- package/dist/{chunk-FX33UKAD.mjs → chunk-IOYBL3E5.mjs} +3 -3
- package/dist/{chunk-UDUATSCJ.mjs → chunk-MJKCU4U7.mjs} +1 -1
- package/dist/{chunk-UDUATSCJ.mjs.map → chunk-MJKCU4U7.mjs.map} +1 -1
- package/dist/{chunk-PKJTN2PD.mjs → chunk-POD3KZQW.mjs} +7 -1
- package/dist/chunk-POD3KZQW.mjs.map +1 -0
- package/dist/{chunk-2IFKPYPO.mjs → chunk-YZDWWXCB.mjs} +58 -17
- package/dist/chunk-YZDWWXCB.mjs.map +1 -0
- package/dist/{eventStore-CTCSKS9E.d.ts → eventStore-BcoMsZtU.d.mts} +23 -7
- package/dist/{eventStore-CcB8yELZ.d.mts → eventStore-CSFKy48Y.d.ts} +23 -7
- package/dist/index.d.mts +251 -243
- package/dist/index.d.ts +251 -243
- package/dist/index.js +3059 -1448
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2716 -1203
- package/dist/index.mjs.map +1 -1
- package/dist/parsing.d.mts +2 -2
- package/dist/parsing.d.ts +2 -2
- package/dist/parsing.js +43 -15
- package/dist/parsing.js.map +1 -1
- package/dist/parsing.mjs +3 -3
- package/dist/plan-utils.d.mts +4 -4
- package/dist/plan-utils.d.ts +4 -4
- package/dist/plan-utils.js +65 -14
- package/dist/plan-utils.js.map +1 -1
- package/dist/plan-utils.mjs +15 -3
- package/dist/plan-utils.mjs.map +1 -1
- package/dist/{runSettingsText-lKLDsyli.d.ts → runSettingsText-BFaZSPRG.d.ts} +686 -26
- package/dist/{runSettingsText-DFVpe6aU.d.mts → runSettingsText-DWsmcnBq.d.mts} +686 -26
- package/dist/testing.d.mts +46 -3
- package/dist/testing.d.ts +46 -3
- package/dist/testing.js +66 -4
- package/dist/testing.js.map +1 -1
- package/dist/testing.mjs +52 -5
- package/dist/testing.mjs.map +1 -1
- package/docker/task.Dockerfile +7 -4
- package/package.json +1 -1
- package/dist/chunk-2IFKPYPO.mjs.map +0 -1
- package/dist/chunk-PKJTN2PD.mjs.map +0 -1
- package/dist/chunk-RZ23BMVR.mjs.map +0 -1
- /package/dist/{chunk-FX33UKAD.mjs.map → chunk-IOYBL3E5.mjs.map} +0 -0
package/dist/testing.d.mts
CHANGED
|
@@ -1,8 +1,51 @@
|
|
|
1
|
-
import { J as EventStore,
|
|
2
|
-
import { U as IntegrationDisposal,
|
|
1
|
+
import { J as EventStore, bQ as TreeEvent, bR as TreeFact, aj as NodePath, K as ExecutionBackend, a4 as LeaseRequest, a5 as LeaseSpec, S as Guarantee, a3 as LeaseRepo, b6 as RunnerPlacement, a2 as LeaseRecord, T as GuaranteeReport, aR as ReservedLease, _ as IRunnerSession, aK as QueuedTaskMessage, bt as StructuredTurnEnd, bs as StructuredEvent, bz as TaskCompleteArgs, x as CheckpointAnswer, bf as ScriptExit, bB as TaskMessageFrom, aX as RunnerCommand, $ as InvokedCommand, k as ApprovalDecision, V as IConfig, W as IFileSystem } from './eventStore-BcoMsZtU.mjs';
|
|
2
|
+
import { U as IntegrationDisposal, b5 as RunnerSessionCost, T as IWorktreeIsolation, W as IsolationAvailability, a2 as IsolationMergeResult, bF as TreeSnapshot, bc as SetupFailure, a5 as IsolationPruneResult, a6 as IsolationRemoval, a3 as IsolationOutcome, a9 as IsolationRevertResult, b0 as RevertCommand, aQ as RepairEvidence, ab as IsolationRun, bq as Task, aI as PrepareIntent, aJ as PreparedTask, J as HandoffCommit, ai as LandedWork, b1 as RevertWatch, X as IsolationHandoff } from './Task-D3O49EUo.mjs';
|
|
3
3
|
import 'child_process';
|
|
4
4
|
import 'zod/v4';
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Remove a test's scratch directory, waiting out whatever still holds it.
|
|
8
|
+
* Windows removes no directory a process works in, and a process tree it was
|
|
9
|
+
* told to end takes a moment to go. The retries back off linearly, about five
|
|
10
|
+
* seconds in all, and only a held directory waits. Async, so the event loop is
|
|
11
|
+
* free to run the kill that lets it go.
|
|
12
|
+
*/
|
|
13
|
+
declare function removeDir(dir: string): Promise<void>;
|
|
14
|
+
/**
|
|
15
|
+
* The variables that make `home` the user's home, for a test that gives this
|
|
16
|
+
* process, or a child, a home of its own.
|
|
17
|
+
*
|
|
18
|
+
* HOME alone is a POSIX home. Node's `os.homedir()` reads USERPROFILE on
|
|
19
|
+
* Windows, so a test that set only HOME there read and wrote the real
|
|
20
|
+
* `~/.ordewell`. The per-user folders the runner probe searches on Windows
|
|
21
|
+
* (`wellKnownBinDirs`: npm's prefix under APPDATA, WinGet's links under
|
|
22
|
+
* LOCALAPPDATA, Chocolatey's under ProgramData, Scoop's own) hang off variables
|
|
23
|
+
* of their own, so those move too, or a CLI really installed there is found.
|
|
24
|
+
*/
|
|
25
|
+
declare function homeEnv(home: string, platform?: NodeJS.Platform): Record<string, string | undefined>;
|
|
26
|
+
/**
|
|
27
|
+
* Set `vars` on this process's environment, and return what puts back the
|
|
28
|
+
* values they replaced. A key given as undefined is deleted: assigning
|
|
29
|
+
* undefined to `process.env` stores the string "undefined".
|
|
30
|
+
*/
|
|
31
|
+
declare function setEnv(vars: Record<string, string | undefined>): () => void;
|
|
32
|
+
/**
|
|
33
|
+
* A file `name` resolves to on PATH from `bin`, for a test whose spawn is
|
|
34
|
+
* faked: it is never run. Windows starts a native executable ahead of anything
|
|
35
|
+
* else on PATH (ADR-0010), so there it is a `.exe`.
|
|
36
|
+
*/
|
|
37
|
+
declare function writeStandIn(bin: string, name: string): string;
|
|
38
|
+
/**
|
|
39
|
+
* A PATH on which `command` starts the fake in `dir`.
|
|
40
|
+
*
|
|
41
|
+
* First on PATH is enough on POSIX. A fake is a batch shim on Windows, and
|
|
42
|
+
* `planDirectLaunch` prefers a native executable anywhere on PATH to a batch
|
|
43
|
+
* shim ahead of it (ADR-0010), so every directory holding a native `command`
|
|
44
|
+
* is left out as well. With {@link homeEnv}, nothing installed on the machine
|
|
45
|
+
* answers in the fake's place.
|
|
46
|
+
*/
|
|
47
|
+
declare function pathWithFake(dir: string, command: string, PATH?: string, platform?: NodeJS.Platform): string;
|
|
48
|
+
|
|
6
49
|
/**
|
|
7
50
|
* Let an already-queued promise chain run to its next await before asserting,
|
|
8
51
|
* without a wall-clock sleep. For a chain whose length is not known, drain the
|
|
@@ -316,4 +359,4 @@ declare class FakeWorktreeIsolation implements IWorktreeIsolation {
|
|
|
316
359
|
sweep(): Promise<void>;
|
|
317
360
|
}
|
|
318
361
|
|
|
319
|
-
export { FakeEventStore, FakeExecutionBackend, type FakeIsolationCall, FakeRunnerSession, FakeWorktreeIsolation, fakeConfig, fakeFileSystem, flushMicrotasks };
|
|
362
|
+
export { FakeEventStore, FakeExecutionBackend, type FakeIsolationCall, FakeRunnerSession, FakeWorktreeIsolation, fakeConfig, fakeFileSystem, flushMicrotasks, homeEnv, pathWithFake, removeDir, setEnv, writeStandIn };
|
package/dist/testing.d.ts
CHANGED
|
@@ -1,8 +1,51 @@
|
|
|
1
|
-
import { J as EventStore,
|
|
2
|
-
import { U as IntegrationDisposal,
|
|
1
|
+
import { J as EventStore, bQ as TreeEvent, bR as TreeFact, aj as NodePath, K as ExecutionBackend, a4 as LeaseRequest, a5 as LeaseSpec, S as Guarantee, a3 as LeaseRepo, b6 as RunnerPlacement, a2 as LeaseRecord, T as GuaranteeReport, aR as ReservedLease, _ as IRunnerSession, aK as QueuedTaskMessage, bt as StructuredTurnEnd, bs as StructuredEvent, bz as TaskCompleteArgs, x as CheckpointAnswer, bf as ScriptExit, bB as TaskMessageFrom, aX as RunnerCommand, $ as InvokedCommand, k as ApprovalDecision, V as IConfig, W as IFileSystem } from './eventStore-CSFKy48Y.js';
|
|
2
|
+
import { U as IntegrationDisposal, b5 as RunnerSessionCost, T as IWorktreeIsolation, W as IsolationAvailability, a2 as IsolationMergeResult, bF as TreeSnapshot, bc as SetupFailure, a5 as IsolationPruneResult, a6 as IsolationRemoval, a3 as IsolationOutcome, a9 as IsolationRevertResult, b0 as RevertCommand, aQ as RepairEvidence, ab as IsolationRun, bq as Task, aI as PrepareIntent, aJ as PreparedTask, J as HandoffCommit, ai as LandedWork, b1 as RevertWatch, X as IsolationHandoff } from './Task-D3O49EUo.js';
|
|
3
3
|
import 'child_process';
|
|
4
4
|
import 'zod/v4';
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Remove a test's scratch directory, waiting out whatever still holds it.
|
|
8
|
+
* Windows removes no directory a process works in, and a process tree it was
|
|
9
|
+
* told to end takes a moment to go. The retries back off linearly, about five
|
|
10
|
+
* seconds in all, and only a held directory waits. Async, so the event loop is
|
|
11
|
+
* free to run the kill that lets it go.
|
|
12
|
+
*/
|
|
13
|
+
declare function removeDir(dir: string): Promise<void>;
|
|
14
|
+
/**
|
|
15
|
+
* The variables that make `home` the user's home, for a test that gives this
|
|
16
|
+
* process, or a child, a home of its own.
|
|
17
|
+
*
|
|
18
|
+
* HOME alone is a POSIX home. Node's `os.homedir()` reads USERPROFILE on
|
|
19
|
+
* Windows, so a test that set only HOME there read and wrote the real
|
|
20
|
+
* `~/.ordewell`. The per-user folders the runner probe searches on Windows
|
|
21
|
+
* (`wellKnownBinDirs`: npm's prefix under APPDATA, WinGet's links under
|
|
22
|
+
* LOCALAPPDATA, Chocolatey's under ProgramData, Scoop's own) hang off variables
|
|
23
|
+
* of their own, so those move too, or a CLI really installed there is found.
|
|
24
|
+
*/
|
|
25
|
+
declare function homeEnv(home: string, platform?: NodeJS.Platform): Record<string, string | undefined>;
|
|
26
|
+
/**
|
|
27
|
+
* Set `vars` on this process's environment, and return what puts back the
|
|
28
|
+
* values they replaced. A key given as undefined is deleted: assigning
|
|
29
|
+
* undefined to `process.env` stores the string "undefined".
|
|
30
|
+
*/
|
|
31
|
+
declare function setEnv(vars: Record<string, string | undefined>): () => void;
|
|
32
|
+
/**
|
|
33
|
+
* A file `name` resolves to on PATH from `bin`, for a test whose spawn is
|
|
34
|
+
* faked: it is never run. Windows starts a native executable ahead of anything
|
|
35
|
+
* else on PATH (ADR-0010), so there it is a `.exe`.
|
|
36
|
+
*/
|
|
37
|
+
declare function writeStandIn(bin: string, name: string): string;
|
|
38
|
+
/**
|
|
39
|
+
* A PATH on which `command` starts the fake in `dir`.
|
|
40
|
+
*
|
|
41
|
+
* First on PATH is enough on POSIX. A fake is a batch shim on Windows, and
|
|
42
|
+
* `planDirectLaunch` prefers a native executable anywhere on PATH to a batch
|
|
43
|
+
* shim ahead of it (ADR-0010), so every directory holding a native `command`
|
|
44
|
+
* is left out as well. With {@link homeEnv}, nothing installed on the machine
|
|
45
|
+
* answers in the fake's place.
|
|
46
|
+
*/
|
|
47
|
+
declare function pathWithFake(dir: string, command: string, PATH?: string, platform?: NodeJS.Platform): string;
|
|
48
|
+
|
|
6
49
|
/**
|
|
7
50
|
* Let an already-queued promise chain run to its next await before asserting,
|
|
8
51
|
* without a wall-clock sleep. For a chain whose length is not known, drain the
|
|
@@ -316,4 +359,4 @@ declare class FakeWorktreeIsolation implements IWorktreeIsolation {
|
|
|
316
359
|
sweep(): Promise<void>;
|
|
317
360
|
}
|
|
318
361
|
|
|
319
|
-
export { FakeEventStore, FakeExecutionBackend, type FakeIsolationCall, FakeRunnerSession, FakeWorktreeIsolation, fakeConfig, fakeFileSystem, flushMicrotasks };
|
|
362
|
+
export { FakeEventStore, FakeExecutionBackend, type FakeIsolationCall, FakeRunnerSession, FakeWorktreeIsolation, fakeConfig, fakeFileSystem, flushMicrotasks, homeEnv, pathWithFake, removeDir, setEnv, writeStandIn };
|
package/dist/testing.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
|
|
20
30
|
// src/testing.ts
|
|
@@ -26,7 +36,12 @@ __export(testing_exports, {
|
|
|
26
36
|
FakeWorktreeIsolation: () => FakeWorktreeIsolation,
|
|
27
37
|
fakeConfig: () => fakeConfig,
|
|
28
38
|
fakeFileSystem: () => fakeFileSystem,
|
|
29
|
-
flushMicrotasks: () => flushMicrotasks
|
|
39
|
+
flushMicrotasks: () => flushMicrotasks,
|
|
40
|
+
homeEnv: () => homeEnv,
|
|
41
|
+
pathWithFake: () => pathWithFake,
|
|
42
|
+
removeDir: () => removeDir,
|
|
43
|
+
setEnv: () => setEnv,
|
|
44
|
+
writeStandIn: () => writeStandIn
|
|
30
45
|
});
|
|
31
46
|
module.exports = __toCommonJS(testing_exports);
|
|
32
47
|
|
|
@@ -95,6 +110,48 @@ function isWithin(node, ancestor) {
|
|
|
95
110
|
return node === ancestor || node.startsWith(`${ancestor}/`);
|
|
96
111
|
}
|
|
97
112
|
|
|
113
|
+
// src/testEnv.ts
|
|
114
|
+
var fs = __toESM(require("fs"));
|
|
115
|
+
var path = __toESM(require("path"));
|
|
116
|
+
function removeDir(dir) {
|
|
117
|
+
return fs.promises.rm(dir, { recursive: true, force: true, maxRetries: 10, retryDelay: 100 });
|
|
118
|
+
}
|
|
119
|
+
function homeEnv(home, platform = process.platform) {
|
|
120
|
+
if (platform !== "win32") return { HOME: home };
|
|
121
|
+
return {
|
|
122
|
+
HOME: home,
|
|
123
|
+
USERPROFILE: home,
|
|
124
|
+
APPDATA: path.win32.join(home, "AppData", "Roaming"),
|
|
125
|
+
LOCALAPPDATA: path.win32.join(home, "AppData", "Local"),
|
|
126
|
+
ProgramData: path.win32.join(home, "ProgramData"),
|
|
127
|
+
SCOOP: void 0,
|
|
128
|
+
SCOOP_GLOBAL: void 0
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
function setEnv(vars) {
|
|
132
|
+
const saved = Object.fromEntries(Object.keys(vars).map((key) => [key, process.env[key]]));
|
|
133
|
+
applyEnv(vars);
|
|
134
|
+
return () => applyEnv(saved);
|
|
135
|
+
}
|
|
136
|
+
function applyEnv(vars) {
|
|
137
|
+
for (const [key, value] of Object.entries(vars)) {
|
|
138
|
+
if (value === void 0) delete process.env[key];
|
|
139
|
+
else process.env[key] = value;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
function writeStandIn(bin, name) {
|
|
143
|
+
const file = path.join(bin, process.platform === "win32" ? `${name}.exe` : name);
|
|
144
|
+
fs.writeFileSync(file, "#!/bin/sh\nexit 1\n");
|
|
145
|
+
fs.chmodSync(file, 493);
|
|
146
|
+
return file;
|
|
147
|
+
}
|
|
148
|
+
function pathWithFake(dir, command, PATH = process.env.PATH ?? "", platform = process.platform) {
|
|
149
|
+
const paths = platform === "win32" ? path.win32 : path.posix;
|
|
150
|
+
const native = platform === "win32" ? [".exe", ".com"] : [];
|
|
151
|
+
const holdsNative = (entry) => native.some((ext) => fs.existsSync(paths.join(entry.replace(/^"|"$/g, ""), `${command}${ext}`)));
|
|
152
|
+
return [dir, ...PATH.split(paths.delimiter).filter((entry) => entry && !holdsNative(entry))].join(paths.delimiter);
|
|
153
|
+
}
|
|
154
|
+
|
|
98
155
|
// src/testing.ts
|
|
99
156
|
async function flushMicrotasks(rounds = 20) {
|
|
100
157
|
for (let i = 0; i < rounds; i += 1) await Promise.resolve();
|
|
@@ -375,9 +432,9 @@ var FakeEventStore = class {
|
|
|
375
432
|
if (this.failing) throw this.failing;
|
|
376
433
|
for (const event of events) this.events.push({ ...event, seq: this.events.length + 1 });
|
|
377
434
|
}
|
|
378
|
-
async *read(after,
|
|
435
|
+
async *read(after, path2) {
|
|
379
436
|
for (const event of [...this.events]) {
|
|
380
|
-
if (event.seq > after && (
|
|
437
|
+
if (event.seq > after && (path2 === void 0 || isWithin(event.node, path2))) yield event;
|
|
381
438
|
}
|
|
382
439
|
}
|
|
383
440
|
async close() {
|
|
@@ -780,6 +837,11 @@ var FakeWorktreeIsolation = class {
|
|
|
780
837
|
FakeWorktreeIsolation,
|
|
781
838
|
fakeConfig,
|
|
782
839
|
fakeFileSystem,
|
|
783
|
-
flushMicrotasks
|
|
840
|
+
flushMicrotasks,
|
|
841
|
+
homeEnv,
|
|
842
|
+
pathWithFake,
|
|
843
|
+
removeDir,
|
|
844
|
+
setEnv,
|
|
845
|
+
writeStandIn
|
|
784
846
|
});
|
|
785
847
|
//# sourceMappingURL=testing.js.map
|