truecourse 0.5.8-windows.2 → 0.5.8-windows.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 +274 -239
- package/package.json +1 -1
- package/server.mjs +2 -1
package/cli.mjs
CHANGED
|
@@ -972,7 +972,7 @@ 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
|
|
975
|
+
var path23 = __require("node:path");
|
|
976
976
|
var fs17 = __require("node:fs");
|
|
977
977
|
var process2 = __require("node:process");
|
|
978
978
|
var { Argument: Argument2, humanReadableArgName } = require_argument();
|
|
@@ -1905,9 +1905,9 @@ 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 =
|
|
1908
|
+
const localBin = path23.resolve(baseDir, baseName);
|
|
1909
1909
|
if (fs17.existsSync(localBin)) return localBin;
|
|
1910
|
-
if (sourceExt.includes(
|
|
1910
|
+
if (sourceExt.includes(path23.extname(baseName))) return void 0;
|
|
1911
1911
|
const foundExt = sourceExt.find(
|
|
1912
1912
|
(ext2) => fs17.existsSync(`${localBin}${ext2}`)
|
|
1913
1913
|
);
|
|
@@ -1925,17 +1925,17 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1925
1925
|
} catch (err) {
|
|
1926
1926
|
resolvedScriptPath = this._scriptPath;
|
|
1927
1927
|
}
|
|
1928
|
-
executableDir =
|
|
1929
|
-
|
|
1928
|
+
executableDir = path23.resolve(
|
|
1929
|
+
path23.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 = path23.basename(
|
|
1937
1937
|
this._scriptPath,
|
|
1938
|
-
|
|
1938
|
+
path23.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(path23.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 = path23.basename(filename, path23.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(path24) {
|
|
2804
|
+
if (path24 === void 0) return this._executableDir;
|
|
2805
|
+
this._executableDir = path24;
|
|
2806
2806
|
return this;
|
|
2807
2807
|
}
|
|
2808
2808
|
/**
|
|
@@ -5422,10 +5422,10 @@ var require_src3 = __commonJS({
|
|
|
5422
5422
|
var fs_1 = __require("fs");
|
|
5423
5423
|
var debug_1 = __importDefault(require_src2());
|
|
5424
5424
|
var log2 = debug_1.default("@kwsites/file-exists");
|
|
5425
|
-
function check(
|
|
5426
|
-
log2(`checking %s`,
|
|
5425
|
+
function check(path23, isFile, isDirectory) {
|
|
5426
|
+
log2(`checking %s`, path23);
|
|
5427
5427
|
try {
|
|
5428
|
-
const stat = fs_1.statSync(
|
|
5428
|
+
const stat = fs_1.statSync(path23);
|
|
5429
5429
|
if (stat.isFile() && isFile) {
|
|
5430
5430
|
log2(`[OK] path represents a file`);
|
|
5431
5431
|
return true;
|
|
@@ -5445,8 +5445,8 @@ var require_src3 = __commonJS({
|
|
|
5445
5445
|
throw e;
|
|
5446
5446
|
}
|
|
5447
5447
|
}
|
|
5448
|
-
function exists2(
|
|
5449
|
-
return check(
|
|
5448
|
+
function exists2(path23, type2 = exports.READABLE) {
|
|
5449
|
+
return check(path23, (type2 & exports.FILE) > 0, (type2 & exports.FOLDER) > 0);
|
|
5450
5450
|
}
|
|
5451
5451
|
exports.exists = exists2;
|
|
5452
5452
|
exports.FILE = 1;
|
|
@@ -5519,8 +5519,8 @@ function pathspec(...paths) {
|
|
|
5519
5519
|
cache.set(key, paths);
|
|
5520
5520
|
return key;
|
|
5521
5521
|
}
|
|
5522
|
-
function isPathSpec(
|
|
5523
|
-
return
|
|
5522
|
+
function isPathSpec(path23) {
|
|
5523
|
+
return path23 instanceof String && cache.has(path23);
|
|
5524
5524
|
}
|
|
5525
5525
|
function toPaths(pathSpec) {
|
|
5526
5526
|
return cache.get(pathSpec) || [];
|
|
@@ -5564,8 +5564,8 @@ function toLinesWithContent(input = "", trimmed2 = true, separator = "\n") {
|
|
|
5564
5564
|
function forEachLineWithContent(input, callback) {
|
|
5565
5565
|
return toLinesWithContent(input, true).map((line) => callback(line));
|
|
5566
5566
|
}
|
|
5567
|
-
function folderExists(
|
|
5568
|
-
return (0, import_file_exists.exists)(
|
|
5567
|
+
function folderExists(path23) {
|
|
5568
|
+
return (0, import_file_exists.exists)(path23, import_file_exists.FOLDER);
|
|
5569
5569
|
}
|
|
5570
5570
|
function append(target, item) {
|
|
5571
5571
|
if (Array.isArray(target)) {
|
|
@@ -5756,8 +5756,8 @@ function checkIsRepoRootTask() {
|
|
|
5756
5756
|
commands,
|
|
5757
5757
|
format: "utf-8",
|
|
5758
5758
|
onError,
|
|
5759
|
-
parser(
|
|
5760
|
-
return /^\.(git)?$/.test(
|
|
5759
|
+
parser(path23) {
|
|
5760
|
+
return /^\.(git)?$/.test(path23.trim());
|
|
5761
5761
|
}
|
|
5762
5762
|
};
|
|
5763
5763
|
}
|
|
@@ -6013,11 +6013,11 @@ function parseGrep(grep) {
|
|
|
6013
6013
|
const paths = /* @__PURE__ */ new Set();
|
|
6014
6014
|
const results = {};
|
|
6015
6015
|
forEachLineWithContent(grep, (input) => {
|
|
6016
|
-
const [
|
|
6017
|
-
paths.add(
|
|
6018
|
-
(results[
|
|
6016
|
+
const [path23, line, preview] = input.split(NULL);
|
|
6017
|
+
paths.add(path23);
|
|
6018
|
+
(results[path23] = results[path23] || []).push({
|
|
6019
6019
|
line: asNumber(line),
|
|
6020
|
-
path:
|
|
6020
|
+
path: path23,
|
|
6021
6021
|
preview
|
|
6022
6022
|
});
|
|
6023
6023
|
});
|
|
@@ -6314,14 +6314,14 @@ function hashObjectTask(filePath, write) {
|
|
|
6314
6314
|
}
|
|
6315
6315
|
return straightThroughStringTask(commands, true);
|
|
6316
6316
|
}
|
|
6317
|
-
function parseInit(bare,
|
|
6317
|
+
function parseInit(bare, path23, text) {
|
|
6318
6318
|
const response = String(text).trim();
|
|
6319
6319
|
let result;
|
|
6320
6320
|
if (result = initResponseRegex.exec(response)) {
|
|
6321
|
-
return new InitSummary(bare,
|
|
6321
|
+
return new InitSummary(bare, path23, false, result[1]);
|
|
6322
6322
|
}
|
|
6323
6323
|
if (result = reInitResponseRegex.exec(response)) {
|
|
6324
|
-
return new InitSummary(bare,
|
|
6324
|
+
return new InitSummary(bare, path23, true, result[1]);
|
|
6325
6325
|
}
|
|
6326
6326
|
let gitDir = "";
|
|
6327
6327
|
const tokens = response.split(" ");
|
|
@@ -6332,12 +6332,12 @@ function parseInit(bare, path22, text) {
|
|
|
6332
6332
|
break;
|
|
6333
6333
|
}
|
|
6334
6334
|
}
|
|
6335
|
-
return new InitSummary(bare,
|
|
6335
|
+
return new InitSummary(bare, path23, /^re/i.test(response), gitDir);
|
|
6336
6336
|
}
|
|
6337
6337
|
function hasBareCommand(command) {
|
|
6338
6338
|
return command.includes(bareCommand);
|
|
6339
6339
|
}
|
|
6340
|
-
function initTask(bare = false,
|
|
6340
|
+
function initTask(bare = false, path23, customArgs) {
|
|
6341
6341
|
const commands = ["init", ...customArgs];
|
|
6342
6342
|
if (bare && !hasBareCommand(commands)) {
|
|
6343
6343
|
commands.splice(1, 0, bareCommand);
|
|
@@ -6346,7 +6346,7 @@ function initTask(bare = false, path22, customArgs) {
|
|
|
6346
6346
|
commands,
|
|
6347
6347
|
format: "utf-8",
|
|
6348
6348
|
parser(text) {
|
|
6349
|
-
return parseInit(commands.includes("--bare"),
|
|
6349
|
+
return parseInit(commands.includes("--bare"), path23, text);
|
|
6350
6350
|
}
|
|
6351
6351
|
};
|
|
6352
6352
|
}
|
|
@@ -6625,14 +6625,14 @@ function splitLine(result, lineStr) {
|
|
|
6625
6625
|
default:
|
|
6626
6626
|
return;
|
|
6627
6627
|
}
|
|
6628
|
-
function data(index, workingDir,
|
|
6628
|
+
function data(index, workingDir, path23) {
|
|
6629
6629
|
const raw = `${index}${workingDir}`;
|
|
6630
6630
|
const handler = parsers6.get(raw);
|
|
6631
6631
|
if (handler) {
|
|
6632
|
-
handler(result,
|
|
6632
|
+
handler(result, path23);
|
|
6633
6633
|
}
|
|
6634
6634
|
if (raw !== "##" && raw !== "!!") {
|
|
6635
|
-
result.files.push(new FileStatusSummary(
|
|
6635
|
+
result.files.push(new FileStatusSummary(path23, index, workingDir));
|
|
6636
6636
|
}
|
|
6637
6637
|
}
|
|
6638
6638
|
}
|
|
@@ -6819,8 +6819,8 @@ function deleteBranchTask(branch, forceDelete = false) {
|
|
|
6819
6819
|
return task;
|
|
6820
6820
|
}
|
|
6821
6821
|
function toPath(input) {
|
|
6822
|
-
const
|
|
6823
|
-
return
|
|
6822
|
+
const path23 = input.trim().replace(/^["']|["']$/g, "");
|
|
6823
|
+
return path23 && normalize(path23);
|
|
6824
6824
|
}
|
|
6825
6825
|
function checkIgnoreTask(paths) {
|
|
6826
6826
|
return {
|
|
@@ -6959,8 +6959,8 @@ function stashListTask(opt = {}, customArgs) {
|
|
|
6959
6959
|
parser: parser4
|
|
6960
6960
|
};
|
|
6961
6961
|
}
|
|
6962
|
-
function addSubModuleTask(repo,
|
|
6963
|
-
return subModuleTask(["add", repo,
|
|
6962
|
+
function addSubModuleTask(repo, path23) {
|
|
6963
|
+
return subModuleTask(["add", repo, path23]);
|
|
6964
6964
|
}
|
|
6965
6965
|
function initSubModuleTask(customArgs) {
|
|
6966
6966
|
return subModuleTask(["init", ...customArgs]);
|
|
@@ -8272,9 +8272,9 @@ var init_esm = __esm({
|
|
|
8272
8272
|
"src/lib/responses/InitSummary.ts"() {
|
|
8273
8273
|
"use strict";
|
|
8274
8274
|
InitSummary = class {
|
|
8275
|
-
constructor(bare,
|
|
8275
|
+
constructor(bare, path23, existing, gitDir) {
|
|
8276
8276
|
this.bare = bare;
|
|
8277
|
-
this.path =
|
|
8277
|
+
this.path = path23;
|
|
8278
8278
|
this.existing = existing;
|
|
8279
8279
|
this.gitDir = gitDir;
|
|
8280
8280
|
}
|
|
@@ -8808,12 +8808,12 @@ var init_esm = __esm({
|
|
|
8808
8808
|
"use strict";
|
|
8809
8809
|
fromPathRegex = /^(.+)\0(.+)$/;
|
|
8810
8810
|
FileStatusSummary = class {
|
|
8811
|
-
constructor(
|
|
8812
|
-
this.path =
|
|
8811
|
+
constructor(path23, index, working_dir) {
|
|
8812
|
+
this.path = path23;
|
|
8813
8813
|
this.index = index;
|
|
8814
8814
|
this.working_dir = working_dir;
|
|
8815
8815
|
if (index === "R" || working_dir === "R") {
|
|
8816
|
-
const detail = fromPathRegex.exec(
|
|
8816
|
+
const detail = fromPathRegex.exec(path23) || [null, path23, path23];
|
|
8817
8817
|
this.from = detail[2] || "";
|
|
8818
8818
|
this.path = detail[1] || "";
|
|
8819
8819
|
}
|
|
@@ -9076,9 +9076,9 @@ var init_esm = __esm({
|
|
|
9076
9076
|
next
|
|
9077
9077
|
);
|
|
9078
9078
|
}
|
|
9079
|
-
hashObject(
|
|
9079
|
+
hashObject(path23, write) {
|
|
9080
9080
|
return this._runTask(
|
|
9081
|
-
hashObjectTask(
|
|
9081
|
+
hashObjectTask(path23, write === true),
|
|
9082
9082
|
trailingFunctionArgument(arguments)
|
|
9083
9083
|
);
|
|
9084
9084
|
}
|
|
@@ -9715,8 +9715,8 @@ var init_esm = __esm({
|
|
|
9715
9715
|
}
|
|
9716
9716
|
return this._runTask(straightThroughStringTask2(command, this._trimmed), next);
|
|
9717
9717
|
};
|
|
9718
|
-
Git2.prototype.submoduleAdd = function(repo,
|
|
9719
|
-
return this._runTask(addSubModuleTask2(repo,
|
|
9718
|
+
Git2.prototype.submoduleAdd = function(repo, path23, then) {
|
|
9719
|
+
return this._runTask(addSubModuleTask2(repo, path23), trailingFunctionArgument2(arguments));
|
|
9720
9720
|
};
|
|
9721
9721
|
Git2.prototype.submoduleUpdate = function(args, then) {
|
|
9722
9722
|
return this._runTask(
|
|
@@ -10336,7 +10336,7 @@ var require_ignore = __commonJS({
|
|
|
10336
10336
|
// path matching.
|
|
10337
10337
|
// - check `string` either `MODE_IGNORE` or `MODE_CHECK_IGNORE`
|
|
10338
10338
|
// @returns {TestResult} true if a file is ignored
|
|
10339
|
-
test(
|
|
10339
|
+
test(path23, checkUnignored, mode) {
|
|
10340
10340
|
let ignored = false;
|
|
10341
10341
|
let unignored = false;
|
|
10342
10342
|
let matchedRule;
|
|
@@ -10345,7 +10345,7 @@ var require_ignore = __commonJS({
|
|
|
10345
10345
|
if (unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored) {
|
|
10346
10346
|
return;
|
|
10347
10347
|
}
|
|
10348
|
-
const matched = rule[mode].test(
|
|
10348
|
+
const matched = rule[mode].test(path23);
|
|
10349
10349
|
if (!matched) {
|
|
10350
10350
|
return;
|
|
10351
10351
|
}
|
|
@@ -10366,17 +10366,17 @@ var require_ignore = __commonJS({
|
|
|
10366
10366
|
var throwError2 = (message, Ctor) => {
|
|
10367
10367
|
throw new Ctor(message);
|
|
10368
10368
|
};
|
|
10369
|
-
var checkPath = (
|
|
10370
|
-
if (!isString(
|
|
10369
|
+
var checkPath = (path23, originalPath, doThrow) => {
|
|
10370
|
+
if (!isString(path23)) {
|
|
10371
10371
|
return doThrow(
|
|
10372
10372
|
`path must be a string, but got \`${originalPath}\``,
|
|
10373
10373
|
TypeError
|
|
10374
10374
|
);
|
|
10375
10375
|
}
|
|
10376
|
-
if (!
|
|
10376
|
+
if (!path23) {
|
|
10377
10377
|
return doThrow(`path must not be empty`, TypeError);
|
|
10378
10378
|
}
|
|
10379
|
-
if (checkPath.isNotRelative(
|
|
10379
|
+
if (checkPath.isNotRelative(path23)) {
|
|
10380
10380
|
const r = "`path.relative()`d";
|
|
10381
10381
|
return doThrow(
|
|
10382
10382
|
`path should be a ${r} string, but got "${originalPath}"`,
|
|
@@ -10385,7 +10385,7 @@ var require_ignore = __commonJS({
|
|
|
10385
10385
|
}
|
|
10386
10386
|
return true;
|
|
10387
10387
|
};
|
|
10388
|
-
var isNotRelative = (
|
|
10388
|
+
var isNotRelative = (path23) => REGEX_TEST_INVALID_PATH.test(path23);
|
|
10389
10389
|
checkPath.isNotRelative = isNotRelative;
|
|
10390
10390
|
checkPath.convert = (p2) => p2;
|
|
10391
10391
|
var Ignore = class {
|
|
@@ -10415,19 +10415,19 @@ var require_ignore = __commonJS({
|
|
|
10415
10415
|
}
|
|
10416
10416
|
// @returns {TestResult}
|
|
10417
10417
|
_test(originalPath, cache2, checkUnignored, slices) {
|
|
10418
|
-
const
|
|
10418
|
+
const path23 = originalPath && checkPath.convert(originalPath);
|
|
10419
10419
|
checkPath(
|
|
10420
|
-
|
|
10420
|
+
path23,
|
|
10421
10421
|
originalPath,
|
|
10422
10422
|
this._strictPathCheck ? throwError2 : RETURN_FALSE
|
|
10423
10423
|
);
|
|
10424
|
-
return this._t(
|
|
10424
|
+
return this._t(path23, cache2, checkUnignored, slices);
|
|
10425
10425
|
}
|
|
10426
|
-
checkIgnore(
|
|
10427
|
-
if (!REGEX_TEST_TRAILING_SLASH.test(
|
|
10428
|
-
return this.test(
|
|
10426
|
+
checkIgnore(path23) {
|
|
10427
|
+
if (!REGEX_TEST_TRAILING_SLASH.test(path23)) {
|
|
10428
|
+
return this.test(path23);
|
|
10429
10429
|
}
|
|
10430
|
-
const slices =
|
|
10430
|
+
const slices = path23.split(SLASH).filter(Boolean);
|
|
10431
10431
|
slices.pop();
|
|
10432
10432
|
if (slices.length) {
|
|
10433
10433
|
const parent = this._t(
|
|
@@ -10440,18 +10440,18 @@ var require_ignore = __commonJS({
|
|
|
10440
10440
|
return parent;
|
|
10441
10441
|
}
|
|
10442
10442
|
}
|
|
10443
|
-
return this._rules.test(
|
|
10443
|
+
return this._rules.test(path23, false, MODE_CHECK_IGNORE);
|
|
10444
10444
|
}
|
|
10445
|
-
_t(
|
|
10446
|
-
if (
|
|
10447
|
-
return cache2[
|
|
10445
|
+
_t(path23, cache2, checkUnignored, slices) {
|
|
10446
|
+
if (path23 in cache2) {
|
|
10447
|
+
return cache2[path23];
|
|
10448
10448
|
}
|
|
10449
10449
|
if (!slices) {
|
|
10450
|
-
slices =
|
|
10450
|
+
slices = path23.split(SLASH).filter(Boolean);
|
|
10451
10451
|
}
|
|
10452
10452
|
slices.pop();
|
|
10453
10453
|
if (!slices.length) {
|
|
10454
|
-
return cache2[
|
|
10454
|
+
return cache2[path23] = this._rules.test(path23, checkUnignored, MODE_IGNORE);
|
|
10455
10455
|
}
|
|
10456
10456
|
const parent = this._t(
|
|
10457
10457
|
slices.join(SLASH) + SLASH,
|
|
@@ -10459,29 +10459,29 @@ var require_ignore = __commonJS({
|
|
|
10459
10459
|
checkUnignored,
|
|
10460
10460
|
slices
|
|
10461
10461
|
);
|
|
10462
|
-
return cache2[
|
|
10462
|
+
return cache2[path23] = parent.ignored ? parent : this._rules.test(path23, checkUnignored, MODE_IGNORE);
|
|
10463
10463
|
}
|
|
10464
|
-
ignores(
|
|
10465
|
-
return this._test(
|
|
10464
|
+
ignores(path23) {
|
|
10465
|
+
return this._test(path23, this._ignoreCache, false).ignored;
|
|
10466
10466
|
}
|
|
10467
10467
|
createFilter() {
|
|
10468
|
-
return (
|
|
10468
|
+
return (path23) => !this.ignores(path23);
|
|
10469
10469
|
}
|
|
10470
10470
|
filter(paths) {
|
|
10471
10471
|
return makeArray(paths).filter(this.createFilter());
|
|
10472
10472
|
}
|
|
10473
10473
|
// @returns {TestResult}
|
|
10474
|
-
test(
|
|
10475
|
-
return this._test(
|
|
10474
|
+
test(path23) {
|
|
10475
|
+
return this._test(path23, this._testCache, true);
|
|
10476
10476
|
}
|
|
10477
10477
|
};
|
|
10478
10478
|
var factory = (options) => new Ignore(options);
|
|
10479
|
-
var isPathValid = (
|
|
10479
|
+
var isPathValid = (path23) => checkPath(path23 && checkPath.convert(path23), path23, RETURN_FALSE);
|
|
10480
10480
|
var setupWindows = () => {
|
|
10481
10481
|
const makePosix = (str2) => /^\\\\\?\\/.test(str2) || /["<>|\u0000-\u001F]+/u.test(str2) ? str2 : str2.replace(/\\/g, "/");
|
|
10482
10482
|
checkPath.convert = makePosix;
|
|
10483
10483
|
const REGEX_TEST_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i;
|
|
10484
|
-
checkPath.isNotRelative = (
|
|
10484
|
+
checkPath.isNotRelative = (path23) => REGEX_TEST_WINDOWS_PATH_ABSOLUTE.test(path23) || isNotRelative(path23);
|
|
10485
10485
|
};
|
|
10486
10486
|
if (
|
|
10487
10487
|
// Detect `process` so that it can run in browsers.
|
|
@@ -11931,18 +11931,18 @@ function extractRouterMount(callNode, filePath) {
|
|
|
11931
11931
|
const routerName = args[0]?.type === "identifier" ? args[0].text : null;
|
|
11932
11932
|
if (!routerName)
|
|
11933
11933
|
return null;
|
|
11934
|
-
let
|
|
11934
|
+
let path23 = "/";
|
|
11935
11935
|
for (const arg of args) {
|
|
11936
11936
|
if (arg.type === "keyword_argument") {
|
|
11937
11937
|
const key = arg.childForFieldName("name")?.text;
|
|
11938
11938
|
const value = arg.childForFieldName("value");
|
|
11939
11939
|
if ((key === "url_prefix" || key === "prefix") && value) {
|
|
11940
|
-
|
|
11940
|
+
path23 = value.text.replace(/^["']|["']$/g, "");
|
|
11941
11941
|
}
|
|
11942
11942
|
}
|
|
11943
11943
|
}
|
|
11944
11944
|
return {
|
|
11945
|
-
path:
|
|
11945
|
+
path: path23,
|
|
11946
11946
|
routerName,
|
|
11947
11947
|
location: {
|
|
11948
11948
|
filePath,
|
|
@@ -11966,11 +11966,11 @@ function extractChainedRoute(outerCall, filePath) {
|
|
|
11966
11966
|
const innerArgs = innerCall.childForFieldName("arguments");
|
|
11967
11967
|
if (!innerArgs)
|
|
11968
11968
|
return null;
|
|
11969
|
-
let
|
|
11969
|
+
let path23 = null;
|
|
11970
11970
|
let httpMethod = methodName === "route" ? "GET" : methodName.toUpperCase();
|
|
11971
11971
|
for (const arg of innerArgs.namedChildren) {
|
|
11972
|
-
if (!
|
|
11973
|
-
|
|
11972
|
+
if (!path23 && arg.type === "string") {
|
|
11973
|
+
path23 = arg.text.replace(/^["']|["']$/g, "");
|
|
11974
11974
|
}
|
|
11975
11975
|
if (arg.type === "keyword_argument") {
|
|
11976
11976
|
const key = arg.childForFieldName("name")?.text;
|
|
@@ -11982,14 +11982,14 @@ function extractChainedRoute(outerCall, filePath) {
|
|
|
11982
11982
|
}
|
|
11983
11983
|
}
|
|
11984
11984
|
}
|
|
11985
|
-
if (!
|
|
11985
|
+
if (!path23)
|
|
11986
11986
|
return null;
|
|
11987
11987
|
const outerArgs = outerCall.childForFieldName("arguments");
|
|
11988
11988
|
const handlerArg = outerArgs?.namedChildren[0];
|
|
11989
11989
|
const handlerName = handlerArg?.type === "identifier" ? handlerArg.text : "anonymous";
|
|
11990
11990
|
return {
|
|
11991
11991
|
httpMethod,
|
|
11992
|
-
path:
|
|
11992
|
+
path: path23,
|
|
11993
11993
|
handlerName,
|
|
11994
11994
|
location: {
|
|
11995
11995
|
filePath,
|
|
@@ -12065,8 +12065,8 @@ function extractRoute(methodName, argsNode, filePath, callNode) {
|
|
|
12065
12065
|
const firstArg = argsNode.namedChild(0);
|
|
12066
12066
|
if (!firstArg)
|
|
12067
12067
|
return null;
|
|
12068
|
-
const
|
|
12069
|
-
if (!
|
|
12068
|
+
const path23 = extractStringLiteral(firstArg);
|
|
12069
|
+
if (!path23)
|
|
12070
12070
|
return null;
|
|
12071
12071
|
const argCount = argsNode.namedChildCount;
|
|
12072
12072
|
if (argCount < 2)
|
|
@@ -12079,7 +12079,7 @@ function extractRoute(methodName, argsNode, filePath, callNode) {
|
|
|
12079
12079
|
return null;
|
|
12080
12080
|
return {
|
|
12081
12081
|
httpMethod: methodName.toUpperCase(),
|
|
12082
|
-
path:
|
|
12082
|
+
path: path23,
|
|
12083
12083
|
handlerName,
|
|
12084
12084
|
location: {
|
|
12085
12085
|
filePath,
|
|
@@ -12096,8 +12096,8 @@ function extractMount(argsNode, filePath, callNode) {
|
|
|
12096
12096
|
const firstArg = argsNode.namedChild(0);
|
|
12097
12097
|
if (!firstArg)
|
|
12098
12098
|
return null;
|
|
12099
|
-
const
|
|
12100
|
-
if (!
|
|
12099
|
+
const path23 = extractStringLiteral(firstArg);
|
|
12100
|
+
if (!path23)
|
|
12101
12101
|
return null;
|
|
12102
12102
|
const secondArg = argsNode.namedChild(1);
|
|
12103
12103
|
if (!secondArg)
|
|
@@ -12106,7 +12106,7 @@ function extractMount(argsNode, filePath, callNode) {
|
|
|
12106
12106
|
if (!routerName)
|
|
12107
12107
|
return null;
|
|
12108
12108
|
return {
|
|
12109
|
-
path:
|
|
12109
|
+
path: path23,
|
|
12110
12110
|
routerName,
|
|
12111
12111
|
location: {
|
|
12112
12112
|
filePath,
|
|
@@ -16657,9 +16657,9 @@ function detectDockerComposeServices(rootPath, allFiles) {
|
|
|
16657
16657
|
];
|
|
16658
16658
|
let composePath2 = null;
|
|
16659
16659
|
for (const file of composeFiles) {
|
|
16660
|
-
const
|
|
16661
|
-
if (existsSync7(
|
|
16662
|
-
composePath2 =
|
|
16660
|
+
const path23 = join6(rootPath, file);
|
|
16661
|
+
if (existsSync7(path23)) {
|
|
16662
|
+
composePath2 = path23;
|
|
16663
16663
|
break;
|
|
16664
16664
|
}
|
|
16665
16665
|
}
|
|
@@ -19694,9 +19694,9 @@ function findSimpleCycles(component, componentSet, adjacency) {
|
|
|
19694
19694
|
for (const next of successors) {
|
|
19695
19695
|
if (!componentSet.has(next))
|
|
19696
19696
|
continue;
|
|
19697
|
-
if (next === start &&
|
|
19698
|
-
const chain = [...
|
|
19699
|
-
const minNode =
|
|
19697
|
+
if (next === start && path23.length >= 2) {
|
|
19698
|
+
const chain = [...path23, start];
|
|
19699
|
+
const minNode = path23.reduce((a, b) => a < b ? a : b);
|
|
19700
19700
|
if (minNode === start) {
|
|
19701
19701
|
cycles.push(chain);
|
|
19702
19702
|
}
|
|
@@ -19704,15 +19704,15 @@ function findSimpleCycles(component, componentSet, adjacency) {
|
|
|
19704
19704
|
}
|
|
19705
19705
|
if (!visited.has(next) && !seen.has(next)) {
|
|
19706
19706
|
visited.add(next);
|
|
19707
|
-
|
|
19707
|
+
path23.push(next);
|
|
19708
19708
|
dfs2(next);
|
|
19709
|
-
|
|
19709
|
+
path23.pop();
|
|
19710
19710
|
visited.delete(next);
|
|
19711
19711
|
}
|
|
19712
19712
|
}
|
|
19713
19713
|
};
|
|
19714
19714
|
var dfs = dfs2;
|
|
19715
|
-
const
|
|
19715
|
+
const path23 = [start];
|
|
19716
19716
|
const visited = /* @__PURE__ */ new Set([start]);
|
|
19717
19717
|
dfs2(start);
|
|
19718
19718
|
seen.add(start);
|
|
@@ -19734,7 +19734,7 @@ function findShortestCycle(start, componentSet, adjacency) {
|
|
|
19734
19734
|
visited.add(next);
|
|
19735
19735
|
}
|
|
19736
19736
|
while (queue.length > 0) {
|
|
19737
|
-
const { node, path:
|
|
19737
|
+
const { node, path: path23 } = queue.shift();
|
|
19738
19738
|
const nexts = adjacency.get(node);
|
|
19739
19739
|
if (!nexts)
|
|
19740
19740
|
continue;
|
|
@@ -19742,11 +19742,11 @@ function findShortestCycle(start, componentSet, adjacency) {
|
|
|
19742
19742
|
if (!componentSet.has(next))
|
|
19743
19743
|
continue;
|
|
19744
19744
|
if (next === start) {
|
|
19745
|
-
return [...
|
|
19745
|
+
return [...path23, start];
|
|
19746
19746
|
}
|
|
19747
19747
|
if (!visited.has(next)) {
|
|
19748
19748
|
visited.add(next);
|
|
19749
|
-
queue.push({ node: next, path: [...
|
|
19749
|
+
queue.push({ node: next, path: [...path23, next] });
|
|
19750
19750
|
}
|
|
19751
19751
|
}
|
|
19752
19752
|
}
|
|
@@ -91856,8 +91856,8 @@ var init_missing_error_status_code = __esm({
|
|
|
91856
91856
|
});
|
|
91857
91857
|
|
|
91858
91858
|
// packages/analyzer/dist/rules/architecture/visitors/javascript/route-without-auth-middleware.js
|
|
91859
|
-
function isPublicPath(
|
|
91860
|
-
return PUBLIC_PATH_PATTERNS.some((re2) => re2.test(
|
|
91859
|
+
function isPublicPath(path23) {
|
|
91860
|
+
return PUBLIC_PATH_PATTERNS.some((re2) => re2.test(path23));
|
|
91861
91861
|
}
|
|
91862
91862
|
function extractMiddlewareNames(callNode) {
|
|
91863
91863
|
const args = callNode.childForFieldName("arguments");
|
|
@@ -91983,8 +91983,8 @@ var init_route_without_auth_middleware = __esm({
|
|
|
91983
91983
|
return null;
|
|
91984
91984
|
const firstArg = args.namedChildren[0];
|
|
91985
91985
|
if (firstArg?.type === "string") {
|
|
91986
|
-
const
|
|
91987
|
-
if (isPublicPath(
|
|
91986
|
+
const path23 = firstArg.text.replace(/^['"`]|['"`]$/g, "");
|
|
91987
|
+
if (isPublicPath(path23))
|
|
91988
91988
|
return null;
|
|
91989
91989
|
}
|
|
91990
91990
|
const middleware = extractMiddlewareNames(node);
|
|
@@ -96082,8 +96082,8 @@ var init_parseUtil = __esm({
|
|
|
96082
96082
|
init_errors2();
|
|
96083
96083
|
init_en();
|
|
96084
96084
|
makeIssue = (params) => {
|
|
96085
|
-
const { data, path:
|
|
96086
|
-
const fullPath = [...
|
|
96085
|
+
const { data, path: path23, errorMaps, issueData } = params;
|
|
96086
|
+
const fullPath = [...path23, ...issueData.path || []];
|
|
96087
96087
|
const fullIssue = {
|
|
96088
96088
|
...issueData,
|
|
96089
96089
|
path: fullPath
|
|
@@ -96391,11 +96391,11 @@ var init_types2 = __esm({
|
|
|
96391
96391
|
init_parseUtil();
|
|
96392
96392
|
init_util3();
|
|
96393
96393
|
ParseInputLazyPath = class {
|
|
96394
|
-
constructor(parent, value,
|
|
96394
|
+
constructor(parent, value, path23, key) {
|
|
96395
96395
|
this._cachedPath = [];
|
|
96396
96396
|
this.parent = parent;
|
|
96397
96397
|
this.data = value;
|
|
96398
|
-
this._path =
|
|
96398
|
+
this._path = path23;
|
|
96399
96399
|
this._key = key;
|
|
96400
96400
|
}
|
|
96401
96401
|
get path() {
|
|
@@ -100482,7 +100482,7 @@ var require_windows = __commonJS({
|
|
|
100482
100482
|
module.exports = isexe;
|
|
100483
100483
|
isexe.sync = sync;
|
|
100484
100484
|
var fs17 = __require("fs");
|
|
100485
|
-
function checkPathExt(
|
|
100485
|
+
function checkPathExt(path23, options) {
|
|
100486
100486
|
var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
|
|
100487
100487
|
if (!pathext) {
|
|
100488
100488
|
return true;
|
|
@@ -100493,25 +100493,25 @@ var require_windows = __commonJS({
|
|
|
100493
100493
|
}
|
|
100494
100494
|
for (var i = 0; i < pathext.length; i++) {
|
|
100495
100495
|
var p2 = pathext[i].toLowerCase();
|
|
100496
|
-
if (p2 &&
|
|
100496
|
+
if (p2 && path23.substr(-p2.length).toLowerCase() === p2) {
|
|
100497
100497
|
return true;
|
|
100498
100498
|
}
|
|
100499
100499
|
}
|
|
100500
100500
|
return false;
|
|
100501
100501
|
}
|
|
100502
|
-
function checkStat(stat,
|
|
100502
|
+
function checkStat(stat, path23, options) {
|
|
100503
100503
|
if (!stat.isSymbolicLink() && !stat.isFile()) {
|
|
100504
100504
|
return false;
|
|
100505
100505
|
}
|
|
100506
|
-
return checkPathExt(
|
|
100506
|
+
return checkPathExt(path23, options);
|
|
100507
100507
|
}
|
|
100508
|
-
function isexe(
|
|
100509
|
-
fs17.stat(
|
|
100510
|
-
cb(er, er ? false : checkStat(stat,
|
|
100508
|
+
function isexe(path23, options, cb) {
|
|
100509
|
+
fs17.stat(path23, function(er, stat) {
|
|
100510
|
+
cb(er, er ? false : checkStat(stat, path23, options));
|
|
100511
100511
|
});
|
|
100512
100512
|
}
|
|
100513
|
-
function sync(
|
|
100514
|
-
return checkStat(fs17.statSync(
|
|
100513
|
+
function sync(path23, options) {
|
|
100514
|
+
return checkStat(fs17.statSync(path23), path23, options);
|
|
100515
100515
|
}
|
|
100516
100516
|
}
|
|
100517
100517
|
});
|
|
@@ -100522,13 +100522,13 @@ var require_mode = __commonJS({
|
|
|
100522
100522
|
module.exports = isexe;
|
|
100523
100523
|
isexe.sync = sync;
|
|
100524
100524
|
var fs17 = __require("fs");
|
|
100525
|
-
function isexe(
|
|
100526
|
-
fs17.stat(
|
|
100525
|
+
function isexe(path23, options, cb) {
|
|
100526
|
+
fs17.stat(path23, function(er, stat) {
|
|
100527
100527
|
cb(er, er ? false : checkStat(stat, options));
|
|
100528
100528
|
});
|
|
100529
100529
|
}
|
|
100530
|
-
function sync(
|
|
100531
|
-
return checkStat(fs17.statSync(
|
|
100530
|
+
function sync(path23, options) {
|
|
100531
|
+
return checkStat(fs17.statSync(path23), options);
|
|
100532
100532
|
}
|
|
100533
100533
|
function checkStat(stat, options) {
|
|
100534
100534
|
return stat.isFile() && checkMode(stat, options);
|
|
@@ -100561,7 +100561,7 @@ var require_isexe = __commonJS({
|
|
|
100561
100561
|
}
|
|
100562
100562
|
module.exports = isexe;
|
|
100563
100563
|
isexe.sync = sync;
|
|
100564
|
-
function isexe(
|
|
100564
|
+
function isexe(path23, options, cb) {
|
|
100565
100565
|
if (typeof options === "function") {
|
|
100566
100566
|
cb = options;
|
|
100567
100567
|
options = {};
|
|
@@ -100571,7 +100571,7 @@ var require_isexe = __commonJS({
|
|
|
100571
100571
|
throw new TypeError("callback not provided");
|
|
100572
100572
|
}
|
|
100573
100573
|
return new Promise(function(resolve8, reject) {
|
|
100574
|
-
isexe(
|
|
100574
|
+
isexe(path23, options || {}, function(er, is) {
|
|
100575
100575
|
if (er) {
|
|
100576
100576
|
reject(er);
|
|
100577
100577
|
} else {
|
|
@@ -100580,7 +100580,7 @@ var require_isexe = __commonJS({
|
|
|
100580
100580
|
});
|
|
100581
100581
|
});
|
|
100582
100582
|
}
|
|
100583
|
-
core2(
|
|
100583
|
+
core2(path23, options || {}, function(er, is) {
|
|
100584
100584
|
if (er) {
|
|
100585
100585
|
if (er.code === "EACCES" || options && options.ignoreErrors) {
|
|
100586
100586
|
er = null;
|
|
@@ -100590,9 +100590,9 @@ var require_isexe = __commonJS({
|
|
|
100590
100590
|
cb(er, is);
|
|
100591
100591
|
});
|
|
100592
100592
|
}
|
|
100593
|
-
function sync(
|
|
100593
|
+
function sync(path23, options) {
|
|
100594
100594
|
try {
|
|
100595
|
-
return core2.sync(
|
|
100595
|
+
return core2.sync(path23, options || {});
|
|
100596
100596
|
} catch (er) {
|
|
100597
100597
|
if (options && options.ignoreErrors || er.code === "EACCES") {
|
|
100598
100598
|
return false;
|
|
@@ -100608,7 +100608,7 @@ var require_isexe = __commonJS({
|
|
|
100608
100608
|
var require_which = __commonJS({
|
|
100609
100609
|
"node_modules/.pnpm/which@2.0.2/node_modules/which/which.js"(exports, module) {
|
|
100610
100610
|
var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
|
|
100611
|
-
var
|
|
100611
|
+
var path23 = __require("path");
|
|
100612
100612
|
var COLON = isWindows ? ";" : ":";
|
|
100613
100613
|
var isexe = require_isexe();
|
|
100614
100614
|
var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
|
|
@@ -100646,7 +100646,7 @@ var require_which = __commonJS({
|
|
|
100646
100646
|
return opt.all && found.length ? resolve8(found) : reject(getNotFoundError(cmd));
|
|
100647
100647
|
const ppRaw = pathEnv[i];
|
|
100648
100648
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
100649
|
-
const pCmd =
|
|
100649
|
+
const pCmd = path23.join(pathPart, cmd);
|
|
100650
100650
|
const p2 = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
100651
100651
|
resolve8(subStep(p2, i, 0));
|
|
100652
100652
|
});
|
|
@@ -100673,7 +100673,7 @@ var require_which = __commonJS({
|
|
|
100673
100673
|
for (let i = 0; i < pathEnv.length; i++) {
|
|
100674
100674
|
const ppRaw = pathEnv[i];
|
|
100675
100675
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
100676
|
-
const pCmd =
|
|
100676
|
+
const pCmd = path23.join(pathPart, cmd);
|
|
100677
100677
|
const p2 = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
100678
100678
|
for (let j2 = 0; j2 < pathExt.length; j2++) {
|
|
100679
100679
|
const cur = p2 + pathExt[j2];
|
|
@@ -100721,7 +100721,7 @@ var require_path_key = __commonJS({
|
|
|
100721
100721
|
var require_resolveCommand = __commonJS({
|
|
100722
100722
|
"node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js"(exports, module) {
|
|
100723
100723
|
"use strict";
|
|
100724
|
-
var
|
|
100724
|
+
var path23 = __require("path");
|
|
100725
100725
|
var which = require_which();
|
|
100726
100726
|
var getPathKey = require_path_key();
|
|
100727
100727
|
function resolveCommandAttempt(parsed, withoutPathExt) {
|
|
@@ -100739,7 +100739,7 @@ var require_resolveCommand = __commonJS({
|
|
|
100739
100739
|
try {
|
|
100740
100740
|
resolved = which.sync(parsed.command, {
|
|
100741
100741
|
path: env[getPathKey({ env })],
|
|
100742
|
-
pathExt: withoutPathExt ?
|
|
100742
|
+
pathExt: withoutPathExt ? path23.delimiter : void 0
|
|
100743
100743
|
});
|
|
100744
100744
|
} catch (e) {
|
|
100745
100745
|
} finally {
|
|
@@ -100748,7 +100748,7 @@ var require_resolveCommand = __commonJS({
|
|
|
100748
100748
|
}
|
|
100749
100749
|
}
|
|
100750
100750
|
if (resolved) {
|
|
100751
|
-
resolved =
|
|
100751
|
+
resolved = path23.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
|
|
100752
100752
|
}
|
|
100753
100753
|
return resolved;
|
|
100754
100754
|
}
|
|
@@ -100802,8 +100802,8 @@ var require_shebang_command = __commonJS({
|
|
|
100802
100802
|
if (!match2) {
|
|
100803
100803
|
return null;
|
|
100804
100804
|
}
|
|
100805
|
-
const [
|
|
100806
|
-
const binary2 =
|
|
100805
|
+
const [path23, argument] = match2[0].replace(/#! ?/, "").split(" ");
|
|
100806
|
+
const binary2 = path23.split("/").pop();
|
|
100807
100807
|
if (binary2 === "env") {
|
|
100808
100808
|
return argument;
|
|
100809
100809
|
}
|
|
@@ -100838,7 +100838,7 @@ var require_readShebang = __commonJS({
|
|
|
100838
100838
|
var require_parse = __commonJS({
|
|
100839
100839
|
"node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js"(exports, module) {
|
|
100840
100840
|
"use strict";
|
|
100841
|
-
var
|
|
100841
|
+
var path23 = __require("path");
|
|
100842
100842
|
var resolveCommand = require_resolveCommand();
|
|
100843
100843
|
var escape2 = require_escape();
|
|
100844
100844
|
var readShebang = require_readShebang();
|
|
@@ -100863,7 +100863,7 @@ var require_parse = __commonJS({
|
|
|
100863
100863
|
const needsShell = !isExecutableRegExp.test(commandFile);
|
|
100864
100864
|
if (parsed.options.forceShell || needsShell) {
|
|
100865
100865
|
const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
|
|
100866
|
-
parsed.command =
|
|
100866
|
+
parsed.command = path23.normalize(parsed.command);
|
|
100867
100867
|
parsed.command = escape2.command(parsed.command);
|
|
100868
100868
|
parsed.args = parsed.args.map((arg) => escape2.argument(arg, needsDoubleEscapeMetaChars));
|
|
100869
100869
|
const shellCommand = [parsed.command].concat(parsed.args).join(" ");
|
|
@@ -100953,7 +100953,7 @@ var require_cross_spawn = __commonJS({
|
|
|
100953
100953
|
var cp = __require("child_process");
|
|
100954
100954
|
var parse2 = require_parse();
|
|
100955
100955
|
var enoent = require_enoent();
|
|
100956
|
-
function
|
|
100956
|
+
function spawn5(command, args, options) {
|
|
100957
100957
|
const parsed = parse2(command, args, options);
|
|
100958
100958
|
const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
|
|
100959
100959
|
enoent.hookChildProcess(spawned, parsed);
|
|
@@ -100965,8 +100965,8 @@ var require_cross_spawn = __commonJS({
|
|
|
100965
100965
|
result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
|
|
100966
100966
|
return result;
|
|
100967
100967
|
}
|
|
100968
|
-
module.exports =
|
|
100969
|
-
module.exports.spawn =
|
|
100968
|
+
module.exports = spawn5;
|
|
100969
|
+
module.exports.spawn = spawn5;
|
|
100970
100970
|
module.exports.sync = spawnSync2;
|
|
100971
100971
|
module.exports._parse = parse2;
|
|
100972
100972
|
module.exports._enoent = enoent;
|
|
@@ -102810,7 +102810,7 @@ var require_package = __commonJS({
|
|
|
102810
102810
|
var require_main = __commonJS({
|
|
102811
102811
|
"node_modules/.pnpm/dotenv@16.6.1/node_modules/dotenv/lib/main.js"(exports, module) {
|
|
102812
102812
|
var fs17 = __require("fs");
|
|
102813
|
-
var
|
|
102813
|
+
var path23 = __require("path");
|
|
102814
102814
|
var os8 = __require("os");
|
|
102815
102815
|
var crypto2 = __require("crypto");
|
|
102816
102816
|
var packageJson = require_package();
|
|
@@ -102926,7 +102926,7 @@ var require_main = __commonJS({
|
|
|
102926
102926
|
possibleVaultPath = options.path.endsWith(".vault") ? options.path : `${options.path}.vault`;
|
|
102927
102927
|
}
|
|
102928
102928
|
} else {
|
|
102929
|
-
possibleVaultPath =
|
|
102929
|
+
possibleVaultPath = path23.resolve(process.cwd(), ".env.vault");
|
|
102930
102930
|
}
|
|
102931
102931
|
if (fs17.existsSync(possibleVaultPath)) {
|
|
102932
102932
|
return possibleVaultPath;
|
|
@@ -102934,7 +102934,7 @@ var require_main = __commonJS({
|
|
|
102934
102934
|
return null;
|
|
102935
102935
|
}
|
|
102936
102936
|
function _resolveHome(envPath) {
|
|
102937
|
-
return envPath[0] === "~" ?
|
|
102937
|
+
return envPath[0] === "~" ? path23.join(os8.homedir(), envPath.slice(1)) : envPath;
|
|
102938
102938
|
}
|
|
102939
102939
|
function _configVault(options) {
|
|
102940
102940
|
const debug2 = Boolean(options && options.debug);
|
|
@@ -102951,7 +102951,7 @@ var require_main = __commonJS({
|
|
|
102951
102951
|
return { parsed };
|
|
102952
102952
|
}
|
|
102953
102953
|
function configDotenv(options) {
|
|
102954
|
-
const dotenvPath =
|
|
102954
|
+
const dotenvPath = path23.resolve(process.cwd(), ".env");
|
|
102955
102955
|
let encoding = "utf8";
|
|
102956
102956
|
const debug2 = Boolean(options && options.debug);
|
|
102957
102957
|
const quiet = options && "quiet" in options ? options.quiet : true;
|
|
@@ -102975,13 +102975,13 @@ var require_main = __commonJS({
|
|
|
102975
102975
|
}
|
|
102976
102976
|
let lastError;
|
|
102977
102977
|
const parsedAll = {};
|
|
102978
|
-
for (const
|
|
102978
|
+
for (const path24 of optionPaths) {
|
|
102979
102979
|
try {
|
|
102980
|
-
const parsed = DotenvModule.parse(fs17.readFileSync(
|
|
102980
|
+
const parsed = DotenvModule.parse(fs17.readFileSync(path24, { encoding }));
|
|
102981
102981
|
DotenvModule.populate(parsedAll, parsed, options);
|
|
102982
102982
|
} catch (e) {
|
|
102983
102983
|
if (debug2) {
|
|
102984
|
-
_debug(`Failed to load ${
|
|
102984
|
+
_debug(`Failed to load ${path24} ${e.message}`);
|
|
102985
102985
|
}
|
|
102986
102986
|
lastError = e;
|
|
102987
102987
|
}
|
|
@@ -102996,7 +102996,7 @@ var require_main = __commonJS({
|
|
|
102996
102996
|
const shortPaths = [];
|
|
102997
102997
|
for (const filePath of optionPaths) {
|
|
102998
102998
|
try {
|
|
102999
|
-
const relative2 =
|
|
102999
|
+
const relative2 = path23.relative(process.cwd(), filePath);
|
|
103000
103000
|
shortPaths.push(relative2);
|
|
103001
103001
|
} catch (e) {
|
|
103002
103002
|
if (debug2) {
|
|
@@ -103830,8 +103830,8 @@ var init_cli_provider = __esm({
|
|
|
103830
103830
|
this._repoId = repoId;
|
|
103831
103831
|
}
|
|
103832
103832
|
/** Set target repo path — used as cwd when spawning CLI so Read tool accesses the right files. */
|
|
103833
|
-
setRepoPath(
|
|
103834
|
-
this._repoPath =
|
|
103833
|
+
setRepoPath(path23) {
|
|
103834
|
+
this._repoPath = path23;
|
|
103835
103835
|
}
|
|
103836
103836
|
flushUsage() {
|
|
103837
103837
|
if (this._usageRecords.length === 0)
|
|
@@ -107371,9 +107371,9 @@ init_dist4();
|
|
|
107371
107371
|
init_paths();
|
|
107372
107372
|
init_registry();
|
|
107373
107373
|
init_helpers();
|
|
107374
|
-
import { spawn as
|
|
107374
|
+
import { spawn as spawn4 } from "node:child_process";
|
|
107375
107375
|
import fs15 from "node:fs";
|
|
107376
|
-
import
|
|
107376
|
+
import path21 from "node:path";
|
|
107377
107377
|
import { fileURLToPath as fileURLToPath5 } from "node:url";
|
|
107378
107378
|
|
|
107379
107379
|
// tools/cli/src/commands/service/macos.ts
|
|
@@ -107415,8 +107415,9 @@ function escapeXml(s) {
|
|
|
107415
107415
|
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
107416
107416
|
}
|
|
107417
107417
|
function buildPlist(serverPath, logPath, envVars) {
|
|
107418
|
-
const
|
|
107419
|
-
const
|
|
107418
|
+
const logDir = path17.dirname(logPath);
|
|
107419
|
+
const stdoutPath = path17.join(logDir, "dashboard.out.log");
|
|
107420
|
+
const stderrPath = path17.join(logDir, "dashboard.err.log");
|
|
107420
107421
|
let envSection = "";
|
|
107421
107422
|
if (Object.keys(envVars).length > 0) {
|
|
107422
107423
|
const entries = Object.entries(envVars).map(([k, v]) => ` <key>${escapeXml(k)}</key>
|
|
@@ -107457,6 +107458,7 @@ var MacOSService = class {
|
|
|
107457
107458
|
if (process.env.PATH && !envVars.PATH) {
|
|
107458
107459
|
envVars.PATH = process.env.PATH;
|
|
107459
107460
|
}
|
|
107461
|
+
envVars.TRUECOURSE_LOG_DIR = path17.dirname(logPath);
|
|
107460
107462
|
fs12.mkdirSync(PLIST_DIR, { recursive: true });
|
|
107461
107463
|
fs12.mkdirSync(path17.dirname(logPath), { recursive: true });
|
|
107462
107464
|
const plist = buildPlist(serverPath, logPath, envVars);
|
|
@@ -107528,8 +107530,9 @@ ExecStart=${process.execPath} ${serverPath}
|
|
|
107528
107530
|
Restart=on-failure
|
|
107529
107531
|
RestartSec=5
|
|
107530
107532
|
EnvironmentFile=${envFile}
|
|
107531
|
-
|
|
107532
|
-
|
|
107533
|
+
Environment=TRUECOURSE_LOG_DIR=${logDir}
|
|
107534
|
+
StandardOutput=append:${path18.join(logDir, "dashboard.out.log")}
|
|
107535
|
+
StandardError=append:${path18.join(logDir, "dashboard.err.log")}
|
|
107533
107536
|
|
|
107534
107537
|
[Install]
|
|
107535
107538
|
WantedBy=default.target
|
|
@@ -107589,7 +107592,9 @@ var LinuxService = class {
|
|
|
107589
107592
|
|
|
107590
107593
|
// tools/cli/src/commands/service/windows.ts
|
|
107591
107594
|
import { execSync as execSync3 } from "node:child_process";
|
|
107595
|
+
import path19 from "node:path";
|
|
107592
107596
|
var SERVICE_NAME2 = "TrueCourse";
|
|
107597
|
+
var SERVICE_ID = "dashboard";
|
|
107593
107598
|
var WindowsService = class {
|
|
107594
107599
|
svc;
|
|
107595
107600
|
async getNodeWindows() {
|
|
@@ -107604,15 +107609,20 @@ var WindowsService = class {
|
|
|
107604
107609
|
async install(serverPath, logPath) {
|
|
107605
107610
|
const nw = await this.getNodeWindows();
|
|
107606
107611
|
const { Service } = nw;
|
|
107612
|
+
const logDir = path19.dirname(logPath);
|
|
107607
107613
|
return new Promise((resolve8, reject) => {
|
|
107608
107614
|
const svc = new Service({
|
|
107609
107615
|
name: SERVICE_NAME2,
|
|
107616
|
+
id: SERVICE_ID,
|
|
107610
107617
|
description: "TrueCourse Server",
|
|
107611
107618
|
script: serverPath,
|
|
107612
107619
|
nodeOptions: [],
|
|
107620
|
+
// Land wrapper logs in our shared log dir (default is the
|
|
107621
|
+
// node-windows install dir, often inside an npx cache).
|
|
107622
|
+
logpath: logDir,
|
|
107613
107623
|
env: [{
|
|
107614
107624
|
name: "TRUECOURSE_LOG_DIR",
|
|
107615
|
-
value:
|
|
107625
|
+
value: logDir
|
|
107616
107626
|
}]
|
|
107617
107627
|
});
|
|
107618
107628
|
svc.on("install", () => {
|
|
@@ -107687,98 +107697,118 @@ function getPlatform() {
|
|
|
107687
107697
|
|
|
107688
107698
|
// tools/cli/src/commands/service/logs.ts
|
|
107689
107699
|
import fs14 from "node:fs";
|
|
107690
|
-
import
|
|
107700
|
+
import path20 from "node:path";
|
|
107691
107701
|
import os7 from "node:os";
|
|
107692
|
-
import { spawn as spawn4 } from "node:child_process";
|
|
107693
107702
|
var MAX_LOG_SIZE2 = 10 * 1024 * 1024;
|
|
107694
107703
|
var MAX_LOG_FILES2 = 5;
|
|
107704
|
+
var POLL_INTERVAL_MS = 500;
|
|
107705
|
+
var KNOWN_LOG_FILENAMES = [
|
|
107706
|
+
"dashboard.log",
|
|
107707
|
+
"dashboard.out.log",
|
|
107708
|
+
"dashboard.err.log",
|
|
107709
|
+
"dashboard.wrapper.log",
|
|
107710
|
+
// Legacy (pre-unified-layout) — kept for backward compatibility with
|
|
107711
|
+
// existing macOS/Linux service registrations.
|
|
107712
|
+
"truecourse.log",
|
|
107713
|
+
"truecourse.error.log"
|
|
107714
|
+
];
|
|
107695
107715
|
function getLogDir() {
|
|
107696
|
-
return
|
|
107716
|
+
return path20.join(os7.homedir(), ".truecourse", "logs");
|
|
107697
107717
|
}
|
|
107698
107718
|
function getLogPath() {
|
|
107699
|
-
return
|
|
107719
|
+
return path20.join(getLogDir(), "dashboard.log");
|
|
107700
107720
|
}
|
|
107701
|
-
function
|
|
107702
|
-
|
|
107721
|
+
function existingLogFiles(logDir) {
|
|
107722
|
+
return KNOWN_LOG_FILENAMES.map((name) => path20.join(logDir, name)).filter((p2) => fs14.existsSync(p2));
|
|
107723
|
+
}
|
|
107724
|
+
function rotateOne(logFile) {
|
|
107703
107725
|
if (!fs14.existsSync(logFile)) return;
|
|
107704
|
-
|
|
107705
|
-
if (stats.size < MAX_LOG_SIZE2) return;
|
|
107726
|
+
if (fs14.statSync(logFile).size < MAX_LOG_SIZE2) return;
|
|
107706
107727
|
for (let i = MAX_LOG_FILES2; i >= 1; i--) {
|
|
107707
|
-
const older =
|
|
107728
|
+
const older = `${logFile}.${i}`;
|
|
107708
107729
|
if (i === MAX_LOG_FILES2) {
|
|
107709
107730
|
if (fs14.existsSync(older)) fs14.unlinkSync(older);
|
|
107710
107731
|
} else {
|
|
107711
|
-
const newer =
|
|
107732
|
+
const newer = `${logFile}.${i + 1}`;
|
|
107712
107733
|
if (fs14.existsSync(older)) fs14.renameSync(older, newer);
|
|
107713
107734
|
}
|
|
107714
107735
|
}
|
|
107715
|
-
fs14.renameSync(logFile,
|
|
107736
|
+
fs14.renameSync(logFile, `${logFile}.1`);
|
|
107716
107737
|
}
|
|
107717
|
-
function
|
|
107718
|
-
const
|
|
107719
|
-
|
|
107720
|
-
|
|
107721
|
-
|
|
107722
|
-
|
|
107723
|
-
|
|
107724
|
-
|
|
107725
|
-
|
|
107726
|
-
|
|
107727
|
-
|
|
107728
|
-
|
|
107729
|
-
|
|
107738
|
+
function rotateLogs(logDir) {
|
|
107739
|
+
for (const name of KNOWN_LOG_FILENAMES) {
|
|
107740
|
+
rotateOne(path20.join(logDir, name));
|
|
107741
|
+
}
|
|
107742
|
+
}
|
|
107743
|
+
function readLastLines(filePath, maxLines) {
|
|
107744
|
+
const content = fs14.readFileSync(filePath, "utf-8");
|
|
107745
|
+
const lines = content.split("\n");
|
|
107746
|
+
if (lines.length > 0 && lines[lines.length - 1] === "") lines.pop();
|
|
107747
|
+
return lines.slice(-maxLines).join("\n");
|
|
107748
|
+
}
|
|
107749
|
+
function dumpLogTails(logDir, linesPerFile = 50) {
|
|
107750
|
+
const files = existingLogFiles(logDir);
|
|
107751
|
+
if (files.length === 0) return false;
|
|
107752
|
+
for (const file of files) {
|
|
107753
|
+
const tail = readLastLines(file, linesPerFile);
|
|
107754
|
+
process.stdout.write(`
|
|
107755
|
+
----- ${path20.basename(file)} (last ${linesPerFile} lines) -----
|
|
107756
|
+
`);
|
|
107757
|
+
process.stdout.write(tail);
|
|
107758
|
+
if (!tail.endsWith("\n")) process.stdout.write("\n");
|
|
107730
107759
|
}
|
|
107731
|
-
|
|
107760
|
+
return true;
|
|
107732
107761
|
}
|
|
107733
107762
|
function tailLogs() {
|
|
107734
|
-
const
|
|
107735
|
-
|
|
107736
|
-
|
|
107737
|
-
console.log(
|
|
107763
|
+
const logDir = getLogDir();
|
|
107764
|
+
const files = existingLogFiles(logDir);
|
|
107765
|
+
if (files.length === 0) {
|
|
107766
|
+
console.log("No log files found. Is the service running?");
|
|
107767
|
+
console.log(`Expected under: ${logDir}`);
|
|
107738
107768
|
return;
|
|
107739
107769
|
}
|
|
107740
|
-
|
|
107741
|
-
|
|
107742
|
-
|
|
107743
|
-
|
|
107744
|
-
|
|
107745
|
-
|
|
107746
|
-
|
|
107747
|
-
|
|
107748
|
-
|
|
107749
|
-
|
|
107750
|
-
|
|
107751
|
-
|
|
107752
|
-
|
|
107753
|
-
|
|
107754
|
-
|
|
107755
|
-
|
|
107756
|
-
|
|
107770
|
+
dumpLogTails(logDir);
|
|
107771
|
+
const sizes = /* @__PURE__ */ new Map();
|
|
107772
|
+
for (const file of files) sizes.set(file, fs14.statSync(file).size);
|
|
107773
|
+
const watch = (file) => {
|
|
107774
|
+
fs14.watchFile(file, { interval: POLL_INTERVAL_MS }, () => {
|
|
107775
|
+
try {
|
|
107776
|
+
const newSize = fs14.statSync(file).size;
|
|
107777
|
+
const lastSize = sizes.get(file) ?? 0;
|
|
107778
|
+
if (newSize > lastSize) {
|
|
107779
|
+
const fd = fs14.openSync(file, "r");
|
|
107780
|
+
const buf = Buffer.alloc(newSize - lastSize);
|
|
107781
|
+
fs14.readSync(fd, buf, 0, buf.length, lastSize);
|
|
107782
|
+
fs14.closeSync(fd);
|
|
107783
|
+
const tag = `[${path20.basename(file)}] `;
|
|
107784
|
+
const text = buf.toString("utf-8");
|
|
107785
|
+
const tagged = text.split("\n").map((line, i, arr) => i === arr.length - 1 && line === "" ? "" : tag + line).join("\n");
|
|
107786
|
+
process.stdout.write(tagged);
|
|
107787
|
+
sizes.set(file, newSize);
|
|
107788
|
+
} else if (newSize < lastSize) {
|
|
107789
|
+
sizes.set(file, newSize);
|
|
107790
|
+
}
|
|
107791
|
+
} catch {
|
|
107757
107792
|
}
|
|
107758
107793
|
});
|
|
107759
|
-
}
|
|
107760
|
-
|
|
107761
|
-
|
|
107762
|
-
|
|
107763
|
-
|
|
107764
|
-
|
|
107765
|
-
|
|
107766
|
-
|
|
107767
|
-
process.on("SIGTERM", cleanup);
|
|
107768
|
-
tail.on("close", () => {
|
|
107769
|
-
process.exit(0);
|
|
107770
|
-
});
|
|
107771
|
-
}
|
|
107794
|
+
};
|
|
107795
|
+
for (const file of files) watch(file);
|
|
107796
|
+
const cleanup = () => {
|
|
107797
|
+
for (const file of files) fs14.unwatchFile(file);
|
|
107798
|
+
process.exit(0);
|
|
107799
|
+
};
|
|
107800
|
+
process.on("SIGINT", cleanup);
|
|
107801
|
+
process.on("SIGTERM", cleanup);
|
|
107772
107802
|
}
|
|
107773
107803
|
|
|
107774
107804
|
// tools/cli/src/commands/dashboard.ts
|
|
107775
|
-
var __dirname2 =
|
|
107805
|
+
var __dirname2 = path21.dirname(fileURLToPath5(import.meta.url));
|
|
107776
107806
|
function resolveServerEntry() {
|
|
107777
107807
|
const candidates = [
|
|
107778
107808
|
// Packaged CLI: dist/cli.mjs next to dist/server.mjs
|
|
107779
|
-
|
|
107809
|
+
path21.join(__dirname2, "server.mjs"),
|
|
107780
107810
|
// Source build output: tools/cli/dist → ../../../../dist/server.mjs
|
|
107781
|
-
|
|
107811
|
+
path21.resolve(__dirname2, "..", "..", "..", "..", "dist", "server.mjs")
|
|
107782
107812
|
];
|
|
107783
107813
|
return candidates.find((p2) => fs15.existsSync(p2)) ?? null;
|
|
107784
107814
|
}
|
|
@@ -107817,7 +107847,7 @@ async function promptRunMode() {
|
|
|
107817
107847
|
async function runConsoleMode(serverEntry) {
|
|
107818
107848
|
const url = getServerUrl();
|
|
107819
107849
|
O2.step("Starting dashboard server...");
|
|
107820
|
-
const serverProcess =
|
|
107850
|
+
const serverProcess = spawn4(process.execPath, [serverEntry], {
|
|
107821
107851
|
stdio: "inherit",
|
|
107822
107852
|
env: { ...process.env }
|
|
107823
107853
|
});
|
|
@@ -107850,7 +107880,6 @@ async function runServiceMode(serverEntry) {
|
|
|
107850
107880
|
const logPath = getLogPath();
|
|
107851
107881
|
const url = getServerUrl();
|
|
107852
107882
|
rotateLogs(logDir);
|
|
107853
|
-
rotateErrorLogs(logDir);
|
|
107854
107883
|
const installed = await platform.isInstalled();
|
|
107855
107884
|
if (!installed) {
|
|
107856
107885
|
O2.step("Installing background service...");
|
|
@@ -107864,8 +107893,14 @@ async function runServiceMode(serverEntry) {
|
|
|
107864
107893
|
}
|
|
107865
107894
|
const healthy = await waitForHealth(url);
|
|
107866
107895
|
if (!healthy) {
|
|
107867
|
-
O2.warn("Service started but server hasn't responded
|
|
107868
|
-
O2.info(
|
|
107896
|
+
O2.warn("Service started but server hasn't responded on the health endpoint.");
|
|
107897
|
+
O2.info(`Log dir: ${logDir}`);
|
|
107898
|
+
const dumped = dumpLogTails(logDir);
|
|
107899
|
+
if (!dumped) {
|
|
107900
|
+
O2.info(
|
|
107901
|
+
"No log files have appeared yet \u2014 the supervisor may not have launched the server. Re-run in a few seconds or use: truecourse dashboard logs"
|
|
107902
|
+
);
|
|
107903
|
+
}
|
|
107869
107904
|
process.exit(1);
|
|
107870
107905
|
}
|
|
107871
107906
|
const target = targetUrlFor(url);
|
|
@@ -108253,7 +108288,7 @@ async function runRulesLlm(options) {
|
|
|
108253
108288
|
// tools/cli/src/commands/hooks.ts
|
|
108254
108289
|
import { execSync as execSync4 } from "node:child_process";
|
|
108255
108290
|
import fs16 from "node:fs";
|
|
108256
|
-
import
|
|
108291
|
+
import path22 from "node:path";
|
|
108257
108292
|
|
|
108258
108293
|
// node_modules/.pnpm/js-yaml@4.1.1/node_modules/js-yaml/dist/js-yaml.mjs
|
|
108259
108294
|
function isNothing(subject) {
|
|
@@ -110913,17 +110948,17 @@ pre-commit:
|
|
|
110913
110948
|
function findGitDir(from) {
|
|
110914
110949
|
let dir = from;
|
|
110915
110950
|
while (true) {
|
|
110916
|
-
const gitPath =
|
|
110951
|
+
const gitPath = path22.join(dir, ".git");
|
|
110917
110952
|
if (fs16.existsSync(gitPath)) {
|
|
110918
110953
|
const stat = fs16.statSync(gitPath);
|
|
110919
110954
|
if (stat.isDirectory()) return gitPath;
|
|
110920
110955
|
if (stat.isFile()) {
|
|
110921
110956
|
const content = fs16.readFileSync(gitPath, "utf-8").trim();
|
|
110922
110957
|
const match2 = content.match(/^gitdir:\s*(.+)$/);
|
|
110923
|
-
if (match2) return
|
|
110958
|
+
if (match2) return path22.resolve(dir, match2[1]);
|
|
110924
110959
|
}
|
|
110925
110960
|
}
|
|
110926
|
-
const parent =
|
|
110961
|
+
const parent = path22.dirname(dir);
|
|
110927
110962
|
if (parent === dir) return null;
|
|
110928
110963
|
dir = parent;
|
|
110929
110964
|
}
|
|
@@ -110931,14 +110966,14 @@ function findGitDir(from) {
|
|
|
110931
110966
|
function findProjectRoot(from) {
|
|
110932
110967
|
let dir = from;
|
|
110933
110968
|
while (true) {
|
|
110934
|
-
if (fs16.existsSync(
|
|
110935
|
-
const parent =
|
|
110969
|
+
if (fs16.existsSync(path22.join(dir, ".git"))) return dir;
|
|
110970
|
+
const parent = path22.dirname(dir);
|
|
110936
110971
|
if (parent === dir) return null;
|
|
110937
110972
|
dir = parent;
|
|
110938
110973
|
}
|
|
110939
110974
|
}
|
|
110940
110975
|
function loadConfig(projectRoot) {
|
|
110941
|
-
const configPath =
|
|
110976
|
+
const configPath = path22.join(projectRoot, ".truecourse", "hooks.yaml");
|
|
110942
110977
|
if (!fs16.existsSync(configPath)) return null;
|
|
110943
110978
|
let parsed;
|
|
110944
110979
|
try {
|
|
@@ -110993,9 +111028,9 @@ async function runHooksInstall() {
|
|
|
110993
111028
|
} else {
|
|
110994
111029
|
console.log(INSTALL_WARNING);
|
|
110995
111030
|
}
|
|
110996
|
-
const hooksDir =
|
|
111031
|
+
const hooksDir = path22.join(gitDir, "hooks");
|
|
110997
111032
|
fs16.mkdirSync(hooksDir, { recursive: true });
|
|
110998
|
-
const hookPath =
|
|
111033
|
+
const hookPath = path22.join(hooksDir, "pre-commit");
|
|
110999
111034
|
if (fs16.existsSync(hookPath)) {
|
|
111000
111035
|
const existing = fs16.readFileSync(hookPath, "utf-8");
|
|
111001
111036
|
if (!existing.includes(HOOK_IDENTIFIER)) {
|
|
@@ -111012,8 +111047,8 @@ async function runHooksInstall() {
|
|
|
111012
111047
|
console.log(` ${hookPath}`);
|
|
111013
111048
|
const projectRoot = findProjectRoot(process.cwd());
|
|
111014
111049
|
if (projectRoot) {
|
|
111015
|
-
const cfgDir =
|
|
111016
|
-
const cfgPath =
|
|
111050
|
+
const cfgDir = path22.join(projectRoot, ".truecourse");
|
|
111051
|
+
const cfgPath = path22.join(cfgDir, "hooks.yaml");
|
|
111017
111052
|
if (!fs16.existsSync(cfgPath)) {
|
|
111018
111053
|
fs16.mkdirSync(cfgDir, { recursive: true });
|
|
111019
111054
|
fs16.writeFileSync(cfgPath, HOOKS_YAML_TEMPLATE);
|
|
@@ -111027,7 +111062,7 @@ function runHooksUninstall() {
|
|
|
111027
111062
|
console.error("Error: Not a git repository.");
|
|
111028
111063
|
process.exit(1);
|
|
111029
111064
|
}
|
|
111030
|
-
const hookPath =
|
|
111065
|
+
const hookPath = path22.join(gitDir, "hooks", "pre-commit");
|
|
111031
111066
|
if (!fs16.existsSync(hookPath)) {
|
|
111032
111067
|
console.log("No pre-commit hook installed.");
|
|
111033
111068
|
return;
|
|
@@ -111046,7 +111081,7 @@ function runHooksStatus() {
|
|
|
111046
111081
|
console.error("Error: Not a git repository.");
|
|
111047
111082
|
process.exit(1);
|
|
111048
111083
|
}
|
|
111049
|
-
const hookPath =
|
|
111084
|
+
const hookPath = path22.join(gitDir, "hooks", "pre-commit");
|
|
111050
111085
|
const installed = fs16.existsSync(hookPath) && fs16.readFileSync(hookPath, "utf-8").includes(HOOK_IDENTIFIER);
|
|
111051
111086
|
if (installed) {
|
|
111052
111087
|
console.log("TrueCourse pre-commit hook: installed");
|
|
@@ -111156,7 +111191,7 @@ async function runHooksRun() {
|
|
|
111156
111191
|
|
|
111157
111192
|
// tools/cli/src/index.ts
|
|
111158
111193
|
var program2 = new Command();
|
|
111159
|
-
program2.name("truecourse").version("0.5.8-windows.
|
|
111194
|
+
program2.name("truecourse").version("0.5.8-windows.3").description("TrueCourse CLI \u2014 analyze your repository and open the dashboard");
|
|
111160
111195
|
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) => {
|
|
111161
111196
|
if (options.service && options.console) {
|
|
111162
111197
|
console.error("error: --service and --console are mutually exclusive");
|
package/package.json
CHANGED
package/server.mjs
CHANGED
|
@@ -156128,8 +156128,9 @@ function stopAllWatchers() {
|
|
|
156128
156128
|
init_logger();
|
|
156129
156129
|
var port = parseInt(process.env.PORT || "3001", 10);
|
|
156130
156130
|
async function main() {
|
|
156131
|
+
const logDir = process.env.TRUECOURSE_LOG_DIR ?? getLogDir();
|
|
156131
156132
|
configureLogger({
|
|
156132
|
-
filePath: path18.join(
|
|
156133
|
+
filePath: path18.join(logDir, "dashboard.log"),
|
|
156133
156134
|
tee: process.env.TRUECOURSE_DEV === "1"
|
|
156134
156135
|
});
|
|
156135
156136
|
if (wipeLegacyPostgresData()) {
|