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":"cli.d.ts","sourceRoot":"","sources":["../../src/cli-allocate/cli.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/cli-allocate/cli.ts"],"names":[],"mappings":"AAWA,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CAMhD"}
|
package/dist/cli-allocate/cli.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `spec-controller allocate <FFF>` — the next scenario code for a feature part, alone on stdout.
|
|
3
|
-
*/
|
|
4
1
|
import { join } from "node:path";
|
|
5
2
|
import { nextScnCode } from "@3f-consulting/spec-controller-core";
|
|
6
3
|
import { cliRegistry, renderCommandHelp } from "../cli-registry.js";
|
|
@@ -35,7 +32,6 @@ function answerOrRefuse(request) {
|
|
|
35
32
|
refuseUsage(refusalLine(err));
|
|
36
33
|
}
|
|
37
34
|
}
|
|
38
|
-
/** A usage refusal: its line on stderr, and the usage status once everything written has drained. */
|
|
39
35
|
function refuseUsage(line) {
|
|
40
36
|
process.stderr.write(line + "\n");
|
|
41
37
|
process.exitCode = 2;
|
|
@@ -58,7 +54,6 @@ function writeLineIfAny(line) {
|
|
|
58
54
|
if (line !== null)
|
|
59
55
|
process.stderr.write(line + "\n");
|
|
60
56
|
}
|
|
61
|
-
/** The tree and its history through git, or the tree alone by a walk where there is no repository. */
|
|
62
57
|
function sightingsFrom(cwd, part, top) {
|
|
63
58
|
return top !== null ? [...readTree(top, part), ...readHistory(cwd, part)] : walkTree(cwd, part);
|
|
64
59
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/cli-allocate/cli.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/cli-allocate/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,WAAW,EAAoB,M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AAC,CAAC;AAC3C,CAAC;AAED,SAAS,cAAc,CAAC,IAAmB;IACzC,IAAI,IAAI,KAAK,IAAI;QAAE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC;AACvD,CAAC;AAED,SAAS,aAAa,CAAC,GAAW,EAAE,IAAY,EAAE,GAAkB;IAClE,OAAO,GAAG,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,GAAG,WAAW,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;AAClG,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { ScnSighting } from "@3f-consulting/spec-controller-core";
|
|
2
|
-
/** How much history the read could see: all of it, none (no repository), or back to a shallow clone's edge. */
|
|
3
2
|
export type HistoryBoundary = {
|
|
4
3
|
kind: "complete";
|
|
5
4
|
} | {
|
|
@@ -8,21 +7,9 @@ export type HistoryBoundary = {
|
|
|
8
7
|
kind: "shallow";
|
|
9
8
|
before: string;
|
|
10
9
|
};
|
|
11
|
-
/**
|
|
12
|
-
* The added and removed lines of every reachable commit whose patch touched `SCN-<part>-`; a refusal
|
|
13
|
-
* when the refs it starts from, or the history git walks from them, cannot be read.
|
|
14
|
-
*/
|
|
15
10
|
export declare function readHistory(cwd: string, part: string): ScnSighting[];
|
|
16
|
-
/**
|
|
17
|
-
* The top of the repository `cwd` stands in, or null outside one. A `.git` at or above `cwd` that git
|
|
18
|
-
* will not open is a repository allocate cannot read, refused naming it, never read as no repository:
|
|
19
|
-
* that would state "no history was read" about a directory whose history exists. No git to ask at all
|
|
20
|
-
* is still no repository, a boundary said beside the answer.
|
|
21
|
-
*/
|
|
22
11
|
export declare function repositoryTop(cwd: string): string | null;
|
|
23
|
-
/** Whether `cwd` stands in a git repository. */
|
|
24
12
|
export declare function isGitRepository(cwd: string): boolean;
|
|
25
13
|
export declare function historyBoundaryOf(cwd: string): HistoryBoundary;
|
|
26
|
-
/** The added and removed lines of `git log -p` output, each with where it stands. */
|
|
27
14
|
export declare function diffLineSightings(logOutput: string): ScnSighting[];
|
|
28
15
|
//# sourceMappingURL=readHistory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readHistory.d.ts","sourceRoot":"","sources":["../../src/cli-allocate/readHistory.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"readHistory.d.ts","sourceRoot":"","sources":["../../src/cli-allocate/readHistory.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAIvE,MAAM,MAAM,eAAe,GAAG;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,kBAAkB,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAMxH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,WAAW,EAAE,CAapE;AAOD,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAOxD;AAUD,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,eAAe,CAI9D;AAuBD,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,WAAW,EAAE,CAQlE"}
|
|
@@ -1,29 +1,10 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The history half of the allocator's read: the added and removed lines of every reachable commit
|
|
3
|
-
* that touched the part, so a code that was deleted is still counted and never reissued.
|
|
4
|
-
*
|
|
5
|
-
* Only diff lines count, never commit messages. History is read so that a deleted scenario's number
|
|
6
|
-
* is not reissued; a code that only ever appeared in a message was never a scenario, and a message
|
|
7
|
-
* cannot be unwritten, so one stray mention would move the answer for good. The format asks git for
|
|
8
|
-
* each commit's abbreviated hash and nothing else, so a sighting can name the commit that carried it.
|
|
9
|
-
*
|
|
10
|
-
* Git is handed the part's prefix alone, which holds no regex syntax. Which words on a line are
|
|
11
|
-
* scenario codes is core's question, answered with the shared grammar, because git's regex dialect
|
|
12
|
-
* has no `\d` and matches nothing when given one, silently.
|
|
13
|
-
*/
|
|
14
1
|
import { spawnSync } from "node:child_process";
|
|
15
2
|
import { lstatSync, readFileSync } from "node:fs";
|
|
16
3
|
import { dirname, join } from "node:path";
|
|
17
4
|
import { proveRefsReadable } from "./refStore.js";
|
|
18
5
|
import { readOrRefuse, refuse, UnreadableInput } from "./unreadable.js";
|
|
19
|
-
/** A long history's patches can be large; the default buffer would truncate them. */
|
|
20
6
|
const MAX_OUTPUT_BYTES = 1024 * 1024 * 1024;
|
|
21
|
-
/** The marker the format puts before each commit's hash, a byte no patch line starts with. */
|
|
22
7
|
const COMMIT_MARKER = "\u0001";
|
|
23
|
-
/**
|
|
24
|
-
* The added and removed lines of every reachable commit whose patch touched `SCN-<part>-`; a refusal
|
|
25
|
-
* when the refs it starts from, or the history git walks from them, cannot be read.
|
|
26
|
-
*/
|
|
27
8
|
export function readHistory(cwd, part) {
|
|
28
9
|
proveRefsReadable(cwd);
|
|
29
10
|
const result = spawnSync("git", ["log", "--all", "-p", "-U0", "--no-color", "--no-ext-diff", "--format=%x01%h", "-G", `SCN-${part}-`], { cwd, encoding: "utf8", maxBuffer: MAX_OUTPUT_BYTES });
|
|
@@ -35,17 +16,10 @@ export function readHistory(cwd, part) {
|
|
|
35
16
|
}
|
|
36
17
|
return diffLineSightings(result.stdout);
|
|
37
18
|
}
|
|
38
|
-
/** Git's answer in `cwd`, trimmed, or null when git refuses (outside a repository, or no git at all). */
|
|
39
19
|
function gitAnswer(cwd, args) {
|
|
40
20
|
const result = spawnSync("git", args, { cwd, encoding: "utf8" });
|
|
41
21
|
return result.status === 0 ? result.stdout.trim() : null;
|
|
42
22
|
}
|
|
43
|
-
/**
|
|
44
|
-
* The top of the repository `cwd` stands in, or null outside one. A `.git` at or above `cwd` that git
|
|
45
|
-
* will not open is a repository allocate cannot read, refused naming it, never read as no repository:
|
|
46
|
-
* that would state "no history was read" about a directory whose history exists. No git to ask at all
|
|
47
|
-
* is still no repository, a boundary said beside the answer.
|
|
48
|
-
*/
|
|
49
23
|
export function repositoryTop(cwd) {
|
|
50
24
|
const result = spawnSync("git", ["rev-parse", "--show-toplevel"], { cwd, encoding: "utf8" });
|
|
51
25
|
if (result.status === 0)
|
|
@@ -56,7 +30,6 @@ export function repositoryTop(cwd) {
|
|
|
56
30
|
const said = result.stderr.split("\n")[0] ?? "";
|
|
57
31
|
throw new UnreadableInput("the repository", gitEntry, `git rev-parse exited ${result.status}: ${said}`);
|
|
58
32
|
}
|
|
59
|
-
/** The `.git` git's own discovery would find from `dir`: the nearest at or above it, of any kind; else null. */
|
|
60
33
|
function gitEntryAtOrAbove(dir) {
|
|
61
34
|
for (let at = dir;; at = dirname(at)) {
|
|
62
35
|
const entry = join(at, ".git");
|
|
@@ -66,7 +39,6 @@ function gitEntryAtOrAbove(dir) {
|
|
|
66
39
|
return null;
|
|
67
40
|
}
|
|
68
41
|
}
|
|
69
|
-
/** Whether `cwd` stands in a git repository. */
|
|
70
42
|
export function isGitRepository(cwd) {
|
|
71
43
|
return gitAnswer(cwd, ["rev-parse", "--git-dir"]) !== null;
|
|
72
44
|
}
|
|
@@ -87,7 +59,6 @@ function shallowRecordPath(cwd) {
|
|
|
87
59
|
const shallowFile = gitAnswer(cwd, ["rev-parse", "--git-path", "shallow"]) ?? "";
|
|
88
60
|
return shallowFile.startsWith("/") ? shallowFile : `${cwd}/${shallowFile}`;
|
|
89
61
|
}
|
|
90
|
-
/** The added and removed lines of `git log -p` output, each with where it stands. */
|
|
91
62
|
export function diffLineSightings(logOutput) {
|
|
92
63
|
const at = { inFileHeader: false, oldPath: "", newPath: "", oldLine: 0, newLine: 0 };
|
|
93
64
|
const sightings = [];
|
|
@@ -98,7 +69,6 @@ export function diffLineSightings(logOutput) {
|
|
|
98
69
|
}
|
|
99
70
|
return sightings;
|
|
100
71
|
}
|
|
101
|
-
/** Move the position past one line of output, and return the sighting it is, if it is one. */
|
|
102
72
|
function readLine(line, at) {
|
|
103
73
|
if (line.startsWith(COMMIT_MARKER))
|
|
104
74
|
at.commit = line.slice(COMMIT_MARKER.length);
|
|
@@ -114,7 +84,6 @@ function readLine(line, at) {
|
|
|
114
84
|
readHunkHeader(line, at);
|
|
115
85
|
return undefined;
|
|
116
86
|
}
|
|
117
|
-
/** A file header's lines: `---`/`+++` name the two sides, and the first hunk ends the header. */
|
|
118
87
|
function readFileHeader(line, at) {
|
|
119
88
|
if (line.startsWith("--- "))
|
|
120
89
|
at.oldPath = pathOf(line);
|
|
@@ -125,11 +94,9 @@ function readFileHeader(line, at) {
|
|
|
125
94
|
readHunkHeader(line, at);
|
|
126
95
|
}
|
|
127
96
|
}
|
|
128
|
-
/** The path a `---`/`+++` header names, without git's `a/`/`b/` prefix. */
|
|
129
97
|
function pathOf(header) {
|
|
130
98
|
return header.slice(4).replace(/^[ab]\//, "");
|
|
131
99
|
}
|
|
132
|
-
/** A hunk header, `@@ -<old>[,n] +<new>[,n] @@`, gives each side's first line. */
|
|
133
100
|
function readHunkHeader(line, at) {
|
|
134
101
|
const match = /^@@ -(\d+)(?:,\d+)? \+(\d+)/.exec(line);
|
|
135
102
|
at.oldLine = Number(match?.[1] ?? 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readHistory.js","sourceRoot":"","sources":["../../src/cli-allocate/readHistory.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"readHistory.js","sourceRoot":"","sources":["../../src/cli-allocate/readHistory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAA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AAC,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AACpF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readParts.d.ts","sourceRoot":"","sources":["../../src/cli-allocate/readParts.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"readParts.d.ts","sourceRoot":"","sources":["../../src/cli-allocate/readParts.ts"],"names":[],"mappings":"AAKA,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE,CAM7D"}
|
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The parts the corpus carries: the header codes of its feature files, read where `balance` reads its
|
|
3
|
-
* corpus by default. A part only history or a test fixture carries is not one of them.
|
|
4
|
-
*/
|
|
5
1
|
import { readdirSync, readFileSync } from "node:fs";
|
|
6
2
|
import { join } from "node:path";
|
|
7
3
|
import { extractFeatureCode } from "../ingest/ingestScenarios.js";
|
|
8
4
|
import { readOrRefuse, refuse } from "./unreadable.js";
|
|
9
|
-
/** The header codes of the feature files in `featuresDir`; none when there is no such directory. */
|
|
10
5
|
export function readHeaderCodes(featuresDir) {
|
|
11
6
|
return featureFilesIn(featuresDir).flatMap((name) => {
|
|
12
7
|
const path = join(featuresDir, name);
|
|
@@ -14,7 +9,6 @@ export function readHeaderCodes(featuresDir) {
|
|
|
14
9
|
return code === null ? [] : [code];
|
|
15
10
|
});
|
|
16
11
|
}
|
|
17
|
-
/** The feature files `dir` lists; none when it is not there, and a refusal when it cannot be listed. */
|
|
18
12
|
function featureFilesIn(dir) {
|
|
19
13
|
try {
|
|
20
14
|
return readdirSync(dir).filter((name) => name.endsWith(".feature"));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readParts.js","sourceRoot":"","sources":["../../src/cli-allocate/readParts.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"readParts.js","sourceRoot":"","sources":["../../src/cli-allocate/readParts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEvD,MAAM,UAAU,eAAe,CAAC,WAAmB;IACjD,OAAO,cAAc,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QAClD,MAAM,IAAI,GAAG,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;QACrC,MAAM,IAAI,GAAG,kBAAkB,CAAC,YAAY,CAAC,gBAAgB,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;QACxG,OAAO,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,cAAc,CAAC,GAAW;IACjC,IAAI,CAAC;QACH,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC;IACtE,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAK,GAA6B,CAAC,IAAI,KAAK,QAAQ;YAAE,OAAO,EAAE,CAAC;QAChE,OAAO,MAAM,CAAC,oBAAoB,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;IAChD,CAAC;AACH,CAAC"}
|
|
@@ -1,16 +1,5 @@
|
|
|
1
1
|
import type { ScnSighting } from "@3f-consulting/spec-controller-core";
|
|
2
|
-
/**
|
|
3
|
-
* Every line in the repository's tree carrying `SCN-<part>-`, with its path from `top`. The tree is
|
|
4
|
-
* what git lists: tracked files, and untracked files the repository does not ignore, since an author
|
|
5
|
-
* allocates because they have just written a scenario, and it is not committed yet.
|
|
6
|
-
*/
|
|
7
2
|
export declare function readTree(top: string, part: string): ScnSighting[];
|
|
8
|
-
/**
|
|
9
|
-
* Whether a walk without git enters a directory: never a package store, never a hidden directory.
|
|
10
|
-
* An installed package carries its own codes (spec-controller's own dist carries hundreds), which
|
|
11
|
-
* would retire a consumer's numbers with a package's.
|
|
12
|
-
*/
|
|
13
3
|
export declare function isWalkedDirectory(name: string): boolean;
|
|
14
|
-
/** Every line carrying `SCN-<part>-` in the text files under `root`, found by walking it without git. */
|
|
15
4
|
export declare function walkTree(root: string, part: string): ScnSighting[];
|
|
16
5
|
//# sourceMappingURL=readTree.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readTree.d.ts","sourceRoot":"","sources":["../../src/cli-allocate/readTree.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"readTree.d.ts","sourceRoot":"","sources":["../../src/cli-allocate/readTree.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAOvE,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,WAAW,EAAE,CAKjE;AA8CD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEvD;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,WAAW,EAAE,CAKlE"}
|
|
@@ -1,32 +1,15 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The tree half of the allocator's read: every line of every text file that mentions the part.
|
|
3
|
-
*
|
|
4
|
-
* In a repository, git says which files are the tree and allocate reads each of them itself. Git
|
|
5
|
-
* skips a file or directory it cannot read and still exits 0, so a code carried only there would be
|
|
6
|
-
* handed out again; reading the files here, and listing every directory git had to list, turns each
|
|
7
|
-
* such path into a refusal instead. Which words on a line are scenario codes is core's question,
|
|
8
|
-
* answered with the shared grammar.
|
|
9
|
-
*/
|
|
10
1
|
import { spawnSync } from "node:child_process";
|
|
11
2
|
import { accessSync, constants, lstatSync, readdirSync, readFileSync } from "node:fs";
|
|
12
3
|
import { join, relative, sep } from "node:path";
|
|
13
4
|
import { readOrRefuse, refuse, UnreadableInput } from "./unreadable.js";
|
|
14
|
-
/** Git's listing can be large on a big repository; the default buffer would truncate it. */
|
|
15
5
|
const MAX_OUTPUT_BYTES = 1024 * 1024 * 1024;
|
|
16
|
-
/** How far into a file git looks for a NUL before it calls the file binary and searches none of it. */
|
|
17
6
|
const BINARY_PROBE_BYTES = 8000;
|
|
18
|
-
/**
|
|
19
|
-
* Every line in the repository's tree carrying `SCN-<part>-`, with its path from `top`. The tree is
|
|
20
|
-
* what git lists: tracked files, and untracked files the repository does not ignore, since an author
|
|
21
|
-
* allocates because they have just written a scenario, and it is not committed yet.
|
|
22
|
-
*/
|
|
23
7
|
export function readTree(top, part) {
|
|
24
8
|
const listed = gitListing(top, ["ls-files", "-z", "--cached", "--others", "--exclude-standard"]);
|
|
25
9
|
const ignored = gitListing(top, ["ls-files", "-z", "--others", "--ignored", "--exclude-standard", "--directory"]);
|
|
26
10
|
proveListable(top, "", new Set(ignored.filter(isDirectoryEntry).map((entry) => entry.slice(0, -1))));
|
|
27
11
|
return listed.filter((entry) => !isDirectoryEntry(entry)).flatMap((path) => sightingsInListed(top, path, `SCN-${part}-`));
|
|
28
12
|
}
|
|
29
|
-
/** The paths a `git ls-files -z` run lists, or the refusal when git could not list them. */
|
|
30
13
|
function gitListing(top, args) {
|
|
31
14
|
const result = spawnSync("git", args, { cwd: top, encoding: "utf8", maxBuffer: MAX_OUTPUT_BYTES });
|
|
32
15
|
if (result.error !== undefined)
|
|
@@ -37,14 +20,9 @@ function gitListing(top, args) {
|
|
|
37
20
|
}
|
|
38
21
|
return result.stdout.split("\0").filter((entry) => entry !== "");
|
|
39
22
|
}
|
|
40
|
-
/** A listed directory rather than a file: a repository nested in the tree, or a wholly ignored one. */
|
|
41
23
|
function isDirectoryEntry(entry) {
|
|
42
24
|
return entry.endsWith("/");
|
|
43
25
|
}
|
|
44
|
-
/**
|
|
45
|
-
* Every directory git had to list to answer, listed and entered here too, so one it could not list
|
|
46
|
-
* is refused rather than skipped. Ignored directories and nested repositories are not the tree.
|
|
47
|
-
*/
|
|
48
26
|
function proveListable(top, dir, ignored) {
|
|
49
27
|
const path = dir === "" ? top : join(top, dir);
|
|
50
28
|
const entries = readOrRefuse("a directory in the tree", path, () => listedAndEntered(path));
|
|
@@ -56,12 +34,10 @@ function proveListable(top, dir, ignored) {
|
|
|
56
34
|
proveListable(top, child, ignored);
|
|
57
35
|
}
|
|
58
36
|
}
|
|
59
|
-
/** A directory's entries, when it may be both listed and entered. */
|
|
60
37
|
function listedAndEntered(path) {
|
|
61
38
|
accessSync(path, constants.R_OK | constants.X_OK);
|
|
62
39
|
return readdirSync(path, { withFileTypes: true });
|
|
63
40
|
}
|
|
64
|
-
/** The sightings in one file git lists: none when it has left the working tree or is not a file. */
|
|
65
41
|
function sightingsInListed(top, path, needle) {
|
|
66
42
|
const file = join(top, path);
|
|
67
43
|
const kind = readOrRefuse("a file in the tree", file, () => lstatSync(file, { throwIfNoEntry: false }));
|
|
@@ -69,7 +45,6 @@ function sightingsInListed(top, path, needle) {
|
|
|
69
45
|
return [];
|
|
70
46
|
return linesCarrying(path, readOrRefuse("a file in the tree", file, () => readFileSync(file)), needle);
|
|
71
47
|
}
|
|
72
|
-
/** The lines of a file's content that carry `needle`; a binary file, by git's rule, carries none. */
|
|
73
48
|
function linesCarrying(path, content, needle) {
|
|
74
49
|
if (content.subarray(0, BINARY_PROBE_BYTES).includes(0))
|
|
75
50
|
return [];
|
|
@@ -78,22 +53,15 @@ function linesCarrying(path, content, needle) {
|
|
|
78
53
|
.split("\n")
|
|
79
54
|
.flatMap((line, i) => (line.includes(needle) ? [{ path, line: i + 1, text: line }] : []));
|
|
80
55
|
}
|
|
81
|
-
/**
|
|
82
|
-
* Whether a walk without git enters a directory: never a package store, never a hidden directory.
|
|
83
|
-
* An installed package carries its own codes (spec-controller's own dist carries hundreds), which
|
|
84
|
-
* would retire a consumer's numbers with a package's.
|
|
85
|
-
*/
|
|
86
56
|
export function isWalkedDirectory(name) {
|
|
87
57
|
return name !== "node_modules" && !name.startsWith(".");
|
|
88
58
|
}
|
|
89
|
-
/** Every line carrying `SCN-<part>-` in the text files under `root`, found by walking it without git. */
|
|
90
59
|
export function walkTree(root, part) {
|
|
91
60
|
return filesUnder(root).flatMap((file) => {
|
|
92
61
|
const content = readOrRefuse("a file in the tree", file, () => readFileSync(file));
|
|
93
62
|
return linesCarrying(relative(root, file).split(sep).join("/"), content, `SCN-${part}-`);
|
|
94
63
|
});
|
|
95
64
|
}
|
|
96
|
-
/** Every file under `dir`, entering only the directories a walk enters; a refusal for one it cannot list. */
|
|
97
65
|
function filesUnder(dir) {
|
|
98
66
|
const entries = readOrRefuse("a directory in the tree", dir, () => readdirSync(dir, { withFileTypes: true }));
|
|
99
67
|
return entries.flatMap((entry) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readTree.js","sourceRoot":"","sources":["../../src/cli-allocate/readTree.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"readTree.js","sourceRoot":"","sources":["../../src/cli-allocate/readTree.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAe,MAAM,SAAS,CAAC;AACnG,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAEhD,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAExE,MAAM,gBAAg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C,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACtC,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refStore.d.ts","sourceRoot":"","sources":["../../src/cli-allocate/refStore.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"refStore.d.ts","sourceRoot":"","sources":["../../src/cli-allocate/refStore.ts"],"names":[],"mappings":"AAOA,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAInD"}
|
|
@@ -1,26 +1,14 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The refs the history read starts from, proved readable before git is asked for the history.
|
|
3
|
-
*
|
|
4
|
-
* Git walks history from every ref, and a ref store it cannot read is not an error to git: with
|
|
5
|
-
* `refs/heads` unreadable, `git log --all` exits 0, writes nothing to stderr, and simply walks from
|
|
6
|
-
* fewer refs, so a deleted code only an unread branch reaches would be handed out again. Reading the
|
|
7
|
-
* store here is the only way that case is ever seen. It reads, and never interprets: whether the
|
|
8
|
-
* store is loose files, `packed-refs` or a reftable, every one of them git would read is read here.
|
|
9
|
-
*/
|
|
10
1
|
import { spawnSync } from "node:child_process";
|
|
11
2
|
import { lstatSync, readdirSync, readFileSync } from "node:fs";
|
|
12
3
|
import { join } from "node:path";
|
|
13
4
|
import { readOrRefuse } from "./unreadable.js";
|
|
14
|
-
/** Where each ref store lives under a git directory, whichever format the repository keeps. */
|
|
15
5
|
const REF_STORES = ["refs", "packed-refs", "reftable"];
|
|
16
|
-
/** Refuse, as history allocate cannot read, a ref store under the repository at `cwd` it may not read. */
|
|
17
6
|
export function proveRefsReadable(cwd) {
|
|
18
7
|
for (const gitDir of gitDirsOf(cwd)) {
|
|
19
8
|
for (const store of REF_STORES)
|
|
20
9
|
readEveryEntry(join(gitDir, store));
|
|
21
10
|
}
|
|
22
11
|
}
|
|
23
|
-
/** The repository's common git directory and its own, which differ only in a linked worktree. */
|
|
24
12
|
function gitDirsOf(cwd) {
|
|
25
13
|
const result = spawnSync("git", ["rev-parse", "--path-format=absolute", "--git-common-dir", "--git-dir"], {
|
|
26
14
|
cwd,
|
|
@@ -30,7 +18,6 @@ function gitDirsOf(cwd) {
|
|
|
30
18
|
return [];
|
|
31
19
|
return [...new Set(result.stdout.split("\n").filter((line) => line !== ""))];
|
|
32
20
|
}
|
|
33
|
-
/** Read `path` whole: a file's content, or every entry under a directory; nothing when it is not there. */
|
|
34
21
|
function readEveryEntry(path) {
|
|
35
22
|
const kind = readOrRefuse("the repository's history", path, () => lstatSync(path, { throwIfNoEntry: false }));
|
|
36
23
|
if (kind === undefined)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refStore.js","sourceRoot":"","sources":["../../src/cli-allocate/refStore.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"refStore.js","sourceRoot":"","sources":["../../src/cli-allocate/refStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,MAAM,UAAU,GAAG,CAAC,MAAM,EAAE,aAAa,EAAE,UAAU,CAAU,CAAC;AAEhE,MAAM,UAAU,iBAAiB,CAAC,GAAW;IAC3C,KAAK,MAAM,MAAM,IAAI,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC;QACpC,KAAK,MAAM,KAAK,IAAI,UAAU;YAAE,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;IACtE,CAAC;AACH,CAAC;AAED,SAAS,SAAS,CAAC,GAAW;IAC5B,MAAM,MAAM,GAAG,SAAS,CAAC,KAAK,EAAE,CAAC,WAAW,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,WAAW,CAAC,EAAE;QACxG,GAAG;QACH,QAAQ,EAAE,MAAM;KACjB,CAAC,CAAC;IACH,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IACnC,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC;AAC/E,CAAC;AAED,SAAS,cAAc,CAAC,IAAY;IAClC,MAAM,IAAI,GAAG,YAAY,CAAC,0BAA0B,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,IAAI,EAAE,EAAE,cAAc,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;IAC9G,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO;IAC/B,IAAI,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;QACvB,MAAM,KAAK,GAAG,YAAY,CAAC,0BAA0B,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;QACtF,KAAK,MAAM,IAAI,IAAI,KAAK;YAAE,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;IAC7D,CAAC;SAAM,IAAI,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC;QACzB,YAAY,CAAC,0BAA0B,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC;IAC3E,CAAC;AACH,CAAC"}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import type { CliRegistry } from "../cli-registry.js";
|
|
2
|
-
/** A well-formed request: the part, and whether it is asked for as new. */
|
|
3
2
|
export interface AllocateRequest {
|
|
4
3
|
readonly part: string;
|
|
5
4
|
readonly isNew: boolean;
|
|
6
5
|
}
|
|
7
|
-
/** The request `argv` makes, or the usage error it is, worded for stderr. */
|
|
8
6
|
export declare function readRequest(argv: readonly string[], registry: CliRegistry, toolVersion: string): AllocateRequest | {
|
|
9
7
|
readonly usageError: string;
|
|
10
8
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../src/cli-allocate/request.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../src/cli-allocate/request.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEtD,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB;AAED,wBAAgB,WAAW,CACzB,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,QAAQ,EAAE,WAAW,EACrB,WAAW,EAAE,MAAM,GAClB,eAAe,GAAG;IAAE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAInD"}
|
|
@@ -1,24 +1,17 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* What an `allocate` invocation asks for, read against the command's registry scope, or the usage
|
|
3
|
-
* error it is. A usage error is worded as one, so it is never taken for an unknown part.
|
|
4
|
-
*/
|
|
5
1
|
import { isFeaturePart } from "@3f-consulting/spec-controller-core";
|
|
6
2
|
import { checkArgvShape, checkMisplacedHostModifiers, checkUnknownFlags, parseArgs, positionalArguments, } from "../cli-args.js";
|
|
7
|
-
/** The request `argv` makes, or the usage error it is, worded for stderr. */
|
|
8
3
|
export function readRequest(argv, registry, toolVersion) {
|
|
9
4
|
const why = argvRefusal(argv, registry, toolVersion) ?? partRefusal(positionalArguments(argv, registry, "allocate")[0]);
|
|
10
5
|
if (why !== null)
|
|
11
6
|
return { usageError: `spec-controller allocate: usage error — ${why}` };
|
|
12
7
|
return { part: positionalArguments(argv, registry, "allocate")[0] ?? "", isNew: argv.includes("--new") };
|
|
13
8
|
}
|
|
14
|
-
/** The first refusal the argv earns against the registry, the same checks `balance` makes, in its order. */
|
|
15
9
|
function argvRefusal(argv, registry, toolVersion) {
|
|
16
10
|
const args = parseArgs(argv);
|
|
17
11
|
return (checkMisplacedHostModifiers(args, registry, "allocate") ??
|
|
18
12
|
checkArgvShape(argv, registry, "allocate") ??
|
|
19
13
|
checkUnknownFlags(args, registry, "allocate", toolVersion));
|
|
20
14
|
}
|
|
21
|
-
/** The refusal for the part given, or null when it is a feature part in canon's form. */
|
|
22
15
|
function partRefusal(part) {
|
|
23
16
|
if (part === undefined)
|
|
24
17
|
return "no feature part was given: 'spec-controller allocate <FFF>' takes one, a feature file's header code.";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request.js","sourceRoot":"","sources":["../../src/cli-allocate/request.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"request.js","sourceRoot":"","sources":["../../src/cli-allocate/request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACpE,OAAO,EACL,cAAc,EACd,2BAA2B,EAC3B,iBAAiB,EACjB,SAAS,EACT,mBAAmB,GACpB,MAAM,gBAAgB,CAAC;AAQxB,MAAM,UAAU,WAAW,CACzB,IAAuB,EACvB,QAAqB,EACrB,WAAmB;IAEnB,MAAM,GAAG,GAAG,WAAW,CAAC,IAAI,EAAE,QAAQ,EAAE,WAAW,CAAC,IAAI,WAAW,CAAC,mBAAmB,CAAC,IAAI,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACxH,IAAI,GAAG,KAAK,IAAI;QAAE,OAAO,EAAE,UAAU,EAAE,2CAA2C,GAAG,EAAE,EAAE,CAAC;IAC1F,OAAO,EAAE,IAAI,EAAE,mBAAmB,CAAC,IAAI,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;AAC3G,CAAC;AAED,SAAS,WAAW,CAAC,IAAuB,EAAE,QAAqB,EAAE,WAAmB;IACtF,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;IAC7B,OAAO,CACL,2BAA2B,CAAC,IAAI,EAAE,QAAQ,EAAE,UAAU,CAAC;QACvD,cAAc,CAAC,IAAI,EAAE,QAAQ,EAAE,UAAU,CAAC;QAC1C,iBAAiB,CAAC,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,WAAW,CAAC,CAC3D,CAAC;AACJ,CAAC;AAED,SAAS,WAAW,CAAC,IAAwB;IAC3C,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO,sGAAsG,CAAC;IACtI,IAAI,aAAa,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IACrC,OAAO,IAAI,IAAI,mFAAmF,CAAC;AACrG,CAAC"}
|
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* What the allocator says beside its answer, on stderr, so stdout carries the code alone.
|
|
3
|
-
*/
|
|
4
1
|
import { type Allocation, type UnknownPart } from "@3f-consulting/spec-controller-core";
|
|
5
2
|
import type { HistoryBoundary } from "./readHistory.js";
|
|
6
|
-
/** What was left unread, and what that means for the answer; nothing when history was read whole. */
|
|
7
3
|
export declare function historyBoundaryLine(boundary: HistoryBoundary, allocation: Allocation): string | null;
|
|
8
|
-
/** Where the highest code was seen: a file and line, and the commit when only history carries it. */
|
|
9
4
|
export declare function highestSeenLine(allocation: Allocation): string;
|
|
10
|
-
/** The refusal for a part no feature file's header carries: the part, and the parts that are. */
|
|
11
5
|
export declare function unknownPartRefusal(refusal: UnknownPart): string;
|
|
12
|
-
/** The note for a part asked for as new that a header already carries; nothing otherwise. */
|
|
13
6
|
export declare function alreadyHeadedNote(allocation: Allocation): string | null;
|
|
14
7
|
//# sourceMappingURL=stderr.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stderr.d.ts","sourceRoot":"","sources":["../../src/cli-allocate/stderr.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"stderr.d.ts","sourceRoot":"","sources":["../../src/cli-allocate/stderr.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,UAAU,EAAE,KAAK,WAAW,EAAE,MAAM,qCAAqC,CAAC;AACvG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAExD,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,eAAe,EAAE,UAAU,EAAE,UAAU,GAAG,MAAM,GAAG,IAAI,CAKpG;AAED,wBAAgB,eAAe,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,CAK9D;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,CAM/D;AAED,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,GAAG,IAAI,CAGvE"}
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* What the allocator says beside its answer, on stderr, so stdout carries the code alone.
|
|
3
|
-
*/
|
|
4
1
|
import { featureCodeOf } from "@3f-consulting/spec-controller-core";
|
|
5
|
-
/** What was left unread, and what that means for the answer; nothing when history was read whole. */
|
|
6
2
|
export function historyBoundaryLine(boundary, allocation) {
|
|
7
3
|
if (boundary.kind === "complete")
|
|
8
4
|
return null;
|
|
@@ -10,7 +6,6 @@ export function historyBoundaryLine(boundary, allocation) {
|
|
|
10
6
|
const risk = allocation.highest === null ? `a code of ${featureCodeOf(allocation.code) ?? ""}` : `a code above ${allocation.highest.code}`;
|
|
11
7
|
return `history: ${unread}; ${risk} may have been used before`;
|
|
12
8
|
}
|
|
13
|
-
/** Where the highest code was seen: a file and line, and the commit when only history carries it. */
|
|
14
9
|
export function highestSeenLine(allocation) {
|
|
15
10
|
const highest = allocation.highest;
|
|
16
11
|
if (highest === null)
|
|
@@ -18,13 +13,11 @@ export function highestSeenLine(allocation) {
|
|
|
18
13
|
const { path, line, commit } = highest.sighting;
|
|
19
14
|
return `highest seen: ${highest.code}, ${path}:${line}${commit === undefined ? "" : ` in ${commit}`}`;
|
|
20
15
|
}
|
|
21
|
-
/** The refusal for a part no feature file's header carries: the part, and the parts that are. */
|
|
22
16
|
export function unknownPartRefusal(refusal) {
|
|
23
17
|
const parts = refusal.headerCodes.length === 0 ? "none" : refusal.headerCodes.join(", ");
|
|
24
18
|
return (`spec-controller allocate: unknown part — no feature file's header carries ${refusal.part}.\n` +
|
|
25
19
|
`The parts this corpus's feature files carry: ${parts}.`);
|
|
26
20
|
}
|
|
27
|
-
/** The note for a part asked for as new that a header already carries; nothing otherwise. */
|
|
28
21
|
export function alreadyHeadedNote(allocation) {
|
|
29
22
|
if (allocation.alreadyHeaded !== true)
|
|
30
23
|
return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stderr.js","sourceRoot":"","sources":["../../src/cli-allocate/stderr.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"stderr.js","sourceRoot":"","sources":["../../src/cli-allocate/stderr.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAqC,MAAM,qCAAqC,CAAC;AAGvG,MAAM,UAAU,mBAAmB,CAAC,QAAyB,EAAE,UAAsB;IACnF,IAAI,QAAQ,CAAC,IAAI,KAAK,UAAU;QAAE,OAAO,IAAI,CAAC;IAC9C,MAAM,MAAM,GAAG,QAAQ,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,kCAAkC,QAAQ,CAAC,MAAM,SAAS,CAAC,CAAC,CAAC,kCAAkC,CAAC;IAC7I,MAAM,IAAI,GAAG,UAAU,CAAC,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,aAAa,aAAa,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,gBAAgB,UAAU,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;IAC3I,OAAO,YAAY,MAAM,KAAK,IAAI,4BAA4B,CAAC;AACjE,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,UAAsB;IACpD,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC;IACnC,IAAI,OAAO,KAAK,IAAI;QAAE,OAAO,oBAAoB,CAAC;IAClD,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,QAAQ,CAAC;IAChD,OAAO,iBAAiB,OAAO,CAAC,IAAI,KAAK,IAAI,IAAI,IAAI,GAAG,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,MAAM,EAAE,EAAE,CAAC;AACxG,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,OAAoB;IACrD,MAAM,KAAK,GAAG,OAAO,CAAC,WAAW,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACzF,OAAO,CACL,6EAA6E,OAAO,CAAC,IAAI,KAAK;QAC9F,gDAAgD,KAAK,GAAG,CACzD,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,UAAsB;IACtD,IAAI,UAAU,CAAC,aAAa,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IACnD,OAAO,iDAAiD,aAAa,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,2BAA2B,CAAC;AAC1H,CAAC"}
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A path allocate is meant to read and cannot. It is the invocation being wrong, the same as a
|
|
3
|
-
* malformed request, so it is refused as a usage error naming the path and the reason, and no code
|
|
4
|
-
* is given: an answer computed without the path could hand out a code the unread path carries.
|
|
5
|
-
*/
|
|
6
|
-
/** What allocate could not read: which input it was, where (when the read had a path), and the reason. */
|
|
7
1
|
export declare class UnreadableInput extends Error {
|
|
8
2
|
readonly subject: string;
|
|
9
3
|
readonly path: string;
|
|
@@ -11,14 +5,7 @@ export declare class UnreadableInput extends Error {
|
|
|
11
5
|
readonly name = "UnreadableInput";
|
|
12
6
|
constructor(subject: string, path: string, reason: string);
|
|
13
7
|
}
|
|
14
|
-
/**
|
|
15
|
-
* The read's answer, or the refusal when the operating system refuses it. Any refusal the OS gives
|
|
16
|
-
* is the same fault here: not permitted, not the kind of path the read expects, or not there. A
|
|
17
|
-
* throw that carries no OS code is not a read failing, and is left to surface.
|
|
18
|
-
*/
|
|
19
8
|
export declare function readOrRefuse<T>(subject: string, path: string, read: () => T): T;
|
|
20
|
-
/** Throw the refusal a failed read of `path` is, or the throw itself when it is not a read failing. */
|
|
21
9
|
export declare function refuse(subject: string, path: string, err: unknown): never;
|
|
22
|
-
/** The one stderr line a refusal is written as, in allocate's usage-error form. */
|
|
23
10
|
export declare function refusalLine(refusal: UnreadableInput): string;
|
|
24
11
|
//# sourceMappingURL=unreadable.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unreadable.d.ts","sourceRoot":"","sources":["../../src/cli-allocate/unreadable.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"unreadable.d.ts","sourceRoot":"","sources":["../../src/cli-allocate/unreadable.ts"],"names":[],"mappings":"AAAA,qBAAa,eAAgB,SAAQ,KAAK;IAItC,QAAQ,CAAC,OAAO,EAAE,MAAM;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM;IACrB,QAAQ,CAAC,MAAM,EAAE,MAAM;IALzB,SAAkB,IAAI,qBAAqB;gBAGhC,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM;CAI1B;AAED,wBAAgB,YAAY,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,CAM/E;AAED,wBAAgB,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,GAAG,KAAK,CAIzE;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,eAAe,GAAG,MAAM,CAE5D"}
|