@lobehub/cli 0.0.213 → 0.0.215

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
@@ -15,7 +15,7 @@ import { Buffer as Buffer$1 } from "node:buffer";
15
15
  import * as net$1 from "node:net";
16
16
  import net, { BlockList, connect, createServer, isIP } from "node:net";
17
17
  import { scheduler, setImmediate as setImmediate$1, setTimeout as setTimeout$1 } from "node:timers/promises";
18
- import process$1, { cwd, execArgv, execPath, hrtime, platform as platform$1 } from "node:process";
18
+ import _w, { cwd, execArgv, execPath, hrtime, platform as platform$1 } from "node:process";
19
19
  import { URL as URL$1, fileURLToPath, pathToFileURL } from "node:url";
20
20
  import { finished, pipeline } from "node:stream/promises";
21
21
  import { Duplex, PassThrough, Readable, Transform, Writable, getDefaultHighWaterMark, pipeline as pipeline$1 } from "node:stream";
@@ -24433,7 +24433,7 @@ var require_command = /* @__PURE__ */ __commonJSMin$2(((exports) => {
24433
24433
  const childProcess$2 = __require("node:child_process");
24434
24434
  const path$16 = __require("node:path");
24435
24435
  const fs$17 = __require("node:fs");
24436
- const process$3 = __require("node:process");
24436
+ const process$2 = __require("node:process");
24437
24437
  const { Argument, humanReadableArgName } = require_argument();
24438
24438
  const { CommanderError } = require_error$1();
24439
24439
  const { Help, stripColor } = require_help();
@@ -24485,13 +24485,13 @@ var require_command = /* @__PURE__ */ __commonJSMin$2(((exports) => {
24485
24485
  this._showSuggestionAfterError = true;
24486
24486
  this._savedState = null;
24487
24487
  this._outputConfiguration = {
24488
- writeOut: (str) => process$3.stdout.write(str),
24489
- writeErr: (str) => process$3.stderr.write(str),
24488
+ writeOut: (str) => process$2.stdout.write(str),
24489
+ writeErr: (str) => process$2.stderr.write(str),
24490
24490
  outputError: (str, write) => write(str),
24491
- getOutHelpWidth: () => process$3.stdout.isTTY ? process$3.stdout.columns : void 0,
24492
- getErrHelpWidth: () => process$3.stderr.isTTY ? process$3.stderr.columns : void 0,
24493
- getOutHasColors: () => useColor() ?? (process$3.stdout.isTTY && process$3.stdout.hasColors?.()),
24494
- getErrHasColors: () => useColor() ?? (process$3.stderr.isTTY && process$3.stderr.hasColors?.()),
24491
+ getOutHelpWidth: () => process$2.stdout.isTTY ? process$2.stdout.columns : void 0,
24492
+ getErrHelpWidth: () => process$2.stderr.isTTY ? process$2.stderr.columns : void 0,
24493
+ getOutHasColors: () => useColor() ?? (process$2.stdout.isTTY && process$2.stdout.hasColors?.()),
24494
+ getErrHasColors: () => useColor() ?? (process$2.stderr.isTTY && process$2.stderr.hasColors?.()),
24495
24495
  stripColor: (str) => stripColor(str)
24496
24496
  };
24497
24497
  this._hidden = false;
@@ -24849,7 +24849,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
24849
24849
  */
24850
24850
  _exit(exitCode, code, message) {
24851
24851
  if (this._exitCallback) this._exitCallback(new CommanderError(exitCode, code, message));
24852
- process$3.exit(exitCode);
24852
+ process$2.exit(exitCode);
24853
24853
  }
24854
24854
  /**
24855
24855
  * Register callback `fn` for the command.
@@ -25188,11 +25188,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
25188
25188
  if (argv !== void 0 && !Array.isArray(argv)) throw new Error("first parameter to parse must be array or undefined");
25189
25189
  parseOptions = parseOptions || {};
25190
25190
  if (argv === void 0 && parseOptions.from === void 0) {
25191
- if (process$3.versions?.electron) parseOptions.from = "electron";
25192
- const execArgv = process$3.execArgv ?? [];
25191
+ if (process$2.versions?.electron) parseOptions.from = "electron";
25192
+ const execArgv = process$2.execArgv ?? [];
25193
25193
  if (execArgv.includes("-e") || execArgv.includes("--eval") || execArgv.includes("-p") || execArgv.includes("--print")) parseOptions.from = "eval";
25194
25194
  }
25195
- if (argv === void 0) argv = process$3.argv;
25195
+ if (argv === void 0) argv = process$2.argv;
25196
25196
  this.rawArgs = argv.slice();
25197
25197
  let userArgs;
25198
25198
  switch (parseOptions.from) {
@@ -25202,7 +25202,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
25202
25202
  userArgs = argv.slice(2);
25203
25203
  break;
25204
25204
  case "electron":
25205
- if (process$3.defaultApp) {
25205
+ if (process$2.defaultApp) {
25206
25206
  this._scriptPath = argv[1];
25207
25207
  userArgs = argv.slice(2);
25208
25208
  } else userArgs = argv.slice(1);
@@ -25367,16 +25367,16 @@ Expecting one of '${allowedValues.join("', '")}'`);
25367
25367
  }
25368
25368
  launchWithNode = sourceExt.includes(path$16.extname(executableFile));
25369
25369
  let proc;
25370
- if (process$3.platform !== "win32") if (launchWithNode) {
25370
+ if (process$2.platform !== "win32") if (launchWithNode) {
25371
25371
  args.unshift(executableFile);
25372
- args = incrementNodeInspectorPort(process$3.execArgv).concat(args);
25373
- proc = childProcess$2.spawn(process$3.argv[0], args, { stdio: "inherit" });
25372
+ args = incrementNodeInspectorPort(process$2.execArgv).concat(args);
25373
+ proc = childProcess$2.spawn(process$2.argv[0], args, { stdio: "inherit" });
25374
25374
  } else proc = childProcess$2.spawn(executableFile, args, { stdio: "inherit" });
25375
25375
  else {
25376
25376
  this._checkForMissingExecutable(executableFile, executableDir, subcommand._name);
25377
25377
  args.unshift(executableFile);
25378
- args = incrementNodeInspectorPort(process$3.execArgv).concat(args);
25379
- proc = childProcess$2.spawn(process$3.execPath, args, { stdio: "inherit" });
25378
+ args = incrementNodeInspectorPort(process$2.execArgv).concat(args);
25379
+ proc = childProcess$2.spawn(process$2.execPath, args, { stdio: "inherit" });
25380
25380
  }
25381
25381
  if (!proc.killed) [
25382
25382
  "SIGUSR1",
@@ -25385,20 +25385,20 @@ Expecting one of '${allowedValues.join("', '")}'`);
25385
25385
  "SIGINT",
25386
25386
  "SIGHUP"
25387
25387
  ].forEach((signal) => {
25388
- process$3.on(signal, () => {
25388
+ process$2.on(signal, () => {
25389
25389
  if (proc.killed === false && proc.exitCode === null) proc.kill(signal);
25390
25390
  });
25391
25391
  });
25392
25392
  const exitCallback = this._exitCallback;
25393
25393
  proc.on("close", (code) => {
25394
25394
  code = code ?? 1;
25395
- if (!exitCallback) process$3.exit(code);
25395
+ if (!exitCallback) process$2.exit(code);
25396
25396
  else exitCallback(new CommanderError(code, "commander.executeSubCommandAsync", "(close)"));
25397
25397
  });
25398
25398
  proc.on("error", (err) => {
25399
25399
  if (err.code === "ENOENT") this._checkForMissingExecutable(executableFile, executableDir, subcommand._name);
25400
25400
  else if (err.code === "EACCES") throw new Error(`'${executableFile}' not executable`);
25401
- if (!exitCallback) process$3.exit(1);
25401
+ if (!exitCallback) process$2.exit(1);
25402
25402
  else {
25403
25403
  const wrappedError = new CommanderError(1, "commander.executeSubCommandAsync", "(error)");
25404
25404
  wrappedError.nestedError = err;
@@ -25807,13 +25807,13 @@ Expecting one of '${allowedValues.join("', '")}'`);
25807
25807
  */
25808
25808
  _parseOptionsEnv() {
25809
25809
  this.options.forEach((option) => {
25810
- if (option.envVar && option.envVar in process$3.env) {
25810
+ if (option.envVar && option.envVar in process$2.env) {
25811
25811
  const optionKey = option.attributeName();
25812
25812
  if (this.getOptionValue(optionKey) === void 0 || [
25813
25813
  "default",
25814
25814
  "config",
25815
25815
  "env"
25816
- ].includes(this.getOptionValueSource(optionKey))) if (option.required || option.optional) this.emit(`optionEnv:${option.name()}`, process$3.env[option.envVar]);
25816
+ ].includes(this.getOptionValueSource(optionKey))) if (option.required || option.optional) this.emit(`optionEnv:${option.name()}`, process$2.env[option.envVar]);
25817
25817
  else this.emit(`optionEnv:${option.name()}`);
25818
25818
  }
25819
25819
  });
@@ -26230,7 +26230,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
26230
26230
  */
26231
26231
  help(contextOptions) {
26232
26232
  this.outputHelp(contextOptions);
26233
- let exitCode = Number(process$3.exitCode ?? 0);
26233
+ let exitCode = Number(process$2.exitCode ?? 0);
26234
26234
  if (exitCode === 0 && contextOptions && typeof contextOptions !== "function" && contextOptions.error) exitCode = 1;
26235
26235
  this._exit(exitCode, "commander.help", "(outputHelp)");
26236
26236
  }
@@ -26320,8 +26320,8 @@ Expecting one of '${allowedValues.join("', '")}'`);
26320
26320
  * @package
26321
26321
  */
26322
26322
  function useColor() {
26323
- if (process$3.env.NO_COLOR || process$3.env.FORCE_COLOR === "0" || process$3.env.FORCE_COLOR === "false") return false;
26324
- if (process$3.env.FORCE_COLOR || process$3.env.CLICOLOR_FORCE !== void 0) return true;
26323
+ if (process$2.env.NO_COLOR || process$2.env.FORCE_COLOR === "0" || process$2.env.FORCE_COLOR === "false") return false;
26324
+ if (process$2.env.FORCE_COLOR || process$2.env.CLICOLOR_FORCE !== void 0) return true;
26325
26325
  }
26326
26326
  exports.Command = Command;
26327
26327
  exports.useColor = useColor;
@@ -80854,6 +80854,14 @@ const normalizeCreditText = (value) => {
80854
80854
  if (typeof value !== "string") return null;
80855
80855
  return value.trim() || null;
80856
80856
  };
80857
+ const mapRpcCredits = (raw) => {
80858
+ const balance = normalizeCreditText(raw?.balance);
80859
+ const unlimited = raw?.unlimited === true;
80860
+ return balance === null && !unlimited ? void 0 : {
80861
+ balance,
80862
+ unlimited
80863
+ };
80864
+ };
80857
80865
  const mapRpcResetCredit = (credit) => ({
80858
80866
  expiresAt: parseCreditTimestamp(credit.expiresAt),
80859
80867
  grantedAt: parseCreditTimestamp(credit.grantedAt),
@@ -81102,6 +81110,7 @@ const fetchViaRpc = async (options, auth) => {
81102
81110
  });
81103
81111
  const rateLimits = mapRpcRateLimits(wrapper);
81104
81112
  const defaultRateLimit = rateLimits.find(({ limitId }) => limitId.toLowerCase() === "codex") ?? rateLimits[0];
81113
+ const credits = mapRpcCredits(wrapper.rateLimitsByLimitId?.codex?.credits) ?? mapRpcCredits(wrapper.rateLimits?.credits);
81105
81114
  const rateLimitResetCredits = mapRpcResetCredits(wrapper?.rateLimitResetCredits);
81106
81115
  let backendCredits = null;
81107
81116
  if (options.includeResetCredits !== false && auth && rateLimitResetCredits?.credits === void 0) try {
@@ -81111,6 +81120,7 @@ const fetchViaRpc = async (options, auth) => {
81111
81120
  }
81112
81121
  const updatedAt = Date.now();
81113
81122
  return {
81123
+ credits,
81114
81124
  error: null,
81115
81125
  readings: codexQuotaReadings(rateLimits, updatedAt),
81116
81126
  provider: "codex",
@@ -338889,7 +338899,7 @@ var stdio_exports = /* @__PURE__ */ __exportAll$2({
338889
338899
  function getDefaultEnvironment() {
338890
338900
  const env = {};
338891
338901
  for (const key of DEFAULT_INHERITED_ENV_VARS) {
338892
- const value = process$1.env[key];
338902
+ const value = _w.env[key];
338893
338903
  if (value === void 0) continue;
338894
338904
  if (value.startsWith("()")) continue;
338895
338905
  env[key] = value;
@@ -338900,7 +338910,7 @@ var import_cross_spawn$1, DEFAULT_INHERITED_ENV_VARS, StdioClientTransport;
338900
338910
  var init_stdio = __esmMin((() => {
338901
338911
  init_src_CeKsbNLO();
338902
338912
  import_cross_spawn$1 = /* @__PURE__ */ __toESM$2(require_cross_spawn(), 1);
338903
- DEFAULT_INHERITED_ENV_VARS = process$1.platform === "win32" ? [
338913
+ DEFAULT_INHERITED_ENV_VARS = _w.platform === "win32" ? [
338904
338914
  "APPDATA",
338905
338915
  "COMSPEC",
338906
338916
  "HOMEDRIVE",
@@ -338957,7 +338967,7 @@ var init_stdio = __esmMin((() => {
338957
338967
  this._serverParams.stderr ?? "inherit"
338958
338968
  ],
338959
338969
  shell: false,
338960
- windowsHide: process$1.platform === "win32",
338970
+ windowsHide: _w.platform === "win32",
338961
338971
  cwd: this._serverParams.cwd
338962
338972
  });
338963
338973
  this._process.on("error", (error) => {
@@ -341008,9 +341018,9 @@ const getSubprocessResult = ({ stdout }) => {
341008
341018
  //#region node_modules/.pnpm/execa@9.6.1/node_modules/execa/lib/utils/standard-stream.js
341009
341019
  const isStandardStream = (stream) => STANDARD_STREAMS.includes(stream);
341010
341020
  const STANDARD_STREAMS = [
341011
- process$1.stdin,
341012
- process$1.stdout,
341013
- process$1.stderr
341021
+ _w.stdin,
341022
+ _w.stdout,
341023
+ _w.stderr
341014
341024
  ];
341015
341025
  const STANDARD_STREAMS_ALIASES = [
341016
341026
  "stdin",
@@ -341135,9 +341145,9 @@ const NO_ESCAPE_REGEXP = /^[\w./-]+$/;
341135
341145
  //#endregion
341136
341146
  //#region node_modules/.pnpm/is-unicode-supported@2.1.0/node_modules/is-unicode-supported/index.js
341137
341147
  function isUnicodeSupported() {
341138
- const { env } = process$1;
341148
+ const { env } = _w;
341139
341149
  const { TERM, TERM_PROGRAM } = env;
341140
- if (process$1.platform !== "win32") return TERM !== "linux";
341150
+ if (_w.platform !== "win32") return TERM !== "linux";
341141
341151
  return Boolean(env.WT_SESSION) || Boolean(env.TERMINUS_SUBLIME) || env.ConEmuTask === "{cmd::Cmder}" || TERM_PROGRAM === "Terminus-Sublime" || TERM_PROGRAM === "vscode" || TERM === "xterm-256color" || TERM === "alacritty" || TERM === "rxvt-unicode" || TERM === "rxvt-unicode-256color" || env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
341142
341152
  }
341143
341153
 
@@ -341672,7 +341682,7 @@ function traversePathUp(startPath) {
341672
341682
 
341673
341683
  //#endregion
341674
341684
  //#region node_modules/.pnpm/npm-run-path@6.0.0/node_modules/npm-run-path/index.js
341675
- const npmRunPath = ({ cwd = process$1.cwd(), path: pathOption = process$1.env[pathKey()], preferLocal = true, execPath = process$1.execPath, addExecPath = true } = {}) => {
341685
+ const npmRunPath = ({ cwd = _w.cwd(), path: pathOption = _w.env[pathKey()], preferLocal = true, execPath = _w.execPath, addExecPath = true } = {}) => {
341676
341686
  const cwdPath = path.resolve(toPath(cwd));
341677
341687
  const result = [];
341678
341688
  const pathParts = pathOption.split(path.delimiter);
@@ -341690,7 +341700,7 @@ const applyExecPath = (result, pathParts, execPath, cwdPath) => {
341690
341700
  const pathPart = path.resolve(cwdPath, toPath(execPath), "..");
341691
341701
  if (!pathParts.includes(pathPart)) result.push(pathPart);
341692
341702
  };
341693
- const npmRunPathEnv = ({ env = process$1.env, ...options } = {}) => {
341703
+ const npmRunPathEnv = ({ env = _w.env, ...options } = {}) => {
341694
341704
  env = { ...env };
341695
341705
  const pathName = pathKey({ env });
341696
341706
  options.path = env[pathName];
@@ -342825,7 +342835,7 @@ const normalizeCwd = (cwd = getDefaultCwd()) => {
342825
342835
  };
342826
342836
  const getDefaultCwd = () => {
342827
342837
  try {
342828
- return process$1.cwd();
342838
+ return _w.cwd();
342829
342839
  } catch (error) {
342830
342840
  error.message = `The current directory does not exist.\n${error.message}`;
342831
342841
  throw error;
@@ -342861,7 +342871,7 @@ const normalizeOptions = (filePath, rawArguments, rawOptions) => {
342861
342871
  options.killSignal = normalizeKillSignal(options.killSignal);
342862
342872
  options.forceKillAfterDelay = normalizeForceKillAfterDelay(options.forceKillAfterDelay);
342863
342873
  options.lines = options.lines.map((lines, fdNumber) => lines && !BINARY_ENCODINGS.has(options.encoding) && options.buffer[fdNumber]);
342864
- if (process$1.platform === "win32" && path.basename(file, ".exe") === "cmd") commandArguments.unshift("/q");
342874
+ if (_w.platform === "win32" && path.basename(file, ".exe") === "cmd") commandArguments.unshift("/q");
342865
342875
  return {
342866
342876
  file,
342867
342877
  commandArguments,
@@ -342888,7 +342898,7 @@ const addDefaultOptions = ({ extendEnv = true, preferLocal = false, cwd, localDi
342888
342898
  });
342889
342899
  const getEnv = ({ env: envOption, extendEnv, preferLocal, node, localDirectory, nodePath }) => {
342890
342900
  const env = extendEnv ? {
342891
- ...process$1.env,
342901
+ ..._w.env,
342892
342902
  ...envOption
342893
342903
  } : envOption;
342894
342904
  if (preferLocal || node) return npmRunPathEnv({
@@ -343890,12 +343900,12 @@ const guessStreamDirection = {
343890
343900
  }
343891
343901
  };
343892
343902
  const getStandardStreamDirection = (value) => {
343893
- if ([0, process$1.stdin].includes(value)) return "input";
343903
+ if ([0, _w.stdin].includes(value)) return "input";
343894
343904
  if ([
343895
343905
  1,
343896
343906
  2,
343897
- process$1.stdout,
343898
- process$1.stderr
343907
+ _w.stdout,
343908
+ _w.stderr
343899
343909
  ].includes(value)) return "output";
343900
343910
  };
343901
343911
  const DEFAULT_DIRECTION = "output";
@@ -344959,9 +344969,9 @@ const addIpcMethods = (subprocess, { ipc }) => {
344959
344969
  Object.assign(subprocess, getIpcMethods(subprocess, false, ipc));
344960
344970
  };
344961
344971
  const getIpcExport = () => {
344962
- const anyProcess = process$1;
344972
+ const anyProcess = _w;
344963
344973
  const isSubprocess = true;
344964
- const ipc = process$1.channel !== void 0;
344974
+ const ipc = _w.channel !== void 0;
344965
344975
  return {
344966
344976
  ...getIpcMethods(anyProcess, isSubprocess, ipc),
344967
344977
  getCancelSignal: getCancelSignal$1.bind(void 0, {
@@ -345438,7 +345448,7 @@ var SignalExitFallback = class extends SignalExitBase {
345438
345448
  };
345439
345449
  var SignalExit = class extends SignalExitBase {
345440
345450
  /* c8 ignore start */
345441
- #hupSig = process$2.platform === "win32" ? "SIGINT" : "SIGHUP";
345451
+ #hupSig = process$1.platform === "win32" ? "SIGINT" : "SIGHUP";
345442
345452
  /* c8 ignore stop */
345443
345453
  #emitter = new Emitter();
345444
345454
  #process;
@@ -345533,8 +345543,8 @@ var SignalExit = class extends SignalExitBase {
345533
345543
  } else return og.call(this.#process, ev, ...args);
345534
345544
  }
345535
345545
  };
345536
- const process$2 = globalThis.process;
345537
- const { onExit, load: load$1, unload } = signalExitWrap(processOk(process$2) ? new SignalExit(process$2) : new SignalExitFallback());
345546
+ const process$1 = globalThis.process;
345547
+ const { onExit, load: load$1, unload } = signalExitWrap(processOk(process$1) ? new SignalExit(process$1) : new SignalExitFallback());
345538
345548
 
345539
345549
  //#endregion
345540
345550
  //#region node_modules/.pnpm/execa@9.6.1/node_modules/execa/lib/terminate/cleanup.js
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.213" "User Commands"
3
+ .TH LH 1 "" "@lobehub/cli 0.0.215" "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.213",
3
+ "version": "0.0.215",
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": "7c10840d8a18ac2d08429e17c27fb5cbf56cd8d9"
86
+ "gitHead": "f604751aa88322e6d714302d1b79bccf108f038f"
87
87
  }