@delorenj/pjangler 1.5.27 โ†’ 1.5.28

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/crank/tui.js CHANGED
@@ -435,6 +435,7 @@ function CrankDashboard({ controller, refreshMs = 5e3, clock = Date.now, onQuit
435
435
  }
436
436
  async function runCrankDashboard(controller, run = {}) {
437
437
  const { refreshMs, ...ink } = run;
438
+ controller.read();
438
439
  await runInk((finish) => /* @__PURE__ */ jsx3(CrankDashboard, { controller, refreshMs, onQuit: () => finish() }), { alternateScreen: true, ...ink });
439
440
  }
440
441
  export {
package/dist/index.js CHANGED
@@ -20420,7 +20420,7 @@ var TAB_STATUS_SUFFIX = /[\s๐ŸŸข๐ŸŸก๐Ÿ”ด๐Ÿ””โšซโœณโœปโ—ยทโ”€]+$/u;
20420
20420
  var defaultShell = (command, args) => {
20421
20421
  const result2 = spawnSync16(command, args, { encoding: "utf8", timeout: 1e4 });
20422
20422
  if (result2.error) return { stdout: "", status: 127 };
20423
- return { stdout: result2.stdout ?? "", status: result2.status ?? 1 };
20423
+ return { stdout: result2.stdout ?? "", status: result2.status ?? 1, stderr: result2.stderr ?? "" };
20424
20424
  };
20425
20425
  function tabDisplay(name) {
20426
20426
  const trimmed2 = (name ?? "").trim();
@@ -20503,10 +20503,28 @@ function redis(deps = {}) {
20503
20503
  const endpoint = redisEndpoint();
20504
20504
  const host = deps.host ?? endpoint.host;
20505
20505
  const port = deps.port ?? endpoint.port;
20506
- const call = (args) => shell("redis-cli", ["--raw", "-h", host, "-p", String(port), ...args]);
20506
+ const call = (args) => shell("redis-cli", ["--raw", "-e", "-h", host, "-p", String(port), ...args]);
20507
+ let errorExitSupport = "unprobed";
20508
+ const requireErrorExit = () => {
20509
+ if (errorExitSupport === "unprobed") {
20510
+ const help = shell("redis-cli", ["--help"]);
20511
+ errorExitSupport = help.status === 0 && /^usage: redis-cli/im.test(help.stdout) ? /(^|\n)\s+-e\s/.test(help.stdout) ? "yes" : "no" : "unknown";
20512
+ }
20513
+ if (errorExitSupport === "no") {
20514
+ throw new Error(
20515
+ `redis-cli is too old for the crank store at ${host}:${port}: no -e flag (needs redis-tools >= 6.2) to fail on Redis error replies \u2014 upgrade redis-tools`
20516
+ );
20517
+ }
20518
+ };
20519
+ const notAnswering = (stderr) => !stderr || stderr.startsWith("Could not connect to Redis at") || stderr.startsWith("Error: ");
20507
20520
  const run = (...args) => {
20521
+ requireErrorExit();
20508
20522
  const result2 = call(args);
20509
- if (result2.status !== 0) throw new Error(`Redis is not answering at ${host}:${port} (${args[0]} failed)`);
20523
+ if (result2.status !== 0) {
20524
+ const stderr = (result2.stderr ?? "").trim();
20525
+ if (notAnswering(stderr)) throw new Error(`Redis is not answering at ${host}:${port} (${args[0]} failed)`);
20526
+ throw new Error(`Redis error reply at ${host}:${port}: ${stderr.split("\n")[0]} (${args.join(" ")})`);
20527
+ }
20510
20528
  return result2.stdout.replace(/\r?\n$/, "");
20511
20529
  };
20512
20530
  const lines = (out) => out.split("\n").map((line) => line.replace(/\r$/, "")).filter(Boolean);
@@ -20515,6 +20533,7 @@ function redis(deps = {}) {
20515
20533
  endpoint: `${host}:${port}`,
20516
20534
  /** PING -> true only when Redis answers PONG. */
20517
20535
  ping: () => {
20536
+ requireErrorExit();
20518
20537
  const result2 = call(["PING"]);
20519
20538
  return result2.status === 0 && result2.stdout.replace(/\r?\n$/, "") === "PONG";
20520
20539
  },
@@ -20970,24 +20989,23 @@ function registerCrankCli(program2) {
20970
20989
  console.error(`${xmark} --tail needs a positive integer, got "${options.tail}"`);
20971
20990
  process.exit(1);
20972
20991
  }
20973
- let current;
20974
20992
  try {
20975
- current = resolveCurrentTab();
20993
+ const current = resolveCurrentTab();
20994
+ const store = redis();
20995
+ const rows = store.logRows(current.tab);
20996
+ if (!rows.length) {
20997
+ console.log(` ${dim(`no crank log rows for ${current.tab}`)}`);
20998
+ return;
20999
+ }
21000
+ const shown = rows.slice(-tail);
21001
+ console.log(` ${bold("crank log")} ${dim(glyph.dot)} ${cyan(current.tab)} ${dim(`(${shown.length}/${rows.length} rows, newest last)`)}`);
21002
+ for (const raw of shown) {
21003
+ console.log(renderLogRow(raw) ?? raw);
21004
+ }
20976
21005
  } catch (error) {
20977
21006
  console.error(`${xmark} ${error instanceof Error ? error.message : String(error)}`);
20978
21007
  process.exit(1);
20979
21008
  }
20980
- const store = redis();
20981
- const rows = store.logRows(current.tab);
20982
- if (!rows.length) {
20983
- console.log(` ${dim(`no crank log rows for ${current.tab}`)}`);
20984
- return;
20985
- }
20986
- const shown = rows.slice(-tail);
20987
- console.log(` ${bold("crank log")} ${dim(glyph.dot)} ${cyan(current.tab)} ${dim(`(${shown.length}/${rows.length} rows, newest last)`)}`);
20988
- for (const raw of shown) {
20989
- console.log(renderLogRow(raw) ?? raw);
20990
- }
20991
21009
  });
20992
21010
  }
20993
21011
  function fail(error, what) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@delorenj/pjangler",
3
- "version": "1.5.27",
3
+ "version": "1.5.28",
4
4
  "description": "Project subsystem bootstrapper CLI",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",