spec-controller 0.1.74 → 0.1.75
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/THIRD-PARTY-LICENSES.txt +382 -0
- package/dist/cli.js +28998 -3
- package/package.json +6 -3
- package/LICENSE +0 -21
- package/dist/cli-allocate/cli.d.ts +0 -2
- package/dist/cli-allocate/cli.d.ts.map +0 -1
- package/dist/cli-allocate/cli.js +0 -63
- package/dist/cli-allocate/cli.js.map +0 -1
- package/dist/cli-allocate/readHistory.d.ts +0 -14
- package/dist/cli-allocate/readHistory.d.ts.map +0 -1
- package/dist/cli-allocate/readHistory.js +0 -109
- package/dist/cli-allocate/readHistory.js.map +0 -1
- package/dist/cli-allocate/readParts.d.ts +0 -2
- package/dist/cli-allocate/readParts.d.ts.map +0 -1
- package/dist/cli-allocate/readParts.js +0 -26
- package/dist/cli-allocate/readParts.js.map +0 -1
- package/dist/cli-allocate/readTree.d.ts +0 -5
- package/dist/cli-allocate/readTree.d.ts.map +0 -1
- package/dist/cli-allocate/readTree.js +0 -74
- package/dist/cli-allocate/readTree.js.map +0 -1
- package/dist/cli-allocate/refStore.d.ts +0 -2
- package/dist/cli-allocate/refStore.d.ts.map +0 -1
- package/dist/cli-allocate/refStore.js +0 -35
- package/dist/cli-allocate/refStore.js.map +0 -1
- package/dist/cli-allocate/request.d.ts +0 -9
- package/dist/cli-allocate/request.d.ts.map +0 -1
- package/dist/cli-allocate/request.js +0 -23
- package/dist/cli-allocate/request.js.map +0 -1
- package/dist/cli-allocate/stderr.d.ts +0 -7
- package/dist/cli-allocate/stderr.d.ts.map +0 -1
- package/dist/cli-allocate/stderr.js +0 -32
- package/dist/cli-allocate/stderr.js.map +0 -1
- package/dist/cli-allocate/unreadable.d.ts +0 -19
- package/dist/cli-allocate/unreadable.d.ts.map +0 -1
- package/dist/cli-allocate/unreadable.js +0 -47
- package/dist/cli-allocate/unreadable.js.map +0 -1
- package/dist/cli-args.d.ts +0 -18
- package/dist/cli-args.d.ts.map +0 -1
- package/dist/cli-args.js +0 -196
- package/dist/cli-args.js.map +0 -1
- package/dist/cli-balance/cli.d.ts +0 -10
- package/dist/cli-balance/cli.d.ts.map +0 -1
- package/dist/cli-balance/cli.js +0 -163
- package/dist/cli-balance/cli.js.map +0 -1
- package/dist/cli-balance/corpusDir.d.ts +0 -3
- package/dist/cli-balance/corpusDir.d.ts.map +0 -1
- package/dist/cli-balance/corpusDir.js +0 -14
- package/dist/cli-balance/corpusDir.js.map +0 -1
- package/dist/cli-balance/emit/format.d.ts +0 -39
- package/dist/cli-balance/emit/format.d.ts.map +0 -1
- package/dist/cli-balance/emit/format.js +0 -59
- package/dist/cli-balance/emit/format.js.map +0 -1
- package/dist/cli-balance/emit/writer.d.ts +0 -13
- package/dist/cli-balance/emit/writer.d.ts.map +0 -1
- package/dist/cli-balance/emit/writer.js +0 -73
- package/dist/cli-balance/emit/writer.js.map +0 -1
- package/dist/cli-balance/evidenceInputs.d.ts +0 -136
- package/dist/cli-balance/evidenceInputs.d.ts.map +0 -1
- package/dist/cli-balance/evidenceInputs.js +0 -125
- package/dist/cli-balance/evidenceInputs.js.map +0 -1
- package/dist/cli-balance/exitStatus.d.ts +0 -4
- package/dist/cli-balance/exitStatus.d.ts.map +0 -1
- package/dist/cli-balance/exitStatus.js +0 -18
- package/dist/cli-balance/exitStatus.js.map +0 -1
- package/dist/cli-balance/inputsRead.d.ts +0 -11
- package/dist/cli-balance/inputsRead.d.ts.map +0 -1
- package/dist/cli-balance/inputsRead.js +0 -51
- package/dist/cli-balance/inputsRead.js.map +0 -1
- package/dist/cli-balance/reRender.d.ts +0 -8
- package/dist/cli-balance/reRender.d.ts.map +0 -1
- package/dist/cli-balance/reRender.js +0 -23
- package/dist/cli-balance/reRender.js.map +0 -1
- package/dist/cli-balance/unreadableInputs.d.ts +0 -52
- package/dist/cli-balance/unreadableInputs.d.ts.map +0 -1
- package/dist/cli-balance/unreadableInputs.js +0 -118
- package/dist/cli-balance/unreadableInputs.js.map +0 -1
- package/dist/cli-registry.d.ts +0 -36
- package/dist/cli-registry.d.ts.map +0 -1
- package/dist/cli-registry.js +0 -147
- package/dist/cli-registry.js.map +0 -1
- package/dist/cli.d.ts +0 -3
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/crashGuards.d.ts +0 -18
- package/dist/crashGuards.d.ts.map +0 -1
- package/dist/crashGuards.js +0 -81
- package/dist/crashGuards.js.map +0 -1
- package/dist/defaultCorpus.d.ts +0 -2
- package/dist/defaultCorpus.d.ts.map +0 -1
- package/dist/defaultCorpus.js +0 -2
- package/dist/defaultCorpus.js.map +0 -1
- package/dist/exitCode.d.ts +0 -21
- package/dist/exitCode.d.ts.map +0 -1
- package/dist/exitCode.js +0 -30
- package/dist/exitCode.js.map +0 -1
- package/dist/host.d.ts +0 -19
- package/dist/host.d.ts.map +0 -1
- package/dist/host.js +0 -119
- package/dist/host.js.map +0 -1
- package/dist/ingest/ciSourcePaths.d.ts +0 -8
- package/dist/ingest/ciSourcePaths.d.ts.map +0 -1
- package/dist/ingest/ciSourcePaths.js +0 -20
- package/dist/ingest/ciSourcePaths.js.map +0 -1
- package/dist/ingest/ingestQualityChecks.d.ts +0 -41
- package/dist/ingest/ingestQualityChecks.d.ts.map +0 -1
- package/dist/ingest/ingestQualityChecks.js +0 -105
- package/dist/ingest/ingestQualityChecks.js.map +0 -1
- package/dist/ingest/ingestScenarios.d.ts +0 -16
- package/dist/ingest/ingestScenarios.d.ts.map +0 -1
- package/dist/ingest/ingestScenarios.js +0 -61
- package/dist/ingest/ingestScenarios.js.map +0 -1
- package/dist/ingest/inputReading.d.ts +0 -12
- package/dist/ingest/inputReading.d.ts.map +0 -1
- package/dist/ingest/inputReading.js +0 -28
- package/dist/ingest/inputReading.js.map +0 -1
- package/dist/ingest/inputShapes.d.ts +0 -18
- package/dist/ingest/inputShapes.d.ts.map +0 -1
- package/dist/ingest/inputShapes.js +0 -135
- package/dist/ingest/inputShapes.js.map +0 -1
- package/dist/ingest/junitReportPaths.d.ts +0 -3
- package/dist/ingest/junitReportPaths.d.ts.map +0 -1
- package/dist/ingest/junitReportPaths.js +0 -16
- package/dist/ingest/junitReportPaths.js.map +0 -1
- package/dist/ingest/junitXml.d.ts +0 -4
- package/dist/ingest/junitXml.d.ts.map +0 -1
- package/dist/ingest/junitXml.js +0 -22
- package/dist/ingest/junitXml.js.map +0 -1
- package/dist/ingest/reportReading.d.ts +0 -20
- package/dist/ingest/reportReading.d.ts.map +0 -1
- package/dist/ingest/reportReading.js +0 -28
- package/dist/ingest/reportReading.js.map +0 -1
- package/dist/main.d.ts +0 -2
- package/dist/main.d.ts.map +0 -1
- package/dist/main.js +0 -107
- package/dist/main.js.map +0 -1
- package/dist/messages.d.ts +0 -242
- package/dist/messages.d.ts.map +0 -1
- package/dist/messages.js +0 -343
- package/dist/messages.js.map +0 -1
- package/dist/outputLocation.d.ts +0 -23
- package/dist/outputLocation.d.ts.map +0 -1
- package/dist/outputLocation.js +0 -139
- package/dist/outputLocation.js.map +0 -1
- package/dist/run-management/keptRun.d.ts +0 -55
- package/dist/run-management/keptRun.d.ts.map +0 -1
- package/dist/run-management/keptRun.js +0 -93
- package/dist/run-management/keptRun.js.map +0 -1
- package/dist/run-management/resolveRunInputs.d.ts +0 -17
- package/dist/run-management/resolveRunInputs.d.ts.map +0 -1
- package/dist/run-management/resolveRunInputs.js +0 -137
- package/dist/run-management/resolveRunInputs.js.map +0 -1
- package/dist/storedRun.d.ts +0 -6
- package/dist/storedRun.d.ts.map +0 -1
- package/dist/storedRun.js +0 -27
- package/dist/storedRun.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "spec-controller",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.75",
|
|
4
4
|
"description": "Reconcile the behaviour your scenarios name against the evidence that actually ran — the deterministic `balance` CLI.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"reconciliation",
|
|
@@ -24,12 +24,15 @@
|
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"fast-xml-parser": "^5.11.2",
|
|
26
26
|
"yaml": "^2.9.0",
|
|
27
|
-
"@3f-consulting/spec-controller-core": "0.1.
|
|
27
|
+
"@3f-consulting/spec-controller-core": "0.1.75"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"esbuild": "0.28.1"
|
|
28
31
|
},
|
|
29
32
|
"publishConfig": {
|
|
30
33
|
"access": "public"
|
|
31
34
|
},
|
|
32
35
|
"scripts": {
|
|
33
|
-
"build": "tsc -p tsconfig.build.json"
|
|
36
|
+
"build": "tsc -p tsconfig.build.json --noEmit && node bundle.mjs"
|
|
34
37
|
}
|
|
35
38
|
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 3F Consulting Ltd
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/cli-allocate/cli.ts"],"names":[],"mappings":"AAcA,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CAMhD"}
|
package/dist/cli-allocate/cli.js
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { join } from "node:path";
|
|
2
|
-
import { nextScnCode } from "@3f-consulting/spec-controller-core";
|
|
3
|
-
import { allocateCommand, cliRegistry, renderCommandHelp } from "../cli-registry.js";
|
|
4
|
-
import { resolveToolIdentity } from "../run-management/resolveRunInputs.js";
|
|
5
|
-
import { readHeaderCodes } from "./readParts.js";
|
|
6
|
-
import { readRequest } from "./request.js";
|
|
7
|
-
import { AppMessage } from "../messages.js";
|
|
8
|
-
import { DEFAULT_FEATURES_DIR } from "../defaultCorpus.js";
|
|
9
|
-
import { readOrRefuse, refusalLine, UnparseableFeatureFiles, UnreadableInput } from "./unreadable.js";
|
|
10
|
-
import { historyBoundaryOf, readHistory, repositoryTop } from "./readHistory.js";
|
|
11
|
-
import { readTree, walkTree } from "./readTree.js";
|
|
12
|
-
import { alreadyHeadedNote, highestSeenLine, historyBoundaryLine, unknownPartRefusal } from "./stderr.js";
|
|
13
|
-
import { endRunOn, USAGE_REFUSAL } from "../exitCode.js";
|
|
14
|
-
export function runAllocate(argv) {
|
|
15
|
-
if (asksForHelp(argv)) {
|
|
16
|
-
process.stdout.write(renderCommandHelp(allocateCommand) + "\n");
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
answerOrRefuse(readRequest(argv, cliRegistry, resolveToolIdentity().toolVersion));
|
|
20
|
-
}
|
|
21
|
-
function asksForHelp(argv) {
|
|
22
|
-
return argv.includes("--help") || argv.includes("-h");
|
|
23
|
-
}
|
|
24
|
-
function answerOrRefuse(request) {
|
|
25
|
-
if ("usageError" in request) {
|
|
26
|
-
refuseUsage(request.usageError);
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
try {
|
|
30
|
-
answerRequest(request);
|
|
31
|
-
}
|
|
32
|
-
catch (err) {
|
|
33
|
-
if (!(err instanceof UnreadableInput || err instanceof UnparseableFeatureFiles))
|
|
34
|
-
throw err;
|
|
35
|
-
refuseUsage(refusalLine(err));
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
function refuseUsage(line) {
|
|
39
|
-
process.stderr.write(line + "\n");
|
|
40
|
-
endRunOn(USAGE_REFUSAL);
|
|
41
|
-
}
|
|
42
|
-
function answerRequest({ part, isNew }) {
|
|
43
|
-
const cwd = readOrRefuse(AppMessage.WorkingDirectory, "", () => process.cwd());
|
|
44
|
-
const top = repositoryTop(cwd);
|
|
45
|
-
const headerCodes = readHeaderCodes(join(top ?? cwd, DEFAULT_FEATURES_DIR));
|
|
46
|
-
const answer = nextScnCode({ part, headerCodes, isNew }, occurrencesFrom(cwd, part, top));
|
|
47
|
-
if (answer.kind === "unknown-part") {
|
|
48
|
-
refuseUsage(unknownPartRefusal(answer));
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
writeLineIfAny(historyBoundaryLine(historyBoundaryOf(cwd), answer));
|
|
52
|
-
process.stderr.write(highestSeenLine(answer) + "\n");
|
|
53
|
-
writeLineIfAny(alreadyHeadedNote(answer));
|
|
54
|
-
process.stdout.write(answer.code + "\n");
|
|
55
|
-
}
|
|
56
|
-
function writeLineIfAny(line) {
|
|
57
|
-
if (line !== null)
|
|
58
|
-
process.stderr.write(line + "\n");
|
|
59
|
-
}
|
|
60
|
-
function occurrencesFrom(cwd, part, top) {
|
|
61
|
-
return top !== null ? [...readTree(top, part), ...readHistory(cwd, part)] : walkTree(cwd,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AAC,CAAC,CAAC;IAC1F,IAAI,MAAM,CAAC,IAAI,KAAK,cAAc,EAAE,CAAC;QACnC,WAAW,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC;QACxC,OAAO;IACT,CAAC;IACD,cAAc,CAAC,mBAAmB,CAAC,iBAAiB,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;IACpE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC;IACrD,cAAc,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC;IAC1C,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC,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,eAAe,CAAC,GAAW,EAAE,IAAY,EAAE,GAAkB;IACpE,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,14 +0,0 @@
|
|
|
1
|
-
import type { ScnOccurrence } from "@3f-consulting/spec-controller-core";
|
|
2
|
-
export type HistoryBoundary = {
|
|
3
|
-
kind: "complete";
|
|
4
|
-
} | {
|
|
5
|
-
kind: "not-a-repository";
|
|
6
|
-
} | {
|
|
7
|
-
kind: "shallow";
|
|
8
|
-
before: string;
|
|
9
|
-
};
|
|
10
|
-
export declare function readHistory(cwd: string, part: string): ScnOccurrence[];
|
|
11
|
-
export declare function repositoryTop(cwd: string): string | null;
|
|
12
|
-
export declare function historyBoundaryOf(cwd: string): HistoryBoundary;
|
|
13
|
-
export declare function diffLineOccurrences(logOutput: string): ScnOccurrence[];
|
|
14
|
-
//# sourceMappingURL=readHistory.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"readHistory.d.ts","sourceRoot":"","sources":["../../src/cli-allocate/readHistory.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AAKzE,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,aAAa,EAAE,CAStE;AAOD,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAOxD;AAcD,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,eAAe,CAI9D;AAuBD,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,aAAa,EAAE,CAQtE"}
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import { spawnSync } from "node:child_process";
|
|
2
|
-
import { lstatSync, readFileSync } from "node:fs";
|
|
3
|
-
import { dirname, join } from "node:path";
|
|
4
|
-
import { proveRefsReadable } from "./refStore.js";
|
|
5
|
-
import { APP_MESSAGES, AppMessage } from "../messages.js";
|
|
6
|
-
import { firstLine, readOrRefuse, refuse, UnreadableInput } from "./unreadable.js";
|
|
7
|
-
const MAX_OUTPUT_BYTES = 1024 * 1024 * 1024;
|
|
8
|
-
const COMMIT_MARKER = "\u0001";
|
|
9
|
-
export function readHistory(cwd, part) {
|
|
10
|
-
proveRefsReadable(cwd);
|
|
11
|
-
const args = ["log", "--all", "-p", "-U0", "--no-color", "--no-ext-diff", "--format=%x01%h", "-G", `SCN-${part}-`];
|
|
12
|
-
const result = spawnSync("git", args, { cwd, encoding: "utf8", maxBuffer: MAX_OUTPUT_BYTES });
|
|
13
|
-
if (result.error !== undefined)
|
|
14
|
-
refuse(AppMessage.History, cwd, result.error);
|
|
15
|
-
if (result.status !== 0) {
|
|
16
|
-
throw new UnreadableInput(AppMessage.History, cwd, APP_MESSAGES[AppMessage.GitExited](args, result.status, firstLine(result.stderr)));
|
|
17
|
-
}
|
|
18
|
-
return diffLineOccurrences(result.stdout);
|
|
19
|
-
}
|
|
20
|
-
function gitAnswer(cwd, args) {
|
|
21
|
-
const result = spawnSync("git", args, { cwd, encoding: "utf8" });
|
|
22
|
-
return result.status === 0 ? result.stdout.trim() : null;
|
|
23
|
-
}
|
|
24
|
-
export function repositoryTop(cwd) {
|
|
25
|
-
const args = ["rev-parse", "--show-toplevel"];
|
|
26
|
-
const result = spawnSync("git", args, { cwd, encoding: "utf8" });
|
|
27
|
-
if (result.status === 0)
|
|
28
|
-
return result.stdout.trim();
|
|
29
|
-
const gitEntry = result.error === undefined ? gitEntryAtOrAbove(cwd) : null;
|
|
30
|
-
if (gitEntry === null)
|
|
31
|
-
return null;
|
|
32
|
-
throw new UnreadableInput(AppMessage.Repository, gitEntry, APP_MESSAGES[AppMessage.GitExited](args, result.status, firstLine(result.stderr)));
|
|
33
|
-
}
|
|
34
|
-
function gitEntryAtOrAbove(dir) {
|
|
35
|
-
for (let at = dir;; at = dirname(at)) {
|
|
36
|
-
const entry = join(at, ".git");
|
|
37
|
-
if (lstatSync(entry, { throwIfNoEntry: false }) !== undefined)
|
|
38
|
-
return entry;
|
|
39
|
-
if (dirname(at) === at)
|
|
40
|
-
return null;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
function isGitRepository(cwd) {
|
|
44
|
-
return gitAnswer(cwd, ["rev-parse", "--git-dir"]) !== null;
|
|
45
|
-
}
|
|
46
|
-
export function historyBoundaryOf(cwd) {
|
|
47
|
-
if (!isGitRepository(cwd))
|
|
48
|
-
return { kind: "not-a-repository" };
|
|
49
|
-
if (gitAnswer(cwd, ["rev-parse", "--is-shallow-repository"]) !== "true")
|
|
50
|
-
return { kind: "complete" };
|
|
51
|
-
return shallowBoundaryOf(cwd);
|
|
52
|
-
}
|
|
53
|
-
function shallowBoundaryOf(cwd) {
|
|
54
|
-
const shallowPath = shallowRecordPath(cwd);
|
|
55
|
-
const record = readOrRefuse(AppMessage.History, shallowPath, () => readFileSync(shallowPath, "utf8"));
|
|
56
|
-
const edge = record.split("\n")[0] ?? "";
|
|
57
|
-
return { kind: "shallow", before: gitAnswer(cwd, ["rev-parse", "--short", edge]) ?? edge };
|
|
58
|
-
}
|
|
59
|
-
function shallowRecordPath(cwd) {
|
|
60
|
-
const shallowFile = gitAnswer(cwd, ["rev-parse", "--git-path", "shallow"]) ?? "";
|
|
61
|
-
return shallowFile.startsWith("/") ? shallowFile : `${cwd}/${shallowFile}`;
|
|
62
|
-
}
|
|
63
|
-
export function diffLineOccurrences(logOutput) {
|
|
64
|
-
const at = { inFileHeader: false, oldPath: "", newPath: "", oldLine: 0, newLine: 0 };
|
|
65
|
-
const occurrences = [];
|
|
66
|
-
for (const line of logOutput.split("\n")) {
|
|
67
|
-
const occurrence = readLine(line, at);
|
|
68
|
-
if (occurrence !== undefined)
|
|
69
|
-
occurrences.push(occurrence);
|
|
70
|
-
}
|
|
71
|
-
return occurrences;
|
|
72
|
-
}
|
|
73
|
-
function readLine(line, at) {
|
|
74
|
-
if (line.startsWith(COMMIT_MARKER))
|
|
75
|
-
at.commit = line.slice(COMMIT_MARKER.length);
|
|
76
|
-
else if (line.startsWith("diff --git "))
|
|
77
|
-
at.inFileHeader = true;
|
|
78
|
-
else if (at.inFileHeader)
|
|
79
|
-
readFileHeader(line, at);
|
|
80
|
-
else if (line.startsWith("-"))
|
|
81
|
-
return occurrenceAt(line, at.oldPath, at.oldLine++, at.commit);
|
|
82
|
-
else if (line.startsWith("+"))
|
|
83
|
-
return occurrenceAt(line, at.newPath, at.newLine++, at.commit);
|
|
84
|
-
else if (line.startsWith("@@ "))
|
|
85
|
-
readHunkHeader(line, at);
|
|
86
|
-
return undefined;
|
|
87
|
-
}
|
|
88
|
-
function readFileHeader(line, at) {
|
|
89
|
-
if (line.startsWith("--- "))
|
|
90
|
-
at.oldPath = pathOf(line);
|
|
91
|
-
else if (line.startsWith("+++ "))
|
|
92
|
-
at.newPath = pathOf(line);
|
|
93
|
-
else if (line.startsWith("@@ ")) {
|
|
94
|
-
at.inFileHeader = false;
|
|
95
|
-
readHunkHeader(line, at);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
function pathOf(header) {
|
|
99
|
-
return header.slice(4).replace(/^[ab]\//, "");
|
|
100
|
-
}
|
|
101
|
-
function readHunkHeader(line, at) {
|
|
102
|
-
const match = /@@ -(\d+)(?:,\d+)? \+(\d+)/.exec(line);
|
|
103
|
-
at.oldLine = Number(match?.[1] ?? 0);
|
|
104
|
-
at.newLine = Number(match?.[2] ?? 0);
|
|
105
|
-
}
|
|
106
|
-
function occurrenceAt(text, path, line, commit) {
|
|
107
|
-
return { text, path, line, commit };
|
|
108
|
-
}
|
|
109
|
-
//# sourceMappingURL=readHistory.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAE,SA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,MAAM,GAAG,MAAM,EAAE,CAQ7D"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { readFileSync } from "node:fs";
|
|
2
|
-
import { parseFeatureCorpus } from "@3f-consulting/spec-controller-core";
|
|
3
|
-
import { corpusFeatureFiles, MissingFeatureCorpusError } from "../ingest/ingestScenarios.js";
|
|
4
|
-
import { AppMessage } from "../messages.js";
|
|
5
|
-
import { readOrRefuse, refuse, UnparseableFeatureFiles } from "./unreadable.js";
|
|
6
|
-
export function readHeaderCodes(featuresDir) {
|
|
7
|
-
const sources = featureFilesIn(featuresDir).map(({ path }) => ({
|
|
8
|
-
file: path,
|
|
9
|
-
source: readOrRefuse(AppMessage.FeatureFile, path, () => readFileSync(path, "utf8")),
|
|
10
|
-
}));
|
|
11
|
-
const parse = parseFeatureCorpus(sources);
|
|
12
|
-
if (parse.kind === "unparseable")
|
|
13
|
-
throw new UnparseableFeatureFiles(parse.faults);
|
|
14
|
-
return parse.parsed.flatMap(({ featureCode }) => (featureCode === null ? [] : [featureCode]));
|
|
15
|
-
}
|
|
16
|
-
function featureFilesIn(dir) {
|
|
17
|
-
try {
|
|
18
|
-
return corpusFeatureFiles(dir);
|
|
19
|
-
}
|
|
20
|
-
catch (err) {
|
|
21
|
-
if (err instanceof MissingFeatureCorpusError)
|
|
22
|
-
return [];
|
|
23
|
-
return refuse(AppMessage.FeatureCorpus, dir, err);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
//# sourceMappingURL=readParts.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"readParts.js","sourceRoot":"","sources":["../../src/cli-allocate/readParts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,EAAE,kBAAkB,EAAE,yBAAyB,EAA0B,MAAM,8BAA8B,CAAC;AACrH,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAEhF,MAAM,UAAU,eAAe,CAAC,WAAmB;IACjD,MAAM,OAAO,GAAG,cAAc,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;QAC7D,IAAI,EAAE,IAAI;QACV,MAAM,EAAE,YAAY,CAAC,UAAU,CAAC,WAAW,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;KACrF,CAAC,CAAC,CAAC;IACJ,MAAM,KAAK,GAAG,kBAAkB,CAAC,OAAO,CAAC,CAAC;IAC1C,IAAI,KAAK,CAAC,IAAI,KAAK,aAAa;QAAE,MAAM,IAAI,uBAAuB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAClF,OAAO,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC,CAAC,WAAW,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;AAChG,CAAC;AAED,SAAS,cAAc,CAAC,GAAW;IACjC,IAAI,CAAC;QACH,OAAO,kBAAkB,CAAC,GAAG,CAAC,CAAC;IACjC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,GAAG,YAAY,yBAAyB;YAAE,OAAO,EAAE,CAAC;QACxD,OAAO,MAAM,CAAC,UAAU,CAAC,aAAa,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;IACpD,CAAC;AACH,CAAC"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { ScnOccurrence } from "@3f-consulting/spec-controller-core";
|
|
2
|
-
export declare function readTree(top: string, part: string): ScnOccurrence[];
|
|
3
|
-
export declare function isWalkedDirectory(name: string): boolean;
|
|
4
|
-
export declare function walkTree(root: string, part: string): ScnOccurrence[];
|
|
5
|
-
//# sourceMappingURL=readTree.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"readTree.d.ts","sourceRoot":"","sources":["../../src/cli-allocate/readTree.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AAQzE,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,aAAa,EAAE,CAKnE;AA6CD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEvD;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,aAAa,EAAE,CAKpE"}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { spawnSync } from "node:child_process";
|
|
2
|
-
import { accessSync, constants, lstatSync, readdirSync, readFileSync } from "node:fs";
|
|
3
|
-
import { join, relative, sep } from "node:path";
|
|
4
|
-
import { APP_MESSAGES, AppMessage } from "../messages.js";
|
|
5
|
-
import { firstLine, readOrRefuse, refuse, UnreadableInput } from "./unreadable.js";
|
|
6
|
-
const MAX_OUTPUT_BYTES = 1024 * 1024 * 1024;
|
|
7
|
-
const BINARY_PROBE_BYTES = 8000;
|
|
8
|
-
export function readTree(top, part) {
|
|
9
|
-
const listed = gitListing(top, ["ls-files", "-z", "--cached", "--others", "--exclude-standard"]);
|
|
10
|
-
const ignored = gitListing(top, ["ls-files", "-z", "--others", "--ignored", "--exclude-standard", "--directory"]);
|
|
11
|
-
proveListable(top, "", new Set(ignored.filter(isDirectoryEntry).map((entry) => entry.slice(0, -1))));
|
|
12
|
-
return listed.flatMap((path) => occurrencesInListed(top, path, `SCN-${part}-`));
|
|
13
|
-
}
|
|
14
|
-
function gitListing(top, args) {
|
|
15
|
-
const result = spawnSync("git", args, { cwd: top, encoding: "utf8", maxBuffer: MAX_OUTPUT_BYTES });
|
|
16
|
-
if (result.error !== undefined)
|
|
17
|
-
refuse(AppMessage.Tree, top, result.error);
|
|
18
|
-
if (result.status !== 0) {
|
|
19
|
-
throw new UnreadableInput(AppMessage.Tree, top, APP_MESSAGES[AppMessage.GitExited](args, result.status, firstLine(result.stderr)));
|
|
20
|
-
}
|
|
21
|
-
return result.stdout.split("\0");
|
|
22
|
-
}
|
|
23
|
-
function isDirectoryEntry(entry) {
|
|
24
|
-
return entry.endsWith("/");
|
|
25
|
-
}
|
|
26
|
-
function proveListable(top, dir, ignored) {
|
|
27
|
-
const path = join(top, dir);
|
|
28
|
-
const entries = readOrRefuse(AppMessage.TreeDirectory, path, () => listedAndEntered(path));
|
|
29
|
-
if (dir !== "" && entries.some((entry) => entry.name === ".git"))
|
|
30
|
-
return;
|
|
31
|
-
for (const entry of entries) {
|
|
32
|
-
const child = dir === "" ? entry.name : `${dir}/${entry.name}`;
|
|
33
|
-
if (entry.isDirectory() && entry.name !== ".git" && !ignored.has(child))
|
|
34
|
-
proveListable(top, child, ignored);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
function listedAndEntered(path) {
|
|
38
|
-
accessSync(path, constants.R_OK | constants.X_OK);
|
|
39
|
-
return readdirSync(path, { withFileTypes: true });
|
|
40
|
-
}
|
|
41
|
-
function occurrencesInListed(top, path, needle) {
|
|
42
|
-
const file = join(top, path);
|
|
43
|
-
const kind = readOrRefuse(AppMessage.TreeFile, file, () => lstatSync(file, { throwIfNoEntry: false }));
|
|
44
|
-
if (kind === undefined || !kind.isFile())
|
|
45
|
-
return [];
|
|
46
|
-
return linesCarrying(path, readOrRefuse(AppMessage.TreeFile, file, () => readFileSync(file)), needle);
|
|
47
|
-
}
|
|
48
|
-
function linesCarrying(path, content, needle) {
|
|
49
|
-
if (content.subarray(0, BINARY_PROBE_BYTES).includes(0))
|
|
50
|
-
return [];
|
|
51
|
-
return content
|
|
52
|
-
.toString("utf8")
|
|
53
|
-
.split("\n")
|
|
54
|
-
.flatMap((line, i) => (line.includes(needle) ? [{ path, line: i + 1, text: line }] : []));
|
|
55
|
-
}
|
|
56
|
-
export function isWalkedDirectory(name) {
|
|
57
|
-
return name !== "node_modules" && !name.startsWith(".");
|
|
58
|
-
}
|
|
59
|
-
export function walkTree(root, part) {
|
|
60
|
-
return filesUnder(root).flatMap((file) => {
|
|
61
|
-
const content = readOrRefuse(AppMessage.TreeFile, file, () => readFileSync(file));
|
|
62
|
-
return linesCarrying(relative(root, file).split(sep).join("/"), content, `SCN-${part}-`);
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
function filesUnder(dir) {
|
|
66
|
-
const entries = readOrRefuse(AppMessage.TreeDirectory, dir, () => readdirSync(dir, { withFileTypes: true }));
|
|
67
|
-
return entries.flatMap((entry) => {
|
|
68
|
-
const path = join(dir, entry.name);
|
|
69
|
-
if (entry.isDirectory())
|
|
70
|
-
return isWalkedDirectory(entry.name) ? filesUnder(path) : [];
|
|
71
|
-
return entry.isFile() ? [path] : [];
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
//# sourceMappingURL=readTree.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEnF,MAAM,gBAAgB,GAAG,IA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appings":"AAQA,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAInD"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { spawnSync } from "node:child_process";
|
|
2
|
-
import { lstatSync, readdirSync, readFileSync } from "node:fs";
|
|
3
|
-
import { join } from "node:path";
|
|
4
|
-
import { AppMessage } from "../messages.js";
|
|
5
|
-
import { readOrRefuse } from "./unreadable.js";
|
|
6
|
-
const REF_STORES = ["refs", "packed-refs", "reftable"];
|
|
7
|
-
export function proveRefsReadable(cwd) {
|
|
8
|
-
for (const gitDir of gitDirsOf(cwd)) {
|
|
9
|
-
for (const store of REF_STORES)
|
|
10
|
-
readEveryEntry(join(gitDir, store));
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
function gitDirsOf(cwd) {
|
|
14
|
-
const result = spawnSync("git", ["rev-parse", "--path-format=absolute", "--git-common-dir", "--git-dir"], {
|
|
15
|
-
cwd,
|
|
16
|
-
encoding: "utf8",
|
|
17
|
-
});
|
|
18
|
-
if (result.status !== 0)
|
|
19
|
-
return [];
|
|
20
|
-
return [...new Set(result.stdout.split("\n").filter((line) => line !== ""))];
|
|
21
|
-
}
|
|
22
|
-
function readEveryEntry(path) {
|
|
23
|
-
const kind = readOrRefuse(AppMessage.History, path, () => lstatSync(path, { throwIfNoEntry: false }));
|
|
24
|
-
if (kind === undefined)
|
|
25
|
-
return;
|
|
26
|
-
if (kind.isDirectory()) {
|
|
27
|
-
const names = readOrRefuse(AppMessage.History, path, () => readdirSync(path));
|
|
28
|
-
for (const name of names)
|
|
29
|
-
readEveryEntry(join(path, name));
|
|
30
|
-
}
|
|
31
|
-
else if (kind.isFile()) {
|
|
32
|
-
readOrRefuse(AppMessage.History, path, () => readFileSync(path));
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
//# sourceMappingURL=refStore.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"refStore.js","sourceRoot":"","sources":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AE,KAAK,EAAE,CAAC,CAAC,CAAC;IACtG,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO;IAC/B,IAAI,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;QACvB,MAAM,KAAK,GAAG,YAAY,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;QAC9E,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,UAAU,CAAC,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC;IACnE,CAAC;AACH,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { CliRegistry } from "../cli-registry.js";
|
|
2
|
-
export interface AllocateRequest {
|
|
3
|
-
readonly part: string;
|
|
4
|
-
readonly isNew: boolean;
|
|
5
|
-
}
|
|
6
|
-
export declare function readRequest(argv: readonly string[], registry: CliRegistry, toolVersion: string): AllocateRequest | {
|
|
7
|
-
readonly usageError: string;
|
|
8
|
-
};
|
|
9
|
-
//# sourceMappingURL=request.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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;AAGtD,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,23 +0,0 @@
|
|
|
1
|
-
import { isFeaturePart } from "@3f-consulting/spec-controller-core";
|
|
2
|
-
import { checkArgvShape, checkMisplacedHostModifiers, checkUnknownFlags, parseArgs, positionalArguments, } from "../cli-args.js";
|
|
3
|
-
import { APP_MESSAGES, AppMessage } from "../messages.js";
|
|
4
|
-
export function readRequest(argv, registry, toolVersion) {
|
|
5
|
-
const why = argvRefusal(argv, registry, toolVersion) ?? partRefusal(positionalArguments(argv, registry, "allocate")[0]);
|
|
6
|
-
if (why !== null)
|
|
7
|
-
return { usageError: APP_MESSAGES[AppMessage.UsageError]("allocate", why) };
|
|
8
|
-
return { part: positionalArguments(argv, registry, "allocate")[0] ?? "", isNew: argv.includes("--new") };
|
|
9
|
-
}
|
|
10
|
-
function argvRefusal(argv, registry, toolVersion) {
|
|
11
|
-
const args = parseArgs(argv);
|
|
12
|
-
return (checkMisplacedHostModifiers(args, registry, "allocate") ??
|
|
13
|
-
checkArgvShape(argv, registry, "allocate") ??
|
|
14
|
-
checkUnknownFlags(args, registry, "allocate", toolVersion));
|
|
15
|
-
}
|
|
16
|
-
function partRefusal(part) {
|
|
17
|
-
if (part === undefined)
|
|
18
|
-
return APP_MESSAGES[AppMessage.NoFeaturePartGiven]();
|
|
19
|
-
if (isFeaturePart(part))
|
|
20
|
-
return null;
|
|
21
|
-
return APP_MESSAGES[AppMessage.NotAFeaturePart](part);
|
|
22
|
-
}
|
|
23
|
-
//# sourceMappingURL=request.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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,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CAAC,CAAC;AACxD,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { type Allocation, type UnknownPart } from "@3f-consulting/spec-controller-core";
|
|
2
|
-
import type { HistoryBoundary } from "./readHistory.js";
|
|
3
|
-
export declare function historyBoundaryLine(boundary: HistoryBoundary, allocation: Allocation): string | null;
|
|
4
|
-
export declare function highestSeenLine(allocation: Allocation): string;
|
|
5
|
-
export declare function unknownPartRefusal(refusal: UnknownPart): string;
|
|
6
|
-
export declare function alreadyHeadedNote(allocation: Allocation): string | null;
|
|
7
|
-
//# sourceMappingURL=stderr.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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;AAEvG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAExD,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,eAAe,EAAE,UAAU,EAAE,UAAU,GAAG,MAAM,GAAG,IAAI,CAWpG;AAED,wBAAgB,eAAe,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,CAO9D;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,CAG/D;AAED,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,GAAG,IAAI,CAGvE"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { featureCodeOf } from "@3f-consulting/spec-controller-core";
|
|
2
|
-
import { APP_MESSAGES, AppMessage } from "../messages.js";
|
|
3
|
-
export function historyBoundaryLine(boundary, allocation) {
|
|
4
|
-
if (boundary.kind === "complete")
|
|
5
|
-
return null;
|
|
6
|
-
const unread = boundary.kind === "shallow"
|
|
7
|
-
? APP_MESSAGES[AppMessage.ShallowHistoryUnread](boundary.before)
|
|
8
|
-
: APP_MESSAGES[AppMessage.NoRepositoryHistoryRead]();
|
|
9
|
-
const risk = allocation.highest === null
|
|
10
|
-
? APP_MESSAGES[AppMessage.RiskOfPartCode](featureCodeOf(allocation.code) ?? "")
|
|
11
|
-
: APP_MESSAGES[AppMessage.RiskAboveCode](allocation.highest.code);
|
|
12
|
-
return APP_MESSAGES[AppMessage.HistoryBoundary](unread, risk);
|
|
13
|
-
}
|
|
14
|
-
export function highestSeenLine(allocation) {
|
|
15
|
-
const highest = allocation.highest;
|
|
16
|
-
if (highest === null)
|
|
17
|
-
return APP_MESSAGES[AppMessage.HighestSeenNone]();
|
|
18
|
-
const { path, line, commit } = highest.occurrence;
|
|
19
|
-
return commit === undefined
|
|
20
|
-
? APP_MESSAGES[AppMessage.HighestSeenInTree](highest.code, path, line)
|
|
21
|
-
: APP_MESSAGES[AppMessage.HighestSeenInCommit](highest.code, path, line, commit);
|
|
22
|
-
}
|
|
23
|
-
export function unknownPartRefusal(refusal) {
|
|
24
|
-
const parts = refusal.headerCodes.length === 0 ? APP_MESSAGES[AppMessage.NoPartsCarried]() : refusal.headerCodes.join(", ");
|
|
25
|
-
return APP_MESSAGES[AppMessage.UnknownPartRefused](refusal.part, parts);
|
|
26
|
-
}
|
|
27
|
-
export function alreadyHeadedNote(allocation) {
|
|
28
|
-
if (allocation.alreadyHeaded !== true)
|
|
29
|
-
return null;
|
|
30
|
-
return APP_MESSAGES[AppMessage.PartAlreadyHeaded](featureCodeOf(allocation.code) ?? "");
|
|
31
|
-
}
|
|
32
|
-
//# sourceMappingURL=stderr.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stderr.js","sourceRoot":"","sources":["../../src/cli-allocate/stderr.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAqC,MAAM,qCAAqC,CAAC;AACvG,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAG1D,MAAM,UAAU,mBAAmB,CAAC,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CAAC,OAAoB;IACrD,MAAM,KAAK,GAAG,OAAO,CAAC,WAAW,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,UAAU,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC5H,OAAO,YAAY,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AAC1E,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,UAAsB;IACtD,IAAI,UAAU,CAAC,aAAa,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IACnD,OAAO,YAAY,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC,aAAa,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;AAC1F,CAAC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { SourceFault } from "@3f-consulting/spec-controller-core";
|
|
2
|
-
import { type Unreadable } from "../messages.js";
|
|
3
|
-
export declare class UnreadableInput extends Error {
|
|
4
|
-
readonly path: string;
|
|
5
|
-
readonly reason: string;
|
|
6
|
-
readonly name = "UnreadableInput";
|
|
7
|
-
readonly subject: string;
|
|
8
|
-
constructor(what: Unreadable, path: string, reason: string);
|
|
9
|
-
}
|
|
10
|
-
export declare class UnparseableFeatureFiles extends Error {
|
|
11
|
-
readonly faults: readonly SourceFault[];
|
|
12
|
-
readonly name = "UnparseableFeatureFiles";
|
|
13
|
-
constructor(faults: readonly SourceFault[]);
|
|
14
|
-
}
|
|
15
|
-
export declare function readOrRefuse<T>(what: Unreadable, path: string, read: () => T): T;
|
|
16
|
-
export declare function refuse(what: Unreadable, path: string, err: unknown): never;
|
|
17
|
-
export declare function refusalLine(refusal: UnreadableInput | UnparseableFeatureFiles): string;
|
|
18
|
-
export declare function firstLine(text: string): string;
|
|
19
|
-
//# sourceMappingURL=unreadable.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"unreadable.d.ts","sourceRoot":"","sources":["../../src/cli-allocate/unreadable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAiD,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEhG,qBAAa,eAAgB,SAAQ,KAAK;IAMtC,QAAQ,CAAC,IAAI,EAAE,MAAM;IACrB,QAAQ,CAAC,MAAM,EAAE,MAAM;IANzB,SAAkB,IAAI,qBAAqB;IAC3C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;gBAGvB,IAAI,EAAE,UAAU,EACP,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM;CAU1B;AAED,qBAAa,uBAAwB,SAAQ,KAAK;IAGpC,QAAQ,CAAC,MAAM,EAAE,SAAS,WAAW,EAAE;IAFnD,SAAkB,IAAI,6BAA6B;gBAE9B,MAAM,EAAE,SAAS,WAAW,EAAE;CASpD;AAED,wBAAgB,YAAY,CAAC,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,CAMhF;AAED,wBAAgB,MAAM,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,GAAG,KAAK,CAI1E;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,eAAe,GAAG,uBAAuB,GAAG,MAAM,CAEtF;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE9C"}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { APP_MESSAGES, AppMessage, UNREADABLE_SUBJECTS } from "../messages.js";
|
|
2
|
-
export class UnreadableInput extends Error {
|
|
3
|
-
path;
|
|
4
|
-
reason;
|
|
5
|
-
name = "UnreadableInput";
|
|
6
|
-
subject;
|
|
7
|
-
constructor(what, path, reason) {
|
|
8
|
-
const subject = UNREADABLE_SUBJECTS[what];
|
|
9
|
-
super(path === ""
|
|
10
|
-
? APP_MESSAGES[AppMessage.CouldNotBeRead](subject, reason)
|
|
11
|
-
: APP_MESSAGES[AppMessage.CouldNotBeReadAt](subject, path, reason));
|
|
12
|
-
this.path = path;
|
|
13
|
-
this.reason = reason;
|
|
14
|
-
this.subject = subject;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
export class UnparseableFeatureFiles extends Error {
|
|
18
|
-
faults;
|
|
19
|
-
name = "UnparseableFeatureFiles";
|
|
20
|
-
constructor(faults) {
|
|
21
|
-
super(faults
|
|
22
|
-
.map(({ file, message }) => APP_MESSAGES[AppMessage.CorpusFileUnparseable](UNREADABLE_SUBJECTS[AppMessage.FeatureCorpus], file, message))
|
|
23
|
-
.join("\n"));
|
|
24
|
-
this.faults = faults;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
export function readOrRefuse(what, path, read) {
|
|
28
|
-
try {
|
|
29
|
-
return read();
|
|
30
|
-
}
|
|
31
|
-
catch (err) {
|
|
32
|
-
return refuse(what, path, err);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
export function refuse(what, path, err) {
|
|
36
|
-
const errno = err;
|
|
37
|
-
if (!(err instanceof Error) || typeof errno.code !== "string")
|
|
38
|
-
throw err;
|
|
39
|
-
throw new UnreadableInput(what, errno.path ?? path, err.message);
|
|
40
|
-
}
|
|
41
|
-
export function refusalLine(refusal) {
|
|
42
|
-
return APP_MESSAGES[AppMessage.UsageError]("allocate", refusal.message);
|
|
43
|
-
}
|
|
44
|
-
export function firstLine(text) {
|
|
45
|
-
return text.split("\n")[0] ?? "";
|
|
46
|
-
}
|
|
47
|
-
//# sourceMappingURL=unreadable.js.map
|