@kaynooo/cli-check 0.18.5 → 0.18.6

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
@@ -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.5";
1168
+ var version = "0.18.6";
1169
1169
 
1170
1170
  // src/check.ts
1171
1171
  import { writeFile as writeFile3 } from "fs/promises";
@@ -2118,7 +2118,10 @@ var BUN_TEST_FILE = /^\S+\.test\.[jt]sx?:$/;
2118
2118
  var GO_ERROR = /^\s*(?:vet: )?(\S+\.go):(\d+):(?:(\d+):)? (.+)$/;
2119
2119
  var GO_NOISE = /^# \S+(?: \[\S+\])?$/;
2120
2120
  var ARROW = /^\s*--> (.+?):(\d+):(\d+)$/;
2121
- var CARGO_HEADER = /^(error|warning)(?:\[(\w+)\])?: (.*)$/;
2121
+ var CARGO_HEADER = /^(error|warning)(?:\[([\w-]+)\])?: (.*)$/;
2122
+ var CONTINUATION2 = /^\s+\S/;
2123
+ var MAX_CONTINUATION = 20;
2124
+ var KAY_SUMMARY = /^(?:\d+ errors?(?:, \d+ warnings?)?|\d+ warnings?)(?:, failing under --deny-warnings)?$|^checked with /;
2122
2125
  var CARGO_NOISE = /^(?:\s+(?:Compiling|Finished|Checking|Fresh|Running|Blocking) |error: (?:aborting due to|could not compile)|warning: .* generated \d+ warnings?|Some errors have detailed explanations|For more information about (?:this|an) error|To learn more, run the command again)/;
2123
2126
  var RUFF_CONCISE = /^(\S+\.pyi?):(\d+):(\d+): ([A-Z]+\d+) (?:\[\*\] )?(.*)$/;
2124
2127
  var RUFF_HEADER = /^([A-Z]{1,5}\d{1,4}) (?:\[\*\] )?(.+)$/;
@@ -2134,7 +2137,7 @@ var PYTEST_EXCEPTION_END = /[\s:]/;
2134
2137
  var PYTEST_NOISE = /^(?:platform |rootdir: |collected |plugins: |configfile: |cachedir: |\S+\.pyi? [.FEsxXR]+ +\[ *\d+%\]$|\S+\.py:\d+: $)/;
2135
2138
  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)/;
2136
2139
  function isNoise(line) {
2137
- return line.trim() === "" || [NOISE, BUN_TEST_SUMMARY, BUN_CHECK_SUMMARY, TSC_SUMMARY, ESLINT_SUMMARY, BOUNDARY, BASH_ECHO, GO_NOISE, CARGO_NOISE, RUFF_NOISE, PYTEST_NOISE, PYTEST_BANNER, ...PHP_NOISE, ...E2E_NOISE].some((pattern) => pattern.test(line));
2140
+ return line.trim() === "" || [NOISE, BUN_TEST_SUMMARY, BUN_CHECK_SUMMARY, TSC_SUMMARY, ESLINT_SUMMARY, BOUNDARY, BASH_ECHO, GO_NOISE, CARGO_NOISE, KAY_SUMMARY, RUFF_NOISE, PYTEST_NOISE, PYTEST_BANNER, ...PHP_NOISE, ...E2E_NOISE].some((pattern) => pattern.test(line));
2138
2141
  }
2139
2142
  var collectBunCheck = (lines, used) => {
2140
2143
  const errors = [];
@@ -2242,20 +2245,27 @@ var collectGo = (lines, used) => {
2242
2245
  }
2243
2246
  return errors;
2244
2247
  };
