truecourse 0.7.0-next.2 → 0.7.0-next.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.mjs +744 -512
- package/package.json +1 -1
- package/public/assets/index-CMCPeAwv.css +1 -0
- package/public/assets/{index-B4R8yF4j.js → index-rfhWLMD4.js} +223 -218
- package/public/index.html +2 -2
- package/server.mjs +1344 -1011
- package/public/assets/index-D9ShQqXg.css +0 -1
package/cli.mjs
CHANGED
|
@@ -972,8 +972,8 @@ var require_command = __commonJS({
|
|
|
972
972
|
"node_modules/.pnpm/commander@12.1.0/node_modules/commander/lib/command.js"(exports) {
|
|
973
973
|
var EventEmitter2 = __require("node:events").EventEmitter;
|
|
974
974
|
var childProcess = __require("node:child_process");
|
|
975
|
-
var
|
|
976
|
-
var
|
|
975
|
+
var path80 = __require("node:path");
|
|
976
|
+
var fs70 = __require("node:fs");
|
|
977
977
|
var process2 = __require("node:process");
|
|
978
978
|
var { Argument: Argument2, humanReadableArgName } = require_argument();
|
|
979
979
|
var { CommanderError: CommanderError2 } = require_error();
|
|
@@ -1905,11 +1905,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1905
1905
|
let launchWithNode = false;
|
|
1906
1906
|
const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
|
|
1907
1907
|
function findFile(baseDir, baseName) {
|
|
1908
|
-
const localBin =
|
|
1909
|
-
if (
|
|
1910
|
-
if (sourceExt.includes(
|
|
1908
|
+
const localBin = path80.resolve(baseDir, baseName);
|
|
1909
|
+
if (fs70.existsSync(localBin)) return localBin;
|
|
1910
|
+
if (sourceExt.includes(path80.extname(baseName))) return void 0;
|
|
1911
1911
|
const foundExt = sourceExt.find(
|
|
1912
|
-
(ext2) =>
|
|
1912
|
+
(ext2) => fs70.existsSync(`${localBin}${ext2}`)
|
|
1913
1913
|
);
|
|
1914
1914
|
if (foundExt) return `${localBin}${foundExt}`;
|
|
1915
1915
|
return void 0;
|
|
@@ -1921,21 +1921,21 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1921
1921
|
if (this._scriptPath) {
|
|
1922
1922
|
let resolvedScriptPath;
|
|
1923
1923
|
try {
|
|
1924
|
-
resolvedScriptPath =
|
|
1924
|
+
resolvedScriptPath = fs70.realpathSync(this._scriptPath);
|
|
1925
1925
|
} catch (err) {
|
|
1926
1926
|
resolvedScriptPath = this._scriptPath;
|
|
1927
1927
|
}
|
|
1928
|
-
executableDir =
|
|
1929
|
-
|
|
1928
|
+
executableDir = path80.resolve(
|
|
1929
|
+
path80.dirname(resolvedScriptPath),
|
|
1930
1930
|
executableDir
|
|
1931
1931
|
);
|
|
1932
1932
|
}
|
|
1933
1933
|
if (executableDir) {
|
|
1934
1934
|
let localFile = findFile(executableDir, executableFile);
|
|
1935
1935
|
if (!localFile && !subcommand._executableFile && this._scriptPath) {
|
|
1936
|
-
const legacyName =
|
|
1936
|
+
const legacyName = path80.basename(
|
|
1937
1937
|
this._scriptPath,
|
|
1938
|
-
|
|
1938
|
+
path80.extname(this._scriptPath)
|
|
1939
1939
|
);
|
|
1940
1940
|
if (legacyName !== this._name) {
|
|
1941
1941
|
localFile = findFile(
|
|
@@ -1946,7 +1946,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1946
1946
|
}
|
|
1947
1947
|
executableFile = localFile || executableFile;
|
|
1948
1948
|
}
|
|
1949
|
-
launchWithNode = sourceExt.includes(
|
|
1949
|
+
launchWithNode = sourceExt.includes(path80.extname(executableFile));
|
|
1950
1950
|
let proc;
|
|
1951
1951
|
if (process2.platform !== "win32") {
|
|
1952
1952
|
if (launchWithNode) {
|
|
@@ -2786,7 +2786,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2786
2786
|
* @return {Command}
|
|
2787
2787
|
*/
|
|
2788
2788
|
nameFromFilename(filename) {
|
|
2789
|
-
this._name =
|
|
2789
|
+
this._name = path80.basename(filename, path80.extname(filename));
|
|
2790
2790
|
return this;
|
|
2791
2791
|
}
|
|
2792
2792
|
/**
|
|
@@ -2800,9 +2800,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2800
2800
|
* @param {string} [path]
|
|
2801
2801
|
* @return {(string|null|Command)}
|
|
2802
2802
|
*/
|
|
2803
|
-
executableDir(
|
|
2804
|
-
if (
|
|
2805
|
-
this._executableDir =
|
|
2803
|
+
executableDir(path81) {
|
|
2804
|
+
if (path81 === void 0) return this._executableDir;
|
|
2805
|
+
this._executableDir = path81;
|
|
2806
2806
|
return this;
|
|
2807
2807
|
}
|
|
2808
2808
|
/**
|
|
@@ -5206,8 +5206,8 @@ var init_parseUtil = __esm({
|
|
|
5206
5206
|
init_errors();
|
|
5207
5207
|
init_en();
|
|
5208
5208
|
makeIssue = (params) => {
|
|
5209
|
-
const { data, path:
|
|
5210
|
-
const fullPath = [...
|
|
5209
|
+
const { data, path: path80, errorMaps, issueData } = params;
|
|
5210
|
+
const fullPath = [...path80, ...issueData.path || []];
|
|
5211
5211
|
const fullIssue = {
|
|
5212
5212
|
...issueData,
|
|
5213
5213
|
path: fullPath
|
|
@@ -5515,11 +5515,11 @@ var init_types = __esm({
|
|
|
5515
5515
|
init_parseUtil();
|
|
5516
5516
|
init_util();
|
|
5517
5517
|
ParseInputLazyPath = class {
|
|
5518
|
-
constructor(parent, value,
|
|
5518
|
+
constructor(parent, value, path80, key4) {
|
|
5519
5519
|
this._cachedPath = [];
|
|
5520
5520
|
this.parent = parent;
|
|
5521
5521
|
this.data = value;
|
|
5522
|
-
this._path =
|
|
5522
|
+
this._path = path80;
|
|
5523
5523
|
this._key = key4;
|
|
5524
5524
|
}
|
|
5525
5525
|
get path() {
|
|
@@ -11976,10 +11976,10 @@ var require_src3 = __commonJS({
|
|
|
11976
11976
|
var fs_1 = __require("fs");
|
|
11977
11977
|
var debug_1 = __importDefault(require_src2());
|
|
11978
11978
|
var log2 = debug_1.default("@kwsites/file-exists");
|
|
11979
|
-
function check(
|
|
11980
|
-
log2(`checking %s`,
|
|
11979
|
+
function check(path80, isFile, isDirectory) {
|
|
11980
|
+
log2(`checking %s`, path80);
|
|
11981
11981
|
try {
|
|
11982
|
-
const stat = fs_1.statSync(
|
|
11982
|
+
const stat = fs_1.statSync(path80);
|
|
11983
11983
|
if (stat.isFile() && isFile) {
|
|
11984
11984
|
log2(`[OK] path represents a file`);
|
|
11985
11985
|
return true;
|
|
@@ -11999,8 +11999,8 @@ var require_src3 = __commonJS({
|
|
|
11999
11999
|
throw e;
|
|
12000
12000
|
}
|
|
12001
12001
|
}
|
|
12002
|
-
function exists2(
|
|
12003
|
-
return check(
|
|
12002
|
+
function exists2(path80, type2 = exports.READABLE) {
|
|
12003
|
+
return check(path80, (type2 & exports.FILE) > 0, (type2 & exports.FOLDER) > 0);
|
|
12004
12004
|
}
|
|
12005
12005
|
exports.exists = exists2;
|
|
12006
12006
|
exports.FILE = 1;
|
|
@@ -12073,8 +12073,8 @@ function pathspec(...paths) {
|
|
|
12073
12073
|
cache.set(key4, paths);
|
|
12074
12074
|
return key4;
|
|
12075
12075
|
}
|
|
12076
|
-
function isPathSpec(
|
|
12077
|
-
return
|
|
12076
|
+
function isPathSpec(path80) {
|
|
12077
|
+
return path80 instanceof String && cache.has(path80);
|
|
12078
12078
|
}
|
|
12079
12079
|
function toPaths(pathSpec) {
|
|
12080
12080
|
return cache.get(pathSpec) || [];
|
|
@@ -12118,8 +12118,8 @@ function toLinesWithContent(input = "", trimmed2 = true, separator = "\n") {
|
|
|
12118
12118
|
function forEachLineWithContent(input, callback) {
|
|
12119
12119
|
return toLinesWithContent(input, true).map((line) => callback(line));
|
|
12120
12120
|
}
|
|
12121
|
-
function folderExists(
|
|
12122
|
-
return (0, import_file_exists.exists)(
|
|
12121
|
+
function folderExists(path80) {
|
|
12122
|
+
return (0, import_file_exists.exists)(path80, import_file_exists.FOLDER);
|
|
12123
12123
|
}
|
|
12124
12124
|
function append(target, item) {
|
|
12125
12125
|
if (Array.isArray(target)) {
|
|
@@ -12310,8 +12310,8 @@ function checkIsRepoRootTask() {
|
|
|
12310
12310
|
commands,
|
|
12311
12311
|
format: "utf-8",
|
|
12312
12312
|
onError,
|
|
12313
|
-
parser(
|
|
12314
|
-
return /^\.(git)?$/.test(
|
|
12313
|
+
parser(path80) {
|
|
12314
|
+
return /^\.(git)?$/.test(path80.trim());
|
|
12315
12315
|
}
|
|
12316
12316
|
};
|
|
12317
12317
|
}
|
|
@@ -12567,11 +12567,11 @@ function parseGrep(grep) {
|
|
|
12567
12567
|
const paths = /* @__PURE__ */ new Set();
|
|
12568
12568
|
const results = {};
|
|
12569
12569
|
forEachLineWithContent(grep, (input) => {
|
|
12570
|
-
const [
|
|
12571
|
-
paths.add(
|
|
12572
|
-
(results[
|
|
12570
|
+
const [path80, line, preview] = input.split(NULL);
|
|
12571
|
+
paths.add(path80);
|
|
12572
|
+
(results[path80] = results[path80] || []).push({
|
|
12573
12573
|
line: asNumber(line),
|
|
12574
|
-
path:
|
|
12574
|
+
path: path80,
|
|
12575
12575
|
preview
|
|
12576
12576
|
});
|
|
12577
12577
|
});
|
|
@@ -12868,14 +12868,14 @@ function hashObjectTask(filePath, write) {
|
|
|
12868
12868
|
}
|
|
12869
12869
|
return straightThroughStringTask(commands, true);
|
|
12870
12870
|
}
|
|
12871
|
-
function parseInit(bare,
|
|
12871
|
+
function parseInit(bare, path80, text4) {
|
|
12872
12872
|
const response = String(text4).trim();
|
|
12873
12873
|
let result;
|
|
12874
12874
|
if (result = initResponseRegex.exec(response)) {
|
|
12875
|
-
return new InitSummary(bare,
|
|
12875
|
+
return new InitSummary(bare, path80, false, result[1]);
|
|
12876
12876
|
}
|
|
12877
12877
|
if (result = reInitResponseRegex.exec(response)) {
|
|
12878
|
-
return new InitSummary(bare,
|
|
12878
|
+
return new InitSummary(bare, path80, true, result[1]);
|
|
12879
12879
|
}
|
|
12880
12880
|
let gitDir = "";
|
|
12881
12881
|
const tokens = response.split(" ");
|
|
@@ -12886,12 +12886,12 @@ function parseInit(bare, path79, text4) {
|
|
|
12886
12886
|
break;
|
|
12887
12887
|
}
|
|
12888
12888
|
}
|
|
12889
|
-
return new InitSummary(bare,
|
|
12889
|
+
return new InitSummary(bare, path80, /^re/i.test(response), gitDir);
|
|
12890
12890
|
}
|
|
12891
12891
|
function hasBareCommand(command) {
|
|
12892
12892
|
return command.includes(bareCommand);
|
|
12893
12893
|
}
|
|
12894
|
-
function initTask(bare = false,
|
|
12894
|
+
function initTask(bare = false, path80, customArgs) {
|
|
12895
12895
|
const commands = ["init", ...customArgs];
|
|
12896
12896
|
if (bare && !hasBareCommand(commands)) {
|
|
12897
12897
|
commands.splice(1, 0, bareCommand);
|
|
@@ -12900,7 +12900,7 @@ function initTask(bare = false, path79, customArgs) {
|
|
|
12900
12900
|
commands,
|
|
12901
12901
|
format: "utf-8",
|
|
12902
12902
|
parser(text4) {
|
|
12903
|
-
return parseInit(commands.includes("--bare"),
|
|
12903
|
+
return parseInit(commands.includes("--bare"), path80, text4);
|
|
12904
12904
|
}
|
|
12905
12905
|
};
|
|
12906
12906
|
}
|
|
@@ -13179,14 +13179,14 @@ function splitLine(result, lineStr) {
|
|
|
13179
13179
|
default:
|
|
13180
13180
|
return;
|
|
13181
13181
|
}
|
|
13182
|
-
function data(index, workingDir,
|
|
13182
|
+
function data(index, workingDir, path80) {
|
|
13183
13183
|
const raw = `${index}${workingDir}`;
|
|
13184
13184
|
const handler = parsers6.get(raw);
|
|
13185
13185
|
if (handler) {
|
|
13186
|
-
handler(result,
|
|
13186
|
+
handler(result, path80);
|
|
13187
13187
|
}
|
|
13188
13188
|
if (raw !== "##" && raw !== "!!") {
|
|
13189
|
-
result.files.push(new FileStatusSummary(
|
|
13189
|
+
result.files.push(new FileStatusSummary(path80, index, workingDir));
|
|
13190
13190
|
}
|
|
13191
13191
|
}
|
|
13192
13192
|
}
|
|
@@ -13373,8 +13373,8 @@ function deleteBranchTask(branch, forceDelete = false) {
|
|
|
13373
13373
|
return task;
|
|
13374
13374
|
}
|
|
13375
13375
|
function toPath(input) {
|
|
13376
|
-
const
|
|
13377
|
-
return
|
|
13376
|
+
const path80 = input.trim().replace(/^["']|["']$/g, "");
|
|
13377
|
+
return path80 && normalize(path80);
|
|
13378
13378
|
}
|
|
13379
13379
|
function checkIgnoreTask(paths) {
|
|
13380
13380
|
return {
|
|
@@ -13513,8 +13513,8 @@ function stashListTask(opt = {}, customArgs) {
|
|
|
13513
13513
|
parser: parser4
|
|
13514
13514
|
};
|
|
13515
13515
|
}
|
|
13516
|
-
function addSubModuleTask(repo,
|
|
13517
|
-
return subModuleTask(["add", repo,
|
|
13516
|
+
function addSubModuleTask(repo, path80) {
|
|
13517
|
+
return subModuleTask(["add", repo, path80]);
|
|
13518
13518
|
}
|
|
13519
13519
|
function initSubModuleTask(customArgs) {
|
|
13520
13520
|
return subModuleTask(["init", ...customArgs]);
|
|
@@ -14826,9 +14826,9 @@ var init_esm2 = __esm({
|
|
|
14826
14826
|
"src/lib/responses/InitSummary.ts"() {
|
|
14827
14827
|
"use strict";
|
|
14828
14828
|
InitSummary = class {
|
|
14829
|
-
constructor(bare,
|
|
14829
|
+
constructor(bare, path80, existing, gitDir) {
|
|
14830
14830
|
this.bare = bare;
|
|
14831
|
-
this.path =
|
|
14831
|
+
this.path = path80;
|
|
14832
14832
|
this.existing = existing;
|
|
14833
14833
|
this.gitDir = gitDir;
|
|
14834
14834
|
}
|
|
@@ -15362,12 +15362,12 @@ var init_esm2 = __esm({
|
|
|
15362
15362
|
"use strict";
|
|
15363
15363
|
fromPathRegex = /^(.+)\0(.+)$/;
|
|
15364
15364
|
FileStatusSummary = class {
|
|
15365
|
-
constructor(
|
|
15366
|
-
this.path =
|
|
15365
|
+
constructor(path80, index, working_dir) {
|
|
15366
|
+
this.path = path80;
|
|
15367
15367
|
this.index = index;
|
|
15368
15368
|
this.working_dir = working_dir;
|
|
15369
15369
|
if (index === "R" || working_dir === "R") {
|
|
15370
|
-
const detail = fromPathRegex.exec(
|
|
15370
|
+
const detail = fromPathRegex.exec(path80) || [null, path80, path80];
|
|
15371
15371
|
this.from = detail[2] || "";
|
|
15372
15372
|
this.path = detail[1] || "";
|
|
15373
15373
|
}
|
|
@@ -15630,9 +15630,9 @@ var init_esm2 = __esm({
|
|
|
15630
15630
|
next
|
|
15631
15631
|
);
|
|
15632
15632
|
}
|
|
15633
|
-
hashObject(
|
|
15633
|
+
hashObject(path80, write) {
|
|
15634
15634
|
return this._runTask(
|
|
15635
|
-
hashObjectTask(
|
|
15635
|
+
hashObjectTask(path80, write === true),
|
|
15636
15636
|
trailingFunctionArgument(arguments)
|
|
15637
15637
|
);
|
|
15638
15638
|
}
|
|
@@ -16269,8 +16269,8 @@ var init_esm2 = __esm({
|
|
|
16269
16269
|
}
|
|
16270
16270
|
return this._runTask(straightThroughStringTask2(command, this._trimmed), next);
|
|
16271
16271
|
};
|
|
16272
|
-
Git2.prototype.submoduleAdd = function(repo,
|
|
16273
|
-
return this._runTask(addSubModuleTask2(repo,
|
|
16272
|
+
Git2.prototype.submoduleAdd = function(repo, path80, then) {
|
|
16273
|
+
return this._runTask(addSubModuleTask2(repo, path80), trailingFunctionArgument2(arguments));
|
|
16274
16274
|
};
|
|
16275
16275
|
Git2.prototype.submoduleUpdate = function(args, then) {
|
|
16276
16276
|
return this._runTask(
|
|
@@ -16896,7 +16896,7 @@ var require_ignore = __commonJS({
|
|
|
16896
16896
|
// path matching.
|
|
16897
16897
|
// - check `string` either `MODE_IGNORE` or `MODE_CHECK_IGNORE`
|
|
16898
16898
|
// @returns {TestResult} true if a file is ignored
|
|
16899
|
-
test(
|
|
16899
|
+
test(path80, checkUnignored, mode) {
|
|
16900
16900
|
let ignored = false;
|
|
16901
16901
|
let unignored = false;
|
|
16902
16902
|
let matchedRule;
|
|
@@ -16905,7 +16905,7 @@ var require_ignore = __commonJS({
|
|
|
16905
16905
|
if (unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored) {
|
|
16906
16906
|
return;
|
|
16907
16907
|
}
|
|
16908
|
-
const matched = rule[mode].test(
|
|
16908
|
+
const matched = rule[mode].test(path80);
|
|
16909
16909
|
if (!matched) {
|
|
16910
16910
|
return;
|
|
16911
16911
|
}
|
|
@@ -16926,17 +16926,17 @@ var require_ignore = __commonJS({
|
|
|
16926
16926
|
var throwError2 = (message, Ctor) => {
|
|
16927
16927
|
throw new Ctor(message);
|
|
16928
16928
|
};
|
|
16929
|
-
var checkPath = (
|
|
16930
|
-
if (!isString(
|
|
16929
|
+
var checkPath = (path80, originalPath, doThrow) => {
|
|
16930
|
+
if (!isString(path80)) {
|
|
16931
16931
|
return doThrow(
|
|
16932
16932
|
`path must be a string, but got \`${originalPath}\``,
|
|
16933
16933
|
TypeError
|
|
16934
16934
|
);
|
|
16935
16935
|
}
|
|
16936
|
-
if (!
|
|
16936
|
+
if (!path80) {
|
|
16937
16937
|
return doThrow(`path must not be empty`, TypeError);
|
|
16938
16938
|
}
|
|
16939
|
-
if (checkPath.isNotRelative(
|
|
16939
|
+
if (checkPath.isNotRelative(path80)) {
|
|
16940
16940
|
const r = "`path.relative()`d";
|
|
16941
16941
|
return doThrow(
|
|
16942
16942
|
`path should be a ${r} string, but got "${originalPath}"`,
|
|
@@ -16945,7 +16945,7 @@ var require_ignore = __commonJS({
|
|
|
16945
16945
|
}
|
|
16946
16946
|
return true;
|
|
16947
16947
|
};
|
|
16948
|
-
var isNotRelative = (
|
|
16948
|
+
var isNotRelative = (path80) => REGEX_TEST_INVALID_PATH.test(path80);
|
|
16949
16949
|
checkPath.isNotRelative = isNotRelative;
|
|
16950
16950
|
checkPath.convert = (p2) => p2;
|
|
16951
16951
|
var Ignore = class {
|
|
@@ -16975,19 +16975,19 @@ var require_ignore = __commonJS({
|
|
|
16975
16975
|
}
|
|
16976
16976
|
// @returns {TestResult}
|
|
16977
16977
|
_test(originalPath, cache3, checkUnignored, slices) {
|
|
16978
|
-
const
|
|
16978
|
+
const path80 = originalPath && checkPath.convert(originalPath);
|
|
16979
16979
|
checkPath(
|
|
16980
|
-
|
|
16980
|
+
path80,
|
|
16981
16981
|
originalPath,
|
|
16982
16982
|
this._strictPathCheck ? throwError2 : RETURN_FALSE
|
|
16983
16983
|
);
|
|
16984
|
-
return this._t(
|
|
16984
|
+
return this._t(path80, cache3, checkUnignored, slices);
|
|
16985
16985
|
}
|
|
16986
|
-
checkIgnore(
|
|
16987
|
-
if (!REGEX_TEST_TRAILING_SLASH.test(
|
|
16988
|
-
return this.test(
|
|
16986
|
+
checkIgnore(path80) {
|
|
16987
|
+
if (!REGEX_TEST_TRAILING_SLASH.test(path80)) {
|
|
16988
|
+
return this.test(path80);
|
|
16989
16989
|
}
|
|
16990
|
-
const slices =
|
|
16990
|
+
const slices = path80.split(SLASH).filter(Boolean);
|
|
16991
16991
|
slices.pop();
|
|
16992
16992
|
if (slices.length) {
|
|
16993
16993
|
const parent = this._t(
|
|
@@ -17000,18 +17000,18 @@ var require_ignore = __commonJS({
|
|
|
17000
17000
|
return parent;
|
|
17001
17001
|
}
|
|
17002
17002
|
}
|
|
17003
|
-
return this._rules.test(
|
|
17003
|
+
return this._rules.test(path80, false, MODE_CHECK_IGNORE);
|
|
17004
17004
|
}
|
|
17005
|
-
_t(
|
|
17006
|
-
if (
|
|
17007
|
-
return cache3[
|
|
17005
|
+
_t(path80, cache3, checkUnignored, slices) {
|
|
17006
|
+
if (path80 in cache3) {
|
|
17007
|
+
return cache3[path80];
|
|
17008
17008
|
}
|
|
17009
17009
|
if (!slices) {
|
|
17010
|
-
slices =
|
|
17010
|
+
slices = path80.split(SLASH).filter(Boolean);
|
|
17011
17011
|
}
|
|
17012
17012
|
slices.pop();
|
|
17013
17013
|
if (!slices.length) {
|
|
17014
|
-
return cache3[
|
|
17014
|
+
return cache3[path80] = this._rules.test(path80, checkUnignored, MODE_IGNORE);
|
|
17015
17015
|
}
|
|
17016
17016
|
const parent = this._t(
|
|
17017
17017
|
slices.join(SLASH) + SLASH,
|
|
@@ -17019,29 +17019,29 @@ var require_ignore = __commonJS({
|
|
|
17019
17019
|
checkUnignored,
|
|
17020
17020
|
slices
|
|
17021
17021
|
);
|
|
17022
|
-
return cache3[
|
|
17022
|
+
return cache3[path80] = parent.ignored ? parent : this._rules.test(path80, checkUnignored, MODE_IGNORE);
|
|
17023
17023
|
}
|
|
17024
|
-
ignores(
|
|
17025
|
-
return this._test(
|
|
17024
|
+
ignores(path80) {
|
|
17025
|
+
return this._test(path80, this._ignoreCache, false).ignored;
|
|
17026
17026
|
}
|
|
17027
17027
|
createFilter() {
|
|
17028
|
-
return (
|
|
17028
|
+
return (path80) => !this.ignores(path80);
|
|
17029
17029
|
}
|
|
17030
17030
|
filter(paths) {
|
|
17031
17031
|
return makeArray(paths).filter(this.createFilter());
|
|
17032
17032
|
}
|
|
17033
17033
|
// @returns {TestResult}
|
|
17034
|
-
test(
|
|
17035
|
-
return this._test(
|
|
17034
|
+
test(path80) {
|
|
17035
|
+
return this._test(path80, this._testCache, true);
|
|
17036
17036
|
}
|
|
17037
17037
|
};
|
|
17038
17038
|
var factory = (options) => new Ignore(options);
|
|
17039
|
-
var isPathValid = (
|
|
17039
|
+
var isPathValid = (path80) => checkPath(path80 && checkPath.convert(path80), path80, RETURN_FALSE);
|
|
17040
17040
|
var setupWindows = () => {
|
|
17041
17041
|
const makePosix = (str2) => /^\\\\\?\\/.test(str2) || /["<>|\u0000-\u001F]+/u.test(str2) ? str2 : str2.replace(/\\/g, "/");
|
|
17042
17042
|
checkPath.convert = makePosix;
|
|
17043
17043
|
const REGEX_TEST_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i;
|
|
17044
|
-
checkPath.isNotRelative = (
|
|
17044
|
+
checkPath.isNotRelative = (path80) => REGEX_TEST_WINDOWS_PATH_ABSOLUTE.test(path80) || isNotRelative(path80);
|
|
17045
17045
|
};
|
|
17046
17046
|
if (
|
|
17047
17047
|
// Detect `process` so that it can run in browsers.
|
|
@@ -18782,18 +18782,18 @@ function extractRouterMount(callNode, filePath) {
|
|
|
18782
18782
|
const routerName = args[0]?.type === "identifier" ? args[0].text : null;
|
|
18783
18783
|
if (!routerName)
|
|
18784
18784
|
return null;
|
|
18785
|
-
let
|
|
18785
|
+
let path80 = "/";
|
|
18786
18786
|
for (const arg of args) {
|
|
18787
18787
|
if (arg.type === "keyword_argument") {
|
|
18788
18788
|
const key4 = arg.childForFieldName("name")?.text;
|
|
18789
18789
|
const value = arg.childForFieldName("value");
|
|
18790
18790
|
if ((key4 === "url_prefix" || key4 === "prefix") && value) {
|
|
18791
|
-
|
|
18791
|
+
path80 = value.text.replace(/^["']|["']$/g, "");
|
|
18792
18792
|
}
|
|
18793
18793
|
}
|
|
18794
18794
|
}
|
|
18795
18795
|
return {
|
|
18796
|
-
path:
|
|
18796
|
+
path: path80,
|
|
18797
18797
|
routerName,
|
|
18798
18798
|
location: {
|
|
18799
18799
|
filePath,
|
|
@@ -18817,11 +18817,11 @@ function extractChainedRoute(outerCall, filePath) {
|
|
|
18817
18817
|
const innerArgs = innerCall.childForFieldName("arguments");
|
|
18818
18818
|
if (!innerArgs)
|
|
18819
18819
|
return null;
|
|
18820
|
-
let
|
|
18820
|
+
let path80 = null;
|
|
18821
18821
|
let httpMethod = methodName3 === "route" ? "GET" : methodName3.toUpperCase();
|
|
18822
18822
|
for (const arg of innerArgs.namedChildren) {
|
|
18823
|
-
if (!
|
|
18824
|
-
|
|
18823
|
+
if (!path80 && arg.type === "string") {
|
|
18824
|
+
path80 = arg.text.replace(/^["']|["']$/g, "");
|
|
18825
18825
|
}
|
|
18826
18826
|
if (arg.type === "keyword_argument") {
|
|
18827
18827
|
const key4 = arg.childForFieldName("name")?.text;
|
|
@@ -18833,14 +18833,14 @@ function extractChainedRoute(outerCall, filePath) {
|
|
|
18833
18833
|
}
|
|
18834
18834
|
}
|
|
18835
18835
|
}
|
|
18836
|
-
if (!
|
|
18836
|
+
if (!path80)
|
|
18837
18837
|
return null;
|
|
18838
18838
|
const outerArgs = outerCall.childForFieldName("arguments");
|
|
18839
18839
|
const handlerArg = outerArgs?.namedChildren[0];
|
|
18840
18840
|
const handlerName = handlerArg?.type === "identifier" ? handlerArg.text : "anonymous";
|
|
18841
18841
|
return {
|
|
18842
18842
|
httpMethod,
|
|
18843
|
-
path:
|
|
18843
|
+
path: path80,
|
|
18844
18844
|
handlerName,
|
|
18845
18845
|
location: {
|
|
18846
18846
|
filePath,
|
|
@@ -18902,11 +18902,11 @@ function collectGroupPrefixes(root2) {
|
|
|
18902
18902
|
const fn = child.childForFieldName("function");
|
|
18903
18903
|
if (fn?.type === "member_access_expression" && fn.childForFieldName("name")?.text === "MapGroup") {
|
|
18904
18904
|
const args = child.childForFieldName("arguments");
|
|
18905
|
-
const
|
|
18906
|
-
if (name &&
|
|
18905
|
+
const path80 = args ? extractFirstStringArg(args) : null;
|
|
18906
|
+
if (name && path80) {
|
|
18907
18907
|
const receiver = fn.childForFieldName("expression")?.text ?? "";
|
|
18908
18908
|
const parentPrefix = prefixes.get(receiver) ?? "";
|
|
18909
|
-
prefixes.set(name, joinRoute(parentPrefix,
|
|
18909
|
+
prefixes.set(name, joinRoute(parentPrefix, path80));
|
|
18910
18910
|
}
|
|
18911
18911
|
}
|
|
18912
18912
|
}
|
|
@@ -18930,9 +18930,9 @@ function extractClassRoutePrefix(classNode) {
|
|
|
18930
18930
|
continue;
|
|
18931
18931
|
const args = childOfType(attr, "attribute_argument_list");
|
|
18932
18932
|
if (args) {
|
|
18933
|
-
const
|
|
18934
|
-
if (
|
|
18935
|
-
return
|
|
18933
|
+
const path80 = extractFirstStringArg(args);
|
|
18934
|
+
if (path80)
|
|
18935
|
+
return path80;
|
|
18936
18936
|
}
|
|
18937
18937
|
}
|
|
18938
18938
|
}
|
|
@@ -18955,16 +18955,16 @@ function extractAttributeRoute(methodNode, filePath, classContext) {
|
|
|
18955
18955
|
httpMethod = method;
|
|
18956
18956
|
const args = childOfType(attr, "attribute_argument_list");
|
|
18957
18957
|
if (args) {
|
|
18958
|
-
const
|
|
18959
|
-
if (
|
|
18960
|
-
routePath =
|
|
18958
|
+
const path80 = extractFirstStringArg(args);
|
|
18959
|
+
if (path80)
|
|
18960
|
+
routePath = path80;
|
|
18961
18961
|
}
|
|
18962
18962
|
} else if (name === "Route" && !routePath) {
|
|
18963
18963
|
const args = childOfType(attr, "attribute_argument_list");
|
|
18964
18964
|
if (args) {
|
|
18965
|
-
const
|
|
18966
|
-
if (
|
|
18967
|
-
routePath =
|
|
18965
|
+
const path80 = extractFirstStringArg(args);
|
|
18966
|
+
if (path80)
|
|
18967
|
+
routePath = path80;
|
|
18968
18968
|
}
|
|
18969
18969
|
}
|
|
18970
18970
|
}
|
|
@@ -18998,12 +18998,12 @@ function extractMinimalApiRoute(callNode, filePath, groupPrefixes) {
|
|
|
18998
18998
|
const argsNode = callNode.childForFieldName("arguments");
|
|
18999
18999
|
if (!argsNode)
|
|
19000
19000
|
return null;
|
|
19001
|
-
const
|
|
19002
|
-
if (
|
|
19001
|
+
const path80 = extractFirstStringArg(argsNode);
|
|
19002
|
+
if (path80 === null)
|
|
19003
19003
|
return null;
|
|
19004
19004
|
const receiver = funcNode.childForFieldName("expression")?.text ?? "";
|
|
19005
19005
|
const prefix = groupPrefixes.get(receiver) ?? "";
|
|
19006
|
-
let fullPath = joinRoute(prefix,
|
|
19006
|
+
let fullPath = joinRoute(prefix, path80);
|
|
19007
19007
|
if (!fullPath.startsWith("/"))
|
|
19008
19008
|
fullPath = "/" + fullPath;
|
|
19009
19009
|
let handlerName = "anonymous";
|
|
@@ -19030,11 +19030,11 @@ function childOfType(node2, type2) {
|
|
|
19030
19030
|
}
|
|
19031
19031
|
return null;
|
|
19032
19032
|
}
|
|
19033
|
-
function joinRoute(prefix,
|
|
19033
|
+
function joinRoute(prefix, path80) {
|
|
19034
19034
|
const p2 = prefix.replace(/\/$/, "");
|
|
19035
|
-
const s =
|
|
19035
|
+
const s = path80.replace(/^\//, "");
|
|
19036
19036
|
if (!p2)
|
|
19037
|
-
return
|
|
19037
|
+
return path80;
|
|
19038
19038
|
if (!s)
|
|
19039
19039
|
return p2;
|
|
19040
19040
|
return `${p2}/${s}`;
|
|
@@ -19143,8 +19143,8 @@ function extractRoute(methodName3, argsNode, filePath, callNode) {
|
|
|
19143
19143
|
const firstArg = argsNode.namedChild(0);
|
|
19144
19144
|
if (!firstArg)
|
|
19145
19145
|
return null;
|
|
19146
|
-
const
|
|
19147
|
-
if (!
|
|
19146
|
+
const path80 = extractStringLiteral(firstArg);
|
|
19147
|
+
if (!path80)
|
|
19148
19148
|
return null;
|
|
19149
19149
|
const argCount = argsNode.namedChildCount;
|
|
19150
19150
|
if (argCount < 2)
|
|
@@ -19157,7 +19157,7 @@ function extractRoute(methodName3, argsNode, filePath, callNode) {
|
|
|
19157
19157
|
return null;
|
|
19158
19158
|
return {
|
|
19159
19159
|
httpMethod: methodName3.toUpperCase(),
|
|
19160
|
-
path:
|
|
19160
|
+
path: path80,
|
|
19161
19161
|
handlerName,
|
|
19162
19162
|
location: {
|
|
19163
19163
|
filePath,
|
|
@@ -19174,8 +19174,8 @@ function extractMount(argsNode, filePath, callNode) {
|
|
|
19174
19174
|
const firstArg = argsNode.namedChild(0);
|
|
19175
19175
|
if (!firstArg)
|
|
19176
19176
|
return null;
|
|
19177
|
-
const
|
|
19178
|
-
if (!
|
|
19177
|
+
const path80 = extractStringLiteral(firstArg);
|
|
19178
|
+
if (!path80)
|
|
19179
19179
|
return null;
|
|
19180
19180
|
const secondArg = argsNode.namedChild(1);
|
|
19181
19181
|
if (!secondArg)
|
|
@@ -19184,7 +19184,7 @@ function extractMount(argsNode, filePath, callNode) {
|
|
|
19184
19184
|
if (!routerName)
|
|
19185
19185
|
return null;
|
|
19186
19186
|
return {
|
|
19187
|
-
path:
|
|
19187
|
+
path: path80,
|
|
19188
19188
|
routerName,
|
|
19189
19189
|
location: {
|
|
19190
19190
|
filePath,
|
|
@@ -21715,11 +21715,11 @@ function buildCSharpSymbolIndex(files, rootPath) {
|
|
|
21715
21715
|
byFullName.get(full).push(decl);
|
|
21716
21716
|
}
|
|
21717
21717
|
const stats = { resolvedRefs: 0, ambiguousRefs: 0 };
|
|
21718
|
-
function resolveQualified(
|
|
21719
|
-
const exact = byFullName.get(
|
|
21718
|
+
function resolveQualified(path80) {
|
|
21719
|
+
const exact = byFullName.get(path80);
|
|
21720
21720
|
if (exact)
|
|
21721
21721
|
return exact;
|
|
21722
|
-
const parts =
|
|
21722
|
+
const parts = path80.split(".");
|
|
21723
21723
|
for (let i = parts.length - 1; i > 0; i--) {
|
|
21724
21724
|
const prefix = parts.slice(0, i).join(".");
|
|
21725
21725
|
const found = byFullName.get(prefix);
|
|
@@ -21733,8 +21733,8 @@ function buildCSharpSymbolIndex(files, rootPath) {
|
|
|
21733
21733
|
const firstDot = ref.name.indexOf(".");
|
|
21734
21734
|
const head = ref.name.slice(0, firstDot);
|
|
21735
21735
|
const aliasTarget2 = aliases.get(head);
|
|
21736
|
-
const
|
|
21737
|
-
return resolveQualified(
|
|
21736
|
+
const path80 = aliasTarget2 ? `${aliasTarget2}${ref.name.slice(firstDot)}` : ref.name;
|
|
21737
|
+
return resolveQualified(path80).filter((d3) => isDeclVisibleFrom(d3, ctx.project, fileProjects.get(d3.filePath)));
|
|
21738
21738
|
}
|
|
21739
21739
|
const aliasTarget = aliases.get(ref.name);
|
|
21740
21740
|
if (aliasTarget) {
|
|
@@ -24858,9 +24858,9 @@ function detectDockerComposeServices(rootPath, allFiles) {
|
|
|
24858
24858
|
];
|
|
24859
24859
|
let composePath2 = null;
|
|
24860
24860
|
for (const file of composeFiles) {
|
|
24861
|
-
const
|
|
24862
|
-
if (existsSync7(
|
|
24863
|
-
composePath2 =
|
|
24861
|
+
const path80 = join8(rootPath, file);
|
|
24862
|
+
if (existsSync7(path80)) {
|
|
24863
|
+
composePath2 = path80;
|
|
24864
24864
|
break;
|
|
24865
24865
|
}
|
|
24866
24866
|
}
|
|
@@ -28067,9 +28067,9 @@ function findSimpleCycles(component, componentSet, adjacency) {
|
|
|
28067
28067
|
for (const next of successors) {
|
|
28068
28068
|
if (!componentSet.has(next))
|
|
28069
28069
|
continue;
|
|
28070
|
-
if (next === start &&
|
|
28071
|
-
const chain = [...
|
|
28072
|
-
const minNode =
|
|
28070
|
+
if (next === start && path80.length >= 2) {
|
|
28071
|
+
const chain = [...path80, start];
|
|
28072
|
+
const minNode = path80.reduce((a, b) => a < b ? a : b);
|
|
28073
28073
|
if (minNode === start) {
|
|
28074
28074
|
cycles.push(chain);
|
|
28075
28075
|
}
|
|
@@ -28077,15 +28077,15 @@ function findSimpleCycles(component, componentSet, adjacency) {
|
|
|
28077
28077
|
}
|
|
28078
28078
|
if (!visited.has(next) && !seen.has(next)) {
|
|
28079
28079
|
visited.add(next);
|
|
28080
|
-
|
|
28080
|
+
path80.push(next);
|
|
28081
28081
|
dfs2(next);
|
|
28082
|
-
|
|
28082
|
+
path80.pop();
|
|
28083
28083
|
visited.delete(next);
|
|
28084
28084
|
}
|
|
28085
28085
|
}
|
|
28086
28086
|
};
|
|
28087
28087
|
var dfs = dfs2;
|
|
28088
|
-
const
|
|
28088
|
+
const path80 = [start];
|
|
28089
28089
|
const visited = /* @__PURE__ */ new Set([start]);
|
|
28090
28090
|
dfs2(start);
|
|
28091
28091
|
seen.add(start);
|
|
@@ -28107,7 +28107,7 @@ function findShortestCycle(start, componentSet, adjacency) {
|
|
|
28107
28107
|
visited.add(next);
|
|
28108
28108
|
}
|
|
28109
28109
|
while (queue.length > 0) {
|
|
28110
|
-
const { node: node2, path:
|
|
28110
|
+
const { node: node2, path: path80 } = queue.shift();
|
|
28111
28111
|
const nexts = adjacency.get(node2);
|
|
28112
28112
|
if (!nexts)
|
|
28113
28113
|
continue;
|
|
@@ -28115,11 +28115,11 @@ function findShortestCycle(start, componentSet, adjacency) {
|
|
|
28115
28115
|
if (!componentSet.has(next))
|
|
28116
28116
|
continue;
|
|
28117
28117
|
if (next === start) {
|
|
28118
|
-
return [...
|
|
28118
|
+
return [...path80, start];
|
|
28119
28119
|
}
|
|
28120
28120
|
if (!visited.has(next)) {
|
|
28121
28121
|
visited.add(next);
|
|
28122
|
-
queue.push({ node: next, path: [...
|
|
28122
|
+
queue.push({ node: next, path: [...path80, next] });
|
|
28123
28123
|
}
|
|
28124
28124
|
}
|
|
28125
28125
|
}
|
|
@@ -105218,7 +105218,7 @@ function parseBlockedOnCapabilities(reason) {
|
|
|
105218
105218
|
return [];
|
|
105219
105219
|
return m[1].split(",").map((s) => s.trim()).filter(Boolean);
|
|
105220
105220
|
}
|
|
105221
|
-
var GuardWrittenScenarioSchema, GuardCoverageGapKindSchema, GuardCoverageGapSchema, GuardBirthFindingSchema, GuardGenerateErrorSchema, GuardEntryPreflightSchema, GuardExtractionFailureSchema, GuardOrphanedSectionSchema, GuardRecipeReportSchema, GuardGenerateUsageSchema, GuardGenerateReportSchema;
|
|
105221
|
+
var GuardWrittenScenarioSchema, GuardCoverageGapKindSchema, GuardCoverageGapSchema, GuardBirthFindingSchema, GuardGenerateErrorSchema, GuardReadyScenarioSchema, GuardHeldSectionSchema, GuardEntryPreflightSchema, GuardExtractionFailureSchema, GuardOrphanedDismissalSchema, GuardOrphanedSectionSchema, GuardRecipeReportSchema, GuardGenerateUsageSchema, GuardGenerateReportSchema;
|
|
105222
105222
|
var init_report = __esm({
|
|
105223
105223
|
"packages/shared/dist/guard/report.js"() {
|
|
105224
105224
|
"use strict";
|
|
@@ -105236,7 +105236,8 @@ var init_report = __esm({
|
|
|
105236
105236
|
"awaiting-driver",
|
|
105237
105237
|
"untestable",
|
|
105238
105238
|
"no-claim",
|
|
105239
|
-
"blocked-on"
|
|
105239
|
+
"blocked-on",
|
|
105240
|
+
"dismissed"
|
|
105240
105241
|
]);
|
|
105241
105242
|
GuardCoverageGapSchema = external_exports.object({
|
|
105242
105243
|
doc: external_exports.string(),
|
|
@@ -105258,6 +105259,22 @@ var init_report = __esm({
|
|
|
105258
105259
|
actual: external_exports.string(),
|
|
105259
105260
|
/** Repo-relative pointer into `guard/evidence/`, when a transcript was written. */
|
|
105260
105261
|
evidencePath: external_exports.string().optional(),
|
|
105262
|
+
/**
|
|
105263
|
+
* The failed candidate's authored YAML, serialized inline AT FINDING CREATION
|
|
105264
|
+
* (same serialize-at-creation as heldSections' readyScenarios). The finding
|
|
105265
|
+
* detail renders it in the scenario-source code block so the user can judge
|
|
105266
|
+
* "defect or drift" with the exact commands the scenario ran on-screen.
|
|
105267
|
+
* Optional so older `result.json` files keep parsing.
|
|
105268
|
+
*/
|
|
105269
|
+
yaml: external_exports.string().optional(),
|
|
105270
|
+
/**
|
|
105271
|
+
* The EXTRACTED CLAIM's stable text — the claim identity a dismissal keys on
|
|
105272
|
+
* (anchor + this). The finding detail's Dismiss action writes it into
|
|
105273
|
+
* `scenarios/decisions.json`; generate then skips a matching claim before
|
|
105274
|
+
* authoring. Distinct from `title` (the scenario title). Optional so older
|
|
105275
|
+
* reports (and the internal retry-evidence findings) parse.
|
|
105276
|
+
*/
|
|
105277
|
+
claim: external_exports.string().optional(),
|
|
105261
105278
|
/**
|
|
105262
105279
|
* The bound section's human heading, joined SERVER-SIDE at report read time
|
|
105263
105280
|
* (never written to `result.json` — the enrichment is read-side). A finding's
|
|
@@ -105271,6 +105288,18 @@ var init_report = __esm({
|
|
|
105271
105288
|
anchor: external_exports.string(),
|
|
105272
105289
|
message: external_exports.string()
|
|
105273
105290
|
}).strict();
|
|
105291
|
+
GuardReadyScenarioSchema = external_exports.object({
|
|
105292
|
+
id: external_exports.string(),
|
|
105293
|
+
title: external_exports.string(),
|
|
105294
|
+
/** The committed YAML the scenario would have been written as. */
|
|
105295
|
+
yaml: external_exports.string()
|
|
105296
|
+
}).strict();
|
|
105297
|
+
GuardHeldSectionSchema = external_exports.object({
|
|
105298
|
+
doc: external_exports.string(),
|
|
105299
|
+
anchor: external_exports.string(),
|
|
105300
|
+
headingText: external_exports.string().optional(),
|
|
105301
|
+
readyScenarios: external_exports.array(GuardReadyScenarioSchema)
|
|
105302
|
+
}).strict();
|
|
105274
105303
|
GuardEntryPreflightSchema = external_exports.object({
|
|
105275
105304
|
/** Display form of the entry argv, e.g. `node tools/cli/dist/index.js`. */
|
|
105276
105305
|
entry: external_exports.string(),
|
|
@@ -105283,6 +105312,11 @@ var init_report = __esm({
|
|
|
105283
105312
|
doc: external_exports.string(),
|
|
105284
105313
|
reason: external_exports.string()
|
|
105285
105314
|
}).strict();
|
|
105315
|
+
GuardOrphanedDismissalSchema = external_exports.object({
|
|
105316
|
+
doc: external_exports.string(),
|
|
105317
|
+
anchor: external_exports.string(),
|
|
105318
|
+
title: external_exports.string()
|
|
105319
|
+
}).strict();
|
|
105286
105320
|
GuardOrphanedSectionSchema = external_exports.object({
|
|
105287
105321
|
doc: external_exports.string(),
|
|
105288
105322
|
anchor: external_exports.string(),
|
|
@@ -105323,6 +105357,19 @@ var init_report = __esm({
|
|
|
105323
105357
|
* `written.length` when a passing scenario's section didn't settle.
|
|
105324
105358
|
*/
|
|
105325
105359
|
birthPassed: external_exports.number().int().nonnegative().optional(),
|
|
105360
|
+
/**
|
|
105361
|
+
* Unsettled sections whose birth-passed candidates were withheld — the
|
|
105362
|
+
* ready-but-held scenarios, each carrying its authored YAML inline. Optional so
|
|
105363
|
+
* older reports (written before this field existed) keep parsing; absent reads
|
|
105364
|
+
* as "no held work".
|
|
105365
|
+
*/
|
|
105366
|
+
heldSections: external_exports.array(GuardHeldSectionSchema).optional(),
|
|
105367
|
+
/**
|
|
105368
|
+
* Dismissals whose claim text matched nothing in a doc this run re-extracted —
|
|
105369
|
+
* stale entries in `scenarios/decisions.json`, surfaced (never silently
|
|
105370
|
+
* honored). Optional so older reports parse; absent reads as "none".
|
|
105371
|
+
*/
|
|
105372
|
+
orphanedDismissals: external_exports.array(GuardOrphanedDismissalSchema).optional(),
|
|
105326
105373
|
manifestPath: external_exports.string().optional(),
|
|
105327
105374
|
usage: GuardGenerateUsageSchema.optional(),
|
|
105328
105375
|
/**
|
|
@@ -105373,6 +105420,35 @@ var init_manifest = __esm({
|
|
|
105373
105420
|
}
|
|
105374
105421
|
});
|
|
105375
105422
|
|
|
105423
|
+
// packages/shared/dist/guard/decisions.js
|
|
105424
|
+
function dismissedClaimKey(doc, anchor, title) {
|
|
105425
|
+
return `${doc}\0${anchor}\0${title}`;
|
|
105426
|
+
}
|
|
105427
|
+
var GuardDismissedClaimSchema, GuardDecisionsSchema, EMPTY_GUARD_DECISIONS;
|
|
105428
|
+
var init_decisions = __esm({
|
|
105429
|
+
"packages/shared/dist/guard/decisions.js"() {
|
|
105430
|
+
"use strict";
|
|
105431
|
+
init_zod();
|
|
105432
|
+
GuardDismissedClaimSchema = external_exports.object({
|
|
105433
|
+
/** Repo-relative doc path the claim's section lives in. */
|
|
105434
|
+
doc: external_exports.string().min(1),
|
|
105435
|
+
/** The section anchor (slug) the claim was extracted under. */
|
|
105436
|
+
anchor: external_exports.string().min(1),
|
|
105437
|
+
/** The extracted claim's stable text — the identity, with `anchor`. */
|
|
105438
|
+
title: external_exports.string().min(1),
|
|
105439
|
+
/** ISO timestamp the dismissal was recorded. */
|
|
105440
|
+
dismissedAt: external_exports.string(),
|
|
105441
|
+
/** Optional free-text rationale ("flaky", "won't fix", …). */
|
|
105442
|
+
note: external_exports.string().optional()
|
|
105443
|
+
});
|
|
105444
|
+
GuardDecisionsSchema = external_exports.object({
|
|
105445
|
+
version: external_exports.literal(1),
|
|
105446
|
+
dismissedClaims: external_exports.array(GuardDismissedClaimSchema).default([])
|
|
105447
|
+
});
|
|
105448
|
+
EMPTY_GUARD_DECISIONS = { version: 1, dismissedClaims: [] };
|
|
105449
|
+
}
|
|
105450
|
+
});
|
|
105451
|
+
|
|
105376
105452
|
// packages/shared/dist/guard/dashboard.js
|
|
105377
105453
|
var init_dashboard = __esm({
|
|
105378
105454
|
"packages/shared/dist/guard/dashboard.js"() {
|
|
@@ -105423,6 +105499,11 @@ function summarizeGenerate(r) {
|
|
|
105423
105499
|
}
|
|
105424
105500
|
}
|
|
105425
105501
|
}
|
|
105502
|
+
const heldSections = r.heldSections ?? [];
|
|
105503
|
+
const heldKeys = new Set(heldSections.map((h) => `${h.doc}\0${h.anchor}`));
|
|
105504
|
+
const readyButHeld = heldSections.reduce((n, h) => n + h.readyScenarios.length, 0);
|
|
105505
|
+
const heldByFindings = r.birthFindings.filter((f2) => heldKeys.has(`${f2.doc}\0${f2.anchor}`)).length;
|
|
105506
|
+
const heldByErrors = r.errors.filter((e) => heldKeys.has(`${e.doc}\0${e.anchor}`)).length;
|
|
105426
105507
|
return {
|
|
105427
105508
|
generatedAt: r.generatedAt,
|
|
105428
105509
|
status: r.status,
|
|
@@ -105433,6 +105514,9 @@ function summarizeGenerate(r) {
|
|
|
105433
105514
|
blockedOnCapabilities,
|
|
105434
105515
|
birthFindings: r.birthFindings.length,
|
|
105435
105516
|
errors: r.errors.length,
|
|
105517
|
+
readyButHeld,
|
|
105518
|
+
heldByFindings,
|
|
105519
|
+
heldByErrors,
|
|
105436
105520
|
...r.usage ? { usage: r.usage } : {}
|
|
105437
105521
|
};
|
|
105438
105522
|
}
|
|
@@ -105464,6 +105548,7 @@ var init_guard = __esm({
|
|
|
105464
105548
|
init_result();
|
|
105465
105549
|
init_report();
|
|
105466
105550
|
init_manifest();
|
|
105551
|
+
init_decisions();
|
|
105467
105552
|
init_dashboard();
|
|
105468
105553
|
init_summary();
|
|
105469
105554
|
}
|
|
@@ -111875,14 +111960,14 @@ var init_missing_error_status_code = __esm({
|
|
|
111875
111960
|
});
|
|
111876
111961
|
|
|
111877
111962
|
// packages/analyzer/dist/rules/architecture/visitors/javascript/route-without-auth-middleware.js
|
|
111878
|
-
function isPublicPath(
|
|
111879
|
-
return PUBLIC_PATH_PATTERNS.some((re2) => re2.test(
|
|
111963
|
+
function isPublicPath(path80) {
|
|
111964
|
+
return PUBLIC_PATH_PATTERNS.some((re2) => re2.test(path80));
|
|
111880
111965
|
}
|
|
111881
|
-
function isUrlCredentialAuthedPath(
|
|
111882
|
-
return URL_CREDENTIAL_PARAMS.test(
|
|
111966
|
+
function isUrlCredentialAuthedPath(path80) {
|
|
111967
|
+
return URL_CREDENTIAL_PARAMS.test(path80);
|
|
111883
111968
|
}
|
|
111884
|
-
function isApiDocsPath(
|
|
111885
|
-
return API_DOCS_PATH.test(
|
|
111969
|
+
function isApiDocsPath(path80) {
|
|
111970
|
+
return API_DOCS_PATH.test(path80);
|
|
111886
111971
|
}
|
|
111887
111972
|
function isFrameworkRequestHandler(arg) {
|
|
111888
111973
|
if (!arg)
|
|
@@ -112031,14 +112116,14 @@ var init_route_without_auth_middleware = __esm({
|
|
|
112031
112116
|
return null;
|
|
112032
112117
|
const firstArg = args.namedChildren[0];
|
|
112033
112118
|
if (firstArg?.type === "string" || firstArg?.type === "template_string") {
|
|
112034
|
-
const
|
|
112035
|
-
if (isPublicPath(
|
|
112119
|
+
const path80 = firstArg.text.replace(/^['"`]|['"`]$/g, "");
|
|
112120
|
+
if (isPublicPath(path80))
|
|
112036
112121
|
return null;
|
|
112037
|
-
if (isUrlCredentialAuthedPath(
|
|
112122
|
+
if (isUrlCredentialAuthedPath(path80))
|
|
112038
112123
|
return null;
|
|
112039
|
-
if (isApiDocsPath(
|
|
112124
|
+
if (isApiDocsPath(path80))
|
|
112040
112125
|
return null;
|
|
112041
|
-
if (
|
|
112126
|
+
if (path80 === "*" || path80 === "(.*)" || path80 === "/*") {
|
|
112042
112127
|
if (isFrameworkRequestHandler(args.namedChildren[args.namedChildren.length - 1])) {
|
|
112043
112128
|
return null;
|
|
112044
112129
|
}
|
|
@@ -146609,8 +146694,8 @@ var require_windows = __commonJS({
|
|
|
146609
146694
|
"node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js"(exports, module) {
|
|
146610
146695
|
module.exports = isexe;
|
|
146611
146696
|
isexe.sync = sync;
|
|
146612
|
-
var
|
|
146613
|
-
function checkPathExt(
|
|
146697
|
+
var fs70 = __require("fs");
|
|
146698
|
+
function checkPathExt(path80, options) {
|
|
146614
146699
|
var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
|
|
146615
146700
|
if (!pathext) {
|
|
146616
146701
|
return true;
|
|
@@ -146621,25 +146706,25 @@ var require_windows = __commonJS({
|
|
|
146621
146706
|
}
|
|
146622
146707
|
for (var i = 0; i < pathext.length; i++) {
|
|
146623
146708
|
var p2 = pathext[i].toLowerCase();
|
|
146624
|
-
if (p2 &&
|
|
146709
|
+
if (p2 && path80.substr(-p2.length).toLowerCase() === p2) {
|
|
146625
146710
|
return true;
|
|
146626
146711
|
}
|
|
146627
146712
|
}
|
|
146628
146713
|
return false;
|
|
146629
146714
|
}
|
|
146630
|
-
function checkStat(stat,
|
|
146715
|
+
function checkStat(stat, path80, options) {
|
|
146631
146716
|
if (!stat.isSymbolicLink() && !stat.isFile()) {
|
|
146632
146717
|
return false;
|
|
146633
146718
|
}
|
|
146634
|
-
return checkPathExt(
|
|
146719
|
+
return checkPathExt(path80, options);
|
|
146635
146720
|
}
|
|
146636
|
-
function isexe(
|
|
146637
|
-
|
|
146638
|
-
cb(er, er ? false : checkStat(stat,
|
|
146721
|
+
function isexe(path80, options, cb) {
|
|
146722
|
+
fs70.stat(path80, function(er, stat) {
|
|
146723
|
+
cb(er, er ? false : checkStat(stat, path80, options));
|
|
146639
146724
|
});
|
|
146640
146725
|
}
|
|
146641
|
-
function sync(
|
|
146642
|
-
return checkStat(
|
|
146726
|
+
function sync(path80, options) {
|
|
146727
|
+
return checkStat(fs70.statSync(path80), path80, options);
|
|
146643
146728
|
}
|
|
146644
146729
|
}
|
|
146645
146730
|
});
|
|
@@ -146649,14 +146734,14 @@ var require_mode = __commonJS({
|
|
|
146649
146734
|
"node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js"(exports, module) {
|
|
146650
146735
|
module.exports = isexe;
|
|
146651
146736
|
isexe.sync = sync;
|
|
146652
|
-
var
|
|
146653
|
-
function isexe(
|
|
146654
|
-
|
|
146737
|
+
var fs70 = __require("fs");
|
|
146738
|
+
function isexe(path80, options, cb) {
|
|
146739
|
+
fs70.stat(path80, function(er, stat) {
|
|
146655
146740
|
cb(er, er ? false : checkStat(stat, options));
|
|
146656
146741
|
});
|
|
146657
146742
|
}
|
|
146658
|
-
function sync(
|
|
146659
|
-
return checkStat(
|
|
146743
|
+
function sync(path80, options) {
|
|
146744
|
+
return checkStat(fs70.statSync(path80), options);
|
|
146660
146745
|
}
|
|
146661
146746
|
function checkStat(stat, options) {
|
|
146662
146747
|
return stat.isFile() && checkMode(stat, options);
|
|
@@ -146680,7 +146765,7 @@ var require_mode = __commonJS({
|
|
|
146680
146765
|
// node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js
|
|
146681
146766
|
var require_isexe = __commonJS({
|
|
146682
146767
|
"node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js"(exports, module) {
|
|
146683
|
-
var
|
|
146768
|
+
var fs70 = __require("fs");
|
|
146684
146769
|
var core2;
|
|
146685
146770
|
if (process.platform === "win32" || global.TESTING_WINDOWS) {
|
|
146686
146771
|
core2 = require_windows();
|
|
@@ -146689,7 +146774,7 @@ var require_isexe = __commonJS({
|
|
|
146689
146774
|
}
|
|
146690
146775
|
module.exports = isexe;
|
|
146691
146776
|
isexe.sync = sync;
|
|
146692
|
-
function isexe(
|
|
146777
|
+
function isexe(path80, options, cb) {
|
|
146693
146778
|
if (typeof options === "function") {
|
|
146694
146779
|
cb = options;
|
|
146695
146780
|
options = {};
|
|
@@ -146699,7 +146784,7 @@ var require_isexe = __commonJS({
|
|
|
146699
146784
|
throw new TypeError("callback not provided");
|
|
146700
146785
|
}
|
|
146701
146786
|
return new Promise(function(resolve12, reject) {
|
|
146702
|
-
isexe(
|
|
146787
|
+
isexe(path80, options || {}, function(er, is) {
|
|
146703
146788
|
if (er) {
|
|
146704
146789
|
reject(er);
|
|
146705
146790
|
} else {
|
|
@@ -146708,7 +146793,7 @@ var require_isexe = __commonJS({
|
|
|
146708
146793
|
});
|
|
146709
146794
|
});
|
|
146710
146795
|
}
|
|
146711
|
-
core2(
|
|
146796
|
+
core2(path80, options || {}, function(er, is) {
|
|
146712
146797
|
if (er) {
|
|
146713
146798
|
if (er.code === "EACCES" || options && options.ignoreErrors) {
|
|
146714
146799
|
er = null;
|
|
@@ -146718,9 +146803,9 @@ var require_isexe = __commonJS({
|
|
|
146718
146803
|
cb(er, is);
|
|
146719
146804
|
});
|
|
146720
146805
|
}
|
|
146721
|
-
function sync(
|
|
146806
|
+
function sync(path80, options) {
|
|
146722
146807
|
try {
|
|
146723
|
-
return core2.sync(
|
|
146808
|
+
return core2.sync(path80, options || {});
|
|
146724
146809
|
} catch (er) {
|
|
146725
146810
|
if (options && options.ignoreErrors || er.code === "EACCES") {
|
|
146726
146811
|
return false;
|
|
@@ -146736,7 +146821,7 @@ var require_isexe = __commonJS({
|
|
|
146736
146821
|
var require_which = __commonJS({
|
|
146737
146822
|
"node_modules/.pnpm/which@2.0.2/node_modules/which/which.js"(exports, module) {
|
|
146738
146823
|
var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
|
|
146739
|
-
var
|
|
146824
|
+
var path80 = __require("path");
|
|
146740
146825
|
var COLON = isWindows ? ";" : ":";
|
|
146741
146826
|
var isexe = require_isexe();
|
|
146742
146827
|
var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
|
|
@@ -146774,7 +146859,7 @@ var require_which = __commonJS({
|
|
|
146774
146859
|
return opt.all && found.length ? resolve12(found) : reject(getNotFoundError(cmd));
|
|
146775
146860
|
const ppRaw = pathEnv[i];
|
|
146776
146861
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
146777
|
-
const pCmd =
|
|
146862
|
+
const pCmd = path80.join(pathPart, cmd);
|
|
146778
146863
|
const p2 = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
146779
146864
|
resolve12(subStep(p2, i, 0));
|
|
146780
146865
|
});
|
|
@@ -146801,7 +146886,7 @@ var require_which = __commonJS({
|
|
|
146801
146886
|
for (let i = 0; i < pathEnv.length; i++) {
|
|
146802
146887
|
const ppRaw = pathEnv[i];
|
|
146803
146888
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
146804
|
-
const pCmd =
|
|
146889
|
+
const pCmd = path80.join(pathPart, cmd);
|
|
146805
146890
|
const p2 = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
146806
146891
|
for (let j2 = 0; j2 < pathExt.length; j2++) {
|
|
146807
146892
|
const cur = p2 + pathExt[j2];
|
|
@@ -146849,7 +146934,7 @@ var require_path_key = __commonJS({
|
|
|
146849
146934
|
var require_resolveCommand = __commonJS({
|
|
146850
146935
|
"node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js"(exports, module) {
|
|
146851
146936
|
"use strict";
|
|
146852
|
-
var
|
|
146937
|
+
var path80 = __require("path");
|
|
146853
146938
|
var which = require_which();
|
|
146854
146939
|
var getPathKey = require_path_key();
|
|
146855
146940
|
function resolveCommandAttempt(parsed, withoutPathExt) {
|
|
@@ -146867,7 +146952,7 @@ var require_resolveCommand = __commonJS({
|
|
|
146867
146952
|
try {
|
|
146868
146953
|
resolved = which.sync(parsed.command, {
|
|
146869
146954
|
path: env[getPathKey({ env })],
|
|
146870
|
-
pathExt: withoutPathExt ?
|
|
146955
|
+
pathExt: withoutPathExt ? path80.delimiter : void 0
|
|
146871
146956
|
});
|
|
146872
146957
|
} catch (e) {
|
|
146873
146958
|
} finally {
|
|
@@ -146876,7 +146961,7 @@ var require_resolveCommand = __commonJS({
|
|
|
146876
146961
|
}
|
|
146877
146962
|
}
|
|
146878
146963
|
if (resolved) {
|
|
146879
|
-
resolved =
|
|
146964
|
+
resolved = path80.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
|
|
146880
146965
|
}
|
|
146881
146966
|
return resolved;
|
|
146882
146967
|
}
|
|
@@ -146930,8 +147015,8 @@ var require_shebang_command = __commonJS({
|
|
|
146930
147015
|
if (!match4) {
|
|
146931
147016
|
return null;
|
|
146932
147017
|
}
|
|
146933
|
-
const [
|
|
146934
|
-
const binary2 =
|
|
147018
|
+
const [path80, argument] = match4[0].replace(/#! ?/, "").split(" ");
|
|
147019
|
+
const binary2 = path80.split("/").pop();
|
|
146935
147020
|
if (binary2 === "env") {
|
|
146936
147021
|
return argument;
|
|
146937
147022
|
}
|
|
@@ -146944,16 +147029,16 @@ var require_shebang_command = __commonJS({
|
|
|
146944
147029
|
var require_readShebang = __commonJS({
|
|
146945
147030
|
"node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js"(exports, module) {
|
|
146946
147031
|
"use strict";
|
|
146947
|
-
var
|
|
147032
|
+
var fs70 = __require("fs");
|
|
146948
147033
|
var shebangCommand = require_shebang_command();
|
|
146949
147034
|
function readShebang(command) {
|
|
146950
147035
|
const size = 150;
|
|
146951
147036
|
const buffer = Buffer.alloc(size);
|
|
146952
147037
|
let fd;
|
|
146953
147038
|
try {
|
|
146954
|
-
fd =
|
|
146955
|
-
|
|
146956
|
-
|
|
147039
|
+
fd = fs70.openSync(command, "r");
|
|
147040
|
+
fs70.readSync(fd, buffer, 0, size, 0);
|
|
147041
|
+
fs70.closeSync(fd);
|
|
146957
147042
|
} catch (e) {
|
|
146958
147043
|
}
|
|
146959
147044
|
return shebangCommand(buffer.toString());
|
|
@@ -146966,7 +147051,7 @@ var require_readShebang = __commonJS({
|
|
|
146966
147051
|
var require_parse = __commonJS({
|
|
146967
147052
|
"node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js"(exports, module) {
|
|
146968
147053
|
"use strict";
|
|
146969
|
-
var
|
|
147054
|
+
var path80 = __require("path");
|
|
146970
147055
|
var resolveCommand = require_resolveCommand();
|
|
146971
147056
|
var escape2 = require_escape();
|
|
146972
147057
|
var readShebang = require_readShebang();
|
|
@@ -146991,7 +147076,7 @@ var require_parse = __commonJS({
|
|
|
146991
147076
|
const needsShell = !isExecutableRegExp.test(commandFile);
|
|
146992
147077
|
if (parsed.options.forceShell || needsShell) {
|
|
146993
147078
|
const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
|
|
146994
|
-
parsed.command =
|
|
147079
|
+
parsed.command = path80.normalize(parsed.command);
|
|
146995
147080
|
parsed.command = escape2.command(parsed.command);
|
|
146996
147081
|
parsed.args = parsed.args.map((arg) => escape2.argument(arg, needsDoubleEscapeMetaChars));
|
|
146997
147082
|
const shellCommand = [parsed.command].concat(parsed.args).join(" ");
|
|
@@ -147357,8 +147442,8 @@ var require_package = __commonJS({
|
|
|
147357
147442
|
// node_modules/.pnpm/dotenv@16.6.1/node_modules/dotenv/lib/main.js
|
|
147358
147443
|
var require_main = __commonJS({
|
|
147359
147444
|
"node_modules/.pnpm/dotenv@16.6.1/node_modules/dotenv/lib/main.js"(exports, module) {
|
|
147360
|
-
var
|
|
147361
|
-
var
|
|
147445
|
+
var fs70 = __require("fs");
|
|
147446
|
+
var path80 = __require("path");
|
|
147362
147447
|
var os15 = __require("os");
|
|
147363
147448
|
var crypto6 = __require("crypto");
|
|
147364
147449
|
var packageJson = require_package();
|
|
@@ -147466,7 +147551,7 @@ var require_main = __commonJS({
|
|
|
147466
147551
|
if (options && options.path && options.path.length > 0) {
|
|
147467
147552
|
if (Array.isArray(options.path)) {
|
|
147468
147553
|
for (const filepath of options.path) {
|
|
147469
|
-
if (
|
|
147554
|
+
if (fs70.existsSync(filepath)) {
|
|
147470
147555
|
possibleVaultPath = filepath.endsWith(".vault") ? filepath : `${filepath}.vault`;
|
|
147471
147556
|
}
|
|
147472
147557
|
}
|
|
@@ -147474,15 +147559,15 @@ var require_main = __commonJS({
|
|
|
147474
147559
|
possibleVaultPath = options.path.endsWith(".vault") ? options.path : `${options.path}.vault`;
|
|
147475
147560
|
}
|
|
147476
147561
|
} else {
|
|
147477
|
-
possibleVaultPath =
|
|
147562
|
+
possibleVaultPath = path80.resolve(process.cwd(), ".env.vault");
|
|
147478
147563
|
}
|
|
147479
|
-
if (
|
|
147564
|
+
if (fs70.existsSync(possibleVaultPath)) {
|
|
147480
147565
|
return possibleVaultPath;
|
|
147481
147566
|
}
|
|
147482
147567
|
return null;
|
|
147483
147568
|
}
|
|
147484
147569
|
function _resolveHome(envPath) {
|
|
147485
|
-
return envPath[0] === "~" ?
|
|
147570
|
+
return envPath[0] === "~" ? path80.join(os15.homedir(), envPath.slice(1)) : envPath;
|
|
147486
147571
|
}
|
|
147487
147572
|
function _configVault(options) {
|
|
147488
147573
|
const debug2 = Boolean(options && options.debug);
|
|
@@ -147499,7 +147584,7 @@ var require_main = __commonJS({
|
|
|
147499
147584
|
return { parsed };
|
|
147500
147585
|
}
|
|
147501
147586
|
function configDotenv(options) {
|
|
147502
|
-
const dotenvPath =
|
|
147587
|
+
const dotenvPath = path80.resolve(process.cwd(), ".env");
|
|
147503
147588
|
let encoding = "utf8";
|
|
147504
147589
|
const debug2 = Boolean(options && options.debug);
|
|
147505
147590
|
const quiet = options && "quiet" in options ? options.quiet : true;
|
|
@@ -147523,13 +147608,13 @@ var require_main = __commonJS({
|
|
|
147523
147608
|
}
|
|
147524
147609
|
let lastError;
|
|
147525
147610
|
const parsedAll = {};
|
|
147526
|
-
for (const
|
|
147611
|
+
for (const path81 of optionPaths) {
|
|
147527
147612
|
try {
|
|
147528
|
-
const parsed = DotenvModule.parse(
|
|
147613
|
+
const parsed = DotenvModule.parse(fs70.readFileSync(path81, { encoding }));
|
|
147529
147614
|
DotenvModule.populate(parsedAll, parsed, options);
|
|
147530
147615
|
} catch (e) {
|
|
147531
147616
|
if (debug2) {
|
|
147532
|
-
_debug(`Failed to load ${
|
|
147617
|
+
_debug(`Failed to load ${path81} ${e.message}`);
|
|
147533
147618
|
}
|
|
147534
147619
|
lastError = e;
|
|
147535
147620
|
}
|
|
@@ -147544,7 +147629,7 @@ var require_main = __commonJS({
|
|
|
147544
147629
|
const shortPaths = [];
|
|
147545
147630
|
for (const filePath of optionPaths) {
|
|
147546
147631
|
try {
|
|
147547
|
-
const relative2 =
|
|
147632
|
+
const relative2 = path80.relative(process.cwd(), filePath);
|
|
147548
147633
|
shortPaths.push(relative2);
|
|
147549
147634
|
} catch (e) {
|
|
147550
147635
|
if (debug2) {
|
|
@@ -148403,8 +148488,8 @@ var init_cli_provider = __esm({
|
|
|
148403
148488
|
this._repoId = repoId;
|
|
148404
148489
|
}
|
|
148405
148490
|
/** Set target repo path — used as cwd when spawning CLI so Read tool accesses the right files. */
|
|
148406
|
-
setRepoPath(
|
|
148407
|
-
this._repoPath =
|
|
148491
|
+
setRepoPath(path80) {
|
|
148492
|
+
this._repoPath = path80;
|
|
148408
148493
|
}
|
|
148409
148494
|
flushUsage() {
|
|
148410
148495
|
if (this._usageRecords.length === 0)
|
|
@@ -160505,11 +160590,11 @@ var require_mime_types = __commonJS({
|
|
|
160505
160590
|
}
|
|
160506
160591
|
return exts[0];
|
|
160507
160592
|
}
|
|
160508
|
-
function lookup(
|
|
160509
|
-
if (!
|
|
160593
|
+
function lookup(path80) {
|
|
160594
|
+
if (!path80 || typeof path80 !== "string") {
|
|
160510
160595
|
return false;
|
|
160511
160596
|
}
|
|
160512
|
-
var extension2 = extname("x." +
|
|
160597
|
+
var extension2 = extname("x." + path80).toLowerCase().substr(1);
|
|
160513
160598
|
if (!extension2) {
|
|
160514
160599
|
return false;
|
|
160515
160600
|
}
|
|
@@ -161614,11 +161699,11 @@ var require_form_data = __commonJS({
|
|
|
161614
161699
|
"use strict";
|
|
161615
161700
|
var CombinedStream = require_combined_stream();
|
|
161616
161701
|
var util2 = __require("util");
|
|
161617
|
-
var
|
|
161702
|
+
var path80 = __require("path");
|
|
161618
161703
|
var http = __require("http");
|
|
161619
161704
|
var https = __require("https");
|
|
161620
161705
|
var parseUrl = __require("url").parse;
|
|
161621
|
-
var
|
|
161706
|
+
var fs70 = __require("fs");
|
|
161622
161707
|
var Stream = __require("stream").Stream;
|
|
161623
161708
|
var crypto6 = __require("crypto");
|
|
161624
161709
|
var mime = require_mime_types();
|
|
@@ -161685,7 +161770,7 @@ var require_form_data = __commonJS({
|
|
|
161685
161770
|
if (value.end != void 0 && value.end != Infinity && value.start != void 0) {
|
|
161686
161771
|
callback(null, value.end + 1 - (value.start ? value.start : 0));
|
|
161687
161772
|
} else {
|
|
161688
|
-
|
|
161773
|
+
fs70.stat(value.path, function(err, stat) {
|
|
161689
161774
|
if (err) {
|
|
161690
161775
|
callback(err);
|
|
161691
161776
|
return;
|
|
@@ -161742,11 +161827,11 @@ var require_form_data = __commonJS({
|
|
|
161742
161827
|
FormData2.prototype._getContentDisposition = function(value, options) {
|
|
161743
161828
|
var filename;
|
|
161744
161829
|
if (typeof options.filepath === "string") {
|
|
161745
|
-
filename =
|
|
161830
|
+
filename = path80.normalize(options.filepath).replace(/\\/g, "/");
|
|
161746
161831
|
} else if (options.filename || value && (value.name || value.path)) {
|
|
161747
|
-
filename =
|
|
161832
|
+
filename = path80.basename(options.filename || value && (value.name || value.path));
|
|
161748
161833
|
} else if (value && value.readable && hasOwn(value, "httpVersion")) {
|
|
161749
|
-
filename =
|
|
161834
|
+
filename = path80.basename(value.client._httpMessage.path || "");
|
|
161750
161835
|
}
|
|
161751
161836
|
if (filename) {
|
|
161752
161837
|
return 'filename="' + filename + '"';
|
|
@@ -162303,8 +162388,8 @@ var require_node2 = __commonJS({
|
|
|
162303
162388
|
}
|
|
162304
162389
|
break;
|
|
162305
162390
|
case "FILE":
|
|
162306
|
-
var
|
|
162307
|
-
stream2 = new
|
|
162391
|
+
var fs70 = __require("fs");
|
|
162392
|
+
stream2 = new fs70.SyncWriteStream(fd2, { autoClose: false });
|
|
162308
162393
|
stream2._type = "fs";
|
|
162309
162394
|
break;
|
|
162310
162395
|
case "PIPE":
|
|
@@ -163400,9 +163485,9 @@ var require_axios = __commonJS({
|
|
|
163400
163485
|
function removeBrackets(key4) {
|
|
163401
163486
|
return utils$1.endsWith(key4, "[]") ? key4.slice(0, -2) : key4;
|
|
163402
163487
|
}
|
|
163403
|
-
function renderKey(
|
|
163404
|
-
if (!
|
|
163405
|
-
return
|
|
163488
|
+
function renderKey(path80, key4, dots) {
|
|
163489
|
+
if (!path80) return key4;
|
|
163490
|
+
return path80.concat(key4).map(function each(token, i) {
|
|
163406
163491
|
token = removeBrackets(token);
|
|
163407
163492
|
return !dots && i ? "[" + token + "]" : token;
|
|
163408
163493
|
}).join(dots ? "." : "");
|
|
@@ -163450,13 +163535,13 @@ var require_axios = __commonJS({
|
|
|
163450
163535
|
}
|
|
163451
163536
|
return value;
|
|
163452
163537
|
}
|
|
163453
|
-
function defaultVisitor(value, key4,
|
|
163538
|
+
function defaultVisitor(value, key4, path80) {
|
|
163454
163539
|
let arr = value;
|
|
163455
163540
|
if (utils$1.isReactNative(formData) && utils$1.isReactNativeBlob(value)) {
|
|
163456
|
-
formData.append(renderKey(
|
|
163541
|
+
formData.append(renderKey(path80, key4, dots), convertValue(value));
|
|
163457
163542
|
return false;
|
|
163458
163543
|
}
|
|
163459
|
-
if (value && !
|
|
163544
|
+
if (value && !path80 && typeof value === "object") {
|
|
163460
163545
|
if (utils$1.endsWith(key4, "{}")) {
|
|
163461
163546
|
key4 = metaTokens ? key4 : key4.slice(0, -2);
|
|
163462
163547
|
value = JSON.stringify(value);
|
|
@@ -163475,7 +163560,7 @@ var require_axios = __commonJS({
|
|
|
163475
163560
|
if (isVisitable(value)) {
|
|
163476
163561
|
return true;
|
|
163477
163562
|
}
|
|
163478
|
-
formData.append(renderKey(
|
|
163563
|
+
formData.append(renderKey(path80, key4, dots), convertValue(value));
|
|
163479
163564
|
return false;
|
|
163480
163565
|
}
|
|
163481
163566
|
const stack2 = [];
|
|
@@ -163484,16 +163569,16 @@ var require_axios = __commonJS({
|
|
|
163484
163569
|
convertValue,
|
|
163485
163570
|
isVisitable
|
|
163486
163571
|
});
|
|
163487
|
-
function build8(value,
|
|
163572
|
+
function build8(value, path80) {
|
|
163488
163573
|
if (utils$1.isUndefined(value)) return;
|
|
163489
163574
|
if (stack2.indexOf(value) !== -1) {
|
|
163490
|
-
throw Error("Circular reference detected in " +
|
|
163575
|
+
throw Error("Circular reference detected in " + path80.join("."));
|
|
163491
163576
|
}
|
|
163492
163577
|
stack2.push(value);
|
|
163493
163578
|
utils$1.forEach(value, function each(el, key4) {
|
|
163494
|
-
const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(formData, el, utils$1.isString(key4) ? key4.trim() : key4,
|
|
163579
|
+
const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(formData, el, utils$1.isString(key4) ? key4.trim() : key4, path80, exposedHelpers);
|
|
163495
163580
|
if (result === true) {
|
|
163496
|
-
build8(el,
|
|
163581
|
+
build8(el, path80 ? path80.concat(key4) : [key4]);
|
|
163497
163582
|
}
|
|
163498
163583
|
});
|
|
163499
163584
|
stack2.pop();
|
|
@@ -163682,7 +163767,7 @@ var require_axios = __commonJS({
|
|
|
163682
163767
|
};
|
|
163683
163768
|
function toURLEncodedForm(data, options) {
|
|
163684
163769
|
return toFormData(data, new platform.classes.URLSearchParams(), {
|
|
163685
|
-
visitor: function(value, key4,
|
|
163770
|
+
visitor: function(value, key4, path80, helpers) {
|
|
163686
163771
|
if (platform.isNode && utils$1.isBuffer(value)) {
|
|
163687
163772
|
this.append(key4, value.toString("base64"));
|
|
163688
163773
|
return false;
|
|
@@ -163710,11 +163795,11 @@ var require_axios = __commonJS({
|
|
|
163710
163795
|
return obj;
|
|
163711
163796
|
}
|
|
163712
163797
|
function formDataToJSON(formData) {
|
|
163713
|
-
function buildPath(
|
|
163714
|
-
let name =
|
|
163798
|
+
function buildPath(path80, value, target, index) {
|
|
163799
|
+
let name = path80[index++];
|
|
163715
163800
|
if (name === "__proto__") return true;
|
|
163716
163801
|
const isNumericKey = Number.isFinite(+name);
|
|
163717
|
-
const isLast = index >=
|
|
163802
|
+
const isLast = index >= path80.length;
|
|
163718
163803
|
name = !name && utils$1.isArray(target) ? target.length : name;
|
|
163719
163804
|
if (isLast) {
|
|
163720
163805
|
if (utils$1.hasOwnProp(target, name)) {
|
|
@@ -163727,7 +163812,7 @@ var require_axios = __commonJS({
|
|
|
163727
163812
|
if (!target[name] || !utils$1.isObject(target[name])) {
|
|
163728
163813
|
target[name] = [];
|
|
163729
163814
|
}
|
|
163730
|
-
const result = buildPath(
|
|
163815
|
+
const result = buildPath(path80, value, target[name], index);
|
|
163731
163816
|
if (result && utils$1.isArray(target[name])) {
|
|
163732
163817
|
target[name] = arrayToObject(target[name]);
|
|
163733
163818
|
}
|
|
@@ -165045,9 +165130,9 @@ var require_axios = __commonJS({
|
|
|
165045
165130
|
auth = urlUsername + ":" + urlPassword;
|
|
165046
165131
|
}
|
|
165047
165132
|
auth && headers.delete("authorization");
|
|
165048
|
-
let
|
|
165133
|
+
let path80;
|
|
165049
165134
|
try {
|
|
165050
|
-
|
|
165135
|
+
path80 = buildURL(parsed.pathname + parsed.search, config2.params, config2.paramsSerializer).replace(/^\?/, "");
|
|
165051
165136
|
} catch (err) {
|
|
165052
165137
|
const customErr = new Error(err.message);
|
|
165053
165138
|
customErr.config = config2;
|
|
@@ -165057,7 +165142,7 @@ var require_axios = __commonJS({
|
|
|
165057
165142
|
}
|
|
165058
165143
|
headers.set("Accept-Encoding", "gzip, compress, deflate" + (isBrotliSupported ? ", br" : ""), false);
|
|
165059
165144
|
const options = {
|
|
165060
|
-
path:
|
|
165145
|
+
path: path80,
|
|
165061
165146
|
method,
|
|
165062
165147
|
headers: headers.toJSON(),
|
|
165063
165148
|
agents: {
|
|
@@ -165263,14 +165348,14 @@ var require_axios = __commonJS({
|
|
|
165263
165348
|
var cookies = platform.hasStandardBrowserEnv ? (
|
|
165264
165349
|
// Standard browser envs support document.cookie
|
|
165265
165350
|
{
|
|
165266
|
-
write(name, value, expires,
|
|
165351
|
+
write(name, value, expires, path80, domain, secure, sameSite) {
|
|
165267
165352
|
if (typeof document === "undefined") return;
|
|
165268
165353
|
const cookie = [`${name}=${encodeURIComponent(value)}`];
|
|
165269
165354
|
if (utils$1.isNumber(expires)) {
|
|
165270
165355
|
cookie.push(`expires=${new Date(expires).toUTCString()}`);
|
|
165271
165356
|
}
|
|
165272
|
-
if (utils$1.isString(
|
|
165273
|
-
cookie.push(`path=${
|
|
165357
|
+
if (utils$1.isString(path80)) {
|
|
165358
|
+
cookie.push(`path=${path80}`);
|
|
165274
165359
|
}
|
|
165275
165360
|
if (utils$1.isString(domain)) {
|
|
165276
165361
|
cookie.push(`domain=${domain}`);
|
|
@@ -166791,8 +166876,8 @@ function createGetModuleFromFilename(basePath = process.argv[1] ? dirname10(proc
|
|
|
166791
166876
|
return decodedFile;
|
|
166792
166877
|
};
|
|
166793
166878
|
}
|
|
166794
|
-
function normalizeWindowsPath(
|
|
166795
|
-
return
|
|
166879
|
+
function normalizeWindowsPath(path80) {
|
|
166880
|
+
return path80.replace(/^[A-Z]:/, "").replace(/\\/g, "/");
|
|
166796
166881
|
}
|
|
166797
166882
|
async function addSourceContext(frames) {
|
|
166798
166883
|
const filesToLines = {};
|
|
@@ -166837,9 +166922,9 @@ async function addSourceContext(frames) {
|
|
|
166837
166922
|
LRU_FILE_CONTENTS_CACHE.reduce();
|
|
166838
166923
|
return frames;
|
|
166839
166924
|
}
|
|
166840
|
-
function getContextLinesFromFile(
|
|
166925
|
+
function getContextLinesFromFile(path80, ranges, output) {
|
|
166841
166926
|
return new Promise((resolve12) => {
|
|
166842
|
-
const stream = createReadStream(
|
|
166927
|
+
const stream = createReadStream(path80);
|
|
166843
166928
|
const lineReaded = createInterface2({
|
|
166844
166929
|
input: stream
|
|
166845
166930
|
});
|
|
@@ -166857,7 +166942,7 @@ function getContextLinesFromFile(path79, ranges, output) {
|
|
|
166857
166942
|
let rangeStart = range2[0];
|
|
166858
166943
|
let rangeEnd = range2[1];
|
|
166859
166944
|
function onStreamError() {
|
|
166860
|
-
LRU_FILE_CONTENTS_FS_READ_FAILED.set(
|
|
166945
|
+
LRU_FILE_CONTENTS_FS_READ_FAILED.set(path80, 1);
|
|
166861
166946
|
lineReaded.close();
|
|
166862
166947
|
lineReaded.removeAllListeners();
|
|
166863
166948
|
destroyStreamAndResolve();
|
|
@@ -166934,8 +167019,8 @@ function clearLineContext(frame) {
|
|
|
166934
167019
|
delete frame.context_line;
|
|
166935
167020
|
delete frame.post_context;
|
|
166936
167021
|
}
|
|
166937
|
-
function shouldSkipContextLinesForFile(
|
|
166938
|
-
return
|
|
167022
|
+
function shouldSkipContextLinesForFile(path80) {
|
|
167023
|
+
return path80.startsWith("node:") || path80.endsWith(".min.js") || path80.endsWith(".min.cjs") || path80.endsWith(".min.mjs") || path80.startsWith("data:");
|
|
166939
167024
|
}
|
|
166940
167025
|
function shouldSkipContextLinesForFrame(frame) {
|
|
166941
167026
|
if (frame.lineno !== void 0 && frame.lineno > MAX_CONTEXTLINES_LINENO) {
|
|
@@ -170284,7 +170369,7 @@ function readToolVersion() {
|
|
|
170284
170369
|
if (cachedVersion)
|
|
170285
170370
|
return cachedVersion;
|
|
170286
170371
|
if (true) {
|
|
170287
|
-
cachedVersion = "0.7.0-next.
|
|
170372
|
+
cachedVersion = "0.7.0-next.4";
|
|
170288
170373
|
return cachedVersion;
|
|
170289
170374
|
}
|
|
170290
170375
|
try {
|
|
@@ -172690,13 +172775,13 @@ var init_pexprs_toFailure = __esm({
|
|
|
172690
172775
|
return new Failure(this, "a Unicode [" + this.categoryOrProp + "] character", "description");
|
|
172691
172776
|
};
|
|
172692
172777
|
Alt.prototype.toFailure = function(grammar2) {
|
|
172693
|
-
const
|
|
172694
|
-
const description = "(" +
|
|
172778
|
+
const fs70 = this.terms.map((t2) => t2.toFailure(grammar2));
|
|
172779
|
+
const description = "(" + fs70.join(" or ") + ")";
|
|
172695
172780
|
return new Failure(this, description, "description");
|
|
172696
172781
|
};
|
|
172697
172782
|
Seq.prototype.toFailure = function(grammar2) {
|
|
172698
|
-
const
|
|
172699
|
-
const description = "(" +
|
|
172783
|
+
const fs70 = this.factors.map((f2) => f2.toFailure(grammar2));
|
|
172784
|
+
const description = "(" + fs70.join(" ") + ")";
|
|
172700
172785
|
return new Failure(this, description, "description");
|
|
172701
172786
|
};
|
|
172702
172787
|
Iter.prototype.toFailure = function(grammar2) {
|
|
@@ -174533,9 +174618,9 @@ function buildGrammar2(match4, namespace, optOhmGrammarForTesting, options) {
|
|
|
174533
174618
|
decl.withSuperGrammar(namespace[superGrammarName]);
|
|
174534
174619
|
}
|
|
174535
174620
|
},
|
|
174536
|
-
Rule_define(n,
|
|
174621
|
+
Rule_define(n, fs70, d3, _2, b) {
|
|
174537
174622
|
currentRuleName = n.visit();
|
|
174538
|
-
currentRuleFormals =
|
|
174623
|
+
currentRuleFormals = fs70.children.map((c2) => c2.visit())[0] || [];
|
|
174539
174624
|
if (!decl.defaultStartRule && decl.ensureSuperGrammar() !== Grammar.ProtoBuiltInRules) {
|
|
174540
174625
|
decl.withDefaultStartRule(currentRuleName);
|
|
174541
174626
|
}
|
|
@@ -174544,9 +174629,9 @@ function buildGrammar2(match4, namespace, optOhmGrammarForTesting, options) {
|
|
|
174544
174629
|
const source = this.source.trimmed();
|
|
174545
174630
|
return decl.define(currentRuleName, currentRuleFormals, body, description, source);
|
|
174546
174631
|
},
|
|
174547
|
-
Rule_override(n,
|
|
174632
|
+
Rule_override(n, fs70, _2, b) {
|
|
174548
174633
|
currentRuleName = n.visit();
|
|
174549
|
-
currentRuleFormals =
|
|
174634
|
+
currentRuleFormals = fs70.children.map((c2) => c2.visit())[0] || [];
|
|
174550
174635
|
const source = this.source.trimmed();
|
|
174551
174636
|
decl.ensureSuperGrammarRuleForOverriding(currentRuleName, source);
|
|
174552
174637
|
overriding = true;
|
|
@@ -174554,9 +174639,9 @@ function buildGrammar2(match4, namespace, optOhmGrammarForTesting, options) {
|
|
|
174554
174639
|
overriding = false;
|
|
174555
174640
|
return decl.override(currentRuleName, currentRuleFormals, body, null, source);
|
|
174556
174641
|
},
|
|
174557
|
-
Rule_extend(n,
|
|
174642
|
+
Rule_extend(n, fs70, _2, b) {
|
|
174558
174643
|
currentRuleName = n.visit();
|
|
174559
|
-
currentRuleFormals =
|
|
174644
|
+
currentRuleFormals = fs70.children.map((c2) => c2.visit())[0] || [];
|
|
174560
174645
|
const body = b.visit();
|
|
174561
174646
|
const source = this.source.trimmed();
|
|
174562
174647
|
return decl.extend(currentRuleName, currentRuleFormals, body, null, source);
|
|
@@ -174583,8 +174668,8 @@ function buildGrammar2(match4, namespace, optOhmGrammarForTesting, options) {
|
|
|
174583
174668
|
return builder.alt(...args).withSource(this.source);
|
|
174584
174669
|
}
|
|
174585
174670
|
},
|
|
174586
|
-
Formals(opointy,
|
|
174587
|
-
return
|
|
174671
|
+
Formals(opointy, fs70, cpointy) {
|
|
174672
|
+
return fs70.visit();
|
|
174588
174673
|
},
|
|
174589
174674
|
Params(opointy, ps, cpointy) {
|
|
174590
174675
|
return ps.visit();
|
|
@@ -174746,8 +174831,8 @@ function initPrototypeParser(grammar2) {
|
|
|
174746
174831
|
formals: optFormals.children.map((c2) => c2.parse())[0] || []
|
|
174747
174832
|
};
|
|
174748
174833
|
},
|
|
174749
|
-
Formals(oparen,
|
|
174750
|
-
return
|
|
174834
|
+
Formals(oparen, fs70, cparen) {
|
|
174835
|
+
return fs70.asIteration().children.map((c2) => c2.parse());
|
|
174751
174836
|
},
|
|
174752
174837
|
name(first2, rest) {
|
|
174753
174838
|
return this.sourceString;
|
|
@@ -178068,8 +178153,8 @@ function parseAndResolve(files) {
|
|
|
178068
178153
|
const parsed = files.map((f2) => parseOne(f2.path, f2.source));
|
|
178069
178154
|
return resolve10(parsed);
|
|
178070
178155
|
}
|
|
178071
|
-
function parseTcFile(
|
|
178072
|
-
return parseOne(
|
|
178156
|
+
function parseTcFile(path80, source) {
|
|
178157
|
+
return parseOne(path80, source);
|
|
178073
178158
|
}
|
|
178074
178159
|
var LineMap, OP_VALUES;
|
|
178075
178160
|
var init_parser_ohm = __esm({
|
|
@@ -179458,13 +179543,13 @@ function extractStarletteRoutesFromFile(filePath, source, tree) {
|
|
|
179458
179543
|
const identities = starletteIdentitiesForPath(rawPath);
|
|
179459
179544
|
const line = node2.startPosition.row + 1;
|
|
179460
179545
|
for (const method of methods) {
|
|
179461
|
-
for (const
|
|
179546
|
+
for (const path80 of identities) {
|
|
179462
179547
|
out.push({
|
|
179463
|
-
identity: `${method} ${
|
|
179548
|
+
identity: `${method} ${path80}`,
|
|
179464
179549
|
contract: {
|
|
179465
179550
|
protocol: "http",
|
|
179466
179551
|
method,
|
|
179467
|
-
path:
|
|
179552
|
+
path: path80,
|
|
179468
179553
|
responses: [],
|
|
179469
179554
|
tags: []
|
|
179470
179555
|
},
|
|
@@ -179641,14 +179726,14 @@ function parseRouteDecorator(dec, source, stringVars) {
|
|
|
179641
179726
|
const args = call.childForFieldName("arguments");
|
|
179642
179727
|
if (!args)
|
|
179643
179728
|
return null;
|
|
179644
|
-
let
|
|
179729
|
+
let path80 = null;
|
|
179645
179730
|
let successStatus = "200";
|
|
179646
179731
|
for (let i = 0; i < args.namedChildCount; i++) {
|
|
179647
179732
|
const a = args.namedChild(i);
|
|
179648
179733
|
if (!a)
|
|
179649
179734
|
continue;
|
|
179650
|
-
if (
|
|
179651
|
-
|
|
179735
|
+
if (path80 === null && a.type === "string")
|
|
179736
|
+
path80 = pyStr(a, source);
|
|
179652
179737
|
else if (a.type === "keyword_argument") {
|
|
179653
179738
|
const name = a.childForFieldName("name");
|
|
179654
179739
|
const value = a.childForFieldName("value");
|
|
@@ -179657,17 +179742,17 @@ function parseRouteDecorator(dec, source, stringVars) {
|
|
|
179657
179742
|
}
|
|
179658
179743
|
}
|
|
179659
179744
|
}
|
|
179660
|
-
if (
|
|
179745
|
+
if (path80 === null) {
|
|
179661
179746
|
const firstArg = args.namedChild(0);
|
|
179662
179747
|
if (firstArg?.type === "identifier") {
|
|
179663
179748
|
const resolved = stringVars.get(source.slice(firstArg.startIndex, firstArg.endIndex));
|
|
179664
179749
|
if (resolved !== void 0)
|
|
179665
|
-
|
|
179750
|
+
path80 = resolved;
|
|
179666
179751
|
}
|
|
179667
179752
|
}
|
|
179668
|
-
if (
|
|
179753
|
+
if (path80 === null)
|
|
179669
179754
|
return null;
|
|
179670
|
-
return { method, path:
|
|
179755
|
+
return { method, path: path80, routerVar, successStatus };
|
|
179671
179756
|
}
|
|
179672
179757
|
function extractResponses2(body, source, successStatus) {
|
|
179673
179758
|
const byStatus = /* @__PURE__ */ new Map();
|
|
@@ -179800,9 +179885,9 @@ function looksLikeModel(p2, source) {
|
|
|
179800
179885
|
const text4 = source.slice(type2.startIndex, type2.endIndex);
|
|
179801
179886
|
return /^[A-Z]/.test(text4);
|
|
179802
179887
|
}
|
|
179803
|
-
function joinPath(prefix,
|
|
179888
|
+
function joinPath(prefix, path80) {
|
|
179804
179889
|
const a = prefix.replace(/\/$/, "");
|
|
179805
|
-
const b =
|
|
179890
|
+
const b = path80.startsWith("/") ? path80 : `/${path80}`;
|
|
179806
179891
|
return a + b || "/";
|
|
179807
179892
|
}
|
|
179808
179893
|
function callName(call, source) {
|
|
@@ -196095,8 +196180,8 @@ async function runRulesReset({ ruleKey }) {
|
|
|
196095
196180
|
|
|
196096
196181
|
// tools/cli/src/commands/contracts.ts
|
|
196097
196182
|
init_dist4();
|
|
196098
|
-
import
|
|
196099
|
-
import
|
|
196183
|
+
import fs67 from "node:fs";
|
|
196184
|
+
import path73 from "node:path";
|
|
196100
196185
|
|
|
196101
196186
|
// packages/spec-consolidator/dist/types.js
|
|
196102
196187
|
init_zod();
|
|
@@ -197486,12 +197571,12 @@ function prefilterDocs(docs, manualIncludes = []) {
|
|
|
197486
197571
|
if (reason)
|
|
197487
197572
|
reasons.set(doc.path, reason);
|
|
197488
197573
|
}
|
|
197489
|
-
for (const { path:
|
|
197490
|
-
reasons.set(
|
|
197574
|
+
for (const { path: path80, reason } of dedupeNearDuplicates(docs.filter((d3) => !manualSet.has(d3.path) && !reasons.has(d3.path)))) {
|
|
197575
|
+
reasons.set(path80, reason);
|
|
197491
197576
|
}
|
|
197492
197577
|
return {
|
|
197493
197578
|
toClassify: docs.filter((d3) => !reasons.has(d3.path)),
|
|
197494
|
-
skipped: [...reasons].map(([
|
|
197579
|
+
skipped: [...reasons].map(([path80, reason]) => ({ path: path80, reason }))
|
|
197495
197580
|
};
|
|
197496
197581
|
}
|
|
197497
197582
|
async function planRelevanceWork(repoRoot5, docs, manualIncludes = []) {
|
|
@@ -198057,8 +198142,8 @@ function canonicalIdentity(_kind, identity) {
|
|
|
198057
198142
|
let id = identity.trim().replace(/\s+/g, " ");
|
|
198058
198143
|
const op = HTTP_METHOD.exec(id);
|
|
198059
198144
|
if (op) {
|
|
198060
|
-
const
|
|
198061
|
-
id = `${op[1].toUpperCase()} ${
|
|
198145
|
+
const path80 = op[2].replace(/\/+$/, "").replace(/:([A-Za-z_][A-Za-z0-9_]*)/g, "{$1}");
|
|
198146
|
+
id = `${op[1].toUpperCase()} ${path80}`;
|
|
198062
198147
|
}
|
|
198063
198148
|
return id;
|
|
198064
198149
|
}
|
|
@@ -204900,6 +204985,7 @@ var HISTORY_FILE2 = "history.json";
|
|
|
204900
204985
|
var RESULT_FILE = "result.json";
|
|
204901
204986
|
var RECIPE_FILE = "recipe.json";
|
|
204902
204987
|
var MANIFEST_FILE = "manifest.json";
|
|
204988
|
+
var DECISIONS_FILE = "decisions.json";
|
|
204903
204989
|
function guardDir(repoRoot5) {
|
|
204904
204990
|
return path54.join(repoRoot5, TRUECOURSE_DIR3, GUARD_DIR);
|
|
204905
204991
|
}
|
|
@@ -204927,6 +205013,9 @@ function recipePath(repoRoot5) {
|
|
|
204927
205013
|
function manifestPath2(repoRoot5) {
|
|
204928
205014
|
return path54.join(scenariosDir(repoRoot5), MANIFEST_FILE);
|
|
204929
205015
|
}
|
|
205016
|
+
function guardDecisionsPath(repoRoot5) {
|
|
205017
|
+
return path54.join(scenariosDir(repoRoot5), DECISIONS_FILE);
|
|
205018
|
+
}
|
|
204930
205019
|
function evidenceRunDir(repoRoot5, runId) {
|
|
204931
205020
|
return path54.join(guardDir(repoRoot5), EVIDENCE_DIR, runId);
|
|
204932
205021
|
}
|
|
@@ -205070,6 +205159,10 @@ ${err.message}`;
|
|
|
205070
205159
|
});
|
|
205071
205160
|
}
|
|
205072
205161
|
|
|
205162
|
+
// packages/guard-runner/dist/preflight.js
|
|
205163
|
+
import fs51 from "node:fs";
|
|
205164
|
+
import path57 from "node:path";
|
|
205165
|
+
|
|
205073
205166
|
// packages/guard-runner/dist/sandbox.js
|
|
205074
205167
|
import fs50 from "node:fs";
|
|
205075
205168
|
import os11 from "node:os";
|
|
@@ -205215,24 +205308,25 @@ function executeStep(opts) {
|
|
|
205215
205308
|
// packages/guard-runner/dist/preflight.js
|
|
205216
205309
|
var ENTRY_PROBE_ARGVS = [[], ["--help"]];
|
|
205217
205310
|
var ENTRY_PREFLIGHT_TIMEOUT_MS = 2e4;
|
|
205218
|
-
var defaultEntryProbeExecutor =
|
|
205219
|
-
const sandbox = createSandbox({ recipeEnv });
|
|
205220
|
-
try {
|
|
205221
|
-
return await executeStep({ argv: fullArgv, cwd: sandbox.cwd, env: sandbox.env, timeoutMs });
|
|
205222
|
-
} finally {
|
|
205223
|
-
sandbox.cleanup();
|
|
205224
|
-
}
|
|
205225
|
-
};
|
|
205311
|
+
var defaultEntryProbeExecutor = (fullArgv, world, timeoutMs) => executeStep({ argv: fullArgv, cwd: world.cwd, env: world.env, timeoutMs });
|
|
205226
205312
|
async function preflightEntry(opts) {
|
|
205227
205313
|
const exec3 = opts.exec ?? defaultEntryProbeExecutor;
|
|
205228
205314
|
const timeoutMs = opts.timeoutMs ?? ENTRY_PREFLIGHT_TIMEOUT_MS;
|
|
205229
205315
|
const entry = opts.displayEntry.join(" ");
|
|
205230
|
-
const
|
|
205231
|
-
|
|
205232
|
-
|
|
205233
|
-
|
|
205316
|
+
const sandbox = createSandbox({ recipeEnv: opts.recipeEnv });
|
|
205317
|
+
const probes = [];
|
|
205318
|
+
try {
|
|
205319
|
+
for (const argv of ENTRY_PROBE_ARGVS) {
|
|
205320
|
+
probes.push({
|
|
205321
|
+
argv: [...argv],
|
|
205322
|
+
capture: await exec3([...opts.resolvedEntry, ...argv], { cwd: sandbox.cwd, env: sandbox.env }, timeoutMs)
|
|
205323
|
+
});
|
|
205324
|
+
}
|
|
205325
|
+
} finally {
|
|
205326
|
+
sandbox.cleanup();
|
|
205327
|
+
}
|
|
205234
205328
|
const ok = entryStarts(probes);
|
|
205235
|
-
return { ok, entry, stderr: ok ? "" :
|
|
205329
|
+
return { ok, entry, stderr: ok ? "" : deadEntryOutput(opts, probes[0].capture, timeoutMs), probes };
|
|
205236
205330
|
}
|
|
205237
205331
|
function entryStarts(probes) {
|
|
205238
205332
|
if (probes.some((p2) => startedCleanly(p2.capture)))
|
|
@@ -205253,6 +205347,15 @@ function failureShape(c2) {
|
|
|
205253
205347
|
stderr: c2.stderr
|
|
205254
205348
|
});
|
|
205255
205349
|
}
|
|
205350
|
+
function deadEntryOutput(opts, bare, timeoutMs) {
|
|
205351
|
+
const parts = [startupOutput(bare, timeoutMs)];
|
|
205352
|
+
if (opts.repoRoot) {
|
|
205353
|
+
const missing = missingEntryScript(opts.repoRoot, opts.displayEntry);
|
|
205354
|
+
if (missing)
|
|
205355
|
+
parts.push(formatMissingEntryScript(missing));
|
|
205356
|
+
}
|
|
205357
|
+
return parts.join("\n\n");
|
|
205358
|
+
}
|
|
205256
205359
|
function startupOutput(c2, timeoutMs) {
|
|
205257
205360
|
const parts = [];
|
|
205258
205361
|
const primary = c2.stderr || c2.stdout;
|
|
@@ -205267,6 +205370,47 @@ function startupOutput(c2, timeoutMs) {
|
|
|
205267
205370
|
}
|
|
205268
205371
|
return parts.join("\n");
|
|
205269
205372
|
}
|
|
205373
|
+
var MAX_SIBLINGS = 25;
|
|
205374
|
+
function missingEntryScript(repoRoot5, entry) {
|
|
205375
|
+
const [command, ...rest] = entry;
|
|
205376
|
+
const candidates = [];
|
|
205377
|
+
if (command && isPathLike(command))
|
|
205378
|
+
candidates.push(command);
|
|
205379
|
+
for (const arg of rest) {
|
|
205380
|
+
if (!arg.startsWith("-") && isPathLike(arg))
|
|
205381
|
+
candidates.push(arg);
|
|
205382
|
+
}
|
|
205383
|
+
for (const arg of candidates) {
|
|
205384
|
+
const resolved = path57.isAbsolute(arg) ? arg : path57.resolve(repoRoot5, arg);
|
|
205385
|
+
if (fs51.existsSync(resolved))
|
|
205386
|
+
continue;
|
|
205387
|
+
const parent = path57.dirname(resolved);
|
|
205388
|
+
const siblings = fs51.existsSync(parent) ? fs51.readdirSync(parent).sort() : null;
|
|
205389
|
+
return {
|
|
205390
|
+
arg,
|
|
205391
|
+
resolved,
|
|
205392
|
+
parentDir: path57.isAbsolute(arg) ? parent : path57.relative(repoRoot5, parent) || ".",
|
|
205393
|
+
siblings
|
|
205394
|
+
};
|
|
205395
|
+
}
|
|
205396
|
+
return null;
|
|
205397
|
+
}
|
|
205398
|
+
function formatMissingEntryScript(m) {
|
|
205399
|
+
const head = `entry file not found: ${m.arg} (resolved: ${m.resolved})`;
|
|
205400
|
+
if (m.siblings === null)
|
|
205401
|
+
return `${head}
|
|
205402
|
+
its directory ${m.parentDir}/ does not exist`;
|
|
205403
|
+
if (m.siblings.length === 0)
|
|
205404
|
+
return `${head}
|
|
205405
|
+
${m.parentDir}/ is empty`;
|
|
205406
|
+
const shown = m.siblings.slice(0, MAX_SIBLINGS).join(", ");
|
|
205407
|
+
const more = m.siblings.length - MAX_SIBLINGS;
|
|
205408
|
+
return `${head}
|
|
205409
|
+
${m.parentDir}/ contains: ${shown}${more > 0 ? ` \u2026 and ${more} more` : ""}`;
|
|
205410
|
+
}
|
|
205411
|
+
function isPathLike(arg) {
|
|
205412
|
+
return arg.includes("/") || arg.includes(path57.sep) || arg.startsWith(".");
|
|
205413
|
+
}
|
|
205270
205414
|
function entryPreflightHeadline(entry, buildCommand) {
|
|
205271
205415
|
return `The recipe entry \`${entry}\` failed to start \u2014 it crashes before it runs, so every scenario would fail identically. Rebuild it with \`${buildCommand}\` (its build output is likely stale or incomplete), then retry.`;
|
|
205272
205416
|
}
|
|
@@ -205276,8 +205420,8 @@ function formatEntryPreflightError(opts) {
|
|
|
205276
205420
|
|
|
205277
205421
|
// packages/guard-runner/dist/capabilities/git.js
|
|
205278
205422
|
import { spawnSync as spawnSync2 } from "node:child_process";
|
|
205279
|
-
import
|
|
205280
|
-
import
|
|
205423
|
+
import fs52 from "node:fs";
|
|
205424
|
+
import path58 from "node:path";
|
|
205281
205425
|
var GIT_IDENTITY = {
|
|
205282
205426
|
GIT_AUTHOR_NAME: "TrueCourse Guard",
|
|
205283
205427
|
GIT_AUTHOR_EMAIL: "guard@truecourse.dev",
|
|
@@ -205309,11 +205453,11 @@ function materializeGit(declaration, ctx) {
|
|
|
205309
205453
|
}
|
|
205310
205454
|
function requireFiles(files, ctx) {
|
|
205311
205455
|
for (const rel of files) {
|
|
205312
|
-
const target =
|
|
205313
|
-
if (target !== ctx.cwd && !target.startsWith(ctx.cwd +
|
|
205456
|
+
const target = path58.resolve(ctx.cwd, rel);
|
|
205457
|
+
if (target !== ctx.cwd && !target.startsWith(ctx.cwd + path58.sep)) {
|
|
205314
205458
|
throw new CapabilityError("git", `path escapes the sandbox: ${rel}`);
|
|
205315
205459
|
}
|
|
205316
|
-
if (!
|
|
205460
|
+
if (!fs52.existsSync(target)) {
|
|
205317
205461
|
throw new CapabilityError("git", `declared file does not exist in the sandbox: ${rel} (seed it via setup.files or an earlier commit)`);
|
|
205318
205462
|
}
|
|
205319
205463
|
}
|
|
@@ -205401,8 +205545,8 @@ function normalize7(text4, normalizers, ctx) {
|
|
|
205401
205545
|
}
|
|
205402
205546
|
|
|
205403
205547
|
// packages/guard-runner/dist/expect.js
|
|
205404
|
-
import
|
|
205405
|
-
import
|
|
205548
|
+
import fs53 from "node:fs";
|
|
205549
|
+
import path59 from "node:path";
|
|
205406
205550
|
function evaluateExpect(params) {
|
|
205407
205551
|
const { expect } = params;
|
|
205408
205552
|
if (expect.exit !== void 0 && params.exitCode !== expect.exit) {
|
|
@@ -205473,8 +205617,8 @@ function matchStream(subject, matcher, value) {
|
|
|
205473
205617
|
};
|
|
205474
205618
|
}
|
|
205475
205619
|
function matchFile3(rel, matcher, sandboxCwd, normalizeText) {
|
|
205476
|
-
const target =
|
|
205477
|
-
const exists2 =
|
|
205620
|
+
const target = path59.resolve(sandboxCwd, rel);
|
|
205621
|
+
const exists2 = fs53.existsSync(target) && fs53.statSync(target).isFile();
|
|
205478
205622
|
if (matcher.exists === true || matcher.absent === false) {
|
|
205479
205623
|
if (!exists2)
|
|
205480
205624
|
return fileMiss(rel, "to exist", "missing");
|
|
@@ -205486,7 +205630,7 @@ function matchFile3(rel, matcher, sandboxCwd, normalizeText) {
|
|
|
205486
205630
|
if (matcher.equals !== void 0 || matcher.contains !== void 0) {
|
|
205487
205631
|
if (!exists2)
|
|
205488
205632
|
return fileMiss(rel, "to exist for a content check", "missing");
|
|
205489
|
-
const content = normalizeText(
|
|
205633
|
+
const content = normalizeText(fs53.readFileSync(target, "utf-8"));
|
|
205490
205634
|
if (matcher.equals !== void 0 && content !== matcher.equals) {
|
|
205491
205635
|
return {
|
|
205492
205636
|
subject: "files",
|
|
@@ -205516,11 +205660,11 @@ function fileMiss(rel, expectedPhrase, actualState) {
|
|
|
205516
205660
|
}
|
|
205517
205661
|
|
|
205518
205662
|
// packages/guard-runner/dist/evidence.js
|
|
205519
|
-
import
|
|
205520
|
-
import
|
|
205663
|
+
import fs54 from "node:fs";
|
|
205664
|
+
import path60 from "node:path";
|
|
205521
205665
|
function writeEvidence(params) {
|
|
205522
205666
|
const dir = evidenceScenarioDir(params.repoRoot, params.runId, params.scenarioId);
|
|
205523
|
-
|
|
205667
|
+
fs54.mkdirSync(dir, { recursive: true });
|
|
205524
205668
|
const failing = params.steps.find((s) => s.index === params.failingStep);
|
|
205525
205669
|
const invocation = {
|
|
205526
205670
|
scenarioId: params.scenarioId,
|
|
@@ -205599,11 +205743,19 @@ function indent(text4) {
|
|
|
205599
205743
|
return body.split("\n").map((l) => ` ${l}`).join("\n");
|
|
205600
205744
|
}
|
|
205601
205745
|
function writeFile(dir, name, content) {
|
|
205602
|
-
|
|
205746
|
+
fs54.writeFileSync(path60.join(dir, name), content);
|
|
205603
205747
|
}
|
|
205604
205748
|
|
|
205605
205749
|
// packages/guard-runner/dist/run-scenario.js
|
|
205606
205750
|
var ENV_PINS = DETERMINISM_PINS;
|
|
205751
|
+
var SANDBOX_SETUP_EXPECTED = "sandbox setup to succeed";
|
|
205752
|
+
var CAPABILITY_SETUP_EXPECTED = "setup capabilities to materialize";
|
|
205753
|
+
function isSetupDefectResult(result) {
|
|
205754
|
+
if (result.outcome !== "error")
|
|
205755
|
+
return false;
|
|
205756
|
+
const expected = result.failure?.expected;
|
|
205757
|
+
return expected === SANDBOX_SETUP_EXPECTED || expected === CAPABILITY_SETUP_EXPECTED;
|
|
205758
|
+
}
|
|
205607
205759
|
async function runScenario(scenario, ctx) {
|
|
205608
205760
|
const start = Date.now();
|
|
205609
205761
|
const base2 = {
|
|
@@ -205624,7 +205776,7 @@ async function runScenario(scenario, ctx) {
|
|
|
205624
205776
|
...base2,
|
|
205625
205777
|
outcome: "error",
|
|
205626
205778
|
durationMs: Date.now() - start,
|
|
205627
|
-
failure: { step: 1, expected:
|
|
205779
|
+
failure: { step: 1, expected: SANDBOX_SETUP_EXPECTED, actual: message }
|
|
205628
205780
|
};
|
|
205629
205781
|
}
|
|
205630
205782
|
const normCtx = { sandboxRoot: sandbox.root, repoRoot: ctx.repoRoot };
|
|
@@ -205639,7 +205791,7 @@ async function runScenario(scenario, ctx) {
|
|
|
205639
205791
|
...base2,
|
|
205640
205792
|
outcome: "error",
|
|
205641
205793
|
durationMs: Date.now() - start,
|
|
205642
|
-
failure: { step: 1, expected:
|
|
205794
|
+
failure: { step: 1, expected: CAPABILITY_SETUP_EXPECTED, actual: message }
|
|
205643
205795
|
};
|
|
205644
205796
|
}
|
|
205645
205797
|
for (let i = 0; i < scenario.steps.length; i++) {
|
|
@@ -205748,15 +205900,15 @@ function toRecord(index, argv, stdin, repeat3, iterationsRun, capture, normText)
|
|
|
205748
205900
|
|
|
205749
205901
|
// packages/guard-runner/dist/doc-index.js
|
|
205750
205902
|
init_zod();
|
|
205751
|
-
import
|
|
205752
|
-
import
|
|
205903
|
+
import fs55 from "node:fs";
|
|
205904
|
+
import path62 from "node:path";
|
|
205753
205905
|
|
|
205754
205906
|
// packages/guard-runner/dist/section-index.js
|
|
205755
|
-
import
|
|
205907
|
+
import path61 from "node:path";
|
|
205756
205908
|
import crypto4 from "node:crypto";
|
|
205757
205909
|
var MARKDOWN_EXTENSIONS = /* @__PURE__ */ new Set([".md", ".markdown", ".mdown", ".mkd"]);
|
|
205758
205910
|
function isMarkdownDoc(docPath) {
|
|
205759
|
-
return MARKDOWN_EXTENSIONS.has(
|
|
205911
|
+
return MARKDOWN_EXTENSIONS.has(path61.extname(docPath).toLowerCase());
|
|
205760
205912
|
}
|
|
205761
205913
|
function slugifyHeading(text4) {
|
|
205762
205914
|
return text4.replace(/[`*_~]/g, "").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
@@ -205809,7 +205961,7 @@ function sectionEndLine(headings, index, totalLines) {
|
|
|
205809
205961
|
}
|
|
205810
205962
|
function deriveSections(doc, content) {
|
|
205811
205963
|
if (!isMarkdownDoc(doc)) {
|
|
205812
|
-
const base2 =
|
|
205964
|
+
const base2 = path61.basename(doc);
|
|
205813
205965
|
return [
|
|
205814
205966
|
{
|
|
205815
205967
|
anchor: slugifyHeading(base2) || "document",
|
|
@@ -205910,11 +206062,11 @@ function resolveBinding(index, anchor, fingerprint2) {
|
|
|
205910
206062
|
// packages/guard-runner/dist/doc-index.js
|
|
205911
206063
|
var CorpusShape = external_exports.object({ docs: external_exports.array(external_exports.object({ ref: external_exports.string() }).passthrough()).optional() }).passthrough();
|
|
205912
206064
|
function corpusKeptDocs(repoRoot5) {
|
|
205913
|
-
const file =
|
|
205914
|
-
if (!
|
|
206065
|
+
const file = path62.join(repoRoot5, ".truecourse", "specs", "corpus.json");
|
|
206066
|
+
if (!fs55.existsSync(file))
|
|
205915
206067
|
return [];
|
|
205916
206068
|
try {
|
|
205917
|
-
const parsed = CorpusShape.safeParse(JSON.parse(
|
|
206069
|
+
const parsed = CorpusShape.safeParse(JSON.parse(fs55.readFileSync(file, "utf-8")));
|
|
205918
206070
|
if (!parsed.success)
|
|
205919
206071
|
return [];
|
|
205920
206072
|
return (parsed.data.docs ?? []).map((d3) => d3.ref);
|
|
@@ -205929,25 +206081,25 @@ function indexRepoDocs(repoRoot5, boundDocs) {
|
|
|
205929
206081
|
const indexes = /* @__PURE__ */ new Map();
|
|
205930
206082
|
const missing = /* @__PURE__ */ new Set();
|
|
205931
206083
|
for (const doc of wanted) {
|
|
205932
|
-
const abs =
|
|
205933
|
-
if (!
|
|
206084
|
+
const abs = path62.resolve(repoRoot5, doc);
|
|
206085
|
+
if (!fs55.existsSync(abs) || !fs55.statSync(abs).isFile()) {
|
|
205934
206086
|
missing.add(doc);
|
|
205935
206087
|
continue;
|
|
205936
206088
|
}
|
|
205937
|
-
indexes.set(doc, buildDocSectionIndex(doc,
|
|
206089
|
+
indexes.set(doc, buildDocSectionIndex(doc, fs55.readFileSync(abs, "utf-8")));
|
|
205938
206090
|
}
|
|
205939
206091
|
return { indexes, missing };
|
|
205940
206092
|
}
|
|
205941
206093
|
|
|
205942
206094
|
// packages/guard-runner/dist/manifest.js
|
|
205943
206095
|
init_dist5();
|
|
205944
|
-
import
|
|
206096
|
+
import fs56 from "node:fs";
|
|
205945
206097
|
function readManifest2(repoRoot5) {
|
|
205946
206098
|
const file = manifestPath2(repoRoot5);
|
|
205947
|
-
if (!
|
|
206099
|
+
if (!fs56.existsSync(file))
|
|
205948
206100
|
return null;
|
|
205949
206101
|
try {
|
|
205950
|
-
const parsed = GuardManifestSchema.safeParse(JSON.parse(
|
|
206102
|
+
const parsed = GuardManifestSchema.safeParse(JSON.parse(fs56.readFileSync(file, "utf-8")));
|
|
205951
206103
|
return parsed.success ? parsed.data : null;
|
|
205952
206104
|
} catch {
|
|
205953
206105
|
return null;
|
|
@@ -205996,7 +206148,8 @@ async function runGuard(opts) {
|
|
|
205996
206148
|
const preflight = await preflightEntry({
|
|
205997
206149
|
resolvedEntry,
|
|
205998
206150
|
displayEntry: loaded.recipe.entry,
|
|
205999
|
-
recipeEnv: loaded.recipe.env
|
|
206151
|
+
recipeEnv: loaded.recipe.env,
|
|
206152
|
+
repoRoot: repoRoot5
|
|
206000
206153
|
});
|
|
206001
206154
|
if (!preflight.ok) {
|
|
206002
206155
|
return { status: "entry-preflight-failed", preflight, buildCommand: loaded.recipe.build, loadErrors };
|
|
@@ -206118,13 +206271,28 @@ async function mapWithConcurrency(items, limit, fn) {
|
|
|
206118
206271
|
return results;
|
|
206119
206272
|
}
|
|
206120
206273
|
|
|
206274
|
+
// packages/guard-runner/dist/decisions.js
|
|
206275
|
+
init_dist5();
|
|
206276
|
+
import fs57 from "node:fs";
|
|
206277
|
+
function readGuardDecisions(repoRoot5) {
|
|
206278
|
+
const file = guardDecisionsPath(repoRoot5);
|
|
206279
|
+
if (!fs57.existsSync(file))
|
|
206280
|
+
return EMPTY_GUARD_DECISIONS;
|
|
206281
|
+
try {
|
|
206282
|
+
const parsed = GuardDecisionsSchema.safeParse(JSON.parse(fs57.readFileSync(file, "utf-8")));
|
|
206283
|
+
return parsed.success ? parsed.data : EMPTY_GUARD_DECISIONS;
|
|
206284
|
+
} catch {
|
|
206285
|
+
return EMPTY_GUARD_DECISIONS;
|
|
206286
|
+
}
|
|
206287
|
+
}
|
|
206288
|
+
|
|
206121
206289
|
// packages/guard-generator/dist/generate.js
|
|
206122
206290
|
init_dist5();
|
|
206123
206291
|
|
|
206124
206292
|
// packages/guard-generator/dist/section-plan.js
|
|
206125
206293
|
init_zod();
|
|
206126
|
-
import
|
|
206127
|
-
import
|
|
206294
|
+
import fs58 from "node:fs";
|
|
206295
|
+
import path63 from "node:path";
|
|
206128
206296
|
import { createHash as createHash15 } from "node:crypto";
|
|
206129
206297
|
init_dist5();
|
|
206130
206298
|
|
|
@@ -206439,12 +206607,12 @@ var CorpusShape2 = external_exports.object({
|
|
|
206439
206607
|
docs: external_exports.array(external_exports.object({ ref: external_exports.string(), areaTags: external_exports.array(external_exports.string()).optional() }).passthrough()).optional()
|
|
206440
206608
|
}).passthrough();
|
|
206441
206609
|
function readCorpusAreaTags(repoRoot5) {
|
|
206442
|
-
const file =
|
|
206610
|
+
const file = path63.join(repoRoot5, ".truecourse", "specs", "corpus.json");
|
|
206443
206611
|
const map2 = /* @__PURE__ */ new Map();
|
|
206444
|
-
if (!
|
|
206612
|
+
if (!fs58.existsSync(file))
|
|
206445
206613
|
return map2;
|
|
206446
206614
|
try {
|
|
206447
|
-
const parsed = CorpusShape2.safeParse(JSON.parse(
|
|
206615
|
+
const parsed = CorpusShape2.safeParse(JSON.parse(fs58.readFileSync(file, "utf-8")));
|
|
206448
206616
|
if (!parsed.success)
|
|
206449
206617
|
return map2;
|
|
206450
206618
|
for (const d3 of parsed.data.docs ?? [])
|
|
@@ -206463,17 +206631,17 @@ function generationInputsHash(fingerprint2, recipeFingerprint) {
|
|
|
206463
206631
|
].join("\0")).digest("hex");
|
|
206464
206632
|
}
|
|
206465
206633
|
function hasGuardUniverse(repoRoot5) {
|
|
206466
|
-
return
|
|
206634
|
+
return fs58.existsSync(path63.join(repoRoot5, ".truecourse", "specs", "corpus.json"));
|
|
206467
206635
|
}
|
|
206468
206636
|
function planGuardWork(repoRoot5, recipeFingerprint) {
|
|
206469
206637
|
const recipeFp = recipeFingerprint ?? computeRecipeFingerprint(repoRoot5);
|
|
206470
|
-
const recipeMissing = !
|
|
206638
|
+
const recipeMissing = !fs58.existsSync(recipePath(repoRoot5));
|
|
206471
206639
|
const hasUniverse = hasGuardUniverse(repoRoot5);
|
|
206472
206640
|
const { indexes } = indexRepoDocs(repoRoot5, []);
|
|
206473
206641
|
const areaTags = readCorpusAreaTags(repoRoot5);
|
|
206474
206642
|
const sections = [];
|
|
206475
206643
|
for (const [doc, index] of indexes) {
|
|
206476
|
-
const texts = extractSectionTexts(doc,
|
|
206644
|
+
const texts = extractSectionTexts(doc, fs58.readFileSync(path63.resolve(repoRoot5, doc), "utf-8"));
|
|
206477
206645
|
for (const s of index.sections) {
|
|
206478
206646
|
const t2 = texts.get(s.anchor);
|
|
206479
206647
|
sections.push({
|
|
@@ -206518,7 +206686,7 @@ function collectWorkDocs(repoRoot5, plan) {
|
|
|
206518
206686
|
}
|
|
206519
206687
|
return [...byDoc].map(([doc, sections]) => ({
|
|
206520
206688
|
doc,
|
|
206521
|
-
content:
|
|
206689
|
+
content: fs58.readFileSync(path63.resolve(repoRoot5, doc), "utf-8"),
|
|
206522
206690
|
sections
|
|
206523
206691
|
}));
|
|
206524
206692
|
}
|
|
@@ -206766,7 +206934,7 @@ function snap(raw, sections) {
|
|
|
206766
206934
|
|
|
206767
206935
|
// packages/guard-generator/dist/ground.js
|
|
206768
206936
|
init_zod();
|
|
206769
|
-
import
|
|
206937
|
+
import path64 from "node:path";
|
|
206770
206938
|
import { createHash as createHash17 } from "node:crypto";
|
|
206771
206939
|
var GROUND_CACHE_NAME = "guard/ground";
|
|
206772
206940
|
var PROBE_TIMEOUT_MS = 2e4;
|
|
@@ -206822,7 +206990,7 @@ function toProbeArgv(fragment, programNames) {
|
|
|
206822
206990
|
const tokens = fragment.trim().split(/\s+/).filter(Boolean);
|
|
206823
206991
|
if (tokens.length === 0)
|
|
206824
206992
|
return null;
|
|
206825
|
-
if (programNames.has(tokens[0]) || programNames.has(
|
|
206993
|
+
if (programNames.has(tokens[0]) || programNames.has(path64.basename(tokens[0])))
|
|
206826
206994
|
tokens.shift();
|
|
206827
206995
|
if (tokens.length === 0)
|
|
206828
206996
|
return [];
|
|
@@ -206843,7 +207011,7 @@ function programNamesOf(entry) {
|
|
|
206843
207011
|
return names;
|
|
206844
207012
|
}
|
|
206845
207013
|
function addName(set2, arg) {
|
|
206846
|
-
const base2 =
|
|
207014
|
+
const base2 = path64.basename(arg);
|
|
206847
207015
|
if (base2)
|
|
206848
207016
|
set2.add(base2);
|
|
206849
207017
|
const stem = base2.replace(/\.[^.]+$/, "");
|
|
@@ -206905,9 +207073,9 @@ function truncate3(text4) {
|
|
|
206905
207073
|
}
|
|
206906
207074
|
|
|
206907
207075
|
// packages/guard-generator/dist/recipe-discovery.js
|
|
206908
|
-
import
|
|
207076
|
+
import fs59 from "node:fs";
|
|
206909
207077
|
import os13 from "node:os";
|
|
206910
|
-
import
|
|
207078
|
+
import path65 from "node:path";
|
|
206911
207079
|
import { createHash as createHash18 } from "node:crypto";
|
|
206912
207080
|
var RECIPE_CACHE_NAME = "guard/recipe";
|
|
206913
207081
|
var DISCOVERY_INPUTS = ["package.json", "pnpm-lock.yaml", "package-lock.json", "yarn.lock", "turbo.json"];
|
|
@@ -206944,6 +207112,14 @@ async function discoverRecipe(repoRoot5, runner) {
|
|
|
206944
207112
|
proposal
|
|
206945
207113
|
};
|
|
206946
207114
|
}
|
|
207115
|
+
const missing = missingEntryScript(repoRoot5, proposal.entry);
|
|
207116
|
+
if (missing) {
|
|
207117
|
+
return {
|
|
207118
|
+
status: "verify-failed",
|
|
207119
|
+
reason: `after \`${proposal.build}\`, ${formatMissingEntryScript(missing)}`,
|
|
207120
|
+
proposal
|
|
207121
|
+
};
|
|
207122
|
+
}
|
|
206947
207123
|
const probe = await probeEntry(repoRoot5, proposal.entry);
|
|
206948
207124
|
if (!probe.ok)
|
|
206949
207125
|
return { status: "verify-failed", reason: probe.reason, proposal };
|
|
@@ -206953,13 +207129,13 @@ async function discoverRecipe(repoRoot5, runner) {
|
|
|
206953
207129
|
...proposal.env ? { env: proposal.env } : {}
|
|
206954
207130
|
};
|
|
206955
207131
|
const target = recipePath(repoRoot5);
|
|
206956
|
-
|
|
206957
|
-
|
|
207132
|
+
fs59.mkdirSync(path65.dirname(target), { recursive: true });
|
|
207133
|
+
fs59.writeFileSync(target, JSON.stringify(recipe, null, 2) + "\n");
|
|
206958
207134
|
return {
|
|
206959
207135
|
status: "discovered",
|
|
206960
207136
|
recipe,
|
|
206961
207137
|
fingerprint: computeRecipeFingerprint(repoRoot5),
|
|
206962
|
-
wrotePath:
|
|
207138
|
+
wrotePath: path65.relative(repoRoot5, target)
|
|
206963
207139
|
};
|
|
206964
207140
|
}
|
|
206965
207141
|
async function proposeRecipeWithReask(input, runner) {
|
|
@@ -206984,14 +207160,14 @@ async function proposeRecipeWithReask(input, runner) {
|
|
|
206984
207160
|
return { error: `recipe proposal invalid after re-ask: ${flattenZodError(reParsed.error)}` };
|
|
206985
207161
|
}
|
|
206986
207162
|
function readDiscoveryInputs(repoRoot5) {
|
|
206987
|
-
const pkgPath =
|
|
206988
|
-
const packageJson =
|
|
206989
|
-
const presentInputs = DISCOVERY_INPUTS.filter((f2) =>
|
|
207163
|
+
const pkgPath = path65.join(repoRoot5, "package.json");
|
|
207164
|
+
const packageJson = fs59.existsSync(pkgPath) ? fs59.readFileSync(pkgPath, "utf-8") : "(no package.json)";
|
|
207165
|
+
const presentInputs = DISCOVERY_INPUTS.filter((f2) => fs59.existsSync(path65.join(repoRoot5, f2)));
|
|
206990
207166
|
return { packageJson, presentInputs };
|
|
206991
207167
|
}
|
|
206992
207168
|
async function probeEntry(repoRoot5, entry) {
|
|
206993
207169
|
const resolved = resolveEntry(repoRoot5, entry);
|
|
206994
|
-
const cwd =
|
|
207170
|
+
const cwd = fs59.mkdtempSync(path65.join(os13.tmpdir(), "tc-guard-probe-"));
|
|
206995
207171
|
try {
|
|
206996
207172
|
for (const args of [["--help"], []]) {
|
|
206997
207173
|
const capture = await executeStep({
|
|
@@ -207008,7 +207184,7 @@ async function probeEntry(repoRoot5, entry) {
|
|
|
207008
207184
|
reason: `entrypoint ${JSON.stringify(entry)} did not answer to \`--help\` or a bare invocation`
|
|
207009
207185
|
};
|
|
207010
207186
|
} finally {
|
|
207011
|
-
|
|
207187
|
+
fs59.rmSync(cwd, { recursive: true, force: true });
|
|
207012
207188
|
}
|
|
207013
207189
|
}
|
|
207014
207190
|
|
|
@@ -207055,8 +207231,8 @@ async function birthValidate(repoRoot5, candidates, opts = {}) {
|
|
|
207055
207231
|
}
|
|
207056
207232
|
|
|
207057
207233
|
// packages/guard-generator/dist/serialize.js
|
|
207058
|
-
import
|
|
207059
|
-
import
|
|
207234
|
+
import fs60 from "node:fs";
|
|
207235
|
+
import path66 from "node:path";
|
|
207060
207236
|
init_dist5();
|
|
207061
207237
|
function anchorLeaf(anchor) {
|
|
207062
207238
|
const segs = anchor.split("/").filter(Boolean);
|
|
@@ -207075,7 +207251,7 @@ function assignScenarioId(anchor, used) {
|
|
|
207075
207251
|
function areaOrDocSlug(section) {
|
|
207076
207252
|
if (section.areaTags.length > 0)
|
|
207077
207253
|
return slugifyHeading(section.areaTags[0]) || "area";
|
|
207078
|
-
const base2 =
|
|
207254
|
+
const base2 = path66.basename(section.doc).replace(/\.[^.]+$/, "");
|
|
207079
207255
|
return slugifyHeading(base2) || "doc";
|
|
207080
207256
|
}
|
|
207081
207257
|
function buildScenario(section, raw, id) {
|
|
@@ -207098,15 +207274,15 @@ function scenarioFileIndex(repoRoot5) {
|
|
|
207098
207274
|
const root2 = scenariosDir(repoRoot5);
|
|
207099
207275
|
const map2 = /* @__PURE__ */ new Map();
|
|
207100
207276
|
const walk20 = (dir) => {
|
|
207101
|
-
if (!
|
|
207277
|
+
if (!fs60.existsSync(dir))
|
|
207102
207278
|
return;
|
|
207103
|
-
for (const entry of
|
|
207104
|
-
const full =
|
|
207279
|
+
for (const entry of fs60.readdirSync(dir, { withFileTypes: true })) {
|
|
207280
|
+
const full = path66.join(dir, entry.name);
|
|
207105
207281
|
if (entry.isDirectory())
|
|
207106
207282
|
walk20(full);
|
|
207107
207283
|
else if (entry.isFile() && /\.ya?ml$/i.test(entry.name)) {
|
|
207108
207284
|
try {
|
|
207109
|
-
const doc = jsYaml.load(
|
|
207285
|
+
const doc = jsYaml.load(fs60.readFileSync(full, "utf-8"));
|
|
207110
207286
|
if (doc && typeof doc.id === "string")
|
|
207111
207287
|
map2.set(doc.id, full);
|
|
207112
207288
|
} catch {
|
|
@@ -207120,19 +207296,22 @@ function scenarioFileIndex(repoRoot5) {
|
|
|
207120
207296
|
function existingScenarioIds(repoRoot5) {
|
|
207121
207297
|
return new Set(loadScenarios(repoRoot5).scenarios.map((s) => s.id));
|
|
207122
207298
|
}
|
|
207299
|
+
function serializeScenarioYaml(scenario) {
|
|
207300
|
+
return jsYaml.dump(scenario, { lineWidth: -1, noRefs: true });
|
|
207301
|
+
}
|
|
207123
207302
|
function writeScenarioFile(repoRoot5, slug2, scenario) {
|
|
207124
|
-
const dir =
|
|
207125
|
-
|
|
207126
|
-
const file =
|
|
207127
|
-
|
|
207128
|
-
return
|
|
207303
|
+
const dir = path66.join(scenariosDir(repoRoot5), slug2);
|
|
207304
|
+
fs60.mkdirSync(dir, { recursive: true });
|
|
207305
|
+
const file = path66.join(dir, `${scenario.id}.yaml`);
|
|
207306
|
+
fs60.writeFileSync(file, serializeScenarioYaml(scenario));
|
|
207307
|
+
return path66.relative(repoRoot5, file);
|
|
207129
207308
|
}
|
|
207130
207309
|
function deleteScenarioFiles(repoRoot5, ids) {
|
|
207131
207310
|
const index = scenarioFileIndex(repoRoot5);
|
|
207132
207311
|
for (const id of ids) {
|
|
207133
207312
|
const file = index.get(id);
|
|
207134
|
-
if (file &&
|
|
207135
|
-
|
|
207313
|
+
if (file && fs60.existsSync(file))
|
|
207314
|
+
fs60.rmSync(file);
|
|
207136
207315
|
}
|
|
207137
207316
|
}
|
|
207138
207317
|
|
|
@@ -207202,7 +207381,9 @@ async function generateGuards(options) {
|
|
|
207202
207381
|
errors: [],
|
|
207203
207382
|
extractionFailures: [],
|
|
207204
207383
|
orphaned,
|
|
207205
|
-
birthPassed: 0
|
|
207384
|
+
birthPassed: 0,
|
|
207385
|
+
heldSections: [],
|
|
207386
|
+
orphanedDismissals: []
|
|
207206
207387
|
};
|
|
207207
207388
|
}
|
|
207208
207389
|
const limit = pLimit(Math.max(1, options.concurrency ?? defaultConcurrency3()));
|
|
@@ -207217,6 +207398,10 @@ async function generateGuards(options) {
|
|
|
207217
207398
|
const coverageGaps = [];
|
|
207218
207399
|
const errors = [];
|
|
207219
207400
|
const extractionFailures = [];
|
|
207401
|
+
const decisions = readGuardDecisions(repoRoot5);
|
|
207402
|
+
const dismissalByKey = new Map(decisions.dismissedClaims.map((d3) => [dismissedClaimKey(d3.doc, d3.anchor, d3.title), d3]));
|
|
207403
|
+
const extractedClaimKeys = /* @__PURE__ */ new Set();
|
|
207404
|
+
const extractedDocs = /* @__PURE__ */ new Set();
|
|
207220
207405
|
const workDocs = collectWorkDocs(repoRoot5, plan);
|
|
207221
207406
|
const workKeys = new Set(plan.work.map(key2));
|
|
207222
207407
|
const workDocByPath = new Map(workDocs.map((d3) => [d3.doc, d3]));
|
|
@@ -207246,34 +207431,47 @@ async function generateGuards(options) {
|
|
|
207246
207431
|
reason: `${result.failedViews} extraction view(s) failed \u2014 re-run to complete coverage for affected sections`
|
|
207247
207432
|
});
|
|
207248
207433
|
}
|
|
207434
|
+
extractedDocs.add(doc.doc);
|
|
207435
|
+
for (const c2 of result.data.claims) {
|
|
207436
|
+
extractedClaimKeys.add(dismissedClaimKey(doc.doc, c2.sectionAnchor, c2.claim));
|
|
207437
|
+
}
|
|
207249
207438
|
const { claimsByAnchor, noteByAnchor } = groupExtraction(result.data);
|
|
207250
207439
|
for (const s of doc.sections) {
|
|
207251
207440
|
if (!workKeys.has(key2(s)))
|
|
207252
207441
|
continue;
|
|
207253
207442
|
const claims = claimsByAnchor.get(s.anchor) ?? [];
|
|
207254
|
-
const
|
|
207443
|
+
const cliAll = claims.filter((c2) => isRunnableDriver(c2.driver));
|
|
207255
207444
|
const others = claims.filter((c2) => !isRunnableDriver(c2.driver));
|
|
207256
207445
|
const note = noteByAnchor.get(s.anchor);
|
|
207446
|
+
const cli = cliAll.filter((c2) => !dismissalByKey.has(dismissedClaimKey(s.doc, s.anchor, c2.claim)));
|
|
207447
|
+
const dismissed = cliAll.filter((c2) => dismissalByKey.has(dismissedClaimKey(s.doc, s.anchor, c2.claim)));
|
|
207448
|
+
for (const d3 of dismissed) {
|
|
207449
|
+
const entry = dismissalByKey.get(dismissedClaimKey(s.doc, s.anchor, d3.claim));
|
|
207450
|
+
coverageGaps.push({ doc: s.doc, anchor: s.anchor, kind: "dismissed", reason: dismissedReason(d3.claim, entry?.note) });
|
|
207451
|
+
}
|
|
207257
207452
|
for (const o of others) {
|
|
207258
207453
|
coverageGaps.push({ doc: s.doc, anchor: s.anchor, kind: "awaiting-driver", driver: o.driver, reason: o.reason });
|
|
207259
207454
|
}
|
|
207260
207455
|
if (cli.length === 0 && others.length === 0) {
|
|
207261
|
-
if (
|
|
207262
|
-
|
|
207263
|
-
|
|
207456
|
+
if (dismissed.length === 0) {
|
|
207457
|
+
if (!result.complete && !note) {
|
|
207458
|
+
extractFailedKeys.add(key2(s));
|
|
207459
|
+
continue;
|
|
207460
|
+
}
|
|
207461
|
+
coverageGaps.push({
|
|
207462
|
+
doc: s.doc,
|
|
207463
|
+
anchor: s.anchor,
|
|
207464
|
+
kind: note ? "untestable" : "no-claim",
|
|
207465
|
+
reason: note?.reason ?? "the section states no CLI-assertable claim"
|
|
207466
|
+
});
|
|
207264
207467
|
}
|
|
207265
|
-
coverageGaps.push({
|
|
207266
|
-
doc: s.doc,
|
|
207267
|
-
anchor: s.anchor,
|
|
207268
|
-
kind: note ? "untestable" : "no-claim",
|
|
207269
|
-
reason: note?.reason ?? "the section states no CLI-assertable claim"
|
|
207270
|
-
});
|
|
207271
207468
|
}
|
|
207272
207469
|
classificationByKey.set(key2(s), deriveClassification(cli, others, note));
|
|
207273
207470
|
for (const c2 of cli)
|
|
207274
207471
|
authTasks.push({ ref: `c${refSeq++}`, section: s, claim: c2 });
|
|
207275
207472
|
}
|
|
207276
207473
|
}
|
|
207474
|
+
const orphanedDismissals = decisions.dismissedClaims.filter((d3) => extractedDocs.has(d3.doc) && !extractedClaimKeys.has(dismissedClaimKey(d3.doc, d3.anchor, d3.title))).map((d3) => ({ doc: d3.doc, anchor: d3.anchor, title: d3.title }));
|
|
207277
207475
|
const buildPromise = runBuild(repoRoot5, recipe.build, recipe.env);
|
|
207278
207476
|
let buildAnnounced = false;
|
|
207279
207477
|
const awaitBuild = async () => {
|
|
@@ -207311,7 +207509,7 @@ async function generateGuards(options) {
|
|
|
207311
207509
|
if (!build8.ok)
|
|
207312
207510
|
return null;
|
|
207313
207511
|
resolvedEntryMemo ??= resolveEntry(repoRoot5, recipe.entry);
|
|
207314
|
-
return preflightEntry({ resolvedEntry: resolvedEntryMemo, displayEntry: recipe.entry, recipeEnv: recipe.env });
|
|
207512
|
+
return preflightEntry({ resolvedEntry: resolvedEntryMemo, displayEntry: recipe.entry, recipeEnv: recipe.env, repoRoot: repoRoot5 });
|
|
207315
207513
|
})();
|
|
207316
207514
|
return entryPreflightMemo;
|
|
207317
207515
|
};
|
|
@@ -207342,6 +207540,7 @@ async function generateGuards(options) {
|
|
|
207342
207540
|
};
|
|
207343
207541
|
const written = [];
|
|
207344
207542
|
const birthFindings = [];
|
|
207543
|
+
const heldSections = [];
|
|
207345
207544
|
let entryPreflightFailure = null;
|
|
207346
207545
|
let birthTotal = 0;
|
|
207347
207546
|
let birthSettled = 0;
|
|
@@ -207449,9 +207648,9 @@ async function generateGuards(options) {
|
|
|
207449
207648
|
pushInto(r1ByRef, o.candidate.ref, o);
|
|
207450
207649
|
const retryEntries = [];
|
|
207451
207650
|
for (const [ref, outcomes] of r1ByRef) {
|
|
207452
|
-
const
|
|
207453
|
-
if (
|
|
207454
|
-
retryEntries.push({ task: taskByRef.get(ref), evidence: toFinding(
|
|
207651
|
+
const retriable2 = outcomes.find((o) => o.result.outcome === "fail" || isSetupDefectResult(o.result));
|
|
207652
|
+
if (retriable2) {
|
|
207653
|
+
retryEntries.push({ task: taskByRef.get(ref), evidence: toFinding(retriable2) });
|
|
207455
207654
|
continue;
|
|
207456
207655
|
}
|
|
207457
207656
|
for (const o of outcomes) {
|
|
@@ -207510,6 +207709,16 @@ async function generateGuards(options) {
|
|
|
207510
207709
|
ids.push(c2.scenario.id);
|
|
207511
207710
|
}
|
|
207512
207711
|
upsertSection(section, ids);
|
|
207712
|
+
} else if (persistedHere.length > 0) {
|
|
207713
|
+
heldSections.push({
|
|
207714
|
+
doc: section.doc,
|
|
207715
|
+
anchor: section.anchor,
|
|
207716
|
+
readyScenarios: persistedHere.map((c2) => ({
|
|
207717
|
+
id: c2.scenario.id,
|
|
207718
|
+
title: c2.scenario.title,
|
|
207719
|
+
yaml: serializeScenarioYaml(c2.scenario)
|
|
207720
|
+
}))
|
|
207721
|
+
});
|
|
207513
207722
|
}
|
|
207514
207723
|
}
|
|
207515
207724
|
const authorTotal = authTasks.length;
|
|
@@ -207588,6 +207797,8 @@ async function generateGuards(options) {
|
|
|
207588
207797
|
extractionFailures,
|
|
207589
207798
|
orphaned,
|
|
207590
207799
|
birthPassed,
|
|
207800
|
+
heldSections,
|
|
207801
|
+
orphanedDismissals,
|
|
207591
207802
|
manifestPath: manifestPath2(repoRoot5),
|
|
207592
207803
|
...entryPreflightFailure ? { entryPreflight: entryPreflightFailure } : {}
|
|
207593
207804
|
};
|
|
@@ -207634,7 +207845,9 @@ function emptyResult(status, extra) {
|
|
|
207634
207845
|
errors: [],
|
|
207635
207846
|
extractionFailures: [],
|
|
207636
207847
|
orphaned: [],
|
|
207637
|
-
birthPassed: 0
|
|
207848
|
+
birthPassed: 0,
|
|
207849
|
+
heldSections: [],
|
|
207850
|
+
orphanedDismissals: []
|
|
207638
207851
|
};
|
|
207639
207852
|
}
|
|
207640
207853
|
function readPriorManifest(repoRoot5) {
|
|
@@ -207729,9 +207942,18 @@ function toFinding(o) {
|
|
|
207729
207942
|
step: f2?.step ?? 1,
|
|
207730
207943
|
expected: f2?.expected ?? "",
|
|
207731
207944
|
actual: f2?.actual ?? "",
|
|
207732
|
-
...o.result.evidencePath ? { evidencePath: o.result.evidencePath } : {}
|
|
207945
|
+
...o.result.evidencePath ? { evidencePath: o.result.evidencePath } : {},
|
|
207946
|
+
// Judge-on-one-screen (item 19): the failed candidate's exact YAML rides inline
|
|
207947
|
+
// so the finding detail shows the commands it ran; `claim` is the dismissal
|
|
207948
|
+
// identity (item 20) so the detail's Dismiss action can key on it.
|
|
207949
|
+
yaml: serializeScenarioYaml(o.candidate.scenario),
|
|
207950
|
+
claim: o.candidate.claim.claim
|
|
207733
207951
|
};
|
|
207734
207952
|
}
|
|
207953
|
+
function dismissedReason(claim, note) {
|
|
207954
|
+
const base2 = `dismissed: ${oneLine(claim)}`;
|
|
207955
|
+
return note ? `${base2} \u2014 ${oneLine(note)}` : base2;
|
|
207956
|
+
}
|
|
207735
207957
|
function errorFrom(o) {
|
|
207736
207958
|
return {
|
|
207737
207959
|
doc: o.candidate.section.doc,
|
|
@@ -207794,8 +208016,8 @@ init_context_router();
|
|
|
207794
208016
|
|
|
207795
208017
|
// packages/core/dist/services/llm/model-prices.js
|
|
207796
208018
|
init_paths();
|
|
207797
|
-
import
|
|
207798
|
-
import
|
|
208019
|
+
import fs61 from "node:fs";
|
|
208020
|
+
import path67 from "node:path";
|
|
207799
208021
|
var OPENROUTER_URL = "https://openrouter.ai/api/v1/models";
|
|
207800
208022
|
var CACHE_TTL_MS = 24 * 60 * 60 * 1e3;
|
|
207801
208023
|
var FETCH_TIMEOUT_MS = 8e3;
|
|
@@ -207811,11 +208033,11 @@ function tierOf(id) {
|
|
|
207811
208033
|
return s.includes("opus") ? "opus" : s.includes("sonnet") ? "sonnet" : s.includes("haiku") ? "haiku" : null;
|
|
207812
208034
|
}
|
|
207813
208035
|
function cacheFilePath() {
|
|
207814
|
-
return
|
|
208036
|
+
return path67.join(getGlobalDir(), "cache", CACHE_FILE);
|
|
207815
208037
|
}
|
|
207816
208038
|
function readCache7() {
|
|
207817
208039
|
try {
|
|
207818
|
-
const t2 = JSON.parse(
|
|
208040
|
+
const t2 = JSON.parse(fs61.readFileSync(cacheFilePath(), "utf-8"));
|
|
207819
208041
|
if (t2 && t2.tiers && t2.byId && typeof t2.fetchedAt === "number")
|
|
207820
208042
|
return t2;
|
|
207821
208043
|
} catch {
|
|
@@ -207824,8 +208046,8 @@ function readCache7() {
|
|
|
207824
208046
|
}
|
|
207825
208047
|
function writeCache7(t2) {
|
|
207826
208048
|
try {
|
|
207827
|
-
|
|
207828
|
-
|
|
208049
|
+
fs61.mkdirSync(path67.dirname(cacheFilePath()), { recursive: true });
|
|
208050
|
+
fs61.writeFileSync(cacheFilePath(), JSON.stringify(t2));
|
|
207829
208051
|
} catch {
|
|
207830
208052
|
}
|
|
207831
208053
|
}
|
|
@@ -208204,16 +208426,16 @@ function changedSubject(total, changed, noun) {
|
|
|
208204
208426
|
|
|
208205
208427
|
// packages/core/dist/commands/spec-in-process.js
|
|
208206
208428
|
init_dist8();
|
|
208207
|
-
import
|
|
208208
|
-
import
|
|
208429
|
+
import fs66 from "node:fs";
|
|
208430
|
+
import path72 from "node:path";
|
|
208209
208431
|
init_git();
|
|
208210
208432
|
import { createHash as createHash20, randomUUID as randomUUID27 } from "node:crypto";
|
|
208211
208433
|
|
|
208212
208434
|
// packages/core/dist/lib/verify-store.js
|
|
208213
208435
|
init_atomic_write();
|
|
208214
208436
|
init_analysis_store();
|
|
208215
|
-
import
|
|
208216
|
-
import
|
|
208437
|
+
import fs62 from "node:fs";
|
|
208438
|
+
import path68 from "node:path";
|
|
208217
208439
|
|
|
208218
208440
|
// packages/core/dist/types/verify-snapshot.js
|
|
208219
208441
|
function driftKey(d3) {
|
|
@@ -208261,23 +208483,23 @@ var LATEST_FILE3 = "LATEST.json";
|
|
|
208261
208483
|
var HISTORY_FILE3 = "history.json";
|
|
208262
208484
|
var DIFF_FILE2 = "diff.json";
|
|
208263
208485
|
function verifierDir(repoPath) {
|
|
208264
|
-
return
|
|
208486
|
+
return path68.join(repoPath, TRUECOURSE_DIR4, VERIFIER_DIR);
|
|
208265
208487
|
}
|
|
208266
208488
|
function runsDir(repoPath) {
|
|
208267
|
-
return
|
|
208489
|
+
return path68.join(verifierDir(repoPath), RUNS_DIR2);
|
|
208268
208490
|
}
|
|
208269
208491
|
function verifyRunPath(repoPath, filename) {
|
|
208270
|
-
return
|
|
208492
|
+
return path68.join(runsDir(repoPath), filename);
|
|
208271
208493
|
}
|
|
208272
208494
|
function verifyLatestPath(repoPath) {
|
|
208273
|
-
return
|
|
208495
|
+
return path68.join(verifierDir(repoPath), LATEST_FILE3);
|
|
208274
208496
|
}
|
|
208275
208497
|
function verifyHistoryPath(repoPath) {
|
|
208276
|
-
return
|
|
208498
|
+
return path68.join(verifierDir(repoPath), HISTORY_FILE3);
|
|
208277
208499
|
}
|
|
208278
208500
|
function verifyDiffPath(repoPath, scope) {
|
|
208279
208501
|
const file = scope ? `diff-${sanitizeScope(scope)}.json` : DIFF_FILE2;
|
|
208280
|
-
return
|
|
208502
|
+
return path68.join(verifierDir(repoPath), file);
|
|
208281
208503
|
}
|
|
208282
208504
|
function sanitizeScope(scope) {
|
|
208283
208505
|
return scope.replace(/[^a-zA-Z0-9._-]/g, "_");
|
|
@@ -208311,7 +208533,7 @@ var FileVerifyStore = class {
|
|
|
208311
208533
|
const file = verifyLatestPath(repoPath);
|
|
208312
208534
|
let mtime;
|
|
208313
208535
|
try {
|
|
208314
|
-
mtime =
|
|
208536
|
+
mtime = fs62.statSync(file).mtimeMs;
|
|
208315
208537
|
} catch (err) {
|
|
208316
208538
|
if (err.code === "ENOENT") {
|
|
208317
208539
|
latestCache2.delete(repoPath);
|
|
@@ -208322,7 +208544,7 @@ var FileVerifyStore = class {
|
|
|
208322
208544
|
const cached = latestCache2.get(repoPath);
|
|
208323
208545
|
if (cached && cached.mtime === mtime)
|
|
208324
208546
|
return cached.data;
|
|
208325
|
-
const data = JSON.parse(
|
|
208547
|
+
const data = JSON.parse(fs62.readFileSync(file, "utf-8"));
|
|
208326
208548
|
latestCache2.set(repoPath, { mtime, data });
|
|
208327
208549
|
return data;
|
|
208328
208550
|
}
|
|
@@ -208332,7 +208554,7 @@ var FileVerifyStore = class {
|
|
|
208332
208554
|
}
|
|
208333
208555
|
async deleteVerifyLatest(repoPath) {
|
|
208334
208556
|
try {
|
|
208335
|
-
|
|
208557
|
+
fs62.unlinkSync(verifyLatestPath(repoPath));
|
|
208336
208558
|
} catch (err) {
|
|
208337
208559
|
if (err.code !== "ENOENT")
|
|
208338
208560
|
throw err;
|
|
@@ -208346,21 +208568,21 @@ var FileVerifyStore = class {
|
|
|
208346
208568
|
}
|
|
208347
208569
|
async readVerifyRun(repoPath, filename) {
|
|
208348
208570
|
const file = verifyRunPath(repoPath, filename);
|
|
208349
|
-
if (!
|
|
208571
|
+
if (!fs62.existsSync(file))
|
|
208350
208572
|
return null;
|
|
208351
|
-
return JSON.parse(
|
|
208573
|
+
return JSON.parse(fs62.readFileSync(file, "utf-8"));
|
|
208352
208574
|
}
|
|
208353
208575
|
async listVerifyRuns(repoPath) {
|
|
208354
208576
|
const dir = runsDir(repoPath);
|
|
208355
|
-
if (!
|
|
208577
|
+
if (!fs62.existsSync(dir))
|
|
208356
208578
|
return [];
|
|
208357
|
-
return
|
|
208579
|
+
return fs62.readdirSync(dir).filter((n) => n.endsWith(".json")).sort();
|
|
208358
208580
|
}
|
|
208359
208581
|
async readVerifyHistory(repoPath) {
|
|
208360
208582
|
const file = verifyHistoryPath(repoPath);
|
|
208361
|
-
if (!
|
|
208583
|
+
if (!fs62.existsSync(file))
|
|
208362
208584
|
return { runs: [] };
|
|
208363
|
-
return JSON.parse(
|
|
208585
|
+
return JSON.parse(fs62.readFileSync(file, "utf-8"));
|
|
208364
208586
|
}
|
|
208365
208587
|
async appendVerifyHistory(repoPath, entry) {
|
|
208366
208588
|
const history = await this.readVerifyHistory(repoPath);
|
|
@@ -208373,7 +208595,7 @@ var FileVerifyStore = class {
|
|
|
208373
208595
|
if (!entry)
|
|
208374
208596
|
return false;
|
|
208375
208597
|
try {
|
|
208376
|
-
|
|
208598
|
+
fs62.unlinkSync(verifyRunPath(repoPath, entry.filename));
|
|
208377
208599
|
} catch (err) {
|
|
208378
208600
|
if (err.code !== "ENOENT")
|
|
208379
208601
|
throw err;
|
|
@@ -208395,16 +208617,16 @@ var FileVerifyStore = class {
|
|
|
208395
208617
|
}
|
|
208396
208618
|
async readVerifyDiff(repoPath, scope) {
|
|
208397
208619
|
const file = verifyDiffPath(repoPath, scope);
|
|
208398
|
-
if (!
|
|
208620
|
+
if (!fs62.existsSync(file))
|
|
208399
208621
|
return null;
|
|
208400
|
-
return JSON.parse(
|
|
208622
|
+
return JSON.parse(fs62.readFileSync(file, "utf-8"));
|
|
208401
208623
|
}
|
|
208402
208624
|
async writeVerifyDiff(repoPath, diff, scope) {
|
|
208403
208625
|
atomicWriteJson(verifyDiffPath(repoPath, scope), diff);
|
|
208404
208626
|
}
|
|
208405
208627
|
async deleteVerifyDiff(repoPath, scope) {
|
|
208406
208628
|
try {
|
|
208407
|
-
|
|
208629
|
+
fs62.unlinkSync(verifyDiffPath(repoPath, scope));
|
|
208408
208630
|
} catch (err) {
|
|
208409
208631
|
if (err.code !== "ENOENT")
|
|
208410
208632
|
throw err;
|
|
@@ -208438,8 +208660,8 @@ async function repoRef(repoRoot5, commitOverride) {
|
|
|
208438
208660
|
}
|
|
208439
208661
|
|
|
208440
208662
|
// packages/core/dist/lib/contract-store.js
|
|
208441
|
-
import
|
|
208442
|
-
import
|
|
208663
|
+
import fs63 from "node:fs";
|
|
208664
|
+
import path69 from "node:path";
|
|
208443
208665
|
var KIND_REL = {
|
|
208444
208666
|
contracts: [".truecourse", "contracts"],
|
|
208445
208667
|
// The inferred tree lives at contracts/_inferred (matches `writeInferred`).
|
|
@@ -208449,13 +208671,13 @@ function countTcFiles(dir) {
|
|
|
208449
208671
|
let n = 0;
|
|
208450
208672
|
let entries;
|
|
208451
208673
|
try {
|
|
208452
|
-
entries =
|
|
208674
|
+
entries = fs63.readdirSync(dir, { withFileTypes: true });
|
|
208453
208675
|
} catch {
|
|
208454
208676
|
return 0;
|
|
208455
208677
|
}
|
|
208456
208678
|
for (const e of entries) {
|
|
208457
208679
|
if (e.isDirectory())
|
|
208458
|
-
n += countTcFiles(
|
|
208680
|
+
n += countTcFiles(path69.join(dir, e.name));
|
|
208459
208681
|
else if (e.isFile() && e.name.endsWith(".tc"))
|
|
208460
208682
|
n += 1;
|
|
208461
208683
|
}
|
|
@@ -208466,7 +208688,7 @@ function walkTcRel(dir, excludeInferred) {
|
|
|
208466
208688
|
const walk20 = (rel) => {
|
|
208467
208689
|
let entries;
|
|
208468
208690
|
try {
|
|
208469
|
-
entries =
|
|
208691
|
+
entries = fs63.readdirSync(path69.join(dir, rel), { withFileTypes: true });
|
|
208470
208692
|
} catch {
|
|
208471
208693
|
return;
|
|
208472
208694
|
}
|
|
@@ -208490,50 +208712,50 @@ function safeResolve(root2, rel) {
|
|
|
208490
208712
|
return null;
|
|
208491
208713
|
if (norm.split("/").some((s) => s === ".." || s === "." || s === ""))
|
|
208492
208714
|
return null;
|
|
208493
|
-
const base2 =
|
|
208494
|
-
const dest =
|
|
208495
|
-
if (dest !== base2 && !dest.startsWith(base2 +
|
|
208715
|
+
const base2 = path69.resolve(root2);
|
|
208716
|
+
const dest = path69.resolve(base2, norm);
|
|
208717
|
+
if (dest !== base2 && !dest.startsWith(base2 + path69.sep))
|
|
208496
208718
|
return null;
|
|
208497
208719
|
return dest;
|
|
208498
208720
|
}
|
|
208499
208721
|
var FileContractStore = class {
|
|
208500
208722
|
materializesInPlace = true;
|
|
208501
208723
|
async saveContracts(ref, kind, _sourceDir) {
|
|
208502
|
-
const dir =
|
|
208724
|
+
const dir = path69.join(ref.repoKey, ...KIND_REL[kind]);
|
|
208503
208725
|
return { manifest: {}, fileCount: countTcFiles(dir), objectsWritten: 0, manifestHash: "" };
|
|
208504
208726
|
}
|
|
208505
208727
|
async loadContracts(ref, kind) {
|
|
208506
|
-
const dir =
|
|
208507
|
-
if (!
|
|
208728
|
+
const dir = path69.join(ref.repoKey, ...KIND_REL[kind]);
|
|
208729
|
+
if (!fs63.existsSync(dir))
|
|
208508
208730
|
return null;
|
|
208509
208731
|
return { dir, cleanup: async () => {
|
|
208510
208732
|
} };
|
|
208511
208733
|
}
|
|
208512
208734
|
async hasContracts(ref, kind) {
|
|
208513
|
-
return
|
|
208735
|
+
return fs63.existsSync(path69.join(ref.repoKey, ...KIND_REL[kind]));
|
|
208514
208736
|
}
|
|
208515
208737
|
// The file impl reads the live repo tree, which is whatever is checked out —
|
|
208516
208738
|
// there is no per-commit history, so `commitSha` is ignored (OSS is latest).
|
|
208517
208739
|
async listContractFiles(repoKey, kind, _commitSha) {
|
|
208518
|
-
return walkTcRel(
|
|
208740
|
+
return walkTcRel(path69.join(repoKey, ...KIND_REL[kind]), kind === "contracts");
|
|
208519
208741
|
}
|
|
208520
208742
|
async readContractFile(repoKey, kind, relPath, _commitSha) {
|
|
208521
|
-
const dest = safeResolve(
|
|
208522
|
-
if (!dest || !
|
|
208743
|
+
const dest = safeResolve(path69.join(repoKey, ...KIND_REL[kind]), relPath);
|
|
208744
|
+
if (!dest || !fs63.existsSync(dest) || !fs63.statSync(dest).isFile())
|
|
208523
208745
|
return null;
|
|
208524
|
-
return
|
|
208746
|
+
return fs63.readFileSync(dest, "utf-8");
|
|
208525
208747
|
}
|
|
208526
208748
|
async putContractFile(ref, kind, relPath, content) {
|
|
208527
|
-
const dest = safeResolve(
|
|
208749
|
+
const dest = safeResolve(path69.join(ref.repoKey, ...KIND_REL[kind]), relPath);
|
|
208528
208750
|
if (!dest)
|
|
208529
208751
|
throw new Error(`[contract-store] unsafe contract path: ${relPath}`);
|
|
208530
|
-
|
|
208531
|
-
|
|
208752
|
+
fs63.mkdirSync(path69.dirname(dest), { recursive: true });
|
|
208753
|
+
fs63.writeFileSync(dest, content);
|
|
208532
208754
|
}
|
|
208533
208755
|
async deleteContractFile(ref, kind, relPath) {
|
|
208534
|
-
const dest = safeResolve(
|
|
208756
|
+
const dest = safeResolve(path69.join(ref.repoKey, ...KIND_REL[kind]), relPath);
|
|
208535
208757
|
if (dest)
|
|
208536
|
-
|
|
208758
|
+
fs63.rmSync(dest, { force: true });
|
|
208537
208759
|
}
|
|
208538
208760
|
// OSS/local has no workspace concept (mirrors the spec store). Writing throws
|
|
208539
208761
|
// (fail loud — a caller that reached here is mis-wired); reads are empty so an
|
|
@@ -208560,10 +208782,10 @@ var loadWorkspaceContracts = (ref, kind) => active8.loadWorkspaceContracts(ref,
|
|
|
208560
208782
|
var contractsMaterializeInPlace = () => active8.materializesInPlace;
|
|
208561
208783
|
|
|
208562
208784
|
// packages/core/dist/lib/spec-store.js
|
|
208563
|
-
import
|
|
208564
|
-
import
|
|
208785
|
+
import fs64 from "node:fs";
|
|
208786
|
+
import path70 from "node:path";
|
|
208565
208787
|
function specPath(repoKey, artifact) {
|
|
208566
|
-
return
|
|
208788
|
+
return path70.join(repoKey, ".truecourse", "specs", `${artifact}.json`);
|
|
208567
208789
|
}
|
|
208568
208790
|
function isPrDecisionsRef(commitSha) {
|
|
208569
208791
|
return /^_pr\/\d+$/.test(commitSha ?? "");
|
|
@@ -208576,18 +208798,18 @@ var FileSpecStore = class {
|
|
|
208576
208798
|
throw new Error(PR_DECISIONS_FILE_ERROR);
|
|
208577
208799
|
}
|
|
208578
208800
|
const file = specPath(ref.repoKey, artifact);
|
|
208579
|
-
|
|
208580
|
-
|
|
208801
|
+
fs64.mkdirSync(path70.dirname(file), { recursive: true });
|
|
208802
|
+
fs64.writeFileSync(file, JSON.stringify(json2, null, 2) + "\n", "utf-8");
|
|
208581
208803
|
}
|
|
208582
208804
|
async loadSpec(ref, artifact) {
|
|
208583
208805
|
if (artifact === "decisions" && isPrDecisionsRef(ref.commitSha)) {
|
|
208584
208806
|
throw new Error(PR_DECISIONS_FILE_ERROR);
|
|
208585
208807
|
}
|
|
208586
208808
|
const file = specPath(ref.repoKey, artifact);
|
|
208587
|
-
if (!
|
|
208809
|
+
if (!fs64.existsSync(file))
|
|
208588
208810
|
return null;
|
|
208589
208811
|
try {
|
|
208590
|
-
return JSON.parse(
|
|
208812
|
+
return JSON.parse(fs64.readFileSync(file, "utf-8"));
|
|
208591
208813
|
} catch {
|
|
208592
208814
|
return null;
|
|
208593
208815
|
}
|
|
@@ -208597,8 +208819,8 @@ var FileSpecStore = class {
|
|
|
208597
208819
|
throw new Error(PR_DECISIONS_FILE_ERROR);
|
|
208598
208820
|
}
|
|
208599
208821
|
const file = specPath(ref.repoKey, artifact);
|
|
208600
|
-
if (
|
|
208601
|
-
|
|
208822
|
+
if (fs64.existsSync(file))
|
|
208823
|
+
fs64.rmSync(file);
|
|
208602
208824
|
}
|
|
208603
208825
|
// The file impl is single-document-per-repo, so "latest" === read the file.
|
|
208604
208826
|
async loadLatest(repoKey, artifact) {
|
|
@@ -208625,23 +208847,23 @@ var loadLatestSpec = (repoKey, artifact) => active9.loadLatest(repoKey, artifact
|
|
|
208625
208847
|
var specsMaterializeInPlace = () => active9.materializesInPlace;
|
|
208626
208848
|
|
|
208627
208849
|
// packages/core/dist/lib/inferred-action-store.js
|
|
208628
|
-
import
|
|
208629
|
-
import
|
|
208850
|
+
import fs65 from "node:fs";
|
|
208851
|
+
import path71 from "node:path";
|
|
208630
208852
|
function actionsFile(repoKey) {
|
|
208631
|
-
return
|
|
208853
|
+
return path71.join(repoKey, ".truecourse", "specs", "inferred-actions.json");
|
|
208632
208854
|
}
|
|
208633
208855
|
var FileInferredActionStore = class {
|
|
208634
208856
|
read(repoKey) {
|
|
208635
208857
|
try {
|
|
208636
|
-
return JSON.parse(
|
|
208858
|
+
return JSON.parse(fs65.readFileSync(actionsFile(repoKey), "utf-8"));
|
|
208637
208859
|
} catch {
|
|
208638
208860
|
return [];
|
|
208639
208861
|
}
|
|
208640
208862
|
}
|
|
208641
208863
|
write(repoKey, actions) {
|
|
208642
208864
|
const file = actionsFile(repoKey);
|
|
208643
|
-
|
|
208644
|
-
|
|
208865
|
+
fs65.mkdirSync(path71.dirname(file), { recursive: true });
|
|
208866
|
+
fs65.writeFileSync(file, JSON.stringify(actions, null, 2) + "\n", "utf-8");
|
|
208645
208867
|
}
|
|
208646
208868
|
async setAction(repoKey, action) {
|
|
208647
208869
|
const next = this.read(repoKey).filter((a) => !(a.kind === action.kind && a.identity === action.identity));
|
|
@@ -208770,13 +208992,13 @@ function resolveTransport(options) {
|
|
|
208770
208992
|
}
|
|
208771
208993
|
return getDefaultTransport();
|
|
208772
208994
|
}
|
|
208773
|
-
var GENERATED_MARKER_REL =
|
|
208995
|
+
var GENERATED_MARKER_REL = path72.join(".truecourse", "contracts", "result.json");
|
|
208774
208996
|
function generatedMarkerPath(repoRoot5) {
|
|
208775
|
-
return
|
|
208997
|
+
return path72.join(repoRoot5, GENERATED_MARKER_REL);
|
|
208776
208998
|
}
|
|
208777
208999
|
function stampGeneratedMarker(repoRoot5, summary) {
|
|
208778
209000
|
const file = generatedMarkerPath(repoRoot5);
|
|
208779
|
-
|
|
209001
|
+
fs66.mkdirSync(path72.dirname(file), { recursive: true });
|
|
208780
209002
|
const body = {
|
|
208781
209003
|
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
208782
209004
|
written: summary?.written ?? 0,
|
|
@@ -208784,7 +209006,7 @@ function stampGeneratedMarker(repoRoot5, summary) {
|
|
|
208784
209006
|
validationIssues: summary?.validationIssues ?? [],
|
|
208785
209007
|
enumerateFailures: summary?.enumerateFailures ?? []
|
|
208786
209008
|
};
|
|
208787
|
-
|
|
209009
|
+
fs66.writeFileSync(file, JSON.stringify(body, null, 2) + "\n");
|
|
208788
209010
|
}
|
|
208789
209011
|
function resolveCurateModels(repoRoot5) {
|
|
208790
209012
|
return {
|
|
@@ -208908,22 +209130,22 @@ async function curateInProcess(repoRoot5, options = {}) {
|
|
|
208908
209130
|
}
|
|
208909
209131
|
}
|
|
208910
209132
|
function buildPriorContracts(repoRoot5) {
|
|
208911
|
-
const dir =
|
|
208912
|
-
if (!
|
|
209133
|
+
const dir = path72.join(repoRoot5, ".truecourse", "contracts");
|
|
209134
|
+
if (!fs66.existsSync(dir))
|
|
208913
209135
|
return void 0;
|
|
208914
209136
|
const targets = [];
|
|
208915
209137
|
const bodyByKey = /* @__PURE__ */ new Map();
|
|
208916
209138
|
const walk20 = (d3) => {
|
|
208917
|
-
for (const e of
|
|
209139
|
+
for (const e of fs66.readdirSync(d3, { withFileTypes: true })) {
|
|
208918
209140
|
if (e.isDirectory()) {
|
|
208919
209141
|
if (e.name === "_inferred")
|
|
208920
209142
|
continue;
|
|
208921
|
-
walk20(
|
|
209143
|
+
walk20(path72.join(d3, e.name));
|
|
208922
209144
|
} else if (e.name.endsWith(".tc")) {
|
|
208923
|
-
const abs =
|
|
208924
|
-
const src =
|
|
209145
|
+
const abs = path72.join(d3, e.name);
|
|
209146
|
+
const src = fs66.readFileSync(abs, "utf-8");
|
|
208925
209147
|
try {
|
|
208926
|
-
const file = parser_ohm_exports.parseTcFile(
|
|
209148
|
+
const file = parser_ohm_exports.parseTcFile(path72.relative(dir, abs), src);
|
|
208927
209149
|
for (const key4 of resolver_exports.resolve([file]).index.keys()) {
|
|
208928
209150
|
const colon = key4.indexOf(":");
|
|
208929
209151
|
if (colon < 0)
|
|
@@ -209083,18 +209305,18 @@ function resolverHardError(result) {
|
|
|
209083
209305
|
const detail = reasons.length ? reasons.slice(0, 3).join("; ") : "duplicate or conflicting artifact identities";
|
|
209084
209306
|
return new Error(`Contract corpus failed to resolve \u2014 ${detail}`);
|
|
209085
209307
|
}
|
|
209086
|
-
var LEGACY_VERIFY_STATE_REL =
|
|
209308
|
+
var LEGACY_VERIFY_STATE_REL = path72.join(".truecourse", ".cache", "verifier", "verify-state.json");
|
|
209087
209309
|
function legacyVerifyStatePath(repoRoot5) {
|
|
209088
|
-
return
|
|
209310
|
+
return path72.join(repoRoot5, LEGACY_VERIFY_STATE_REL);
|
|
209089
209311
|
}
|
|
209090
209312
|
async function withContracts(repoRoot5, options, tracker, fn) {
|
|
209091
|
-
const fallbackPath =
|
|
209313
|
+
const fallbackPath = path72.join(repoRoot5, ".truecourse", "contracts");
|
|
209092
209314
|
const wsMat = options.workspaceOrgId ? await loadWorkspaceContracts({ workspaceOrgId: options.workspaceOrgId }, "contracts") : null;
|
|
209093
209315
|
let repoMat = null;
|
|
209094
209316
|
try {
|
|
209095
209317
|
let recorded;
|
|
209096
209318
|
if (options.contractsDir) {
|
|
209097
|
-
if (!
|
|
209319
|
+
if (!fs66.existsSync(options.contractsDir)) {
|
|
209098
209320
|
const err = new Error(`Contracts directory not found at ${options.contractsDir}. Run \`truecourse contracts generate\` first.`);
|
|
209099
209321
|
tracker?.error("load", err.message);
|
|
209100
209322
|
throw err;
|
|
@@ -209139,7 +209361,7 @@ async function verifyInProcess(repoRoot5, options = {}) {
|
|
|
209139
209361
|
tracker?.start("compare");
|
|
209140
209362
|
tracker?.done("compare", `${result.drifts.length} drift${result.drifts.length === 1 ? "" : "s"}`);
|
|
209141
209363
|
if (options.ref) {
|
|
209142
|
-
result.drifts = result.drifts.map((d3) => d3.filePath &&
|
|
209364
|
+
result.drifts = result.drifts.map((d3) => d3.filePath && path72.isAbsolute(d3.filePath) ? { ...d3, filePath: path72.relative(repoRoot5, d3.filePath).split(path72.sep).join("/") } : d3);
|
|
209143
209365
|
}
|
|
209144
209366
|
const verifiedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
209145
209367
|
const { branch, commitHash } = await gitMeta(repoRoot5);
|
|
@@ -209183,7 +209405,7 @@ async function verifyInProcess(repoRoot5, options = {}) {
|
|
|
209183
209405
|
bySeverity: summary.bySeverity
|
|
209184
209406
|
});
|
|
209185
209407
|
await deleteVerifyDiff(storeKey);
|
|
209186
|
-
|
|
209408
|
+
fs66.rmSync(legacyVerifyStatePath(repoRoot5), { force: true });
|
|
209187
209409
|
}
|
|
209188
209410
|
const state = {
|
|
209189
209411
|
verifiedAt,
|
|
@@ -209231,7 +209453,7 @@ async function runWithStash(repoRoot5, skipStash, tracker, fn) {
|
|
|
209231
209453
|
const status = await stashGit.status();
|
|
209232
209454
|
if (!status.isClean()) {
|
|
209233
209455
|
const gitRoot = (await stashGit.revparse(["--show-toplevel"])).trim();
|
|
209234
|
-
if (
|
|
209456
|
+
if (path72.resolve(repoRoot5) === path72.resolve(gitRoot)) {
|
|
209235
209457
|
tracker?.detail?.("load", "Stashing pending changes...");
|
|
209236
209458
|
const res = await stashGit.stash(["push", "--include-untracked", "-m", "truecourse-verify-stash"]);
|
|
209237
209459
|
didStash = !res.includes("No local changes");
|
|
@@ -209333,7 +209555,7 @@ async function verifyDiffInProcess(repoRoot5, options = {}) {
|
|
|
209333
209555
|
async function inferInProcess(repoRoot5, options = {}) {
|
|
209334
209556
|
const startedAt = Date.now();
|
|
209335
209557
|
const codeDir = options.codeDir ?? autodetectCodeDir(repoRoot5);
|
|
209336
|
-
let contractsDir = options.contractsDir ??
|
|
209558
|
+
let contractsDir = options.contractsDir ?? path72.join(repoRoot5, ".truecourse", "contracts");
|
|
209337
209559
|
let releaseContracts = async () => {
|
|
209338
209560
|
};
|
|
209339
209561
|
if (!options.contractsDir && options.ref) {
|
|
@@ -209377,7 +209599,7 @@ async function persistInferred(repoRoot5, options, contractsDir, codeDir, starte
|
|
|
209377
209599
|
});
|
|
209378
209600
|
}
|
|
209379
209601
|
if (!options.dryRun && options.ref) {
|
|
209380
|
-
await saveContracts(options.ref, "contracts_inferred",
|
|
209602
|
+
await saveContracts(options.ref, "contracts_inferred", path72.join(contractsDir, "_inferred"));
|
|
209381
209603
|
}
|
|
209382
209604
|
const rendered = result.decisions.map((d3) => renderDecision(d3));
|
|
209383
209605
|
const decisionPaths = rendered.map((r) => r.relPath);
|
|
@@ -209400,8 +209622,8 @@ async function persistInferred(repoRoot5, options, contractsDir, codeDir, starte
|
|
|
209400
209622
|
return { infer: result, written, proposed, decisionPaths, summaries };
|
|
209401
209623
|
}
|
|
209402
209624
|
function autodetectCodeDir(repoRoot5) {
|
|
209403
|
-
const codeSubdir =
|
|
209404
|
-
if (
|
|
209625
|
+
const codeSubdir = path72.join(repoRoot5, "code");
|
|
209626
|
+
if (fs66.existsSync(codeSubdir) && fs66.statSync(codeSubdir).isDirectory()) {
|
|
209405
209627
|
return codeSubdir;
|
|
209406
209628
|
}
|
|
209407
209629
|
return repoRoot5;
|
|
@@ -209721,8 +209943,8 @@ async function runContractsGenerate(options = {}) {
|
|
|
209721
209943
|
}
|
|
209722
209944
|
async function runContractsList(options = {}) {
|
|
209723
209945
|
const repoRoot5 = options.cwd ?? process.cwd();
|
|
209724
|
-
const contractsDir =
|
|
209725
|
-
if (!
|
|
209946
|
+
const contractsDir = path73.join(repoRoot5, ".truecourse", "contracts");
|
|
209947
|
+
if (!fs67.existsSync(contractsDir)) {
|
|
209726
209948
|
O2.info("No contracts found. Run `truecourse contracts generate` first.");
|
|
209727
209949
|
return;
|
|
209728
209950
|
}
|
|
@@ -209730,12 +209952,12 @@ async function runContractsList(options = {}) {
|
|
|
209730
209952
|
const fileNodes = [];
|
|
209731
209953
|
let parseErrors = 0;
|
|
209732
209954
|
const visit = (dir) => {
|
|
209733
|
-
for (const entry of
|
|
209734
|
-
const full =
|
|
209955
|
+
for (const entry of fs67.readdirSync(dir, { withFileTypes: true })) {
|
|
209956
|
+
const full = path73.join(dir, entry.name);
|
|
209735
209957
|
if (entry.isDirectory()) visit(full);
|
|
209736
209958
|
else if (entry.isFile() && entry.name.endsWith(".tc")) {
|
|
209737
209959
|
try {
|
|
209738
|
-
fileNodes.push(parserOhm.parseTcFile(full,
|
|
209960
|
+
fileNodes.push(parserOhm.parseTcFile(full, fs67.readFileSync(full, "utf-8")));
|
|
209739
209961
|
} catch {
|
|
209740
209962
|
parseErrors += 1;
|
|
209741
209963
|
}
|
|
@@ -209762,7 +209984,7 @@ async function runContractsList(options = {}) {
|
|
|
209762
209984
|
mt(`Contracts \u2014 ${artifacts.length} ${scope}artifact${artifacts.length === 1 ? "" : "s"}`);
|
|
209763
209985
|
for (const a of artifacts) {
|
|
209764
209986
|
const conf = a.confidence ? `[${a.confidence}] ` : "";
|
|
209765
|
-
const loc = a.origin ? a.origin.lines[0] >= 0 ? `${a.origin.source}:${a.origin.lines[0]}` : a.origin.source : `${
|
|
209987
|
+
const loc = a.origin ? a.origin.lines[0] >= 0 ? `${a.origin.source}:${a.origin.lines[0]}` : a.origin.source : `${path73.relative(repoRoot5, a.declarationLoc.filePath)}:${a.declarationLoc.lineStart}`;
|
|
209766
209988
|
console.log(` ${conf}${a.ref.type}:${a.ref.identity} ${loc}`);
|
|
209767
209989
|
}
|
|
209768
209990
|
if (parseErrors > 0) {
|
|
@@ -209774,8 +209996,8 @@ async function runContractsList(options = {}) {
|
|
|
209774
209996
|
}
|
|
209775
209997
|
async function runContractsValidate(options = {}) {
|
|
209776
209998
|
const repoRoot5 = options.cwd ?? process.cwd();
|
|
209777
|
-
const contractsDir =
|
|
209778
|
-
if (!
|
|
209999
|
+
const contractsDir = path73.join(repoRoot5, ".truecourse", "contracts");
|
|
210000
|
+
if (!fs67.existsSync(contractsDir)) {
|
|
209779
210001
|
O2.error("No .truecourse/contracts/ directory found.");
|
|
209780
210002
|
process.exit(1);
|
|
209781
210003
|
}
|
|
@@ -209783,14 +210005,14 @@ async function runContractsValidate(options = {}) {
|
|
|
209783
210005
|
const fileNodes = [];
|
|
209784
210006
|
const issues = [];
|
|
209785
210007
|
const visit = (dir) => {
|
|
209786
|
-
for (const entry of
|
|
209787
|
-
const full =
|
|
210008
|
+
for (const entry of fs67.readdirSync(dir, { withFileTypes: true })) {
|
|
210009
|
+
const full = path73.join(dir, entry.name);
|
|
209788
210010
|
if (entry.isDirectory()) visit(full);
|
|
209789
210011
|
else if (entry.isFile() && entry.name.endsWith(".tc")) {
|
|
209790
210012
|
try {
|
|
209791
|
-
fileNodes.push(parserOhm.parseTcFile(full,
|
|
210013
|
+
fileNodes.push(parserOhm.parseTcFile(full, fs67.readFileSync(full, "utf-8")));
|
|
209792
210014
|
} catch (e) {
|
|
209793
|
-
issues.push(`${
|
|
210015
|
+
issues.push(`${path73.relative(repoRoot5, full)}: parse error: ${e instanceof Error ? e.message : e}`);
|
|
209794
210016
|
}
|
|
209795
210017
|
}
|
|
209796
210018
|
}
|
|
@@ -209798,11 +210020,11 @@ async function runContractsValidate(options = {}) {
|
|
|
209798
210020
|
visit(contractsDir);
|
|
209799
210021
|
const resolution = resolver.resolve(fileNodes);
|
|
209800
210022
|
for (const err of resolution.errors) {
|
|
209801
|
-
issues.push(`${
|
|
210023
|
+
issues.push(`${path73.relative(repoRoot5, err.filePath)}:${err.line} ${err.message}`);
|
|
209802
210024
|
}
|
|
209803
210025
|
const trulyUnresolved = resolution.unresolvedRefs.filter((u2) => u2.ref.type !== "Unknown");
|
|
209804
210026
|
for (const u2 of trulyUnresolved) {
|
|
209805
|
-
issues.push(`${
|
|
210027
|
+
issues.push(`${path73.relative(repoRoot5, u2.usedAt.filePath)}:${u2.usedAt.lineStart} unresolved ${u2.ref.type}:${u2.ref.identity}`);
|
|
209806
210028
|
}
|
|
209807
210029
|
if (issues.length === 0) {
|
|
209808
210030
|
O2.success(`Validated ${resolution.index.size} artifact${resolution.index.size === 1 ? "" : "s"} \u2014 no issues.`);
|
|
@@ -209816,7 +210038,7 @@ async function runContractsValidate(options = {}) {
|
|
|
209816
210038
|
|
|
209817
210039
|
// tools/cli/src/commands/spec.ts
|
|
209818
210040
|
init_dist4();
|
|
209819
|
-
import
|
|
210041
|
+
import path74 from "node:path";
|
|
209820
210042
|
init_progress();
|
|
209821
210043
|
init_registry();
|
|
209822
210044
|
var repoRoot = (opts = {}) => opts.cwd ?? process.cwd();
|
|
@@ -209942,7 +210164,7 @@ async function runVerify(opts = {}) {
|
|
|
209942
210164
|
O2.message("");
|
|
209943
210165
|
O2.message("Drifts:");
|
|
209944
210166
|
for (const d3 of verify2.drifts.slice(0, 20)) {
|
|
209945
|
-
const loc = d3.filePath ? ` ${
|
|
210167
|
+
const loc = d3.filePath ? ` ${path74.relative(root2, d3.filePath)}:${d3.lineStart ?? "?"}` : "";
|
|
209946
210168
|
O2.message(` [${d3.severity}] ${d3.obligationKey}${loc}`);
|
|
209947
210169
|
O2.message(` \u2192 ${d3.message}`);
|
|
209948
210170
|
}
|
|
@@ -209976,7 +210198,7 @@ async function runVerifyDiff(opts) {
|
|
|
209976
210198
|
O2.message("");
|
|
209977
210199
|
O2.message(`${label}:`);
|
|
209978
210200
|
for (const d3 of drifts.slice(0, 20)) {
|
|
209979
|
-
const loc = d3.filePath ? ` ${
|
|
210201
|
+
const loc = d3.filePath ? ` ${path74.relative(root2, d3.filePath)}:${d3.lineStart ?? "?"}` : "";
|
|
209980
210202
|
O2.message(` [${d3.severity}] ${d3.obligationKey}${loc}`);
|
|
209981
210203
|
}
|
|
209982
210204
|
if (drifts.length > 20) O2.message(` \u2026 (+${drifts.length - 20} more)`);
|
|
@@ -210031,8 +210253,8 @@ async function runInfer(opts = {}) {
|
|
|
210031
210253
|
|
|
210032
210254
|
// tools/cli/src/commands/spec-conflicts.ts
|
|
210033
210255
|
init_dist4();
|
|
210034
|
-
import
|
|
210035
|
-
import
|
|
210256
|
+
import fs68 from "node:fs";
|
|
210257
|
+
import path75 from "node:path";
|
|
210036
210258
|
var root = (opts) => opts.cwd ?? process.cwd();
|
|
210037
210259
|
var base = (ref) => ref.split("/").pop() ?? ref;
|
|
210038
210260
|
function effectiveRelations2(corpus, repoRoot5) {
|
|
@@ -210079,7 +210301,7 @@ async function runSpecConflictsList(opts = {}) {
|
|
|
210079
210301
|
function excerpt(repoRoot5, ref, note, max = 20) {
|
|
210080
210302
|
let text4;
|
|
210081
210303
|
try {
|
|
210082
|
-
text4 =
|
|
210304
|
+
text4 = fs68.readFileSync(path75.join(repoRoot5, ref), "utf-8");
|
|
210083
210305
|
} catch {
|
|
210084
210306
|
return ` (could not read ${ref})`;
|
|
210085
210307
|
}
|
|
@@ -210304,7 +210526,7 @@ function fail3(msg) {
|
|
|
210304
210526
|
|
|
210305
210527
|
// tools/cli/src/commands/drifts.ts
|
|
210306
210528
|
init_dist4();
|
|
210307
|
-
import
|
|
210529
|
+
import path76 from "node:path";
|
|
210308
210530
|
var DRIFT_SEVERITIES = [
|
|
210309
210531
|
"critical",
|
|
210310
210532
|
"high",
|
|
@@ -210341,7 +210563,7 @@ async function runDriftsList(opts = {}) {
|
|
|
210341
210563
|
O2.message("");
|
|
210342
210564
|
O2.message("Drifts:");
|
|
210343
210565
|
for (const d3 of page) {
|
|
210344
|
-
const loc = d3.filePath ? ` ${
|
|
210566
|
+
const loc = d3.filePath ? ` ${path76.relative(root2, d3.filePath)}:${d3.lineStart ?? "?"}` : "";
|
|
210345
210567
|
O2.message(` [${d3.severity}] ${d3.obligationKey}${loc}`);
|
|
210346
210568
|
O2.message(` \u2192 ${d3.message}`);
|
|
210347
210569
|
}
|
|
@@ -210372,7 +210594,7 @@ function parseDriftSeverityFlag(raw) {
|
|
|
210372
210594
|
|
|
210373
210595
|
// tools/cli/src/commands/guard.ts
|
|
210374
210596
|
init_dist4();
|
|
210375
|
-
import
|
|
210597
|
+
import path77 from "node:path";
|
|
210376
210598
|
init_progress();
|
|
210377
210599
|
|
|
210378
210600
|
// packages/core/dist/commands/guard-in-process.js
|
|
@@ -210772,7 +210994,7 @@ async function runGuardGenerate(opts = {}) {
|
|
|
210772
210994
|
return;
|
|
210773
210995
|
}
|
|
210774
210996
|
const report4 = readGuardResult(repoRoot5) ?? { ...guard, generatedAt: (/* @__PURE__ */ new Date()).toISOString() };
|
|
210775
|
-
printGuardGenerateSummary(report4,
|
|
210997
|
+
printGuardGenerateSummary(report4, path77.relative(repoRoot5, guardResultPath(repoRoot5)));
|
|
210776
210998
|
if (guard.written.length === 0 && guard.birthFindings.length === 0 && guard.errors.length === 0) {
|
|
210777
210999
|
gt("No scenarios written.");
|
|
210778
211000
|
return;
|
|
@@ -210791,6 +211013,11 @@ function printGuardGenerateSummary(report4, reportPath) {
|
|
|
210791
211013
|
O2.step(`sections ${report4.sectionsChanged} changed \xB7 ${settled} settled \xB7 ${unsettled.size} unsettled \xB7 ${report4.skippedUnchanged} unchanged`);
|
|
210792
211014
|
const birth = g.birthPassed !== null ? ` \xB7 ${g.birthPassed} passed birth` : "";
|
|
210793
211015
|
O2.step(`scenarios ${g.written} written${birth}`);
|
|
211016
|
+
if (g.readyButHeld > 0) {
|
|
211017
|
+
O2.step(
|
|
211018
|
+
`held ${g.readyButHeld} ready but held (${g.heldByFindings} finding${g.heldByFindings === 1 ? "" : "s"} \xB7 ${g.heldByErrors} error${g.heldByErrors === 1 ? "" : "s"})`
|
|
211019
|
+
);
|
|
211020
|
+
}
|
|
210794
211021
|
const gapTotal = Object.values(g.coverageGapsByKind).reduce((a, b) => a + b, 0);
|
|
210795
211022
|
if (gapTotal > 0) {
|
|
210796
211023
|
const kinds = Object.entries(g.coverageGapsByKind).filter(([, n]) => n > 0).map(([k, n]) => k === "blocked-on" ? `${n} blocked-on${blockedOnBreakdown(g.blockedOnCapabilities)}` : `${n} ${k}`);
|
|
@@ -210802,6 +211029,10 @@ function printGuardGenerateSummary(report4, reportPath) {
|
|
|
210802
211029
|
if (report4.extractionFailures.length > 0) {
|
|
210803
211030
|
O2.step(`extraction ${report4.extractionFailures.length} document${report4.extractionFailures.length === 1 ? "" : "s"} failed \u2014 re-run to retry`);
|
|
210804
211031
|
}
|
|
211032
|
+
if (report4.orphanedDismissals && report4.orphanedDismissals.length > 0) {
|
|
211033
|
+
const n = report4.orphanedDismissals.length;
|
|
211034
|
+
O2.step(`dismissals ${n} orphaned \u2014 the dismissed claim no longer exists; re-dismiss the new text or drop it from decisions.json`);
|
|
211035
|
+
}
|
|
210805
211036
|
if (g.birthFindings > 0) O2.step(`findings ${g.birthFindings} birth finding${g.birthFindings === 1 ? "" : "s"}`);
|
|
210806
211037
|
if (g.errors > 0) O2.step(`errors ${g.errors} authoring error${g.errors === 1 ? "" : "s"}`);
|
|
210807
211038
|
if (g.usage) O2.step(`cost ${g.usage.calls} call${g.usage.calls === 1 ? "" : "s"} \xB7 $${g.usage.costUsd.toFixed(2)}`);
|
|
@@ -210881,6 +211112,7 @@ async function runGuardStatus(opts = {}) {
|
|
|
210881
211112
|
const kinds = Object.entries(g.coverageGapsByKind).filter(([, n]) => n > 0).map(([k, n]) => k === "blocked-on" ? `${n} blocked-on${blockedOnBreakdown(g.blockedOnCapabilities)}` : `${n} ${k}`);
|
|
210882
211113
|
detail.push(`${gapTotal} gap${gapTotal === 1 ? "" : "s"} (${kinds.join(", ")})`);
|
|
210883
211114
|
}
|
|
211115
|
+
if (g.readyButHeld > 0) detail.push(`${g.readyButHeld} ready but held`);
|
|
210884
211116
|
if (g.birthFindings > 0) detail.push(`${g.birthFindings} birth finding${g.birthFindings === 1 ? "" : "s"}`);
|
|
210885
211117
|
if (g.errors > 0) detail.push(`${g.errors} error${g.errors === 1 ? "" : "s"}`);
|
|
210886
211118
|
if (detail.length > 0) O2.message(` ${detail.join(" \xB7 ")}`);
|
|
@@ -210970,7 +211202,7 @@ function printLoadErrors(loadErrors) {
|
|
|
210970
211202
|
|
|
210971
211203
|
// tools/cli/src/commands/config.ts
|
|
210972
211204
|
init_dist4();
|
|
210973
|
-
import
|
|
211205
|
+
import path78 from "node:path";
|
|
210974
211206
|
var STAGE_LABEL = {
|
|
210975
211207
|
"spec.relevance": "Spec \xB7 doc relevance",
|
|
210976
211208
|
"spec.areaTag": "Spec \xB7 area tag",
|
|
@@ -211001,7 +211233,7 @@ async function runConfigLlmShow(options = {}) {
|
|
|
211001
211233
|
const repoRoot5 = options.cwd ?? process.cwd();
|
|
211002
211234
|
const { stages, fallbackModel } = describeStageResolutions(repoRoot5);
|
|
211003
211235
|
mt("LLM model resolution");
|
|
211004
|
-
O2.info(`repoRoot ${
|
|
211236
|
+
O2.info(`repoRoot ${path78.relative(process.cwd(), repoRoot5) || "."}`);
|
|
211005
211237
|
O2.info(`fallback ${fallbackModel ?? "(not configured)"}`);
|
|
211006
211238
|
for (const stage of stages) {
|
|
211007
211239
|
const label = STAGE_LABEL[stage.stageId];
|
|
@@ -211017,8 +211249,8 @@ async function runConfigLlmShow(options = {}) {
|
|
|
211017
211249
|
|
|
211018
211250
|
// tools/cli/src/commands/hooks.ts
|
|
211019
211251
|
import { execSync as execSync4 } from "node:child_process";
|
|
211020
|
-
import
|
|
211021
|
-
import
|
|
211252
|
+
import fs69 from "node:fs";
|
|
211253
|
+
import path79 from "node:path";
|
|
211022
211254
|
init_dist4();
|
|
211023
211255
|
init_paths();
|
|
211024
211256
|
init_registry();
|
|
@@ -211052,17 +211284,17 @@ pre-commit:
|
|
|
211052
211284
|
function findGitDir(from) {
|
|
211053
211285
|
let dir = from;
|
|
211054
211286
|
while (true) {
|
|
211055
|
-
const gitPath =
|
|
211056
|
-
if (
|
|
211057
|
-
const stat =
|
|
211287
|
+
const gitPath = path79.join(dir, ".git");
|
|
211288
|
+
if (fs69.existsSync(gitPath)) {
|
|
211289
|
+
const stat = fs69.statSync(gitPath);
|
|
211058
211290
|
if (stat.isDirectory()) return gitPath;
|
|
211059
211291
|
if (stat.isFile()) {
|
|
211060
|
-
const content =
|
|
211292
|
+
const content = fs69.readFileSync(gitPath, "utf-8").trim();
|
|
211061
211293
|
const match4 = content.match(/^gitdir:\s*(.+)$/);
|
|
211062
|
-
if (match4) return
|
|
211294
|
+
if (match4) return path79.resolve(dir, match4[1]);
|
|
211063
211295
|
}
|
|
211064
211296
|
}
|
|
211065
|
-
const parent =
|
|
211297
|
+
const parent = path79.dirname(dir);
|
|
211066
211298
|
if (parent === dir) return null;
|
|
211067
211299
|
dir = parent;
|
|
211068
211300
|
}
|
|
@@ -211070,18 +211302,18 @@ function findGitDir(from) {
|
|
|
211070
211302
|
function findProjectRoot(from) {
|
|
211071
211303
|
let dir = from;
|
|
211072
211304
|
while (true) {
|
|
211073
|
-
if (
|
|
211074
|
-
const parent =
|
|
211305
|
+
if (fs69.existsSync(path79.join(dir, ".git"))) return dir;
|
|
211306
|
+
const parent = path79.dirname(dir);
|
|
211075
211307
|
if (parent === dir) return null;
|
|
211076
211308
|
dir = parent;
|
|
211077
211309
|
}
|
|
211078
211310
|
}
|
|
211079
211311
|
function loadConfig(projectRoot) {
|
|
211080
|
-
const configPath =
|
|
211081
|
-
if (!
|
|
211312
|
+
const configPath = path79.join(projectRoot, ".truecourse", "hooks.yaml");
|
|
211313
|
+
if (!fs69.existsSync(configPath)) return null;
|
|
211082
211314
|
let parsed;
|
|
211083
211315
|
try {
|
|
211084
|
-
const raw =
|
|
211316
|
+
const raw = fs69.readFileSync(configPath, "utf-8");
|
|
211085
211317
|
parsed = jsYaml.load(raw) || {};
|
|
211086
211318
|
} catch (err) {
|
|
211087
211319
|
console.error(`Error parsing ${configPath}: ${err.message}`);
|
|
@@ -211132,11 +211364,11 @@ async function runHooksInstall() {
|
|
|
211132
211364
|
} else {
|
|
211133
211365
|
console.log(INSTALL_WARNING);
|
|
211134
211366
|
}
|
|
211135
|
-
const hooksDir =
|
|
211136
|
-
|
|
211137
|
-
const hookPath =
|
|
211138
|
-
if (
|
|
211139
|
-
const existing =
|
|
211367
|
+
const hooksDir = path79.join(gitDir, "hooks");
|
|
211368
|
+
fs69.mkdirSync(hooksDir, { recursive: true });
|
|
211369
|
+
const hookPath = path79.join(hooksDir, "pre-commit");
|
|
211370
|
+
if (fs69.existsSync(hookPath)) {
|
|
211371
|
+
const existing = fs69.readFileSync(hookPath, "utf-8");
|
|
211140
211372
|
if (!existing.includes(HOOK_IDENTIFIER)) {
|
|
211141
211373
|
console.error(
|
|
211142
211374
|
"Error: A pre-commit hook already exists and was not installed by TrueCourse."
|
|
@@ -211146,16 +211378,16 @@ async function runHooksInstall() {
|
|
|
211146
211378
|
process.exit(1);
|
|
211147
211379
|
}
|
|
211148
211380
|
}
|
|
211149
|
-
|
|
211381
|
+
fs69.writeFileSync(hookPath, HOOK_SCRIPT, { mode: 493 });
|
|
211150
211382
|
console.log("TrueCourse pre-commit hook installed.");
|
|
211151
211383
|
console.log(` ${hookPath}`);
|
|
211152
211384
|
const projectRoot = findProjectRoot(process.cwd());
|
|
211153
211385
|
if (projectRoot) {
|
|
211154
|
-
const cfgDir =
|
|
211155
|
-
const cfgPath =
|
|
211156
|
-
if (!
|
|
211157
|
-
|
|
211158
|
-
|
|
211386
|
+
const cfgDir = path79.join(projectRoot, ".truecourse");
|
|
211387
|
+
const cfgPath = path79.join(cfgDir, "hooks.yaml");
|
|
211388
|
+
if (!fs69.existsSync(cfgPath)) {
|
|
211389
|
+
fs69.mkdirSync(cfgDir, { recursive: true });
|
|
211390
|
+
fs69.writeFileSync(cfgPath, HOOKS_YAML_TEMPLATE);
|
|
211159
211391
|
console.log(` ${cfgPath} (starter config \u2014 edit to customize, commit to share with the team)`);
|
|
211160
211392
|
}
|
|
211161
211393
|
}
|
|
@@ -211166,17 +211398,17 @@ function runHooksUninstall() {
|
|
|
211166
211398
|
console.error("Error: Not a git repository.");
|
|
211167
211399
|
process.exit(1);
|
|
211168
211400
|
}
|
|
211169
|
-
const hookPath =
|
|
211170
|
-
if (!
|
|
211401
|
+
const hookPath = path79.join(gitDir, "hooks", "pre-commit");
|
|
211402
|
+
if (!fs69.existsSync(hookPath)) {
|
|
211171
211403
|
console.log("No pre-commit hook installed.");
|
|
211172
211404
|
return;
|
|
211173
211405
|
}
|
|
211174
|
-
const content =
|
|
211406
|
+
const content = fs69.readFileSync(hookPath, "utf-8");
|
|
211175
211407
|
if (!content.includes(HOOK_IDENTIFIER)) {
|
|
211176
211408
|
console.error("Error: The pre-commit hook was not installed by TrueCourse. Leaving it in place.");
|
|
211177
211409
|
process.exit(1);
|
|
211178
211410
|
}
|
|
211179
|
-
|
|
211411
|
+
fs69.unlinkSync(hookPath);
|
|
211180
211412
|
console.log("TrueCourse pre-commit hook removed.");
|
|
211181
211413
|
}
|
|
211182
211414
|
function runHooksStatus() {
|
|
@@ -211185,8 +211417,8 @@ function runHooksStatus() {
|
|
|
211185
211417
|
console.error("Error: Not a git repository.");
|
|
211186
211418
|
process.exit(1);
|
|
211187
211419
|
}
|
|
211188
|
-
const hookPath =
|
|
211189
|
-
const installed =
|
|
211420
|
+
const hookPath = path79.join(gitDir, "hooks", "pre-commit");
|
|
211421
|
+
const installed = fs69.existsSync(hookPath) && fs69.readFileSync(hookPath, "utf-8").includes(HOOK_IDENTIFIER);
|
|
211190
211422
|
if (installed) {
|
|
211191
211423
|
console.log("TrueCourse pre-commit hook: installed");
|
|
211192
211424
|
console.log(` ${hookPath}`);
|
|
@@ -211295,7 +211527,7 @@ async function runHooksRun() {
|
|
|
211295
211527
|
|
|
211296
211528
|
// tools/cli/src/index.ts
|
|
211297
211529
|
var program2 = new Command();
|
|
211298
|
-
program2.name("truecourse").version("0.7.0-next.
|
|
211530
|
+
program2.name("truecourse").version("0.7.0-next.4").description("TrueCourse CLI \u2014 analyze your repository and open the dashboard");
|
|
211299
211531
|
var dashboardCmd = program2.command("dashboard").description("Start the TrueCourse dashboard and open it in your browser").option("--reconfigure", "Re-prompt for console vs background service mode").option("--service", "Run as a background service (skips mode prompt)").option("--console", "Run in this terminal (skips mode prompt)").action(async (options) => {
|
|
211300
211532
|
if (options.service && options.console) {
|
|
211301
211533
|
console.error("error: --service and --console are mutually exclusive");
|