@kaynooo/cli-check 0.18.0 → 0.18.2
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 +3 -2
- package/dist/cli.js +135 -80
- package/dist/errs-cli.js +112 -62
- package/dist/fix-cli.js +122 -69
- package/dist/j-cli.js +159 -107
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
// @bun
|
|
3
3
|
|
|
4
4
|
// src/cli.ts
|
|
5
|
-
import
|
|
5
|
+
import process21 from "process";
|
|
6
6
|
// ../kit/src/args.ts
|
|
7
7
|
import process10 from "process";
|
|
8
8
|
import { parseArgs } from "util";
|
|
9
9
|
|
|
10
10
|
// ../kit/src/format.ts
|
|
11
11
|
import process7 from "process";
|
|
12
|
+
|
|
12
13
|
// ../../node_modules/.bun/@kaynooo+utils@3.0.0+4c7ddab9986847c5/node_modules/@kaynooo/utils/dist/chunk-rxztfxgv.js
|
|
13
14
|
var N = new Map;
|
|
14
15
|
var Nt = /\s+\S*$/;
|
|
@@ -26,6 +27,7 @@ function ko(t, e, r = "...") {
|
|
|
26
27
|
}
|
|
27
28
|
var be = new Map(["\u20AC", "", "\u201A", "\u0192", "\u201E", "\u2026", "\u2020", "\u2021", "\u02C6", "\u2030", "\u0160", "\u2039", "\u0152", "", "\u017D", "", "", "\u2018", "\u2019", "\u201C", "\u201D", "\u2022", "\u2013", "\u2014", "\u02DC", "\u2122", "\u0161", "\u203A", "\u0153", "", "\u017E", "\u0178"].map((t, e) => [t, 128 + e]).filter(([t]) => t));
|
|
28
29
|
var z = new Map;
|
|
30
|
+
|
|
29
31
|
// ../kit/src/mode.ts
|
|
30
32
|
import process2 from "process";
|
|
31
33
|
var MODES = new Set(["terminal", "ci", "agent", "pipe"]);
|
|
@@ -74,7 +76,7 @@ function C(r, e = globalThis.process?.env ?? {}) {
|
|
|
74
76
|
return false;
|
|
75
77
|
return r?.isTTY === true;
|
|
76
78
|
}
|
|
77
|
-
function
|
|
79
|
+
function f(r, e = []) {
|
|
78
80
|
let l = "", n = "";
|
|
79
81
|
for (let t = 0, i = e.length;t < i; t++)
|
|
80
82
|
l += `\x1B[${e[t][0]}m`, n = `\x1B[${e[t][1]}m${n}`;
|
|
@@ -84,7 +86,7 @@ function f2(r, e = []) {
|
|
|
84
86
|
if (Array.isArray(a)) {
|
|
85
87
|
let s = g.get(i);
|
|
86
88
|
if (s === undefined)
|
|
87
|
-
s =
|
|
89
|
+
s = f(r, [...e, a]), g.set(i, s);
|
|
88
90
|
return s;
|
|
89
91
|
}
|
|
90
92
|
if (typeof a === "function")
|
|
@@ -93,20 +95,20 @@ function f2(r, e = []) {
|
|
|
93
95
|
if (u === undefined) {
|
|
94
96
|
if (g.size >= 64)
|
|
95
97
|
g.clear();
|
|
96
|
-
u =
|
|
98
|
+
u = f(r, [...e, a(...s)]), g.set(y, u);
|
|
97
99
|
}
|
|
98
100
|
return u;
|
|
99
101
|
};
|
|
100
102
|
throw Error(`Unknown style: ${String(i)}`);
|
|
101
103
|
} });
|
|
102
104
|
}
|
|
103
|
-
function
|
|
104
|
-
return
|
|
105
|
+
function Fe(r = {}) {
|
|
106
|
+
return f(r);
|
|
105
107
|
}
|
|
106
|
-
var
|
|
108
|
+
var o = Fe();
|
|
107
109
|
|
|
108
110
|
// ../kit/src/theme.ts
|
|
109
|
-
import { existsSync as
|
|
111
|
+
import { existsSync as existsSync3, readFileSync as readFileSync2, statSync } from "fs";
|
|
110
112
|
import { homedir as homedir2 } from "os";
|
|
111
113
|
import { join as join3, resolve as resolve2 } from "path";
|
|
112
114
|
import process5 from "process";
|
|
@@ -127,6 +129,7 @@ function findUp(names, from = process3.cwd(), stop = () => false) {
|
|
|
127
129
|
}
|
|
128
130
|
|
|
129
131
|
// ../kit/src/user-config.ts
|
|
132
|
+
import { existsSync as existsSync2, readFileSync } from "fs";
|
|
130
133
|
import { homedir } from "os";
|
|
131
134
|
import { join as join2 } from "path";
|
|
132
135
|
import process4 from "process";
|
|
@@ -137,6 +140,24 @@ function configBase(where = {}) {
|
|
|
137
140
|
function userConfigPath(bin, where = {}) {
|
|
138
141
|
return join2(configBase(where), "kaynooo-cli", `${bin}.json`);
|
|
139
142
|
}
|
|
143
|
+
function userConfigReadPath(bin, legacy = [], where = {}) {
|
|
144
|
+
const current = userConfigPath(bin, where);
|
|
145
|
+
if (existsSync2(current))
|
|
146
|
+
return current;
|
|
147
|
+
const base = configBase(where);
|
|
148
|
+
return legacy.map((parts) => join2(base, ...parts)).find((path) => existsSync2(path)) ?? current;
|
|
149
|
+
}
|
|
150
|
+
function readUserConfig(bin, where = {}, legacy = []) {
|
|
151
|
+
const path = userConfigReadPath(bin, legacy, where);
|
|
152
|
+
if (!existsSync2(path))
|
|
153
|
+
return {};
|
|
154
|
+
try {
|
|
155
|
+
const parsed = Bun.JSONC.parse(readFileSync(path, "utf8"));
|
|
156
|
+
return typeof parsed === "object" && parsed !== null && !Array.isArray(parsed) ? parsed : {};
|
|
157
|
+
} catch {
|
|
158
|
+
return {};
|
|
159
|
+
}
|
|
160
|
+
}
|
|
140
161
|
|
|
141
162
|
// ../kit/src/theme.ts
|
|
142
163
|
var ENDS = new Map;
|
|
@@ -203,7 +224,7 @@ function readThemeFile(path, warn) {
|
|
|
203
224
|
warn(`${path} is not a regular file under ${MAX_FILE_BYTES / 1024} KiB, theme ignored`);
|
|
204
225
|
return;
|
|
205
226
|
}
|
|
206
|
-
const parsed = JSON.parse(
|
|
227
|
+
const parsed = JSON.parse(readFileSync2(path, "utf8"));
|
|
207
228
|
if (isRecord(parsed))
|
|
208
229
|
return parsed;
|
|
209
230
|
warn(`${path} is not a JSON object, theme ignored`);
|
|
@@ -269,7 +290,7 @@ function applyFile(theme, file, where, warn) {
|
|
|
269
290
|
}
|
|
270
291
|
}
|
|
271
292
|
function endsWalk(home) {
|
|
272
|
-
return (dir) => dir === resolve2(home) ||
|
|
293
|
+
return (dir) => dir === resolve2(home) || existsSync3(join3(dir, ".git"));
|
|
273
294
|
}
|
|
274
295
|
var warned = new Set;
|
|
275
296
|
function warnOnce(message) {
|
|
@@ -325,7 +346,7 @@ function takesControlCodes(stream, env = process6.env) {
|
|
|
325
346
|
return stream.isTTY === true && env.NO_COLOR === undefined && env.NODE_DISABLE_COLORS === undefined && env.TERM !== "dumb" && outputMode(stream, env) === "terminal";
|
|
326
347
|
}
|
|
327
348
|
function paint(stream, env = process6.env) {
|
|
328
|
-
return
|
|
349
|
+
return Fe({ stream: { isTTY: takesControlCodes(stream, env) }, env });
|
|
329
350
|
}
|
|
330
351
|
function marked(mark, text, stream, detail, env = process6.env) {
|
|
331
352
|
const colors = paint(stream, env);
|
|
@@ -759,9 +780,33 @@ function nearestOption(message, options, allowNegative) {
|
|
|
759
780
|
const meant = closest(word, known.map((flag) => flag.replace(DASHES, "")));
|
|
760
781
|
return meant === undefined ? undefined : `did you mean ${known.find((flag) => flag.replace(DASHES, "") === meant)}?`;
|
|
761
782
|
}
|
|
783
|
+
// ../kit/src/argv.ts
|
|
784
|
+
import { readFileSync as readFileSync3, realpathSync } from "fs";
|
|
785
|
+
import { resolve as resolve3 } from "path";
|
|
786
|
+
import process11 from "process";
|
|
787
|
+
function commandLine() {
|
|
788
|
+
try {
|
|
789
|
+
return readFileSync3("/proc/self/cmdline", "utf8").split("\x00").slice(0, -1);
|
|
790
|
+
} catch {
|
|
791
|
+
return;
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
function realPath(word) {
|
|
795
|
+
try {
|
|
796
|
+
return realpathSync(resolve3(word));
|
|
797
|
+
} catch {
|
|
798
|
+
return;
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
function scriptArgs(argv = process11.argv.slice(2), cmdline = commandLine(), script = process11.argv[1]) {
|
|
802
|
+
const target = script === undefined ? undefined : realPath(script) ?? script;
|
|
803
|
+
const at = cmdline === undefined || target === undefined ? -1 : cmdline.findIndex((word, index) => index > 0 && (resolve3(word) === script || realPath(word) === target));
|
|
804
|
+
const after = at === -1 ? [] : cmdline.slice(at + 1);
|
|
805
|
+
return after[0] === "--" && after.length === argv.length + 1 && argv.every((word, index) => word === after[index + 1]) ? after : argv;
|
|
806
|
+
}
|
|
762
807
|
// ../kit/src/process.ts
|
|
763
808
|
import { constants } from "os";
|
|
764
|
-
import
|
|
809
|
+
import process12 from "process";
|
|
765
810
|
var KILL_GRACE_MS = 2000;
|
|
766
811
|
var SIGNALS = ["SIGINT", "SIGTERM", "SIGHUP"];
|
|
767
812
|
function exitCodeOf(code, signal) {
|
|
@@ -783,7 +828,7 @@ function holdSignals(cleanup) {
|
|
|
783
828
|
},
|
|
784
829
|
release: () => {
|
|
785
830
|
for (const signal of SIGNALS)
|
|
786
|
-
|
|
831
|
+
process12.off(signal, onSignal);
|
|
787
832
|
}
|
|
788
833
|
};
|
|
789
834
|
function onSignal(signal) {
|
|
@@ -796,10 +841,10 @@ function holdSignals(cleanup) {
|
|
|
796
841
|
return;
|
|
797
842
|
held.release();
|
|
798
843
|
cleanup(signal);
|
|
799
|
-
|
|
844
|
+
process12.kill(process12.pid, signal);
|
|
800
845
|
}
|
|
801
846
|
for (const signal of SIGNALS)
|
|
802
|
-
|
|
847
|
+
process12.on(signal, onSignal);
|
|
803
848
|
return held;
|
|
804
849
|
}
|
|
805
850
|
async function runCommand(argv, { cwd, env, stdin = "ignore", timeoutMs, signal, maxBytes = Infinity, onChunk, onStart } = {}) {
|
|
@@ -813,7 +858,7 @@ async function runCommand(argv, { cwd, env, stdin = "ignore", timeoutMs, signal,
|
|
|
813
858
|
return;
|
|
814
859
|
try {
|
|
815
860
|
if (grouped)
|
|
816
|
-
|
|
861
|
+
process12.kill(-proc.pid, killing);
|
|
817
862
|
else
|
|
818
863
|
proc.kill(killing);
|
|
819
864
|
} catch {}
|
|
@@ -887,33 +932,33 @@ var ESCAPE_CODE = new RegExp(`${ESC}(?:\\[[\\x30-\\x3F]*[\\x20-\\x2F]*[\\x40-\\x
|
|
|
887
932
|
var RESET_STYLE = `${ESC}[0m`;
|
|
888
933
|
var CLOSE_LINK = `${ESC}]8;;${ESC}\\`;
|
|
889
934
|
// ../kit/src/cli.ts
|
|
890
|
-
import { readFileSync as
|
|
935
|
+
import { readFileSync as readFileSync4, realpathSync as realpathSync2 } from "fs";
|
|
891
936
|
import { dirname as dirname3, join as join6 } from "path";
|
|
892
|
-
import
|
|
937
|
+
import process15 from "process";
|
|
893
938
|
|
|
894
939
|
// ../kit/src/usage.ts
|
|
895
940
|
import { appendFileSync, mkdirSync } from "fs";
|
|
896
941
|
import { homedir as homedir4 } from "os";
|
|
897
942
|
import { dirname as dirname2, isAbsolute, join as join5 } from "path";
|
|
898
|
-
import
|
|
943
|
+
import process14 from "process";
|
|
899
944
|
|
|
900
945
|
// ../kit/src/logs.ts
|
|
901
946
|
import { lstatSync, openSync } from "fs";
|
|
902
947
|
import { mkdir, mkdtemp, readdir, rm, stat } from "fs/promises";
|
|
903
948
|
import { homedir as homedir3, tmpdir } from "os";
|
|
904
949
|
import { join as join4 } from "path";
|
|
905
|
-
import
|
|
950
|
+
import process13 from "process";
|
|
906
951
|
var DAY_MS = 24 * 60 * 60 * 1000;
|
|
907
952
|
var CLI_FOLDER = "kaynooo-cli";
|
|
908
953
|
function isPrivateDirectory(path) {
|
|
909
954
|
try {
|
|
910
955
|
const info = lstatSync(path, { throwIfNoEntry: false });
|
|
911
|
-
return info !== undefined && info.isDirectory() && info.uid === (
|
|
956
|
+
return info !== undefined && info.isDirectory() && info.uid === (process13.getuid?.() ?? info.uid) && (info.mode & 63) === 0;
|
|
912
957
|
} catch {
|
|
913
958
|
return false;
|
|
914
959
|
}
|
|
915
960
|
}
|
|
916
|
-
async function privateLogDirectory(name, env =
|
|
961
|
+
async function privateLogDirectory(name, env = process13.env) {
|
|
917
962
|
const runtime = env.XDG_RUNTIME_DIR;
|
|
918
963
|
const base = runtime === undefined || runtime === "" ? join4(homedir3(), ".cache", CLI_FOLDER) : join4(runtime, CLI_FOLDER);
|
|
919
964
|
const path = join4(base, name);
|
|
@@ -953,14 +998,14 @@ var usageError;
|
|
|
953
998
|
function noteUsageError(message) {
|
|
954
999
|
usageError = message;
|
|
955
1000
|
}
|
|
956
|
-
function stateHome(env =
|
|
1001
|
+
function stateHome(env = process14.env) {
|
|
957
1002
|
const dir = env.XDG_STATE_HOME;
|
|
958
1003
|
return dir !== undefined && isAbsolute(dir) ? dir : join5(homedir4(), ".local", "state");
|
|
959
1004
|
}
|
|
960
|
-
function usagePath(env =
|
|
1005
|
+
function usagePath(env = process14.env) {
|
|
961
1006
|
return join5(stateHome(env), CLI_FOLDER, "usage.jsonl");
|
|
962
1007
|
}
|
|
963
|
-
function usageRecorded(env =
|
|
1008
|
+
function usageRecorded(env = process14.env) {
|
|
964
1009
|
const off = env.KAYNOOO_CLI_NO_USAGE;
|
|
965
1010
|
return env.NODE_ENV !== "test" && (off === undefined || off === "" || off === "0");
|
|
966
1011
|
}
|
|
@@ -974,7 +1019,7 @@ function usageEntry(bin, command, argv, code, now = new Date) {
|
|
|
974
1019
|
usageError = undefined;
|
|
975
1020
|
return { at: now.toISOString(), bin, ...command === undefined ? {} : { command }, flags: flagNames(argv), code, ...unknown === undefined ? {} : { unknown } };
|
|
976
1021
|
}
|
|
977
|
-
function recordUsage(entry, env =
|
|
1022
|
+
function recordUsage(entry, env = process14.env) {
|
|
978
1023
|
if (!usageRecorded(env))
|
|
979
1024
|
return;
|
|
980
1025
|
try {
|
|
@@ -992,8 +1037,8 @@ var LEVEL_OPTIONS = {
|
|
|
992
1037
|
};
|
|
993
1038
|
var TOP_OPTIONS = { ...LEVEL_OPTIONS, version: { type: "boolean", short: "v", description: "print the version" } };
|
|
994
1039
|
function printError(prefix, message, hint, cause) {
|
|
995
|
-
const colors = paint(
|
|
996
|
-
const styled = takesControlCodes(
|
|
1040
|
+
const colors = paint(process15.stderr);
|
|
1041
|
+
const styled = takesControlCodes(process15.stderr);
|
|
997
1042
|
const head = styled ? `${colors.red.bold("error")} ${colors.dim(`${prefix}:`)}` : `error: ${prefix}:`;
|
|
998
1043
|
const under = (label, text, tint) => text === undefined ? "" : `
|
|
999
1044
|
${styled ? tint(label) : `${label}:`} ${text}`;
|
|
@@ -1037,24 +1082,24 @@ function candidateLine(candidate) {
|
|
|
1037
1082
|
}
|
|
1038
1083
|
function positionalBeingTyped(before, { options, positionals }) {
|
|
1039
1084
|
const takesValue = (word) => !word.includes("=") && Object.entries(options).some(([name, { short, type }]) => type === "string" && (word === `--${name}` || word === `-${short}`));
|
|
1040
|
-
|
|
1085
|
+
const typed = [];
|
|
1041
1086
|
let at = 0;
|
|
1042
1087
|
while (at < before.length) {
|
|
1043
1088
|
const word = before[at];
|
|
1044
1089
|
if (word === "--") {
|
|
1045
|
-
|
|
1090
|
+
typed.push(...before.slice(at + 1));
|
|
1046
1091
|
break;
|
|
1047
1092
|
}
|
|
1048
1093
|
if (!word.startsWith("-"))
|
|
1049
|
-
|
|
1094
|
+
typed.push(word);
|
|
1050
1095
|
else if (takesValue(word))
|
|
1051
1096
|
at++;
|
|
1052
1097
|
at++;
|
|
1053
1098
|
}
|
|
1054
1099
|
const last = positionals.at(-1);
|
|
1055
|
-
if (
|
|
1056
|
-
return positionals[
|
|
1057
|
-
return last?.replace("]", "").endsWith("...") === true ? last : undefined;
|
|
1100
|
+
if (typed.length < positionals.length)
|
|
1101
|
+
return { name: positionals[typed.length], typed };
|
|
1102
|
+
return { name: last?.replace("]", "").endsWith("...") === true ? last : undefined, typed };
|
|
1058
1103
|
}
|
|
1059
1104
|
async function leafCandidates(run, words) {
|
|
1060
1105
|
const completing = await completingOf(run);
|
|
@@ -1062,12 +1107,12 @@ async function leafCandidates(run, words) {
|
|
|
1062
1107
|
return Object.entries(completing.options).map(([name, option]) => option.description === undefined ? `--${name}` : `--${name} ${option.description}`);
|
|
1063
1108
|
const flag = words.at(-2);
|
|
1064
1109
|
const option = flag?.startsWith("-") === true ? Object.entries(completing.options).find(([name, { short }]) => flag === `--${name}` || flag === `-${short}`)?.[1] : undefined;
|
|
1110
|
+
const { name, typed } = positionalBeingTyped(words.slice(0, -1), completing);
|
|
1065
1111
|
if (option?.type === "string") {
|
|
1066
|
-
const values = option.choices === undefined ? await option.candidates?.() : option.choices;
|
|
1112
|
+
const values = option.choices === undefined ? await option.candidates?.(typed) : option.choices;
|
|
1067
1113
|
return values === undefined ? [FILES] : values.map(candidateLine);
|
|
1068
1114
|
}
|
|
1069
|
-
const
|
|
1070
|
-
const values = name === undefined ? undefined : await completing.candidates[name]?.();
|
|
1115
|
+
const values = name === undefined ? undefined : await completing.candidates[name]?.(typed);
|
|
1071
1116
|
return values === undefined ? [FILES] : values.map(candidateLine);
|
|
1072
1117
|
}
|
|
1073
1118
|
async function printCandidates(found) {
|
|
@@ -1076,9 +1121,9 @@ async function printCandidates(found) {
|
|
|
1076
1121
|
return 0;
|
|
1077
1122
|
}
|
|
1078
1123
|
function packageVersion(entry = Bun.main) {
|
|
1079
|
-
for (let dir = dirname3(
|
|
1124
|
+
for (let dir = dirname3(realpathSync2(entry));; dir = dirname3(dir)) {
|
|
1080
1125
|
try {
|
|
1081
|
-
const { version } = JSON.parse(
|
|
1126
|
+
const { version } = JSON.parse(readFileSync4(join6(dir, "package.json"), "utf8"));
|
|
1082
1127
|
if (typeof version === "string")
|
|
1083
1128
|
return version;
|
|
1084
1129
|
} catch {}
|
|
@@ -1086,7 +1131,7 @@ function packageVersion(entry = Bun.main) {
|
|
|
1086
1131
|
return "0.0.0";
|
|
1087
1132
|
}
|
|
1088
1133
|
}
|
|
1089
|
-
async function runMain({ name, version, run, redact, usage }, argv =
|
|
1134
|
+
async function runMain({ name, version, run, redact, usage }, argv = scriptArgs()) {
|
|
1090
1135
|
if (argv[0] === COMPLETE)
|
|
1091
1136
|
return printCandidates(leafCandidates(run, argv.slice(1)));
|
|
1092
1137
|
if (argv.length === 1 && (argv[0] === "--version" || argv[0] === "-v")) {
|
|
@@ -1108,6 +1153,11 @@ async function runMain({ name, version, run, redact, usage }, argv = process14.a
|
|
|
1108
1153
|
}
|
|
1109
1154
|
// ../kit/src/folders.ts
|
|
1110
1155
|
var SKIPPED_FOLDERS = new Set(["node_modules", "vendor", "dist", "build", "target", "coverage", "venv", "__pycache__"]);
|
|
1156
|
+
function ignoredFolders(extra = [], where = {}) {
|
|
1157
|
+
const configured = readUserConfig("config", where).ignore;
|
|
1158
|
+
const names = Array.isArray(configured) ? configured.filter((name) => typeof name === "string" && name !== "") : [];
|
|
1159
|
+
return new Set([...SKIPPED_FOLDERS, ...extra, ...names]);
|
|
1160
|
+
}
|
|
1111
1161
|
// ../kit/src/secrets.ts
|
|
1112
1162
|
var SECRET_WORDS = new Set(["key", "pass", "pwd", "auth", "salt", "cookie", "session", "jwt", "ssn", "iban", "card", "cvv", "otp"]);
|
|
1113
1163
|
// ../kit/src/sessions.ts
|
|
@@ -1115,12 +1165,12 @@ var {Glob } = globalThis.Bun;
|
|
|
1115
1165
|
var SESSION_FILES = new Glob("*.json");
|
|
1116
1166
|
var ACCOUNT_DIRS = new Glob("*/sessions");
|
|
1117
1167
|
// package.json
|
|
1118
|
-
var version = "0.18.
|
|
1168
|
+
var version = "0.18.2";
|
|
1119
1169
|
|
|
1120
1170
|
// src/check.ts
|
|
1121
1171
|
import { writeFile as writeFile3 } from "fs/promises";
|
|
1122
1172
|
import { basename as basename4, join as join13 } from "path";
|
|
1123
|
-
import
|
|
1173
|
+
import process20 from "process";
|
|
1124
1174
|
|
|
1125
1175
|
// ../kit/src/shell.ts
|
|
1126
1176
|
var SEPARATORS = new Set([`
|
|
@@ -1170,10 +1220,10 @@ function shellQuote(word) {
|
|
|
1170
1220
|
}
|
|
1171
1221
|
|
|
1172
1222
|
// src/compose.ts
|
|
1173
|
-
import { existsSync as
|
|
1223
|
+
import { existsSync as existsSync4 } from "fs";
|
|
1174
1224
|
import { homedir as homedir5 } from "os";
|
|
1175
|
-
import { basename, dirname as dirname4, join as join7, relative, resolve as
|
|
1176
|
-
import
|
|
1225
|
+
import { basename, dirname as dirname4, join as join7, relative, resolve as resolve4 } from "path";
|
|
1226
|
+
import process17 from "process";
|
|
1177
1227
|
var COMPOSE_FILES = ["compose.yaml", "compose.yml", "docker-compose.yaml", "docker-compose.yml"];
|
|
1178
1228
|
var OVERRIDE_FILES = ["compose.override.yaml", "compose.override.yml", "docker-compose.override.yaml", "docker-compose.override.yml"];
|
|
1179
1229
|
var PS_TIMEOUT_MS = 20000;
|
|
@@ -1217,7 +1267,7 @@ async function variables(composeDir) {
|
|
|
1217
1267
|
if (match !== null && !line.trimStart().startsWith("#"))
|
|
1218
1268
|
env[match[1] ?? ""] = (match[2] ?? "").trim().replace(QUOTED, "$2");
|
|
1219
1269
|
}
|
|
1220
|
-
for (const [key, value] of Object.entries(
|
|
1270
|
+
for (const [key, value] of Object.entries(process17.env)) {
|
|
1221
1271
|
if (value !== undefined)
|
|
1222
1272
|
env[key] = value;
|
|
1223
1273
|
}
|
|
@@ -1239,8 +1289,8 @@ function bindSource(source, composeDir, env) {
|
|
|
1239
1289
|
if (path.startsWith("~"))
|
|
1240
1290
|
return join7(homedir5(), path.slice(1));
|
|
1241
1291
|
if (path.startsWith("/"))
|
|
1242
|
-
return
|
|
1243
|
-
return path.startsWith(".") ?
|
|
1292
|
+
return resolve4(path);
|
|
1293
|
+
return path.startsWith(".") ? resolve4(composeDir, path) : undefined;
|
|
1244
1294
|
}
|
|
1245
1295
|
function mountsOf(volumes, composeDir, env) {
|
|
1246
1296
|
if (!Array.isArray(volumes))
|
|
@@ -1282,7 +1332,7 @@ async function composeFiles(composeDir, env) {
|
|
|
1282
1332
|
const files = [];
|
|
1283
1333
|
const separator = env.COMPOSE_PATH_SEPARATOR;
|
|
1284
1334
|
for (const name of listed.split(separator === undefined || separator === "" ? ":" : separator).filter((entry) => entry !== "")) {
|
|
1285
|
-
const file = Bun.file(
|
|
1335
|
+
const file = Bun.file(resolve4(composeDir, name));
|
|
1286
1336
|
if (!await file.exists())
|
|
1287
1337
|
fail(`COMPOSE_FILE names ${join7(composeDir, name)}, which does not exist`, 1, "fix COMPOSE_FILE, or run on the host with --host");
|
|
1288
1338
|
files.push({ name, text: await file.text() });
|
|
@@ -1318,11 +1368,11 @@ async function readServices(composeDir) {
|
|
|
1318
1368
|
function climb(dir) {
|
|
1319
1369
|
const folders = [dir];
|
|
1320
1370
|
let current = dir;
|
|
1321
|
-
while (!
|
|
1371
|
+
while (!existsSync4(join7(current, ".git")) && dirname4(current) !== current) {
|
|
1322
1372
|
current = dirname4(current);
|
|
1323
1373
|
folders.push(current);
|
|
1324
1374
|
}
|
|
1325
|
-
return
|
|
1375
|
+
return existsSync4(join7(current, ".git")) ? folders : [dir];
|
|
1326
1376
|
}
|
|
1327
1377
|
function containerPath(service, dir) {
|
|
1328
1378
|
const holding = service.mounts.filter((mount) => {
|
|
@@ -1353,7 +1403,7 @@ async function place(dir, program, { service, host } = {}) {
|
|
|
1353
1403
|
fail(`--in ${service}: no compose project mounts ${dir}`);
|
|
1354
1404
|
return;
|
|
1355
1405
|
}
|
|
1356
|
-
if (Bun.which("docker", { PATH:
|
|
1406
|
+
if (Bun.which("docker", { PATH: process17.env.PATH ?? "" }) === null) {
|
|
1357
1407
|
if (service !== undefined)
|
|
1358
1408
|
fail(`--in ${service}: docker not found`);
|
|
1359
1409
|
if (!noticed.has(found.composeDir)) {
|
|
@@ -1405,7 +1455,7 @@ class Stack {
|
|
|
1405
1455
|
}
|
|
1406
1456
|
static async running(composeDir) {
|
|
1407
1457
|
try {
|
|
1408
|
-
const ran = await runCommand(["docker", "compose", "ps", "--services", "--status", "running"], { cwd: composeDir, env:
|
|
1458
|
+
const ran = await runCommand(["docker", "compose", "ps", "--services", "--status", "running"], { cwd: composeDir, env: process17.env, timeoutMs: PS_TIMEOUT_MS });
|
|
1409
1459
|
if (ran.code !== 0)
|
|
1410
1460
|
return `docker compose ps failed in ${composeDir}: ${ran.text.trim().split(`
|
|
1411
1461
|
`).at(-1) ?? `exit ${ran.code}`}`;
|
|
@@ -1437,10 +1487,10 @@ function placeSettings(values) {
|
|
|
1437
1487
|
}
|
|
1438
1488
|
|
|
1439
1489
|
// src/fix.ts
|
|
1440
|
-
import { existsSync as
|
|
1490
|
+
import { existsSync as existsSync5, statSync as statSync2 } from "fs";
|
|
1441
1491
|
import { rename, writeFile as writeFile2 } from "fs/promises";
|
|
1442
1492
|
import { join as join11 } from "path";
|
|
1443
|
-
import
|
|
1493
|
+
import process19 from "process";
|
|
1444
1494
|
|
|
1445
1495
|
// src/changes.ts
|
|
1446
1496
|
import { stat as stat2 } from "fs/promises";
|
|
@@ -1502,12 +1552,12 @@ import { join as join9 } from "path";
|
|
|
1502
1552
|
var STEP_NAMES = ["check", "typecheck", "lint", "test"];
|
|
1503
1553
|
var TARGET2 = /^@?([\w-]+)(?:[ \t][^:=\n]*)?:(?!=)/gm;
|
|
1504
1554
|
var JUSTFILES = ["justfile", "Justfile", ".justfile"];
|
|
1555
|
+
var TASK_RUNNERS = new Set(["Justfile", "Makefile"]);
|
|
1505
1556
|
var MAKEFILES = ["GNUmakefile", "makefile", "Makefile"];
|
|
1506
1557
|
var CS_FIXER_CONFIGS = [".php-cs-fixer.php", ".php-cs-fixer.dist.php"];
|
|
1507
1558
|
var JUST_TIMEOUT_MS = 1e4;
|
|
1508
1559
|
var PHPSTAN_CONFIGS = ["phpstan.neon", "phpstan.neon.dist", "phpstan.dist.neon"];
|
|
1509
1560
|
var PHPUNIT_CONFIGS = ["phpunit.xml", "phpunit.xml.dist", "phpunit.dist.xml"];
|
|
1510
|
-
var SKIPPED = new Set([...SKIPPED_FOLDERS, "var", "tmp"]);
|
|
1511
1561
|
async function readFirst(dir, files) {
|
|
1512
1562
|
for (const file of files) {
|
|
1513
1563
|
const handle = Bun.file(join9(dir, file));
|
|
@@ -1602,8 +1652,9 @@ async function discoverProjects(dir) {
|
|
|
1602
1652
|
return [{ dir, steps: own }];
|
|
1603
1653
|
const projects = [];
|
|
1604
1654
|
const entries = await readdir2(dir, { withFileTypes: true });
|
|
1655
|
+
const ignored = ignoredFolders(["var", "tmp"]);
|
|
1605
1656
|
for (const entry of entries.toSorted((a, b) => a.name.localeCompare(b.name))) {
|
|
1606
|
-
if (!entry.isDirectory() || entry.name.startsWith(".") ||
|
|
1657
|
+
if (!entry.isDirectory() || entry.name.startsWith(".") || ignored.has(entry.name))
|
|
1607
1658
|
continue;
|
|
1608
1659
|
const steps = await discover(join9(dir, entry.name));
|
|
1609
1660
|
if (steps.length > 0)
|
|
@@ -1613,8 +1664,9 @@ async function discoverProjects(dir) {
|
|
|
1613
1664
|
}
|
|
1614
1665
|
async function discover(dir) {
|
|
1615
1666
|
const found = await candidates(dir, "check");
|
|
1667
|
+
const runnerCheck = found.find((candidate) => candidate.name === "check" && TASK_RUNNERS.has(candidate.source));
|
|
1616
1668
|
return STEP_NAMES.flatMap((name) => {
|
|
1617
|
-
const step = found.find((candidate) => candidate.name === name);
|
|
1669
|
+
const step = name === "check" && runnerCheck !== undefined ? runnerCheck : found.find((candidate) => candidate.name === name);
|
|
1618
1670
|
return step === undefined ? [] : [step];
|
|
1619
1671
|
});
|
|
1620
1672
|
}
|
|
@@ -1630,6 +1682,7 @@ var fixOptions = {
|
|
|
1630
1682
|
var options = {
|
|
1631
1683
|
...fixOptions,
|
|
1632
1684
|
fix: { type: "boolean", short: "f", description: "run the folder's fixers and formatters instead of the steps, as the fix bin does" },
|
|
1685
|
+
quiet: { type: "boolean", short: "q", description: "print nothing for a passing step, and nothing at all when every step passes" },
|
|
1633
1686
|
failed: { type: "boolean", description: "run only the steps that failed in the last run of this folder, read from the run folder" },
|
|
1634
1687
|
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" },
|
|
1635
1688
|
slot: { type: "boolean", description: "run each step through slot, queued behind the machine-wide slots of the other sessions (needs the slot bin)" }
|
|
@@ -1650,7 +1703,7 @@ function pick(steps, only, noun = "step") {
|
|
|
1650
1703
|
// src/run.ts
|
|
1651
1704
|
import { mkdir as mkdir2, readdir as readdir3, stat as stat3, writeFile } from "fs/promises";
|
|
1652
1705
|
import { basename as basename2, join as join10 } from "path";
|
|
1653
|
-
import
|
|
1706
|
+
import process18 from "process";
|
|
1654
1707
|
|
|
1655
1708
|
// src/e2e.ts
|
|
1656
1709
|
var E2E_NOISE = [
|
|
@@ -2285,7 +2338,7 @@ var runPrefix = (cwd) => `${basename2(cwd)}-${Bun.hash(cwd).toString(36)}-`;
|
|
|
2285
2338
|
async function logDirectory(cwd) {
|
|
2286
2339
|
const root = await privateLogDirectory("check");
|
|
2287
2340
|
await sweepLogs(root, LOG_MAX_AGE_MS);
|
|
2288
|
-
const path = join10(root, `${runPrefix(cwd)}${Date.now().toString(36)}-${
|
|
2341
|
+
const path = join10(root, `${runPrefix(cwd)}${Date.now().toString(36)}-${process18.pid}`);
|
|
2289
2342
|
await mkdir2(path, { mode: 448 });
|
|
2290
2343
|
return path;
|
|
2291
2344
|
}
|
|
@@ -2311,7 +2364,7 @@ async function lastFailed(cwd) {
|
|
|
2311
2364
|
async function saveLog(output) {
|
|
2312
2365
|
const root = await privateLogDirectory("errs");
|
|
2313
2366
|
await sweepLogs(root);
|
|
2314
|
-
const path = join10(root, `${new Date().toISOString().replaceAll(/[:.]/g, "-")}-${
|
|
2367
|
+
const path = join10(root, `${new Date().toISOString().replaceAll(/[:.]/g, "-")}-${process18.pid}-${crypto.randomUUID().slice(0, 8)}.log`);
|
|
2315
2368
|
await writeFile(path, output, { mode: 384, flag: "wx" });
|
|
2316
2369
|
return path;
|
|
2317
2370
|
}
|
|
@@ -2319,7 +2372,7 @@ async function runStep(command, cwd, logFile, { env = {}, timeoutMs, held } = {}
|
|
|
2319
2372
|
const started = Date.now();
|
|
2320
2373
|
const { code, text, timedOut } = await runCommand(["sh", "-c", `${command} 2>&1`], {
|
|
2321
2374
|
cwd,
|
|
2322
|
-
env: { ...
|
|
2375
|
+
env: { ...process18.env, NO_COLOR: "1", FORCE_COLOR: "0", ...env },
|
|
2323
2376
|
...timeoutMs === undefined ? {} : { timeoutMs },
|
|
2324
2377
|
...held === undefined ? {} : { onStart: (child) => held.forward(child) }
|
|
2325
2378
|
});
|
|
@@ -2335,8 +2388,8 @@ function outcomeJson(name, command, logFile, outcome, service) {
|
|
|
2335
2388
|
return { name, command, ...service === undefined ? {} : { in: service }, ok: outcome.ok, ms: outcome.ms, log: logFile, ...outcome.timedOut === true ? { timedOut: true } : {}, ...outcome.ok ? {} : { failed: failureExcerpt(outcome.output) } };
|
|
2336
2389
|
}
|
|
2337
2390
|
function printOutcome(name, width, command, logFile, outcome) {
|
|
2338
|
-
const colors = paint(
|
|
2339
|
-
const path = role("path",
|
|
2391
|
+
const colors = paint(process18.stdout);
|
|
2392
|
+
const path = role("path", process18.stdout);
|
|
2340
2393
|
const took = colors.dim(formatDuration(outcome.ms));
|
|
2341
2394
|
if (outcome.ok) {
|
|
2342
2395
|
console.log(`${colors.bold(colors.green("ok "))} ${name.padEnd(width)} ${took} ${path(logFile)}`);
|
|
@@ -2367,7 +2420,7 @@ var RUFF_CONFIGS = ["ruff.toml", ".ruff.toml"];
|
|
|
2367
2420
|
var RUFF_SECTION = /^\[tool\.ruff/m;
|
|
2368
2421
|
var MAX_CHANGED = 30;
|
|
2369
2422
|
async function replaceFile(path, content) {
|
|
2370
|
-
const temporary = `${path}.${
|
|
2423
|
+
const temporary = `${path}.${process19.pid}.tmp`;
|
|
2371
2424
|
await writeFile2(temporary, content, { mode: statSync2(path).mode & 511 });
|
|
2372
2425
|
await rename(temporary, path);
|
|
2373
2426
|
}
|
|
@@ -2388,7 +2441,7 @@ async function toolFixers(dir) {
|
|
|
2388
2441
|
fixers.push({ name: "makefile", command: "declare every target .PHONY", source: makefile, write: async (cwd) => {
|
|
2389
2442
|
const path = join11(cwd, makefile);
|
|
2390
2443
|
const current = await Bun.file(path).text();
|
|
2391
|
-
const { content, targets } = declarePhony(current, (name) =>
|
|
2444
|
+
const { content, targets } = declarePhony(current, (name) => existsSync5(join11(cwd, name)));
|
|
2392
2445
|
if (content !== current)
|
|
2393
2446
|
await replaceFile(path, content);
|
|
2394
2447
|
return `.PHONY: ${targets.join(" ")}`;
|
|
@@ -2439,14 +2492,14 @@ function printChanged(changed) {
|
|
|
2439
2492
|
if (changed.length > MAX_CHANGED)
|
|
2440
2493
|
console.log(` and ${changed.length - MAX_CHANGED} more`);
|
|
2441
2494
|
}
|
|
2442
|
-
async function fix(args, cwd =
|
|
2495
|
+
async function fix(args, cwd = process19.cwd()) {
|
|
2443
2496
|
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"]] });
|
|
2444
2497
|
return runFixers(parsed.values, cwd);
|
|
2445
2498
|
}
|
|
2446
2499
|
async function runFixers(values, cwd) {
|
|
2447
2500
|
const parsed = { values };
|
|
2448
2501
|
const settings = placeSettings(values);
|
|
2449
|
-
if (
|
|
2502
|
+
if (process19.env[RUNNING] !== undefined)
|
|
2450
2503
|
fail("a fixer called fix again, which would recurse: give its script another command");
|
|
2451
2504
|
const found = await fixers(cwd);
|
|
2452
2505
|
if (found.length === 0)
|
|
@@ -2480,7 +2533,7 @@ async function runFixers(values, cwd) {
|
|
|
2480
2533
|
break;
|
|
2481
2534
|
if (missing(fixer)) {
|
|
2482
2535
|
if (!json)
|
|
2483
|
-
console.log(`${paint(
|
|
2536
|
+
console.log(`${paint(process19.stdout).yellow("skip ")} ${fixer.name.padEnd(width)} ${fixer.requires} is not installed`);
|
|
2484
2537
|
ran.push({ name: fixer.name, command: fixer.command, skipped: `${fixer.requires} is not installed` });
|
|
2485
2538
|
continue;
|
|
2486
2539
|
}
|
|
@@ -2513,7 +2566,7 @@ async function runFixers(values, cwd) {
|
|
|
2513
2566
|
}
|
|
2514
2567
|
|
|
2515
2568
|
// src/narrow.ts
|
|
2516
|
-
import { existsSync as
|
|
2569
|
+
import { existsSync as existsSync6 } from "fs";
|
|
2517
2570
|
import { basename as basename3, dirname as dirname5, extname, join as join12 } from "path";
|
|
2518
2571
|
var {$: $2 } = globalThis.Bun;
|
|
2519
2572
|
var LINTERS = /^(?:keslint|eslint|oxlint)\b/;
|
|
@@ -2526,7 +2579,7 @@ async function changedPaths(dir) {
|
|
|
2526
2579
|
const untracked = await $2`git ls-files -z --others --exclude-standard`.cwd(dir).quiet().nothrow();
|
|
2527
2580
|
if (tracked.exitCode !== 0 || untracked.exitCode !== 0)
|
|
2528
2581
|
return;
|
|
2529
|
-
return [...new Set([...tracked.stdout.toString().split("\x00"), ...untracked.stdout.toString().split("\x00")])].filter((path) => path !== "" &&
|
|
2582
|
+
return [...new Set([...tracked.stdout.toString().split("\x00"), ...untracked.stdout.toString().split("\x00")])].filter((path) => path !== "" && existsSync6(join12(dir, path)));
|
|
2530
2583
|
}
|
|
2531
2584
|
function siblingTests(path, exists) {
|
|
2532
2585
|
const extension = extname(path);
|
|
@@ -2560,7 +2613,7 @@ async function narrow2(step, dir, changed) {
|
|
|
2560
2613
|
if (TEST_FILE.test(path)) {
|
|
2561
2614
|
tests.add(path);
|
|
2562
2615
|
} else {
|
|
2563
|
-
for (const test of siblingTests(path, (candidate) =>
|
|
2616
|
+
for (const test of siblingTests(path, (candidate) => existsSync6(join12(dir, candidate)))) {
|
|
2564
2617
|
tests.add(test);
|
|
2565
2618
|
}
|
|
2566
2619
|
}
|
|
@@ -2587,7 +2640,7 @@ async function scriptText(dir, name) {
|
|
|
2587
2640
|
}
|
|
2588
2641
|
|
|
2589
2642
|
// src/check.ts
|
|
2590
|
-
var usage2 = `check [--only <steps>] [--changed] [--failed] [--timeout <duration>] [--slot] [--in <service> | --host] [--list]
|
|
2643
|
+
var usage2 = `check [--only <steps>] [--changed] [--failed] [--quiet] [--timeout <duration>] [--slot] [--in <service> | --host] [--list]
|
|
2591
2644
|
check --fix [--only <fixers>] [--timeout <duration>] [--in <service> | --host] [--list]
|
|
2592
2645
|
|
|
2593
2646
|
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.
|
|
@@ -2595,6 +2648,7 @@ A folder without steps but with subfolders that have some (api/ and client/) run
|
|
|
2595
2648
|
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.
|
|
2596
2649
|
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.
|
|
2597
2650
|
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.
|
|
2651
|
+
With --quiet, passing steps print nothing, and a fully passing run prints nothing at all: only the failing steps and the closing summary of a run that failed.
|
|
2598
2652
|
A step still running after --timeout is ended with everything it started, but not what it started inside a container.
|
|
2599
2653
|
With --failed, only the steps that failed in the last run of this folder run again, read from that run's folder of logs; when no last run failed, it says so and exits 2.
|
|
2600
2654
|
With --fix, the folder's fixers and formatters run instead of the steps, exactly as the \`fix\` bin does (it is the alias of \`check --fix\`): its own scripts, php-cs-fixer, just --fmt, go fmt, cargo fmt, ruff and the Makefile's .PHONY targets, then the files the run changed are listed. --only then names fixers, as --list prints them; --changed, --failed and --slot do not apply.
|
|
@@ -2628,13 +2682,13 @@ function launch(step) {
|
|
|
2628
2682
|
return step.placement === undefined ? step.command : shellIn(step.placement, step.command);
|
|
2629
2683
|
}
|
|
2630
2684
|
function summaryLine(outcomes) {
|
|
2631
|
-
const colors = paint(
|
|
2685
|
+
const colors = paint(process20.stdout);
|
|
2632
2686
|
const failed = outcomes.filter((outcome) => !outcome.ok).length;
|
|
2633
2687
|
const passed = outcomes.length - failed;
|
|
2634
2688
|
const parts = [colors.green(`${passed} passed`), ...failed === 0 ? [] : [colors.red(`${failed} failed`)], colors.dim(formatDuration(outcomes.reduce((sum, outcome) => sum + outcome.ms, 0)))];
|
|
2635
2689
|
return parts.join(colors.dim(" \xB7 "));
|
|
2636
2690
|
}
|
|
2637
|
-
async function check(args, cwd =
|
|
2691
|
+
async function check(args, cwd = process20.cwd()) {
|
|
2638
2692
|
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"]] });
|
|
2639
2693
|
const settings = placeSettings(parsed.values);
|
|
2640
2694
|
if (parsed.values.fix === true) {
|
|
@@ -2645,7 +2699,7 @@ async function check(args, cwd = process19.cwd()) {
|
|
|
2645
2699
|
return runFixers(parsed.values, cwd);
|
|
2646
2700
|
}
|
|
2647
2701
|
const timeoutMs = parsed.values.timeout === undefined ? undefined : duration(parsed.values.timeout, "timeout", 0);
|
|
2648
|
-
if (parsed.values.slot === true && Bun.which("slot", { PATH:
|
|
2702
|
+
if (parsed.values.slot === true && Bun.which("slot", { PATH: process20.env.PATH ?? "" }) === null)
|
|
2649
2703
|
fail("--slot needs the slot bin: bun install -g @kaynooo/cli-wait");
|
|
2650
2704
|
const projects = await discoverProjects(cwd);
|
|
2651
2705
|
const found = projects.flatMap((project) => project.steps.map((step) => ({ ...step, project })));
|
|
@@ -2675,7 +2729,8 @@ async function check(args, cwd = process19.cwd()) {
|
|
|
2675
2729
|
const stack = new Stack;
|
|
2676
2730
|
const width = Math.max(...steps.map((step) => step.label.length));
|
|
2677
2731
|
const outcomes = [];
|
|
2678
|
-
const
|
|
2732
|
+
const quiet = parsed.values.quiet === true;
|
|
2733
|
+
const heading = json || quiet ? "" : header("check", `${basename4(cwd)} \xB7 ${steps.length} ${steps.length === 1 ? "step" : "steps"}`, process20.stdout);
|
|
2679
2734
|
if (heading !== "")
|
|
2680
2735
|
console.log(heading);
|
|
2681
2736
|
try {
|
|
@@ -2684,7 +2739,7 @@ async function check(args, cwd = process19.cwd()) {
|
|
|
2684
2739
|
const down = step.placement === undefined ? undefined : await stack.problem(step.placement);
|
|
2685
2740
|
const command = parsed.values.slot === true ? slotted(launch(step)) : launch(step);
|
|
2686
2741
|
const outcome = down === undefined ? await runStep(command, step.dir, logFile, { ...timeoutMs === undefined ? {} : { timeoutMs }, held }) : await refusedStep(down, logFile);
|
|
2687
|
-
if (!json)
|
|
2742
|
+
if (!json && !(quiet && outcome.ok))
|
|
2688
2743
|
printOutcome(step.label, width, `${step.command}${step.note === undefined ? "" : ` (${step.note})`}${step.placement === undefined ? "" : ` (in ${step.placement.service})`}`, logFile, outcome);
|
|
2689
2744
|
outcomes.push(outcomeJson(step.label, step.command, logFile, outcome, step.placement?.service));
|
|
2690
2745
|
if (held.signal !== undefined)
|
|
@@ -2696,7 +2751,7 @@ async function check(args, cwd = process19.cwd()) {
|
|
|
2696
2751
|
await writeFile3(join13(directory, RESULTS_FILE), JSON.stringify(outcomes.map(({ name, ok }) => ({ name, ok }))), { mode: 384 });
|
|
2697
2752
|
if (json)
|
|
2698
2753
|
printJson(outcomes);
|
|
2699
|
-
else if (heading !== "")
|
|
2754
|
+
else if (heading !== "" || quiet && !outcomes.every((outcome) => outcome.ok))
|
|
2700
2755
|
console.log(summaryLine(outcomes));
|
|
2701
2756
|
if (held.signal !== undefined)
|
|
2702
2757
|
return exitCodeOf(null, held.signal);
|
|
@@ -2706,4 +2761,4 @@ async function check(args, cwd = process19.cwd()) {
|
|
|
2706
2761
|
}
|
|
2707
2762
|
|
|
2708
2763
|
// src/cli.ts
|
|
2709
|
-
|
|
2764
|
+
process21.exitCode = await runMain({ name: "check", version, run: async (args) => check(args) });
|