2248
+ function headerAbove(lines, arrow, used) {
2249
+ let at = arrow - 1;
2250
+ while (at > 0 && arrow - at <= MAX_CONTINUATION && !used.has(at) && CONTINUATION2.test(lines[at] ?? "") && !ARROW.test(lines[at] ?? ""))
2251
+ at--;
2252
+ return at;
2253
+ }
2245
2254
  var collectArrowed = (lines, used) => {
2246
2255
  const errors = [];
2247
2256
  for (const [index, line] of lines.entries()) {
2248
2257
  const arrow = used.has(index) || index === 0 ? null : ARROW.exec(line);
2249
- const header = arrow === null ? null : lines[index - 1] ?? "";
2258
+ const at = arrow === null ? -1 : headerAbove(lines, index, used);
2259
+ const header = at === -1 ? null : lines[at] ?? "";
2250
2260
  const cargo = header === null ? null : CARGO_HEADER.exec(header);
2251
2261
  const ruff = header === null || cargo !== null ? null : RUFF_HEADER.exec(header);
2252
- if (arrow === null || cargo === null && ruff === null || used.has(index - 1))
2262
+ if (arrow === null || cargo === null && ruff === null || used.has(at))
2253
2263
  continue;
2254
- const [, file, row, column] = arrow;
2255
- const fields = { file: file ?? "", line: Number(row), column: Number(column) };
2256
- errors.push(cargo === null ? { tool: "ruff", ...fields, rule: ruff?.[1], severity: "error", message: ruff?.[2] ?? "" } : { tool: "cargo", ...fields, rule: cargo[2], severity: cargo[1] === "warning" ? "warning" : "error", message: cargo[3] ?? "" });
2257
- used.add(index - 1);
2258
- used.add(index);
2264
+ const [, file = "", row, column] = arrow;
2265
+ const fields = { file, line: Number(row), column: Number(column) };
2266
+ errors.push(cargo === null ? { tool: "ruff", ...fields, rule: ruff?.[1], severity: "error", message: ruff?.[2] ?? "" } : { tool: file.endsWith(".rs") ? "cargo" : "kay check", ...fields, rule: cargo[2], severity: cargo[1] === "warning" ? "warning" : "error", message: cargo[3] ?? "" });
2267
+ for (let taken = at;taken <= index; taken++)
2268
+ used.add(taken);
2259
2269
  for (let frame = index + 1;frame < lines.length && (lines[frame] ?? "").trim() !== ""; frame++) {
2260
2270
  if (CARGO_HEADER.test(lines[frame] ?? "") || RUFF_HEADER.test(lines[frame] ?? ""))
2261
2271
  break;
package/dist/errs-cli.js CHANGED
@@ -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.5";
1168
+ var version = "0.18.6";
1169
1169
 
1170
1170
  // src/errs.ts
1171
1171
  import { relative as relative2 } from "path";
@@ -1900,7 +1900,10 @@ var BUN_TEST_FILE = /^\S+\.test\.[jt]sx?:$/;
1900
1900
  var GO_ERROR = /^\s*(?:vet: )?(\S+\.go):(\d+):(?:(\d+):)? (.+)$/;
1901
1901
  var GO_NOISE = /^# \S+(?: \[\S+\])?$/;
1902
1902
  var ARROW = /^\s*--> (.+?):(\d+):(\d+)$/;
1903
- var CARGO_HEADER = /^(error|warning)(?:\[(\w+)\])?: (.*)$/;
1903
+ var CARGO_HEADER = /^(error|warning)(?:\[([\w-]+)\])?: (.*)$/;
1904
+ var CONTINUATION = /^\s+\S/;
1905
+ var MAX_CONTINUATION = 20;
1906
+ var KAY_SUMMARY = /^(?:\d+ errors?(?:, \d+ warnings?)?|\d+ warnings?)(?:, failing under --deny-warnings)?$|^checked with /;
1904
1907
  var CARGO_NOISE = /^(?:\s+(?:Compiling|Finished|Checking|Fresh|Running|Blocking) |error: (?:aborting due to|could not compile)|warning: .* generated \d+ warnings?|Some errors have detailed explanations|For more information about (?:this|an) error|To learn more, run the command again)/;
1905
1908
  var RUFF_CONCISE = /^(\S+\.pyi?):(\d+):(\d+): ([A-Z]+\d+) (?:\[\*\] )?(.*)$/;
1906
1909
  var RUFF_HEADER = /^([A-Z]{1,5}\d{1,4}) (?:\[\*\] )?(.+)$/;
@@ -1916,7 +1919,7 @@ var PYTEST_EXCEPTION_END = /[\s:]/;
1916
1919
  var PYTEST_NOISE = /^(?:platform |rootdir: |collected |plugins: |configfile: |cachedir: |\S+\.pyi? [.FEsxXR]+ +\[ *\d+%\]$|\S+\.py:\d+: $)/;
1917
1920
  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)/;
1918
1921
  function isNoise(line) {
1919
- return line.trim() === "" || [NOISE, BUN_TEST_SUMMARY, BUN_CHECK_SUMMARY, TSC_SUMMARY, ESLINT_SUMMARY, BOUNDARY, BASH_ECHO, GO_NOISE, CARGO_NOISE, RUFF_NOISE, PYTEST_NOISE, PYTEST_BANNER, ...PHP_NOISE, ...E2E_NOISE].some((pattern) => pattern.test(line));
1922
+ return line.trim() === "" || [NOISE, BUN_TEST_SUMMARY, BUN_CHECK_SUMMARY, TSC_SUMMARY, ESLINT_SUMMARY, BOUNDARY, BASH_ECHO, GO_NOISE, CARGO_NOISE, KAY_SUMMARY, RUFF_NOISE, PYTEST_NOISE, PYTEST_BANNER, ...PHP_NOISE, ...E2E_NOISE].some((pattern) => pattern.test(line));
1920
1923
  }
1921
1924
  var collectBunCheck = (lines, used) => {
1922
1925
  const errors = [];
@@ -2024,20 +2027,27 @@ var collectGo = (lines, used) => {
2024
2027
  }
2025
2028
  return errors;
2026
2029
  };
2030
+ function headerAbove(lines, arrow, used) {
2031
+ let at = arrow - 1;
2032
+ while (at > 0 && arrow - at <= MAX_CONTINUATION && !used.has(at) && CONTINUATION.test(lines[at] ?? "") && !ARROW.test(lines[at] ?? ""))
2033
+ at--;
2034
+ return at;
2035
+ }
2027
2036
  var collectArrowed = (lines, used) => {
2028
2037
  const errors = [];
2029
2038
  for (const [index, line] of lines.entries()) {
2030
2039
  const arrow = used.has(index) || index === 0 ? null : ARROW.exec(line);
2031
- const header = arrow === null ? null : lines[index - 1] ?? "";
2040
+ const at = arrow === null ? -1 : headerAbove(lines, index, used);
2041
+ const header = at === -1 ? null : lines[at] ?? "";
2032
2042
  const cargo = header === null ? null : CARGO_HEADER.exec(header);
2033
2043
  const ruff = header === null || cargo !== null ? null : RUFF_HEADER.exec(header);
2034
- if (arrow === null || cargo === null && ruff === null || used.has(index - 1))
2044
+ if (arrow === null || cargo === null && ruff === null || used.has(at))
2035
2045
  continue;
2036
- const [, file, row, column] = arrow;
2037
- const fields = { file: file ?? "", line: Number(row), column: Number(column) };
2038
- errors.push(cargo === null ? { tool: "ruff", ...fields, rule: ruff?.[1], severity: "error", message: ruff?.[2] ?? "" } : { tool: "cargo", ...fields, rule: cargo[2], severity: cargo[1] === "warning" ? "warning" : "error", message: cargo[3] ?? "" });
2039
- used.add(index - 1);
2040
- used.add(index);
2046
+ const [, file = "", row, column] = arrow;
2047
+ const fields = { file, line: Number(row), column: Number(column) };
2048
+ errors.push(cargo === null ? { tool: "ruff", ...fields, rule: ruff?.[1], severity: "error", message: ruff?.[2] ?? "" } : { tool: file.endsWith(".rs") ? "cargo" : "kay check", ...fields, rule: cargo[2], severity: cargo[1] === "warning" ? "warning" : "error", message: cargo[3] ?? "" });
2049
+ for (let taken = at;taken <= index; taken++)
2050
+ used.add(taken);
2041
2051
  for (let frame = index + 1;frame < lines.length && (lines[frame] ?? "").trim() !== ""; frame++) {
2042
2052
  if (CARGO_HEADER.test(lines[frame] ?? "") || RUFF_HEADER.test(lines[frame] ?? ""))
2043
2053
  break;
@@ -2194,10 +2204,10 @@ var usage2 = `errs [options] [log]
2194
2204
  errs [options] -- <command> [args...]
2195
2205
  errs --in <service> | --host -- <command> [args...]
2196
2206
 
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 --.
2207
+ Prints one \`file:line:col: message (rule)\` line per error found in a tsc, tsgo, vue-tsc, bun check, kay 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
2208
  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
2209
  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
- --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.`;
2210
+ --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.`;
2201
2211
  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
2212
  var options = {
2203
2213
  ...placeOptions,
package/dist/fix-cli.js CHANGED
@@ -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.5";
1168
+ var version = "0.18.6";
1169
1169
 
1170
1170
  // src/fix.ts
1171
1171
  import { existsSync as existsSync5, statSync as statSync2 } from "fs";
@@ -2115,7 +2115,10 @@ var BUN_TEST_FILE = /^\S+\.test\.[jt]sx?:$/;
2115
2115
  var GO_ERROR = /^\s*(?:vet: )?(\S+\.go):(\d+):(?:(\d+):)? (.+)$/;
2116
2116
  var GO_NOISE = /^# \S+(?: \[\S+\])?$/;
2117
2117
  var ARROW = /^\s*--> (.+?):(\d+):(\d+)$/;
2118
- var CARGO_HEADER = /^(error|warning)(?:\[(\w+)\])?: (.*)$/;
2118
+ var CARGO_HEADER = /^(error|warning)(?:\[([\w-]+)\])?: (.*)$/;
2119
+ var CONTINUATION2 = /^\s+\S/;
2120
+ var MAX_CONTINUATION = 20;
2121
+ var KAY_SUMMARY = /^(?:\d+ errors?(?:, \d+ warnings?)?|\d+ warnings?)(?:, failing under --deny-warnings)?$|^checked with /;
2119
2122
  var CARGO_NOISE = /^(?:\s+(?:Compiling|Finished|Checking|Fresh|Running|Blocking) |error: (?:aborting due to|could not compile)|warning: .* generated \d+ warnings?|Some errors have detailed explanations|For more information about (?:this|an) error|To learn more, run the command again)/;
2120
2123
  var RUFF_CONCISE = /^(\S+\.pyi?):(\d+):(\d+): ([A-Z]+\d+) (?:\[\*\] )?(.*)$/;
2121
2124
  var RUFF_HEADER = /^([A-Z]{1,5}\d{1,4}) (?:\[\*\] )?(.+)$/;
@@ -2131,7 +2134,7 @@ var PYTEST_EXCEPTION_END = /[\s:]/;
2131
2134
  var PYTEST_NOISE = /^(?:platform |rootdir: |collected |plugins: |configfile: |cachedir: |\S+\.pyi? [.FEsxXR]+ +\[ *\d+%\]$|\S+\.py:\d+: $)/;
2132
2135
  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)/;
2133
2136
  function isNoise(line) {
2134
- return line.trim() === "" || [NOISE, BUN_TEST_SUMMARY, BUN_CHECK_SUMMARY, TSC_SUMMARY, ESLINT_SUMMARY, BOUNDARY, BASH_ECHO, GO_NOISE, CARGO_NOISE, RUFF_NOISE, PYTEST_NOISE, PYTEST_BANNER, ...PHP_NOISE, ...E2E_NOISE].some((pattern) => pattern.test(line));
2137
+ return line.trim() === "" || [NOISE, BUN_TEST_SUMMARY, BUN_CHECK_SUMMARY, TSC_SUMMARY, ESLINT_SUMMARY, BOUNDARY, BASH_ECHO, GO_NOISE, CARGO_NOISE, KAY_SUMMARY, RUFF_NOISE, PYTEST_NOISE, PYTEST_BANNER, ...PHP_NOISE, ...E2E_NOISE].some((pattern) => pattern.test(line));
2135
2138
  }
2136
2139
  var collectBunCheck = (lines, used) => {
2137
2140
  const errors = [];
@@ -2239,20 +2242,27 @@ var collectGo = (lines, used) => {
2239
2242
  }
2240
2243
  return errors;
2241
2244
  };
2245
+ function headerAbove(lines, arrow, used) {
2246
+ let at = arrow - 1;
2247
+ while (at > 0 && arrow - at <= MAX_CONTINUATION && !used.has(at) && CONTINUATION2.test(lines[at] ?? "") && !ARROW.test(lines[at] ?? ""))
2248
+ at--;
2249
+ return at;
2250
+ }
2242
2251
  var collectArrowed = (lines, used) => {
2243
2252
  const errors = [];
2244
2253
  for (const [index, line] of lines.entries()) {
2245
2254
  const arrow = used.has(index) || index === 0 ? null : ARROW.exec(line);
2246
- const header = arrow === null ? null : lines[index - 1] ?? "";
2255
+ const at = arrow === null ? -1 : headerAbove(lines, index, used);
2256
+ const header = at === -1 ? null : lines[at] ?? "";
2247
2257
  const cargo = header === null ? null : CARGO_HEADER.exec(header);
2248
2258
  const ruff = header === null || cargo !== null ? null : RUFF_HEADER.exec(header);
2249
- if (arrow === null || cargo === null && ruff === null || used.has(index - 1))
2259
+ if (arrow === null || cargo === null && ruff === null || used.has(at))
2250
2260
  continue;
2251
- const [, file, row, column] = arrow;
2252
- const fields = { file: file ?? "", line: Number(row), column: Number(column) };
2253
- errors.push(cargo === null ? { tool: "ruff", ...fields, rule: ruff?.[1], severity: "error", message: ruff?.[2] ?? "" } : { tool: "cargo", ...fields, rule: cargo[2], severity: cargo[1] === "warning" ? "warning" : "error", message: cargo[3] ?? "" });
2254
- used.add(index - 1);
2255
- used.add(index);
2261
+ const [, file = "", row, column] = arrow;
2262
+ const fields = { file, line: Number(row), column: Number(column) };
2263
+ errors.push(cargo === null ? { tool: "ruff", ...fields, rule: ruff?.[1], severity: "error", message: ruff?.[2] ?? "" } : { tool: file.endsWith(".rs") ? "cargo" : "kay check", ...fields, rule: cargo[2], severity: cargo[1] === "warning" ? "warning" : "error", message: cargo[3] ?? "" });
2264
+ for (let taken = at;taken <= index; taken++)
2265
+ used.add(taken);
2256
2266
  for (let frame = index + 1;frame < lines.length && (lines[frame] ?? "").trim() !== ""; frame++) {
2257
2267
  if (CARGO_HEADER.test(lines[frame] ?? "") || RUFF_HEADER.test(lines[frame] ?? ""))
2258
2268
  break;
package/dist/j-cli.js CHANGED
@@ -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.5";
1168
+ var version = "0.18.6";
1169
1169
 
1170
1170
  // src/j.ts
1171
1171
  import process22 from "process";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kaynooo/cli-check",
3
3
  "type": "module",
4
- "version": "0.18.5",
4
+ "version": "0.18.6",
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.5"
37
+ "@kaynooo/cli-kit": "0.38.6"
38
38
  }
39
39
  }