truecourse 0.7.0-next.2 → 0.7.0-next.3
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 +556 -492
- package/package.json +1 -1
- package/server.mjs +1052 -988
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 fs69 = __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 (fs69.existsSync(localBin)) return localBin;
|
|
1910
|
+
if (sourceExt.includes(path80.extname(baseName))) return void 0;
|
|
1911
1911
|
const foundExt = sourceExt.find(
|
|
1912
|
-
(ext2) =>
|
|
1912
|
+
(ext2) => fs69.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 = fs69.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
|
}
|
|
@@ -111875,14 +111875,14 @@ var init_missing_error_status_code = __esm({
|
|
|
111875
111875
|
});
|
|
111876
111876
|
|
|
111877
111877
|
// packages/analyzer/dist/rules/architecture/visitors/javascript/route-without-auth-middleware.js
|
|
111878
|
-
function isPublicPath(
|
|
111879
|
-
return PUBLIC_PATH_PATTERNS.some((re2) => re2.test(
|
|
111878
|
+
function isPublicPath(path80) {
|
|
111879
|
+
return PUBLIC_PATH_PATTERNS.some((re2) => re2.test(path80));
|
|
111880
111880
|
}
|
|
111881
|
-
function isUrlCredentialAuthedPath(
|
|
111882
|
-
return URL_CREDENTIAL_PARAMS.test(
|
|
111881
|
+
function isUrlCredentialAuthedPath(path80) {
|
|
111882
|
+
return URL_CREDENTIAL_PARAMS.test(path80);
|
|
111883
111883
|
}
|
|
111884
|
-
function isApiDocsPath(
|
|
111885
|
-
return API_DOCS_PATH.test(
|
|
111884
|
+
function isApiDocsPath(path80) {
|
|
111885
|
+
return API_DOCS_PATH.test(path80);
|
|
111886
111886
|
}
|
|
111887
111887
|
function isFrameworkRequestHandler(arg) {
|
|
111888
111888
|
if (!arg)
|
|
@@ -112031,14 +112031,14 @@ var init_route_without_auth_middleware = __esm({
|
|
|
112031
112031
|
return null;
|
|
112032
112032
|
const firstArg = args.namedChildren[0];
|
|
112033
112033
|
if (firstArg?.type === "string" || firstArg?.type === "template_string") {
|
|
112034
|
-
const
|
|
112035
|
-
if (isPublicPath(
|
|
112034
|
+
const path80 = firstArg.text.replace(/^['"`]|['"`]$/g, "");
|
|
112035
|
+
if (isPublicPath(path80))
|
|
112036
112036
|
return null;
|
|
112037
|
-
if (isUrlCredentialAuthedPath(
|
|
112037
|
+
if (isUrlCredentialAuthedPath(path80))
|
|
112038
112038
|
return null;
|
|
112039
|
-
if (isApiDocsPath(
|
|
112039
|
+
if (isApiDocsPath(path80))
|
|
112040
112040
|
return null;
|
|
112041
|
-
if (
|
|
112041
|
+
if (path80 === "*" || path80 === "(.*)" || path80 === "/*") {
|
|
112042
112042
|
if (isFrameworkRequestHandler(args.namedChildren[args.namedChildren.length - 1])) {
|
|
112043
112043
|
return null;
|
|
112044
112044
|
}
|
|
@@ -146609,8 +146609,8 @@ var require_windows = __commonJS({
|
|
|
146609
146609
|
"node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js"(exports, module) {
|
|
146610
146610
|
module.exports = isexe;
|
|
146611
146611
|
isexe.sync = sync;
|
|
146612
|
-
var
|
|
146613
|
-
function checkPathExt(
|
|
146612
|
+
var fs69 = __require("fs");
|
|
146613
|
+
function checkPathExt(path80, options) {
|
|
146614
146614
|
var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
|
|
146615
146615
|
if (!pathext) {
|
|
146616
146616
|
return true;
|
|
@@ -146621,25 +146621,25 @@ var require_windows = __commonJS({
|
|
|
146621
146621
|
}
|
|
146622
146622
|
for (var i = 0; i < pathext.length; i++) {
|
|
146623
146623
|
var p2 = pathext[i].toLowerCase();
|
|
146624
|
-
if (p2 &&
|
|
146624
|
+
if (p2 && path80.substr(-p2.length).toLowerCase() === p2) {
|
|
146625
146625
|
return true;
|
|
146626
146626
|
}
|
|
146627
146627
|
}
|
|
146628
146628
|
return false;
|
|
146629
146629
|
}
|
|
146630
|
-
function checkStat(stat,
|
|
146630
|
+
function checkStat(stat, path80, options) {
|
|
146631
146631
|
if (!stat.isSymbolicLink() && !stat.isFile()) {
|
|
146632
146632
|
return false;
|
|
146633
146633
|
}
|
|
146634
|
-
return checkPathExt(
|
|
146634
|
+
return checkPathExt(path80, options);
|
|
146635
146635
|
}
|
|
146636
|
-
function isexe(
|
|
146637
|
-
|
|
146638
|
-
cb(er, er ? false : checkStat(stat,
|
|
146636
|
+
function isexe(path80, options, cb) {
|
|
146637
|
+
fs69.stat(path80, function(er, stat) {
|
|
146638
|
+
cb(er, er ? false : checkStat(stat, path80, options));
|
|
146639
146639
|
});
|
|
146640
146640
|
}
|
|
146641
|
-
function sync(
|
|
146642
|
-
return checkStat(
|
|
146641
|
+
function sync(path80, options) {
|
|
146642
|
+
return checkStat(fs69.statSync(path80), path80, options);
|
|
146643
146643
|
}
|
|
146644
146644
|
}
|
|
146645
146645
|
});
|
|
@@ -146649,14 +146649,14 @@ var require_mode = __commonJS({
|
|
|
146649
146649
|
"node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js"(exports, module) {
|
|
146650
146650
|
module.exports = isexe;
|
|
146651
146651
|
isexe.sync = sync;
|
|
146652
|
-
var
|
|
146653
|
-
function isexe(
|
|
146654
|
-
|
|
146652
|
+
var fs69 = __require("fs");
|
|
146653
|
+
function isexe(path80, options, cb) {
|
|
146654
|
+
fs69.stat(path80, function(er, stat) {
|
|
146655
146655
|
cb(er, er ? false : checkStat(stat, options));
|
|
146656
146656
|
});
|
|
146657
146657
|
}
|
|
146658
|
-
function sync(
|
|
146659
|
-
return checkStat(
|
|
146658
|
+
function sync(path80, options) {
|
|
146659
|
+
return checkStat(fs69.statSync(path80), options);
|
|
146660
146660
|
}
|
|
146661
146661
|
function checkStat(stat, options) {
|
|
146662
146662
|
return stat.isFile() && checkMode(stat, options);
|
|
@@ -146680,7 +146680,7 @@ var require_mode = __commonJS({
|
|
|
146680
146680
|
// node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js
|
|
146681
146681
|
var require_isexe = __commonJS({
|
|
146682
146682
|
"node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js"(exports, module) {
|
|
146683
|
-
var
|
|
146683
|
+
var fs69 = __require("fs");
|
|
146684
146684
|
var core2;
|
|
146685
146685
|
if (process.platform === "win32" || global.TESTING_WINDOWS) {
|
|
146686
146686
|
core2 = require_windows();
|
|
@@ -146689,7 +146689,7 @@ var require_isexe = __commonJS({
|
|
|
146689
146689
|
}
|
|
146690
146690
|
module.exports = isexe;
|
|
146691
146691
|
isexe.sync = sync;
|
|
146692
|
-
function isexe(
|
|
146692
|
+
function isexe(path80, options, cb) {
|
|
146693
146693
|
if (typeof options === "function") {
|
|
146694
146694
|
cb = options;
|
|
146695
146695
|
options = {};
|
|
@@ -146699,7 +146699,7 @@ var require_isexe = __commonJS({
|
|
|
146699
146699
|
throw new TypeError("callback not provided");
|
|
146700
146700
|
}
|
|
146701
146701
|
return new Promise(function(resolve12, reject) {
|
|
146702
|
-
isexe(
|
|
146702
|
+
isexe(path80, options || {}, function(er, is) {
|
|
146703
146703
|
if (er) {
|
|
146704
146704
|
reject(er);
|
|
146705
146705
|
} else {
|
|
@@ -146708,7 +146708,7 @@ var require_isexe = __commonJS({
|
|
|
146708
146708
|
});
|
|
146709
146709
|
});
|
|
146710
146710
|
}
|
|
146711
|
-
core2(
|
|
146711
|
+
core2(path80, options || {}, function(er, is) {
|
|
146712
146712
|
if (er) {
|
|
146713
146713
|
if (er.code === "EACCES" || options && options.ignoreErrors) {
|
|
146714
146714
|
er = null;
|
|
@@ -146718,9 +146718,9 @@ var require_isexe = __commonJS({
|
|
|
146718
146718
|
cb(er, is);
|
|
146719
146719
|
});
|
|
146720
146720
|
}
|
|
146721
|
-
function sync(
|
|
146721
|
+
function sync(path80, options) {
|
|
146722
146722
|
try {
|
|
146723
|
-
return core2.sync(
|
|
146723
|
+
return core2.sync(path80, options || {});
|
|
146724
146724
|
} catch (er) {
|
|
146725
146725
|
if (options && options.ignoreErrors || er.code === "EACCES") {
|
|
146726
146726
|
return false;
|
|
@@ -146736,7 +146736,7 @@ var require_isexe = __commonJS({
|
|
|
146736
146736
|
var require_which = __commonJS({
|
|
146737
146737
|
"node_modules/.pnpm/which@2.0.2/node_modules/which/which.js"(exports, module) {
|
|
146738
146738
|
var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
|
|
146739
|
-
var
|
|
146739
|
+
var path80 = __require("path");
|
|
146740
146740
|
var COLON = isWindows ? ";" : ":";
|
|
146741
146741
|
var isexe = require_isexe();
|
|
146742
146742
|
var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
|
|
@@ -146774,7 +146774,7 @@ var require_which = __commonJS({
|
|
|
146774
146774
|
return opt.all && found.length ? resolve12(found) : reject(getNotFoundError(cmd));
|
|
146775
146775
|
const ppRaw = pathEnv[i];
|
|
146776
146776
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
146777
|
-
const pCmd =
|
|
146777
|
+
const pCmd = path80.join(pathPart, cmd);
|
|
146778
146778
|
const p2 = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
146779
146779
|
resolve12(subStep(p2, i, 0));
|
|
146780
146780
|
});
|
|
@@ -146801,7 +146801,7 @@ var require_which = __commonJS({
|
|
|
146801
146801
|
for (let i = 0; i < pathEnv.length; i++) {
|
|
146802
146802
|
const ppRaw = pathEnv[i];
|
|
146803
146803
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
146804
|
-
const pCmd =
|
|
146804
|
+
const pCmd = path80.join(pathPart, cmd);
|
|
146805
146805
|
const p2 = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
146806
146806
|
for (let j2 = 0; j2 < pathExt.length; j2++) {
|
|
146807
146807
|
const cur = p2 + pathExt[j2];
|
|
@@ -146849,7 +146849,7 @@ var require_path_key = __commonJS({
|
|
|
146849
146849
|
var require_resolveCommand = __commonJS({
|
|
146850
146850
|
"node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js"(exports, module) {
|
|
146851
146851
|
"use strict";
|
|
146852
|
-
var
|
|
146852
|
+
var path80 = __require("path");
|
|
146853
146853
|
var which = require_which();
|
|
146854
146854
|
var getPathKey = require_path_key();
|
|
146855
146855
|
function resolveCommandAttempt(parsed, withoutPathExt) {
|
|
@@ -146867,7 +146867,7 @@ var require_resolveCommand = __commonJS({
|
|
|
146867
146867
|
try {
|
|
146868
146868
|
resolved = which.sync(parsed.command, {
|
|
146869
146869
|
path: env[getPathKey({ env })],
|
|
146870
|
-
pathExt: withoutPathExt ?
|
|
146870
|
+
pathExt: withoutPathExt ? path80.delimiter : void 0
|
|
146871
146871
|
});
|
|
146872
146872
|
} catch (e) {
|
|
146873
146873
|
} finally {
|
|
@@ -146876,7 +146876,7 @@ var require_resolveCommand = __commonJS({
|
|
|
146876
146876
|
}
|
|
146877
146877
|
}
|
|
146878
146878
|
if (resolved) {
|
|
146879
|
-
resolved =
|
|
146879
|
+
resolved = path80.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
|
|
146880
146880
|
}
|
|
146881
146881
|
return resolved;
|
|
146882
146882
|
}
|
|
@@ -146930,8 +146930,8 @@ var require_shebang_command = __commonJS({
|
|
|
146930
146930
|
if (!match4) {
|
|
146931
146931
|
return null;
|
|
146932
146932
|
}
|
|
146933
|
-
const [
|
|
146934
|
-
const binary2 =
|
|
146933
|
+
const [path80, argument] = match4[0].replace(/#! ?/, "").split(" ");
|
|
146934
|
+
const binary2 = path80.split("/").pop();
|
|
146935
146935
|
if (binary2 === "env") {
|
|
146936
146936
|
return argument;
|
|
146937
146937
|
}
|
|
@@ -146944,16 +146944,16 @@ var require_shebang_command = __commonJS({
|
|
|
146944
146944
|
var require_readShebang = __commonJS({
|
|
146945
146945
|
"node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js"(exports, module) {
|
|
146946
146946
|
"use strict";
|
|
146947
|
-
var
|
|
146947
|
+
var fs69 = __require("fs");
|
|
146948
146948
|
var shebangCommand = require_shebang_command();
|
|
146949
146949
|
function readShebang(command) {
|
|
146950
146950
|
const size = 150;
|
|
146951
146951
|
const buffer = Buffer.alloc(size);
|
|
146952
146952
|
let fd;
|
|
146953
146953
|
try {
|
|
146954
|
-
fd =
|
|
146955
|
-
|
|
146956
|
-
|
|
146954
|
+
fd = fs69.openSync(command, "r");
|
|
146955
|
+
fs69.readSync(fd, buffer, 0, size, 0);
|
|
146956
|
+
fs69.closeSync(fd);
|
|
146957
146957
|
} catch (e) {
|
|
146958
146958
|
}
|
|
146959
146959
|
return shebangCommand(buffer.toString());
|
|
@@ -146966,7 +146966,7 @@ var require_readShebang = __commonJS({
|
|
|
146966
146966
|
var require_parse = __commonJS({
|
|
146967
146967
|
"node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js"(exports, module) {
|
|
146968
146968
|
"use strict";
|
|
146969
|
-
var
|
|
146969
|
+
var path80 = __require("path");
|
|
146970
146970
|
var resolveCommand = require_resolveCommand();
|
|
146971
146971
|
var escape2 = require_escape();
|
|
146972
146972
|
var readShebang = require_readShebang();
|
|
@@ -146991,7 +146991,7 @@ var require_parse = __commonJS({
|
|
|
146991
146991
|
const needsShell = !isExecutableRegExp.test(commandFile);
|
|
146992
146992
|
if (parsed.options.forceShell || needsShell) {
|
|
146993
146993
|
const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
|
|
146994
|
-
parsed.command =
|
|
146994
|
+
parsed.command = path80.normalize(parsed.command);
|
|
146995
146995
|
parsed.command = escape2.command(parsed.command);
|
|
146996
146996
|
parsed.args = parsed.args.map((arg) => escape2.argument(arg, needsDoubleEscapeMetaChars));
|
|
146997
146997
|
const shellCommand = [parsed.command].concat(parsed.args).join(" ");
|
|
@@ -147357,8 +147357,8 @@ var require_package = __commonJS({
|
|
|
147357
147357
|
// node_modules/.pnpm/dotenv@16.6.1/node_modules/dotenv/lib/main.js
|
|
147358
147358
|
var require_main = __commonJS({
|
|
147359
147359
|
"node_modules/.pnpm/dotenv@16.6.1/node_modules/dotenv/lib/main.js"(exports, module) {
|
|
147360
|
-
var
|
|
147361
|
-
var
|
|
147360
|
+
var fs69 = __require("fs");
|
|
147361
|
+
var path80 = __require("path");
|
|
147362
147362
|
var os15 = __require("os");
|
|
147363
147363
|
var crypto6 = __require("crypto");
|
|
147364
147364
|
var packageJson = require_package();
|
|
@@ -147466,7 +147466,7 @@ var require_main = __commonJS({
|
|
|
147466
147466
|
if (options && options.path && options.path.length > 0) {
|
|
147467
147467
|
if (Array.isArray(options.path)) {
|
|
147468
147468
|
for (const filepath of options.path) {
|
|
147469
|
-
if (
|
|
147469
|
+
if (fs69.existsSync(filepath)) {
|
|
147470
147470
|
possibleVaultPath = filepath.endsWith(".vault") ? filepath : `${filepath}.vault`;
|
|
147471
147471
|
}
|
|
147472
147472
|
}
|
|
@@ -147474,15 +147474,15 @@ var require_main = __commonJS({
|
|
|
147474
147474
|
possibleVaultPath = options.path.endsWith(".vault") ? options.path : `${options.path}.vault`;
|
|
147475
147475
|
}
|
|
147476
147476
|
} else {
|
|
147477
|
-
possibleVaultPath =
|
|
147477
|
+
possibleVaultPath = path80.resolve(process.cwd(), ".env.vault");
|
|
147478
147478
|
}
|
|
147479
|
-
if (
|
|
147479
|
+
if (fs69.existsSync(possibleVaultPath)) {
|
|
147480
147480
|
return possibleVaultPath;
|
|
147481
147481
|
}
|
|
147482
147482
|
return null;
|
|
147483
147483
|
}
|
|
147484
147484
|
function _resolveHome(envPath) {
|
|
147485
|
-
return envPath[0] === "~" ?
|
|
147485
|
+
return envPath[0] === "~" ? path80.join(os15.homedir(), envPath.slice(1)) : envPath;
|
|
147486
147486
|
}
|
|
147487
147487
|
function _configVault(options) {
|
|
147488
147488
|
const debug2 = Boolean(options && options.debug);
|
|
@@ -147499,7 +147499,7 @@ var require_main = __commonJS({
|
|
|
147499
147499
|
return { parsed };
|
|
147500
147500
|
}
|
|
147501
147501
|
function configDotenv(options) {
|
|
147502
|
-
const dotenvPath =
|
|
147502
|
+
const dotenvPath = path80.resolve(process.cwd(), ".env");
|
|
147503
147503
|
let encoding = "utf8";
|
|
147504
147504
|
const debug2 = Boolean(options && options.debug);
|
|
147505
147505
|
const quiet = options && "quiet" in options ? options.quiet : true;
|
|
@@ -147523,13 +147523,13 @@ var require_main = __commonJS({
|
|
|
147523
147523
|
}
|
|
147524
147524
|
let lastError;
|
|
147525
147525
|
const parsedAll = {};
|
|
147526
|
-
for (const
|
|
147526
|
+
for (const path81 of optionPaths) {
|
|
147527
147527
|
try {
|
|
147528
|
-
const parsed = DotenvModule.parse(
|
|
147528
|
+
const parsed = DotenvModule.parse(fs69.readFileSync(path81, { encoding }));
|
|
147529
147529
|
DotenvModule.populate(parsedAll, parsed, options);
|
|
147530
147530
|
} catch (e) {
|
|
147531
147531
|
if (debug2) {
|
|
147532
|
-
_debug(`Failed to load ${
|
|
147532
|
+
_debug(`Failed to load ${path81} ${e.message}`);
|
|
147533
147533
|
}
|
|
147534
147534
|
lastError = e;
|
|
147535
147535
|
}
|
|
@@ -147544,7 +147544,7 @@ var require_main = __commonJS({
|
|
|
147544
147544
|
const shortPaths = [];
|
|
147545
147545
|
for (const filePath of optionPaths) {
|
|
147546
147546
|
try {
|
|
147547
|
-
const relative2 =
|
|
147547
|
+
const relative2 = path80.relative(process.cwd(), filePath);
|
|
147548
147548
|
shortPaths.push(relative2);
|
|
147549
147549
|
} catch (e) {
|
|
147550
147550
|
if (debug2) {
|
|
@@ -148403,8 +148403,8 @@ var init_cli_provider = __esm({
|
|
|
148403
148403
|
this._repoId = repoId;
|
|
148404
148404
|
}
|
|
148405
148405
|
/** Set target repo path — used as cwd when spawning CLI so Read tool accesses the right files. */
|
|
148406
|
-
setRepoPath(
|
|
148407
|
-
this._repoPath =
|
|
148406
|
+
setRepoPath(path80) {
|
|
148407
|
+
this._repoPath = path80;
|
|
148408
148408
|
}
|
|
148409
148409
|
flushUsage() {
|
|
148410
148410
|
if (this._usageRecords.length === 0)
|
|
@@ -160505,11 +160505,11 @@ var require_mime_types = __commonJS({
|
|
|
160505
160505
|
}
|
|
160506
160506
|
return exts[0];
|
|
160507
160507
|
}
|
|
160508
|
-
function lookup(
|
|
160509
|
-
if (!
|
|
160508
|
+
function lookup(path80) {
|
|
160509
|
+
if (!path80 || typeof path80 !== "string") {
|
|
160510
160510
|
return false;
|
|
160511
160511
|
}
|
|
160512
|
-
var extension2 = extname("x." +
|
|
160512
|
+
var extension2 = extname("x." + path80).toLowerCase().substr(1);
|
|
160513
160513
|
if (!extension2) {
|
|
160514
160514
|
return false;
|
|
160515
160515
|
}
|
|
@@ -161614,11 +161614,11 @@ var require_form_data = __commonJS({
|
|
|
161614
161614
|
"use strict";
|
|
161615
161615
|
var CombinedStream = require_combined_stream();
|
|
161616
161616
|
var util2 = __require("util");
|
|
161617
|
-
var
|
|
161617
|
+
var path80 = __require("path");
|
|
161618
161618
|
var http = __require("http");
|
|
161619
161619
|
var https = __require("https");
|
|
161620
161620
|
var parseUrl = __require("url").parse;
|
|
161621
|
-
var
|
|
161621
|
+
var fs69 = __require("fs");
|
|
161622
161622
|
var Stream = __require("stream").Stream;
|
|
161623
161623
|
var crypto6 = __require("crypto");
|
|
161624
161624
|
var mime = require_mime_types();
|
|
@@ -161685,7 +161685,7 @@ var require_form_data = __commonJS({
|
|
|
161685
161685
|
if (value.end != void 0 && value.end != Infinity && value.start != void 0) {
|
|
161686
161686
|
callback(null, value.end + 1 - (value.start ? value.start : 0));
|
|
161687
161687
|
} else {
|
|
161688
|
-
|
|
161688
|
+
fs69.stat(value.path, function(err, stat) {
|
|
161689
161689
|
if (err) {
|
|
161690
161690
|
callback(err);
|
|
161691
161691
|
return;
|
|
@@ -161742,11 +161742,11 @@ var require_form_data = __commonJS({
|
|
|
161742
161742
|
FormData2.prototype._getContentDisposition = function(value, options) {
|
|
161743
161743
|
var filename;
|
|
161744
161744
|
if (typeof options.filepath === "string") {
|
|
161745
|
-
filename =
|
|
161745
|
+
filename = path80.normalize(options.filepath).replace(/\\/g, "/");
|
|
161746
161746
|
} else if (options.filename || value && (value.name || value.path)) {
|
|
161747
|
-
filename =
|
|
161747
|
+
filename = path80.basename(options.filename || value && (value.name || value.path));
|
|
161748
161748
|
} else if (value && value.readable && hasOwn(value, "httpVersion")) {
|
|
161749
|
-
filename =
|
|
161749
|
+
filename = path80.basename(value.client._httpMessage.path || "");
|
|
161750
161750
|
}
|
|
161751
161751
|
if (filename) {
|
|
161752
161752
|
return 'filename="' + filename + '"';
|
|
@@ -162303,8 +162303,8 @@ var require_node2 = __commonJS({
|
|
|
162303
162303
|
}
|
|
162304
162304
|
break;
|
|
162305
162305
|
case "FILE":
|
|
162306
|
-
var
|
|
162307
|
-
stream2 = new
|
|
162306
|
+
var fs69 = __require("fs");
|
|
162307
|
+
stream2 = new fs69.SyncWriteStream(fd2, { autoClose: false });
|
|
162308
162308
|
stream2._type = "fs";
|
|
162309
162309
|
break;
|
|
162310
162310
|
case "PIPE":
|
|
@@ -163400,9 +163400,9 @@ var require_axios = __commonJS({
|
|
|
163400
163400
|
function removeBrackets(key4) {
|
|
163401
163401
|
return utils$1.endsWith(key4, "[]") ? key4.slice(0, -2) : key4;
|
|
163402
163402
|
}
|
|
163403
|
-
function renderKey(
|
|
163404
|
-
if (!
|
|
163405
|
-
return
|
|
163403
|
+
function renderKey(path80, key4, dots) {
|
|
163404
|
+
if (!path80) return key4;
|
|
163405
|
+
return path80.concat(key4).map(function each(token, i) {
|
|
163406
163406
|
token = removeBrackets(token);
|
|
163407
163407
|
return !dots && i ? "[" + token + "]" : token;
|
|
163408
163408
|
}).join(dots ? "." : "");
|
|
@@ -163450,13 +163450,13 @@ var require_axios = __commonJS({
|
|
|
163450
163450
|
}
|
|
163451
163451
|
return value;
|
|
163452
163452
|
}
|
|
163453
|
-
function defaultVisitor(value, key4,
|
|
163453
|
+
function defaultVisitor(value, key4, path80) {
|
|
163454
163454
|
let arr = value;
|
|
163455
163455
|
if (utils$1.isReactNative(formData) && utils$1.isReactNativeBlob(value)) {
|
|
163456
|
-
formData.append(renderKey(
|
|
163456
|
+
formData.append(renderKey(path80, key4, dots), convertValue(value));
|
|
163457
163457
|
return false;
|
|
163458
163458
|
}
|
|
163459
|
-
if (value && !
|
|
163459
|
+
if (value && !path80 && typeof value === "object") {
|
|
163460
163460
|
if (utils$1.endsWith(key4, "{}")) {
|
|
163461
163461
|
key4 = metaTokens ? key4 : key4.slice(0, -2);
|
|
163462
163462
|
value = JSON.stringify(value);
|
|
@@ -163475,7 +163475,7 @@ var require_axios = __commonJS({
|
|
|
163475
163475
|
if (isVisitable(value)) {
|
|
163476
163476
|
return true;
|
|
163477
163477
|
}
|
|
163478
|
-
formData.append(renderKey(
|
|
163478
|
+
formData.append(renderKey(path80, key4, dots), convertValue(value));
|
|
163479
163479
|
return false;
|
|
163480
163480
|
}
|
|
163481
163481
|
const stack2 = [];
|
|
@@ -163484,16 +163484,16 @@ var require_axios = __commonJS({
|
|
|
163484
163484
|
convertValue,
|
|
163485
163485
|
isVisitable
|
|
163486
163486
|
});
|
|
163487
|
-
function build8(value,
|
|
163487
|
+
function build8(value, path80) {
|
|
163488
163488
|
if (utils$1.isUndefined(value)) return;
|
|
163489
163489
|
if (stack2.indexOf(value) !== -1) {
|
|
163490
|
-
throw Error("Circular reference detected in " +
|
|
163490
|
+
throw Error("Circular reference detected in " + path80.join("."));
|
|
163491
163491
|
}
|
|
163492
163492
|
stack2.push(value);
|
|
163493
163493
|
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,
|
|
163494
|
+
const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(formData, el, utils$1.isString(key4) ? key4.trim() : key4, path80, exposedHelpers);
|
|
163495
163495
|
if (result === true) {
|
|
163496
|
-
build8(el,
|
|
163496
|
+
build8(el, path80 ? path80.concat(key4) : [key4]);
|
|
163497
163497
|
}
|
|
163498
163498
|
});
|
|
163499
163499
|
stack2.pop();
|
|
@@ -163682,7 +163682,7 @@ var require_axios = __commonJS({
|
|
|
163682
163682
|
};
|
|
163683
163683
|
function toURLEncodedForm(data, options) {
|
|
163684
163684
|
return toFormData(data, new platform.classes.URLSearchParams(), {
|
|
163685
|
-
visitor: function(value, key4,
|
|
163685
|
+
visitor: function(value, key4, path80, helpers) {
|
|
163686
163686
|
if (platform.isNode && utils$1.isBuffer(value)) {
|
|
163687
163687
|
this.append(key4, value.toString("base64"));
|
|
163688
163688
|
return false;
|
|
@@ -163710,11 +163710,11 @@ var require_axios = __commonJS({
|
|
|
163710
163710
|
return obj;
|
|
163711
163711
|
}
|
|
163712
163712
|
function formDataToJSON(formData) {
|
|
163713
|
-
function buildPath(
|
|
163714
|
-
let name =
|
|
163713
|
+
function buildPath(path80, value, target, index) {
|
|
163714
|
+
let name = path80[index++];
|
|
163715
163715
|
if (name === "__proto__") return true;
|
|
163716
163716
|
const isNumericKey = Number.isFinite(+name);
|
|
163717
|
-
const isLast = index >=
|
|
163717
|
+
const isLast = index >= path80.length;
|
|
163718
163718
|
name = !name && utils$1.isArray(target) ? target.length : name;
|
|
163719
163719
|
if (isLast) {
|
|
163720
163720
|
if (utils$1.hasOwnProp(target, name)) {
|
|
@@ -163727,7 +163727,7 @@ var require_axios = __commonJS({
|
|
|
163727
163727
|
if (!target[name] || !utils$1.isObject(target[name])) {
|
|
163728
163728
|
target[name] = [];
|
|
163729
163729
|
}
|
|
163730
|
-
const result = buildPath(
|
|
163730
|
+
const result = buildPath(path80, value, target[name], index);
|
|
163731
163731
|
if (result && utils$1.isArray(target[name])) {
|
|
163732
163732
|
target[name] = arrayToObject(target[name]);
|
|
163733
163733
|
}
|
|
@@ -165045,9 +165045,9 @@ var require_axios = __commonJS({
|
|
|
165045
165045
|
auth = urlUsername + ":" + urlPassword;
|
|
165046
165046
|
}
|
|
165047
165047
|
auth && headers.delete("authorization");
|
|
165048
|
-
let
|
|
165048
|
+
let path80;
|
|
165049
165049
|
try {
|
|
165050
|
-
|
|
165050
|
+
path80 = buildURL(parsed.pathname + parsed.search, config2.params, config2.paramsSerializer).replace(/^\?/, "");
|
|
165051
165051
|
} catch (err) {
|
|
165052
165052
|
const customErr = new Error(err.message);
|
|
165053
165053
|
customErr.config = config2;
|
|
@@ -165057,7 +165057,7 @@ var require_axios = __commonJS({
|
|
|
165057
165057
|
}
|
|
165058
165058
|
headers.set("Accept-Encoding", "gzip, compress, deflate" + (isBrotliSupported ? ", br" : ""), false);
|
|
165059
165059
|
const options = {
|
|
165060
|
-
path:
|
|
165060
|
+
path: path80,
|
|
165061
165061
|
method,
|
|
165062
165062
|
headers: headers.toJSON(),
|
|
165063
165063
|
agents: {
|
|
@@ -165263,14 +165263,14 @@ var require_axios = __commonJS({
|
|
|
165263
165263
|
var cookies = platform.hasStandardBrowserEnv ? (
|
|
165264
165264
|
// Standard browser envs support document.cookie
|
|
165265
165265
|
{
|
|
165266
|
-
write(name, value, expires,
|
|
165266
|
+
write(name, value, expires, path80, domain, secure, sameSite) {
|
|
165267
165267
|
if (typeof document === "undefined") return;
|
|
165268
165268
|
const cookie = [`${name}=${encodeURIComponent(value)}`];
|
|
165269
165269
|
if (utils$1.isNumber(expires)) {
|
|
165270
165270
|
cookie.push(`expires=${new Date(expires).toUTCString()}`);
|
|
165271
165271
|
}
|
|
165272
|
-
if (utils$1.isString(
|
|
165273
|
-
cookie.push(`path=${
|
|
165272
|
+
if (utils$1.isString(path80)) {
|
|
165273
|
+
cookie.push(`path=${path80}`);
|
|
165274
165274
|
}
|
|
165275
165275
|
if (utils$1.isString(domain)) {
|
|
165276
165276
|
cookie.push(`domain=${domain}`);
|
|
@@ -166791,8 +166791,8 @@ function createGetModuleFromFilename(basePath = process.argv[1] ? dirname10(proc
|
|
|
166791
166791
|
return decodedFile;
|
|
166792
166792
|
};
|
|
166793
166793
|
}
|
|
166794
|
-
function normalizeWindowsPath(
|
|
166795
|
-
return
|
|
166794
|
+
function normalizeWindowsPath(path80) {
|
|
166795
|
+
return path80.replace(/^[A-Z]:/, "").replace(/\\/g, "/");
|
|
166796
166796
|
}
|
|
166797
166797
|
async function addSourceContext(frames) {
|
|
166798
166798
|
const filesToLines = {};
|
|
@@ -166837,9 +166837,9 @@ async function addSourceContext(frames) {
|
|
|
166837
166837
|
LRU_FILE_CONTENTS_CACHE.reduce();
|
|
166838
166838
|
return frames;
|
|
166839
166839
|
}
|
|
166840
|
-
function getContextLinesFromFile(
|
|
166840
|
+
function getContextLinesFromFile(path80, ranges, output) {
|
|
166841
166841
|
return new Promise((resolve12) => {
|
|
166842
|
-
const stream = createReadStream(
|
|
166842
|
+
const stream = createReadStream(path80);
|
|
166843
166843
|
const lineReaded = createInterface2({
|
|
166844
166844
|
input: stream
|
|
166845
166845
|
});
|
|
@@ -166857,7 +166857,7 @@ function getContextLinesFromFile(path79, ranges, output) {
|
|
|
166857
166857
|
let rangeStart = range2[0];
|
|
166858
166858
|
let rangeEnd = range2[1];
|
|
166859
166859
|
function onStreamError() {
|
|
166860
|
-
LRU_FILE_CONTENTS_FS_READ_FAILED.set(
|
|
166860
|
+
LRU_FILE_CONTENTS_FS_READ_FAILED.set(path80, 1);
|
|
166861
166861
|
lineReaded.close();
|
|
166862
166862
|
lineReaded.removeAllListeners();
|
|
166863
166863
|
destroyStreamAndResolve();
|
|
@@ -166934,8 +166934,8 @@ function clearLineContext(frame) {
|
|
|
166934
166934
|
delete frame.context_line;
|
|
166935
166935
|
delete frame.post_context;
|
|
166936
166936
|
}
|
|
166937
|
-
function shouldSkipContextLinesForFile(
|
|
166938
|
-
return
|
|
166937
|
+
function shouldSkipContextLinesForFile(path80) {
|
|
166938
|
+
return path80.startsWith("node:") || path80.endsWith(".min.js") || path80.endsWith(".min.cjs") || path80.endsWith(".min.mjs") || path80.startsWith("data:");
|
|
166939
166939
|
}
|
|
166940
166940
|
function shouldSkipContextLinesForFrame(frame) {
|
|
166941
166941
|
if (frame.lineno !== void 0 && frame.lineno > MAX_CONTEXTLINES_LINENO) {
|
|
@@ -170284,7 +170284,7 @@ function readToolVersion() {
|
|
|
170284
170284
|
if (cachedVersion)
|
|
170285
170285
|
return cachedVersion;
|
|
170286
170286
|
if (true) {
|
|
170287
|
-
cachedVersion = "0.7.0-next.
|
|
170287
|
+
cachedVersion = "0.7.0-next.3";
|
|
170288
170288
|
return cachedVersion;
|
|
170289
170289
|
}
|
|
170290
170290
|
try {
|
|
@@ -172690,13 +172690,13 @@ var init_pexprs_toFailure = __esm({
|
|
|
172690
172690
|
return new Failure(this, "a Unicode [" + this.categoryOrProp + "] character", "description");
|
|
172691
172691
|
};
|
|
172692
172692
|
Alt.prototype.toFailure = function(grammar2) {
|
|
172693
|
-
const
|
|
172694
|
-
const description = "(" +
|
|
172693
|
+
const fs69 = this.terms.map((t2) => t2.toFailure(grammar2));
|
|
172694
|
+
const description = "(" + fs69.join(" or ") + ")";
|
|
172695
172695
|
return new Failure(this, description, "description");
|
|
172696
172696
|
};
|
|
172697
172697
|
Seq.prototype.toFailure = function(grammar2) {
|
|
172698
|
-
const
|
|
172699
|
-
const description = "(" +
|
|
172698
|
+
const fs69 = this.factors.map((f2) => f2.toFailure(grammar2));
|
|
172699
|
+
const description = "(" + fs69.join(" ") + ")";
|
|
172700
172700
|
return new Failure(this, description, "description");
|
|
172701
172701
|
};
|
|
172702
172702
|
Iter.prototype.toFailure = function(grammar2) {
|
|
@@ -174533,9 +174533,9 @@ function buildGrammar2(match4, namespace, optOhmGrammarForTesting, options) {
|
|
|
174533
174533
|
decl.withSuperGrammar(namespace[superGrammarName]);
|
|
174534
174534
|
}
|
|
174535
174535
|
},
|
|
174536
|
-
Rule_define(n,
|
|
174536
|
+
Rule_define(n, fs69, d3, _2, b) {
|
|
174537
174537
|
currentRuleName = n.visit();
|
|
174538
|
-
currentRuleFormals =
|
|
174538
|
+
currentRuleFormals = fs69.children.map((c2) => c2.visit())[0] || [];
|
|
174539
174539
|
if (!decl.defaultStartRule && decl.ensureSuperGrammar() !== Grammar.ProtoBuiltInRules) {
|
|
174540
174540
|
decl.withDefaultStartRule(currentRuleName);
|
|
174541
174541
|
}
|
|
@@ -174544,9 +174544,9 @@ function buildGrammar2(match4, namespace, optOhmGrammarForTesting, options) {
|
|
|
174544
174544
|
const source = this.source.trimmed();
|
|
174545
174545
|
return decl.define(currentRuleName, currentRuleFormals, body, description, source);
|
|
174546
174546
|
},
|
|
174547
|
-
Rule_override(n,
|
|
174547
|
+
Rule_override(n, fs69, _2, b) {
|
|
174548
174548
|
currentRuleName = n.visit();
|
|
174549
|
-
currentRuleFormals =
|
|
174549
|
+
currentRuleFormals = fs69.children.map((c2) => c2.visit())[0] || [];
|
|
174550
174550
|
const source = this.source.trimmed();
|
|
174551
174551
|
decl.ensureSuperGrammarRuleForOverriding(currentRuleName, source);
|
|
174552
174552
|
overriding = true;
|
|
@@ -174554,9 +174554,9 @@ function buildGrammar2(match4, namespace, optOhmGrammarForTesting, options) {
|
|
|
174554
174554
|
overriding = false;
|
|
174555
174555
|
return decl.override(currentRuleName, currentRuleFormals, body, null, source);
|
|
174556
174556
|
},
|
|
174557
|
-
Rule_extend(n,
|
|
174557
|
+
Rule_extend(n, fs69, _2, b) {
|
|
174558
174558
|
currentRuleName = n.visit();
|
|
174559
|
-
currentRuleFormals =
|
|
174559
|
+
currentRuleFormals = fs69.children.map((c2) => c2.visit())[0] || [];
|
|
174560
174560
|
const body = b.visit();
|
|
174561
174561
|
const source = this.source.trimmed();
|
|
174562
174562
|
return decl.extend(currentRuleName, currentRuleFormals, body, null, source);
|
|
@@ -174583,8 +174583,8 @@ function buildGrammar2(match4, namespace, optOhmGrammarForTesting, options) {
|
|
|
174583
174583
|
return builder.alt(...args).withSource(this.source);
|
|
174584
174584
|
}
|
|
174585
174585
|
},
|
|
174586
|
-
Formals(opointy,
|
|
174587
|
-
return
|
|
174586
|
+
Formals(opointy, fs69, cpointy) {
|
|
174587
|
+
return fs69.visit();
|
|
174588
174588
|
},
|
|
174589
174589
|
Params(opointy, ps, cpointy) {
|
|
174590
174590
|
return ps.visit();
|
|
@@ -174746,8 +174746,8 @@ function initPrototypeParser(grammar2) {
|
|
|
174746
174746
|
formals: optFormals.children.map((c2) => c2.parse())[0] || []
|
|
174747
174747
|
};
|
|
174748
174748
|
},
|
|
174749
|
-
Formals(oparen,
|
|
174750
|
-
return
|
|
174749
|
+
Formals(oparen, fs69, cparen) {
|
|
174750
|
+
return fs69.asIteration().children.map((c2) => c2.parse());
|
|
174751
174751
|
},
|
|
174752
174752
|
name(first2, rest) {
|
|
174753
174753
|
return this.sourceString;
|
|
@@ -178068,8 +178068,8 @@ function parseAndResolve(files) {
|
|
|
178068
178068
|
const parsed = files.map((f2) => parseOne(f2.path, f2.source));
|
|
178069
178069
|
return resolve10(parsed);
|
|
178070
178070
|
}
|
|
178071
|
-
function parseTcFile(
|
|
178072
|
-
return parseOne(
|
|
178071
|
+
function parseTcFile(path80, source) {
|
|
178072
|
+
return parseOne(path80, source);
|
|
178073
178073
|
}
|
|
178074
178074
|
var LineMap, OP_VALUES;
|
|
178075
178075
|
var init_parser_ohm = __esm({
|
|
@@ -179458,13 +179458,13 @@ function extractStarletteRoutesFromFile(filePath, source, tree) {
|
|
|
179458
179458
|
const identities = starletteIdentitiesForPath(rawPath);
|
|
179459
179459
|
const line = node2.startPosition.row + 1;
|
|
179460
179460
|
for (const method of methods) {
|
|
179461
|
-
for (const
|
|
179461
|
+
for (const path80 of identities) {
|
|
179462
179462
|
out.push({
|
|
179463
|
-
identity: `${method} ${
|
|
179463
|
+
identity: `${method} ${path80}`,
|
|
179464
179464
|
contract: {
|
|
179465
179465
|
protocol: "http",
|
|
179466
179466
|
method,
|
|
179467
|
-
path:
|
|
179467
|
+
path: path80,
|
|
179468
179468
|
responses: [],
|
|
179469
179469
|
tags: []
|
|
179470
179470
|
},
|
|
@@ -179641,14 +179641,14 @@ function parseRouteDecorator(dec, source, stringVars) {
|
|
|
179641
179641
|
const args = call.childForFieldName("arguments");
|
|
179642
179642
|
if (!args)
|
|
179643
179643
|
return null;
|
|
179644
|
-
let
|
|
179644
|
+
let path80 = null;
|
|
179645
179645
|
let successStatus = "200";
|
|
179646
179646
|
for (let i = 0; i < args.namedChildCount; i++) {
|
|
179647
179647
|
const a = args.namedChild(i);
|
|
179648
179648
|
if (!a)
|
|
179649
179649
|
continue;
|
|
179650
|
-
if (
|
|
179651
|
-
|
|
179650
|
+
if (path80 === null && a.type === "string")
|
|
179651
|
+
path80 = pyStr(a, source);
|
|
179652
179652
|
else if (a.type === "keyword_argument") {
|
|
179653
179653
|
const name = a.childForFieldName("name");
|
|
179654
179654
|
const value = a.childForFieldName("value");
|
|
@@ -179657,17 +179657,17 @@ function parseRouteDecorator(dec, source, stringVars) {
|
|
|
179657
179657
|
}
|
|
179658
179658
|
}
|
|
179659
179659
|
}
|
|
179660
|
-
if (
|
|
179660
|
+
if (path80 === null) {
|
|
179661
179661
|
const firstArg = args.namedChild(0);
|
|
179662
179662
|
if (firstArg?.type === "identifier") {
|
|
179663
179663
|
const resolved = stringVars.get(source.slice(firstArg.startIndex, firstArg.endIndex));
|
|
179664
179664
|
if (resolved !== void 0)
|
|
179665
|
-
|
|
179665
|
+
path80 = resolved;
|
|
179666
179666
|
}
|
|
179667
179667
|
}
|
|
179668
|
-
if (
|
|
179668
|
+
if (path80 === null)
|
|
179669
179669
|
return null;
|
|
179670
|
-
return { method, path:
|
|
179670
|
+
return { method, path: path80, routerVar, successStatus };
|
|
179671
179671
|
}
|
|
179672
179672
|
function extractResponses2(body, source, successStatus) {
|
|
179673
179673
|
const byStatus = /* @__PURE__ */ new Map();
|
|
@@ -179800,9 +179800,9 @@ function looksLikeModel(p2, source) {
|
|
|
179800
179800
|
const text4 = source.slice(type2.startIndex, type2.endIndex);
|
|
179801
179801
|
return /^[A-Z]/.test(text4);
|
|
179802
179802
|
}
|
|
179803
|
-
function joinPath(prefix,
|
|
179803
|
+
function joinPath(prefix, path80) {
|
|
179804
179804
|
const a = prefix.replace(/\/$/, "");
|
|
179805
|
-
const b =
|
|
179805
|
+
const b = path80.startsWith("/") ? path80 : `/${path80}`;
|
|
179806
179806
|
return a + b || "/";
|
|
179807
179807
|
}
|
|
179808
179808
|
function callName(call, source) {
|
|
@@ -196095,8 +196095,8 @@ async function runRulesReset({ ruleKey }) {
|
|
|
196095
196095
|
|
|
196096
196096
|
// tools/cli/src/commands/contracts.ts
|
|
196097
196097
|
init_dist4();
|
|
196098
|
-
import
|
|
196099
|
-
import
|
|
196098
|
+
import fs66 from "node:fs";
|
|
196099
|
+
import path73 from "node:path";
|
|
196100
196100
|
|
|
196101
196101
|
// packages/spec-consolidator/dist/types.js
|
|
196102
196102
|
init_zod();
|
|
@@ -197486,12 +197486,12 @@ function prefilterDocs(docs, manualIncludes = []) {
|
|
|
197486
197486
|
if (reason)
|
|
197487
197487
|
reasons.set(doc.path, reason);
|
|
197488
197488
|
}
|
|
197489
|
-
for (const { path:
|
|
197490
|
-
reasons.set(
|
|
197489
|
+
for (const { path: path80, reason } of dedupeNearDuplicates(docs.filter((d3) => !manualSet.has(d3.path) && !reasons.has(d3.path)))) {
|
|
197490
|
+
reasons.set(path80, reason);
|
|
197491
197491
|
}
|
|
197492
197492
|
return {
|
|
197493
197493
|
toClassify: docs.filter((d3) => !reasons.has(d3.path)),
|
|
197494
|
-
skipped: [...reasons].map(([
|
|
197494
|
+
skipped: [...reasons].map(([path80, reason]) => ({ path: path80, reason }))
|
|
197495
197495
|
};
|
|
197496
197496
|
}
|
|
197497
197497
|
async function planRelevanceWork(repoRoot5, docs, manualIncludes = []) {
|
|
@@ -198057,8 +198057,8 @@ function canonicalIdentity(_kind, identity) {
|
|
|
198057
198057
|
let id = identity.trim().replace(/\s+/g, " ");
|
|
198058
198058
|
const op = HTTP_METHOD.exec(id);
|
|
198059
198059
|
if (op) {
|
|
198060
|
-
const
|
|
198061
|
-
id = `${op[1].toUpperCase()} ${
|
|
198060
|
+
const path80 = op[2].replace(/\/+$/, "").replace(/:([A-Za-z_][A-Za-z0-9_]*)/g, "{$1}");
|
|
198061
|
+
id = `${op[1].toUpperCase()} ${path80}`;
|
|
198062
198062
|
}
|
|
198063
198063
|
return id;
|
|
198064
198064
|
}
|
|
@@ -205070,6 +205070,10 @@ ${err.message}`;
|
|
|
205070
205070
|
});
|
|
205071
205071
|
}
|
|
205072
205072
|
|
|
205073
|
+
// packages/guard-runner/dist/preflight.js
|
|
205074
|
+
import fs51 from "node:fs";
|
|
205075
|
+
import path57 from "node:path";
|
|
205076
|
+
|
|
205073
205077
|
// packages/guard-runner/dist/sandbox.js
|
|
205074
205078
|
import fs50 from "node:fs";
|
|
205075
205079
|
import os11 from "node:os";
|
|
@@ -205215,24 +205219,25 @@ function executeStep(opts) {
|
|
|
205215
205219
|
// packages/guard-runner/dist/preflight.js
|
|
205216
205220
|
var ENTRY_PROBE_ARGVS = [[], ["--help"]];
|
|
205217
205221
|
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
|
-
};
|
|
205222
|
+
var defaultEntryProbeExecutor = (fullArgv, world, timeoutMs) => executeStep({ argv: fullArgv, cwd: world.cwd, env: world.env, timeoutMs });
|
|
205226
205223
|
async function preflightEntry(opts) {
|
|
205227
205224
|
const exec3 = opts.exec ?? defaultEntryProbeExecutor;
|
|
205228
205225
|
const timeoutMs = opts.timeoutMs ?? ENTRY_PREFLIGHT_TIMEOUT_MS;
|
|
205229
205226
|
const entry = opts.displayEntry.join(" ");
|
|
205230
|
-
const
|
|
205231
|
-
|
|
205232
|
-
|
|
205233
|
-
|
|
205227
|
+
const sandbox = createSandbox({ recipeEnv: opts.recipeEnv });
|
|
205228
|
+
const probes = [];
|
|
205229
|
+
try {
|
|
205230
|
+
for (const argv of ENTRY_PROBE_ARGVS) {
|
|
205231
|
+
probes.push({
|
|
205232
|
+
argv: [...argv],
|
|
205233
|
+
capture: await exec3([...opts.resolvedEntry, ...argv], { cwd: sandbox.cwd, env: sandbox.env }, timeoutMs)
|
|
205234
|
+
});
|
|
205235
|
+
}
|
|
205236
|
+
} finally {
|
|
205237
|
+
sandbox.cleanup();
|
|
205238
|
+
}
|
|
205234
205239
|
const ok = entryStarts(probes);
|
|
205235
|
-
return { ok, entry, stderr: ok ? "" :
|
|
205240
|
+
return { ok, entry, stderr: ok ? "" : deadEntryOutput(opts, probes[0].capture, timeoutMs), probes };
|
|
205236
205241
|
}
|
|
205237
205242
|
function entryStarts(probes) {
|
|
205238
205243
|
if (probes.some((p2) => startedCleanly(p2.capture)))
|
|
@@ -205253,6 +205258,15 @@ function failureShape(c2) {
|
|
|
205253
205258
|
stderr: c2.stderr
|
|
205254
205259
|
});
|
|
205255
205260
|
}
|
|
205261
|
+
function deadEntryOutput(opts, bare, timeoutMs) {
|
|
205262
|
+
const parts = [startupOutput(bare, timeoutMs)];
|
|
205263
|
+
if (opts.repoRoot) {
|
|
205264
|
+
const missing = missingEntryScript(opts.repoRoot, opts.displayEntry);
|
|
205265
|
+
if (missing)
|
|
205266
|
+
parts.push(formatMissingEntryScript(missing));
|
|
205267
|
+
}
|
|
205268
|
+
return parts.join("\n\n");
|
|
205269
|
+
}
|
|
205256
205270
|
function startupOutput(c2, timeoutMs) {
|
|
205257
205271
|
const parts = [];
|
|
205258
205272
|
const primary = c2.stderr || c2.stdout;
|
|
@@ -205267,6 +205281,47 @@ function startupOutput(c2, timeoutMs) {
|
|
|
205267
205281
|
}
|
|
205268
205282
|
return parts.join("\n");
|
|
205269
205283
|
}
|
|
205284
|
+
var MAX_SIBLINGS = 25;
|
|
205285
|
+
function missingEntryScript(repoRoot5, entry) {
|
|
205286
|
+
const [command, ...rest] = entry;
|
|
205287
|
+
const candidates = [];
|
|
205288
|
+
if (command && isPathLike(command))
|
|
205289
|
+
candidates.push(command);
|
|
205290
|
+
for (const arg of rest) {
|
|
205291
|
+
if (!arg.startsWith("-") && isPathLike(arg))
|
|
205292
|
+
candidates.push(arg);
|
|
205293
|
+
}
|
|
205294
|
+
for (const arg of candidates) {
|
|
205295
|
+
const resolved = path57.isAbsolute(arg) ? arg : path57.resolve(repoRoot5, arg);
|
|
205296
|
+
if (fs51.existsSync(resolved))
|
|
205297
|
+
continue;
|
|
205298
|
+
const parent = path57.dirname(resolved);
|
|
205299
|
+
const siblings = fs51.existsSync(parent) ? fs51.readdirSync(parent).sort() : null;
|
|
205300
|
+
return {
|
|
205301
|
+
arg,
|
|
205302
|
+
resolved,
|
|
205303
|
+
parentDir: path57.isAbsolute(arg) ? parent : path57.relative(repoRoot5, parent) || ".",
|
|
205304
|
+
siblings
|
|
205305
|
+
};
|
|
205306
|
+
}
|
|
205307
|
+
return null;
|
|
205308
|
+
}
|
|
205309
|
+
function formatMissingEntryScript(m) {
|
|
205310
|
+
const head = `entry file not found: ${m.arg} (resolved: ${m.resolved})`;
|
|
205311
|
+
if (m.siblings === null)
|
|
205312
|
+
return `${head}
|
|
205313
|
+
its directory ${m.parentDir}/ does not exist`;
|
|
205314
|
+
if (m.siblings.length === 0)
|
|
205315
|
+
return `${head}
|
|
205316
|
+
${m.parentDir}/ is empty`;
|
|
205317
|
+
const shown = m.siblings.slice(0, MAX_SIBLINGS).join(", ");
|
|
205318
|
+
const more = m.siblings.length - MAX_SIBLINGS;
|
|
205319
|
+
return `${head}
|
|
205320
|
+
${m.parentDir}/ contains: ${shown}${more > 0 ? ` \u2026 and ${more} more` : ""}`;
|
|
205321
|
+
}
|
|
205322
|
+
function isPathLike(arg) {
|
|
205323
|
+
return arg.includes("/") || arg.includes(path57.sep) || arg.startsWith(".");
|
|
205324
|
+
}
|
|
205270
205325
|
function entryPreflightHeadline(entry, buildCommand) {
|
|
205271
205326
|
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
205327
|
}
|
|
@@ -205276,8 +205331,8 @@ function formatEntryPreflightError(opts) {
|
|
|
205276
205331
|
|
|
205277
205332
|
// packages/guard-runner/dist/capabilities/git.js
|
|
205278
205333
|
import { spawnSync as spawnSync2 } from "node:child_process";
|
|
205279
|
-
import
|
|
205280
|
-
import
|
|
205334
|
+
import fs52 from "node:fs";
|
|
205335
|
+
import path58 from "node:path";
|
|
205281
205336
|
var GIT_IDENTITY = {
|
|
205282
205337
|
GIT_AUTHOR_NAME: "TrueCourse Guard",
|
|
205283
205338
|
GIT_AUTHOR_EMAIL: "guard@truecourse.dev",
|
|
@@ -205309,11 +205364,11 @@ function materializeGit(declaration, ctx) {
|
|
|
205309
205364
|
}
|
|
205310
205365
|
function requireFiles(files, ctx) {
|
|
205311
205366
|
for (const rel of files) {
|
|
205312
|
-
const target =
|
|
205313
|
-
if (target !== ctx.cwd && !target.startsWith(ctx.cwd +
|
|
205367
|
+
const target = path58.resolve(ctx.cwd, rel);
|
|
205368
|
+
if (target !== ctx.cwd && !target.startsWith(ctx.cwd + path58.sep)) {
|
|
205314
205369
|
throw new CapabilityError("git", `path escapes the sandbox: ${rel}`);
|
|
205315
205370
|
}
|
|
205316
|
-
if (!
|
|
205371
|
+
if (!fs52.existsSync(target)) {
|
|
205317
205372
|
throw new CapabilityError("git", `declared file does not exist in the sandbox: ${rel} (seed it via setup.files or an earlier commit)`);
|
|
205318
205373
|
}
|
|
205319
205374
|
}
|
|
@@ -205401,8 +205456,8 @@ function normalize7(text4, normalizers, ctx) {
|
|
|
205401
205456
|
}
|
|
205402
205457
|
|
|
205403
205458
|
// packages/guard-runner/dist/expect.js
|
|
205404
|
-
import
|
|
205405
|
-
import
|
|
205459
|
+
import fs53 from "node:fs";
|
|
205460
|
+
import path59 from "node:path";
|
|
205406
205461
|
function evaluateExpect(params) {
|
|
205407
205462
|
const { expect } = params;
|
|
205408
205463
|
if (expect.exit !== void 0 && params.exitCode !== expect.exit) {
|
|
@@ -205473,8 +205528,8 @@ function matchStream(subject, matcher, value) {
|
|
|
205473
205528
|
};
|
|
205474
205529
|
}
|
|
205475
205530
|
function matchFile3(rel, matcher, sandboxCwd, normalizeText) {
|
|
205476
|
-
const target =
|
|
205477
|
-
const exists2 =
|
|
205531
|
+
const target = path59.resolve(sandboxCwd, rel);
|
|
205532
|
+
const exists2 = fs53.existsSync(target) && fs53.statSync(target).isFile();
|
|
205478
205533
|
if (matcher.exists === true || matcher.absent === false) {
|
|
205479
205534
|
if (!exists2)
|
|
205480
205535
|
return fileMiss(rel, "to exist", "missing");
|
|
@@ -205486,7 +205541,7 @@ function matchFile3(rel, matcher, sandboxCwd, normalizeText) {
|
|
|
205486
205541
|
if (matcher.equals !== void 0 || matcher.contains !== void 0) {
|
|
205487
205542
|
if (!exists2)
|
|
205488
205543
|
return fileMiss(rel, "to exist for a content check", "missing");
|
|
205489
|
-
const content = normalizeText(
|
|
205544
|
+
const content = normalizeText(fs53.readFileSync(target, "utf-8"));
|
|
205490
205545
|
if (matcher.equals !== void 0 && content !== matcher.equals) {
|
|
205491
205546
|
return {
|
|
205492
205547
|
subject: "files",
|
|
@@ -205516,11 +205571,11 @@ function fileMiss(rel, expectedPhrase, actualState) {
|
|
|
205516
205571
|
}
|
|
205517
205572
|
|
|
205518
205573
|
// packages/guard-runner/dist/evidence.js
|
|
205519
|
-
import
|
|
205520
|
-
import
|
|
205574
|
+
import fs54 from "node:fs";
|
|
205575
|
+
import path60 from "node:path";
|
|
205521
205576
|
function writeEvidence(params) {
|
|
205522
205577
|
const dir = evidenceScenarioDir(params.repoRoot, params.runId, params.scenarioId);
|
|
205523
|
-
|
|
205578
|
+
fs54.mkdirSync(dir, { recursive: true });
|
|
205524
205579
|
const failing = params.steps.find((s) => s.index === params.failingStep);
|
|
205525
205580
|
const invocation = {
|
|
205526
205581
|
scenarioId: params.scenarioId,
|
|
@@ -205599,7 +205654,7 @@ function indent(text4) {
|
|
|
205599
205654
|
return body.split("\n").map((l) => ` ${l}`).join("\n");
|
|
205600
205655
|
}
|
|
205601
205656
|
function writeFile(dir, name, content) {
|
|
205602
|
-
|
|
205657
|
+
fs54.writeFileSync(path60.join(dir, name), content);
|
|
205603
205658
|
}
|
|
205604
205659
|
|
|
205605
205660
|
// packages/guard-runner/dist/run-scenario.js
|
|
@@ -205748,15 +205803,15 @@ function toRecord(index, argv, stdin, repeat3, iterationsRun, capture, normText)
|
|
|
205748
205803
|
|
|
205749
205804
|
// packages/guard-runner/dist/doc-index.js
|
|
205750
205805
|
init_zod();
|
|
205751
|
-
import
|
|
205752
|
-
import
|
|
205806
|
+
import fs55 from "node:fs";
|
|
205807
|
+
import path62 from "node:path";
|
|
205753
205808
|
|
|
205754
205809
|
// packages/guard-runner/dist/section-index.js
|
|
205755
|
-
import
|
|
205810
|
+
import path61 from "node:path";
|
|
205756
205811
|
import crypto4 from "node:crypto";
|
|
205757
205812
|
var MARKDOWN_EXTENSIONS = /* @__PURE__ */ new Set([".md", ".markdown", ".mdown", ".mkd"]);
|
|
205758
205813
|
function isMarkdownDoc(docPath) {
|
|
205759
|
-
return MARKDOWN_EXTENSIONS.has(
|
|
205814
|
+
return MARKDOWN_EXTENSIONS.has(path61.extname(docPath).toLowerCase());
|
|
205760
205815
|
}
|
|
205761
205816
|
function slugifyHeading(text4) {
|
|
205762
205817
|
return text4.replace(/[`*_~]/g, "").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
@@ -205809,7 +205864,7 @@ function sectionEndLine(headings, index, totalLines) {
|
|
|
205809
205864
|
}
|
|
205810
205865
|
function deriveSections(doc, content) {
|
|
205811
205866
|
if (!isMarkdownDoc(doc)) {
|
|
205812
|
-
const base2 =
|
|
205867
|
+
const base2 = path61.basename(doc);
|
|
205813
205868
|
return [
|
|
205814
205869
|
{
|
|
205815
205870
|
anchor: slugifyHeading(base2) || "document",
|
|
@@ -205910,11 +205965,11 @@ function resolveBinding(index, anchor, fingerprint2) {
|
|
|
205910
205965
|
// packages/guard-runner/dist/doc-index.js
|
|
205911
205966
|
var CorpusShape = external_exports.object({ docs: external_exports.array(external_exports.object({ ref: external_exports.string() }).passthrough()).optional() }).passthrough();
|
|
205912
205967
|
function corpusKeptDocs(repoRoot5) {
|
|
205913
|
-
const file =
|
|
205914
|
-
if (!
|
|
205968
|
+
const file = path62.join(repoRoot5, ".truecourse", "specs", "corpus.json");
|
|
205969
|
+
if (!fs55.existsSync(file))
|
|
205915
205970
|
return [];
|
|
205916
205971
|
try {
|
|
205917
|
-
const parsed = CorpusShape.safeParse(JSON.parse(
|
|
205972
|
+
const parsed = CorpusShape.safeParse(JSON.parse(fs55.readFileSync(file, "utf-8")));
|
|
205918
205973
|
if (!parsed.success)
|
|
205919
205974
|
return [];
|
|
205920
205975
|
return (parsed.data.docs ?? []).map((d3) => d3.ref);
|
|
@@ -205929,25 +205984,25 @@ function indexRepoDocs(repoRoot5, boundDocs) {
|
|
|
205929
205984
|
const indexes = /* @__PURE__ */ new Map();
|
|
205930
205985
|
const missing = /* @__PURE__ */ new Set();
|
|
205931
205986
|
for (const doc of wanted) {
|
|
205932
|
-
const abs =
|
|
205933
|
-
if (!
|
|
205987
|
+
const abs = path62.resolve(repoRoot5, doc);
|
|
205988
|
+
if (!fs55.existsSync(abs) || !fs55.statSync(abs).isFile()) {
|
|
205934
205989
|
missing.add(doc);
|
|
205935
205990
|
continue;
|
|
205936
205991
|
}
|
|
205937
|
-
indexes.set(doc, buildDocSectionIndex(doc,
|
|
205992
|
+
indexes.set(doc, buildDocSectionIndex(doc, fs55.readFileSync(abs, "utf-8")));
|
|
205938
205993
|
}
|
|
205939
205994
|
return { indexes, missing };
|
|
205940
205995
|
}
|
|
205941
205996
|
|
|
205942
205997
|
// packages/guard-runner/dist/manifest.js
|
|
205943
205998
|
init_dist5();
|
|
205944
|
-
import
|
|
205999
|
+
import fs56 from "node:fs";
|
|
205945
206000
|
function readManifest2(repoRoot5) {
|
|
205946
206001
|
const file = manifestPath2(repoRoot5);
|
|
205947
|
-
if (!
|
|
206002
|
+
if (!fs56.existsSync(file))
|
|
205948
206003
|
return null;
|
|
205949
206004
|
try {
|
|
205950
|
-
const parsed = GuardManifestSchema.safeParse(JSON.parse(
|
|
206005
|
+
const parsed = GuardManifestSchema.safeParse(JSON.parse(fs56.readFileSync(file, "utf-8")));
|
|
205951
206006
|
return parsed.success ? parsed.data : null;
|
|
205952
206007
|
} catch {
|
|
205953
206008
|
return null;
|
|
@@ -205996,7 +206051,8 @@ async function runGuard(opts) {
|
|
|
205996
206051
|
const preflight = await preflightEntry({
|
|
205997
206052
|
resolvedEntry,
|
|
205998
206053
|
displayEntry: loaded.recipe.entry,
|
|
205999
|
-
recipeEnv: loaded.recipe.env
|
|
206054
|
+
recipeEnv: loaded.recipe.env,
|
|
206055
|
+
repoRoot: repoRoot5
|
|
206000
206056
|
});
|
|
206001
206057
|
if (!preflight.ok) {
|
|
206002
206058
|
return { status: "entry-preflight-failed", preflight, buildCommand: loaded.recipe.build, loadErrors };
|
|
@@ -206123,8 +206179,8 @@ init_dist5();
|
|
|
206123
206179
|
|
|
206124
206180
|
// packages/guard-generator/dist/section-plan.js
|
|
206125
206181
|
init_zod();
|
|
206126
|
-
import
|
|
206127
|
-
import
|
|
206182
|
+
import fs57 from "node:fs";
|
|
206183
|
+
import path63 from "node:path";
|
|
206128
206184
|
import { createHash as createHash15 } from "node:crypto";
|
|
206129
206185
|
init_dist5();
|
|
206130
206186
|
|
|
@@ -206439,12 +206495,12 @@ var CorpusShape2 = external_exports.object({
|
|
|
206439
206495
|
docs: external_exports.array(external_exports.object({ ref: external_exports.string(), areaTags: external_exports.array(external_exports.string()).optional() }).passthrough()).optional()
|
|
206440
206496
|
}).passthrough();
|
|
206441
206497
|
function readCorpusAreaTags(repoRoot5) {
|
|
206442
|
-
const file =
|
|
206498
|
+
const file = path63.join(repoRoot5, ".truecourse", "specs", "corpus.json");
|
|
206443
206499
|
const map2 = /* @__PURE__ */ new Map();
|
|
206444
|
-
if (!
|
|
206500
|
+
if (!fs57.existsSync(file))
|
|
206445
206501
|
return map2;
|
|
206446
206502
|
try {
|
|
206447
|
-
const parsed = CorpusShape2.safeParse(JSON.parse(
|
|
206503
|
+
const parsed = CorpusShape2.safeParse(JSON.parse(fs57.readFileSync(file, "utf-8")));
|
|
206448
206504
|
if (!parsed.success)
|
|
206449
206505
|
return map2;
|
|
206450
206506
|
for (const d3 of parsed.data.docs ?? [])
|
|
@@ -206463,17 +206519,17 @@ function generationInputsHash(fingerprint2, recipeFingerprint) {
|
|
|
206463
206519
|
].join("\0")).digest("hex");
|
|
206464
206520
|
}
|
|
206465
206521
|
function hasGuardUniverse(repoRoot5) {
|
|
206466
|
-
return
|
|
206522
|
+
return fs57.existsSync(path63.join(repoRoot5, ".truecourse", "specs", "corpus.json"));
|
|
206467
206523
|
}
|
|
206468
206524
|
function planGuardWork(repoRoot5, recipeFingerprint) {
|
|
206469
206525
|
const recipeFp = recipeFingerprint ?? computeRecipeFingerprint(repoRoot5);
|
|
206470
|
-
const recipeMissing = !
|
|
206526
|
+
const recipeMissing = !fs57.existsSync(recipePath(repoRoot5));
|
|
206471
206527
|
const hasUniverse = hasGuardUniverse(repoRoot5);
|
|
206472
206528
|
const { indexes } = indexRepoDocs(repoRoot5, []);
|
|
206473
206529
|
const areaTags = readCorpusAreaTags(repoRoot5);
|
|
206474
206530
|
const sections = [];
|
|
206475
206531
|
for (const [doc, index] of indexes) {
|
|
206476
|
-
const texts = extractSectionTexts(doc,
|
|
206532
|
+
const texts = extractSectionTexts(doc, fs57.readFileSync(path63.resolve(repoRoot5, doc), "utf-8"));
|
|
206477
206533
|
for (const s of index.sections) {
|
|
206478
206534
|
const t2 = texts.get(s.anchor);
|
|
206479
206535
|
sections.push({
|
|
@@ -206518,7 +206574,7 @@ function collectWorkDocs(repoRoot5, plan) {
|
|
|
206518
206574
|
}
|
|
206519
206575
|
return [...byDoc].map(([doc, sections]) => ({
|
|
206520
206576
|
doc,
|
|
206521
|
-
content:
|
|
206577
|
+
content: fs57.readFileSync(path63.resolve(repoRoot5, doc), "utf-8"),
|
|
206522
206578
|
sections
|
|
206523
206579
|
}));
|
|
206524
206580
|
}
|
|
@@ -206766,7 +206822,7 @@ function snap(raw, sections) {
|
|
|
206766
206822
|
|
|
206767
206823
|
// packages/guard-generator/dist/ground.js
|
|
206768
206824
|
init_zod();
|
|
206769
|
-
import
|
|
206825
|
+
import path64 from "node:path";
|
|
206770
206826
|
import { createHash as createHash17 } from "node:crypto";
|
|
206771
206827
|
var GROUND_CACHE_NAME = "guard/ground";
|
|
206772
206828
|
var PROBE_TIMEOUT_MS = 2e4;
|
|
@@ -206822,7 +206878,7 @@ function toProbeArgv(fragment, programNames) {
|
|
|
206822
206878
|
const tokens = fragment.trim().split(/\s+/).filter(Boolean);
|
|
206823
206879
|
if (tokens.length === 0)
|
|
206824
206880
|
return null;
|
|
206825
|
-
if (programNames.has(tokens[0]) || programNames.has(
|
|
206881
|
+
if (programNames.has(tokens[0]) || programNames.has(path64.basename(tokens[0])))
|
|
206826
206882
|
tokens.shift();
|
|
206827
206883
|
if (tokens.length === 0)
|
|
206828
206884
|
return [];
|
|
@@ -206843,7 +206899,7 @@ function programNamesOf(entry) {
|
|
|
206843
206899
|
return names;
|
|
206844
206900
|
}
|
|
206845
206901
|
function addName(set2, arg) {
|
|
206846
|
-
const base2 =
|
|
206902
|
+
const base2 = path64.basename(arg);
|
|
206847
206903
|
if (base2)
|
|
206848
206904
|
set2.add(base2);
|
|
206849
206905
|
const stem = base2.replace(/\.[^.]+$/, "");
|
|
@@ -206905,9 +206961,9 @@ function truncate3(text4) {
|
|
|
206905
206961
|
}
|
|
206906
206962
|
|
|
206907
206963
|
// packages/guard-generator/dist/recipe-discovery.js
|
|
206908
|
-
import
|
|
206964
|
+
import fs58 from "node:fs";
|
|
206909
206965
|
import os13 from "node:os";
|
|
206910
|
-
import
|
|
206966
|
+
import path65 from "node:path";
|
|
206911
206967
|
import { createHash as createHash18 } from "node:crypto";
|
|
206912
206968
|
var RECIPE_CACHE_NAME = "guard/recipe";
|
|
206913
206969
|
var DISCOVERY_INPUTS = ["package.json", "pnpm-lock.yaml", "package-lock.json", "yarn.lock", "turbo.json"];
|
|
@@ -206944,6 +207000,14 @@ async function discoverRecipe(repoRoot5, runner) {
|
|
|
206944
207000
|
proposal
|
|
206945
207001
|
};
|
|
206946
207002
|
}
|
|
207003
|
+
const missing = missingEntryScript(repoRoot5, proposal.entry);
|
|
207004
|
+
if (missing) {
|
|
207005
|
+
return {
|
|
207006
|
+
status: "verify-failed",
|
|
207007
|
+
reason: `after \`${proposal.build}\`, ${formatMissingEntryScript(missing)}`,
|
|
207008
|
+
proposal
|
|
207009
|
+
};
|
|
207010
|
+
}
|
|
206947
207011
|
const probe = await probeEntry(repoRoot5, proposal.entry);
|
|
206948
207012
|
if (!probe.ok)
|
|
206949
207013
|
return { status: "verify-failed", reason: probe.reason, proposal };
|
|
@@ -206953,13 +207017,13 @@ async function discoverRecipe(repoRoot5, runner) {
|
|
|
206953
207017
|
...proposal.env ? { env: proposal.env } : {}
|
|
206954
207018
|
};
|
|
206955
207019
|
const target = recipePath(repoRoot5);
|
|
206956
|
-
|
|
206957
|
-
|
|
207020
|
+
fs58.mkdirSync(path65.dirname(target), { recursive: true });
|
|
207021
|
+
fs58.writeFileSync(target, JSON.stringify(recipe, null, 2) + "\n");
|
|
206958
207022
|
return {
|
|
206959
207023
|
status: "discovered",
|
|
206960
207024
|
recipe,
|
|
206961
207025
|
fingerprint: computeRecipeFingerprint(repoRoot5),
|
|
206962
|
-
wrotePath:
|
|
207026
|
+
wrotePath: path65.relative(repoRoot5, target)
|
|
206963
207027
|
};
|
|
206964
207028
|
}
|
|
206965
207029
|
async function proposeRecipeWithReask(input, runner) {
|
|
@@ -206984,14 +207048,14 @@ async function proposeRecipeWithReask(input, runner) {
|
|
|
206984
207048
|
return { error: `recipe proposal invalid after re-ask: ${flattenZodError(reParsed.error)}` };
|
|
206985
207049
|
}
|
|
206986
207050
|
function readDiscoveryInputs(repoRoot5) {
|
|
206987
|
-
const pkgPath =
|
|
206988
|
-
const packageJson =
|
|
206989
|
-
const presentInputs = DISCOVERY_INPUTS.filter((f2) =>
|
|
207051
|
+
const pkgPath = path65.join(repoRoot5, "package.json");
|
|
207052
|
+
const packageJson = fs58.existsSync(pkgPath) ? fs58.readFileSync(pkgPath, "utf-8") : "(no package.json)";
|
|
207053
|
+
const presentInputs = DISCOVERY_INPUTS.filter((f2) => fs58.existsSync(path65.join(repoRoot5, f2)));
|
|
206990
207054
|
return { packageJson, presentInputs };
|
|
206991
207055
|
}
|
|
206992
207056
|
async function probeEntry(repoRoot5, entry) {
|
|
206993
207057
|
const resolved = resolveEntry(repoRoot5, entry);
|
|
206994
|
-
const cwd =
|
|
207058
|
+
const cwd = fs58.mkdtempSync(path65.join(os13.tmpdir(), "tc-guard-probe-"));
|
|
206995
207059
|
try {
|
|
206996
207060
|
for (const args of [["--help"], []]) {
|
|
206997
207061
|
const capture = await executeStep({
|
|
@@ -207008,7 +207072,7 @@ async function probeEntry(repoRoot5, entry) {
|
|
|
207008
207072
|
reason: `entrypoint ${JSON.stringify(entry)} did not answer to \`--help\` or a bare invocation`
|
|
207009
207073
|
};
|
|
207010
207074
|
} finally {
|
|
207011
|
-
|
|
207075
|
+
fs58.rmSync(cwd, { recursive: true, force: true });
|
|
207012
207076
|
}
|
|
207013
207077
|
}
|
|
207014
207078
|
|
|
@@ -207055,8 +207119,8 @@ async function birthValidate(repoRoot5, candidates, opts = {}) {
|
|
|
207055
207119
|
}
|
|
207056
207120
|
|
|
207057
207121
|
// packages/guard-generator/dist/serialize.js
|
|
207058
|
-
import
|
|
207059
|
-
import
|
|
207122
|
+
import fs59 from "node:fs";
|
|
207123
|
+
import path66 from "node:path";
|
|
207060
207124
|
init_dist5();
|
|
207061
207125
|
function anchorLeaf(anchor) {
|
|
207062
207126
|
const segs = anchor.split("/").filter(Boolean);
|
|
@@ -207075,7 +207139,7 @@ function assignScenarioId(anchor, used) {
|
|
|
207075
207139
|
function areaOrDocSlug(section) {
|
|
207076
207140
|
if (section.areaTags.length > 0)
|
|
207077
207141
|
return slugifyHeading(section.areaTags[0]) || "area";
|
|
207078
|
-
const base2 =
|
|
207142
|
+
const base2 = path66.basename(section.doc).replace(/\.[^.]+$/, "");
|
|
207079
207143
|
return slugifyHeading(base2) || "doc";
|
|
207080
207144
|
}
|
|
207081
207145
|
function buildScenario(section, raw, id) {
|
|
@@ -207098,15 +207162,15 @@ function scenarioFileIndex(repoRoot5) {
|
|
|
207098
207162
|
const root2 = scenariosDir(repoRoot5);
|
|
207099
207163
|
const map2 = /* @__PURE__ */ new Map();
|
|
207100
207164
|
const walk20 = (dir) => {
|
|
207101
|
-
if (!
|
|
207165
|
+
if (!fs59.existsSync(dir))
|
|
207102
207166
|
return;
|
|
207103
|
-
for (const entry of
|
|
207104
|
-
const full =
|
|
207167
|
+
for (const entry of fs59.readdirSync(dir, { withFileTypes: true })) {
|
|
207168
|
+
const full = path66.join(dir, entry.name);
|
|
207105
207169
|
if (entry.isDirectory())
|
|
207106
207170
|
walk20(full);
|
|
207107
207171
|
else if (entry.isFile() && /\.ya?ml$/i.test(entry.name)) {
|
|
207108
207172
|
try {
|
|
207109
|
-
const doc = jsYaml.load(
|
|
207173
|
+
const doc = jsYaml.load(fs59.readFileSync(full, "utf-8"));
|
|
207110
207174
|
if (doc && typeof doc.id === "string")
|
|
207111
207175
|
map2.set(doc.id, full);
|
|
207112
207176
|
} catch {
|
|
@@ -207121,18 +207185,18 @@ function existingScenarioIds(repoRoot5) {
|
|
|
207121
207185
|
return new Set(loadScenarios(repoRoot5).scenarios.map((s) => s.id));
|
|
207122
207186
|
}
|
|
207123
207187
|
function writeScenarioFile(repoRoot5, slug2, scenario) {
|
|
207124
|
-
const dir =
|
|
207125
|
-
|
|
207126
|
-
const file =
|
|
207127
|
-
|
|
207128
|
-
return
|
|
207188
|
+
const dir = path66.join(scenariosDir(repoRoot5), slug2);
|
|
207189
|
+
fs59.mkdirSync(dir, { recursive: true });
|
|
207190
|
+
const file = path66.join(dir, `${scenario.id}.yaml`);
|
|
207191
|
+
fs59.writeFileSync(file, jsYaml.dump(scenario, { lineWidth: -1, noRefs: true }));
|
|
207192
|
+
return path66.relative(repoRoot5, file);
|
|
207129
207193
|
}
|
|
207130
207194
|
function deleteScenarioFiles(repoRoot5, ids) {
|
|
207131
207195
|
const index = scenarioFileIndex(repoRoot5);
|
|
207132
207196
|
for (const id of ids) {
|
|
207133
207197
|
const file = index.get(id);
|
|
207134
|
-
if (file &&
|
|
207135
|
-
|
|
207198
|
+
if (file && fs59.existsSync(file))
|
|
207199
|
+
fs59.rmSync(file);
|
|
207136
207200
|
}
|
|
207137
207201
|
}
|
|
207138
207202
|
|
|
@@ -207311,7 +207375,7 @@ async function generateGuards(options) {
|
|
|
207311
207375
|
if (!build8.ok)
|
|
207312
207376
|
return null;
|
|
207313
207377
|
resolvedEntryMemo ??= resolveEntry(repoRoot5, recipe.entry);
|
|
207314
|
-
return preflightEntry({ resolvedEntry: resolvedEntryMemo, displayEntry: recipe.entry, recipeEnv: recipe.env });
|
|
207378
|
+
return preflightEntry({ resolvedEntry: resolvedEntryMemo, displayEntry: recipe.entry, recipeEnv: recipe.env, repoRoot: repoRoot5 });
|
|
207315
207379
|
})();
|
|
207316
207380
|
return entryPreflightMemo;
|
|
207317
207381
|
};
|
|
@@ -207794,8 +207858,8 @@ init_context_router();
|
|
|
207794
207858
|
|
|
207795
207859
|
// packages/core/dist/services/llm/model-prices.js
|
|
207796
207860
|
init_paths();
|
|
207797
|
-
import
|
|
207798
|
-
import
|
|
207861
|
+
import fs60 from "node:fs";
|
|
207862
|
+
import path67 from "node:path";
|
|
207799
207863
|
var OPENROUTER_URL = "https://openrouter.ai/api/v1/models";
|
|
207800
207864
|
var CACHE_TTL_MS = 24 * 60 * 60 * 1e3;
|
|
207801
207865
|
var FETCH_TIMEOUT_MS = 8e3;
|
|
@@ -207811,11 +207875,11 @@ function tierOf(id) {
|
|
|
207811
207875
|
return s.includes("opus") ? "opus" : s.includes("sonnet") ? "sonnet" : s.includes("haiku") ? "haiku" : null;
|
|
207812
207876
|
}
|
|
207813
207877
|
function cacheFilePath() {
|
|
207814
|
-
return
|
|
207878
|
+
return path67.join(getGlobalDir(), "cache", CACHE_FILE);
|
|
207815
207879
|
}
|
|
207816
207880
|
function readCache7() {
|
|
207817
207881
|
try {
|
|
207818
|
-
const t2 = JSON.parse(
|
|
207882
|
+
const t2 = JSON.parse(fs60.readFileSync(cacheFilePath(), "utf-8"));
|
|
207819
207883
|
if (t2 && t2.tiers && t2.byId && typeof t2.fetchedAt === "number")
|
|
207820
207884
|
return t2;
|
|
207821
207885
|
} catch {
|
|
@@ -207824,8 +207888,8 @@ function readCache7() {
|
|
|
207824
207888
|
}
|
|
207825
207889
|
function writeCache7(t2) {
|
|
207826
207890
|
try {
|
|
207827
|
-
|
|
207828
|
-
|
|
207891
|
+
fs60.mkdirSync(path67.dirname(cacheFilePath()), { recursive: true });
|
|
207892
|
+
fs60.writeFileSync(cacheFilePath(), JSON.stringify(t2));
|
|
207829
207893
|
} catch {
|
|
207830
207894
|
}
|
|
207831
207895
|
}
|
|
@@ -208204,16 +208268,16 @@ function changedSubject(total, changed, noun) {
|
|
|
208204
208268
|
|
|
208205
208269
|
// packages/core/dist/commands/spec-in-process.js
|
|
208206
208270
|
init_dist8();
|
|
208207
|
-
import
|
|
208208
|
-
import
|
|
208271
|
+
import fs65 from "node:fs";
|
|
208272
|
+
import path72 from "node:path";
|
|
208209
208273
|
init_git();
|
|
208210
208274
|
import { createHash as createHash20, randomUUID as randomUUID27 } from "node:crypto";
|
|
208211
208275
|
|
|
208212
208276
|
// packages/core/dist/lib/verify-store.js
|
|
208213
208277
|
init_atomic_write();
|
|
208214
208278
|
init_analysis_store();
|
|
208215
|
-
import
|
|
208216
|
-
import
|
|
208279
|
+
import fs61 from "node:fs";
|
|
208280
|
+
import path68 from "node:path";
|
|
208217
208281
|
|
|
208218
208282
|
// packages/core/dist/types/verify-snapshot.js
|
|
208219
208283
|
function driftKey(d3) {
|
|
@@ -208261,23 +208325,23 @@ var LATEST_FILE3 = "LATEST.json";
|
|
|
208261
208325
|
var HISTORY_FILE3 = "history.json";
|
|
208262
208326
|
var DIFF_FILE2 = "diff.json";
|
|
208263
208327
|
function verifierDir(repoPath) {
|
|
208264
|
-
return
|
|
208328
|
+
return path68.join(repoPath, TRUECOURSE_DIR4, VERIFIER_DIR);
|
|
208265
208329
|
}
|
|
208266
208330
|
function runsDir(repoPath) {
|
|
208267
|
-
return
|
|
208331
|
+
return path68.join(verifierDir(repoPath), RUNS_DIR2);
|
|
208268
208332
|
}
|
|
208269
208333
|
function verifyRunPath(repoPath, filename) {
|
|
208270
|
-
return
|
|
208334
|
+
return path68.join(runsDir(repoPath), filename);
|
|
208271
208335
|
}
|
|
208272
208336
|
function verifyLatestPath(repoPath) {
|
|
208273
|
-
return
|
|
208337
|
+
return path68.join(verifierDir(repoPath), LATEST_FILE3);
|
|
208274
208338
|
}
|
|
208275
208339
|
function verifyHistoryPath(repoPath) {
|
|
208276
|
-
return
|
|
208340
|
+
return path68.join(verifierDir(repoPath), HISTORY_FILE3);
|
|
208277
208341
|
}
|
|
208278
208342
|
function verifyDiffPath(repoPath, scope) {
|
|
208279
208343
|
const file = scope ? `diff-${sanitizeScope(scope)}.json` : DIFF_FILE2;
|
|
208280
|
-
return
|
|
208344
|
+
return path68.join(verifierDir(repoPath), file);
|
|
208281
208345
|
}
|
|
208282
208346
|
function sanitizeScope(scope) {
|
|
208283
208347
|
return scope.replace(/[^a-zA-Z0-9._-]/g, "_");
|
|
@@ -208311,7 +208375,7 @@ var FileVerifyStore = class {
|
|
|
208311
208375
|
const file = verifyLatestPath(repoPath);
|
|
208312
208376
|
let mtime;
|
|
208313
208377
|
try {
|
|
208314
|
-
mtime =
|
|
208378
|
+
mtime = fs61.statSync(file).mtimeMs;
|
|
208315
208379
|
} catch (err) {
|
|
208316
208380
|
if (err.code === "ENOENT") {
|
|
208317
208381
|
latestCache2.delete(repoPath);
|
|
@@ -208322,7 +208386,7 @@ var FileVerifyStore = class {
|
|
|
208322
208386
|
const cached = latestCache2.get(repoPath);
|
|
208323
208387
|
if (cached && cached.mtime === mtime)
|
|
208324
208388
|
return cached.data;
|
|
208325
|
-
const data = JSON.parse(
|
|
208389
|
+
const data = JSON.parse(fs61.readFileSync(file, "utf-8"));
|
|
208326
208390
|
latestCache2.set(repoPath, { mtime, data });
|
|
208327
208391
|
return data;
|
|
208328
208392
|
}
|
|
@@ -208332,7 +208396,7 @@ var FileVerifyStore = class {
|
|
|
208332
208396
|
}
|
|
208333
208397
|
async deleteVerifyLatest(repoPath) {
|
|
208334
208398
|
try {
|
|
208335
|
-
|
|
208399
|
+
fs61.unlinkSync(verifyLatestPath(repoPath));
|
|
208336
208400
|
} catch (err) {
|
|
208337
208401
|
if (err.code !== "ENOENT")
|
|
208338
208402
|
throw err;
|
|
@@ -208346,21 +208410,21 @@ var FileVerifyStore = class {
|
|
|
208346
208410
|
}
|
|
208347
208411
|
async readVerifyRun(repoPath, filename) {
|
|
208348
208412
|
const file = verifyRunPath(repoPath, filename);
|
|
208349
|
-
if (!
|
|
208413
|
+
if (!fs61.existsSync(file))
|
|
208350
208414
|
return null;
|
|
208351
|
-
return JSON.parse(
|
|
208415
|
+
return JSON.parse(fs61.readFileSync(file, "utf-8"));
|
|
208352
208416
|
}
|
|
208353
208417
|
async listVerifyRuns(repoPath) {
|
|
208354
208418
|
const dir = runsDir(repoPath);
|
|
208355
|
-
if (!
|
|
208419
|
+
if (!fs61.existsSync(dir))
|
|
208356
208420
|
return [];
|
|
208357
|
-
return
|
|
208421
|
+
return fs61.readdirSync(dir).filter((n) => n.endsWith(".json")).sort();
|
|
208358
208422
|
}
|
|
208359
208423
|
async readVerifyHistory(repoPath) {
|
|
208360
208424
|
const file = verifyHistoryPath(repoPath);
|
|
208361
|
-
if (!
|
|
208425
|
+
if (!fs61.existsSync(file))
|
|
208362
208426
|
return { runs: [] };
|
|
208363
|
-
return JSON.parse(
|
|
208427
|
+
return JSON.parse(fs61.readFileSync(file, "utf-8"));
|
|
208364
208428
|
}
|
|
208365
208429
|
async appendVerifyHistory(repoPath, entry) {
|
|
208366
208430
|
const history = await this.readVerifyHistory(repoPath);
|
|
@@ -208373,7 +208437,7 @@ var FileVerifyStore = class {
|
|
|
208373
208437
|
if (!entry)
|
|
208374
208438
|
return false;
|
|
208375
208439
|
try {
|
|
208376
|
-
|
|
208440
|
+
fs61.unlinkSync(verifyRunPath(repoPath, entry.filename));
|
|
208377
208441
|
} catch (err) {
|
|
208378
208442
|
if (err.code !== "ENOENT")
|
|
208379
208443
|
throw err;
|
|
@@ -208395,16 +208459,16 @@ var FileVerifyStore = class {
|
|
|
208395
208459
|
}
|
|
208396
208460
|
async readVerifyDiff(repoPath, scope) {
|
|
208397
208461
|
const file = verifyDiffPath(repoPath, scope);
|
|
208398
|
-
if (!
|
|
208462
|
+
if (!fs61.existsSync(file))
|
|
208399
208463
|
return null;
|
|
208400
|
-
return JSON.parse(
|
|
208464
|
+
return JSON.parse(fs61.readFileSync(file, "utf-8"));
|
|
208401
208465
|
}
|
|
208402
208466
|
async writeVerifyDiff(repoPath, diff, scope) {
|
|
208403
208467
|
atomicWriteJson(verifyDiffPath(repoPath, scope), diff);
|
|
208404
208468
|
}
|
|
208405
208469
|
async deleteVerifyDiff(repoPath, scope) {
|
|
208406
208470
|
try {
|
|
208407
|
-
|
|
208471
|
+
fs61.unlinkSync(verifyDiffPath(repoPath, scope));
|
|
208408
208472
|
} catch (err) {
|
|
208409
208473
|
if (err.code !== "ENOENT")
|
|
208410
208474
|
throw err;
|
|
@@ -208438,8 +208502,8 @@ async function repoRef(repoRoot5, commitOverride) {
|
|
|
208438
208502
|
}
|
|
208439
208503
|
|
|
208440
208504
|
// packages/core/dist/lib/contract-store.js
|
|
208441
|
-
import
|
|
208442
|
-
import
|
|
208505
|
+
import fs62 from "node:fs";
|
|
208506
|
+
import path69 from "node:path";
|
|
208443
208507
|
var KIND_REL = {
|
|
208444
208508
|
contracts: [".truecourse", "contracts"],
|
|
208445
208509
|
// The inferred tree lives at contracts/_inferred (matches `writeInferred`).
|
|
@@ -208449,13 +208513,13 @@ function countTcFiles(dir) {
|
|
|
208449
208513
|
let n = 0;
|
|
208450
208514
|
let entries;
|
|
208451
208515
|
try {
|
|
208452
|
-
entries =
|
|
208516
|
+
entries = fs62.readdirSync(dir, { withFileTypes: true });
|
|
208453
208517
|
} catch {
|
|
208454
208518
|
return 0;
|
|
208455
208519
|
}
|
|
208456
208520
|
for (const e of entries) {
|
|
208457
208521
|
if (e.isDirectory())
|
|
208458
|
-
n += countTcFiles(
|
|
208522
|
+
n += countTcFiles(path69.join(dir, e.name));
|
|
208459
208523
|
else if (e.isFile() && e.name.endsWith(".tc"))
|
|
208460
208524
|
n += 1;
|
|
208461
208525
|
}
|
|
@@ -208466,7 +208530,7 @@ function walkTcRel(dir, excludeInferred) {
|
|
|
208466
208530
|
const walk20 = (rel) => {
|
|
208467
208531
|
let entries;
|
|
208468
208532
|
try {
|
|
208469
|
-
entries =
|
|
208533
|
+
entries = fs62.readdirSync(path69.join(dir, rel), { withFileTypes: true });
|
|
208470
208534
|
} catch {
|
|
208471
208535
|
return;
|
|
208472
208536
|
}
|
|
@@ -208490,50 +208554,50 @@ function safeResolve(root2, rel) {
|
|
|
208490
208554
|
return null;
|
|
208491
208555
|
if (norm.split("/").some((s) => s === ".." || s === "." || s === ""))
|
|
208492
208556
|
return null;
|
|
208493
|
-
const base2 =
|
|
208494
|
-
const dest =
|
|
208495
|
-
if (dest !== base2 && !dest.startsWith(base2 +
|
|
208557
|
+
const base2 = path69.resolve(root2);
|
|
208558
|
+
const dest = path69.resolve(base2, norm);
|
|
208559
|
+
if (dest !== base2 && !dest.startsWith(base2 + path69.sep))
|
|
208496
208560
|
return null;
|
|
208497
208561
|
return dest;
|
|
208498
208562
|
}
|
|
208499
208563
|
var FileContractStore = class {
|
|
208500
208564
|
materializesInPlace = true;
|
|
208501
208565
|
async saveContracts(ref, kind, _sourceDir) {
|
|
208502
|
-
const dir =
|
|
208566
|
+
const dir = path69.join(ref.repoKey, ...KIND_REL[kind]);
|
|
208503
208567
|
return { manifest: {}, fileCount: countTcFiles(dir), objectsWritten: 0, manifestHash: "" };
|
|
208504
208568
|
}
|
|
208505
208569
|
async loadContracts(ref, kind) {
|
|
208506
|
-
const dir =
|
|
208507
|
-
if (!
|
|
208570
|
+
const dir = path69.join(ref.repoKey, ...KIND_REL[kind]);
|
|
208571
|
+
if (!fs62.existsSync(dir))
|
|
208508
208572
|
return null;
|
|
208509
208573
|
return { dir, cleanup: async () => {
|
|
208510
208574
|
} };
|
|
208511
208575
|
}
|
|
208512
208576
|
async hasContracts(ref, kind) {
|
|
208513
|
-
return
|
|
208577
|
+
return fs62.existsSync(path69.join(ref.repoKey, ...KIND_REL[kind]));
|
|
208514
208578
|
}
|
|
208515
208579
|
// The file impl reads the live repo tree, which is whatever is checked out —
|
|
208516
208580
|
// there is no per-commit history, so `commitSha` is ignored (OSS is latest).
|
|
208517
208581
|
async listContractFiles(repoKey, kind, _commitSha) {
|
|
208518
|
-
return walkTcRel(
|
|
208582
|
+
return walkTcRel(path69.join(repoKey, ...KIND_REL[kind]), kind === "contracts");
|
|
208519
208583
|
}
|
|
208520
208584
|
async readContractFile(repoKey, kind, relPath, _commitSha) {
|
|
208521
|
-
const dest = safeResolve(
|
|
208522
|
-
if (!dest || !
|
|
208585
|
+
const dest = safeResolve(path69.join(repoKey, ...KIND_REL[kind]), relPath);
|
|
208586
|
+
if (!dest || !fs62.existsSync(dest) || !fs62.statSync(dest).isFile())
|
|
208523
208587
|
return null;
|
|
208524
|
-
return
|
|
208588
|
+
return fs62.readFileSync(dest, "utf-8");
|
|
208525
208589
|
}
|
|
208526
208590
|
async putContractFile(ref, kind, relPath, content) {
|
|
208527
|
-
const dest = safeResolve(
|
|
208591
|
+
const dest = safeResolve(path69.join(ref.repoKey, ...KIND_REL[kind]), relPath);
|
|
208528
208592
|
if (!dest)
|
|
208529
208593
|
throw new Error(`[contract-store] unsafe contract path: ${relPath}`);
|
|
208530
|
-
|
|
208531
|
-
|
|
208594
|
+
fs62.mkdirSync(path69.dirname(dest), { recursive: true });
|
|
208595
|
+
fs62.writeFileSync(dest, content);
|
|
208532
208596
|
}
|
|
208533
208597
|
async deleteContractFile(ref, kind, relPath) {
|
|
208534
|
-
const dest = safeResolve(
|
|
208598
|
+
const dest = safeResolve(path69.join(ref.repoKey, ...KIND_REL[kind]), relPath);
|
|
208535
208599
|
if (dest)
|
|
208536
|
-
|
|
208600
|
+
fs62.rmSync(dest, { force: true });
|
|
208537
208601
|
}
|
|
208538
208602
|
// OSS/local has no workspace concept (mirrors the spec store). Writing throws
|
|
208539
208603
|
// (fail loud — a caller that reached here is mis-wired); reads are empty so an
|
|
@@ -208560,10 +208624,10 @@ var loadWorkspaceContracts = (ref, kind) => active8.loadWorkspaceContracts(ref,
|
|
|
208560
208624
|
var contractsMaterializeInPlace = () => active8.materializesInPlace;
|
|
208561
208625
|
|
|
208562
208626
|
// packages/core/dist/lib/spec-store.js
|
|
208563
|
-
import
|
|
208564
|
-
import
|
|
208627
|
+
import fs63 from "node:fs";
|
|
208628
|
+
import path70 from "node:path";
|
|
208565
208629
|
function specPath(repoKey, artifact) {
|
|
208566
|
-
return
|
|
208630
|
+
return path70.join(repoKey, ".truecourse", "specs", `${artifact}.json`);
|
|
208567
208631
|
}
|
|
208568
208632
|
function isPrDecisionsRef(commitSha) {
|
|
208569
208633
|
return /^_pr\/\d+$/.test(commitSha ?? "");
|
|
@@ -208576,18 +208640,18 @@ var FileSpecStore = class {
|
|
|
208576
208640
|
throw new Error(PR_DECISIONS_FILE_ERROR);
|
|
208577
208641
|
}
|
|
208578
208642
|
const file = specPath(ref.repoKey, artifact);
|
|
208579
|
-
|
|
208580
|
-
|
|
208643
|
+
fs63.mkdirSync(path70.dirname(file), { recursive: true });
|
|
208644
|
+
fs63.writeFileSync(file, JSON.stringify(json2, null, 2) + "\n", "utf-8");
|
|
208581
208645
|
}
|
|
208582
208646
|
async loadSpec(ref, artifact) {
|
|
208583
208647
|
if (artifact === "decisions" && isPrDecisionsRef(ref.commitSha)) {
|
|
208584
208648
|
throw new Error(PR_DECISIONS_FILE_ERROR);
|
|
208585
208649
|
}
|
|
208586
208650
|
const file = specPath(ref.repoKey, artifact);
|
|
208587
|
-
if (!
|
|
208651
|
+
if (!fs63.existsSync(file))
|
|
208588
208652
|
return null;
|
|
208589
208653
|
try {
|
|
208590
|
-
return JSON.parse(
|
|
208654
|
+
return JSON.parse(fs63.readFileSync(file, "utf-8"));
|
|
208591
208655
|
} catch {
|
|
208592
208656
|
return null;
|
|
208593
208657
|
}
|
|
@@ -208597,8 +208661,8 @@ var FileSpecStore = class {
|
|
|
208597
208661
|
throw new Error(PR_DECISIONS_FILE_ERROR);
|
|
208598
208662
|
}
|
|
208599
208663
|
const file = specPath(ref.repoKey, artifact);
|
|
208600
|
-
if (
|
|
208601
|
-
|
|
208664
|
+
if (fs63.existsSync(file))
|
|
208665
|
+
fs63.rmSync(file);
|
|
208602
208666
|
}
|
|
208603
208667
|
// The file impl is single-document-per-repo, so "latest" === read the file.
|
|
208604
208668
|
async loadLatest(repoKey, artifact) {
|
|
@@ -208625,23 +208689,23 @@ var loadLatestSpec = (repoKey, artifact) => active9.loadLatest(repoKey, artifact
|
|
|
208625
208689
|
var specsMaterializeInPlace = () => active9.materializesInPlace;
|
|
208626
208690
|
|
|
208627
208691
|
// packages/core/dist/lib/inferred-action-store.js
|
|
208628
|
-
import
|
|
208629
|
-
import
|
|
208692
|
+
import fs64 from "node:fs";
|
|
208693
|
+
import path71 from "node:path";
|
|
208630
208694
|
function actionsFile(repoKey) {
|
|
208631
|
-
return
|
|
208695
|
+
return path71.join(repoKey, ".truecourse", "specs", "inferred-actions.json");
|
|
208632
208696
|
}
|
|
208633
208697
|
var FileInferredActionStore = class {
|
|
208634
208698
|
read(repoKey) {
|
|
208635
208699
|
try {
|
|
208636
|
-
return JSON.parse(
|
|
208700
|
+
return JSON.parse(fs64.readFileSync(actionsFile(repoKey), "utf-8"));
|
|
208637
208701
|
} catch {
|
|
208638
208702
|
return [];
|
|
208639
208703
|
}
|
|
208640
208704
|
}
|
|
208641
208705
|
write(repoKey, actions) {
|
|
208642
208706
|
const file = actionsFile(repoKey);
|
|
208643
|
-
|
|
208644
|
-
|
|
208707
|
+
fs64.mkdirSync(path71.dirname(file), { recursive: true });
|
|
208708
|
+
fs64.writeFileSync(file, JSON.stringify(actions, null, 2) + "\n", "utf-8");
|
|
208645
208709
|
}
|
|
208646
208710
|
async setAction(repoKey, action) {
|
|
208647
208711
|
const next = this.read(repoKey).filter((a) => !(a.kind === action.kind && a.identity === action.identity));
|
|
@@ -208770,13 +208834,13 @@ function resolveTransport(options) {
|
|
|
208770
208834
|
}
|
|
208771
208835
|
return getDefaultTransport();
|
|
208772
208836
|
}
|
|
208773
|
-
var GENERATED_MARKER_REL =
|
|
208837
|
+
var GENERATED_MARKER_REL = path72.join(".truecourse", "contracts", "result.json");
|
|
208774
208838
|
function generatedMarkerPath(repoRoot5) {
|
|
208775
|
-
return
|
|
208839
|
+
return path72.join(repoRoot5, GENERATED_MARKER_REL);
|
|
208776
208840
|
}
|
|
208777
208841
|
function stampGeneratedMarker(repoRoot5, summary) {
|
|
208778
208842
|
const file = generatedMarkerPath(repoRoot5);
|
|
208779
|
-
|
|
208843
|
+
fs65.mkdirSync(path72.dirname(file), { recursive: true });
|
|
208780
208844
|
const body = {
|
|
208781
208845
|
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
208782
208846
|
written: summary?.written ?? 0,
|
|
@@ -208784,7 +208848,7 @@ function stampGeneratedMarker(repoRoot5, summary) {
|
|
|
208784
208848
|
validationIssues: summary?.validationIssues ?? [],
|
|
208785
208849
|
enumerateFailures: summary?.enumerateFailures ?? []
|
|
208786
208850
|
};
|
|
208787
|
-
|
|
208851
|
+
fs65.writeFileSync(file, JSON.stringify(body, null, 2) + "\n");
|
|
208788
208852
|
}
|
|
208789
208853
|
function resolveCurateModels(repoRoot5) {
|
|
208790
208854
|
return {
|
|
@@ -208908,22 +208972,22 @@ async function curateInProcess(repoRoot5, options = {}) {
|
|
|
208908
208972
|
}
|
|
208909
208973
|
}
|
|
208910
208974
|
function buildPriorContracts(repoRoot5) {
|
|
208911
|
-
const dir =
|
|
208912
|
-
if (!
|
|
208975
|
+
const dir = path72.join(repoRoot5, ".truecourse", "contracts");
|
|
208976
|
+
if (!fs65.existsSync(dir))
|
|
208913
208977
|
return void 0;
|
|
208914
208978
|
const targets = [];
|
|
208915
208979
|
const bodyByKey = /* @__PURE__ */ new Map();
|
|
208916
208980
|
const walk20 = (d3) => {
|
|
208917
|
-
for (const e of
|
|
208981
|
+
for (const e of fs65.readdirSync(d3, { withFileTypes: true })) {
|
|
208918
208982
|
if (e.isDirectory()) {
|
|
208919
208983
|
if (e.name === "_inferred")
|
|
208920
208984
|
continue;
|
|
208921
|
-
walk20(
|
|
208985
|
+
walk20(path72.join(d3, e.name));
|
|
208922
208986
|
} else if (e.name.endsWith(".tc")) {
|
|
208923
|
-
const abs =
|
|
208924
|
-
const src =
|
|
208987
|
+
const abs = path72.join(d3, e.name);
|
|
208988
|
+
const src = fs65.readFileSync(abs, "utf-8");
|
|
208925
208989
|
try {
|
|
208926
|
-
const file = parser_ohm_exports.parseTcFile(
|
|
208990
|
+
const file = parser_ohm_exports.parseTcFile(path72.relative(dir, abs), src);
|
|
208927
208991
|
for (const key4 of resolver_exports.resolve([file]).index.keys()) {
|
|
208928
208992
|
const colon = key4.indexOf(":");
|
|
208929
208993
|
if (colon < 0)
|
|
@@ -209083,18 +209147,18 @@ function resolverHardError(result) {
|
|
|
209083
209147
|
const detail = reasons.length ? reasons.slice(0, 3).join("; ") : "duplicate or conflicting artifact identities";
|
|
209084
209148
|
return new Error(`Contract corpus failed to resolve \u2014 ${detail}`);
|
|
209085
209149
|
}
|
|
209086
|
-
var LEGACY_VERIFY_STATE_REL =
|
|
209150
|
+
var LEGACY_VERIFY_STATE_REL = path72.join(".truecourse", ".cache", "verifier", "verify-state.json");
|
|
209087
209151
|
function legacyVerifyStatePath(repoRoot5) {
|
|
209088
|
-
return
|
|
209152
|
+
return path72.join(repoRoot5, LEGACY_VERIFY_STATE_REL);
|
|
209089
209153
|
}
|
|
209090
209154
|
async function withContracts(repoRoot5, options, tracker, fn) {
|
|
209091
|
-
const fallbackPath =
|
|
209155
|
+
const fallbackPath = path72.join(repoRoot5, ".truecourse", "contracts");
|
|
209092
209156
|
const wsMat = options.workspaceOrgId ? await loadWorkspaceContracts({ workspaceOrgId: options.workspaceOrgId }, "contracts") : null;
|
|
209093
209157
|
let repoMat = null;
|
|
209094
209158
|
try {
|
|
209095
209159
|
let recorded;
|
|
209096
209160
|
if (options.contractsDir) {
|
|
209097
|
-
if (!
|
|
209161
|
+
if (!fs65.existsSync(options.contractsDir)) {
|
|
209098
209162
|
const err = new Error(`Contracts directory not found at ${options.contractsDir}. Run \`truecourse contracts generate\` first.`);
|
|
209099
209163
|
tracker?.error("load", err.message);
|
|
209100
209164
|
throw err;
|
|
@@ -209139,7 +209203,7 @@ async function verifyInProcess(repoRoot5, options = {}) {
|
|
|
209139
209203
|
tracker?.start("compare");
|
|
209140
209204
|
tracker?.done("compare", `${result.drifts.length} drift${result.drifts.length === 1 ? "" : "s"}`);
|
|
209141
209205
|
if (options.ref) {
|
|
209142
|
-
result.drifts = result.drifts.map((d3) => d3.filePath &&
|
|
209206
|
+
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
209207
|
}
|
|
209144
209208
|
const verifiedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
209145
209209
|
const { branch, commitHash } = await gitMeta(repoRoot5);
|
|
@@ -209183,7 +209247,7 @@ async function verifyInProcess(repoRoot5, options = {}) {
|
|
|
209183
209247
|
bySeverity: summary.bySeverity
|
|
209184
209248
|
});
|
|
209185
209249
|
await deleteVerifyDiff(storeKey);
|
|
209186
|
-
|
|
209250
|
+
fs65.rmSync(legacyVerifyStatePath(repoRoot5), { force: true });
|
|
209187
209251
|
}
|
|
209188
209252
|
const state = {
|
|
209189
209253
|
verifiedAt,
|
|
@@ -209231,7 +209295,7 @@ async function runWithStash(repoRoot5, skipStash, tracker, fn) {
|
|
|
209231
209295
|
const status = await stashGit.status();
|
|
209232
209296
|
if (!status.isClean()) {
|
|
209233
209297
|
const gitRoot = (await stashGit.revparse(["--show-toplevel"])).trim();
|
|
209234
|
-
if (
|
|
209298
|
+
if (path72.resolve(repoRoot5) === path72.resolve(gitRoot)) {
|
|
209235
209299
|
tracker?.detail?.("load", "Stashing pending changes...");
|
|
209236
209300
|
const res = await stashGit.stash(["push", "--include-untracked", "-m", "truecourse-verify-stash"]);
|
|
209237
209301
|
didStash = !res.includes("No local changes");
|
|
@@ -209333,7 +209397,7 @@ async function verifyDiffInProcess(repoRoot5, options = {}) {
|
|
|
209333
209397
|
async function inferInProcess(repoRoot5, options = {}) {
|
|
209334
209398
|
const startedAt = Date.now();
|
|
209335
209399
|
const codeDir = options.codeDir ?? autodetectCodeDir(repoRoot5);
|
|
209336
|
-
let contractsDir = options.contractsDir ??
|
|
209400
|
+
let contractsDir = options.contractsDir ?? path72.join(repoRoot5, ".truecourse", "contracts");
|
|
209337
209401
|
let releaseContracts = async () => {
|
|
209338
209402
|
};
|
|
209339
209403
|
if (!options.contractsDir && options.ref) {
|
|
@@ -209377,7 +209441,7 @@ async function persistInferred(repoRoot5, options, contractsDir, codeDir, starte
|
|
|
209377
209441
|
});
|
|
209378
209442
|
}
|
|
209379
209443
|
if (!options.dryRun && options.ref) {
|
|
209380
|
-
await saveContracts(options.ref, "contracts_inferred",
|
|
209444
|
+
await saveContracts(options.ref, "contracts_inferred", path72.join(contractsDir, "_inferred"));
|
|
209381
209445
|
}
|
|
209382
209446
|
const rendered = result.decisions.map((d3) => renderDecision(d3));
|
|
209383
209447
|
const decisionPaths = rendered.map((r) => r.relPath);
|
|
@@ -209400,8 +209464,8 @@ async function persistInferred(repoRoot5, options, contractsDir, codeDir, starte
|
|
|
209400
209464
|
return { infer: result, written, proposed, decisionPaths, summaries };
|
|
209401
209465
|
}
|
|
209402
209466
|
function autodetectCodeDir(repoRoot5) {
|
|
209403
|
-
const codeSubdir =
|
|
209404
|
-
if (
|
|
209467
|
+
const codeSubdir = path72.join(repoRoot5, "code");
|
|
209468
|
+
if (fs65.existsSync(codeSubdir) && fs65.statSync(codeSubdir).isDirectory()) {
|
|
209405
209469
|
return codeSubdir;
|
|
209406
209470
|
}
|
|
209407
209471
|
return repoRoot5;
|
|
@@ -209721,8 +209785,8 @@ async function runContractsGenerate(options = {}) {
|
|
|
209721
209785
|
}
|
|
209722
209786
|
async function runContractsList(options = {}) {
|
|
209723
209787
|
const repoRoot5 = options.cwd ?? process.cwd();
|
|
209724
|
-
const contractsDir =
|
|
209725
|
-
if (!
|
|
209788
|
+
const contractsDir = path73.join(repoRoot5, ".truecourse", "contracts");
|
|
209789
|
+
if (!fs66.existsSync(contractsDir)) {
|
|
209726
209790
|
O2.info("No contracts found. Run `truecourse contracts generate` first.");
|
|
209727
209791
|
return;
|
|
209728
209792
|
}
|
|
@@ -209730,12 +209794,12 @@ async function runContractsList(options = {}) {
|
|
|
209730
209794
|
const fileNodes = [];
|
|
209731
209795
|
let parseErrors = 0;
|
|
209732
209796
|
const visit = (dir) => {
|
|
209733
|
-
for (const entry of
|
|
209734
|
-
const full =
|
|
209797
|
+
for (const entry of fs66.readdirSync(dir, { withFileTypes: true })) {
|
|
209798
|
+
const full = path73.join(dir, entry.name);
|
|
209735
209799
|
if (entry.isDirectory()) visit(full);
|
|
209736
209800
|
else if (entry.isFile() && entry.name.endsWith(".tc")) {
|
|
209737
209801
|
try {
|
|
209738
|
-
fileNodes.push(parserOhm.parseTcFile(full,
|
|
209802
|
+
fileNodes.push(parserOhm.parseTcFile(full, fs66.readFileSync(full, "utf-8")));
|
|
209739
209803
|
} catch {
|
|
209740
209804
|
parseErrors += 1;
|
|
209741
209805
|
}
|
|
@@ -209762,7 +209826,7 @@ async function runContractsList(options = {}) {
|
|
|
209762
209826
|
mt(`Contracts \u2014 ${artifacts.length} ${scope}artifact${artifacts.length === 1 ? "" : "s"}`);
|
|
209763
209827
|
for (const a of artifacts) {
|
|
209764
209828
|
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 : `${
|
|
209829
|
+
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
209830
|
console.log(` ${conf}${a.ref.type}:${a.ref.identity} ${loc}`);
|
|
209767
209831
|
}
|
|
209768
209832
|
if (parseErrors > 0) {
|
|
@@ -209774,8 +209838,8 @@ async function runContractsList(options = {}) {
|
|
|
209774
209838
|
}
|
|
209775
209839
|
async function runContractsValidate(options = {}) {
|
|
209776
209840
|
const repoRoot5 = options.cwd ?? process.cwd();
|
|
209777
|
-
const contractsDir =
|
|
209778
|
-
if (!
|
|
209841
|
+
const contractsDir = path73.join(repoRoot5, ".truecourse", "contracts");
|
|
209842
|
+
if (!fs66.existsSync(contractsDir)) {
|
|
209779
209843
|
O2.error("No .truecourse/contracts/ directory found.");
|
|
209780
209844
|
process.exit(1);
|
|
209781
209845
|
}
|
|
@@ -209783,14 +209847,14 @@ async function runContractsValidate(options = {}) {
|
|
|
209783
209847
|
const fileNodes = [];
|
|
209784
209848
|
const issues = [];
|
|
209785
209849
|
const visit = (dir) => {
|
|
209786
|
-
for (const entry of
|
|
209787
|
-
const full =
|
|
209850
|
+
for (const entry of fs66.readdirSync(dir, { withFileTypes: true })) {
|
|
209851
|
+
const full = path73.join(dir, entry.name);
|
|
209788
209852
|
if (entry.isDirectory()) visit(full);
|
|
209789
209853
|
else if (entry.isFile() && entry.name.endsWith(".tc")) {
|
|
209790
209854
|
try {
|
|
209791
|
-
fileNodes.push(parserOhm.parseTcFile(full,
|
|
209855
|
+
fileNodes.push(parserOhm.parseTcFile(full, fs66.readFileSync(full, "utf-8")));
|
|
209792
209856
|
} catch (e) {
|
|
209793
|
-
issues.push(`${
|
|
209857
|
+
issues.push(`${path73.relative(repoRoot5, full)}: parse error: ${e instanceof Error ? e.message : e}`);
|
|
209794
209858
|
}
|
|
209795
209859
|
}
|
|
209796
209860
|
}
|
|
@@ -209798,11 +209862,11 @@ async function runContractsValidate(options = {}) {
|
|
|
209798
209862
|
visit(contractsDir);
|
|
209799
209863
|
const resolution = resolver.resolve(fileNodes);
|
|
209800
209864
|
for (const err of resolution.errors) {
|
|
209801
|
-
issues.push(`${
|
|
209865
|
+
issues.push(`${path73.relative(repoRoot5, err.filePath)}:${err.line} ${err.message}`);
|
|
209802
209866
|
}
|
|
209803
209867
|
const trulyUnresolved = resolution.unresolvedRefs.filter((u2) => u2.ref.type !== "Unknown");
|
|
209804
209868
|
for (const u2 of trulyUnresolved) {
|
|
209805
|
-
issues.push(`${
|
|
209869
|
+
issues.push(`${path73.relative(repoRoot5, u2.usedAt.filePath)}:${u2.usedAt.lineStart} unresolved ${u2.ref.type}:${u2.ref.identity}`);
|
|
209806
209870
|
}
|
|
209807
209871
|
if (issues.length === 0) {
|
|
209808
209872
|
O2.success(`Validated ${resolution.index.size} artifact${resolution.index.size === 1 ? "" : "s"} \u2014 no issues.`);
|
|
@@ -209816,7 +209880,7 @@ async function runContractsValidate(options = {}) {
|
|
|
209816
209880
|
|
|
209817
209881
|
// tools/cli/src/commands/spec.ts
|
|
209818
209882
|
init_dist4();
|
|
209819
|
-
import
|
|
209883
|
+
import path74 from "node:path";
|
|
209820
209884
|
init_progress();
|
|
209821
209885
|
init_registry();
|
|
209822
209886
|
var repoRoot = (opts = {}) => opts.cwd ?? process.cwd();
|
|
@@ -209942,7 +210006,7 @@ async function runVerify(opts = {}) {
|
|
|
209942
210006
|
O2.message("");
|
|
209943
210007
|
O2.message("Drifts:");
|
|
209944
210008
|
for (const d3 of verify2.drifts.slice(0, 20)) {
|
|
209945
|
-
const loc = d3.filePath ? ` ${
|
|
210009
|
+
const loc = d3.filePath ? ` ${path74.relative(root2, d3.filePath)}:${d3.lineStart ?? "?"}` : "";
|
|
209946
210010
|
O2.message(` [${d3.severity}] ${d3.obligationKey}${loc}`);
|
|
209947
210011
|
O2.message(` \u2192 ${d3.message}`);
|
|
209948
210012
|
}
|
|
@@ -209976,7 +210040,7 @@ async function runVerifyDiff(opts) {
|
|
|
209976
210040
|
O2.message("");
|
|
209977
210041
|
O2.message(`${label}:`);
|
|
209978
210042
|
for (const d3 of drifts.slice(0, 20)) {
|
|
209979
|
-
const loc = d3.filePath ? ` ${
|
|
210043
|
+
const loc = d3.filePath ? ` ${path74.relative(root2, d3.filePath)}:${d3.lineStart ?? "?"}` : "";
|
|
209980
210044
|
O2.message(` [${d3.severity}] ${d3.obligationKey}${loc}`);
|
|
209981
210045
|
}
|
|
209982
210046
|
if (drifts.length > 20) O2.message(` \u2026 (+${drifts.length - 20} more)`);
|
|
@@ -210031,8 +210095,8 @@ async function runInfer(opts = {}) {
|
|
|
210031
210095
|
|
|
210032
210096
|
// tools/cli/src/commands/spec-conflicts.ts
|
|
210033
210097
|
init_dist4();
|
|
210034
|
-
import
|
|
210035
|
-
import
|
|
210098
|
+
import fs67 from "node:fs";
|
|
210099
|
+
import path75 from "node:path";
|
|
210036
210100
|
var root = (opts) => opts.cwd ?? process.cwd();
|
|
210037
210101
|
var base = (ref) => ref.split("/").pop() ?? ref;
|
|
210038
210102
|
function effectiveRelations2(corpus, repoRoot5) {
|
|
@@ -210079,7 +210143,7 @@ async function runSpecConflictsList(opts = {}) {
|
|
|
210079
210143
|
function excerpt(repoRoot5, ref, note, max = 20) {
|
|
210080
210144
|
let text4;
|
|
210081
210145
|
try {
|
|
210082
|
-
text4 =
|
|
210146
|
+
text4 = fs67.readFileSync(path75.join(repoRoot5, ref), "utf-8");
|
|
210083
210147
|
} catch {
|
|
210084
210148
|
return ` (could not read ${ref})`;
|
|
210085
210149
|
}
|
|
@@ -210304,7 +210368,7 @@ function fail3(msg) {
|
|
|
210304
210368
|
|
|
210305
210369
|
// tools/cli/src/commands/drifts.ts
|
|
210306
210370
|
init_dist4();
|
|
210307
|
-
import
|
|
210371
|
+
import path76 from "node:path";
|
|
210308
210372
|
var DRIFT_SEVERITIES = [
|
|
210309
210373
|
"critical",
|
|
210310
210374
|
"high",
|
|
@@ -210341,7 +210405,7 @@ async function runDriftsList(opts = {}) {
|
|
|
210341
210405
|
O2.message("");
|
|
210342
210406
|
O2.message("Drifts:");
|
|
210343
210407
|
for (const d3 of page) {
|
|
210344
|
-
const loc = d3.filePath ? ` ${
|
|
210408
|
+
const loc = d3.filePath ? ` ${path76.relative(root2, d3.filePath)}:${d3.lineStart ?? "?"}` : "";
|
|
210345
210409
|
O2.message(` [${d3.severity}] ${d3.obligationKey}${loc}`);
|
|
210346
210410
|
O2.message(` \u2192 ${d3.message}`);
|
|
210347
210411
|
}
|
|
@@ -210372,7 +210436,7 @@ function parseDriftSeverityFlag(raw) {
|
|
|
210372
210436
|
|
|
210373
210437
|
// tools/cli/src/commands/guard.ts
|
|
210374
210438
|
init_dist4();
|
|
210375
|
-
import
|
|
210439
|
+
import path77 from "node:path";
|
|
210376
210440
|
init_progress();
|
|
210377
210441
|
|
|
210378
210442
|
// packages/core/dist/commands/guard-in-process.js
|
|
@@ -210772,7 +210836,7 @@ async function runGuardGenerate(opts = {}) {
|
|
|
210772
210836
|
return;
|
|
210773
210837
|
}
|
|
210774
210838
|
const report4 = readGuardResult(repoRoot5) ?? { ...guard, generatedAt: (/* @__PURE__ */ new Date()).toISOString() };
|
|
210775
|
-
printGuardGenerateSummary(report4,
|
|
210839
|
+
printGuardGenerateSummary(report4, path77.relative(repoRoot5, guardResultPath(repoRoot5)));
|
|
210776
210840
|
if (guard.written.length === 0 && guard.birthFindings.length === 0 && guard.errors.length === 0) {
|
|
210777
210841
|
gt("No scenarios written.");
|
|
210778
210842
|
return;
|
|
@@ -210970,7 +211034,7 @@ function printLoadErrors(loadErrors) {
|
|
|
210970
211034
|
|
|
210971
211035
|
// tools/cli/src/commands/config.ts
|
|
210972
211036
|
init_dist4();
|
|
210973
|
-
import
|
|
211037
|
+
import path78 from "node:path";
|
|
210974
211038
|
var STAGE_LABEL = {
|
|
210975
211039
|
"spec.relevance": "Spec \xB7 doc relevance",
|
|
210976
211040
|
"spec.areaTag": "Spec \xB7 area tag",
|
|
@@ -211001,7 +211065,7 @@ async function runConfigLlmShow(options = {}) {
|
|
|
211001
211065
|
const repoRoot5 = options.cwd ?? process.cwd();
|
|
211002
211066
|
const { stages, fallbackModel } = describeStageResolutions(repoRoot5);
|
|
211003
211067
|
mt("LLM model resolution");
|
|
211004
|
-
O2.info(`repoRoot ${
|
|
211068
|
+
O2.info(`repoRoot ${path78.relative(process.cwd(), repoRoot5) || "."}`);
|
|
211005
211069
|
O2.info(`fallback ${fallbackModel ?? "(not configured)"}`);
|
|
211006
211070
|
for (const stage of stages) {
|
|
211007
211071
|
const label = STAGE_LABEL[stage.stageId];
|
|
@@ -211017,8 +211081,8 @@ async function runConfigLlmShow(options = {}) {
|
|
|
211017
211081
|
|
|
211018
211082
|
// tools/cli/src/commands/hooks.ts
|
|
211019
211083
|
import { execSync as execSync4 } from "node:child_process";
|
|
211020
|
-
import
|
|
211021
|
-
import
|
|
211084
|
+
import fs68 from "node:fs";
|
|
211085
|
+
import path79 from "node:path";
|
|
211022
211086
|
init_dist4();
|
|
211023
211087
|
init_paths();
|
|
211024
211088
|
init_registry();
|
|
@@ -211052,17 +211116,17 @@ pre-commit:
|
|
|
211052
211116
|
function findGitDir(from) {
|
|
211053
211117
|
let dir = from;
|
|
211054
211118
|
while (true) {
|
|
211055
|
-
const gitPath =
|
|
211056
|
-
if (
|
|
211057
|
-
const stat =
|
|
211119
|
+
const gitPath = path79.join(dir, ".git");
|
|
211120
|
+
if (fs68.existsSync(gitPath)) {
|
|
211121
|
+
const stat = fs68.statSync(gitPath);
|
|
211058
211122
|
if (stat.isDirectory()) return gitPath;
|
|
211059
211123
|
if (stat.isFile()) {
|
|
211060
|
-
const content =
|
|
211124
|
+
const content = fs68.readFileSync(gitPath, "utf-8").trim();
|
|
211061
211125
|
const match4 = content.match(/^gitdir:\s*(.+)$/);
|
|
211062
|
-
if (match4) return
|
|
211126
|
+
if (match4) return path79.resolve(dir, match4[1]);
|
|
211063
211127
|
}
|
|
211064
211128
|
}
|
|
211065
|
-
const parent =
|
|
211129
|
+
const parent = path79.dirname(dir);
|
|
211066
211130
|
if (parent === dir) return null;
|
|
211067
211131
|
dir = parent;
|
|
211068
211132
|
}
|
|
@@ -211070,18 +211134,18 @@ function findGitDir(from) {
|
|
|
211070
211134
|
function findProjectRoot(from) {
|
|
211071
211135
|
let dir = from;
|
|
211072
211136
|
while (true) {
|
|
211073
|
-
if (
|
|
211074
|
-
const parent =
|
|
211137
|
+
if (fs68.existsSync(path79.join(dir, ".git"))) return dir;
|
|
211138
|
+
const parent = path79.dirname(dir);
|
|
211075
211139
|
if (parent === dir) return null;
|
|
211076
211140
|
dir = parent;
|
|
211077
211141
|
}
|
|
211078
211142
|
}
|
|
211079
211143
|
function loadConfig(projectRoot) {
|
|
211080
|
-
const configPath =
|
|
211081
|
-
if (!
|
|
211144
|
+
const configPath = path79.join(projectRoot, ".truecourse", "hooks.yaml");
|
|
211145
|
+
if (!fs68.existsSync(configPath)) return null;
|
|
211082
211146
|
let parsed;
|
|
211083
211147
|
try {
|
|
211084
|
-
const raw =
|
|
211148
|
+
const raw = fs68.readFileSync(configPath, "utf-8");
|
|
211085
211149
|
parsed = jsYaml.load(raw) || {};
|
|
211086
211150
|
} catch (err) {
|
|
211087
211151
|
console.error(`Error parsing ${configPath}: ${err.message}`);
|
|
@@ -211132,11 +211196,11 @@ async function runHooksInstall() {
|
|
|
211132
211196
|
} else {
|
|
211133
211197
|
console.log(INSTALL_WARNING);
|
|
211134
211198
|
}
|
|
211135
|
-
const hooksDir =
|
|
211136
|
-
|
|
211137
|
-
const hookPath =
|
|
211138
|
-
if (
|
|
211139
|
-
const existing =
|
|
211199
|
+
const hooksDir = path79.join(gitDir, "hooks");
|
|
211200
|
+
fs68.mkdirSync(hooksDir, { recursive: true });
|
|
211201
|
+
const hookPath = path79.join(hooksDir, "pre-commit");
|
|
211202
|
+
if (fs68.existsSync(hookPath)) {
|
|
211203
|
+
const existing = fs68.readFileSync(hookPath, "utf-8");
|
|
211140
211204
|
if (!existing.includes(HOOK_IDENTIFIER)) {
|
|
211141
211205
|
console.error(
|
|
211142
211206
|
"Error: A pre-commit hook already exists and was not installed by TrueCourse."
|
|
@@ -211146,16 +211210,16 @@ async function runHooksInstall() {
|
|
|
211146
211210
|
process.exit(1);
|
|
211147
211211
|
}
|
|
211148
211212
|
}
|
|
211149
|
-
|
|
211213
|
+
fs68.writeFileSync(hookPath, HOOK_SCRIPT, { mode: 493 });
|
|
211150
211214
|
console.log("TrueCourse pre-commit hook installed.");
|
|
211151
211215
|
console.log(` ${hookPath}`);
|
|
211152
211216
|
const projectRoot = findProjectRoot(process.cwd());
|
|
211153
211217
|
if (projectRoot) {
|
|
211154
|
-
const cfgDir =
|
|
211155
|
-
const cfgPath =
|
|
211156
|
-
if (!
|
|
211157
|
-
|
|
211158
|
-
|
|
211218
|
+
const cfgDir = path79.join(projectRoot, ".truecourse");
|
|
211219
|
+
const cfgPath = path79.join(cfgDir, "hooks.yaml");
|
|
211220
|
+
if (!fs68.existsSync(cfgPath)) {
|
|
211221
|
+
fs68.mkdirSync(cfgDir, { recursive: true });
|
|
211222
|
+
fs68.writeFileSync(cfgPath, HOOKS_YAML_TEMPLATE);
|
|
211159
211223
|
console.log(` ${cfgPath} (starter config \u2014 edit to customize, commit to share with the team)`);
|
|
211160
211224
|
}
|
|
211161
211225
|
}
|
|
@@ -211166,17 +211230,17 @@ function runHooksUninstall() {
|
|
|
211166
211230
|
console.error("Error: Not a git repository.");
|
|
211167
211231
|
process.exit(1);
|
|
211168
211232
|
}
|
|
211169
|
-
const hookPath =
|
|
211170
|
-
if (!
|
|
211233
|
+
const hookPath = path79.join(gitDir, "hooks", "pre-commit");
|
|
211234
|
+
if (!fs68.existsSync(hookPath)) {
|
|
211171
211235
|
console.log("No pre-commit hook installed.");
|
|
211172
211236
|
return;
|
|
211173
211237
|
}
|
|
211174
|
-
const content =
|
|
211238
|
+
const content = fs68.readFileSync(hookPath, "utf-8");
|
|
211175
211239
|
if (!content.includes(HOOK_IDENTIFIER)) {
|
|
211176
211240
|
console.error("Error: The pre-commit hook was not installed by TrueCourse. Leaving it in place.");
|
|
211177
211241
|
process.exit(1);
|
|
211178
211242
|
}
|
|
211179
|
-
|
|
211243
|
+
fs68.unlinkSync(hookPath);
|
|
211180
211244
|
console.log("TrueCourse pre-commit hook removed.");
|
|
211181
211245
|
}
|
|
211182
211246
|
function runHooksStatus() {
|
|
@@ -211185,8 +211249,8 @@ function runHooksStatus() {
|
|
|
211185
211249
|
console.error("Error: Not a git repository.");
|
|
211186
211250
|
process.exit(1);
|
|
211187
211251
|
}
|
|
211188
|
-
const hookPath =
|
|
211189
|
-
const installed =
|
|
211252
|
+
const hookPath = path79.join(gitDir, "hooks", "pre-commit");
|
|
211253
|
+
const installed = fs68.existsSync(hookPath) && fs68.readFileSync(hookPath, "utf-8").includes(HOOK_IDENTIFIER);
|
|
211190
211254
|
if (installed) {
|
|
211191
211255
|
console.log("TrueCourse pre-commit hook: installed");
|
|
211192
211256
|
console.log(` ${hookPath}`);
|
|
@@ -211295,7 +211359,7 @@ async function runHooksRun() {
|
|
|
211295
211359
|
|
|
211296
211360
|
// tools/cli/src/index.ts
|
|
211297
211361
|
var program2 = new Command();
|
|
211298
|
-
program2.name("truecourse").version("0.7.0-next.
|
|
211362
|
+
program2.name("truecourse").version("0.7.0-next.3").description("TrueCourse CLI \u2014 analyze your repository and open the dashboard");
|
|
211299
211363
|
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
211364
|
if (options.service && options.console) {
|
|
211301
211365
|
console.error("error: --service and --console are mutually exclusive");
|