@kaynooo/cli-check 0.18.0 → 0.18.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 +2 -1
- package/dist/cli.js +56 -27
- package/dist/errs-cli.js +42 -16
- package/dist/fix-cli.js +47 -20
- package/dist/j-cli.js +79 -53
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -11,6 +11,7 @@ check --timeout 5m # end a step still running after 5 minutes, exit 2
|
|
|
11
11
|
check --slot # queue each step behind the machine-wide slots of `slot` (@kaynooo/cli-wait)
|
|
12
12
|
check --in app # run every step in this compose service, whatever is detected
|
|
13
13
|
check --failed # run again only the steps that failed in this folder's last run
|
|
14
|
+
check --quiet # print only the failing steps, nothing when all pass
|
|
14
15
|
check --fix # run the fixers instead, what `fix` does
|
|
15
16
|
check --host # run on the host even when a compose service mounts the folder
|
|
16
17
|
check --json # [{name, command, in?, ok, ms, log, failed?}] once every step ran
|
|
@@ -32,7 +33,7 @@ check --json # [{name, command, in?, ok, ms, log, failed?}] once every step
|
|
|
32
33
|
|
|
33
34
|
Scripts always go through `bun run`, so a `check` script of `$npm_execpath check` runs Bun's type checker, and a script that calls this bin by name is skipped.
|
|
34
35
|
|
|
35
|
-
A folder with no step of its own but subfolders that have some (a root with `api/` and `client/`) runs each subfolder's steps, in alphabetical order, each line naming it: `api/lint`, `client/test`. `--only lint` picks `lint` in every one, and each step runs in its own subfolder. Only the folder's direct children are looked at, without hidden ones, `node_modules`, `vendor`, `dist`, `build`, `var`, `tmp` and `coverage`.
|
|
36
|
+
A folder with no step of its own but subfolders that have some (a root with `api/` and `client/`) runs each subfolder's steps, in alphabetical order, each line naming it: `api/lint`, `client/test`. `--only lint` picks `lint` in every one, and each step runs in its own subfolder. Only the folder's direct children are looked at, without hidden ones, `node_modules`, `vendor`, `dist`, `build`, `var`, `tmp` and `coverage`, plus the names in the `ignore` array of `~/.config/kaynooo-cli/config.json`.
|
|
36
37
|
|
|
37
38
|
## In the compose service
|
|
38
39
|
|
package/dist/cli.js
CHANGED
|
@@ -9,6 +9,7 @@ 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);
|
|
@@ -887,7 +908,7 @@ var ESCAPE_CODE = new RegExp(`${ESC}(?:\\[[\\x30-\\x3F]*[\\x20-\\x2F]*[\\x40-\\x
|
|
|
887
908
|
var RESET_STYLE = `${ESC}[0m`;
|
|
888
909
|
var CLOSE_LINK = `${ESC}]8;;${ESC}\\`;
|
|
889
910
|
// ../kit/src/cli.ts
|
|
890
|
-
import { readFileSync as
|
|
911
|
+
import { readFileSync as readFileSync3, realpathSync } from "fs";
|
|
891
912
|
import { dirname as dirname3, join as join6 } from "path";
|
|
892
913
|
import process14 from "process";
|
|
893
914
|
|
|
@@ -1078,7 +1099,7 @@ async function printCandidates(found) {
|
|
|
1078
1099
|
function packageVersion(entry = Bun.main) {
|
|
1079
1100
|
for (let dir = dirname3(realpathSync(entry));; dir = dirname3(dir)) {
|
|
1080
1101
|
try {
|
|
1081
|
-
const { version } = JSON.parse(
|
|
1102
|
+
const { version } = JSON.parse(readFileSync3(join6(dir, "package.json"), "utf8"));
|
|
1082
1103
|
if (typeof version === "string")
|
|
1083
1104
|
return version;
|
|
1084
1105
|
} catch {}
|
|
@@ -1108,6 +1129,11 @@ async function runMain({ name, version, run, redact, usage }, argv = process14.a
|
|
|
1108
1129
|
}
|
|
1109
1130
|
// ../kit/src/folders.ts
|
|
1110
1131
|
var SKIPPED_FOLDERS = new Set(["node_modules", "vendor", "dist", "build", "target", "coverage", "venv", "__pycache__"]);
|
|
1132
|
+
function ignoredFolders(extra = [], where = {}) {
|
|
1133
|
+
const configured = readUserConfig("config", where).ignore;
|
|
1134
|
+
const names = Array.isArray(configured) ? configured.filter((name) => typeof name === "string" && name !== "") : [];
|
|
1135
|
+
return new Set([...SKIPPED_FOLDERS, ...extra, ...names]);
|
|
1136
|
+
}
|
|
1111
1137
|
// ../kit/src/secrets.ts
|
|
1112
1138
|
var SECRET_WORDS = new Set(["key", "pass", "pwd", "auth", "salt", "cookie", "session", "jwt", "ssn", "iban", "card", "cvv", "otp"]);
|
|
1113
1139
|
// ../kit/src/sessions.ts
|
|
@@ -1115,7 +1141,7 @@ var {Glob } = globalThis.Bun;
|
|
|
1115
1141
|
var SESSION_FILES = new Glob("*.json");
|
|
1116
1142
|
var ACCOUNT_DIRS = new Glob("*/sessions");
|
|
1117
1143
|
// package.json
|
|
1118
|
-
var version = "0.18.
|
|
1144
|
+
var version = "0.18.1";
|
|
1119
1145
|
|
|
1120
1146
|
// src/check.ts
|
|
1121
1147
|
import { writeFile as writeFile3 } from "fs/promises";
|
|
@@ -1170,7 +1196,7 @@ function shellQuote(word) {
|
|
|
1170
1196
|
}
|
|
1171
1197
|
|
|
1172
1198
|
// src/compose.ts
|
|
1173
|
-
import { existsSync as
|
|
1199
|
+
import { existsSync as existsSync4 } from "fs";
|
|
1174
1200
|
import { homedir as homedir5 } from "os";
|
|
1175
1201
|
import { basename, dirname as dirname4, join as join7, relative, resolve as resolve3 } from "path";
|
|
1176
1202
|
import process16 from "process";
|
|
@@ -1318,11 +1344,11 @@ async function readServices(composeDir) {
|
|
|
1318
1344
|
function climb(dir) {
|
|
1319
1345
|
const folders = [dir];
|
|
1320
1346
|
let current = dir;
|
|
1321
|
-
while (!
|
|
1347
|
+
while (!existsSync4(join7(current, ".git")) && dirname4(current) !== current) {
|
|
1322
1348
|
current = dirname4(current);
|
|
1323
1349
|
folders.push(current);
|
|
1324
1350
|
}
|
|
1325
|
-
return
|
|
1351
|
+
return existsSync4(join7(current, ".git")) ? folders : [dir];
|
|
1326
1352
|
}
|
|
1327
1353
|
function containerPath(service, dir) {
|
|
1328
1354
|
const holding = service.mounts.filter((mount) => {
|
|
@@ -1437,7 +1463,7 @@ function placeSettings(values) {
|
|
|
1437
1463
|
}
|
|
1438
1464
|
|
|
1439
1465
|
// src/fix.ts
|
|
1440
|
-
import { existsSync as
|
|
1466
|
+
import { existsSync as existsSync5, statSync as statSync2 } from "fs";
|
|
1441
1467
|
import { rename, writeFile as writeFile2 } from "fs/promises";
|
|
1442
1468
|
import { join as join11 } from "path";
|
|
1443
1469
|
import process18 from "process";
|
|
@@ -1507,7 +1533,6 @@ var CS_FIXER_CONFIGS = [".php-cs-fixer.php", ".php-cs-fixer.dist.php"];
|
|
|
1507
1533
|
var JUST_TIMEOUT_MS = 1e4;
|
|
1508
1534
|
var PHPSTAN_CONFIGS = ["phpstan.neon", "phpstan.neon.dist", "phpstan.dist.neon"];
|
|
1509
1535
|
var PHPUNIT_CONFIGS = ["phpunit.xml", "phpunit.xml.dist", "phpunit.dist.xml"];
|
|
1510
|
-
var SKIPPED = new Set([...SKIPPED_FOLDERS, "var", "tmp"]);
|
|
1511
1536
|
async function readFirst(dir, files) {
|
|
1512
1537
|
for (const file of files) {
|
|
1513
1538
|
const handle = Bun.file(join9(dir, file));
|
|
@@ -1602,8 +1627,9 @@ async function discoverProjects(dir) {
|
|
|
1602
1627
|
return [{ dir, steps: own }];
|
|
1603
1628
|
const projects = [];
|
|
1604
1629
|
const entries = await readdir2(dir, { withFileTypes: true });
|
|
1630
|
+
const ignored = ignoredFolders(["var", "tmp"]);
|
|
1605
1631
|
for (const entry of entries.toSorted((a, b) => a.name.localeCompare(b.name))) {
|
|
1606
|
-
if (!entry.isDirectory() || entry.name.startsWith(".") ||
|
|
1632
|
+
if (!entry.isDirectory() || entry.name.startsWith(".") || ignored.has(entry.name))
|
|
1607
1633
|
continue;
|
|
1608
1634
|
const steps = await discover(join9(dir, entry.name));
|
|
1609
1635
|
if (steps.length > 0)
|
|
@@ -1630,6 +1656,7 @@ var fixOptions = {
|
|
|
1630
1656
|
var options = {
|
|
1631
1657
|
...fixOptions,
|
|
1632
1658
|
fix: { type: "boolean", short: "f", description: "run the folder's fixers and formatters instead of the steps, as the fix bin does" },
|
|
1659
|
+
quiet: { type: "boolean", short: "q", description: "print nothing for a passing step, and nothing at all when every step passes" },
|
|
1633
1660
|
failed: { type: "boolean", description: "run only the steps that failed in the last run of this folder, read from the run folder" },
|
|
1634
1661
|
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
1662
|
slot: { type: "boolean", description: "run each step through slot, queued behind the machine-wide slots of the other sessions (needs the slot bin)" }
|
|
@@ -2388,7 +2415,7 @@ async function toolFixers(dir) {
|
|
|
2388
2415
|
fixers.push({ name: "makefile", command: "declare every target .PHONY", source: makefile, write: async (cwd) => {
|
|
2389
2416
|
const path = join11(cwd, makefile);
|
|
2390
2417
|
const current = await Bun.file(path).text();
|
|
2391
|
-
const { content, targets } = declarePhony(current, (name) =>
|
|
2418
|
+
const { content, targets } = declarePhony(current, (name) => existsSync5(join11(cwd, name)));
|
|
2392
2419
|
if (content !== current)
|
|
2393
2420
|
await replaceFile(path, content);
|
|
2394
2421
|
return `.PHONY: ${targets.join(" ")}`;
|
|
@@ -2513,7 +2540,7 @@ async function runFixers(values, cwd) {
|
|
|
2513
2540
|
}
|
|
2514
2541
|
|
|
2515
2542
|
// src/narrow.ts
|
|
2516
|
-
import { existsSync as
|
|
2543
|
+
import { existsSync as existsSync6 } from "fs";
|
|
2517
2544
|
import { basename as basename3, dirname as dirname5, extname, join as join12 } from "path";
|
|
2518
2545
|
var {$: $2 } = globalThis.Bun;
|
|
2519
2546
|
var LINTERS = /^(?:keslint|eslint|oxlint)\b/;
|
|
@@ -2526,7 +2553,7 @@ async function changedPaths(dir) {
|
|
|
2526
2553
|
const untracked = await $2`git ls-files -z --others --exclude-standard`.cwd(dir).quiet().nothrow();
|
|
2527
2554
|
if (tracked.exitCode !== 0 || untracked.exitCode !== 0)
|
|
2528
2555
|
return;
|
|
2529
|
-
return [...new Set([...tracked.stdout.toString().split("\x00"), ...untracked.stdout.toString().split("\x00")])].filter((path) => path !== "" &&
|
|
2556
|
+
return [...new Set([...tracked.stdout.toString().split("\x00"), ...untracked.stdout.toString().split("\x00")])].filter((path) => path !== "" && existsSync6(join12(dir, path)));
|
|
2530
2557
|
}
|
|
2531
2558
|
function siblingTests(path, exists) {
|
|
2532
2559
|
const extension = extname(path);
|
|
@@ -2560,7 +2587,7 @@ async function narrow2(step, dir, changed) {
|
|
|
2560
2587
|
if (TEST_FILE.test(path)) {
|
|
2561
2588
|
tests.add(path);
|
|
2562
2589
|
} else {
|
|
2563
|
-
for (const test of siblingTests(path, (candidate) =>
|
|
2590
|
+
for (const test of siblingTests(path, (candidate) => existsSync6(join12(dir, candidate)))) {
|
|
2564
2591
|
tests.add(test);
|
|
2565
2592
|
}
|
|
2566
2593
|
}
|
|
@@ -2587,7 +2614,7 @@ async function scriptText(dir, name) {
|
|
|
2587
2614
|
}
|
|
2588
2615
|
|
|
2589
2616
|
// src/check.ts
|
|
2590
|
-
var usage2 = `check [--only <steps>] [--changed] [--failed] [--timeout <duration>] [--slot] [--in <service> | --host] [--list]
|
|
2617
|
+
var usage2 = `check [--only <steps>] [--changed] [--failed] [--quiet] [--timeout <duration>] [--slot] [--in <service> | --host] [--list]
|
|
2591
2618
|
check --fix [--only <fixers>] [--timeout <duration>] [--in <service> | --host] [--list]
|
|
2592
2619
|
|
|
2593
2620
|
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 +2622,7 @@ A folder without steps but with subfolders that have some (api/ and client/) run
|
|
|
2595
2622
|
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
2623
|
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
2624
|
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.
|
|
2625
|
+
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
2626
|
A step still running after --timeout is ended with everything it started, but not what it started inside a container.
|
|
2599
2627
|
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
2628
|
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.
|
|
@@ -2675,7 +2703,8 @@ async function check(args, cwd = process19.cwd()) {
|
|
|
2675
2703
|
const stack = new Stack;
|
|
2676
2704
|
const width = Math.max(...steps.map((step) => step.label.length));
|
|
2677
2705
|
const outcomes = [];
|
|
2678
|
-
const
|
|
2706
|
+
const quiet = parsed.values.quiet === true;
|
|
2707
|
+
const heading = json || quiet ? "" : header("check", `${basename4(cwd)} \xB7 ${steps.length} ${steps.length === 1 ? "step" : "steps"}`, process19.stdout);
|
|
2679
2708
|
if (heading !== "")
|
|
2680
2709
|
console.log(heading);
|
|
2681
2710
|
try {
|
|
@@ -2684,7 +2713,7 @@ async function check(args, cwd = process19.cwd()) {
|
|
|
2684
2713
|
const down = step.placement === undefined ? undefined : await stack.problem(step.placement);
|
|
2685
2714
|
const command = parsed.values.slot === true ? slotted(launch(step)) : launch(step);
|
|
2686
2715
|
const outcome = down === undefined ? await runStep(command, step.dir, logFile, { ...timeoutMs === undefined ? {} : { timeoutMs }, held }) : await refusedStep(down, logFile);
|
|
2687
|
-
if (!json)
|
|
2716
|
+
if (!json && !(quiet && outcome.ok))
|
|
2688
2717
|
printOutcome(step.label, width, `${step.command}${step.note === undefined ? "" : ` (${step.note})`}${step.placement === undefined ? "" : ` (in ${step.placement.service})`}`, logFile, outcome);
|
|
2689
2718
|
outcomes.push(outcomeJson(step.label, step.command, logFile, outcome, step.placement?.service));
|
|
2690
2719
|
if (held.signal !== undefined)
|
|
@@ -2696,7 +2725,7 @@ async function check(args, cwd = process19.cwd()) {
|
|
|
2696
2725
|
await writeFile3(join13(directory, RESULTS_FILE), JSON.stringify(outcomes.map(({ name, ok }) => ({ name, ok }))), { mode: 384 });
|
|
2697
2726
|
if (json)
|
|
2698
2727
|
printJson(outcomes);
|
|
2699
|
-
else if (heading !== "")
|
|
2728
|
+
else if (heading !== "" || quiet && !outcomes.every((outcome) => outcome.ok))
|
|
2700
2729
|
console.log(summaryLine(outcomes));
|
|
2701
2730
|
if (held.signal !== undefined)
|
|
2702
2731
|
return exitCodeOf(null, held.signal);
|
package/dist/errs-cli.js
CHANGED
|
@@ -9,6 +9,7 @@ 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);
|
|
@@ -887,7 +908,7 @@ var ESCAPE_CODE = new RegExp(`${ESC}(?:\\[[\\x30-\\x3F]*[\\x20-\\x2F]*[\\x40-\\x
|
|
|
887
908
|
var RESET_STYLE = `${ESC}[0m`;
|
|
888
909
|
var CLOSE_LINK = `${ESC}]8;;${ESC}\\`;
|
|
889
910
|
// ../kit/src/cli.ts
|
|
890
|
-
import { readFileSync as
|
|
911
|
+
import { readFileSync as readFileSync3, realpathSync } from "fs";
|
|
891
912
|
import { dirname as dirname3, join as join6 } from "path";
|
|
892
913
|
import process14 from "process";
|
|
893
914
|
|
|
@@ -1078,7 +1099,7 @@ async function printCandidates(found) {
|
|
|
1078
1099
|
function packageVersion(entry = Bun.main) {
|
|
1079
1100
|
for (let dir = dirname3(realpathSync(entry));; dir = dirname3(dir)) {
|
|
1080
1101
|
try {
|
|
1081
|
-
const { version } = JSON.parse(
|
|
1102
|
+
const { version } = JSON.parse(readFileSync3(join6(dir, "package.json"), "utf8"));
|
|
1082
1103
|
if (typeof version === "string")
|
|
1083
1104
|
return version;
|
|
1084
1105
|
} catch {}
|
|
@@ -1108,6 +1129,11 @@ async function runMain({ name, version, run, redact, usage }, argv = process14.a
|
|
|
1108
1129
|
}
|
|
1109
1130
|
// ../kit/src/folders.ts
|
|
1110
1131
|
var SKIPPED_FOLDERS = new Set(["node_modules", "vendor", "dist", "build", "target", "coverage", "venv", "__pycache__"]);
|
|
1132
|
+
function ignoredFolders(extra = [], where = {}) {
|
|
1133
|
+
const configured = readUserConfig("config", where).ignore;
|
|
1134
|
+
const names = Array.isArray(configured) ? configured.filter((name) => typeof name === "string" && name !== "") : [];
|
|
1135
|
+
return new Set([...SKIPPED_FOLDERS, ...extra, ...names]);
|
|
1136
|
+
}
|
|
1111
1137
|
// ../kit/src/secrets.ts
|
|
1112
1138
|
var SECRET_WORDS = new Set(["key", "pass", "pwd", "auth", "salt", "cookie", "session", "jwt", "ssn", "iban", "card", "cvv", "otp"]);
|
|
1113
1139
|
// ../kit/src/sessions.ts
|
|
@@ -1115,14 +1141,14 @@ var {Glob } = globalThis.Bun;
|
|
|
1115
1141
|
var SESSION_FILES = new Glob("*.json");
|
|
1116
1142
|
var ACCOUNT_DIRS = new Glob("*/sessions");
|
|
1117
1143
|
// package.json
|
|
1118
|
-
var version = "0.18.
|
|
1144
|
+
var version = "0.18.1";
|
|
1119
1145
|
|
|
1120
1146
|
// src/errs.ts
|
|
1121
1147
|
import { relative as relative2 } from "path";
|
|
1122
1148
|
import process18 from "process";
|
|
1123
1149
|
|
|
1124
1150
|
// src/compose.ts
|
|
1125
|
-
import { existsSync as
|
|
1151
|
+
import { existsSync as existsSync4 } from "fs";
|
|
1126
1152
|
import { homedir as homedir5 } from "os";
|
|
1127
1153
|
import { basename, dirname as dirname4, join as join7, relative, resolve as resolve3 } from "path";
|
|
1128
1154
|
import process16 from "process";
|
|
@@ -1319,11 +1345,11 @@ async function readServices(composeDir) {
|
|
|
1319
1345
|
function climb(dir) {
|
|
1320
1346
|
const folders = [dir];
|
|
1321
1347
|
let current = dir;
|
|
1322
|
-
while (!
|
|
1348
|
+
while (!existsSync4(join7(current, ".git")) && dirname4(current) !== current) {
|
|
1323
1349
|
current = dirname4(current);
|
|
1324
1350
|
folders.push(current);
|
|
1325
1351
|
}
|
|
1326
|
-
return
|
|
1352
|
+
return existsSync4(join7(current, ".git")) ? folders : [dir];
|
|
1327
1353
|
}
|
|
1328
1354
|
function containerPath(service, dir) {
|
|
1329
1355
|
const holding = service.mounts.filter((mount) => {
|
package/dist/fix-cli.js
CHANGED
|
@@ -9,6 +9,7 @@ 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);
|
|
@@ -887,7 +908,7 @@ var ESCAPE_CODE = new RegExp(`${ESC}(?:\\[[\\x30-\\x3F]*[\\x20-\\x2F]*[\\x40-\\x
|
|
|
887
908
|
var RESET_STYLE = `${ESC}[0m`;
|
|
888
909
|
var CLOSE_LINK = `${ESC}]8;;${ESC}\\`;
|
|
889
910
|
// ../kit/src/cli.ts
|
|
890
|
-
import { readFileSync as
|
|
911
|
+
import { readFileSync as readFileSync3, realpathSync } from "fs";
|
|
891
912
|
import { dirname as dirname3, join as join6 } from "path";
|
|
892
913
|
import process14 from "process";
|
|
893
914
|
|
|
@@ -1078,7 +1099,7 @@ async function printCandidates(found) {
|
|
|
1078
1099
|
function packageVersion(entry = Bun.main) {
|
|
1079
1100
|
for (let dir = dirname3(realpathSync(entry));; dir = dirname3(dir)) {
|
|
1080
1101
|
try {
|
|
1081
|
-
const { version } = JSON.parse(
|
|
1102
|
+
const { version } = JSON.parse(readFileSync3(join6(dir, "package.json"), "utf8"));
|
|
1082
1103
|
if (typeof version === "string")
|
|
1083
1104
|
return version;
|
|
1084
1105
|
} catch {}
|
|
@@ -1108,6 +1129,11 @@ async function runMain({ name, version, run, redact, usage }, argv = process14.a
|
|
|
1108
1129
|
}
|
|
1109
1130
|
// ../kit/src/folders.ts
|
|
1110
1131
|
var SKIPPED_FOLDERS = new Set(["node_modules", "vendor", "dist", "build", "target", "coverage", "venv", "__pycache__"]);
|
|
1132
|
+
function ignoredFolders(extra = [], where = {}) {
|
|
1133
|
+
const configured = readUserConfig("config", where).ignore;
|
|
1134
|
+
const names = Array.isArray(configured) ? configured.filter((name) => typeof name === "string" && name !== "") : [];
|
|
1135
|
+
return new Set([...SKIPPED_FOLDERS, ...extra, ...names]);
|
|
1136
|
+
}
|
|
1111
1137
|
// ../kit/src/secrets.ts
|
|
1112
1138
|
var SECRET_WORDS = new Set(["key", "pass", "pwd", "auth", "salt", "cookie", "session", "jwt", "ssn", "iban", "card", "cvv", "otp"]);
|
|
1113
1139
|
// ../kit/src/sessions.ts
|
|
@@ -1115,10 +1141,10 @@ var {Glob } = globalThis.Bun;
|
|
|
1115
1141
|
var SESSION_FILES = new Glob("*.json");
|
|
1116
1142
|
var ACCOUNT_DIRS = new Glob("*/sessions");
|
|
1117
1143
|
// package.json
|
|
1118
|
-
var version = "0.18.
|
|
1144
|
+
var version = "0.18.1";
|
|
1119
1145
|
|
|
1120
1146
|
// src/fix.ts
|
|
1121
|
-
import { existsSync as
|
|
1147
|
+
import { existsSync as existsSync5, statSync as statSync2 } from "fs";
|
|
1122
1148
|
import { rename, writeFile as writeFile2 } from "fs/promises";
|
|
1123
1149
|
import { join as join11 } from "path";
|
|
1124
1150
|
import process18 from "process";
|
|
@@ -1147,7 +1173,7 @@ function changedFiles(before, after) {
|
|
|
1147
1173
|
}
|
|
1148
1174
|
|
|
1149
1175
|
// src/compose.ts
|
|
1150
|
-
import { existsSync as
|
|
1176
|
+
import { existsSync as existsSync4 } from "fs";
|
|
1151
1177
|
import { homedir as homedir5 } from "os";
|
|
1152
1178
|
import { basename, dirname as dirname4, join as join8, relative, resolve as resolve3 } from "path";
|
|
1153
1179
|
import process16 from "process";
|
|
@@ -1344,11 +1370,11 @@ async function readServices(composeDir) {
|
|
|
1344
1370
|
function climb(dir) {
|
|
1345
1371
|
const folders = [dir];
|
|
1346
1372
|
let current = dir;
|
|
1347
|
-
while (!
|
|
1373
|
+
while (!existsSync4(join8(current, ".git")) && dirname4(current) !== current) {
|
|
1348
1374
|
current = dirname4(current);
|
|
1349
1375
|
folders.push(current);
|
|
1350
1376
|
}
|
|
1351
|
-
return
|
|
1377
|
+
return existsSync4(join8(current, ".git")) ? folders : [dir];
|
|
1352
1378
|
}
|
|
1353
1379
|
function containerPath(service, dir) {
|
|
1354
1380
|
const holding = service.mounts.filter((mount) => {
|
|
@@ -1504,7 +1530,6 @@ var CS_FIXER_CONFIGS = [".php-cs-fixer.php", ".php-cs-fixer.dist.php"];
|
|
|
1504
1530
|
var JUST_TIMEOUT_MS = 1e4;
|
|
1505
1531
|
var PHPSTAN_CONFIGS = ["phpstan.neon", "phpstan.neon.dist", "phpstan.dist.neon"];
|
|
1506
1532
|
var PHPUNIT_CONFIGS = ["phpunit.xml", "phpunit.xml.dist", "phpunit.dist.xml"];
|
|
1507
|
-
var SKIPPED = new Set([...SKIPPED_FOLDERS, "var", "tmp"]);
|
|
1508
1533
|
async function readFirst(dir, files) {
|
|
1509
1534
|
for (const file of files) {
|
|
1510
1535
|
const handle = Bun.file(join9(dir, file));
|
|
@@ -1599,8 +1624,9 @@ async function discoverProjects(dir) {
|
|
|
1599
1624
|
return [{ dir, steps: own }];
|
|
1600
1625
|
const projects = [];
|
|
1601
1626
|
const entries = await readdir2(dir, { withFileTypes: true });
|
|
1627
|
+
const ignored = ignoredFolders(["var", "tmp"]);
|
|
1602
1628
|
for (const entry of entries.toSorted((a, b) => a.name.localeCompare(b.name))) {
|
|
1603
|
-
if (!entry.isDirectory() || entry.name.startsWith(".") ||
|
|
1629
|
+
if (!entry.isDirectory() || entry.name.startsWith(".") || ignored.has(entry.name))
|
|
1604
1630
|
continue;
|
|
1605
1631
|
const steps = await discover(join9(dir, entry.name));
|
|
1606
1632
|
if (steps.length > 0)
|
|
@@ -1627,6 +1653,7 @@ var fixOptions = {
|
|
|
1627
1653
|
var options = {
|
|
1628
1654
|
...fixOptions,
|
|
1629
1655
|
fix: { type: "boolean", short: "f", description: "run the folder's fixers and formatters instead of the steps, as the fix bin does" },
|
|
1656
|
+
quiet: { type: "boolean", short: "q", description: "print nothing for a passing step, and nothing at all when every step passes" },
|
|
1630
1657
|
failed: { type: "boolean", description: "run only the steps that failed in the last run of this folder, read from the run folder" },
|
|
1631
1658
|
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" },
|
|
1632
1659
|
slot: { type: "boolean", description: "run each step through slot, queued behind the machine-wide slots of the other sessions (needs the slot bin)" }
|
|
@@ -2385,7 +2412,7 @@ async function toolFixers(dir) {
|
|
|
2385
2412
|
fixers.push({ name: "makefile", command: "declare every target .PHONY", source: makefile, write: async (cwd) => {
|
|
2386
2413
|
const path = join11(cwd, makefile);
|
|
2387
2414
|
const current = await Bun.file(path).text();
|
|
2388
|
-
const { content, targets } = declarePhony(current, (name) =>
|
|
2415
|
+
const { content, targets } = declarePhony(current, (name) => existsSync5(join11(cwd, name)));
|
|
2389
2416
|
if (content !== current)
|
|
2390
2417
|
await replaceFile(path, content);
|
|
2391
2418
|
return `.PHONY: ${targets.join(" ")}`;
|
package/dist/j-cli.js
CHANGED
|
@@ -9,6 +9,7 @@ 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);
|
|
@@ -887,7 +908,7 @@ var ESCAPE_CODE = new RegExp(`${ESC}(?:\\[[\\x30-\\x3F]*[\\x20-\\x2F]*[\\x40-\\x
|
|
|
887
908
|
var RESET_STYLE = `${ESC}[0m`;
|
|
888
909
|
var CLOSE_LINK = `${ESC}]8;;${ESC}\\`;
|
|
889
910
|
// ../kit/src/cli.ts
|
|
890
|
-
import { readFileSync as
|
|
911
|
+
import { readFileSync as readFileSync3, realpathSync } from "fs";
|
|
891
912
|
import { dirname as dirname3, join as join6 } from "path";
|
|
892
913
|
import process14 from "process";
|
|
893
914
|
|
|
@@ -1078,7 +1099,7 @@ async function printCandidates(found) {
|
|
|
1078
1099
|
function packageVersion(entry = Bun.main) {
|
|
1079
1100
|
for (let dir = dirname3(realpathSync(entry));; dir = dirname3(dir)) {
|
|
1080
1101
|
try {
|
|
1081
|
-
const { version } = JSON.parse(
|
|
1102
|
+
const { version } = JSON.parse(readFileSync3(join6(dir, "package.json"), "utf8"));
|
|
1082
1103
|
if (typeof version === "string")
|
|
1083
1104
|
return version;
|
|
1084
1105
|
} catch {}
|
|
@@ -1108,6 +1129,11 @@ async function runMain({ name, version, run, redact, usage }, argv = process14.a
|
|
|
1108
1129
|
}
|
|
1109
1130
|
// ../kit/src/folders.ts
|
|
1110
1131
|
var SKIPPED_FOLDERS = new Set(["node_modules", "vendor", "dist", "build", "target", "coverage", "venv", "__pycache__"]);
|
|
1132
|
+
function ignoredFolders(extra = [], where = {}) {
|
|
1133
|
+
const configured = readUserConfig("config", where).ignore;
|
|
1134
|
+
const names = Array.isArray(configured) ? configured.filter((name) => typeof name === "string" && name !== "") : [];
|
|
1135
|
+
return new Set([...SKIPPED_FOLDERS, ...extra, ...names]);
|
|
1136
|
+
}
|
|
1111
1137
|
// ../kit/src/secrets.ts
|
|
1112
1138
|
var SECRET_WORDS = new Set(["key", "pass", "pwd", "auth", "salt", "cookie", "session", "jwt", "ssn", "iban", "card", "cvv", "otp"]);
|
|
1113
1139
|
// ../kit/src/sessions.ts
|
|
@@ -1115,13 +1141,13 @@ var {Glob } = globalThis.Bun;
|
|
|
1115
1141
|
var SESSION_FILES = new Glob("*.json");
|
|
1116
1142
|
var ACCOUNT_DIRS = new Glob("*/sessions");
|
|
1117
1143
|
// package.json
|
|
1118
|
-
var version = "0.18.
|
|
1144
|
+
var version = "0.18.1";
|
|
1119
1145
|
|
|
1120
1146
|
// src/j.ts
|
|
1121
1147
|
import process21 from "process";
|
|
1122
1148
|
|
|
1123
1149
|
// ../kit/src/picker.ts
|
|
1124
|
-
import { existsSync as
|
|
1150
|
+
import { existsSync as existsSync4, mkdirSync as mkdirSync2, readFileSync as readFileSync4, writeFileSync } from "fs";
|
|
1125
1151
|
import { homedir as homedir5 } from "os";
|
|
1126
1152
|
import { dirname as dirname4, join as join7 } from "path";
|
|
1127
1153
|
import process18 from "process";
|
|
@@ -1219,7 +1245,9 @@ var COLUMN_GAP = 2;
|
|
|
1219
1245
|
var PASTE_START = "\x1B[200~";
|
|
1220
1246
|
var PASTE_END = "\x1B[201~";
|
|
1221
1247
|
var LAST_WORD = /\S*\s*$/;
|
|
1222
|
-
var KEY_SEQUENCES = /\x1B\[[0-9;]*[A-Z~]|\x1BO[A-Z]|\x1B[\s\S]|[\s\S]/gu;
|
|
1248
|
+
var KEY_SEQUENCES = /\x1B\[<[0-9;]*[A-Za-z]|\x1B\[[0-9;]*[A-Z~]|\x1BO[A-Z]|\x1B[\s\S]|[\s\S]/gu;
|
|
1249
|
+
var MOUSE = /^\x1B\[<(\d+);\d+;\d+[a-z]$/i;
|
|
1250
|
+
var WHEEL_LINES = 3;
|
|
1223
1251
|
var KEYS = {
|
|
1224
1252
|
"\x1B[A": "up",
|
|
1225
1253
|
"\x1BOA": "up",
|
|
@@ -1301,6 +1329,9 @@ function lay(rows, searched) {
|
|
|
1301
1329
|
function parseKeys(input, paste = { active: false }, ctrls = []) {
|
|
1302
1330
|
const codes = new Map(ctrls.map((name) => [String.fromCharCode(name.codePointAt(name.length - 1) - 96), name]));
|
|
1303
1331
|
return (input.match(KEY_SEQUENCES) ?? []).flatMap((sequence) => {
|
|
1332
|
+
const wheel = MOUSE.exec(sequence)?.[1];
|
|
1333
|
+
if (wheel !== undefined)
|
|
1334
|
+
return repeat(wheel === "64" ? "up" : "down", wheel === "64" || wheel === "65" ? WHEEL_LINES : 0);
|
|
1304
1335
|
const named = codes.get(sequence);
|
|
1305
1336
|
const key = named === undefined ? KEYS[sequence] : { ctrl: named };
|
|
1306
1337
|
if (sequence === PASTE_START || sequence === PASTE_END) {
|
|
@@ -1543,7 +1574,7 @@ function caretColumn(state, layout) {
|
|
|
1543
1574
|
}
|
|
1544
1575
|
function helpLines(state, layout, theme) {
|
|
1545
1576
|
const lines = [
|
|
1546
|
-
"type to filter, up, down, ctrl-p, ctrl-n, pgup, pgdn, home, end move",
|
|
1577
|
+
"type to filter, up, down, ctrl-p, ctrl-n, pgup, pgdn, home, end, the wheel move",
|
|
1547
1578
|
`enter picks${state.multi ? ", tab marks" : ""}, ctrl-u clears the query, ctrl-w a word, esc or ctrl-c cancels`,
|
|
1548
1579
|
...state.expect.length > 0 ? [`${state.expect.join(", ")} end the pick as this command asks`] : []
|
|
1549
1580
|
];
|
|
@@ -1593,8 +1624,11 @@ var ESCAPE_WAIT_MS = 30;
|
|
|
1593
1624
|
var OPEN = { ctrl: "open" };
|
|
1594
1625
|
var HIDE_CURSOR = "\x1B[?25l";
|
|
1595
1626
|
var SHOW_CURSOR = "\x1B[?25h";
|
|
1627
|
+
var CARET = "\x1B[7m \x1B[27m";
|
|
1596
1628
|
var PASTE_ON = "\x1B[?2004h";
|
|
1597
1629
|
var PASTE_OFF = "\x1B[?2004l";
|
|
1630
|
+
var MOUSE_ON = "\x1B[?1000h\x1B[?1006h";
|
|
1631
|
+
var MOUSE_OFF = "\x1B[?1006l\x1B[?1000l";
|
|
1598
1632
|
var CLEAR_BELOW = "\r\x1B[J";
|
|
1599
1633
|
var SIGNALS2 = ["SIGINT", "SIGTERM", "SIGHUP"];
|
|
1600
1634
|
function up(lines) {
|
|
@@ -1657,21 +1691,18 @@ async function select(rows, settings, terminal = openTerminal()) {
|
|
|
1657
1691
|
let finish;
|
|
1658
1692
|
let restored = false;
|
|
1659
1693
|
let escape;
|
|
1660
|
-
let caret;
|
|
1661
1694
|
function draw(clear = false) {
|
|
1662
1695
|
if (restored)
|
|
1663
1696
|
return;
|
|
1664
1697
|
const layout = layoutFor({ columns: terminal.columns, rows: terminal.rows }, settings.height, settings.preview !== undefined, settings.previewPosition);
|
|
1665
1698
|
let frame = HIDE_CURSOR;
|
|
1666
1699
|
if (reserved !== layout.height || clear) {
|
|
1667
|
-
frame += clear && caret !== undefined ? up(Math.floor((caret - 1) / terminal.columns)) : "";
|
|
1668
1700
|
frame += CLEAR_BELOW + `
|
|
1669
1701
|
`.repeat(layout.height - 1) + up(layout.height - 1);
|
|
1670
1702
|
reserved = layout.height;
|
|
1671
1703
|
}
|
|
1672
|
-
caret = caretColumn(state, layout);
|
|
1673
1704
|
frame += `\r${render(state, layout, theme, preview).map((line) => `\x1B[2K${line}`).join(`
|
|
1674
|
-
`)}${up(layout.height - 1)}\r\x1B[${
|
|
1705
|
+
`)}${up(layout.height - 1)}\r\x1B[${caretColumn(state, layout)}G${CARET}\r`;
|
|
1675
1706
|
terminal.write(frame);
|
|
1676
1707
|
}
|
|
1677
1708
|
function pageSize() {
|
|
@@ -1710,7 +1741,7 @@ async function select(rows, settings, terminal = openTerminal()) {
|
|
|
1710
1741
|
clearTimeout(previewTimer);
|
|
1711
1742
|
clearTimeout(escape);
|
|
1712
1743
|
previewing.abort();
|
|
1713
|
-
terminal.write(`${CLEAR_BELOW}${PASTE_OFF}${SHOW_CURSOR}`);
|
|
1744
|
+
terminal.write(`${CLEAR_BELOW}${MOUSE_OFF}${PASTE_OFF}${SHOW_CURSOR}`);
|
|
1714
1745
|
terminal.close();
|
|
1715
1746
|
}
|
|
1716
1747
|
const stop = () => {
|
|
@@ -1789,7 +1820,7 @@ async function select(rows, settings, terminal = openTerminal()) {
|
|
|
1789
1820
|
for (const signal of SIGNALS2)
|
|
1790
1821
|
process17.once(signal, stop);
|
|
1791
1822
|
try {
|
|
1792
|
-
terminal.write(PASTE_ON);
|
|
1823
|
+
terminal.write(`${PASTE_ON}${MOUSE_ON}`);
|
|
1793
1824
|
terminal.listen(onChunk, () => draw(true));
|
|
1794
1825
|
refreshPreview();
|
|
1795
1826
|
draw(true);
|
|
@@ -1837,7 +1868,7 @@ function historyFile(name) {
|
|
|
1837
1868
|
function history(name) {
|
|
1838
1869
|
try {
|
|
1839
1870
|
const file = historyFile(name);
|
|
1840
|
-
return
|
|
1871
|
+
return existsSync4(file) ? JSON.parse(readFileSync4(file, "utf-8")) : {};
|
|
1841
1872
|
} catch {
|
|
1842
1873
|
return {};
|
|
1843
1874
|
}
|
|
@@ -1914,16 +1945,13 @@ async function ask(question, { hint, terminal = process19 }, render, press) {
|
|
|
1914
1945
|
if (!isInteractive(terminal))
|
|
1915
1946
|
fail(`cannot ask "${question}" off a terminal`, 2, hint);
|
|
1916
1947
|
const colors = paint(stderr);
|
|
1917
|
-
let drawn = [];
|
|
1918
1948
|
let current = "asking";
|
|
1919
1949
|
let outcome;
|
|
1920
1950
|
const columns = () => stderr.columns || 80;
|
|
1921
|
-
const draw = (state) => {
|
|
1951
|
+
const draw = (state, last = false) => {
|
|
1922
1952
|
const frame = render(colors, state, { columns: columns(), rows: stderr.rows || 24 });
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
`)}`);
|
|
1926
|
-
drawn = frame;
|
|
1953
|
+
stderr.write(`\r\x1B[0J${frame.join(`
|
|
1954
|
+
`)}${last || frame.length < 2 ? "" : `\x1B[${frame.length - 1}A`}${last ? "" : "\r"}`);
|
|
1927
1955
|
current = state;
|
|
1928
1956
|
};
|
|
1929
1957
|
const redraw = () => draw(current);
|
|
@@ -1959,7 +1987,7 @@ async function ask(question, { hint, terminal = process19 }, render, press) {
|
|
|
1959
1987
|
});
|
|
1960
1988
|
} finally {
|
|
1961
1989
|
stderr.off?.("resize", redraw);
|
|
1962
|
-
draw(outcome ?? "cancel");
|
|
1990
|
+
draw(outcome ?? "cancel", true);
|
|
1963
1991
|
stderr.write(`
|
|
1964
1992
|
\x1B[?25h\x1B[?2004l`);
|
|
1965
1993
|
stdin.setRawMode(false);
|
|
@@ -1971,7 +1999,7 @@ async function ask(question, { hint, terminal = process19 }, render, press) {
|
|
|
1971
1999
|
import process20 from "process";
|
|
1972
2000
|
|
|
1973
2001
|
// src/jobs.ts
|
|
1974
|
-
import { existsSync as
|
|
2002
|
+
import { existsSync as existsSync5, readdirSync, readFileSync as readFileSync5 } from "fs";
|
|
1975
2003
|
import { dirname as dirname5, join as join9, resolve as resolvePath } from "path";
|
|
1976
2004
|
|
|
1977
2005
|
// src/steps.ts
|
|
@@ -1985,7 +2013,6 @@ var CS_FIXER_CONFIGS = [".php-cs-fixer.php", ".php-cs-fixer.dist.php"];
|
|
|
1985
2013
|
var JUST_TIMEOUT_MS = 1e4;
|
|
1986
2014
|
var PHPSTAN_CONFIGS = ["phpstan.neon", "phpstan.neon.dist", "phpstan.dist.neon"];
|
|
1987
2015
|
var PHPUNIT_CONFIGS = ["phpunit.xml", "phpunit.xml.dist", "phpunit.dist.xml"];
|
|
1988
|
-
var SKIPPED = new Set([...SKIPPED_FOLDERS, "var", "tmp"]);
|
|
1989
2016
|
async function readFirst(dir, files) {
|
|
1990
2017
|
for (const file of files) {
|
|
1991
2018
|
const handle = Bun.file(join8(dir, file));
|
|
@@ -2080,8 +2107,9 @@ async function discoverProjects(dir) {
|
|
|
2080
2107
|
return [{ dir, steps: own }];
|
|
2081
2108
|
const projects = [];
|
|
2082
2109
|
const entries = await readdir2(dir, { withFileTypes: true });
|
|
2110
|
+
const ignored = ignoredFolders(["var", "tmp"]);
|
|
2083
2111
|
for (const entry of entries.toSorted((a, b) => a.name.localeCompare(b.name))) {
|
|
2084
|
-
if (!entry.isDirectory() || entry.name.startsWith(".") ||
|
|
2112
|
+
if (!entry.isDirectory() || entry.name.startsWith(".") || ignored.has(entry.name))
|
|
2085
2113
|
continue;
|
|
2086
2114
|
const steps = await discover(join8(dir, entry.name));
|
|
2087
2115
|
if (steps.length > 0)
|
|
@@ -2128,16 +2156,17 @@ function list2(dir) {
|
|
|
2128
2156
|
}
|
|
2129
2157
|
function locate(dir, here, names) {
|
|
2130
2158
|
for (let current = dir;; current = join9(current, "..")) {
|
|
2131
|
-
const found = names.find((name) =>
|
|
2159
|
+
const found = names.find((name) => existsSync5(join9(current, name)));
|
|
2132
2160
|
if (found !== undefined)
|
|
2133
2161
|
return join9(current, found);
|
|
2134
2162
|
const absolute = resolvePath(current);
|
|
2135
|
-
if (!here ||
|
|
2163
|
+
if (!here || existsSync5(join9(current, ".git")) || dirname5(absolute) === absolute)
|
|
2136
2164
|
return;
|
|
2137
2165
|
}
|
|
2138
2166
|
}
|
|
2139
2167
|
function children(dir = ".") {
|
|
2140
|
-
|
|
2168
|
+
const ignored = ignoredFolders();
|
|
2169
|
+
return readdirSync(dir, { withFileTypes: true }).filter((child) => child.isDirectory() && !child.name.startsWith(".") && !ignored.has(child.name)).map((child) => child.name).toSorted();
|
|
2141
2170
|
}
|
|
2142
2171
|
function build(base, items) {
|
|
2143
2172
|
return items.map((item) => ({ ...base, doc: null, parameters: [], ...item }));
|
|
@@ -2221,10 +2250,10 @@ function show(source, target) {
|
|
|
2221
2250
|
`).trimEnd();
|
|
2222
2251
|
}
|
|
2223
2252
|
function make(dir) {
|
|
2224
|
-
const file = MAKEFILES.find((name) =>
|
|
2253
|
+
const file = MAKEFILES.find((name) => existsSync5(join9(dir, name)));
|
|
2225
2254
|
if (file === undefined)
|
|
2226
2255
|
return [];
|
|
2227
|
-
const source =
|
|
2256
|
+
const source = readFileSync5(join9(dir, file), "utf-8");
|
|
2228
2257
|
return build({ kind: "make", tag: "make", runner: ["make"], separated: false, dir }, targets2(source).map((target) => ({ ...target, body: show(source, target.name) })));
|
|
2229
2258
|
}
|
|
2230
2259
|
function manager(dir, manifest) {
|
|
@@ -2233,7 +2262,7 @@ function manager(dir, manifest) {
|
|
|
2233
2262
|
if (known !== undefined)
|
|
2234
2263
|
return known[1];
|
|
2235
2264
|
for (let current = resolvePath(dir);; current = dirname5(current)) {
|
|
2236
|
-
const found = LOCKFILES.find(([file]) =>
|
|
2265
|
+
const found = LOCKFILES.find(([file]) => existsSync5(join9(current, file)));
|
|
2237
2266
|
if (found !== undefined)
|
|
2238
2267
|
return found[1];
|
|
2239
2268
|
if (dirname5(current) === current)
|
|
@@ -2247,7 +2276,7 @@ function packageScripts(dir, here) {
|
|
|
2247
2276
|
const file = locate(dir, here, ["package.json"]);
|
|
2248
2277
|
if (file === undefined)
|
|
2249
2278
|
return [];
|
|
2250
|
-
const manifest = JSON.parse(
|
|
2279
|
+
const manifest = JSON.parse(readFileSync5(file, "utf-8"));
|
|
2251
2280
|
const tool = manager(dirname5(file), manifest);
|
|
2252
2281
|
const items = Object.entries(table2(manifest.scripts)).map(([name, command]) => ({ name, body: text2(command) }));
|
|
2253
2282
|
return build({ kind: "package", tag: tool, runner: [tool, "run"], separated: tool === "npm", dir: dirname5(file) }, items);
|
|
@@ -2256,7 +2285,7 @@ function composer(dir, here) {
|
|
|
2256
2285
|
const file = locate(dir, here, ["composer.json"]);
|
|
2257
2286
|
if (file === undefined)
|
|
2258
2287
|
return [];
|
|
2259
|
-
const manifest = JSON.parse(
|
|
2288
|
+
const manifest = JSON.parse(readFileSync5(file, "utf-8"));
|
|
2260
2289
|
const descriptions = table2(manifest["scripts-descriptions"]);
|
|
2261
2290
|
const items = Object.entries(table2(manifest.scripts)).map(([name, command]) => ({ name, doc: field(descriptions, name), body: text2(command) }));
|
|
2262
2291
|
return build({ kind: "composer", tag: "composer", runner: ["composer", "run"], separated: true, dir: dirname5(file) }, items);
|
|
@@ -2265,7 +2294,7 @@ function deno(dir, here) {
|
|
|
2265
2294
|
const file = locate(dir, here, ["deno.json", "deno.jsonc"]);
|
|
2266
2295
|
if (file === undefined)
|
|
2267
2296
|
return [];
|
|
2268
|
-
const manifest = Bun.JSONC.parse(
|
|
2297
|
+
const manifest = Bun.JSONC.parse(readFileSync5(file, "utf-8"));
|
|
2269
2298
|
const items = Object.entries(table2(manifest.tasks)).map(([name, task]) => ({ name, doc: field(task, "description"), body: field(task, "command") ?? text2(task) }));
|
|
2270
2299
|
return build({ kind: "deno", tag: "deno", runner: ["deno", "task"], separated: false, dir: dirname5(file) }, items);
|
|
2271
2300
|
}
|
|
@@ -2273,12 +2302,12 @@ function taskfile(dir, here) {
|
|
|
2273
2302
|
const file = locate(dir, here, TASKFILES);
|
|
2274
2303
|
if (file === undefined)
|
|
2275
2304
|
return [];
|
|
2276
|
-
const tasks = table2(Bun.YAML.parse(
|
|
2305
|
+
const tasks = table2(Bun.YAML.parse(readFileSync5(file, "utf-8"))?.tasks);
|
|
2277
2306
|
const items = Object.entries(tasks).filter(([, task]) => !(task !== null && typeof task === "object" && task.internal === true)).map(([name, task]) => ({ name, doc: field(task, "desc") ?? field(task, "summary"), body: text2(task) }));
|
|
2278
2307
|
return build({ kind: "task", tag: "task", runner: ["task"], separated: true, dir: dirname5(file) }, items);
|
|
2279
2308
|
}
|
|
2280
2309
|
function mise(dir, here) {
|
|
2281
|
-
if (!has("mise") || !here && !MISE_FILES.some((name) =>
|
|
2310
|
+
if (!has("mise") || !here && !MISE_FILES.some((name) => existsSync5(join9(dir, name))))
|
|
2282
2311
|
return [];
|
|
2283
2312
|
const proc = Bun.spawnSync(["mise", "tasks", "ls", "--json"], { cwd: dir, stderr: "pipe" });
|
|
2284
2313
|
if (!proc.success)
|
|
@@ -2292,7 +2321,7 @@ function pyproject(dir, here) {
|
|
|
2292
2321
|
const file = locate(dir, here, ["pyproject.toml"]);
|
|
2293
2322
|
if (file === undefined)
|
|
2294
2323
|
return [];
|
|
2295
|
-
const manifest = Bun.TOML.parse(
|
|
2324
|
+
const manifest = Bun.TOML.parse(readFileSync5(file, "utf-8"));
|
|
2296
2325
|
const tool = table2(manifest.tool);
|
|
2297
2326
|
const project = table2(manifest.project);
|
|
2298
2327
|
const uv = locate(dirname5(file), true, ["uv.lock"]) !== undefined;
|
|
@@ -2324,9 +2353,9 @@ function readOr(read, fallback) {
|
|
|
2324
2353
|
}
|
|
2325
2354
|
}
|
|
2326
2355
|
function workspaces() {
|
|
2327
|
-
const manifest = readOr(() => JSON.parse(
|
|
2356
|
+
const manifest = readOr(() => JSON.parse(readFileSync5("package.json", "utf-8")), {});
|
|
2328
2357
|
const declared = Array.isArray(manifest.workspaces) ? manifest.workspaces : table2(manifest.workspaces).packages;
|
|
2329
|
-
const pnpm = readOr(() => table2(Bun.YAML.parse(
|
|
2358
|
+
const pnpm = readOr(() => table2(Bun.YAML.parse(readFileSync5("pnpm-workspace.yaml", "utf-8"))).packages, undefined);
|
|
2330
2359
|
const patterns = [declared, pnpm].flatMap((value) => Array.isArray(value) ? value.filter((pattern) => typeof pattern === "string") : []);
|
|
2331
2360
|
const excluded = patterns.filter((pattern) => pattern.startsWith("!")).map((pattern) => new Bun.Glob(pattern.slice(1)));
|
|
2332
2361
|
return patterns.filter((pattern) => !pattern.startsWith("!")).flatMap((pattern) => [...new Bun.Glob(`${pattern.replace(TRAILING_SLASHES, "")}/package.json`).scanSync({ cwd: "." })].map((file) => dirname5(file))).filter((dir) => !dir.split("/").includes("node_modules") && !excluded.some((glob) => glob.match(dir)));
|
|
@@ -2453,13 +2482,10 @@ function listed2(found) {
|
|
|
2453
2482
|
editsTyped: true
|
|
2454
2483
|
}));
|
|
2455
2484
|
}
|
|
2456
|
-
function
|
|
2485
|
+
function listing(found) {
|
|
2457
2486
|
const colors = paint(process21.stdout);
|
|
2458
2487
|
const labels = labelled(found);
|
|
2459
|
-
|
|
2460
|
-
const widths = rows[0]?.map((_, column) => Math.max(...rows.map((cells) => cells[column].length))) ?? [];
|
|
2461
|
-
return found.map((entry, index) => `${rows[index].map((cell, column) => cell.padEnd(widths[column])).join(" ")} ${colors.dim(entry.doc ?? "")}`.trimEnd()).join(`
|
|
2462
|
-
`);
|
|
2488
|
+
return table(found.map((entry) => [...labels ? [entry.tag] : [], key(entry), signature(entry), colors.dim(entry.doc ?? "")]));
|
|
2463
2489
|
}
|
|
2464
2490
|
function missing(entry, given) {
|
|
2465
2491
|
return entry.parameters.slice(given.length).filter((parameter) => parameter.default === null && parameter.kind === "singular").map((parameter) => parameter.name);
|
|
@@ -2522,7 +2548,7 @@ async function j2(argv) {
|
|
|
2522
2548
|
if (parsed.values.json === true)
|
|
2523
2549
|
printJson(found.map((each) => ({ id: id(each), key: key(each), runner: each.tag, dir: each.dir, name: each.name, doc: each.doc, parameters: each.parameters })));
|
|
2524
2550
|
else
|
|
2525
|
-
console.log(
|
|
2551
|
+
console.log(listing(found));
|
|
2526
2552
|
return 0;
|
|
2527
2553
|
}
|
|
2528
2554
|
entry = await pickJob(byRecency(found, previous, id));
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kaynooo/cli-check",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.18.
|
|
4
|
+
"version": "0.18.1",
|
|
5
5
|
"description": "check, fix and errs: run a repo's check, typecheck, lint and test steps or its fixers, inside its docker compose service when one mounts the folder, showing only what failed with each full output saved to a file, and turn tsc, eslint, bun test, vitest, playwright, phpunit, phpstan and php-cs-fixer logs into file:line:col errors.",
|
|
6
6
|
"author": "Kaynooo <contact@kaynooo.fr>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -34,6 +34,6 @@
|
|
|
34
34
|
"j": "$npm_execpath src/j-cli.ts"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@kaynooo/cli-kit": "0.
|
|
37
|
+
"@kaynooo/cli-kit": "0.37.0"
|
|
38
38
|
}
|
|
39
39
|
}
|