@lobehub/cli 0.0.114 → 0.0.115

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/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import { createRequire } from "node:module";
3
3
  import crypto$1, { X509Certificate, createHash, randomBytes, randomUUID, sign } from "node:crypto";
4
4
  import * as fs$5 from "node:fs";
5
- import fs, { appendFileSync, closeSync, constants, createReadStream, createWriteStream, existsSync, lstatSync, mkdirSync, mkdtempSync, openSync, readFileSync, readSync, readdirSync, readlinkSync, realpathSync, rmSync, statSync, symlinkSync, unlink, writeFileSync } from "node:fs";
5
+ import fs, { appendFileSync, closeSync, constants, createReadStream, createWriteStream, existsSync, fstatSync, lstatSync, mkdirSync, mkdtempSync, openSync, readFileSync, readSync, readdirSync, readlinkSync, realpathSync, rmSync, statSync, symlinkSync, unlink, writeFileSync } from "node:fs";
6
6
  import * as os$4 from "node:os";
7
7
  import os, { EOL, constants as constants$1, homedir, platform, tmpdir } from "node:os";
8
8
  import * as path$4 from "node:path";
@@ -27095,7 +27095,16 @@ function printKanban(columns) {
27095
27095
  }).join(" ");
27096
27096
  console.log(bottomBorder);
27097
27097
  }
27098
+ /**
27099
+ * Ask a `(y/N)` question on the terminal.
27100
+ *
27101
+ * Without a terminal there is nobody to answer: an agent's shell, a pipe or CI
27102
+ * either never closes stdin (the command hangs until it is killed) or closes it
27103
+ * empty (the action is silently cancelled). Fail loudly instead, so the caller
27104
+ * learns it has to pass `--yes`.
27105
+ */
27098
27106
  function confirm(message) {
27107
+ if (!process.stdin.isTTY) return Promise.reject(/* @__PURE__ */ new Error(`${message}\nRefusing to continue without an interactive terminal to confirm. Re-run with --yes to skip the prompt.`));
27099
27108
  const rl = createInterface({
27100
27109
  input: process.stdin,
27101
27110
  output: process.stderr
@@ -49841,9 +49850,21 @@ function formatFsLongListing(nodes) {
49841
49850
  async function readFsContentInput(options) {
49842
49851
  if (options.contentFile) return readFileSync(options.contentFile, "utf8");
49843
49852
  if (options.content !== void 0) return options.content;
49844
- if (process.stdin.isTTY === false) return text(process.stdin);
49853
+ if (isStdinRedirected()) return text(process.stdin);
49845
49854
  return "";
49846
49855
  }
49856
+ /**
49857
+ * Whether stdin was piped (`echo x | lh …`) or redirected from a file (`< x`).
49858
+ * A terminal, a closed stdin or `/dev/null` (an agent shell) is not input.
49859
+ */
49860
+ function isStdinRedirected() {
49861
+ try {
49862
+ const stat = fstatSync(0);
49863
+ return stat.isFIFO() || stat.isFile();
49864
+ } catch {
49865
+ return false;
49866
+ }
49867
+ }
49847
49868
  async function resolveAgentFsContext(client, options) {
49848
49869
  return {
49849
49870
  agentId: await resolveAgentId$1(client, options),
@@ -268574,8 +268595,13 @@ var require_tree_kill = /* @__PURE__ */ __commonJSMin$2(((exports, module) => {
268574
268595
  var import_tree_kill = /* @__PURE__ */ __toESM$2(require_tree_kill());
268575
268596
  const KILL_SIGNAL = "SIGKILL";
268576
268597
  /**
268577
- * Non-interactive backend: a plain `child_process` with stdin left as an
268578
- * unused pipe and stdout/stderr inherited straight into the output files.
268598
+ * Non-interactive backend: a plain `child_process` with stdin bound to the
268599
+ * null device and stdout/stderr inherited straight into the output files.
268600
+ *
268601
+ * Nothing ever writes to a command's stdin here, so it must not be an open
268602
+ * pipe: a command that reads stdin (a `(y/N)` confirm, `read`, a CLI that falls
268603
+ * back to piped input) would wait on it until the shell timeout. With `ignore`
268604
+ * it reads EOF at once and fails or cancels instead of hanging.
268579
268605
  */
268580
268606
  var ChildProcessBackend = class {
268581
268607
  capabilities = {
@@ -268609,7 +268635,7 @@ var ChildProcessBackend = class {
268609
268635
  env,
268610
268636
  shell: false,
268611
268637
  stdio: [
268612
- "pipe",
268638
+ "ignore",
268613
268639
  outputFiles.stdout.fd,
268614
268640
  outputFiles.stderr.fd
268615
268641
  ],
package/man/man1/lh.1 CHANGED
@@ -1,6 +1,6 @@
1
1
  .\" Code generated by `npm run man:generate`; DO NOT EDIT.
2
2
  .\" Manual command details come from the Commander command tree.
3
- .TH LH 1 "" "@lobehub/cli 0.0.114" "User Commands"
3
+ .TH LH 1 "" "@lobehub/cli 0.0.115" "User Commands"
4
4
  .SH NAME
5
5
  lh \- LobeHub CLI \- manage and connect to LobeHub services
6
6
  .SH SYNOPSIS
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/cli",
3
- "version": "0.0.114",
3
+ "version": "0.0.115",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/lobehub/lobehub",
@@ -83,5 +83,5 @@
83
83
  "access": "public",
84
84
  "registry": "https://registry.npmjs.org"
85
85
  },
86
- "gitHead": "cb13873cad7a256344c7776aac05f571e940141e"
86
+ "gitHead": "e998173235dcc0d30e474038db052ae4d3d5b236"
87
87
  }