@kaynooo/cli-check 0.20.1 → 0.21.0

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 CHANGED
@@ -1,6 +1,6 @@
1
- # check and fix
1
+ # check
2
2
 
3
- `check` runs a repo's validation and `check --fix` its fixers, both showing only what failed, so a Claude Code session spends no tokens on passing output. `fix` stays installed as the alias of `check --fix`: same options, output and exit codes.
3
+ `check` runs a repo's validation and `check --fix` its fixers, both showing only what failed, so a Claude Code session spends no tokens on passing output.
4
4
 
5
5
  ```sh
6
6
  bun install -g @kaynooo/cli-check
@@ -12,7 +12,7 @@ check --no-slot # run the steps at once; by default each queues behind the mach
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
14
  check --quiet # print only the failing steps, nothing when all pass
15
- check --fix # run the fixers instead, what `fix` does
15
+ check --fix # run the fixers and formatters instead
16
16
  check --host # run on the host even when a compose service mounts the folder
17
17
  check --json # [{name, command, in?, ok, ms, log, failed?}] once every step ran
18
18
  ```
@@ -37,7 +37,7 @@ A folder with no step of its own but subfolders that have some (a root with `api
37
37
 
38
38
  ## In the compose service
39
39
 
40
- Athome repos run their tools in a container, so `check`, `fix` and `errs -- <command>` run a step inside the docker compose service that bind-mounts its folder, instead of on the host. The project is the nearest `compose.yaml`, `compose.yml`, `docker-compose.yaml` or `docker-compose.yml` from the step's folder up to the repository root (the folder holding `.git`), with its `compose.override.*` merged in. A service qualifies when one of its bind mounts (`.:/app`, `./api:/var/www/html`, the long `type: bind` syntax, `${VAR:-default}` interpolated with the environment and the project's `.env`) holds the folder, a mount of a parent folder included; named volumes are ignored. The step runs `docker compose exec -T -w <path of the folder in the container> <service> sh -c '<command>'` from the project's folder, with `NO_COLOR=1 FORCE_COLOR=0` set, and the container path is the mount's target plus the folder's path under its source.
40
+ In a repo that runs its tools in a container, `check`, `check --fix` and `errs -- <command>` run a step inside the docker compose service that bind-mounts its folder, instead of on the host. The project is the nearest `compose.yaml`, `compose.yml`, `docker-compose.yaml` or `docker-compose.yml` from the step's folder up to the repository root (the folder holding `.git`), with its `compose.override.*` merged in. A service qualifies when one of its bind mounts (`.:/app`, `./api:/var/www/html`, the long `type: bind` syntax, `${VAR:-default}` interpolated with the environment and the project's `.env`) holds the folder, a mount of a parent folder included; named volumes are ignored. The step runs `docker compose exec -T -w <path of the folder in the container> <service> sh -c '<command>'` from the project's folder, with `NO_COLOR=1 FORCE_COLOR=0` set, and the container path is the mount's target plus the folder's path under its source.
41
41
 
42
42
  - The stack is only read: `docker compose ps --services --status running` is asked once per project, and a service that is down is never started. The step fails, naming the service and where its project lives, and the other steps go on; start the stack yourself, or pass `--host`.
43
43
  - Several services mounting the folder (php and a worker): the one whose name, image or build names the step's tool wins (`bun` and `node` look for `bun` or `node`, `composer`, `php`, `phpunit`, `phpstan` and `vendor/bin/*` for `php`). When none or several stand out the call fails listing them and asks for `--in <service>`.
@@ -48,7 +48,7 @@ Athome repos run their tools in a container, so `check`, `fix` and `errs -- <com
48
48
  - A compose file that does not parse fails the call naming the file and the parse error, and points at `--host`; it never falls back to the host silently, even without docker.
49
49
  - The slot queue (the default when `slot` is installed, `--slot` to require it) holds the whole docker command. `--timeout` ends the `docker compose exec` client, which does not always end what it started inside the container.
50
50
  - `check --changed` (`-c`) narrows `lint` to the changed source files (staged, unstaged and untracked, against HEAD) when its script is a bare `keslint`, `eslint` or `oxlint`, and `test` to the changed test files and the tests next to changed sources (same folder, `tests/`, `../tests/`) when its script is a bare `bun test`. Every other step runs in full and its line says so, a test step finding no test for the diff included. The typecheck is never narrowed.
51
- - `fix` runs the project's scripts and `php-cs-fixer` in the service, and keeps its own formatters (`justfile`, `go`, `rust`, `python`, `makefile`) on the host. The recursion guard variable is passed into the container.
51
+ - `check --fix` runs the project's scripts and `php-cs-fixer` in the service, and keeps its own formatters (`justfile`, `go`, `rust`, `python`, `makefile`) on the host. The recursion guard variable is passed into the container.
52
52
 
53
53
  ## Output
54
54
 
@@ -60,16 +60,16 @@ Exit code 0 when every step passed, 1 when one failed, 2 on bad usage, when no s
60
60
 
61
61
  `--failed` reads the last finished run's folder of logs, where each run leaves a `results.json` of its steps' names and results, and runs the steps that failed there again. When that run had none, or there was no run, it says so and exits 2. The re-run leaves its own `results.json`.
62
62
 
63
- ## fix
63
+ ## check --fix
64
64
 
65
- `fix` is `check --fix`: `check --fix --only lint:fix` is the same call. `--only` then names fixers, and `--changed`, `--failed`, `--slot`, `--no-slot` and `--parallel` are refused.
65
+ `--only` then names fixers, and `--changed`, `--failed`, `--slot`, `--no-slot` and `--parallel` are refused.
66
66
 
67
67
  ```sh
68
- fix # run every fixer that applies to this folder
69
- fix --list # print them and their commands
70
- fix --only lint:fix,justfile
71
- fix --in app # run the scripts in this compose service; --host forces the host
72
- fix --json # {fixers, changed}, a skipped fixer as {name, command, skipped}
68
+ check --fix # run every fixer that applies to this folder
69
+ check --fix --list # print them and their commands
70
+ check --fix --only lint:fix,justfile
71
+ check --fix --in app # run the scripts in this compose service; --host forces the host
72
+ check --fix --json # {fixers, changed}, a skipped fixer as {name, command, skipped}
73
73
  ```
74
74
 
75
75
  The project's own `fix` script, recipe or target when it has one, else its `lint:fix` (or `lint-fix`) and `format` ones, found in the same sources as `check`'s steps. Then the formatters the folder's files call for:
@@ -83,7 +83,7 @@ The project's own `fix` script, recipe or target when it has one, else its `lint
83
83
  | `rust` | `Cargo.toml` | `cargo fmt` |
84
84
  | `python` | `ruff.toml`, `.ruff.toml` or a `[tool.ruff]` section | `ruff check --fix . && ruff format .` |
85
85
 
86
- It looks at the folder itself only, so each package of a monorepo gets its own run. A fixer whose binary is missing is skipped with a `skip` line. Lines and logs read like `check`'s, then the files the run changed are listed, leaving out those already dirty before it, when the folder is in a git repository. A script that calls `fix` again fails instead of recursing.
86
+ It looks at the folder itself only, so each package of a monorepo gets its own run. A fixer whose binary is missing is skipped with a `skip` line. Lines and logs read like `check`'s, then the files the run changed are listed, leaving out those already dirty before it, when the folder is in a git repository. A script calling `check` is skipped, and one reaching `check --fix` again some other way fails instead of recursing.
87
87
 
88
88
  Exit code 0 when every fixer ran, 1 when one failed, 2 on bad usage or when nothing applies.
89
89
 
package/dist/cli.js CHANGED
@@ -1437,7 +1437,7 @@ var {Glob } = globalThis.Bun;
1437
1437
  var SESSION_FILES = new Glob("*.json");
1438
1438
  var ACCOUNT_DIRS = new Glob("*/sessions");
1439
1439
  // package.json
1440
- var version = "0.20.1";
1440
+ var version = "0.21.0";
1441
1441
 
1442
1442
  // src/check.ts
1443
1443
  import { writeFile as writeFile3 } from "fs/promises";
@@ -1944,17 +1944,13 @@ async function discover(dir) {
1944
1944
  }
1945
1945
 
1946
1946
  // src/options.ts
1947
- var fixOptions = {
1947
+ var options = {
1948
1948
  list: { type: "boolean", short: "l", description: "print the steps (or, with --fix, the fixers) found, the commands that run them and where (host or service), without running them" },
1949
- only: { type: "string", short: "o", description: `comma separated steps to run, among ${STEP_NAMES.join(", ")}; with --fix the fixers to run, by the names --list prints` },
1949
+ only: { type: "string", short: "o", description: `comma separated steps to run, among ${STEP_NAMES.join(", ")}; with --fix the fixers to run, by the names --list prints`, candidates: () => [...STEP_NAMES] },
1950
1950
  timeout: { type: "string", short: "t", description: "longest a step or fixer may run before it is ended (30s, 5m, 1h), none by default" },
1951
1951
  ...placeOptions,
1952
- json: jsonOption()
1953
- };
1954
- var options = {
1955
- ...fixOptions,
1956
- only: { ...fixOptions.only, candidates: () => [...STEP_NAMES] },
1957
- fix: { type: "boolean", short: "f", description: "run the folder's fixers and formatters instead of the steps, as the fix bin does" },
1952
+ json: jsonOption(),
1953
+ fix: { type: "boolean", short: "f", description: "run the folder's fixers and formatters instead of the steps" },
1958
1954
  quiet: { type: "boolean", short: "q", description: "print nothing for a passing step, and nothing at all when every step passes" },
1959
1955
  failed: { type: "boolean", description: "run only the steps that failed in the last run of this folder, read from the run folder" },
1960
1956
  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" },
@@ -2054,15 +2050,6 @@ function printOutcome(name, width, command, logFile, outcome) {
2054
2050
  }
2055
2051
 
2056
2052
  // src/fix.ts
2057
- var fixUsage = `fix [--only <fixers>] [--timeout <duration>] [--in <service> | --host] [--list]
2058
-
2059
- Alias of \`check --fix\`. Runs the folder's fixers: the project's own \`fix\` script, else its \`lint:fix\` and \`format\` ones (package.json through bun run, composer.json, a Justfile or a Makefile), then the formatters its files call for: php-cs-fixer where configured and composer.json has no fixer, just --fmt, go fmt and go mod tidy, cargo fmt, ruff where configured, and every Makefile target declared .PHONY.
2060
- It looks at the folder itself only, so each package of a monorepo gets its own run.
2061
- 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.
2062
- 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.
2063
- A fixer still running after --timeout is ended with everything it started, but not what it started inside a container.
2064
- --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.`;
2065
- 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"]];
2066
2053
  var RUNNING = "KAYNOOO_CLI_FIX";
2067
2054
  var JUSTFILES2 = ["justfile", "Justfile", ".justfile"];
2068
2055
  var RUFF_CONFIGS = ["ruff.toml", ".ruff.toml"];
@@ -2074,7 +2061,7 @@ async function replaceFile(path, content) {
2074
2061
  await rename(temporary, path);
2075
2062
  }
2076
2063
  async function projectFixers(dir) {
2077
- const found = await candidates(dir, "fix");
2064
+ const found = await candidates(dir, "check");
2078
2065
  const named = (name) => found.find((step) => step.name === name);
2079
2066
  const all = named("fix");
2080
2067
  if (all !== undefined)
@@ -2106,7 +2093,6 @@ async function toolFixers(dir) {
2106
2093
  fixers.push({ name: "python", command: "ruff check --fix . && ruff format .", source: "ruff", requires: "ruff" });
2107
2094
  return fixers;
2108
2095
  }
2109
- var fixParseOptions = { ...fixOptions, only: { ...fixOptions.only, candidates: async () => (await fixers(process21.cwd())).map((fixer) => fixer.name) } };
2110
2096
  async function fixers(dir) {
2111
2097
  const project = await projectFixers(dir);
2112
2098
  const csFixer = await firstFile(dir, CS_FIXER_CONFIGS);
@@ -2142,15 +2128,11 @@ function printChanged(changed) {
2142
2128
  if (changed.length > MAX_CHANGED)
2143
2129
  console.log(` and ${changed.length - MAX_CHANGED} more`);
2144
2130
  }
2145
- async function fix(args, cwd = process21.cwd()) {
2146
- const parsed = parse(args, fixUsage, fixParseOptions, { 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"]] });
2147
- return runFixers(parsed.values, cwd);
2148
- }
2149
2131
  async function runFixers(values, cwd) {
2150
2132
  const parsed = { values };
2151
2133
  const settings = placeSettings(values);
2152
2134
  if (process21.env[RUNNING] !== undefined)
2153
- fail("a fixer called fix again, which would recurse: give its script another command");
2135
+ fail("a fixer called check --fix again, which would recurse: give its script another command");
2154
2136
  const found = await fixers(cwd);
2155
2137
  if (found.length === 0)
2156
2138
  fail("nothing to fix here: no fix, lint:fix or format script, php-cs-fixer config, Makefile, Justfile, go.mod, Cargo.toml nor ruff config");
@@ -2303,9 +2285,9 @@ With --parallel, the steps run at the same time, each one's output held and prin
2303
2285
  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.
2304
2286
  A step still running after --timeout is ended with everything it started, but not what it started inside a container.
2305
2287
  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.
2306
- 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, --slot, --no-slot and --parallel do not apply.
2307
- --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.`;
2308
- var EXITS2 = [[0, "every step passed"], [1, "one failed"], [2, "bad usage, no step is found or a step timed out"]];
2288
+ With --fix, the folder's fixers and formatters run instead of the steps: the project's own \`fix\` script, else its \`lint:fix\` and \`format\` ones, from the same sources as the steps, then the formatters its files call for: php-cs-fixer where configured and composer.json has no fixer, just --fmt, go fmt and go mod tidy, cargo fmt, ruff where configured, and every Makefile target declared .PHONY. The scripts and php-cs-fixer run in the compose service, the formatters on the host. One line per fixer, then the files the run changed. --only then names fixers, as --list prints them; --changed, --failed, --slot, --no-slot and --parallel do not apply.
2289
+ --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 {fixers: [{name, command, in?, ok, ms, log, failed?} or {name, command, skipped}], changed}, changed null outside a git repository.`;
2290
+ var EXITS = [[0, "every step passed"], [1, "one failed"], [2, "bad usage, no step is found or a step timed out"]];
2309
2291
  function slotted(command) {
2310
2292
  return `slot -- sh -c ${shellQuote(command)}`;
2311
2293
  }
@@ -2341,7 +2323,7 @@ function summaryLine(outcomes) {
2341
2323
  return parts.join(colors.dim(" \xB7 "));
2342
2324
  }
2343
2325
  async function check(args, cwd = process22.cwd()) {
2344
- 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"]] });
2326
+ const parsed = parse(args, usage2, options, { exits: EXITS, 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, and with --fix each fixer and formatter run by hand", examples: ["check", ["check --only lint,test", "two of the steps"], ["check --in app", "every step inside the app service"], ["check --fix", "the fixers and formatters instead"], ["check --fix --list", "the fixers it would run"]] });
2345
2327
  const settings = placeSettings(parsed.values);
2346
2328
  if (parsed.values.fix === true) {
2347
2329
  for (const flag of ["changed", "failed", "slot", "no-slot", "parallel"]) {
package/dist/errs-cli.js CHANGED
@@ -1437,7 +1437,7 @@ var {Glob } = globalThis.Bun;
1437
1437
  var SESSION_FILES = new Glob("*.json");
1438
1438
  var ACCOUNT_DIRS = new Glob("*/sessions");
1439
1439
  // package.json
1440
- var version = "0.20.1";
1440
+ var version = "0.21.0";
1441
1441
 
1442
1442
  // src/errs.ts
1443
1443
  import { relative as relative2 } from "path";
package/dist/j-cli.js CHANGED
@@ -1437,7 +1437,7 @@ var {Glob } = globalThis.Bun;
1437
1437
  var SESSION_FILES = new Glob("*.json");
1438
1438
  var ACCOUNT_DIRS = new Glob("*/sessions");
1439
1439
  // package.json
1440
- var version = "0.20.1";
1440
+ var version = "0.21.0";
1441
1441
 
1442
1442
  // src/j.ts
1443
1443
  import process25 from "process";
package/package.json CHANGED
@@ -1,21 +1,20 @@
1
1
  {
2
2
  "name": "@kaynooo/cli-check",
3
3
  "type": "module",
4
- "version": "0.20.1",
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.",
4
+ "version": "0.21.0",
5
+ "description": "check and errs: run a repo's check, typecheck, lint and test steps or, with --fix, 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",
8
- "homepage": "https://git.kaynooo.fr/kaynooo/cli/src/branch/main/packages/check#readme",
8
+ "homepage": "https://github.com/Kayno0o/cli/tree/main/packages/check#readme",
9
9
  "repository": {
10
10
  "type": "git",
11
- "url": "git+https://git.kaynooo.fr/kaynooo/cli.git",
11
+ "url": "git+https://github.com/Kayno0o/cli.git",
12
12
  "directory": "packages/check"
13
13
  },
14
- "bugs": "https://git.kaynooo.fr/kaynooo/cli/issues",
14
+ "bugs": "https://github.com/Kayno0o/cli/issues",
15
15
  "keywords": ["check", "fix", "lint", "format", "typecheck", "test", "claude-code"],
16
16
  "bin": {
17
17
  "check": "./dist/cli.js",
18
- "fix": "./dist/fix-cli.js",
19
18
  "errs": "./dist/errs-cli.js",
20
19
  "j": "./dist/j-cli.js"
21
20
  },
@@ -27,9 +26,8 @@
27
26
  "registry": "https://git.kaynooo.fr/api/packages/kaynooo/npm/"
28
27
  },
29
28
  "scripts": {
30
- "build": "$npm_execpath build src/cli.ts src/fix-cli.ts src/errs-cli.ts src/j-cli.ts --target bun --outdir dist",
29
+ "build": "$npm_execpath build src/cli.ts src/errs-cli.ts src/j-cli.ts --target bun --outdir dist",
31
30
  "check": "$npm_execpath src/cli.ts",
32
- "fix": "$npm_execpath src/fix-cli.ts",
33
31
  "errs": "$npm_execpath src/errs-cli.ts",
34
32
  "j": "$npm_execpath src/j-cli.ts"
35
33
  },