@kaynooo/cli-check 0.11.0 → 0.12.1
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/README.md +7 -1
- package/dist/cli.js +496 -184
- package/dist/errs-cli.js +140 -75
- package/dist/fix-cli.js +221 -317
- package/dist/j-cli.js +158 -106
- package/package.json +2 -2
package/dist/fix-cli.js
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
#!/usr/bin/env bun
|
|
1
|
+
#!/usr/bin/env -S bun --no-env-file
|
|
2
2
|
// @bun
|
|
3
3
|
|
|
4
4
|
// src/fix-cli.ts
|
|
5
5
|
import process15 from "process";
|
|
6
|
-
|
|
7
6
|
// ../kit/src/args.ts
|
|
8
|
-
import
|
|
7
|
+
import process6 from "process";
|
|
9
8
|
import { parseArgs } from "util";
|
|
10
9
|
|
|
11
10
|
// ../kit/src/format.ts
|
|
12
|
-
import
|
|
11
|
+
import process3 from "process";
|
|
13
12
|
|
|
14
13
|
// ../kit/src/style.ts
|
|
15
|
-
import
|
|
14
|
+
import process2 from "process";
|
|
16
15
|
|
|
17
16
|
// ../../node_modules/.bun/@kaynooo+utils@2.31.2+d0769e28dc4dad16/node_modules/@kaynooo/utils/dist/chunk-mtetydvc.js
|
|
18
17
|
function x(s) {
|
|
@@ -282,20 +281,20 @@ var MARKS = {
|
|
|
282
281
|
problem: { symbol: "\u2717", word: "error:", paint: (colors) => colors.red },
|
|
283
282
|
note: { symbol: "\xB7", word: "note:", paint: (colors) => colors.dim }
|
|
284
283
|
};
|
|
285
|
-
function takesControlCodes(stream, env =
|
|
284
|
+
function takesControlCodes(stream, env = process2.env) {
|
|
286
285
|
return stream.isTTY === true && env.NO_COLOR === undefined && env.NODE_DISABLE_COLORS === undefined && env.TERM !== "dumb";
|
|
287
286
|
}
|
|
288
|
-
function paint(stream, env =
|
|
287
|
+
function paint(stream, env = process2.env) {
|
|
289
288
|
return le({ stream: { isTTY: takesControlCodes(stream, env) }, env });
|
|
290
289
|
}
|
|
291
|
-
function marked(mark, text, stream, detail, env =
|
|
290
|
+
function marked(mark, text, stream, detail, env = process2.env) {
|
|
292
291
|
const colors = paint(stream, env);
|
|
293
292
|
const { symbol, word, paint: tint } = MARKS[mark];
|
|
294
293
|
const head = takesControlCodes(stream, env) ? tint(colors)(symbol) : word;
|
|
295
294
|
return `${head} ${text}${detail === undefined ? "" : ` ${colors.dim(detail)}`}`;
|
|
296
295
|
}
|
|
297
296
|
function warn(text, detail) {
|
|
298
|
-
console.error(marked("warn", text,
|
|
297
|
+
console.error(marked("warn", text, process2.stderr, detail));
|
|
299
298
|
}
|
|
300
299
|
var STATUSES = {
|
|
301
300
|
passed: { symbol: "\u2713", words: ["passed", "success", "succeeded", "ok"], paint: (colors) => colors.green },
|
|
@@ -344,7 +343,7 @@ function table(rows, { cellWidth, header = false, align = [], fit } = {}) {
|
|
|
344
343
|
widths[index] = Math.max(widths[index] ?? 0, textWidth(cell));
|
|
345
344
|
}
|
|
346
345
|
const shown = fit === undefined ? cells : narrow(cells, widths, fit);
|
|
347
|
-
const colors = paint(
|
|
346
|
+
const colors = paint(process3.stdout);
|
|
348
347
|
const lines = shown.map((row) => row.map((cell, index) => {
|
|
349
348
|
const width = widths[index] ?? 0;
|
|
350
349
|
const gap = " ".repeat(Math.max(0, width - textWidth(cell)));
|
|
@@ -376,24 +375,30 @@ function printJson(value) {
|
|
|
376
375
|
}
|
|
377
376
|
|
|
378
377
|
// ../kit/src/help.ts
|
|
379
|
-
import
|
|
378
|
+
import process4 from "process";
|
|
380
379
|
var OPTIONAL = /\[[^\]]+\]/g;
|
|
381
380
|
var USAGE_PREFIX = /^usage:\s*/i;
|
|
382
381
|
var FULL_STOP = /\.$/;
|
|
383
|
-
function usageLine(usage, colors = paint(
|
|
382
|
+
function usageLine(usage, colors = paint(process4.stdout)) {
|
|
384
383
|
return `${colors.bold("Usage:")} ${usage.replace(USAGE_PREFIX, "").replaceAll(OPTIONAL, (part) => colors.dim(part))}`;
|
|
385
384
|
}
|
|
386
|
-
function helpText(usage, options, colors = paint(
|
|
387
|
-
return [usageLine(usage, colors), ...replacesRows(replaces, colors), "", colors.bold("Options:"), ...optionRows(options, colors), ...exampleRows(examples, colors)].join(`
|
|
385
|
+
function helpText(usage, options, colors = paint(process4.stdout), { examples = [], replaces, exits = [] } = {}) {
|
|
386
|
+
return [usageLine(usage, colors), ...replacesRows(replaces, colors), "", colors.bold("Options:"), ...optionRows(options, colors), ...exitRows(exits, colors), ...exampleRows(examples, colors)].join(`
|
|
388
387
|
`);
|
|
389
388
|
}
|
|
390
|
-
function
|
|
389
|
+
function exitRows(exits, colors = paint(process4.stdout)) {
|
|
390
|
+
if (exits.length === 0)
|
|
391
|
+
return [];
|
|
392
|
+
const width = Math.max(...exits.map(([code]) => String(code).length));
|
|
393
|
+
return ["", colors.bold("Exits:"), ...exits.map(([code, meaning]) => ` ${colors.cyan(String(code).padEnd(width))} ${meaning}`)];
|
|
394
|
+
}
|
|
395
|
+
function replacesRows(replaces, colors = paint(process4.stdout)) {
|
|
391
396
|
return replaces === undefined ? [] : ["", `${colors.bold("Instead of:")} ${replaces}`];
|
|
392
397
|
}
|
|
393
|
-
function wantsHelpJson(env =
|
|
398
|
+
function wantsHelpJson(env = process4.env) {
|
|
394
399
|
return env.KIT_HELP === "json";
|
|
395
400
|
}
|
|
396
|
-
function description(usage, { examples = [], replaces } = {}) {
|
|
401
|
+
function description(usage, { examples = [], replaces, exits } = {}, options) {
|
|
397
402
|
const lines = usage.replace(USAGE_PREFIX, "").split(`
|
|
398
403
|
`);
|
|
399
404
|
const first = lines[0];
|
|
@@ -404,15 +409,17 @@ function description(usage, { examples = [], replaces } = {}) {
|
|
|
404
409
|
synopsis: colon === -1 ? first : first.slice(0, colon),
|
|
405
410
|
summary: colon === -1 ? fallback : first.slice(colon + 2),
|
|
406
411
|
...replaces === undefined ? {} : { replaces },
|
|
407
|
-
examples: examples.map((example) => typeof example === "string" ? { line: example } : { line: example[0], note: example[1] })
|
|
412
|
+
examples: examples.map((example) => typeof example === "string" ? { line: example } : { line: example[0], note: example[1] }),
|
|
413
|
+
...exits === undefined ? {} : { exits: exits.map(([code, meaning]) => ({ code, meaning })) },
|
|
414
|
+
...options === undefined ? {} : { options: Object.entries(options).map(([name, { short, description }]) => ({ name, ...short === undefined ? {} : { short }, ...description === undefined ? {} : { description } })) }
|
|
408
415
|
};
|
|
409
416
|
}
|
|
410
|
-
function exampleRows(examples, colors = paint(
|
|
417
|
+
function exampleRows(examples, colors = paint(process4.stdout)) {
|
|
411
418
|
if (examples.length === 0)
|
|
412
419
|
return [];
|
|
413
420
|
return ["", colors.bold("Examples:"), ...examples.map((example) => typeof example === "string" ? ` ${example}` : ` ${example[0]} ${colors.dim(`# ${example[1]}`)}`)];
|
|
414
421
|
}
|
|
415
|
-
function optionRows(options, colors = paint(
|
|
422
|
+
function optionRows(options, colors = paint(process4.stdout)) {
|
|
416
423
|
const rows = Object.entries(options).map(([name, option]) => {
|
|
417
424
|
const short = option.short === undefined ? " " : `${colors.cyan(`-${option.short}`)}, `;
|
|
418
425
|
const named = option.choices === undefined ? "<value>" : `<${option.choices.join("|")}>`;
|
|
@@ -447,7 +454,7 @@ function closest(name, names) {
|
|
|
447
454
|
return best !== undefined && best.far <= (name.length < 4 ? 1 : 2) ? best.known : undefined;
|
|
448
455
|
}
|
|
449
456
|
// ../kit/src/input.ts
|
|
450
|
-
import
|
|
457
|
+
import process5 from "process";
|
|
451
458
|
var DURATION = /^(\d+(?:\.\d+)?)(ms|[smhd])?$/;
|
|
452
459
|
var UNIT_MS = { ms: 1, s: 1000, m: 60000, h: 3600000, d: 86400000 };
|
|
453
460
|
function duration(value, name, fallback, unit = "s") {
|
|
@@ -461,7 +468,7 @@ function duration(value, name, fallback, unit = "s") {
|
|
|
461
468
|
}
|
|
462
469
|
async function readInput(path, { noStdin = "nothing is piped on stdin" } = {}) {
|
|
463
470
|
if (path === "-") {
|
|
464
|
-
if (
|
|
471
|
+
if (process5.stdin.isTTY)
|
|
465
472
|
fail(noStdin);
|
|
466
473
|
return Bun.stdin.text();
|
|
467
474
|
}
|
|
@@ -520,7 +527,7 @@ var OUTPUT_OPTIONS = {
|
|
|
520
527
|
color: { type: "string", description: "auto (on a terminal alone), always or never" },
|
|
521
528
|
plain: { type: "boolean", description: "plain text, no colour or spinner: --color never" }
|
|
522
529
|
};
|
|
523
|
-
function applyOutput(color, plain, env =
|
|
530
|
+
function applyOutput(color, plain, env = process6.env) {
|
|
524
531
|
const when = plain === true ? "never" : color ?? "auto";
|
|
525
532
|
if (when === "auto")
|
|
526
533
|
return;
|
|
@@ -543,7 +550,7 @@ function parse(args, usage, options, settings = {}) {
|
|
|
543
550
|
const { own, rest } = settings.trailing === true ? splitTrailing(args, all, settings.positionals?.length ?? 0) : splitRest(args, settings.rest === true);
|
|
544
551
|
let parsed;
|
|
545
552
|
try {
|
|
546
|
-
parsed = parseArgs({ args: joinDashValues(withBare(own, all), all), options: all, allowPositionals: true, allowNegative: settings.allowNegative === true, strict: true });
|
|
553
|
+
parsed = parseArgs({ args: joinDashValues(withBare(withAliases(own, all), all), all), options: all, allowPositionals: true, allowNegative: settings.allowNegative === true, strict: true });
|
|
547
554
|
} catch (error) {
|
|
548
555
|
const message = parseError(error);
|
|
549
556
|
throw new UsageError(message, nearestOption(message, all, settings.allowNegative === true));
|
|
@@ -551,7 +558,7 @@ function parse(args, usage, options, settings = {}) {
|
|
|
551
558
|
const values = parsed.values;
|
|
552
559
|
applyOutput("color" in output ? values.color : undefined, "plain" in output ? values.plain : undefined);
|
|
553
560
|
if (values.help === true) {
|
|
554
|
-
console.log(wantsHelpJson() ? JSON.stringify(description(usage, settings)) : helpText(usage, listing, undefined, settings));
|
|
561
|
+
console.log(wantsHelpJson() ? JSON.stringify(description(usage, settings, listing)) : helpText(usage, listing, undefined, settings));
|
|
555
562
|
throw new HelpShown;
|
|
556
563
|
}
|
|
557
564
|
checkChoices(parsed.values, all);
|
|
@@ -593,6 +600,18 @@ function listed(options, allowNegative) {
|
|
|
593
600
|
return [...option.description === undefined ? [] : [[name, option]], [`no-${name}`, { type: "boolean", description: option.negative }]];
|
|
594
601
|
}));
|
|
595
602
|
}
|
|
603
|
+
function withAliases(args, options) {
|
|
604
|
+
const named = new Map(Object.entries(options).flatMap(([name, { aliases = [] }]) => aliases.map((alias) => [`--${alias}`, `--${name}`])));
|
|
605
|
+
if (named.size === 0)
|
|
606
|
+
return args;
|
|
607
|
+
const separator = args.indexOf("--");
|
|
608
|
+
const own = separator === -1 ? args : args.slice(0, separator);
|
|
609
|
+
return [...own.map((arg) => {
|
|
610
|
+
const at = arg.indexOf("=");
|
|
611
|
+
const current = named.get(at === -1 ? arg : arg.slice(0, at));
|
|
612
|
+
return current === undefined ? arg : `${current}${at === -1 ? "" : arg.slice(at)}`;
|
|
613
|
+
}), ...separator === -1 ? [] : args.slice(separator)];
|
|
614
|
+
}
|
|
596
615
|
function withBare(args, options) {
|
|
597
616
|
const bare = new Map(Object.entries(options).flatMap(([name, { short, optional }]) => optional === undefined ? [] : [[`--${name}`, optional], ...short === undefined ? [] : [[`-${short}`, optional]]]));
|
|
598
617
|
if (bare.size === 0)
|
|
@@ -679,7 +698,7 @@ function nearestOption(message, options, allowNegative) {
|
|
|
679
698
|
}
|
|
680
699
|
// ../kit/src/process.ts
|
|
681
700
|
import { constants } from "os";
|
|
682
|
-
import
|
|
701
|
+
import process7 from "process";
|
|
683
702
|
var KILL_GRACE_MS = 2000;
|
|
684
703
|
var SIGNALS = ["SIGINT", "SIGTERM", "SIGHUP"];
|
|
685
704
|
function exitCodeOf(code, signal) {
|
|
@@ -701,7 +720,7 @@ function holdSignals(cleanup) {
|
|
|
701
720
|
},
|
|
702
721
|
release: () => {
|
|
703
722
|
for (const signal of SIGNALS)
|
|
704
|
-
|
|
723
|
+
process7.off(signal, onSignal);
|
|
705
724
|
}
|
|
706
725
|
};
|
|
707
726
|
function onSignal(signal) {
|
|
@@ -714,10 +733,10 @@ function holdSignals(cleanup) {
|
|
|
714
733
|
return;
|
|
715
734
|
held.release();
|
|
716
735
|
cleanup(signal);
|
|
717
|
-
|
|
736
|
+
process7.kill(process7.pid, signal);
|
|
718
737
|
}
|
|
719
738
|
for (const signal of SIGNALS)
|
|
720
|
-
|
|
739
|
+
process7.on(signal, onSignal);
|
|
721
740
|
return held;
|
|
722
741
|
}
|
|
723
742
|
async function runCommand(argv, { cwd, env, stdin = "ignore", timeoutMs, signal, maxBytes = Infinity, onChunk, onStart } = {}) {
|
|
@@ -731,7 +750,7 @@ async function runCommand(argv, { cwd, env, stdin = "ignore", timeoutMs, signal,
|
|
|
731
750
|
return;
|
|
732
751
|
try {
|
|
733
752
|
if (grouped)
|
|
734
|
-
|
|
753
|
+
process7.kill(-proc.pid, killing);
|
|
735
754
|
else
|
|
736
755
|
proc.kill(killing);
|
|
737
756
|
} catch {}
|
|
@@ -805,31 +824,33 @@ var ESCAPE_CODE = new RegExp(`${ESC}(?:\\[[\\x30-\\x3F]*[\\x20-\\x2F]*[\\x40-\\x
|
|
|
805
824
|
var RESET_STYLE = `${ESC}[0m`;
|
|
806
825
|
var CLOSE_LINK = `${ESC}]8;;${ESC}\\`;
|
|
807
826
|
// ../kit/src/cli.ts
|
|
808
|
-
import
|
|
827
|
+
import { readFileSync, realpathSync } from "fs";
|
|
828
|
+
import { dirname as dirname2, join as join3 } from "path";
|
|
829
|
+
import process10 from "process";
|
|
809
830
|
|
|
810
831
|
// ../kit/src/usage.ts
|
|
811
832
|
import { appendFileSync, mkdirSync } from "fs";
|
|
812
833
|
import { homedir as homedir2 } from "os";
|
|
813
834
|
import { dirname, isAbsolute, join as join2 } from "path";
|
|
814
|
-
import
|
|
835
|
+
import process9 from "process";
|
|
815
836
|
|
|
816
837
|
// ../kit/src/logs.ts
|
|
817
838
|
import { lstatSync, openSync } from "fs";
|
|
818
839
|
import { mkdir, mkdtemp, readdir, rm, stat } from "fs/promises";
|
|
819
840
|
import { homedir, tmpdir } from "os";
|
|
820
841
|
import { join } from "path";
|
|
821
|
-
import
|
|
842
|
+
import process8 from "process";
|
|
822
843
|
var DAY_MS = 24 * 60 * 60 * 1000;
|
|
823
844
|
var CLI_FOLDER = "kaynooo-cli";
|
|
824
845
|
function isPrivateDirectory(path) {
|
|
825
846
|
try {
|
|
826
847
|
const info = lstatSync(path, { throwIfNoEntry: false });
|
|
827
|
-
return info !== undefined && info.isDirectory() && info.uid === (
|
|
848
|
+
return info !== undefined && info.isDirectory() && info.uid === (process8.getuid?.() ?? info.uid) && (info.mode & 63) === 0;
|
|
828
849
|
} catch {
|
|
829
850
|
return false;
|
|
830
851
|
}
|
|
831
852
|
}
|
|
832
|
-
async function privateLogDirectory(name, env =
|
|
853
|
+
async function privateLogDirectory(name, env = process8.env) {
|
|
833
854
|
const runtime = env.XDG_RUNTIME_DIR;
|
|
834
855
|
const base = runtime === undefined || runtime === "" ? join(homedir(), ".cache", CLI_FOLDER) : join(runtime, CLI_FOLDER);
|
|
835
856
|
const path = join(base, name);
|
|
@@ -869,14 +890,14 @@ var usageError;
|
|
|
869
890
|
function noteUsageError(message) {
|
|
870
891
|
usageError = message;
|
|
871
892
|
}
|
|
872
|
-
function stateHome(env =
|
|
893
|
+
function stateHome(env = process9.env) {
|
|
873
894
|
const dir = env.XDG_STATE_HOME;
|
|
874
895
|
return dir !== undefined && isAbsolute(dir) ? dir : join2(homedir2(), ".local", "state");
|
|
875
896
|
}
|
|
876
|
-
function usagePath(env =
|
|
897
|
+
function usagePath(env = process9.env) {
|
|
877
898
|
return join2(stateHome(env), CLI_FOLDER, "usage.jsonl");
|
|
878
899
|
}
|
|
879
|
-
function usageRecorded(env =
|
|
900
|
+
function usageRecorded(env = process9.env) {
|
|
880
901
|
const off = env.KAYNOOO_CLI_NO_USAGE;
|
|
881
902
|
return env.NODE_ENV !== "test" && (off === undefined || off === "" || off === "0");
|
|
882
903
|
}
|
|
@@ -890,7 +911,7 @@ function usageEntry(bin, command, argv, code, now = new Date) {
|
|
|
890
911
|
usageError = undefined;
|
|
891
912
|
return { at: now.toISOString(), bin, ...command === undefined ? {} : { command }, flags: flagNames(argv), code, ...unknown === undefined ? {} : { unknown } };
|
|
892
913
|
}
|
|
893
|
-
function recordUsage(entry, env =
|
|
914
|
+
function recordUsage(entry, env = process9.env) {
|
|
894
915
|
if (!usageRecorded(env))
|
|
895
916
|
return;
|
|
896
917
|
try {
|
|
@@ -908,8 +929,8 @@ var LEVEL_OPTIONS = {
|
|
|
908
929
|
};
|
|
909
930
|
var TOP_OPTIONS = { ...LEVEL_OPTIONS, version: { type: "boolean", short: "v", description: "print the version" } };
|
|
910
931
|
function printError(prefix, message, hint, cause) {
|
|
911
|
-
const colors = paint(
|
|
912
|
-
const styled = takesControlCodes(
|
|
932
|
+
const colors = paint(process10.stderr);
|
|
933
|
+
const styled = takesControlCodes(process10.stderr);
|
|
913
934
|
const head = styled ? `${colors.red.bold("error")} ${colors.dim(`${prefix}:`)}` : `error: ${prefix}:`;
|
|
914
935
|
const under = (label, text, tint) => text === undefined ? "" : `
|
|
915
936
|
${styled ? tint(label) : `${label}:`} ${text}`;
|
|
@@ -991,11 +1012,22 @@ async function printCandidates(found) {
|
|
|
991
1012
|
console.log(line);
|
|
992
1013
|
return 0;
|
|
993
1014
|
}
|
|
994
|
-
|
|
1015
|
+
function packageVersion(entry = Bun.main) {
|
|
1016
|
+
for (let dir = dirname2(realpathSync(entry));; dir = dirname2(dir)) {
|
|
1017
|
+
try {
|
|
1018
|
+
const { version } = JSON.parse(readFileSync(join3(dir, "package.json"), "utf8"));
|
|
1019
|
+
if (typeof version === "string")
|
|
1020
|
+
return version;
|
|
1021
|
+
} catch {}
|
|
1022
|
+
if (dirname2(dir) === dir)
|
|
1023
|
+
return "0.0.0";
|
|
1024
|
+
}
|
|
1025
|
+
}
|
|
1026
|
+
async function runMain({ name, version, run, redact, usage }, argv = process10.argv.slice(2)) {
|
|
995
1027
|
if (argv[0] === COMPLETE)
|
|
996
1028
|
return printCandidates(leafCandidates(run, argv.slice(1)));
|
|
997
1029
|
if (argv.length === 1 && (argv[0] === "--version" || argv[0] === "-v")) {
|
|
998
|
-
console.log(version);
|
|
1030
|
+
console.log(version ?? packageVersion());
|
|
999
1031
|
return 0;
|
|
1000
1032
|
}
|
|
1001
1033
|
let code;
|
|
@@ -1004,8 +1036,11 @@ async function runMain({ name, version, run, redact, usage }, argv = process9.ar
|
|
|
1004
1036
|
} catch (error) {
|
|
1005
1037
|
code = reportThrown(name, error, redact, wantsJson(argv));
|
|
1006
1038
|
}
|
|
1007
|
-
if (usage !== false)
|
|
1008
|
-
|
|
1039
|
+
if (usage !== false) {
|
|
1040
|
+
try {
|
|
1041
|
+
recordUsage(usageEntry(name, undefined, argv, code));
|
|
1042
|
+
} catch {}
|
|
1043
|
+
}
|
|
1009
1044
|
return code;
|
|
1010
1045
|
}
|
|
1011
1046
|
// ../kit/src/secrets.ts
|
|
@@ -1015,17 +1050,17 @@ var {Glob } = globalThis.Bun;
|
|
|
1015
1050
|
var SESSION_FILES = new Glob("*.json");
|
|
1016
1051
|
var ACCOUNT_DIRS = new Glob("*/sessions");
|
|
1017
1052
|
// package.json
|
|
1018
|
-
var version = "0.
|
|
1053
|
+
var version = "0.12.1";
|
|
1019
1054
|
|
|
1020
1055
|
// src/fix.ts
|
|
1021
|
-
import { existsSync as
|
|
1056
|
+
import { existsSync as existsSync2, statSync } from "fs";
|
|
1022
1057
|
import { rename, writeFile as writeFile2 } from "fs/promises";
|
|
1023
|
-
import { join as
|
|
1058
|
+
import { join as join8 } from "path";
|
|
1024
1059
|
import process14 from "process";
|
|
1025
1060
|
|
|
1026
1061
|
// src/changes.ts
|
|
1027
1062
|
import { stat as stat2 } from "fs/promises";
|
|
1028
|
-
import { join as
|
|
1063
|
+
import { join as join4 } from "path";
|
|
1029
1064
|
var {$ } = globalThis.Bun;
|
|
1030
1065
|
async function dirtyFiles(dir) {
|
|
1031
1066
|
const listed = await $`git ls-files -z --modified --others --exclude-standard`.cwd(dir).quiet().nothrow();
|
|
@@ -1034,7 +1069,7 @@ async function dirtyFiles(dir) {
|
|
|
1034
1069
|
const files = new Map;
|
|
1035
1070
|
for (const path of listed.stdout.toString().split("\x00").filter(Boolean)) {
|
|
1036
1071
|
try {
|
|
1037
|
-
const { size, mtimeMs } = await stat2(
|
|
1072
|
+
const { size, mtimeMs } = await stat2(join4(dir, path));
|
|
1038
1073
|
files.set(path, `${size}:${mtimeMs}`);
|
|
1039
1074
|
} catch {
|
|
1040
1075
|
files.set(path, "");
|
|
@@ -1046,9 +1081,11 @@ function changedFiles(before, after) {
|
|
|
1046
1081
|
return [...after].filter(([path, hash]) => before.get(path) !== hash).map(([path]) => path);
|
|
1047
1082
|
}
|
|
1048
1083
|
|
|
1049
|
-
// src/
|
|
1050
|
-
import {
|
|
1051
|
-
import
|
|
1084
|
+
// src/compose.ts
|
|
1085
|
+
import { existsSync } from "fs";
|
|
1086
|
+
import { homedir as homedir3 } from "os";
|
|
1087
|
+
import { basename, dirname as dirname3, join as join5, relative, resolve } from "path";
|
|
1088
|
+
import process12 from "process";
|
|
1052
1089
|
|
|
1053
1090
|
// ../kit/src/shell.ts
|
|
1054
1091
|
var SEPARATORS = new Set([`
|
|
@@ -1059,13 +1096,16 @@ var COMMENT_PREFIXES = new Set([";", "&", "|", "(", ")"]);
|
|
|
1059
1096
|
var SAFE_WORD = /^[\w@%+=:,./-]+$/;
|
|
1060
1097
|
var DOUBLE_QUOTED_ESCAPES = new Set(["$", "`", '"', "\\"]);
|
|
1061
1098
|
var KEYWORDS = new Set(["then", "do", "else", "if", "elif", "while", "until", "!", "{", "}"]);
|
|
1062
|
-
var SHELLS = new Set(["sh", "bash", "zsh", "dash", "ash", "ksh"]);
|
|
1063
|
-
var
|
|
1099
|
+
var SHELLS = new Set(["sh", "bash", "zsh", "dash", "ash", "ksh", "fish", "csh", "tcsh", "nu", "xonsh", "elvish", "pwsh", "powershell"]);
|
|
1100
|
+
var SCANNED_PROGRAMS = new Set(["su", "runuser", "flock"]);
|
|
1101
|
+
var COMMAND_STRING_PROGRAMS = new Set([...SHELLS, ...SCANNED_PROGRAMS]);
|
|
1102
|
+
var POWERSHELL = new Set(["pwsh", "powershell"]);
|
|
1064
1103
|
var SHELL_VALUE_OPTIONS = new Set(["-o", "-O", "--rcfile", "--init-file"]);
|
|
1104
|
+
var FISH_VALUE_OPTIONS = new Set(["-C", "--init-command"]);
|
|
1065
1105
|
var PRINTERS = new Set(["echo", "printf"]);
|
|
1066
1106
|
var FIND_EXEC = new Set(["-exec", "-execdir", "-ok", "-okdir"]);
|
|
1067
|
-
function wrapper(short = "", long = [], operands = 0) {
|
|
1068
|
-
return { short, long, operands };
|
|
1107
|
+
function wrapper(short = "", long = [], operands = 0, runsString = false) {
|
|
1108
|
+
return { short, long, operands, runsString };
|
|
1069
1109
|
}
|
|
1070
1110
|
var WRAPPERS = new Map([
|
|
1071
1111
|
["command", wrapper()],
|
|
@@ -1083,6 +1123,11 @@ var WRAPPERS = new Map([
|
|
|
1083
1123
|
["ionice", wrapper("cnpPu", ["--class", "--classdata", "--pid", "--pgid", "--uid"])],
|
|
1084
1124
|
["stdbuf", wrapper("ioe", ["--input", "--output", "--error"])],
|
|
1085
1125
|
["chroot", wrapper("", ["--userspec", "--groups"], 1)],
|
|
1126
|
+
["watch", wrapper("n", ["--interval"], 0, true)],
|
|
1127
|
+
["flock", wrapper("wE", ["--timeout", "--conflict-exit-code"], 1)],
|
|
1128
|
+
["parallel", wrapper("jnNSaIPlLdTsC", ["--jobs", "--max-args", "--max-replace-args", "--sshlogin", "--arg-file", "--delimiter", "--colsep"], 0, true)],
|
|
1129
|
+
["unbuffer", wrapper()],
|
|
1130
|
+
["systemd-run", wrapper("puEMH", ["--property", "--unit", "--description", "--slice", "--setenv", "--machine", "--host", "--uid", "--gid", "--working-directory", "--nice", "--service-type"])],
|
|
1086
1131
|
["xargs", wrapper("IndsEaPL", ["--max-args", "--max-procs", "--max-chars", "--delimiter", "--arg-file", "--eof", "--max-lines", "--process-slot-var"])]
|
|
1087
1132
|
]);
|
|
1088
1133
|
function shellQuote(word) {
|
|
@@ -1090,10 +1135,6 @@ function shellQuote(word) {
|
|
|
1090
1135
|
}
|
|
1091
1136
|
|
|
1092
1137
|
// src/compose.ts
|
|
1093
|
-
import { existsSync } from "fs";
|
|
1094
|
-
import { homedir as homedir3 } from "os";
|
|
1095
|
-
import { basename, dirname as dirname2, join as join4, relative, resolve } from "path";
|
|
1096
|
-
import process11 from "process";
|
|
1097
1138
|
var COMPOSE_FILES = ["compose.yaml", "compose.yml", "docker-compose.yaml", "docker-compose.yml"];
|
|
1098
1139
|
var OVERRIDE_FILES = ["compose.override.yaml", "compose.override.yml", "docker-compose.override.yaml", "docker-compose.override.yml"];
|
|
1099
1140
|
var PS_TIMEOUT_MS = 20000;
|
|
@@ -1122,7 +1163,7 @@ function toolWords(program) {
|
|
|
1122
1163
|
}
|
|
1123
1164
|
async function readFiles(dir, names) {
|
|
1124
1165
|
for (const name of names) {
|
|
1125
|
-
const handle = Bun.file(
|
|
1166
|
+
const handle = Bun.file(join5(dir, name));
|
|
1126
1167
|
if (await handle.exists())
|
|
1127
1168
|
return { name, text: await handle.text() };
|
|
1128
1169
|
}
|
|
@@ -1137,7 +1178,7 @@ async function variables(composeDir) {
|
|
|
1137
1178
|
if (match !== null && !line.trimStart().startsWith("#"))
|
|
1138
1179
|
env[match[1] ?? ""] = (match[2] ?? "").trim().replace(QUOTED, "$2");
|
|
1139
1180
|
}
|
|
1140
|
-
for (const [key, value] of Object.entries(
|
|
1181
|
+
for (const [key, value] of Object.entries(process12.env)) {
|
|
1141
1182
|
if (value !== undefined)
|
|
1142
1183
|
env[key] = value;
|
|
1143
1184
|
}
|
|
@@ -1157,7 +1198,7 @@ function interpolate(text, env) {
|
|
|
1157
1198
|
function bindSource(source, composeDir, env) {
|
|
1158
1199
|
const path = interpolate(source, env);
|
|
1159
1200
|
if (path.startsWith("~"))
|
|
1160
|
-
return
|
|
1201
|
+
return join5(homedir3(), path.slice(1));
|
|
1161
1202
|
if (path.startsWith("/"))
|
|
1162
1203
|
return resolve(path);
|
|
1163
1204
|
return path.startsWith(".") ? resolve(composeDir, path) : undefined;
|
|
@@ -1204,7 +1245,7 @@ async function composeFiles(composeDir, env) {
|
|
|
1204
1245
|
for (const name of listed.split(separator === undefined || separator === "" ? ":" : separator).filter((entry) => entry !== "")) {
|
|
1205
1246
|
const file = Bun.file(resolve(composeDir, name));
|
|
1206
1247
|
if (!await file.exists())
|
|
1207
|
-
fail(`COMPOSE_FILE names ${
|
|
1248
|
+
fail(`COMPOSE_FILE names ${join5(composeDir, name)}, which does not exist`, 1, "fix COMPOSE_FILE, or run on the host with --host");
|
|
1208
1249
|
files.push({ name, text: await file.text() });
|
|
1209
1250
|
}
|
|
1210
1251
|
return files;
|
|
@@ -1226,7 +1267,7 @@ async function readServices(composeDir) {
|
|
|
1226
1267
|
try {
|
|
1227
1268
|
parsed = parseServices(file.text, composeDir, env);
|
|
1228
1269
|
} catch (error) {
|
|
1229
|
-
fail(`cannot read ${
|
|
1270
|
+
fail(`cannot read ${join5(composeDir, file.name)}: ${error instanceof Error ? error.message : String(error)}`, 1, "fix the file, or run on the host with --host");
|
|
1230
1271
|
}
|
|
1231
1272
|
for (const [name, extra] of parsed) {
|
|
1232
1273
|
const known = services.get(name);
|
|
@@ -1238,11 +1279,11 @@ async function readServices(composeDir) {
|
|
|
1238
1279
|
function climb(dir) {
|
|
1239
1280
|
const folders = [dir];
|
|
1240
1281
|
let current = dir;
|
|
1241
|
-
while (!existsSync(
|
|
1242
|
-
current =
|
|
1282
|
+
while (!existsSync(join5(current, ".git")) && dirname3(current) !== current) {
|
|
1283
|
+
current = dirname3(current);
|
|
1243
1284
|
folders.push(current);
|
|
1244
1285
|
}
|
|
1245
|
-
return existsSync(
|
|
1286
|
+
return existsSync(join5(current, ".git")) ? folders : [dir];
|
|
1246
1287
|
}
|
|
1247
1288
|
function containerPath(service, dir) {
|
|
1248
1289
|
const holding = service.mounts.filter((mount) => {
|
|
@@ -1253,7 +1294,7 @@ function containerPath(service, dir) {
|
|
|
1253
1294
|
if (deepest === undefined)
|
|
1254
1295
|
return;
|
|
1255
1296
|
const inside = relative(deepest.source, dir);
|
|
1256
|
-
return inside === "" ? deepest.target :
|
|
1297
|
+
return inside === "" ? deepest.target : join5(deepest.target, inside);
|
|
1257
1298
|
}
|
|
1258
1299
|
var noticed = new Set;
|
|
1259
1300
|
async function place(dir, program, { service, host } = {}) {
|
|
@@ -1273,7 +1314,7 @@ async function place(dir, program, { service, host } = {}) {
|
|
|
1273
1314
|
fail(`--in ${service}: no compose project mounts ${dir}`);
|
|
1274
1315
|
return;
|
|
1275
1316
|
}
|
|
1276
|
-
if (Bun.which("docker", { PATH:
|
|
1317
|
+
if (Bun.which("docker", { PATH: process12.env.PATH ?? "" }) === null) {
|
|
1277
1318
|
if (service !== undefined)
|
|
1278
1319
|
fail(`--in ${service}: docker not found`);
|
|
1279
1320
|
if (!noticed.has(found.composeDir)) {
|
|
@@ -1325,7 +1366,7 @@ class Stack {
|
|
|
1325
1366
|
}
|
|
1326
1367
|
static async running(composeDir) {
|
|
1327
1368
|
try {
|
|
1328
|
-
const ran = await runCommand(["docker", "compose", "ps", "--services", "--status", "running"], { cwd: composeDir, env:
|
|
1369
|
+
const ran = await runCommand(["docker", "compose", "ps", "--services", "--status", "running"], { cwd: composeDir, env: process12.env, timeoutMs: PS_TIMEOUT_MS });
|
|
1329
1370
|
if (ran.code !== 0)
|
|
1330
1371
|
return `docker compose ps failed in ${composeDir}: ${ran.text.trim().split(`
|
|
1331
1372
|
`).at(-1) ?? `exit ${ran.code}`}`;
|
|
@@ -1356,16 +1397,42 @@ function placeSettings(values) {
|
|
|
1356
1397
|
return { service: values.in, host: values.host };
|
|
1357
1398
|
}
|
|
1358
1399
|
|
|
1359
|
-
// src/
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
var
|
|
1400
|
+
// src/makefile.ts
|
|
1401
|
+
var TARGET = /^([\w-]+(?:[ \t]+[\w-]+)*)[ \t]*::?(?!:?=)(.*)$/gm;
|
|
1402
|
+
var PHONY_LINE = /^\.PHONY:((?:.*\\\n)*.*)$/gm;
|
|
1403
|
+
var DEFINE_BLOCK = /^define\b.*\n(?:.*\n)*?endef\b.*$/gm;
|
|
1404
|
+
var BLANKS = /\s+/;
|
|
1405
|
+
var CONTINUATION = /\\\n/g;
|
|
1406
|
+
var EXTRA_BLANK_LINES = /\n\s*\n\s*\n/g;
|
|
1407
|
+
var LEADING_BLANK_LINES = /^\s*\n/;
|
|
1408
|
+
var TRAILING_WHITESPACE = /\s+$/;
|
|
1409
|
+
var FILE_LIKE = /[./]/;
|
|
1410
|
+
var PLACEHOLDER = "\x00phony\x00";
|
|
1411
|
+
function declarePhony(content, exists = () => false) {
|
|
1412
|
+
const declared = Array.from(content.matchAll(PHONY_LINE), (match) => match[1].replace(CONTINUATION, " ").split(BLANKS)).flat().filter((name) => name !== "");
|
|
1413
|
+
const found = Array.from(content.replace(DEFINE_BLOCK, "").matchAll(TARGET), (match) => ({ names: match[1].split(BLANKS), deps: match[2] })).filter(({ deps }) => !FILE_LIKE.test(deps)).flatMap(({ names }) => names).filter((name) => !exists(name));
|
|
1414
|
+
const targets = [...new Set([...declared, ...found])].sort((a, b) => a.localeCompare(b));
|
|
1415
|
+
let isFirst = true;
|
|
1416
|
+
const body = content.replace(PHONY_LINE, () => {
|
|
1417
|
+
const kept = isFirst ? PLACEHOLDER : "";
|
|
1418
|
+
isFirst = false;
|
|
1419
|
+
return kept;
|
|
1420
|
+
}).replace(EXTRA_BLANK_LINES, `
|
|
1421
|
+
|
|
1422
|
+
`).replace(LEADING_BLANK_LINES, "");
|
|
1423
|
+
const line = targets.length === 0 ? "" : `.PHONY: ${targets.join(" ")}`;
|
|
1424
|
+
const fixed = body.includes(PLACEHOLDER) || line === "" ? body.replace(PLACEHOLDER, () => line) : `${line}
|
|
1425
|
+
|
|
1426
|
+
${body}`;
|
|
1427
|
+
return { content: fixed.replace(LEADING_BLANK_LINES, "").replace(TRAILING_WHITESPACE, `
|
|
1428
|
+
`), targets };
|
|
1429
|
+
}
|
|
1363
1430
|
|
|
1364
1431
|
// src/steps.ts
|
|
1365
1432
|
import { readdir as readdir2 } from "fs/promises";
|
|
1366
|
-
import { join as
|
|
1433
|
+
import { join as join6 } from "path";
|
|
1367
1434
|
var STEP_NAMES = ["check", "typecheck", "lint", "test"];
|
|
1368
|
-
var
|
|
1435
|
+
var TARGET2 = /^@?([\w-]+)(?:[ \t][^:=\n]*)?:(?!=)/gm;
|
|
1369
1436
|
var JUSTFILES = ["justfile", "Justfile", ".justfile"];
|
|
1370
1437
|
var MAKEFILES = ["GNUmakefile", "makefile", "Makefile"];
|
|
1371
1438
|
var CS_FIXER_CONFIGS = [".php-cs-fixer.php", ".php-cs-fixer.dist.php"];
|
|
@@ -1375,7 +1442,7 @@ var PHPUNIT_CONFIGS = ["phpunit.xml", "phpunit.xml.dist", "phpunit.dist.xml"];
|
|
|
1375
1442
|
var SKIPPED = new Set(["node_modules", "vendor", "dist", "build", "var", "tmp", "coverage"]);
|
|
1376
1443
|
async function readFirst(dir, files) {
|
|
1377
1444
|
for (const file of files) {
|
|
1378
|
-
const handle = Bun.file(
|
|
1445
|
+
const handle = Bun.file(join6(dir, file));
|
|
1379
1446
|
if (await handle.exists())
|
|
1380
1447
|
return { file, text: await handle.text() };
|
|
1381
1448
|
}
|
|
@@ -1383,7 +1450,7 @@ async function readFirst(dir, files) {
|
|
|
1383
1450
|
}
|
|
1384
1451
|
async function read(dir, ...files) {
|
|
1385
1452
|
for (const file of files) {
|
|
1386
|
-
const handle = Bun.file(
|
|
1453
|
+
const handle = Bun.file(join6(dir, file));
|
|
1387
1454
|
if (await handle.exists())
|
|
1388
1455
|
return handle.text();
|
|
1389
1456
|
}
|
|
@@ -1394,11 +1461,11 @@ function scripts(file, text) {
|
|
|
1394
1461
|
const parsed = JSON.parse(text);
|
|
1395
1462
|
return parsed.scripts ?? {};
|
|
1396
1463
|
} catch {
|
|
1397
|
-
|
|
1464
|
+
fail(`${file} is not valid JSON`);
|
|
1398
1465
|
}
|
|
1399
1466
|
}
|
|
1400
1467
|
function targets(text) {
|
|
1401
|
-
return [...text.matchAll(
|
|
1468
|
+
return [...text.matchAll(TARGET2)].map((match) => match[1] ?? "");
|
|
1402
1469
|
}
|
|
1403
1470
|
async function recipes(dir, file, text) {
|
|
1404
1471
|
if (Bun.which("just") === null)
|
|
@@ -1443,7 +1510,7 @@ async function candidates(dir, bin) {
|
|
|
1443
1510
|
}
|
|
1444
1511
|
async function firstFile(dir, names) {
|
|
1445
1512
|
for (const name of names) {
|
|
1446
|
-
if (await Bun.file(
|
|
1513
|
+
if (await Bun.file(join6(dir, name)).exists())
|
|
1447
1514
|
return name;
|
|
1448
1515
|
}
|
|
1449
1516
|
return;
|
|
@@ -1470,9 +1537,9 @@ async function discoverProjects(dir) {
|
|
|
1470
1537
|
for (const entry of entries.toSorted((a, b) => a.name.localeCompare(b.name))) {
|
|
1471
1538
|
if (!entry.isDirectory() || entry.name.startsWith(".") || SKIPPED.has(entry.name))
|
|
1472
1539
|
continue;
|
|
1473
|
-
const steps = await discover(
|
|
1540
|
+
const steps = await discover(join6(dir, entry.name));
|
|
1474
1541
|
if (steps.length > 0)
|
|
1475
|
-
projects.push({ name: entry.name, dir:
|
|
1542
|
+
projects.push({ name: entry.name, dir: join6(dir, entry.name), steps });
|
|
1476
1543
|
}
|
|
1477
1544
|
return projects;
|
|
1478
1545
|
}
|
|
@@ -1484,81 +1551,38 @@ async function discover(dir) {
|
|
|
1484
1551
|
});
|
|
1485
1552
|
}
|
|
1486
1553
|
|
|
1487
|
-
// src/
|
|
1488
|
-
var
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
}
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
}
|
|
1514
|
-
return [...found];
|
|
1515
|
-
}
|
|
1516
|
-
function isBare(script, tool) {
|
|
1517
|
-
return tool.test(script.trim()) && script.trim().replace(tool, "").split(WHITESPACE).every((word) => word.startsWith("-") || word === "");
|
|
1518
|
-
}
|
|
1519
|
-
async function narrow2(step, dir, changed) {
|
|
1520
|
-
const script = step.source === "package.json" ? (await scriptText(dir, step.name))?.trim() : undefined;
|
|
1521
|
-
const full = (why) => ({ command: step.command, note: `in full, ${why}` });
|
|
1522
|
-
if (script !== undefined && step.name === "lint" && isBare(script, LINTERS)) {
|
|
1523
|
-
const files = changed.filter((path) => LINTABLE.has(extname(path)));
|
|
1524
|
-
return files.length === 0 ? { command: "true", note: "nothing changed to lint" } : { command: `${step.command} -- ${files.map(quote).join(" ")}`, note: `${files.length} changed file${files.length === 1 ? "" : "s"}` };
|
|
1525
|
-
}
|
|
1526
|
-
if (script !== undefined && step.name === "test" && isBare(script, TEST_RUNNER)) {
|
|
1527
|
-
const tests = new Set;
|
|
1528
|
-
for (const path of changed) {
|
|
1529
|
-
if (TEST_FILE.test(path)) {
|
|
1530
|
-
tests.add(path);
|
|
1531
|
-
} else {
|
|
1532
|
-
for (const test of siblingTests(path, (candidate) => existsSync2(join6(dir, candidate)))) {
|
|
1533
|
-
tests.add(test);
|
|
1534
|
-
}
|
|
1535
|
-
}
|
|
1536
|
-
}
|
|
1537
|
-
if (tests.size === 0)
|
|
1538
|
-
return full("no test sits next to the changed files");
|
|
1539
|
-
return { command: `${step.command} -- ${[...tests].map((test) => quote(`./${test}`)).join(" ")}`, note: `${tests.size} test file${tests.size === 1 ? "" : "s"}` };
|
|
1540
|
-
}
|
|
1541
|
-
return full(`${step.name} cannot be narrowed`);
|
|
1542
|
-
}
|
|
1543
|
-
function quote(path) {
|
|
1544
|
-
return `'${path.replaceAll("'", "'\\''")}'`;
|
|
1545
|
-
}
|
|
1546
|
-
async function scriptText(dir, name) {
|
|
1547
|
-
const text = await read(dir, "package.json");
|
|
1548
|
-
if (text === undefined)
|
|
1549
|
-
return;
|
|
1550
|
-
try {
|
|
1551
|
-
const value = JSON.parse(text).scripts?.[name];
|
|
1552
|
-
return typeof value === "string" ? value : undefined;
|
|
1553
|
-
} catch {
|
|
1554
|
-
return;
|
|
1555
|
-
}
|
|
1554
|
+
// src/options.ts
|
|
1555
|
+
var fixOptions = {
|
|
1556
|
+
list: { type: "boolean", short: "l", description: "print the steps (or, with --fix, the fixers) found, the commands that run them and where (host or service), without running them" },
|
|
1557
|
+
only: { type: "string", short: "o", description: `comma separated steps to run, among ${STEP_NAMES.join(", ")}; with --fix the fixers to run, by the names --list prints` },
|
|
1558
|
+
timeout: { type: "string", short: "t", description: "longest a step or fixer may run before it is ended (30s, 5m, 1h), none by default" },
|
|
1559
|
+
...placeOptions,
|
|
1560
|
+
json: jsonOption()
|
|
1561
|
+
};
|
|
1562
|
+
var options = {
|
|
1563
|
+
...fixOptions,
|
|
1564
|
+
fix: { type: "boolean", short: "f", description: "run the folder's fixers and formatters instead of the steps, as the fix bin does" },
|
|
1565
|
+
failed: { type: "boolean", description: "run only the steps that failed in the last run of this folder, read from the run folder" },
|
|
1566
|
+
changed: { type: "boolean", short: "c", description: "narrow lint and test to the files changed against HEAD (a bare linter script, a bare bun test script), every other step runs in full and says so" },
|
|
1567
|
+
slot: { type: "boolean", description: "run each step through slot, queued behind the machine-wide slots of the other sessions (needs the slot bin)" }
|
|
1568
|
+
};
|
|
1569
|
+
var COMMA = /\s*,\s*/;
|
|
1570
|
+
function pick(steps, only, noun = "step") {
|
|
1571
|
+
if (only === undefined)
|
|
1572
|
+
return steps;
|
|
1573
|
+
const names = only.split(COMMA).filter((name) => name !== "");
|
|
1574
|
+
if (names.length === 0)
|
|
1575
|
+
fail(`--only names no ${noun}, found ${steps.map((step) => step.name).join(", ")}`);
|
|
1576
|
+
const unknown = names.filter((name) => !steps.some((step) => step.name === name));
|
|
1577
|
+
if (unknown.length > 0)
|
|
1578
|
+
fail(`no ${unknown.join(", ")} ${noun} here, found ${[...new Set(steps.map((step) => step.name))].join(", ")}`);
|
|
1579
|
+
return steps.filter((step) => names.includes(step.name));
|
|
1556
1580
|
}
|
|
1557
1581
|
|
|
1558
1582
|
// src/run.ts
|
|
1559
|
-
import { mkdir as mkdir2, writeFile } from "fs/promises";
|
|
1560
|
-
import { basename as
|
|
1561
|
-
import
|
|
1583
|
+
import { mkdir as mkdir2, readdir as readdir3, stat as stat3, writeFile } from "fs/promises";
|
|
1584
|
+
import { basename as basename2, join as join7 } from "path";
|
|
1585
|
+
import process13 from "process";
|
|
1562
1586
|
|
|
1563
1587
|
// src/e2e.ts
|
|
1564
1588
|
var E2E_NOISE = [
|
|
@@ -1870,7 +1894,8 @@ var bunCheck = (lines) => {
|
|
|
1870
1894
|
return [...errors, ...lines.filter((line) => BUN_CHECK_SUMMARY.test(line))];
|
|
1871
1895
|
};
|
|
1872
1896
|
function bunCheckFields(block) {
|
|
1873
|
-
const attributes = Object.fromEntries([...block.
|
|
1897
|
+
const attributes = Object.fromEntries([...block.slice(0, block.indexOf(`
|
|
1898
|
+
`)).matchAll(BUN_CHECK_ATTRIBUTE)].map((match) => [match[1] ?? "", match[2] ?? ""]));
|
|
1874
1899
|
return {
|
|
1875
1900
|
file: attributes.file ?? "",
|
|
1876
1901
|
line: attributes.line ?? "",
|
|
@@ -2187,17 +2212,38 @@ function parseErrors(output) {
|
|
|
2187
2212
|
|
|
2188
2213
|
// src/run.ts
|
|
2189
2214
|
var LOG_MAX_AGE_MS = 3 * 24 * 60 * 60 * 1000;
|
|
2215
|
+
var RESULTS_FILE = "results.json";
|
|
2216
|
+
var runPrefix = (cwd) => `${basename2(cwd)}-${Bun.hash(cwd).toString(36)}-`;
|
|
2190
2217
|
async function logDirectory(cwd) {
|
|
2191
2218
|
const root = await privateLogDirectory("check");
|
|
2192
2219
|
await sweepLogs(root, LOG_MAX_AGE_MS);
|
|
2193
|
-
const path = join7(root, `${
|
|
2220
|
+
const path = join7(root, `${runPrefix(cwd)}${Date.now().toString(36)}-${process13.pid}`);
|
|
2194
2221
|
await mkdir2(path, { mode: 448 });
|
|
2195
2222
|
return path;
|
|
2196
2223
|
}
|
|
2224
|
+
async function lastFailed(cwd) {
|
|
2225
|
+
const root = await privateLogDirectory("check");
|
|
2226
|
+
const prefix = runPrefix(cwd);
|
|
2227
|
+
let latest;
|
|
2228
|
+
for (const name of await readdir3(root)) {
|
|
2229
|
+
if (!name.startsWith(prefix))
|
|
2230
|
+
continue;
|
|
2231
|
+
const file = join7(root, name, RESULTS_FILE);
|
|
2232
|
+
try {
|
|
2233
|
+
const { mtimeMs } = await stat3(file);
|
|
2234
|
+
if (latest === undefined || mtimeMs > latest.time)
|
|
2235
|
+
latest = { time: mtimeMs, file };
|
|
2236
|
+
} catch {}
|
|
2237
|
+
}
|
|
2238
|
+
if (latest === undefined)
|
|
2239
|
+
return;
|
|
2240
|
+
const results = JSON.parse(await Bun.file(latest.file).text());
|
|
2241
|
+
return results.filter((result) => !result.ok).map((result) => result.name);
|
|
2242
|
+
}
|
|
2197
2243
|
async function saveLog(output) {
|
|
2198
2244
|
const root = await privateLogDirectory("errs");
|
|
2199
2245
|
await sweepLogs(root);
|
|
2200
|
-
const path = join7(root, `${new Date().toISOString().replaceAll(/[:.]/g, "-")}-${
|
|
2246
|
+
const path = join7(root, `${new Date().toISOString().replaceAll(/[:.]/g, "-")}-${process13.pid}-${crypto.randomUUID().slice(0, 8)}.log`);
|
|
2201
2247
|
await writeFile(path, output, { mode: 384, flag: "wx" });
|
|
2202
2248
|
return path;
|
|
2203
2249
|
}
|
|
@@ -2205,7 +2251,7 @@ async function runStep(command, cwd, logFile, { env = {}, timeoutMs, held } = {}
|
|
|
2205
2251
|
const started = Date.now();
|
|
2206
2252
|
const { code, text, timedOut } = await runCommand(["sh", "-c", `${command} 2>&1`], {
|
|
2207
2253
|
cwd,
|
|
2208
|
-
env: { ...
|
|
2254
|
+
env: { ...process13.env, NO_COLOR: "1", FORCE_COLOR: "0", ...env },
|
|
2209
2255
|
...timeoutMs === undefined ? {} : { timeoutMs },
|
|
2210
2256
|
...held === undefined ? {} : { onStart: (child) => held.forward(child) }
|
|
2211
2257
|
});
|
|
@@ -2234,162 +2280,16 @@ function printOutcome(name, width, command, logFile, outcome) {
|
|
|
2234
2280
|
`));
|
|
2235
2281
|
}
|
|
2236
2282
|
|
|
2237
|
-
// src/check.ts
|
|
2238
|
-
var usage2 = `check [--only <steps>] [--changed] [--timeout <duration>] [--slot] [--in <service> | --host] [--list]
|
|
2239
|
-
|
|
2240
|
-
Runs the repo's check, typecheck, lint and test steps, from package.json scripts (through bun run), composer.json, a Justfile or a Makefile, and for PHP from phpstan.neon (typecheck), .php-cs-fixer.dist.php (lint, dry-run) and phpunit.xml.dist (test) when composer.json has no such script.
|
|
2241
|
-
A folder without steps but with subfolders that have some (api/ and client/) runs each one's, each line naming its subfolder.
|
|
2242
|
-
A step runs inside the docker compose service that bind-mounts its folder (found in compose.yml, compose.yaml or docker-compose.yml, up to the repository root), at the matching path; a service that is down is never started, the step fails naming it. --in picks the service, --host forces the host.
|
|
2243
|
-
A passing step is one line, a failing one shows only what failed, and each step's full output is saved to the file whose path ends its line.
|
|
2244
|
-
With --changed, lint and test run on the files changed against HEAD (staged, unstaged and untracked) when their script is a bare linter (keslint, eslint, oxlint) or a bare \`bun test\`: lint on the changed source files, test on the changed test files and the tests next to the changed sources. Every other step, and a test step finding no test for the diff, runs in full and the line says so.
|
|
2245
|
-
A step still running after --timeout is ended with everything it started, but not what it started inside a container.
|
|
2246
|
-
Exits 0 when every step passed, 1 when one failed, 2 on bad usage, when no step is found or when a step timed out.
|
|
2247
|
-
--json prints [{name, command, in?, ok, ms, log, failed?}] once every step ran, --list --json [{name, command, source, in?}], in the compose service the step ran in.`;
|
|
2248
|
-
var options = {
|
|
2249
|
-
list: { type: "boolean", short: "l", description: "print the steps found, the commands that run them and where (host or service), without running them" },
|
|
2250
|
-
only: { type: "string", short: "o", description: `comma separated steps to run, among ${STEP_NAMES.join(", ")}` },
|
|
2251
|
-
timeout: { type: "string", short: "t", description: "longest a step may run before it is ended (30s, 5m, 1h), none by default" },
|
|
2252
|
-
changed: { type: "boolean", short: "c", description: "narrow lint and test to the files changed against HEAD (a bare linter script, a bare bun test script), every other step runs in full and says so" },
|
|
2253
|
-
slot: { type: "boolean", description: "run each step through slot, queued behind the machine-wide slots of the other sessions (needs the slot bin)" },
|
|
2254
|
-
...placeOptions,
|
|
2255
|
-
json: jsonOption()
|
|
2256
|
-
};
|
|
2257
|
-
function slotted(command) {
|
|
2258
|
-
return `slot -- sh -c ${shellQuote(command)}`;
|
|
2259
|
-
}
|
|
2260
|
-
var COMMA = /\s*,\s*/;
|
|
2261
|
-
function pick(steps, only) {
|
|
2262
|
-
if (only === undefined)
|
|
2263
|
-
return steps;
|
|
2264
|
-
const names = only.split(COMMA).filter((name) => name !== "");
|
|
2265
|
-
if (names.length === 0)
|
|
2266
|
-
fail(`--only names no step, found ${steps.map((step) => step.name).join(", ")}`);
|
|
2267
|
-
const unknown = names.filter((name) => !steps.some((step) => step.name === name));
|
|
2268
|
-
if (unknown.length > 0)
|
|
2269
|
-
fail(`no ${unknown.join(", ")} step here, found ${[...new Set(steps.map((step) => step.name))].join(", ")}`);
|
|
2270
|
-
return steps.filter((step) => names.includes(step.name));
|
|
2271
|
-
}
|
|
2272
|
-
async function plan(steps, settings) {
|
|
2273
|
-
const planned = [];
|
|
2274
|
-
for (const { project, ...step } of steps)
|
|
2275
|
-
planned.push({ ...step, dir: project.dir, label: project.name === undefined ? step.name : `${project.name}/${step.name}`, placement: await place(project.dir, programOf(step.command), settings) });
|
|
2276
|
-
return planned;
|
|
2277
|
-
}
|
|
2278
|
-
async function narrowed(steps) {
|
|
2279
|
-
const cache = new Map;
|
|
2280
|
-
const result = [];
|
|
2281
|
-
for (const step of steps) {
|
|
2282
|
-
if (!cache.has(step.dir)) {
|
|
2283
|
-
const paths = await changedPaths(step.dir);
|
|
2284
|
-
if (paths === undefined)
|
|
2285
|
-
fail("--changed needs a git repository");
|
|
2286
|
-
cache.set(step.dir, paths);
|
|
2287
|
-
}
|
|
2288
|
-
const { command, note } = await narrow2(step, step.dir, cache.get(step.dir) ?? []);
|
|
2289
|
-
result.push({ ...step, command, note });
|
|
2290
|
-
}
|
|
2291
|
-
return result;
|
|
2292
|
-
}
|
|
2293
|
-
function launch(step) {
|
|
2294
|
-
return step.placement === undefined ? step.command : shellIn(step.placement, step.command);
|
|
2295
|
-
}
|
|
2296
|
-
async function check(args, cwd = process13.cwd()) {
|
|
2297
|
-
const parsed = parse(args, usage2, options, { replaces: "chaining docker compose exec <service> bun run check | tail, lint and test by hand, or bun run check && bun run lint && bun run test read through tail", examples: ["check", ["check --only lint,test", "two of the steps"], ["check --in app", "every step inside the app service"]] });
|
|
2298
|
-
const settings = placeSettings(parsed.values);
|
|
2299
|
-
const projects = await discoverProjects(cwd);
|
|
2300
|
-
const found = projects.flatMap((project) => project.steps.map((step) => ({ ...step, project })));
|
|
2301
|
-
if (found.length === 0)
|
|
2302
|
-
fail(`no ${STEP_NAMES.join(", ")} step in package.json, composer.json, a Justfile, a Makefile or a PHP tool's config, nor in a subfolder`);
|
|
2303
|
-
const planned = await plan(pick(found, parsed.values.only), settings);
|
|
2304
|
-
const steps = parsed.values.changed === true ? await narrowed(planned) : planned;
|
|
2305
|
-
const json = parsed.values.json === true;
|
|
2306
|
-
if (parsed.values.list === true) {
|
|
2307
|
-
if (json)
|
|
2308
|
-
printJson(steps.map(({ label, command, source, placement }) => ({ name: label, command, source, ...placement === undefined ? {} : { in: placement.service } })));
|
|
2309
|
-
else
|
|
2310
|
-
console.log(table(steps.map((step) => [step.label, step.command, step.source, step.placement?.service ?? "host"])));
|
|
2311
|
-
return 0;
|
|
2312
|
-
}
|
|
2313
|
-
if (parsed.values.slot === true && Bun.which("slot", { PATH: process13.env.PATH ?? "" }) === null)
|
|
2314
|
-
fail("--slot needs the slot bin: bun install -g @kaynooo/cli-wait");
|
|
2315
|
-
const timeoutMs = parsed.values.timeout === undefined ? undefined : duration(parsed.values.timeout, "timeout", 0);
|
|
2316
|
-
const directory = await logDirectory(cwd);
|
|
2317
|
-
const held = holdSignals();
|
|
2318
|
-
const stack = new Stack;
|
|
2319
|
-
const width = Math.max(...steps.map((step) => step.label.length));
|
|
2320
|
-
const outcomes = [];
|
|
2321
|
-
try {
|
|
2322
|
-
for (const step of steps) {
|
|
2323
|
-
const logFile = join8(directory, `${step.label.replaceAll("/", "-")}.log`);
|
|
2324
|
-
const down = step.placement === undefined ? undefined : await stack.problem(step.placement);
|
|
2325
|
-
const command = parsed.values.slot === true ? slotted(launch(step)) : launch(step);
|
|
2326
|
-
const outcome = down === undefined ? await runStep(command, step.dir, logFile, { ...timeoutMs === undefined ? {} : { timeoutMs }, held }) : await refusedStep(down, logFile);
|
|
2327
|
-
if (!json)
|
|
2328
|
-
printOutcome(step.label, width, `${step.command}${step.note === undefined ? "" : ` (${step.note})`}${step.placement === undefined ? "" : ` (in ${step.placement.service})`}`, logFile, outcome);
|
|
2329
|
-
outcomes.push(outcomeJson(step.label, step.command, logFile, outcome, step.placement?.service));
|
|
2330
|
-
if (held.signal !== undefined)
|
|
2331
|
-
break;
|
|
2332
|
-
}
|
|
2333
|
-
} finally {
|
|
2334
|
-
held.release();
|
|
2335
|
-
}
|
|
2336
|
-
if (json)
|
|
2337
|
-
printJson(outcomes);
|
|
2338
|
-
if (held.signal !== undefined)
|
|
2339
|
-
return exitCodeOf(null, held.signal);
|
|
2340
|
-
if (outcomes.some((outcome) => outcome.timedOut === true))
|
|
2341
|
-
return 2;
|
|
2342
|
-
return outcomes.every((outcome) => outcome.ok) ? 0 : 1;
|
|
2343
|
-
}
|
|
2344
|
-
|
|
2345
|
-
// src/makefile.ts
|
|
2346
|
-
var TARGET2 = /^([\w-]+(?:[ \t]+[\w-]+)*)[ \t]*::?(?!:?=)(.*)$/gm;
|
|
2347
|
-
var PHONY_LINE = /^\.PHONY:((?:.*\\\n)*.*)$/gm;
|
|
2348
|
-
var DEFINE_BLOCK = /^define\b.*\n(?:.*\n)*?endef\b.*$/gm;
|
|
2349
|
-
var BLANKS = /\s+/;
|
|
2350
|
-
var CONTINUATION = /\\\n/g;
|
|
2351
|
-
var EXTRA_BLANK_LINES = /\n\s*\n\s*\n/g;
|
|
2352
|
-
var LEADING_BLANK_LINES = /^\s*\n/;
|
|
2353
|
-
var TRAILING_WHITESPACE = /\s+$/;
|
|
2354
|
-
var FILE_LIKE = /[./]/;
|
|
2355
|
-
var PLACEHOLDER = "\x00phony\x00";
|
|
2356
|
-
function declarePhony(content, exists = () => false) {
|
|
2357
|
-
const declared = Array.from(content.matchAll(PHONY_LINE), (match) => match[1].replace(CONTINUATION, " ").split(BLANKS)).flat().filter((name) => name !== "");
|
|
2358
|
-
const found = Array.from(content.replace(DEFINE_BLOCK, "").matchAll(TARGET2), (match) => ({ names: match[1].split(BLANKS), deps: match[2] })).filter(({ deps }) => !FILE_LIKE.test(deps)).flatMap(({ names }) => names).filter((name) => !exists(name));
|
|
2359
|
-
const targets = [...new Set([...declared, ...found])].sort((a, b) => a.localeCompare(b));
|
|
2360
|
-
let isFirst = true;
|
|
2361
|
-
const body = content.replace(PHONY_LINE, () => {
|
|
2362
|
-
const kept = isFirst ? PLACEHOLDER : "";
|
|
2363
|
-
isFirst = false;
|
|
2364
|
-
return kept;
|
|
2365
|
-
}).replace(EXTRA_BLANK_LINES, `
|
|
2366
|
-
|
|
2367
|
-
`).replace(LEADING_BLANK_LINES, "");
|
|
2368
|
-
const line = targets.length === 0 ? "" : `.PHONY: ${targets.join(" ")}`;
|
|
2369
|
-
const fixed = body.includes(PLACEHOLDER) || line === "" ? body.replace(PLACEHOLDER, () => line) : `${line}
|
|
2370
|
-
|
|
2371
|
-
${body}`;
|
|
2372
|
-
return { content: fixed.replace(LEADING_BLANK_LINES, "").replace(TRAILING_WHITESPACE, `
|
|
2373
|
-
`), targets };
|
|
2374
|
-
}
|
|
2375
|
-
|
|
2376
2283
|
// src/fix.ts
|
|
2377
|
-
var
|
|
2284
|
+
var fixUsage = `fix [--only <fixers>] [--timeout <duration>] [--in <service> | --host] [--list]
|
|
2378
2285
|
|
|
2379
|
-
Runs the folder's fixers: the project's own \`fix\` script, else its \`lint:fix\` and \`format\` ones (package.json through bun run, composer.json, a Justfile or a Makefile), then the formatters its files call for: php-cs-fixer where configured and composer.json has no fixer, just --fmt, go fmt and go mod tidy, cargo fmt, ruff where configured, and every Makefile target declared .PHONY.
|
|
2286
|
+
Alias of \`check --fix\`. Runs the folder's fixers: the project's own \`fix\` script, else its \`lint:fix\` and \`format\` ones (package.json through bun run, composer.json, a Justfile or a Makefile), then the formatters its files call for: php-cs-fixer where configured and composer.json has no fixer, just --fmt, go fmt and go mod tidy, cargo fmt, ruff where configured, and every Makefile target declared .PHONY.
|
|
2380
2287
|
It looks at the folder itself only, so each package of a monorepo gets its own run.
|
|
2381
2288
|
A script or php-cs-fixer runs inside the docker compose service that bind-mounts the folder (found in compose.yml, compose.yaml or docker-compose.yml, up to the repository root), at the matching path; a service that is down is never started, the fixer fails naming it. The formatters run on the host. --in picks the service, --host forces the host.
|
|
2382
2289
|
Prints one line per fixer, what a failing one said, then the files the run changed. Each fixer's full output is saved to the file whose path ends its line.
|
|
2383
2290
|
A fixer still running after --timeout is ended with everything it started, but not what it started inside a container.
|
|
2384
2291
|
Exits 0 when every fixer ran or was skipped for a missing binary, 1 when one failed, 2 on bad usage, when nothing applies or when a fixer timed out.
|
|
2385
2292
|
--json prints {fixers: [{name, command, in?, ok, ms, log, failed?} or {name, command, skipped}], changed} once every fixer ran, changed null outside a git repository.`;
|
|
2386
|
-
var options2 = {
|
|
2387
|
-
list: { type: "boolean", short: "l", description: "print the fixers that apply, the commands that run them and where (host or service), without running them" },
|
|
2388
|
-
only: { type: "string", short: "o", description: "comma separated fixers to run, by the names --list prints" },
|
|
2389
|
-
timeout: { type: "string", short: "t", description: "longest a fixer may run before it is ended (30s, 5m, 1h), none by default" },
|
|
2390
|
-
...placeOptions,
|
|
2391
|
-
json: jsonOption()
|
|
2392
|
-
};
|
|
2393
2293
|
var RUNNING = "KAYNOOO_CLI_FIX";
|
|
2394
2294
|
var JUSTFILES2 = ["justfile", "Justfile", ".justfile"];
|
|
2395
2295
|
var RUFF_CONFIGS = ["ruff.toml", ".ruff.toml"];
|
|
@@ -2415,9 +2315,9 @@ async function toolFixers(dir) {
|
|
|
2415
2315
|
const ruff = await firstFile(dir, RUFF_CONFIGS) !== undefined || RUFF_SECTION.test(await read(dir, "pyproject.toml") ?? "");
|
|
2416
2316
|
if (makefile !== undefined) {
|
|
2417
2317
|
fixers.push({ name: "makefile", command: "declare every target .PHONY", source: makefile, write: async (cwd) => {
|
|
2418
|
-
const path =
|
|
2318
|
+
const path = join8(cwd, makefile);
|
|
2419
2319
|
const current = await Bun.file(path).text();
|
|
2420
|
-
const { content, targets } = declarePhony(current, (name) =>
|
|
2320
|
+
const { content, targets } = declarePhony(current, (name) => existsSync2(join8(cwd, name)));
|
|
2421
2321
|
if (content !== current)
|
|
2422
2322
|
await replaceFile(path, content);
|
|
2423
2323
|
return `.PHONY: ${targets.join(" ")}`;
|
|
@@ -2425,9 +2325,9 @@ async function toolFixers(dir) {
|
|
|
2425
2325
|
}
|
|
2426
2326
|
if (justfile !== undefined)
|
|
2427
2327
|
fixers.push({ name: "justfile", command: `just --justfile ${justfile} --fmt`, source: justfile, requires: "just" });
|
|
2428
|
-
if (await Bun.file(
|
|
2328
|
+
if (await Bun.file(join8(dir, "go.mod")).exists())
|
|
2429
2329
|
fixers.push({ name: "go", command: "go fmt ./... && go mod tidy", source: "go.mod", requires: "go" });
|
|
2430
|
-
if (await Bun.file(
|
|
2330
|
+
if (await Bun.file(join8(dir, "Cargo.toml")).exists())
|
|
2431
2331
|
fixers.push({ name: "rust", command: "cargo fmt", source: "Cargo.toml", requires: "cargo" });
|
|
2432
2332
|
if (ruff)
|
|
2433
2333
|
fixers.push({ name: "python", command: "ruff check --fix . && ruff format .", source: "ruff", requires: "ruff" });
|
|
@@ -2469,14 +2369,18 @@ function printChanged(changed) {
|
|
|
2469
2369
|
console.log(` and ${changed.length - MAX_CHANGED} more`);
|
|
2470
2370
|
}
|
|
2471
2371
|
async function fix(args, cwd = process14.cwd()) {
|
|
2472
|
-
const parsed = parse(args,
|
|
2473
|
-
|
|
2372
|
+
const parsed = parse(args, fixUsage, fixOptions, { replaces: "running each fixer and formatter by hand, or docker compose exec <service> bun run lint:fix", examples: ["fix", ["fix --list", "the fixers it would run"]] });
|
|
2373
|
+
return runFixers(parsed.values, cwd);
|
|
2374
|
+
}
|
|
2375
|
+
async function runFixers(values, cwd) {
|
|
2376
|
+
const parsed = { values };
|
|
2377
|
+
const settings = placeSettings(values);
|
|
2474
2378
|
if (process14.env[RUNNING] !== undefined)
|
|
2475
2379
|
fail("a fixer called fix again, which would recurse: give its script another command");
|
|
2476
2380
|
const found = await fixers(cwd);
|
|
2477
2381
|
if (found.length === 0)
|
|
2478
2382
|
fail("nothing to fix here: no fix, lint:fix or format script, php-cs-fixer config, Makefile, Justfile, go.mod, Cargo.toml nor ruff config");
|
|
2479
|
-
const picked = pick(found, parsed.values.only);
|
|
2383
|
+
const picked = pick(found, parsed.values.only, "fixer");
|
|
2480
2384
|
const placements = new Map;
|
|
2481
2385
|
for (const fixer of picked)
|
|
2482
2386
|
placements.set(fixer, runsInService(fixer) ? await place(cwd, programOf(fixer.command), settings) : undefined);
|
|
@@ -2509,7 +2413,7 @@ async function fix(args, cwd = process14.cwd()) {
|
|
|
2509
2413
|
ran.push({ name: fixer.name, command: fixer.command, skipped: `${fixer.requires} is not installed` });
|
|
2510
2414
|
continue;
|
|
2511
2415
|
}
|
|
2512
|
-
const logFile =
|
|
2416
|
+
const logFile = join8(directory, `fix-${fixer.name.replaceAll(":", "-")}.log`);
|
|
2513
2417
|
const placement = placements.get(fixer);
|
|
2514
2418
|
const down = placement === undefined ? undefined : await stack.problem(placement);
|
|
2515
2419
|
const outcome = down === undefined ? await runFixer(fixer, placement, cwd, logFile, runSettings) : await refusedStep(down, logFile);
|