@kaynooo/cli-check 0.18.4 → 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.4";
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.4";
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.4";
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.4";
1168
+ var version = "0.18.6";
1169
1169
 
1170
1170
  // src/j.ts
1171
1171
  import process22 from "process";
@@ -1292,7 +1292,8 @@ var KEYS = {
1292
1292
  "\x03": "cancel",
1293
1293
  "\x1B": "cancel",
1294
1294
  "\x7F": "erase",
1295
- "\b": "erase",
1295
+ "\b": "word",
1296
+ "\x1B\x7F": "word",
1296
1297
  "\x15": "clear",
1297
1298
  "\x17": "word",
1298
1299
  "\t": "tab",
@@ -1300,6 +1301,9 @@ var KEYS = {
1300
1301
  "\x1BOP": "help",
1301
1302
  "\x1B[11~": "help"
1302
1303
  };
1304
+ function eraseWord(text) {
1305
+ return text.replace(LAST_WORD, "");
1306
+ }
1303
1307
  var CTRL_KEY = /^ctrl-[abd-gkln-z]$/;
1304
1308
  function repeat(value, count) {
1305
1309
  return Array.from({ length: count }).fill(value);
@@ -1422,7 +1426,7 @@ function press(state, key) {
1422
1426
  case "clear":
1423
1427
  return withQuery(state, "");
1424
1428
  case "word":
1425
- return withQuery(state, state.query.replace(LAST_WORD, ""));
1429
+ return withQuery(state, eraseWord(state.query));
1426
1430
  case "enter":
1427
1431
  return state.matches.length === 0 && state.marked.size === 0 ? state : { ...state, done: "accept" };
1428
1432
  case "tab": {
@@ -1452,9 +1456,12 @@ import tty from "tty";
1452
1456
  var SYNC_START = "\x1B[?2026h";
1453
1457
  var SYNC_END = "\x1B[?2026l";
1454
1458
  function overwrite(lines, columns) {
1455
- return lines.map((line) => textWidth(line) < columns ? `${line}\x1B[K` : `\x1B[2K${line}`).join(`
1459
+ return lines.map((line) => textWidth(line) % columns === 0 ? `\x1B[2K${line}` : `${line}\x1B[K`).join(`
1456
1460
  `);
1457
1461
  }
1462
+ function rowsTaken(lines, columns) {
1463
+ return lines.reduce((rows, line) => rows + Math.max(1, Math.ceil(textWidth(line) / columns)), 0);
1464
+ }
1458
1465
 
1459
1466
  // ../kit/src/picker/preview.ts
1460
1467
  import process17 from "process";
@@ -1935,10 +1942,19 @@ function list(rows) {
1935
1942
 
1936
1943
  // ../kit/src/prompt.ts
1937
1944
  import process20 from "process";
1938
- var PROMPT_KEYS = new Set(["up", "down", "pageup", "pagedown", "home", "end", "enter", "cancel", "erase"]);
1945
+ var PROMPT_KEYS = new Set(["up", "down", "pageup", "pagedown", "home", "end", "enter", "cancel", "erase", "word", "clear"]);
1939
1946
  function readKeys(input, paste = { active: false }) {
1940
1947
  return parseKeys(input, paste).filter((key) => typeof key === "object" ? "text" in key : PROMPT_KEYS.has(key));
1941
1948
  }
1949
+ function edit(text, key) {
1950
+ if (key === "erase")
1951
+ return [...text].slice(0, -1).join("");
1952
+ if (key === "word")
1953
+ return eraseWord(text);
1954
+ if (key === "clear")
1955
+ return "";
1956
+ return typeof key === "object" ? text + key.text : text;
1957
+ }
1942
1958
  async function input2(question, { default: fallback, mask = false, validate, ...settings } = {}) {
1943
1959
  let value = "";
1944
1960
  let invalid;
@@ -1948,8 +1964,8 @@ async function input2(question, { default: fallback, mask = false, validate, ...
1948
1964
  if (state !== "asking")
1949
1965
  return [answer(colors, question, state, shown())];
1950
1966
  const characters = [...shown()];
1951
- const room = Math.max(columns - question.length - 5, 1);
1952
- const tail = characters.length > room ? `\u2026${characters.slice(1 - room).join("")}` : shown();
1967
+ const room = Math.max(columns - textWidth(`? ${question} `) % columns - 2, 1);
1968
+ const tail = characters.length > room ? `\u2026${characters.slice(characters.length - room + 1).join("")}` : shown();
1953
1969
  const typed = value === "" ? colors.dim(tail) : tail;
1954
1970
  return [`${colors.cyan("?")} ${question} ${typed}${colors.dim("\u2588")}`, ...invalid === undefined ? [] : [` ${colors.red(invalid)}`]];
1955
1971
  }, (key) => {
@@ -1960,10 +1976,7 @@ async function input2(question, { default: fallback, mask = false, validate, ...
1960
1976
  invalid = validate?.(taken());
1961
1977
  return invalid === undefined ? "enter" : undefined;
1962
1978
  }
1963
- if (key === "erase")
1964
- value = [...value].slice(0, -1).join("");
1965
- else if (typeof key === "object")
1966
- value += key.text;
1979
+ value = edit(value, key);
1967
1980
  return;
1968
1981
  });
1969
1982
  return accepted ? taken() : undefined;
@@ -1981,7 +1994,8 @@ async function ask(question, { hint, terminal = process20 }, render, press) {
1981
1994
  const columns = () => stderr.columns || 80;
1982
1995
  const draw = (state, last = false) => {
1983
1996
  const frame = render(colors, state, { columns: columns(), rows: stderr.rows || 24 });
1984
- stderr.write(`${SYNC_START}\r${overwrite(frame, columns())}\x1B[0J${last || frame.length < 2 ? "" : `\x1B[${frame.length - 1}A`}${last ? "" : "\r"}${SYNC_END}`);
1997
+ const rows = rowsTaken(frame, columns());
1998
+ stderr.write(`${SYNC_START}\r${overwrite(frame, columns())}\x1B[0J${last || rows < 2 ? "" : `\x1B[${rows - 1}A`}${last ? "" : "\r"}${SYNC_END}`);
1985
1999
  current = state;
1986
2000
  };
1987
2001
  const redraw = () => draw(current);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kaynooo/cli-check",
3
3
  "type": "module",
4
- "version": "0.18.4",
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.4"
37
+ "@kaynooo/cli-kit": "0.38.6"
38
38
  }
39
39
  }