@kaynooo/cli-check 0.9.0 → 0.9.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
@@ -97,6 +97,10 @@ Turns tsc, tsgo and vue-tsc (plain and pretty), bun check, eslint and keslint (s
97
97
  | `phpstan` | the default table, `--error-format=raw` and `json` | message: `file:line: message (identifier)`, a wrapped table message joined, problems with no file at line 0 |
98
98
  | `php-cs-fixer` | `fix --dry-run` (`-v` names the fixers, `--diff` is skipped) | file: `file:0:0: style issues to fix (fixer, fixer)` |
99
99
  | `playwright` | the list and line reporters | failed test: the spec file and line of the first stack frame, the first error line and `expected X, received Y`. A test that passed on retry is flaky and not reported |
100
+ | `go` | `go build`, `go vet` and `go test` compile errors | compiler message: `file:line:col: message`, paths as Go prints them (`./main.go`) |
101
+ | `cargo` | rustc's human format | diagnostic: `file:line:col: message (E0308)`, the code frame skipped, warnings prefixed `warning:` |
102
+ | `ruff` | `check` in the concise format and the full one (header plus `-->` line) | diagnostic: `file:line:col: message (F401)` |
103
+ | `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 |
100
104
  | `vitest` | the default and verbose reporters | failed test, or suite that failed to load, at its first `file:line:col` frame |
101
105
 
102
106
  `--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.
package/dist/cli.js CHANGED
@@ -955,7 +955,7 @@ var {Glob } = globalThis.Bun;
955
955
  var SESSION_FILES = new Glob("*.json");
956
956
  var ACCOUNT_DIRS = new Glob("*/sessions");
957
957
  // package.json
958
- var version = "0.9.0";
958
+ var version = "0.9.1";
959
959
 
960
960
  // src/check.ts
961
961
  import { join as join5 } from "path";
@@ -1694,6 +1694,8 @@ var PYTEST_E_LINE = /^E {3}(.*)$/;
1694
1694
  var PYTEST_BANNER = /^={3,} (.*?) ={3,}$/;
1695
1695
  var PYTEST_FAILURES = new Set(["FAILURES", "ERRORS"]);
1696
1696
  var PYTEST_SUMMARY_LINE = /^(?:FAILED|ERROR) \S/;
1697
+ var PYTEST_FRAME = /^in \S/;
1698
+ var PYTEST_SECTION = /^_{3,} .* _{3,}$/;
1697
1699
  var PYTEST_EXCEPTION_END = /[\s:]/;
1698
1700
  var PYTEST_NOISE = /^(?:platform |rootdir: |collected |plugins: |configfile: |cachedir: |\S+\.pyi? [.FEsxXR]+ +\[ *\d+%\]$|\S+\.py:\d+: $)/;
1699
1701
  var NOISE = /^(?:bun test v|Errors {2}Files$|Ran \d+ tests?|note: |\s*\d+ expect\(\) calls|\s+\d+\s+\S+:\d+$|\s*\d+ errors? and \d+ warnings? potentially fixable)/;
@@ -1848,24 +1850,35 @@ var collectPytest = (lines, used) => {
1848
1850
  const end = lines.findIndex((line, index) => index > start && title(line) !== undefined && !PYTEST_FAILURES.has(title(line) ?? ""));
1849
1851
  const stop = end === -1 ? lines.length : end;
1850
1852
  let message = [];
1853
+ let frame;
1851
1854
  for (let index = start;index < stop; index++) {
1852
1855
  const line = lines[index] ?? "";
1853
1856
  const failure = PYTEST_E_LINE.exec(line);
1854
1857
  if (failure !== null) {
1855
1858
  message.push((failure[1] ?? "").trim());
1856
1859
  } else {
1860
+ if (frame !== undefined && message.length > 0) {
1861
+ errors.push({ tool: "pytest", ...frame, column: 0, severity: "error", message: message[0] ?? "" });
1862
+ frame = undefined;
1863
+ }
1857
1864
  const location = PYTEST_LOCATION.exec(line);
1858
- if (location !== null) {
1865
+ if (location !== null && PYTEST_FRAME.test(location[3] ?? "")) {
1866
+ frame = { file: location[1] ?? "", line: Number(location[2]) };
1867
+ } else if (location !== null) {
1859
1868
  const [exception = ""] = (location[3] ?? "").split(PYTEST_EXCEPTION_END);
1860
1869
  const first = message[0] ?? "";
1861
1870
  const text = first === "" || first.startsWith(exception) ? first || (location[3] ?? "") : `${location[3] ?? ""}: ${first}`;
1862
1871
  errors.push({ tool: "pytest", file: location[1] ?? "", line: Number(location[2]), column: 0, severity: "error", message: text });
1863
1872
  }
1873
+ if (PYTEST_SECTION.test(line))
1874
+ frame = undefined;
1864
1875
  if (line.trim() !== "")
1865
1876
  message = [];
1866
1877
  }
1867
1878
  used.add(index);
1868
1879
  }
1880
+ if (frame !== undefined && message.length > 0)
1881
+ errors.push({ tool: "pytest", ...frame, column: 0, severity: "error", message: message[0] ?? "" });
1869
1882
  for (let index = stop;index < lines.length; index++) {
1870
1883
  if (PYTEST_SUMMARY_LINE.test(lines[index] ?? ""))
1871
1884
  used.add(index);
package/dist/errs-cli.js CHANGED
@@ -955,7 +955,7 @@ var {Glob } = globalThis.Bun;
955
955
  var SESSION_FILES = new Glob("*.json");
956
956
  var ACCOUNT_DIRS = new Glob("*/sessions");
957
957
  // package.json
958
- var version = "0.9.0";
958
+ var version = "0.9.1";
959
959
 
960
960
  // src/errs.ts
961
961
  import { relative as relative2 } from "path";
@@ -1691,6 +1691,8 @@ var PYTEST_E_LINE = /^E {3}(.*)$/;
1691
1691
  var PYTEST_BANNER = /^={3,} (.*?) ={3,}$/;
1692
1692
  var PYTEST_FAILURES = new Set(["FAILURES", "ERRORS"]);
1693
1693
  var PYTEST_SUMMARY_LINE = /^(?:FAILED|ERROR) \S/;
1694
+ var PYTEST_FRAME = /^in \S/;
1695
+ var PYTEST_SECTION = /^_{3,} .* _{3,}$/;
1694
1696
  var PYTEST_EXCEPTION_END = /[\s:]/;
1695
1697
  var PYTEST_NOISE = /^(?:platform |rootdir: |collected |plugins: |configfile: |cachedir: |\S+\.pyi? [.FEsxXR]+ +\[ *\d+%\]$|\S+\.py:\d+: $)/;
1696
1698
  var NOISE = /^(?:bun test v|Errors {2}Files$|Ran \d+ tests?|note: |\s*\d+ expect\(\) calls|\s+\d+\s+\S+:\d+$|\s*\d+ errors? and \d+ warnings? potentially fixable)/;
@@ -1845,24 +1847,35 @@ var collectPytest = (lines, used) => {
1845
1847
  const end = lines.findIndex((line, index) => index > start && title(line) !== undefined && !PYTEST_FAILURES.has(title(line) ?? ""));
1846
1848
  const stop = end === -1 ? lines.length : end;
1847
1849
  let message = [];
1850
+ let frame;
1848
1851
  for (let index = start;index < stop; index++) {
1849
1852
  const line = lines[index] ?? "";
1850
1853
  const failure = PYTEST_E_LINE.exec(line);
1851
1854
  if (failure !== null) {
1852
1855
  message.push((failure[1] ?? "").trim());
1853
1856
  } else {
1857
+ if (frame !== undefined && message.length > 0) {
1858
+ errors.push({ tool: "pytest", ...frame, column: 0, severity: "error", message: message[0] ?? "" });
1859
+ frame = undefined;
1860
+ }
1854
1861
  const location = PYTEST_LOCATION.exec(line);
1855
- if (location !== null) {
1862
+ if (location !== null && PYTEST_FRAME.test(location[3] ?? "")) {
1863
+ frame = { file: location[1] ?? "", line: Number(location[2]) };
1864
+ } else if (location !== null) {
1856
1865
  const [exception = ""] = (location[3] ?? "").split(PYTEST_EXCEPTION_END);
1857
1866
  const first = message[0] ?? "";
1858
1867
  const text = first === "" || first.startsWith(exception) ? first || (location[3] ?? "") : `${location[3] ?? ""}: ${first}`;
1859
1868
  errors.push({ tool: "pytest", file: location[1] ?? "", line: Number(location[2]), column: 0, severity: "error", message: text });
1860
1869
  }
1870
+ if (PYTEST_SECTION.test(line))
1871
+ frame = undefined;
1861
1872
  if (line.trim() !== "")
1862
1873
  message = [];
1863
1874
  }
1864
1875
  used.add(index);
1865
1876
  }
1877
+ if (frame !== undefined && message.length > 0)
1878
+ errors.push({ tool: "pytest", ...frame, column: 0, severity: "error", message: message[0] ?? "" });
1866
1879
  for (let index = stop;index < lines.length; index++) {
1867
1880
  if (PYTEST_SUMMARY_LINE.test(lines[index] ?? ""))
1868
1881
  used.add(index);
package/dist/fix-cli.js CHANGED
@@ -955,7 +955,7 @@ var {Glob } = globalThis.Bun;
955
955
  var SESSION_FILES = new Glob("*.json");
956
956
  var ACCOUNT_DIRS = new Glob("*/sessions");
957
957
  // package.json
958
- var version = "0.9.0";
958
+ var version = "0.9.1";
959
959
 
960
960
  // src/fix.ts
961
961
  import { existsSync as existsSync2, statSync } from "fs";
@@ -1723,6 +1723,8 @@ var PYTEST_E_LINE = /^E {3}(.*)$/;
1723
1723
  var PYTEST_BANNER = /^={3,} (.*?) ={3,}$/;
1724
1724
  var PYTEST_FAILURES = new Set(["FAILURES", "ERRORS"]);
1725
1725
  var PYTEST_SUMMARY_LINE = /^(?:FAILED|ERROR) \S/;
1726
+ var PYTEST_FRAME = /^in \S/;
1727
+ var PYTEST_SECTION = /^_{3,} .* _{3,}$/;
1726
1728
  var PYTEST_EXCEPTION_END = /[\s:]/;
1727
1729
  var PYTEST_NOISE = /^(?:platform |rootdir: |collected |plugins: |configfile: |cachedir: |\S+\.pyi? [.FEsxXR]+ +\[ *\d+%\]$|\S+\.py:\d+: $)/;
1728
1730
  var NOISE = /^(?:bun test v|Errors {2}Files$|Ran \d+ tests?|note: |\s*\d+ expect\(\) calls|\s+\d+\s+\S+:\d+$|\s*\d+ errors? and \d+ warnings? potentially fixable)/;
@@ -1877,24 +1879,35 @@ var collectPytest = (lines, used) => {
1877
1879
  const end = lines.findIndex((line, index) => index > start && title(line) !== undefined && !PYTEST_FAILURES.has(title(line) ?? ""));
1878
1880
  const stop = end === -1 ? lines.length : end;
1879
1881
  let message = [];
1882
+ let frame;
1880
1883
  for (let index = start;index < stop; index++) {
1881
1884
  const line = lines[index] ?? "";
1882
1885
  const failure = PYTEST_E_LINE.exec(line);
1883
1886
  if (failure !== null) {
1884
1887
  message.push((failure[1] ?? "").trim());
1885
1888
  } else {
1889
+ if (frame !== undefined && message.length > 0) {
1890
+ errors.push({ tool: "pytest", ...frame, column: 0, severity: "error", message: message[0] ?? "" });
1891
+ frame = undefined;
1892
+ }
1886
1893
  const location = PYTEST_LOCATION.exec(line);
1887
- if (location !== null) {
1894
+ if (location !== null && PYTEST_FRAME.test(location[3] ?? "")) {
1895
+ frame = { file: location[1] ?? "", line: Number(location[2]) };
1896
+ } else if (location !== null) {
1888
1897
  const [exception = ""] = (location[3] ?? "").split(PYTEST_EXCEPTION_END);
1889
1898
  const first = message[0] ?? "";
1890
1899
  const text = first === "" || first.startsWith(exception) ? first || (location[3] ?? "") : `${location[3] ?? ""}: ${first}`;
1891
1900
  errors.push({ tool: "pytest", file: location[1] ?? "", line: Number(location[2]), column: 0, severity: "error", message: text });
1892
1901
  }
1902
+ if (PYTEST_SECTION.test(line))
1903
+ frame = undefined;
1893
1904
  if (line.trim() !== "")
1894
1905
  message = [];
1895
1906
  }
1896
1907
  used.add(index);
1897
1908
  }
1909
+ if (frame !== undefined && message.length > 0)
1910
+ errors.push({ tool: "pytest", ...frame, column: 0, severity: "error", message: message[0] ?? "" });
1898
1911
  for (let index = stop;index < lines.length; index++) {
1899
1912
  if (PYTEST_SUMMARY_LINE.test(lines[index] ?? ""))
1900
1913
  used.add(index);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kaynooo/cli-check",
3
3
  "type": "module",
4
- "version": "0.9.0",
4
+ "version": "0.9.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",