@kaynooo/cli-check 0.18.2 → 0.18.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -467,18 +467,14 @@ var FULL_STOP = /\.$/;
467
467
  function usageLine(usage, colors = paint(process8.stdout)) {
468
468
  return `${colors.bold("Usage:")} ${usage.replace(USAGE_PREFIX, "").replaceAll(OPTIONAL, (part) => colors.dim(part))}`;
469
469
  }
470
- function helpText(usage, options, colors = paint(process8.stdout), { examples = [], replaces, exits = [] } = {}) {
471
- return [usageLine(usage, colors), ...replacesRows(replaces, colors), "", colors.bold("Options:"), ...optionRows(options, colors), ...exitRows(exits, colors), ...exampleRows(examples, colors)].join(`
470
+ function helpText(usage, options, colors = paint(process8.stdout), { examples = [], exits = [] } = {}) {
471
+ return [usageLine(usage, colors), "", colors.bold("Options:"), ...optionRows(options, colors), ...exitRows(exits, colors), ...exampleRows(examples, colors)].join(`
472
472
  `);
473
473
  }
474
474
  function exitRows(exits, colors = paint(process8.stdout)) {
475
475
  if (exits.length === 0)
476
476
  return [];
477
- const width = Math.max(...exits.map(([code]) => String(code).length));
478
- return ["", colors.bold("Exits:"), ...exits.map(([code, meaning]) => ` ${colors.cyan(String(code).padEnd(width))} ${meaning}`)];
479
- }
480
- function replacesRows(replaces, colors = paint(process8.stdout)) {
481
- return replaces === undefined || outputMode() === "agent" ? [] : ["", `${colors.bold("Instead of:")} ${replaces}`];
477
+ return ["", `${colors.bold("Exit codes:")} ${exits.map(([code, meaning]) => `${colors.cyan(String(code))} ${meaning}`).join(", ")}`];
482
478
  }
483
479
  function wantsHelpJson(env = process8.env) {
484
480
  return env.KIT_HELP === "json";
@@ -1121,7 +1117,11 @@ async function printCandidates(found) {
1121
1117
  return 0;
1122
1118
  }
1123
1119
  function packageVersion(entry = Bun.main) {
1124
- for (let dir = dirname3(realpathSync2(entry));; dir = dirname3(dir)) {
1120
+ let resolved = entry;
1121
+ try {
1122
+ resolved = realpathSync2(entry);
1123
+ } catch {}
1124
+ for (let dir = dirname3(resolved);; dir = dirname3(dir)) {
1125
1125
  try {
1126
1126
  const { version } = JSON.parse(readFileSync4(join6(dir, "package.json"), "utf8"));
1127
1127
  if (typeof version === "string")
@@ -1165,7 +1165,7 @@ var {Glob } = globalThis.Bun;
1165
1165
  var SESSION_FILES = new Glob("*.json");
1166
1166
  var ACCOUNT_DIRS = new Glob("*/sessions");
1167
1167
  // package.json
1168
- var version = "0.18.2";
1168
+ var version = "0.18.3";
1169
1169
 
1170
1170
  // src/check.ts
1171
1171
  import { writeFile as writeFile3 } from "fs/promises";
@@ -2412,8 +2412,8 @@ It looks at the folder itself only, so each package of a monorepo gets its own r
2412
2412
  A script or php-cs-fixer runs inside the docker compose service that bind-mounts the folder (found in compose.yml, compose.yaml or docker-compose.yml, up to the repository root), at the matching path; a service that is down is never started, the fixer fails naming it. The formatters run on the host. --in picks the service, --host forces the host.
2413
2413
  Prints one line per fixer, what a failing one said, then the files the run changed. Each fixer's full output is saved to the file whose path ends its line.
2414
2414
  A fixer still running after --timeout is ended with everything it started, but not what it started inside a container.
2415
- Exits 0 when every fixer ran or was skipped for a missing binary, 1 when one failed, 2 on bad usage, when nothing applies or when a fixer timed out.
2416
2415
  --json prints {fixers: [{name, command, in?, ok, ms, log, failed?} or {name, command, skipped}], changed} once every fixer ran, changed null outside a git repository.`;
2416
+ var EXITS = [[0, "every fixer ran or was skipped for a missing binary"], [1, "one failed"], [2, "bad usage, nothing applies or a fixer timed out"]];
2417
2417
  var RUNNING = "KAYNOOO_CLI_FIX";
2418
2418
  var JUSTFILES2 = ["justfile", "Justfile", ".justfile"];
2419
2419
  var RUFF_CONFIGS = ["ruff.toml", ".ruff.toml"];
@@ -2493,7 +2493,7 @@ function printChanged(changed) {
2493
2493
  console.log(` and ${changed.length - MAX_CHANGED} more`);
2494
2494
  }
2495
2495
  async function fix(args, cwd = process19.cwd()) {
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"]] });
2496
+ const parsed = parse(args, fixUsage, fixOptions, { exits: EXITS, 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"]] });
2497
2497
  return runFixers(parsed.values, cwd);
2498
2498
  }
2499
2499
  async function runFixers(values, cwd) {
@@ -2652,8 +2652,8 @@ With --quiet, passing steps print nothing, and a fully passing run prints nothin
2652
2652
  A step still running after --timeout is ended with everything it started, but not what it started inside a container.
2653
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.
2654
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.
2655
- Exits 0 when every step passed, 1 when one failed, 2 on bad usage, when no step is found or when a step timed out.
2656
2655
  --json prints [{name, command, in?, ok, ms, log, failed?}] once every step ran, --list --json [{name, command, source, in?}], in the compose service the step ran in; with --fix the shape \`fix --json\` prints.`;
2656
+ var EXITS2 = [[0, "every step passed"], [1, "one failed"], [2, "bad usage, no step is found or a step timed out"]];
2657
2657
  function slotted(command) {
2658
2658
  return `slot -- sh -c ${shellQuote(command)}`;
2659
2659
  }
@@ -2689,7 +2689,7 @@ function summaryLine(outcomes) {
2689
2689
  return parts.join(colors.dim(" \xB7 "));
2690
2690
  }
2691
2691
  async function check(args, cwd = process20.cwd()) {
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"]] });
2692
+ const parsed = parse(args, usage2, options, { exits: EXITS2, 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"]] });
2693
2693
  const settings = placeSettings(parsed.values);
2694
2694
  if (parsed.values.fix === true) {
2695
2695
  for (const flag of ["changed", "failed", "slot"]) {
package/dist/errs-cli.js CHANGED
@@ -467,18 +467,14 @@ var FULL_STOP = /\.$/;
467
467
  function usageLine(usage, colors = paint(process8.stdout)) {
468
468
  return `${colors.bold("Usage:")} ${usage.replace(USAGE_PREFIX, "").replaceAll(OPTIONAL, (part) => colors.dim(part))}`;
469
469
  }
470
- function helpText(usage, options, colors = paint(process8.stdout), { examples = [], replaces, exits = [] } = {}) {
471
- return [usageLine(usage, colors), ...replacesRows(replaces, colors), "", colors.bold("Options:"), ...optionRows(options, colors), ...exitRows(exits, colors), ...exampleRows(examples, colors)].join(`
470
+ function helpText(usage, options, colors = paint(process8.stdout), { examples = [], exits = [] } = {}) {
471
+ return [usageLine(usage, colors), "", colors.bold("Options:"), ...optionRows(options, colors), ...exitRows(exits, colors), ...exampleRows(examples, colors)].join(`
472
472
  `);
473
473
  }
474
474
  function exitRows(exits, colors = paint(process8.stdout)) {
475
475
  if (exits.length === 0)
476
476
  return [];
477
- const width = Math.max(...exits.map(([code]) => String(code).length));
478
- return ["", colors.bold("Exits:"), ...exits.map(([code, meaning]) => ` ${colors.cyan(String(code).padEnd(width))} ${meaning}`)];
479
- }
480
- function replacesRows(replaces, colors = paint(process8.stdout)) {
481
- return replaces === undefined || outputMode() === "agent" ? [] : ["", `${colors.bold("Instead of:")} ${replaces}`];
477
+ return ["", `${colors.bold("Exit codes:")} ${exits.map(([code, meaning]) => `${colors.cyan(String(code))} ${meaning}`).join(", ")}`];
482
478
  }
483
479
  function wantsHelpJson(env = process8.env) {
484
480
  return env.KIT_HELP === "json";
@@ -1121,7 +1117,11 @@ async function printCandidates(found) {
1121
1117
  return 0;
1122
1118
  }
1123
1119
  function packageVersion(entry = Bun.main) {
1124
- for (let dir = dirname3(realpathSync2(entry));; dir = dirname3(dir)) {
1120
+ let resolved = entry;
1121
+ try {
1122
+ resolved = realpathSync2(entry);
1123
+ } catch {}
1124
+ for (let dir = dirname3(resolved);; dir = dirname3(dir)) {
1125
1125
  try {
1126
1126
  const { version } = JSON.parse(readFileSync4(join6(dir, "package.json"), "utf8"));
1127
1127
  if (typeof version === "string")
@@ -1165,7 +1165,7 @@ var {Glob } = globalThis.Bun;
1165
1165
  var SESSION_FILES = new Glob("*.json");
1166
1166
  var ACCOUNT_DIRS = new Glob("*/sessions");
1167
1167
  // package.json
1168
- var version = "0.18.2";
1168
+ var version = "0.18.3";
1169
1169
 
1170
1170
  // src/errs.ts
1171
1171
  import { relative as relative2 } from "path";
@@ -2197,8 +2197,8 @@ errs --in <service> | --host -- <command> [args...]
2197
2197
  Prints one \`file:line:col: message (rule)\` line per error found in a tsc, tsgo, vue-tsc, bun check, eslint, keslint, bun test, vitest, playwright (list and line reporters), phpunit, paratest, phpstan (table, raw and json), php-cs-fixer, go (build, vet), cargo (rustc), ruff (concise and full) or pytest log, read from the file given, from stdin (no argument or -), or from the output of the command run after --.
2198
2198
  The lines no format recognised are counted on stderr, never dropped silently, and a command's full output is saved to a log file whose path is printed with that count.
2199
2199
  A command runs inside the docker compose service that bind-mounts the current folder (found in compose.yml, compose.yaml or docker-compose.yml, up to the repository root), at the matching path, with its output read here; a service that is down is never started, the call fails naming it. --in picks the service, --host forces the host.
2200
- Exits 0 when no error was found and the command, if any, passed, 1 when errors were found or the command failed, 2 on a usage error.
2201
2200
  --json prints {errors: [{tool, file, line, column, rule, severity, message, test?}], unrecognised, log?, code?}, tool one of tsc, eslint, bun check, bun test, vitest, playwright, phpunit, phpstan, php-cs-fixer, go, cargo, ruff, pytest.`;
2201
+ var EXITS = [[0, "no error was found and the command, if any, passed"], [1, "errors were found or the command failed"], [2, "a usage error"]];
2202
2202
  var options = {
2203
2203
  ...placeOptions,
2204
2204
  json: jsonOption()
@@ -2242,7 +2242,7 @@ async function readInput2(command, run, settings, cwd) {
2242
2242
  async function errs(args, cwd = process19.cwd()) {
2243
2243
  const first = args[0];
2244
2244
  const bare = first !== undefined && !first.startsWith("-") && !await Bun.file(first).exists();
2245
- const parsed = parse(bare ? [] : args, usage2, options, { rest: true, replaces: "reading raw tsc, eslint, phpunit, phpstan or playwright logs, or grepping a test summary out of them", examples: [["errs -- bun run check", "the type errors of a run"], ["bun test 2>&1 | errs", "the failed tests from stdin"], ["errs -- vendor/bin/phpunit", "each failed PHP test with its file and line"]] });
2245
+ const parsed = parse(bare ? [] : args, usage2, options, { exits: EXITS, rest: true, replaces: "reading raw tsc, eslint, phpunit, phpstan or playwright logs, or grepping a test summary out of them", examples: [["errs -- bun run check", "the type errors of a run"], ["bun test 2>&1 | errs", "the failed tests from stdin"], ["errs -- vendor/bin/phpunit", "each failed PHP test with its file and line"]] });
2246
2246
  if (parsed.positionals.length > 1)
2247
2247
  fail(`give one log, or a command after --
2248
2248
 
package/dist/fix-cli.js CHANGED
@@ -467,18 +467,14 @@ var FULL_STOP = /\.$/;
467
467
  function usageLine(usage, colors = paint(process8.stdout)) {
468
468
  return `${colors.bold("Usage:")} ${usage.replace(USAGE_PREFIX, "").replaceAll(OPTIONAL, (part) => colors.dim(part))}`;
469
469
  }
470
- function helpText(usage, options, colors = paint(process8.stdout), { examples = [], replaces, exits = [] } = {}) {
471
- return [usageLine(usage, colors), ...replacesRows(replaces, colors), "", colors.bold("Options:"), ...optionRows(options, colors), ...exitRows(exits, colors), ...exampleRows(examples, colors)].join(`
470
+ function helpText(usage, options, colors = paint(process8.stdout), { examples = [], exits = [] } = {}) {
471
+ return [usageLine(usage, colors), "", colors.bold("Options:"), ...optionRows(options, colors), ...exitRows(exits, colors), ...exampleRows(examples, colors)].join(`
472
472
  `);
473
473
  }
474
474
  function exitRows(exits, colors = paint(process8.stdout)) {
475
475
  if (exits.length === 0)
476
476
  return [];
477
- const width = Math.max(...exits.map(([code]) => String(code).length));
478
- return ["", colors.bold("Exits:"), ...exits.map(([code, meaning]) => ` ${colors.cyan(String(code).padEnd(width))} ${meaning}`)];
479
- }
480
- function replacesRows(replaces, colors = paint(process8.stdout)) {
481
- return replaces === undefined || outputMode() === "agent" ? [] : ["", `${colors.bold("Instead of:")} ${replaces}`];
477
+ return ["", `${colors.bold("Exit codes:")} ${exits.map(([code, meaning]) => `${colors.cyan(String(code))} ${meaning}`).join(", ")}`];
482
478
  }
483
479
  function wantsHelpJson(env = process8.env) {
484
480
  return env.KIT_HELP === "json";
@@ -1121,7 +1117,11 @@ async function printCandidates(found) {
1121
1117
  return 0;
1122
1118
  }
1123
1119
  function packageVersion(entry = Bun.main) {
1124
- for (let dir = dirname3(realpathSync2(entry));; dir = dirname3(dir)) {
1120
+ let resolved = entry;
1121
+ try {
1122
+ resolved = realpathSync2(entry);
1123
+ } catch {}
1124
+ for (let dir = dirname3(resolved);; dir = dirname3(dir)) {
1125
1125
  try {
1126
1126
  const { version } = JSON.parse(readFileSync4(join6(dir, "package.json"), "utf8"));
1127
1127
  if (typeof version === "string")
@@ -1165,7 +1165,7 @@ var {Glob } = globalThis.Bun;
1165
1165
  var SESSION_FILES = new Glob("*.json");
1166
1166
  var ACCOUNT_DIRS = new Glob("*/sessions");
1167
1167
  // package.json
1168
- var version = "0.18.2";
1168
+ var version = "0.18.3";
1169
1169
 
1170
1170
  // src/fix.ts
1171
1171
  import { existsSync as existsSync5, statSync as statSync2 } from "fs";
@@ -2409,8 +2409,8 @@ It looks at the folder itself only, so each package of a monorepo gets its own r
2409
2409
  A script or php-cs-fixer runs inside the docker compose service that bind-mounts the folder (found in compose.yml, compose.yaml or docker-compose.yml, up to the repository root), at the matching path; a service that is down is never started, the fixer fails naming it. The formatters run on the host. --in picks the service, --host forces the host.
2410
2410
  Prints one line per fixer, what a failing one said, then the files the run changed. Each fixer's full output is saved to the file whose path ends its line.
2411
2411
  A fixer still running after --timeout is ended with everything it started, but not what it started inside a container.
2412
- Exits 0 when every fixer ran or was skipped for a missing binary, 1 when one failed, 2 on bad usage, when nothing applies or when a fixer timed out.
2413
2412
  --json prints {fixers: [{name, command, in?, ok, ms, log, failed?} or {name, command, skipped}], changed} once every fixer ran, changed null outside a git repository.`;
2413
+ var EXITS = [[0, "every fixer ran or was skipped for a missing binary"], [1, "one failed"], [2, "bad usage, nothing applies or a fixer timed out"]];
2414
2414
  var RUNNING = "KAYNOOO_CLI_FIX";
2415
2415
  var JUSTFILES2 = ["justfile", "Justfile", ".justfile"];
2416
2416
  var RUFF_CONFIGS = ["ruff.toml", ".ruff.toml"];
@@ -2490,7 +2490,7 @@ function printChanged(changed) {
2490
2490
  console.log(` and ${changed.length - MAX_CHANGED} more`);
2491
2491
  }
2492
2492
  async function fix(args, cwd = process19.cwd()) {
2493
- 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"]] });
2493
+ const parsed = parse(args, fixUsage, fixOptions, { exits: EXITS, 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"]] });
2494
2494
  return runFixers(parsed.values, cwd);
2495
2495
  }
2496
2496
  async function runFixers(values, cwd) {
package/dist/j-cli.js CHANGED
@@ -467,18 +467,14 @@ var FULL_STOP = /\.$/;
467
467
  function usageLine(usage, colors = paint(process8.stdout)) {
468
468
  return `${colors.bold("Usage:")} ${usage.replace(USAGE_PREFIX, "").replaceAll(OPTIONAL, (part) => colors.dim(part))}`;
469
469
  }
470
- function helpText(usage, options, colors = paint(process8.stdout), { examples = [], replaces, exits = [] } = {}) {
471
- return [usageLine(usage, colors), ...replacesRows(replaces, colors), "", colors.bold("Options:"), ...optionRows(options, colors), ...exitRows(exits, colors), ...exampleRows(examples, colors)].join(`
470
+ function helpText(usage, options, colors = paint(process8.stdout), { examples = [], exits = [] } = {}) {
471
+ return [usageLine(usage, colors), "", colors.bold("Options:"), ...optionRows(options, colors), ...exitRows(exits, colors), ...exampleRows(examples, colors)].join(`
472
472
  `);
473
473
  }
474
474
  function exitRows(exits, colors = paint(process8.stdout)) {
475
475
  if (exits.length === 0)
476
476
  return [];
477
- const width = Math.max(...exits.map(([code]) => String(code).length));
478
- return ["", colors.bold("Exits:"), ...exits.map(([code, meaning]) => ` ${colors.cyan(String(code).padEnd(width))} ${meaning}`)];
479
- }
480
- function replacesRows(replaces, colors = paint(process8.stdout)) {
481
- return replaces === undefined || outputMode() === "agent" ? [] : ["", `${colors.bold("Instead of:")} ${replaces}`];
477
+ return ["", `${colors.bold("Exit codes:")} ${exits.map(([code, meaning]) => `${colors.cyan(String(code))} ${meaning}`).join(", ")}`];
482
478
  }
483
479
  function wantsHelpJson(env = process8.env) {
484
480
  return env.KIT_HELP === "json";
@@ -1121,7 +1117,11 @@ async function printCandidates(found) {
1121
1117
  return 0;
1122
1118
  }
1123
1119
  function packageVersion(entry = Bun.main) {
1124
- for (let dir = dirname3(realpathSync2(entry));; dir = dirname3(dir)) {
1120
+ let resolved = entry;
1121
+ try {
1122
+ resolved = realpathSync2(entry);
1123
+ } catch {}
1124
+ for (let dir = dirname3(resolved);; dir = dirname3(dir)) {
1125
1125
  try {
1126
1126
  const { version } = JSON.parse(readFileSync4(join6(dir, "package.json"), "utf8"));
1127
1127
  if (typeof version === "string")
@@ -1165,7 +1165,7 @@ var {Glob } = globalThis.Bun;
1165
1165
  var SESSION_FILES = new Glob("*.json");
1166
1166
  var ACCOUNT_DIRS = new Glob("*/sessions");
1167
1167
  // package.json
1168
- var version = "0.18.2";
1168
+ var version = "0.18.3";
1169
1169
 
1170
1170
  // src/j.ts
1171
1171
  import process22 from "process";
@@ -2466,9 +2466,8 @@ j -
2466
2466
  Without a name, picks a recipe, target, script or task of this folder, its parents and its child folders when a terminal is attached, and runs it. The ones run last come first, per folder. Without a terminal it lists them instead.
2467
2467
  \`j -\` runs the last one again with the same arguments, \`j <name> [args...]\` runs without the picker, the words after the name filling the parameters in order and the required ones left being asked for.
2468
2468
  The sources are a Justfile, a Makefile, the scripts of a package.json (through its package manager), composer.json scripts, deno tasks, a Taskfile, mise tasks and a pyproject (poe tasks and entry points).
2469
- A name is the key behind the folder it runs from, \`api/test\`, bare for this folder. A name several entries share offers them, unless it comes qualified by its runner: \`just:check\`, \`bun:api/test\`.
2470
-
2471
- Exits with the code of the command it ran, 1 when there is nothing to run here or nothing by that name.`;
2469
+ A name is the key behind the folder it runs from, \`api/test\`, bare for this folder. A name several entries share offers them, unless it comes qualified by its runner: \`just:check\`, \`bun:api/test\`.`;
2470
+ var EXITS = [["its own", "the code of the command it ran"], [1, "there is nothing to run here or nothing by that name"]];
2472
2471
  var options = {
2473
2472
  json: jsonOption("[{ id, key, runner, dir, name, doc, parameters }]")
2474
2473
  };
@@ -2546,6 +2545,7 @@ async function j2(argv) {
2546
2545
  const args = emitting ? argv.slice(1) : argv;
2547
2546
  const last = args[0] === "-";
2548
2547
  const parsed = last ? { values: {}, positionals: ["-"], rest: args.slice(1) } : parse(args, usage2, options, {
2548
+ exits: EXITS,
2549
2549
  positionals: ["[name]"],
2550
2550
  candidates: { "[name]": completions },
2551
2551
  trailing: true,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kaynooo/cli-check",
3
3
  "type": "module",
4
- "version": "0.18.2",
4
+ "version": "0.18.3",
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.38.1"
37
+ "@kaynooo/cli-kit": "0.38.2"
38
38
  }
39
39
  }