@kaynooo/cli-wait 0.8.0 → 0.9.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/dist/cli.js +15 -10
- package/dist/slot-cli.js +16 -11
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -329,13 +329,13 @@ function userConfigPath(bin, where = {}) {
|
|
|
329
329
|
// ../kit/src/theme.ts
|
|
330
330
|
var DEFAULT = {
|
|
331
331
|
colors: { accent: "cyan", id: "yellow", path: "blue", label: "dim", value: "bold", ok: "green", warn: "yellow", problem: "red", note: "dim", passed: "green", failed: "red", running: "cyan", queued: "yellow", skipped: "dim" },
|
|
332
|
-
glyphs: { ok: "\u2713", warn: "\u25B2", problem: "\u2717", note: "\u203A", passed: "\u2713", failed: "\u2717", running: "\u25CF", queued: "\u25CB", skipped: "-", bar: "\u2501" },
|
|
332
|
+
glyphs: { ok: "\u2713", warn: "\u25B2", problem: "\u2717", note: "\u203A", passed: "\u2713", failed: "\u2717", running: "\u25CF", queued: "\u25CB", skipped: "-", bar: "\u2501", rule: "\u2500", corner: "\u256D" },
|
|
333
333
|
accents: ["cyan", "magenta", "green", "blue", "yellow", "redBright"],
|
|
334
334
|
bins: {}
|
|
335
335
|
};
|
|
336
336
|
var BRIGHT = { accent: "cyanBright", id: "yellowBright", path: "blueBright", label: "white", value: "bold whiteBright", ok: "greenBright", warn: "yellowBright", problem: "redBright", note: "white", passed: "greenBright", failed: "redBright", running: "cyanBright", queued: "yellowBright", skipped: "white" };
|
|
337
337
|
var MONO = { accent: "bold", id: "bold", path: "underline", label: "dim", value: "bold", ok: "bold", warn: "bold", problem: "bold", note: "dim", passed: "bold", failed: "bold", running: "bold", queued: "dim", skipped: "dim" };
|
|
338
|
-
var ASCII = { ok: "+", warn: "!", problem: "x", note: ">", passed: "+", failed: "x", running: "*", queued: "o", skipped: "-", bar: "#" };
|
|
338
|
+
var ASCII = { ok: "+", warn: "!", problem: "x", note: ">", passed: "+", failed: "x", running: "*", queued: "o", skipped: "-", bar: "#", rule: "-", corner: "+" };
|
|
339
339
|
var PRESETS = {
|
|
340
340
|
default: {},
|
|
341
341
|
"high-contrast": { colors: BRIGHT, accents: ["cyanBright", "magentaBright", "greenBright", "blueBright", "yellowBright", "redBright"] },
|
|
@@ -712,7 +712,6 @@ var DASHES = /^-+/;
|
|
|
712
712
|
function jsonOption(holds) {
|
|
713
713
|
return { type: "boolean", description: holds === undefined ? "print JSON" : `print JSON: ${holds}` };
|
|
714
714
|
}
|
|
715
|
-
|
|
716
715
|
class Exit extends Error {
|
|
717
716
|
code;
|
|
718
717
|
hint;
|
|
@@ -1071,25 +1070,28 @@ function liveRegion(render, stream = process11.stderr, env = process11.env) {
|
|
|
1071
1070
|
} };
|
|
1072
1071
|
const write = stream.write.bind(stream);
|
|
1073
1072
|
let frame = 0;
|
|
1074
|
-
let drawn =
|
|
1073
|
+
let drawn = [];
|
|
1074
|
+
const columns = () => stream.columns === undefined || stream.columns === 0 ? 80 : stream.columns;
|
|
1075
|
+
const rowsDrawn = () => drawn.reduce((sum, width) => sum + Math.max(1, Math.ceil(width / columns())), 0);
|
|
1075
1076
|
const clear = () => {
|
|
1076
|
-
if (drawn > 0)
|
|
1077
|
-
write(`${CLEAR_LINE}${LINE_UP.repeat(
|
|
1078
|
-
drawn =
|
|
1077
|
+
if (drawn.length > 0)
|
|
1078
|
+
write(`${CLEAR_LINE}${LINE_UP.repeat(rowsDrawn() - 1)}`);
|
|
1079
|
+
drawn = [];
|
|
1079
1080
|
};
|
|
1080
1081
|
const draw = () => {
|
|
1081
|
-
const width = (
|
|
1082
|
+
const width = columns() - 1;
|
|
1082
1083
|
const height = stream.rows === undefined || stream.rows === 0 ? 24 : stream.rows;
|
|
1083
1084
|
const lines = render(FRAMES[frame++ % FRAMES.length]).slice(0, Math.max(1, height - 1)).map((line) => cutToWidth(line, width));
|
|
1084
1085
|
if (lines.length === 0) {
|
|
1085
1086
|
clear();
|
|
1086
1087
|
return;
|
|
1087
1088
|
}
|
|
1088
|
-
write(`${drawn > 0 ? `${CLEAR_LINE}${LINE_UP.repeat(
|
|
1089
|
+
write(`${drawn.length > 0 ? `${CLEAR_LINE}${LINE_UP.repeat(rowsDrawn() - 1)}` : CLEAR_LINE}${lines.join(`
|
|
1089
1090
|
`)}`);
|
|
1090
|
-
drawn = lines.
|
|
1091
|
+
drawn = lines.map((line) => Bun.stringWidth(line));
|
|
1091
1092
|
};
|
|
1092
1093
|
const timer = setInterval(draw, FRAME_MS);
|
|
1094
|
+
stream.on?.("resize", draw);
|
|
1093
1095
|
const restore = interceptOutput(clear);
|
|
1094
1096
|
const release = swallowInput();
|
|
1095
1097
|
const onExit = () => {
|
|
@@ -1099,6 +1101,7 @@ function liveRegion(render, stream = process11.stderr, env = process11.env) {
|
|
|
1099
1101
|
const signals = holdSignals(stop);
|
|
1100
1102
|
function stop() {
|
|
1101
1103
|
clearInterval(timer);
|
|
1104
|
+
stream.off?.("resize", draw);
|
|
1102
1105
|
clear();
|
|
1103
1106
|
restore();
|
|
1104
1107
|
release();
|
|
@@ -1385,6 +1388,8 @@ async function runMain({ name, version, run, redact, usage }, argv = process14.a
|
|
|
1385
1388
|
}
|
|
1386
1389
|
return code;
|
|
1387
1390
|
}
|
|
1391
|
+
// ../kit/src/folders.ts
|
|
1392
|
+
var SKIPPED_FOLDERS = new Set(["node_modules", "vendor", "dist", "build", "target", "coverage", "venv", "__pycache__"]);
|
|
1388
1393
|
// ../kit/src/secrets.ts
|
|
1389
1394
|
var SECRET_WORDS = new Set(["key", "pass", "pwd", "auth", "salt", "cookie", "session", "jwt", "ssn", "iban", "card", "cvv", "otp"]);
|
|
1390
1395
|
// ../kit/src/sessions.ts
|
package/dist/slot-cli.js
CHANGED
|
@@ -328,13 +328,13 @@ function userConfigPath(bin, where = {}) {
|
|
|
328
328
|
// ../kit/src/theme.ts
|
|
329
329
|
var DEFAULT = {
|
|
330
330
|
colors: { accent: "cyan", id: "yellow", path: "blue", label: "dim", value: "bold", ok: "green", warn: "yellow", problem: "red", note: "dim", passed: "green", failed: "red", running: "cyan", queued: "yellow", skipped: "dim" },
|
|
331
|
-
glyphs: { ok: "\u2713", warn: "\u25B2", problem: "\u2717", note: "\u203A", passed: "\u2713", failed: "\u2717", running: "\u25CF", queued: "\u25CB", skipped: "-", bar: "\u2501" },
|
|
331
|
+
glyphs: { ok: "\u2713", warn: "\u25B2", problem: "\u2717", note: "\u203A", passed: "\u2713", failed: "\u2717", running: "\u25CF", queued: "\u25CB", skipped: "-", bar: "\u2501", rule: "\u2500", corner: "\u256D" },
|
|
332
332
|
accents: ["cyan", "magenta", "green", "blue", "yellow", "redBright"],
|
|
333
333
|
bins: {}
|
|
334
334
|
};
|
|
335
335
|
var BRIGHT = { accent: "cyanBright", id: "yellowBright", path: "blueBright", label: "white", value: "bold whiteBright", ok: "greenBright", warn: "yellowBright", problem: "redBright", note: "white", passed: "greenBright", failed: "redBright", running: "cyanBright", queued: "yellowBright", skipped: "white" };
|
|
336
336
|
var MONO = { accent: "bold", id: "bold", path: "underline", label: "dim", value: "bold", ok: "bold", warn: "bold", problem: "bold", note: "dim", passed: "bold", failed: "bold", running: "bold", queued: "dim", skipped: "dim" };
|
|
337
|
-
var ASCII = { ok: "+", warn: "!", problem: "x", note: ">", passed: "+", failed: "x", running: "*", queued: "o", skipped: "-", bar: "#" };
|
|
337
|
+
var ASCII = { ok: "+", warn: "!", problem: "x", note: ">", passed: "+", failed: "x", running: "*", queued: "o", skipped: "-", bar: "#", rule: "-", corner: "+" };
|
|
338
338
|
var PRESETS = {
|
|
339
339
|
default: {},
|
|
340
340
|
"high-contrast": { colors: BRIGHT, accents: ["cyanBright", "magentaBright", "greenBright", "blueBright", "yellowBright", "redBright"] },
|
|
@@ -711,7 +711,6 @@ var DASHES = /^-+/;
|
|
|
711
711
|
function jsonOption(holds) {
|
|
712
712
|
return { type: "boolean", description: holds === undefined ? "print JSON" : `print JSON: ${holds}` };
|
|
713
713
|
}
|
|
714
|
-
|
|
715
714
|
class Exit extends Error {
|
|
716
715
|
code;
|
|
717
716
|
hint;
|
|
@@ -1070,25 +1069,28 @@ function liveRegion(render, stream = process11.stderr, env = process11.env) {
|
|
|
1070
1069
|
} };
|
|
1071
1070
|
const write = stream.write.bind(stream);
|
|
1072
1071
|
let frame = 0;
|
|
1073
|
-
let drawn =
|
|
1072
|
+
let drawn = [];
|
|
1073
|
+
const columns = () => stream.columns === undefined || stream.columns === 0 ? 80 : stream.columns;
|
|
1074
|
+
const rowsDrawn = () => drawn.reduce((sum, width) => sum + Math.max(1, Math.ceil(width / columns())), 0);
|
|
1074
1075
|
const clear = () => {
|
|
1075
|
-
if (drawn > 0)
|
|
1076
|
-
write(`${CLEAR_LINE}${LINE_UP.repeat(
|
|
1077
|
-
drawn =
|
|
1076
|
+
if (drawn.length > 0)
|
|
1077
|
+
write(`${CLEAR_LINE}${LINE_UP.repeat(rowsDrawn() - 1)}`);
|
|
1078
|
+
drawn = [];
|
|
1078
1079
|
};
|
|
1079
1080
|
const draw = () => {
|
|
1080
|
-
const width = (
|
|
1081
|
+
const width = columns() - 1;
|
|
1081
1082
|
const height = stream.rows === undefined || stream.rows === 0 ? 24 : stream.rows;
|
|
1082
1083
|
const lines = render(FRAMES[frame++ % FRAMES.length]).slice(0, Math.max(1, height - 1)).map((line) => cutToWidth(line, width));
|
|
1083
1084
|
if (lines.length === 0) {
|
|
1084
1085
|
clear();
|
|
1085
1086
|
return;
|
|
1086
1087
|
}
|
|
1087
|
-
write(`${drawn > 0 ? `${CLEAR_LINE}${LINE_UP.repeat(
|
|
1088
|
+
write(`${drawn.length > 0 ? `${CLEAR_LINE}${LINE_UP.repeat(rowsDrawn() - 1)}` : CLEAR_LINE}${lines.join(`
|
|
1088
1089
|
`)}`);
|
|
1089
|
-
drawn = lines.
|
|
1090
|
+
drawn = lines.map((line) => Bun.stringWidth(line));
|
|
1090
1091
|
};
|
|
1091
1092
|
const timer = setInterval(draw, FRAME_MS);
|
|
1093
|
+
stream.on?.("resize", draw);
|
|
1092
1094
|
const restore = interceptOutput(clear);
|
|
1093
1095
|
const release = swallowInput();
|
|
1094
1096
|
const onExit = () => {
|
|
@@ -1098,6 +1100,7 @@ function liveRegion(render, stream = process11.stderr, env = process11.env) {
|
|
|
1098
1100
|
const signals = holdSignals(stop);
|
|
1099
1101
|
function stop() {
|
|
1100
1102
|
clearInterval(timer);
|
|
1103
|
+
stream.off?.("resize", draw);
|
|
1101
1104
|
clear();
|
|
1102
1105
|
restore();
|
|
1103
1106
|
release();
|
|
@@ -1384,6 +1387,8 @@ async function runMain({ name, version, run, redact, usage }, argv = process14.a
|
|
|
1384
1387
|
}
|
|
1385
1388
|
return code;
|
|
1386
1389
|
}
|
|
1390
|
+
// ../kit/src/folders.ts
|
|
1391
|
+
var SKIPPED_FOLDERS = new Set(["node_modules", "vendor", "dist", "build", "target", "coverage", "venv", "__pycache__"]);
|
|
1387
1392
|
// ../kit/src/secrets.ts
|
|
1388
1393
|
var SECRET_WORDS = new Set(["key", "pass", "pwd", "auth", "salt", "cookie", "session", "jwt", "ssn", "iban", "card", "cvv", "otp"]);
|
|
1389
1394
|
// ../kit/src/sessions.ts
|
|
@@ -1680,7 +1685,7 @@ async function listSlots(args) {
|
|
|
1680
1685
|
printJson({ slots: count, busy, entries });
|
|
1681
1686
|
return 0;
|
|
1682
1687
|
}
|
|
1683
|
-
console.log(`slots: ${busy} of ${count} busy`);
|
|
1688
|
+
console.log(paint(process18.stdout).bold(`slots: ${busy} of ${count} busy`));
|
|
1684
1689
|
if (entries.length > 0)
|
|
1685
1690
|
console.log(table(entries.map((entry) => [badge(entry.state, process18.stdout), entry.resource, entry.session ?? `pid ${entry.pid}`, truncate(entry.command, COMMAND_WIDTH), entry.since === 0 ? "?" : formatAge(entry.since)])));
|
|
1686
1691
|
return 0;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kaynooo/cli-wait",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.9.0",
|
|
5
5
|
"description": "waitfor and slot: waits for a log line, a listening port or a URL answering, and queues heavy commands behind machine-wide slots and named locks, for Claude Code, instead of sleep and polling loops.",
|
|
6
6
|
"author": "Kaynooo <contact@kaynooo.fr>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -38,6 +38,6 @@
|
|
|
38
38
|
"waitfor": "$npm_execpath src/cli.ts"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@kaynooo/cli-kit": "0.
|
|
41
|
+
"@kaynooo/cli-kit": "0.30.0"
|
|
42
42
|
}
|
|
43
43
|
}
|