@kaynooo/cli-check 0.20.1 → 0.21.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 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
 
@@ -58,18 +58,20 @@ SIGINT, SIGTERM and SIGHUP go to the running step's whole process group and `che
58
58
 
59
59
  Exit code 0 when every step passed, 1 when one failed, 2 on bad usage, when no step is found or when a step timed out.
60
60
 
61
+ `--json` prints `[{name, command, in?, ok, ms, log, failed?}]` once every step ran, `in` naming the compose service the step ran in; `--list --json` prints `[{name, command, source, in?}]`, and `--fix --json` `{fixers: [{name, command, in?, ok, ms, log, failed?} or {name, command, skipped}], changed}`, `changed` being null outside a git repository.
62
+
61
63
  `--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
64
 
63
- ## fix
65
+ ## check --fix
64
66
 
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.
67
+ `--only` then names fixers, and `--changed`, `--failed`, `--slot`, `--no-slot` and `--parallel` are refused.
66
68
 
67
69
  ```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}
70
+ check --fix # run every fixer that applies to this folder
71
+ check --fix --list # print them and their commands
72
+ check --fix --only lint:fix,justfile
73
+ check --fix --in app # run the scripts in this compose service; --host forces the host
74
+ check --fix --json # {fixers, changed}, a skipped fixer as {name, command, skipped}
73
75
  ```
74
76
 
75
77
  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 +85,7 @@ The project's own `fix` script, recipe or target when it has one, else its `lint
83
85
  | `rust` | `Cargo.toml` | `cargo fmt` |
84
86
  | `python` | `ruff.toml`, `.ruff.toml` or a `[tool.ruff]` section | `ruff check --fix . && ruff format .` |
85
87
 
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.
88
+ 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
89
 
88
90
  Exit code 0 when every fixer ran, 1 when one failed, 2 on bad usage or when nothing applies.
89
91
 
@@ -97,7 +99,7 @@ errs --json -- keslint src # {errors, unrecognised, log?, code?}
97
99
  errs --in app -- vendor/bin/phpunit # in this compose service; --host forces the host
98
100
  ```
99
101
 
100
- Turns tsc, tsgo and vue-tsc (plain and pretty), bun check, eslint and keslint (stylish), bun test, vitest, playwright, phpunit, paratest, phpstan, php-cs-fixer, go (build and vet), cargo (rustc), ruff (concise and full) and pytest logs into one `file:line:col: message (rule)` line per error, so a session reads the failures without the log. A failed bun test reads `file:line:col: <test name>: <assertion> (expected X, received Y)`, located at the first stack frame of its error, and an eslint warning is prefixed `warning:`. Absolute paths under the current folder are printed relative.
102
+ Turns tsc, tsgo and vue-tsc (plain and pretty), bun check, kay check, eslint and keslint (stylish), bun test, vitest, playwright, phpunit, paratest, phpstan, php-cs-fixer, go (build and vet), cargo (rustc), ruff (concise and full) and pytest logs, and any `file:line[:col]: error|warning: message` line (mypy, gcc, clang, `shellcheck -f gcc`, golangci-lint), into one `file:line:col: message (rule)` line per error, so a session reads the failures without the log. A failed bun test reads `file:line:col: <test name>: <assertion> (expected X, received Y)`, located at the first stack frame of its error, and an eslint warning is prefixed `warning:`. Absolute paths under the current folder are printed relative.
101
103
 
102
104
  | Tool | Read from | One error per |
103
105
  | --- | --- | --- |
@@ -111,7 +113,7 @@ Turns tsc, tsgo and vue-tsc (plain and pretty), bun check, eslint and keslint (s
111
113
  | `pytest` | the failures and errors sections | failure: the location `file:line` of the assertion or exception with its `E` line; with `--tb=short` or a collection error the last frame carries the `E` line. Ruff and pytest are not installed here, so their fixtures are written from the documented output |
112
114
  | `vitest` | the default and verbose reporters | failed test, or suite that failed to load, at its first `file:line:col` frame |
113
115
 
114
- `--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` or `pytest`. Lines no format recognised are never dropped silently: their count goes to stderr, with the path of the full log. A command run after `--` has its whole output saved with the same log writer as `out`, and `log` is that file (the file given when a log is read, nothing for stdin). A first argument that is neither an option nor an existing file starts the command, so the `--` is optional. A command runs in the compose service mounting the current folder like a `check` step does (see above), `--in` and `--host` applying only to a command; a service that is down exits 1 with the service named.
116
+ `--json` prints `{errors: [{tool, file, line, column, rule?, severity, message, test?}], unrecognised, log?, code?}`, `tool` one of `tsc`, `eslint`, `bun check`, `kay check`, `bun test`, `vitest`, `playwright`, `phpunit`, `phpstan`, `php-cs-fixer`, `go`, `cargo`, `ruff`, `pytest` or `generic`. An error repeated with the same file, position and message is printed once. Lines no format recognised are never dropped silently: their count goes to stderr, with the path of the full log. A command run after `--` has its whole output saved with the same log writer as `out`, and `log` is that file (the file given when a log is read, nothing for stdin). A first argument that is neither an option nor an existing file starts the command, so the `--` is optional. A command runs in the compose service mounting the current folder like a `check` step does (see above), `--in` and `--host` applying only to a command; a service that is down exits 1 with the service named.
115
117
 
116
118
  Exit code 0 when no error was found and the command, if any, passed, 1 when errors were found or the command failed, 2 on bad usage.
117
119