spec-controller 0.1.0-alpha.45 → 0.1.0-alpha.47
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/cli-allocate/cli.d.ts.map +1 -1
- package/dist/cli-allocate/cli.js +0 -5
- package/dist/cli-allocate/cli.js.map +1 -1
- package/dist/cli-allocate/readHistory.d.ts +0 -13
- package/dist/cli-allocate/readHistory.d.ts.map +1 -1
- package/dist/cli-allocate/readHistory.js +0 -33
- package/dist/cli-allocate/readHistory.js.map +1 -1
- package/dist/cli-allocate/readParts.d.ts +0 -1
- package/dist/cli-allocate/readParts.d.ts.map +1 -1
- package/dist/cli-allocate/readParts.js +0 -6
- package/dist/cli-allocate/readParts.js.map +1 -1
- package/dist/cli-allocate/readTree.d.ts +0 -11
- package/dist/cli-allocate/readTree.d.ts.map +1 -1
- package/dist/cli-allocate/readTree.js +0 -32
- package/dist/cli-allocate/readTree.js.map +1 -1
- package/dist/cli-allocate/refStore.d.ts +0 -1
- package/dist/cli-allocate/refStore.d.ts.map +1 -1
- package/dist/cli-allocate/refStore.js +0 -13
- package/dist/cli-allocate/refStore.js.map +1 -1
- package/dist/cli-allocate/request.d.ts +0 -2
- package/dist/cli-allocate/request.d.ts.map +1 -1
- package/dist/cli-allocate/request.js +0 -7
- package/dist/cli-allocate/request.js.map +1 -1
- package/dist/cli-allocate/stderr.d.ts +0 -7
- package/dist/cli-allocate/stderr.d.ts.map +1 -1
- package/dist/cli-allocate/stderr.js +0 -7
- package/dist/cli-allocate/stderr.js.map +1 -1
- package/dist/cli-allocate/unreadable.d.ts +0 -13
- package/dist/cli-allocate/unreadable.d.ts.map +1 -1
- package/dist/cli-allocate/unreadable.js +0 -13
- package/dist/cli-allocate/unreadable.js.map +1 -1
- package/dist/cli-args.d.ts +0 -113
- package/dist/cli-args.d.ts.map +1 -1
- package/dist/cli-args.js +0 -145
- package/dist/cli-args.js.map +1 -1
- package/dist/cli-balance/cli.d.ts +0 -85
- package/dist/cli-balance/cli.d.ts.map +1 -1
- package/dist/cli-balance/cli.js +0 -230
- package/dist/cli-balance/cli.js.map +1 -1
- package/dist/cli-balance/emit/format.d.ts +0 -52
- package/dist/cli-balance/emit/format.d.ts.map +1 -1
- package/dist/cli-balance/emit/format.js +0 -70
- package/dist/cli-balance/emit/format.js.map +1 -1
- package/dist/cli-balance/emit/writer.d.ts +0 -17
- package/dist/cli-balance/emit/writer.d.ts.map +1 -1
- package/dist/cli-balance/emit/writer.js +0 -13
- package/dist/cli-balance/emit/writer.js.map +1 -1
- package/dist/cli-balance/exitStatus.d.ts +0 -1
- package/dist/cli-balance/exitStatus.d.ts.map +1 -1
- package/dist/cli-balance/exitStatus.js +0 -7
- package/dist/cli-balance/exitStatus.js.map +1 -1
- package/dist/cli-balance/inputsRead.d.ts +0 -12
- package/dist/cli-balance/inputsRead.d.ts.map +1 -1
- package/dist/cli-balance/inputsRead.js +0 -12
- package/dist/cli-balance/inputsRead.js.map +1 -1
- package/dist/cli-balance/reRender.d.ts +0 -14
- package/dist/cli-balance/reRender.d.ts.map +1 -1
- package/dist/cli-balance/reRender.js +0 -15
- package/dist/cli-balance/reRender.js.map +1 -1
- package/dist/cli-balance/unreadableInputs.d.ts +0 -21
- package/dist/cli-balance/unreadableInputs.d.ts.map +1 -1
- package/dist/cli-balance/unreadableInputs.js +0 -21
- package/dist/cli-balance/unreadableInputs.js.map +1 -1
- package/dist/cli-registry.d.ts +0 -86
- package/dist/cli-registry.d.ts.map +1 -1
- package/dist/cli-registry.js +0 -70
- package/dist/cli-registry.js.map +1 -1
- package/dist/cli.d.ts +0 -20
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +0 -21
- package/dist/cli.js.map +1 -1
- package/dist/deferralTags.d.ts +0 -14
- package/dist/deferralTags.d.ts.map +1 -1
- package/dist/deferralTags.js +0 -14
- package/dist/deferralTags.js.map +1 -1
- package/dist/host.d.ts +0 -61
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +1 -84
- package/dist/host.js.map +1 -1
- package/dist/ingest/ciSourcePaths.d.ts +0 -38
- package/dist/ingest/ciSourcePaths.d.ts.map +1 -1
- package/dist/ingest/ciSourcePaths.js +0 -38
- package/dist/ingest/ciSourcePaths.js.map +1 -1
- package/dist/ingest/gherkinValidation.d.ts +0 -76
- package/dist/ingest/gherkinValidation.d.ts.map +1 -1
- package/dist/ingest/gherkinValidation.js +0 -76
- package/dist/ingest/gherkinValidation.js.map +1 -1
- package/dist/ingest/ingestQualityChecks.d.ts +0 -81
- package/dist/ingest/ingestQualityChecks.d.ts.map +1 -1
- package/dist/ingest/ingestQualityChecks.js +0 -194
- package/dist/ingest/ingestQualityChecks.js.map +1 -1
- package/dist/ingest/ingestScenarios.d.ts +0 -39
- package/dist/ingest/ingestScenarios.d.ts.map +1 -1
- package/dist/ingest/ingestScenarios.js +0 -70
- package/dist/ingest/ingestScenarios.js.map +1 -1
- package/dist/ingest/inputShapes.d.ts +0 -31
- package/dist/ingest/inputShapes.d.ts.map +1 -1
- package/dist/ingest/inputShapes.js +0 -30
- package/dist/ingest/inputShapes.js.map +1 -1
- package/dist/outputLocation.d.ts +0 -48
- package/dist/outputLocation.d.ts.map +1 -1
- package/dist/outputLocation.js +0 -48
- package/dist/outputLocation.js.map +1 -1
- package/dist/run-management/keptRun.d.ts +0 -107
- package/dist/run-management/keptRun.d.ts.map +1 -1
- package/dist/run-management/keptRun.js +0 -75
- package/dist/run-management/keptRun.js.map +1 -1
- package/dist/run-management/resolveRunInputs.d.ts +0 -67
- package/dist/run-management/resolveRunInputs.d.ts.map +1 -1
- package/dist/run-management/resolveRunInputs.js +0 -88
- package/dist/run-management/resolveRunInputs.js.map +1 -1
- package/dist/storedRun.d.ts +0 -21
- package/dist/storedRun.d.ts.map +1 -1
- package/dist/storedRun.js +0 -21
- package/dist/storedRun.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inputShapes.js","sourceRoot":"","sources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G,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;QACxD,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAChC,IAAI,MAAM,CAAC,GAAG,CAAC,KAAK,SAAS,EAAE,CAAC;YAC9B,IAAI,KAAK,CAAC,QAAQ,EAAE,QAAQ,CAAC,GAAG,CAAC,KAAK,IAAI;gBAAE,OAAO,GAAG,IAAI,aAAa,CAAC;YACxE,SAAS;QACX,CAAC;QACD,MAAM,KAAK,GAAG,YAAY,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;QACrD,IAAI,KAAK,KAAK,IAAI;YAAE,OAAO,KAAK,CAAC;IACnC,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,YAAY,CAAC,MAA+B,EAAE,KAAc,EAAE,KAAa;IAClF,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAClD,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;YAAE,SAAS;QAChE,MAAM,KAAK,GAAG,YAAY,CAAC,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC;QACrE,IAAI,KAAK,KAAK,IAAI;YAAE,OAAO,KAAK,CAAC;IACnC,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/dist/outputLocation.d.ts
CHANGED
|
@@ -1,75 +1,27 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A run refused on the usage code. Its one line is already on stderr when it is thrown; the command
|
|
3
|
-
* running it settles the status (`settlingRefusal`), so the process ends by draining what was written
|
|
4
|
-
* rather than being cut off mid-write.
|
|
5
|
-
*/
|
|
6
1
|
export declare class UsageRefusal extends Error {
|
|
7
2
|
readonly name = "UsageRefusal";
|
|
8
3
|
readonly exitCode = 2;
|
|
9
4
|
}
|
|
10
5
|
export declare function unwritableRefusal(subject: string, path: string, err: unknown): string;
|
|
11
|
-
/**
|
|
12
|
-
* The catch sits on the one write it guards rather than on the process, so a refusal can only ever
|
|
13
|
-
* name a location this call was asked to write, and a crash anywhere else is not dressed up as one.
|
|
14
|
-
*/
|
|
15
6
|
export declare function writeOrRefuse(subject: string, path: string, write: () => void): void;
|
|
16
|
-
/** Refuses the run on the usage code with one line on stderr, then throws for the command to settle. */
|
|
17
7
|
export declare function refuse(message: string): never;
|
|
18
|
-
/**
|
|
19
|
-
* Runs a command and settles a usage refusal it throws: the status becomes the refusal's code and
|
|
20
|
-
* `refused` is answered. Anything else thrown is not a refusal, and propagates as it would have.
|
|
21
|
-
*/
|
|
22
8
|
export declare function settlingRefusal<T>(run: () => T, refused: T): T;
|
|
23
|
-
/** The operating system's identity for a regular file; anything else has none. */
|
|
24
9
|
export interface RegularFileIdentity {
|
|
25
10
|
readonly dev: bigint;
|
|
26
11
|
readonly ino: bigint;
|
|
27
12
|
}
|
|
28
|
-
/** A file a run reads, and how a refusal names it. */
|
|
29
13
|
export interface ReadInput {
|
|
30
14
|
readonly subject: string;
|
|
31
15
|
readonly path: string;
|
|
32
16
|
}
|
|
33
|
-
/** What opening a destination found: the identity of the regular file it is, and the file it had to create, if any. */
|
|
34
17
|
export interface ProbedDestination {
|
|
35
18
|
readonly identity: RegularFileIdentity | undefined;
|
|
36
19
|
readonly created: string | undefined;
|
|
37
20
|
}
|
|
38
|
-
/**
|
|
39
|
-
* Throws the operating system's own error when `path` cannot be written as a file, and otherwise
|
|
40
|
-
* answers which regular file it is. An existing file is opened write-only without truncation (not
|
|
41
|
-
* "r+", which would also demand read permission). An absent one is created and left in place for the
|
|
42
|
-
* caller to remove once every destination has been identified: two names for one absent file share
|
|
43
|
-
* an identity only once one of them exists. So a missing, read-only or non-directory parent answers
|
|
44
|
-
* with its real reason instead of one this module would have to invent.
|
|
45
|
-
*
|
|
46
|
-
* The creation is not exclusive, because the write-only open has already answered that nothing exists
|
|
47
|
-
* at the end of the path, and an exclusive create would refuse a link whose target does not exist yet
|
|
48
|
-
* although the write would follow it. What the caller removes is the real file created, never the
|
|
49
|
-
* link that led to it.
|
|
50
|
-
*/
|
|
51
21
|
export declare function probeDestination(path: string): ProbedDestination;
|
|
52
|
-
/**
|
|
53
|
-
* The first of `others` that is the same regular file as `file`, or undefined when none is. Every
|
|
54
|
-
* file created to find out is removed again. A path that cannot be opened shares nothing here: the
|
|
55
|
-
* write that would use it refuses it on its own terms.
|
|
56
|
-
*/
|
|
57
22
|
export declare function firstSharingFile(file: string, others: readonly string[]): string | undefined;
|
|
58
|
-
/**
|
|
59
|
-
* The identity of the regular file a path a run reads leads to, through any links, or undefined when
|
|
60
|
-
* it leads to anything else or to nothing. The file is only looked at: an input is never opened for
|
|
61
|
-
* writing, and one that is not there cannot be overwritten.
|
|
62
|
-
*/
|
|
63
23
|
export declare function regularFileIdentity(path: string): RegularFileIdentity | undefined;
|
|
64
|
-
/** The first of `inputs` that is the regular file at `path`, or undefined when none is, or nothing is there. */
|
|
65
24
|
export declare function inputAt(path: string, inputs: readonly ReadInput[]): ReadInput | undefined;
|
|
66
|
-
/** The identity of the regular file standard output is, when it is one. */
|
|
67
25
|
export declare function stdoutIdentity(): RegularFileIdentity | undefined;
|
|
68
|
-
/**
|
|
69
|
-
* Whether `path` names standard output: spelled as file descriptor 1, or reaching such a spelling
|
|
70
|
-
* through links, followed one at a time as `realpath` would. Asking what the path spells rather than
|
|
71
|
-
* which file it opens is deliberate: when standard output and standard error share one terminal or
|
|
72
|
-
* one pipe, /dev/stderr opens the very same file, and it does not name standard output.
|
|
73
|
-
*/
|
|
74
26
|
export declare function namesStdout(path: string): boolean;
|
|
75
27
|
//# sourceMappingURL=outputLocation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"outputLocation.d.ts","sourceRoot":"","sources":["../src/outputLocation.ts"],"names":[],"mappings":"AAKA
|
|
1
|
+
{"version":3,"file":"outputLocation.d.ts","sourceRoot":"","sources":["../src/outputLocation.ts"],"names":[],"mappings":"AAKA,qBAAa,YAAa,SAAQ,KAAK;IACrC,SAAkB,IAAI,kBAAkB;IACxC,QAAQ,CAAC,QAAQ,KAAmB;CACrC;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,GAAG,MAAM,CAGrF;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,IAAI,GAAG,IAAI,CAMpF;AAED,wBAAgB,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,CAG7C;AAED,wBAAgB,eAAe,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC,GAAG,CAAC,CAQ9D;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,QAAQ,EAAE,mBAAmB,GAAG,SAAS,CAAC;IACnD,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;CACtC;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,iBAAiB,CAQhE;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,GAAG,SAAS,CAS5F;AAgBD,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,mBAAmB,GAAG,SAAS,CAMjF;AAED,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,SAAS,EAAE,GAAG,SAAS,GAAG,SAAS,CAIzF;AAED,wBAAgB,cAAc,IAAI,mBAAmB,GAAG,SAAS,CAMhE;AAkBD,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAOjD"}
|
package/dist/outputLocation.js
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import { closeSync, constants, fstatSync, lstatSync, openSync, readlinkSync, realpathSync, statSync, unlinkSync } from "node:fs";
|
|
2
2
|
import { dirname, resolve, sep } from "node:path";
|
|
3
3
|
const USAGE_EXIT_CODE = 2;
|
|
4
|
-
/**
|
|
5
|
-
* A run refused on the usage code. Its one line is already on stderr when it is thrown; the command
|
|
6
|
-
* running it settles the status (`settlingRefusal`), so the process ends by draining what was written
|
|
7
|
-
* rather than being cut off mid-write.
|
|
8
|
-
*/
|
|
9
4
|
export class UsageRefusal extends Error {
|
|
10
5
|
name = "UsageRefusal";
|
|
11
6
|
exitCode = USAGE_EXIT_CODE;
|
|
@@ -14,10 +9,6 @@ export function unwritableRefusal(subject, path, err) {
|
|
|
14
9
|
const reason = err instanceof Error ? err.message : String(err);
|
|
15
10
|
return `${subject}: ${path} (${reason})`;
|
|
16
11
|
}
|
|
17
|
-
/**
|
|
18
|
-
* The catch sits on the one write it guards rather than on the process, so a refusal can only ever
|
|
19
|
-
* name a location this call was asked to write, and a crash anywhere else is not dressed up as one.
|
|
20
|
-
*/
|
|
21
12
|
export function writeOrRefuse(subject, path, write) {
|
|
22
13
|
try {
|
|
23
14
|
write();
|
|
@@ -26,15 +17,10 @@ export function writeOrRefuse(subject, path, write) {
|
|
|
26
17
|
refuse(unwritableRefusal(subject, path, err));
|
|
27
18
|
}
|
|
28
19
|
}
|
|
29
|
-
/** Refuses the run on the usage code with one line on stderr, then throws for the command to settle. */
|
|
30
20
|
export function refuse(message) {
|
|
31
21
|
process.stderr.write(message + "\n");
|
|
32
22
|
throw new UsageRefusal(message);
|
|
33
23
|
}
|
|
34
|
-
/**
|
|
35
|
-
* Runs a command and settles a usage refusal it throws: the status becomes the refusal's code and
|
|
36
|
-
* `refused` is answered. Anything else thrown is not a refusal, and propagates as it would have.
|
|
37
|
-
*/
|
|
38
24
|
export function settlingRefusal(run, refused) {
|
|
39
25
|
try {
|
|
40
26
|
return run();
|
|
@@ -46,19 +32,6 @@ export function settlingRefusal(run, refused) {
|
|
|
46
32
|
return refused;
|
|
47
33
|
}
|
|
48
34
|
}
|
|
49
|
-
/**
|
|
50
|
-
* Throws the operating system's own error when `path` cannot be written as a file, and otherwise
|
|
51
|
-
* answers which regular file it is. An existing file is opened write-only without truncation (not
|
|
52
|
-
* "r+", which would also demand read permission). An absent one is created and left in place for the
|
|
53
|
-
* caller to remove once every destination has been identified: two names for one absent file share
|
|
54
|
-
* an identity only once one of them exists. So a missing, read-only or non-directory parent answers
|
|
55
|
-
* with its real reason instead of one this module would have to invent.
|
|
56
|
-
*
|
|
57
|
-
* The creation is not exclusive, because the write-only open has already answered that nothing exists
|
|
58
|
-
* at the end of the path, and an exclusive create would refuse a link whose target does not exist yet
|
|
59
|
-
* although the write would follow it. What the caller removes is the real file created, never the
|
|
60
|
-
* link that led to it.
|
|
61
|
-
*/
|
|
62
35
|
export function probeDestination(path) {
|
|
63
36
|
try {
|
|
64
37
|
return { identity: identityOf(openSync(path, constants.O_WRONLY)), created: undefined };
|
|
@@ -70,11 +43,6 @@ export function probeDestination(path) {
|
|
|
70
43
|
const identity = identityOf(openSync(path, constants.O_WRONLY | constants.O_CREAT));
|
|
71
44
|
return { identity, created: realpathSync(path) };
|
|
72
45
|
}
|
|
73
|
-
/**
|
|
74
|
-
* The first of `others` that is the same regular file as `file`, or undefined when none is. Every
|
|
75
|
-
* file created to find out is removed again. A path that cannot be opened shares nothing here: the
|
|
76
|
-
* write that would use it refuses it on its own terms.
|
|
77
|
-
*/
|
|
78
46
|
export function firstSharingFile(file, others) {
|
|
79
47
|
const created = [];
|
|
80
48
|
try {
|
|
@@ -102,11 +70,6 @@ function identityOrNone(path, created) {
|
|
|
102
70
|
function sameIdentity(a, b) {
|
|
103
71
|
return a !== undefined && a.dev === b.dev && a.ino === b.ino;
|
|
104
72
|
}
|
|
105
|
-
/**
|
|
106
|
-
* The identity of the regular file a path a run reads leads to, through any links, or undefined when
|
|
107
|
-
* it leads to anything else or to nothing. The file is only looked at: an input is never opened for
|
|
108
|
-
* writing, and one that is not there cannot be overwritten.
|
|
109
|
-
*/
|
|
110
73
|
export function regularFileIdentity(path) {
|
|
111
74
|
try {
|
|
112
75
|
return regularIdentity(statSync(path, { bigint: true }));
|
|
@@ -115,14 +78,12 @@ export function regularFileIdentity(path) {
|
|
|
115
78
|
return undefined;
|
|
116
79
|
}
|
|
117
80
|
}
|
|
118
|
-
/** The first of `inputs` that is the regular file at `path`, or undefined when none is, or nothing is there. */
|
|
119
81
|
export function inputAt(path, inputs) {
|
|
120
82
|
const identity = regularFileIdentity(path);
|
|
121
83
|
if (identity === undefined)
|
|
122
84
|
return undefined;
|
|
123
85
|
return inputs.find((input) => sameIdentity(regularFileIdentity(input.path), identity));
|
|
124
86
|
}
|
|
125
|
-
/** The identity of the regular file standard output is, when it is one. */
|
|
126
87
|
export function stdoutIdentity() {
|
|
127
88
|
try {
|
|
128
89
|
return regularIdentity(fstatSync(1, { bigint: true }));
|
|
@@ -142,16 +103,8 @@ function identityOf(fd) {
|
|
|
142
103
|
function regularIdentity(stats) {
|
|
143
104
|
return stats.isFile() ? { dev: stats.dev, ino: stats.ino } : undefined;
|
|
144
105
|
}
|
|
145
|
-
/** The spellings of file descriptor 1 itself, on macOS and on Linux. */
|
|
146
106
|
const STDOUT_SPELLINGS = new Set(["/dev/stdout", "/dev/fd/1", "/proc/self/fd/1", "/proc/thread-self/fd/1", `/proc/${process.pid}/fd/1`]);
|
|
147
|
-
/** A bound on the links followed, as the kernel sets one, so a loop of links answers rather than spins. */
|
|
148
107
|
const MAX_LINKS_FOLLOWED = 40;
|
|
149
|
-
/**
|
|
150
|
-
* Whether `path` names standard output: spelled as file descriptor 1, or reaching such a spelling
|
|
151
|
-
* through links, followed one at a time as `realpath` would. Asking what the path spells rather than
|
|
152
|
-
* which file it opens is deliberate: when standard output and standard error share one terminal or
|
|
153
|
-
* one pipe, /dev/stderr opens the very same file, and it does not name standard output.
|
|
154
|
-
*/
|
|
155
108
|
export function namesStdout(path) {
|
|
156
109
|
let current = resolve(path);
|
|
157
110
|
for (let followed = 0; current !== undefined && followed <= MAX_LINKS_FOLLOWED; followed++) {
|
|
@@ -161,7 +114,6 @@ export function namesStdout(path) {
|
|
|
161
114
|
}
|
|
162
115
|
return false;
|
|
163
116
|
}
|
|
164
|
-
/** `path` with its first linked component replaced by the link's target, or undefined when none is a link. */
|
|
165
117
|
function withFirstLinkFollowed(path) {
|
|
166
118
|
const parts = path.split(sep).filter((part) => part !== "");
|
|
167
119
|
for (let length = 1; length <= parts.length; length++) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"outputLocation.js","sourceRoot":"","sources":["../src/outputLocation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACjI,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAElD,MAAM,eAAe,GAAG,CAAC,CAAC;AAE1B
|
|
1
|
+
{"version":3,"file":"outputLocation.js","sourceRoot":"","sources":["../src/outputLocation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAY,EAAE,Y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,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACtD,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC;QAClC,IAAI,MAAM,KAAK,SAAS;YAAE,OAAO,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;IAC5F,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,UAAU,CAAC,IAAY;IAC9B,IAAI,CAAC;QACH,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC3E,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC"}
|
|
@@ -1,76 +1,25 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The KEPT-RUN scaffold — the thin app-layer that turns a bare tool invocation into a
|
|
3
|
-
* STORED run (the run-management layer). A kept run is a consultancy / product-dev artefact (NOT CI):
|
|
4
|
-
* it makes a per-run directory under a caller-INJECTED store root and routes the tool's
|
|
5
|
-
* `--format` outputs into it. The tool holds no storage opinion (the `--format` surface); this
|
|
6
|
-
* scaffold adds only the directory + the routing.
|
|
7
|
-
*
|
|
8
|
-
* Split by the three-layer architecture:
|
|
9
|
-
* - PURE planner (`planKeptRun`): given `{ storeRoot, target, runId }`, yields the run
|
|
10
|
-
* dir `<storeRoot>/<target>/<runId>/` and the two file-dest paths — no IO, proven
|
|
11
|
-
* `@unit`.
|
|
12
|
-
* - IMPURE runner (`executeKeptRun`): `mkdir -p` the run dir, then route the tool's
|
|
13
|
-
* `--format` outputs into the two files by handing an injected tool-invoker the two
|
|
14
|
-
* file-dest `--format` specs. The ONLY IO, proven `@integration` (the real on-disk
|
|
15
|
-
* files under a temp root + the repo untouched — never a planner re-run).
|
|
16
|
-
*
|
|
17
|
-
* The store root is an INJECTED parameter — never hardcoded — so the scaffold is
|
|
18
|
-
* location-agnostic (proven against a temp root; the repo is never written).
|
|
19
|
-
*/
|
|
20
1
|
import { type ReadInput } from "../outputLocation.js";
|
|
21
|
-
/** The two artefact filenames a kept run routes the tool's outputs into. */
|
|
22
2
|
export declare const RECONCILIATION_DOCUMENT = "spec-reconciliation.md";
|
|
23
|
-
/**
|
|
24
|
-
* The machine artefact filename — renamed `ledger.json` →
|
|
25
|
-
* `spec-reconciliation.json` (parity with `spec-reconciliation.md`): it is the machine form
|
|
26
|
-
* of the WHOLE reconciliation document, not just the ledger.
|
|
27
|
-
*/
|
|
28
3
|
export declare const RECONCILIATION_JSON = "spec-reconciliation.json";
|
|
29
|
-
/** The manifest filename a kept run stamps in the run dir. */
|
|
30
4
|
export declare const RUN_MANIFEST = "run.yaml";
|
|
31
|
-
/**
|
|
32
|
-
* The run.yaml schema version this scaffold stamps. Bumped 1 → 2 when it added
|
|
33
|
-
* the tool identity (`tool_sha` / `tool_version`) — so a reader can tell a run that
|
|
34
|
-
* predates tool-identity recording (schema 1) from one that should carry it (schema 2).
|
|
35
|
-
* run.yaml is write-only (no production reader), so the bump breaks no read path.
|
|
36
|
-
*/
|
|
37
5
|
export declare const RUN_MANIFEST_SCHEMA_VERSION = 2;
|
|
38
|
-
/** The stored-run modes (run.yaml `mode`). */
|
|
39
6
|
export type RunMode = "balance" | "analyse" | "migrate";
|
|
40
|
-
/**
|
|
41
|
-
* The manifest-only metadata a kept run stamps that the path spec (`KeptRunSpec`) does not
|
|
42
|
-
* carry — the source SHA, the run mode, and the ISO date.
|
|
43
|
-
*/
|
|
44
7
|
export interface RunManifestMeta {
|
|
45
8
|
readonly sourceSha: string;
|
|
46
|
-
/**
|
|
47
|
-
* The TOOL's own git SHA — which spec-controller produced this run, distinct
|
|
48
|
-
* from the target's `sourceSha`. A string ("unknown" when the tool is not a git
|
|
49
|
-
* checkout), mirroring `sourceSha`'s own "unknown" fallback — so run.yaml is internally
|
|
50
|
-
* consistent (both facts use the same absent-marker, never a bare null).
|
|
51
|
-
*/
|
|
52
9
|
readonly toolSha: string;
|
|
53
|
-
/** The tool's package version — always present. */
|
|
54
10
|
readonly toolVersion: string;
|
|
55
11
|
readonly mode: RunMode;
|
|
56
12
|
readonly date: string;
|
|
57
13
|
}
|
|
58
|
-
/** The full manifest input: the path spec's run-id + target, plus the manifest-only meta. */
|
|
59
14
|
export interface RunManifestInput extends RunManifestMeta {
|
|
60
15
|
readonly runId: string;
|
|
61
16
|
readonly target: string;
|
|
62
17
|
}
|
|
63
|
-
/**
|
|
64
|
-
* The run.yaml manifest — the decided light field set. `purpose`/`links` default EMPTY (the ad-hoc default; slugs are
|
|
65
|
-
* added by operator hand-edit afterward). `category`/`use_case` are NOT stamped (`purpose`
|
|
66
|
-
* subsumes them). Keys are listed in the decided stamp order.
|
|
67
|
-
*/
|
|
68
18
|
export interface RunManifest {
|
|
69
19
|
readonly schema_version: number;
|
|
70
20
|
readonly run_id: string;
|
|
71
21
|
readonly target: string;
|
|
72
22
|
readonly source_sha: string;
|
|
73
|
-
/** The TOOL's identity — which spec-controller produced the run. */
|
|
74
23
|
readonly tool_sha: string;
|
|
75
24
|
readonly tool_version: string;
|
|
76
25
|
readonly mode: RunMode;
|
|
@@ -82,82 +31,26 @@ export interface RunManifest {
|
|
|
82
31
|
readonly reconciliation: string;
|
|
83
32
|
};
|
|
84
33
|
}
|
|
85
|
-
/** The kept-run inputs: the injected store root, the target, and the run-id. */
|
|
86
34
|
export interface KeptRunSpec {
|
|
87
35
|
readonly storeRoot: string;
|
|
88
36
|
readonly target: string;
|
|
89
37
|
readonly runId: string;
|
|
90
|
-
/** The file paths the command's own `--format` values name, which must not be a file the run writes. */
|
|
91
38
|
readonly formatPaths?: readonly string[];
|
|
92
|
-
/** The files the command reads, which the run's own run.yaml must not be. */
|
|
93
39
|
readonly inputs?: readonly ReadInput[];
|
|
94
40
|
}
|
|
95
|
-
/** The planned run: the run dir plus the two file-dest paths inside it. */
|
|
96
41
|
export interface KeptRunPlan {
|
|
97
42
|
readonly runDir: string;
|
|
98
43
|
readonly documentPath: string;
|
|
99
44
|
readonly reconciliationJsonPath: string;
|
|
100
45
|
}
|
|
101
|
-
/**
|
|
102
|
-
* Invokes the reconciliation tool with the given `--format <fmt>:<path>` specs, and answers
|
|
103
|
-
* whether it wrote the report those specs name. INJECTED so the scaffold stays the tool's
|
|
104
|
-
* black-box caller (the real CLI subprocess in the `@integration` arm) and holds no opinion on
|
|
105
|
-
* HOW the tool is run — only WHERE its outputs land (the two file-dest paths the runner hands it).
|
|
106
|
-
*
|
|
107
|
-
* The answer is the command's own, and positive: only the command knows it wrote its report. The
|
|
108
|
-
* files' existence afterwards cannot say so, because an earlier run under the same run-id may
|
|
109
|
-
* have left them there.
|
|
110
|
-
*/
|
|
111
46
|
export type RouteOutputs = (formatSpecs: readonly string[]) => boolean;
|
|
112
|
-
/**
|
|
113
|
-
* PURE planner: yield the run dir `<storeRoot>/<target>/<runId>/` and the two file-dest
|
|
114
|
-
* paths (`<dir>/spec-reconciliation.md`, `<dir>/spec-reconciliation.json`) from the spec. No
|
|
115
|
-
* IO — the store root is threaded straight through `join`, so it is a parameter, never
|
|
116
|
-
* hardcoded.
|
|
117
|
-
*/
|
|
118
47
|
export declare function planKeptRun(spec: KeptRunSpec): KeptRunPlan;
|
|
119
|
-
/**
|
|
120
|
-
* Options for the pure run-id resolver: the operator's OPTIONAL `--run-id` mnemonic
|
|
121
|
-
* and the INJECTED clock instant the default timestamp derives from.
|
|
122
|
-
*/
|
|
123
48
|
export interface ResolveRunIdOptions {
|
|
124
|
-
/** The operator's `--run-id` mnemonic when supplied; overrides the timestamp default, verbatim. */
|
|
125
49
|
readonly runId?: string;
|
|
126
|
-
/**
|
|
127
|
-
* The injected instant the default ISO-timestamp run-id derives from — the deterministic-@unit
|
|
128
|
-
* seam. Never a bare `new Date()` inside the resolver, so the default run-id is pin-testable.
|
|
129
|
-
*/
|
|
130
50
|
readonly now: Date;
|
|
131
51
|
}
|
|
132
|
-
/**
|
|
133
|
-
* PURE run-id resolver — the CLI/edge seam that turns an OPTIONAL `--run-id` into the concrete
|
|
134
|
-
* run-id naming the run dir (feeds `KeptRunSpec.runId`). No `--run-id` → an ISO-8601 UTC
|
|
135
|
-
* timestamp derived from the INJECTED `now` (filesystem-safe: no colons, no millis — matching
|
|
136
|
-
* the existing store run dir); `--run-id <mnemonic>` → that mnemonic verbatim (`acme-q3`, `e1`
|
|
137
|
-
* — an earlier precedent), which ignores the clock. No IO — proven `@unit`.
|
|
138
|
-
* The clock is injected (never a bare `new Date()`) so the default timestamp is deterministic
|
|
139
|
-
* under test (the discipline the old `formatRunTimestamp` used). Just default-vs-override — no
|
|
140
|
-
* sanitisation / collision policy (deferred).
|
|
141
|
-
*/
|
|
142
52
|
export declare function resolveRunId(options: ResolveRunIdOptions): string;
|
|
143
|
-
/**
|
|
144
|
-
* PURE: build the run.yaml manifest object from the run metadata. `purpose` and
|
|
145
|
-
* `links` are stamped EMPTY (the ad-hoc default; slugs are added by operator hand-edit of
|
|
146
|
-
* run.yaml afterward — the documented curation convention); `artefacts` carry the decided
|
|
147
|
-
* filenames. No IO — proven `@unit`.
|
|
148
|
-
*/
|
|
149
53
|
export declare function planRunManifest(input: RunManifestInput): RunManifest;
|
|
150
|
-
/** PURE: serialise the manifest to YAML text the impure runner writes verbatim. */
|
|
151
54
|
export declare function serialiseRunManifest(manifest: RunManifest): string;
|
|
152
|
-
/**
|
|
153
|
-
* IMPURE runner: `mkdir -p` the run dir, route the tool's `--format` outputs into the two files
|
|
154
|
-
* via the injected `route` — the document as `md:<documentPath>`, the reconciliation JSON as
|
|
155
|
-
* `json:<reconciliationJsonPath>` — and, only when the route answers that it wrote them, stamp
|
|
156
|
-
* `run.yaml` from the spec + `meta` and return the plan it realised. A route that wrote nothing
|
|
157
|
-
* gets no manifest and no plan back, so nothing names a run that did not happen, and an earlier
|
|
158
|
-
* run's manifest under the same run-id is left as it was. The `mkdir` is load-bearing: the tool's
|
|
159
|
-
* writer creates no directories, so the scaffold creates the one the location-agnostic tool
|
|
160
|
-
* writes into.
|
|
161
|
-
*/
|
|
162
55
|
export declare function executeKeptRun(spec: KeptRunSpec, meta: RunManifestMeta, route: RouteOutputs): KeptRunPlan | undefined;
|
|
163
56
|
//# sourceMappingURL=keptRun.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keptRun.d.ts","sourceRoot":"","sources":["../../src/run-management/keptRun.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"keptRun.d.ts","sourceRoot":"","sources":["../../src/run-management/keptRun.ts"],"names":[],"mappings":"AAGA,OAAO,EAAoD,KAAK,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAExG,eAAO,MAAM,uBAAuB,2BAA2B,CAAC;AAChE,eAAO,MAAM,mBAAmB,6BAA6B,CAAC;AAE9D,eAAO,MAAM,YAAY,aAAa,CAAC;AAEvC,eAAO,MAAM,2BAA2B,IAAI,CAAC;AAE7C,MAAM,MAAM,OAAO,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CAAC;AAExD,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,gBAAiB,SAAQ,eAAe;IACvD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EA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AO,EAAE,mBAAmB,GAAG,MAAM,CAKjE;AAMD,wBAAgB,eAAe,CAAC,KAAK,EAAE,gBAAgB,GAAG,WAAW,CAiBpE;AAED,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,WAAW,GAAG,MAAM,CAElE;AAED,wBAAgB,cAAc,CAC5B,IAAI,EAAE,WAAW,EACjB,IAAI,EAAE,eAAe,EACrB,KAAK,EAAE,YAAY,GAClB,WAAW,GAAG,SAAS,CA0BzB"}
|
|
@@ -1,49 +1,11 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The KEPT-RUN scaffold — the thin app-layer that turns a bare tool invocation into a
|
|
3
|
-
* STORED run (the run-management layer). A kept run is a consultancy / product-dev artefact (NOT CI):
|
|
4
|
-
* it makes a per-run directory under a caller-INJECTED store root and routes the tool's
|
|
5
|
-
* `--format` outputs into it. The tool holds no storage opinion (the `--format` surface); this
|
|
6
|
-
* scaffold adds only the directory + the routing.
|
|
7
|
-
*
|
|
8
|
-
* Split by the three-layer architecture:
|
|
9
|
-
* - PURE planner (`planKeptRun`): given `{ storeRoot, target, runId }`, yields the run
|
|
10
|
-
* dir `<storeRoot>/<target>/<runId>/` and the two file-dest paths — no IO, proven
|
|
11
|
-
* `@unit`.
|
|
12
|
-
* - IMPURE runner (`executeKeptRun`): `mkdir -p` the run dir, then route the tool's
|
|
13
|
-
* `--format` outputs into the two files by handing an injected tool-invoker the two
|
|
14
|
-
* file-dest `--format` specs. The ONLY IO, proven `@integration` (the real on-disk
|
|
15
|
-
* files under a temp root + the repo untouched — never a planner re-run).
|
|
16
|
-
*
|
|
17
|
-
* The store root is an INJECTED parameter — never hardcoded — so the scaffold is
|
|
18
|
-
* location-agnostic (proven against a temp root; the repo is never written).
|
|
19
|
-
*/
|
|
20
1
|
import { mkdirSync, writeFileSync } from "node:fs";
|
|
21
2
|
import { join } from "node:path";
|
|
22
3
|
import { stringify } from "yaml";
|
|
23
4
|
import { firstSharingFile, inputAt, refuse, writeOrRefuse } from "../outputLocation.js";
|
|
24
|
-
/** The two artefact filenames a kept run routes the tool's outputs into. */
|
|
25
5
|
export const RECONCILIATION_DOCUMENT = "spec-reconciliation.md";
|
|
26
|
-
/**
|
|
27
|
-
* The machine artefact filename — renamed `ledger.json` →
|
|
28
|
-
* `spec-reconciliation.json` (parity with `spec-reconciliation.md`): it is the machine form
|
|
29
|
-
* of the WHOLE reconciliation document, not just the ledger.
|
|
30
|
-
*/
|
|
31
6
|
export const RECONCILIATION_JSON = "spec-reconciliation.json";
|
|
32
|
-
/** The manifest filename a kept run stamps in the run dir. */
|
|
33
7
|
export const RUN_MANIFEST = "run.yaml";
|
|
34
|
-
/**
|
|
35
|
-
* The run.yaml schema version this scaffold stamps. Bumped 1 → 2 when it added
|
|
36
|
-
* the tool identity (`tool_sha` / `tool_version`) — so a reader can tell a run that
|
|
37
|
-
* predates tool-identity recording (schema 1) from one that should carry it (schema 2).
|
|
38
|
-
* run.yaml is write-only (no production reader), so the bump breaks no read path.
|
|
39
|
-
*/
|
|
40
8
|
export const RUN_MANIFEST_SCHEMA_VERSION = 2;
|
|
41
|
-
/**
|
|
42
|
-
* PURE planner: yield the run dir `<storeRoot>/<target>/<runId>/` and the two file-dest
|
|
43
|
-
* paths (`<dir>/spec-reconciliation.md`, `<dir>/spec-reconciliation.json`) from the spec. No
|
|
44
|
-
* IO — the store root is threaded straight through `join`, so it is a parameter, never
|
|
45
|
-
* hardcoded.
|
|
46
|
-
*/
|
|
47
9
|
export function planKeptRun(spec) {
|
|
48
10
|
const runDir = join(spec.storeRoot, spec.target, spec.runId);
|
|
49
11
|
return {
|
|
@@ -52,39 +14,15 @@ export function planKeptRun(spec) {
|
|
|
52
14
|
reconciliationJsonPath: join(runDir, RECONCILIATION_JSON),
|
|
53
15
|
};
|
|
54
16
|
}
|
|
55
|
-
/**
|
|
56
|
-
* PURE run-id resolver — the CLI/edge seam that turns an OPTIONAL `--run-id` into the concrete
|
|
57
|
-
* run-id naming the run dir (feeds `KeptRunSpec.runId`). No `--run-id` → an ISO-8601 UTC
|
|
58
|
-
* timestamp derived from the INJECTED `now` (filesystem-safe: no colons, no millis — matching
|
|
59
|
-
* the existing store run dir); `--run-id <mnemonic>` → that mnemonic verbatim (`acme-q3`, `e1`
|
|
60
|
-
* — an earlier precedent), which ignores the clock. No IO — proven `@unit`.
|
|
61
|
-
* The clock is injected (never a bare `new Date()`) so the default timestamp is deterministic
|
|
62
|
-
* under test (the discipline the old `formatRunTimestamp` used). Just default-vs-override — no
|
|
63
|
-
* sanitisation / collision policy (deferred).
|
|
64
|
-
*/
|
|
65
17
|
export function resolveRunId(options) {
|
|
66
|
-
// The operator mnemonic, when given, names the run dir verbatim — the clock is ignored.
|
|
67
18
|
if (options.runId !== undefined) {
|
|
68
19
|
return options.runId;
|
|
69
20
|
}
|
|
70
|
-
// Otherwise the run-id defaults to the injected instant as a filesystem-safe timestamp.
|
|
71
21
|
return formatRunTimestamp(options.now);
|
|
72
22
|
}
|
|
73
|
-
/**
|
|
74
|
-
* Format an injected instant as a filesystem-safe ISO-8601 UTC timestamp: `toISOString()`
|
|
75
|
-
* yields `2026-06-30T10:04:01.123Z`; drop the milliseconds, then swap the time-separator
|
|
76
|
-
* colons for hyphens so the string is a safe directory name (`2026-06-30T10-04-01Z` — the
|
|
77
|
-
* form the existing store run dir uses).
|
|
78
|
-
*/
|
|
79
23
|
function formatRunTimestamp(instant) {
|
|
80
24
|
return instant.toISOString().replace(/\.\d+Z$/, "Z").replace(/:/g, "-");
|
|
81
25
|
}
|
|
82
|
-
/**
|
|
83
|
-
* PURE: build the run.yaml manifest object from the run metadata. `purpose` and
|
|
84
|
-
* `links` are stamped EMPTY (the ad-hoc default; slugs are added by operator hand-edit of
|
|
85
|
-
* run.yaml afterward — the documented curation convention); `artefacts` carry the decided
|
|
86
|
-
* filenames. No IO — proven `@unit`.
|
|
87
|
-
*/
|
|
88
26
|
export function planRunManifest(input) {
|
|
89
27
|
return {
|
|
90
28
|
schema_version: RUN_MANIFEST_SCHEMA_VERSION,
|
|
@@ -95,8 +33,6 @@ export function planRunManifest(input) {
|
|
|
95
33
|
tool_version: input.toolVersion,
|
|
96
34
|
mode: input.mode,
|
|
97
35
|
date: input.date,
|
|
98
|
-
// EMPTY defaults — the ad-hoc run; slugs/links are added by operator hand-edit of
|
|
99
|
-
// run.yaml afterward (no --purpose flag, no vocab enforcement — both deferred).
|
|
100
36
|
purpose: [],
|
|
101
37
|
links: [],
|
|
102
38
|
artefacts: {
|
|
@@ -105,20 +41,9 @@ export function planRunManifest(input) {
|
|
|
105
41
|
},
|
|
106
42
|
};
|
|
107
43
|
}
|
|
108
|
-
/** PURE: serialise the manifest to YAML text the impure runner writes verbatim. */
|
|
109
44
|
export function serialiseRunManifest(manifest) {
|
|
110
45
|
return stringify(manifest);
|
|
111
46
|
}
|
|
112
|
-
/**
|
|
113
|
-
* IMPURE runner: `mkdir -p` the run dir, route the tool's `--format` outputs into the two files
|
|
114
|
-
* via the injected `route` — the document as `md:<documentPath>`, the reconciliation JSON as
|
|
115
|
-
* `json:<reconciliationJsonPath>` — and, only when the route answers that it wrote them, stamp
|
|
116
|
-
* `run.yaml` from the spec + `meta` and return the plan it realised. A route that wrote nothing
|
|
117
|
-
* gets no manifest and no plan back, so nothing names a run that did not happen, and an earlier
|
|
118
|
-
* run's manifest under the same run-id is left as it was. The `mkdir` is load-bearing: the tool's
|
|
119
|
-
* writer creates no directories, so the scaffold creates the one the location-agnostic tool
|
|
120
|
-
* writes into.
|
|
121
|
-
*/
|
|
122
47
|
export function executeKeptRun(spec, meta, route) {
|
|
123
48
|
const plan = planKeptRun(spec);
|
|
124
49
|
writeOrRefuse("The stored run's directory could not be created", plan.runDir, () => mkdirSync(plan.runDir, { recursive: true }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keptRun.js","sourceRoot":"","sources":["../../src/run-management/keptRun.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"keptRun.js","sourceRoot":"","sources":["../../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,YAAY,KAAK,SAAS,EAAE,CAAC;QAC/B,MAAM,CACJ,2CAA2C,YAAY,KAAK,YAAY,CAAC,IAAI,OAAO,YAAY,CAAC,OAAO,IAAI;YAC1G,wDAAwD,CAC3D,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,IAAI,CAAC,YAAY,EAAE,EAAE,QAAQ,IAAI,CAAC,sBAAsB,EAAE,CAAC,CAAC;QAAE,OAAO,SAAS,CAAC;IACjG,MAAM,QAAQ,GAAG,eAAe,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC;IACtF,aAAa,CAAC,gDAAgD,EAAE,YAAY,EAAE,GAAG,EAAE,CACjF,aAAa,CAAC,YAAY,EAAE,oBAAoB,CAAC,QAAQ,CAAC,CAAC,CAC5D,CAAC;IACF,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -1,82 +1,15 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Resolve a run's git-derived inputs — the target's source SHA and repo root. The
|
|
3
|
-
* IMPURE half of the old run/runContext.ts: both shell out to `git` over the
|
|
4
|
-
* target tree, so they live in the app's run-management layer, apart from the pure
|
|
5
|
-
* provenance projection (packages/core/src/provenance/provenance.ts) they feed. The
|
|
6
|
-
* CLI (cli-balance/cli.ts) calls these once to build the RunContext.
|
|
7
|
-
*
|
|
8
|
-
* Scenarios: @SCN-RPT-001 (the run-provenance slice); the --source-sha override;
|
|
9
|
-
* @SCN-RPT-016 (target-root derivation); @SCN-RPT-026 / @SCN-RPT-029 (the tool's own identity).
|
|
10
|
-
*/
|
|
11
|
-
/**
|
|
12
|
-
* Resolve the target's source SHA (project design §4). An explicit non-empty
|
|
13
|
-
* `sourceSha` wins — the override for non-git / zip / detached-HEAD targets (the
|
|
14
|
-
* --source-sha flag). Otherwise `git -C <targetDir> rev-parse HEAD` (trimmed) as a
|
|
15
|
-
* READ-ONLY pure read. On any throw —
|
|
16
|
-
* a non-git target, git absent, an empty answer — resolve to `null` ("unknown")
|
|
17
|
-
* rather than crashing. `targetDir` = dirname(--features) when given, else cwd.
|
|
18
|
-
*/
|
|
19
1
|
export declare function resolveSourceSha(opts: {
|
|
20
2
|
sourceSha?: string;
|
|
21
3
|
targetDir?: string;
|
|
22
4
|
}): string | null;
|
|
23
|
-
/** The tool's own identity — which spec-controller produced a run (3F-1916). */
|
|
24
5
|
export interface ToolIdentity {
|
|
25
|
-
/** The tool's own git HEAD, or null when the tool is not a git checkout (an installed package). */
|
|
26
6
|
toolSha: string | null;
|
|
27
|
-
/** The tool's package version — always present (read from the tool's own package.json). */
|
|
28
7
|
toolVersion: string;
|
|
29
8
|
}
|
|
30
|
-
/**
|
|
31
|
-
* Resolve the TOOL's own identity (3F-1916) — which spec-controller produced this run,
|
|
32
|
-
* distinct from the TARGET's `sourceSha`. Two facts, one call, threaded to both the
|
|
33
|
-
* report provenance (RunContext) and the run.yaml manifest.
|
|
34
|
-
*
|
|
35
|
-
* **TWO TRAPS, AND THIS DOCBLOCK ONLY NAMED THE FIRST FOR ELEVEN WEEKS** (@SCN-RPT-029,
|
|
36
|
-
* 3F-3418). Nothing typechecks a comment, and the sentence below — true, and the whole of
|
|
37
|
-
* what was written here — is what made the second trap read as already-handled.
|
|
38
|
-
*
|
|
39
|
-
* **Trap one, cwd:** at run time the process cwd is the TARGET repo (reconcile runs
|
|
40
|
-
* there), so a bare `git rev-parse HEAD` would re-record the TARGET's SHA. So the SHA is
|
|
41
|
-
* read `git -C <the tool's OWN dir>`, derived from `import.meta.url`, never cwd (3F-1916).
|
|
42
|
-
*
|
|
43
|
-
* **Trap two, which the `-C` guard could not see:** the tool's own dir is ITSELF inside the
|
|
44
|
-
* target. For an installed package that dir is `<consumer>/node_modules/…`, which is inside
|
|
45
|
-
* the consumer's worktree, so `git -C` walks up to the consumer's `.git` and answers with
|
|
46
|
-
* the consumer's HEAD — being `.gitignore`d makes no difference, git does not stop at
|
|
47
|
-
* ignored directories. That is not an absent tool SHA, it is a WRONG one, and nothing on
|
|
48
|
-
* the rendered report distinguishes it from a genuine one. It is also the only case a
|
|
49
|
-
* consumer ever sees: every adopter installs into a git repository. `resolveToolSha`
|
|
50
|
-
* therefore answers a `node_modules` SEGMENT before it asks git at all.
|
|
51
|
-
*
|
|
52
|
-
* `toolSha` is `null` for a tool resolved out of `node_modules`, and otherwise
|
|
53
|
-
* `git -C <toolDir> rev-parse HEAD` (trimmed) or `null` on any throw — no `.git` above the
|
|
54
|
-
* tool, git absent, or an empty answer — mirroring `resolveSourceSha`'s fail-soft.
|
|
55
|
-
* `toolVersion` is read from the tool's own `package.json` (walked up from `toolDir`), or
|
|
56
|
-
* `"unknown"` when none is found — so a run stays attributable by version even when no SHA
|
|
57
|
-
* can be read. `toolDir` / `packageJsonPath` are injectable for the `@unit` teeth
|
|
58
|
-
* (@SCN-RPT-026, @SCN-RPT-029).
|
|
59
|
-
*/
|
|
60
9
|
export declare function resolveToolIdentity(opts?: {
|
|
61
10
|
toolDir?: string;
|
|
62
11
|
packageJsonPath?: string;
|
|
63
12
|
}): ToolIdentity;
|
|
64
|
-
/**
|
|
65
|
-
* Resolve the TARGET repo root — the root the recorded input paths (`presentInputs`)
|
|
66
|
-
* and the evidence-observation locators (`countRuntimeEvidenceObservationKinds`) are both made
|
|
67
|
-
* portable against (@SCN-RPT-016). The bug it fixes: the prior CLI relativized
|
|
68
|
-
* against `process.cwd()` — the TOOL's own repo — so a cross-repo reconcile
|
|
69
|
-
* (cwd ≠ target) kept the target's absolute paths (they aren't under cwd → the
|
|
70
|
-
* "absolute-not-under-root" branch of `relativizeToRoot` → leaked verbatim).
|
|
71
|
-
*
|
|
72
|
-
* The rule (mirrors `resolveSourceSha`'s targetDir derivation): the root is derived from
|
|
73
|
-
* the TARGET, never the run cwd — the git top-level of `dirname(--features)` when the
|
|
74
|
-
* target is a git repo (the robust case: `--features` may sit in a nested dir), else
|
|
75
|
-
* `dirname(--features)` itself (a non-git target — a zip / extracted tree), else
|
|
76
|
-
* `process.cwd()` for a self-reconcile with no `--features` (the legacy cwd = target
|
|
77
|
-
* assumption, preserved as the fallback). A READ-ONLY `git -C … rev-parse --show-toplevel`
|
|
78
|
-
* (read-only-target-safe); any throw falls back to `dirname(--features)`.
|
|
79
|
-
*/
|
|
80
13
|
export declare function resolveTargetRoot(opts: {
|
|
81
14
|
features?: string;
|
|
82
15
|
}): string;
|