@kevisual/cli 0.1.6 → 0.1.7

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/envision.js CHANGED
@@ -10268,7 +10268,7 @@ var require_queue = __commonJS((exports, module) => {
10268
10268
  if (!(_concurrency >= 1)) {
10269
10269
  throw new Error("fastqueue concurrency must be equal to or greater than 1");
10270
10270
  }
10271
- var cache = reusify(Task);
10271
+ var cache2 = reusify(Task);
10272
10272
  var queueHead = null;
10273
10273
  var queueTail = null;
10274
10274
  var _running = 0;
@@ -10348,7 +10348,7 @@ var require_queue = __commonJS((exports, module) => {
10348
10348
  return _running === 0 && self2.length() === 0;
10349
10349
  }
10350
10350
  function push(value, done) {
10351
- var current = cache.get();
10351
+ var current = cache2.get();
10352
10352
  current.context = context;
10353
10353
  current.release = release;
10354
10354
  current.value = value;
@@ -10369,7 +10369,7 @@ var require_queue = __commonJS((exports, module) => {
10369
10369
  }
10370
10370
  }
10371
10371
  function unshift(value, done) {
10372
- var current = cache.get();
10372
+ var current = cache2.get();
10373
10373
  current.context = context;
10374
10374
  current.release = release;
10375
10375
  current.value = value;
@@ -10391,7 +10391,7 @@ var require_queue = __commonJS((exports, module) => {
10391
10391
  }
10392
10392
  function release(holder) {
10393
10393
  if (holder) {
10394
- cache.release(holder);
10394
+ cache2.release(holder);
10395
10395
  }
10396
10396
  var next = queueHead;
10397
10397
  if (next && _running <= _concurrency) {
@@ -22312,8 +22312,8 @@ InitEnv.init();
22312
22312
  var version = useContextKey("version", () => {
22313
22313
  let version2 = "0.0.64";
22314
22314
  try {
22315
- if ("0.1.6")
22316
- version2 = "0.1.6";
22315
+ if ("0.1.7")
22316
+ version2 = "0.1.7";
22317
22317
  } catch (e) {}
22318
22318
  return version2;
22319
22319
  });
@@ -23430,14 +23430,14 @@ var getEnvToken = () => {
23430
23430
  return envTokne;
23431
23431
  };
23432
23432
 
23433
- // node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.2.3/node_modules/@inquirer/core/dist/lib/key.js
23433
+ // node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/key.js
23434
23434
  var isUpKey = (key, keybindings = []) => key.name === "up" || keybindings.includes("vim") && key.name === "k" || keybindings.includes("emacs") && key.ctrl && key.name === "p";
23435
23435
  var isDownKey = (key, keybindings = []) => key.name === "down" || keybindings.includes("vim") && key.name === "j" || keybindings.includes("emacs") && key.ctrl && key.name === "n";
23436
23436
  var isBackspaceKey = (key) => key.name === "backspace";
23437
23437
  var isTabKey = (key) => key.name === "tab";
23438
23438
  var isNumberKey = (key) => "1234567890".includes(key.name);
23439
23439
  var isEnterKey = (key) => key.name === "enter" || key.name === "return";
23440
- // node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.2.3/node_modules/@inquirer/core/dist/lib/errors.js
23440
+ // node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/errors.js
23441
23441
  class AbortPromptError extends Error {
23442
23442
  name = "AbortPromptError";
23443
23443
  message = "Prompt was aborted";
@@ -23463,10 +23463,10 @@ class HookError extends Error {
23463
23463
  class ValidationError extends Error {
23464
23464
  name = "ValidationError";
23465
23465
  }
23466
- // node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.2.3/node_modules/@inquirer/core/dist/lib/use-state.js
23466
+ // node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/use-state.js
23467
23467
  import { AsyncResource as AsyncResource2 } from "node:async_hooks";
23468
23468
 
23469
- // node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.2.3/node_modules/@inquirer/core/dist/lib/hook-engine.js
23469
+ // node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/hook-engine.js
23470
23470
  import { AsyncLocalStorage, AsyncResource } from "node:async_hooks";
23471
23471
  var hookStorage = new AsyncLocalStorage;
23472
23472
  function createStore(rl) {
@@ -23571,7 +23571,7 @@ var effectScheduler = {
23571
23571
  }
23572
23572
  };
23573
23573
 
23574
- // node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.2.3/node_modules/@inquirer/core/dist/lib/use-state.js
23574
+ // node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/use-state.js
23575
23575
  function useState(defaultValue) {
23576
23576
  return withPointer((pointer) => {
23577
23577
  const setState = AsyncResource2.bind(function setState2(newValue) {
@@ -23589,7 +23589,7 @@ function useState(defaultValue) {
23589
23589
  });
23590
23590
  }
23591
23591
 
23592
- // node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.2.3/node_modules/@inquirer/core/dist/lib/use-effect.js
23592
+ // node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/use-effect.js
23593
23593
  function useEffect(cb, depArray) {
23594
23594
  withPointer((pointer) => {
23595
23595
  const oldDeps = pointer.get();
@@ -23601,7 +23601,7 @@ function useEffect(cb, depArray) {
23601
23601
  });
23602
23602
  }
23603
23603
 
23604
- // node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.2.3/node_modules/@inquirer/core/dist/lib/theme.js
23604
+ // node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/theme.js
23605
23605
  import { styleText } from "node:util";
23606
23606
 
23607
23607
  // node_modules/.pnpm/@inquirer+figures@2.0.3/node_modules/@inquirer/figures/dist/index.js
@@ -23893,7 +23893,7 @@ var figures = shouldUseMain ? mainSymbols : fallbackSymbols;
23893
23893
  var dist_default = figures;
23894
23894
  var replacements = Object.entries(specialMainSymbols);
23895
23895
 
23896
- // node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.2.3/node_modules/@inquirer/core/dist/lib/theme.js
23896
+ // node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/theme.js
23897
23897
  var defaultTheme = {
23898
23898
  prefix: {
23899
23899
  idle: styleText("blue", "?"),
@@ -23914,7 +23914,7 @@ var defaultTheme = {
23914
23914
  }
23915
23915
  };
23916
23916
 
23917
- // node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.2.3/node_modules/@inquirer/core/dist/lib/make-theme.js
23917
+ // node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/make-theme.js
23918
23918
  function isPlainObject(value) {
23919
23919
  if (typeof value !== "object" || value === null)
23920
23920
  return false;
@@ -23942,7 +23942,7 @@ function makeTheme(...themes) {
23942
23942
  return deepMerge(...themesToMerge);
23943
23943
  }
23944
23944
 
23945
- // node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.2.3/node_modules/@inquirer/core/dist/lib/use-prefix.js
23945
+ // node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/use-prefix.js
23946
23946
  function usePrefix({ status = "idle", theme }) {
23947
23947
  const [showLoader, setShowLoader] = useState(false);
23948
23948
  const [tick, setTick] = useState(0);
@@ -23972,7 +23972,7 @@ function usePrefix({ status = "idle", theme }) {
23972
23972
  const iconName = status === "loading" ? "idle" : status;
23973
23973
  return typeof prefix === "string" ? prefix : prefix[iconName] ?? prefix["idle"];
23974
23974
  }
23975
- // node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.2.3/node_modules/@inquirer/core/dist/lib/use-memo.js
23975
+ // node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/use-memo.js
23976
23976
  function useMemo(fn, dependencies) {
23977
23977
  return withPointer((pointer) => {
23978
23978
  const prev = pointer.get();
@@ -23984,11 +23984,11 @@ function useMemo(fn, dependencies) {
23984
23984
  return prev.value;
23985
23985
  });
23986
23986
  }
23987
- // node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.2.3/node_modules/@inquirer/core/dist/lib/use-ref.js
23987
+ // node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/use-ref.js
23988
23988
  function useRef(val) {
23989
23989
  return useState({ current: val })[0];
23990
23990
  }
23991
- // node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.2.3/node_modules/@inquirer/core/dist/lib/use-keypress.js
23991
+ // node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/use-keypress.js
23992
23992
  function useKeypress(userHandler) {
23993
23993
  const signal = useRef(userHandler);
23994
23994
  signal.current = userHandler;
@@ -24006,7 +24006,7 @@ function useKeypress(userHandler) {
24006
24006
  };
24007
24007
  }, []);
24008
24008
  }
24009
- // node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.2.3/node_modules/@inquirer/core/dist/lib/utils.js
24009
+ // node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/utils.js
24010
24010
  var import_cli_width = __toESM(require_cli_width(), 1);
24011
24011
 
24012
24012
  // node_modules/.pnpm/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/utils.js
@@ -24350,7 +24350,7 @@ function wrapAnsi(string, columns, options) {
24350
24350
  `);
24351
24351
  }
24352
24352
 
24353
- // node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.2.3/node_modules/@inquirer/core/dist/lib/utils.js
24353
+ // node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/utils.js
24354
24354
  function breakLines(content, width) {
24355
24355
  return content.split(`
24356
24356
  `).flatMap((line) => wrapAnsi(line, width, { trim: false, hard: true }).split(`
@@ -24361,7 +24361,7 @@ function readlineWidth() {
24361
24361
  return import_cli_width.default({ defaultWidth: 80, output: readline().output });
24362
24362
  }
24363
24363
 
24364
- // node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.2.3/node_modules/@inquirer/core/dist/lib/pagination/use-pagination.js
24364
+ // node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/pagination/use-pagination.js
24365
24365
  function usePointerPosition({ active, renderedItems, pageSize, loop }) {
24366
24366
  const state = useRef({
24367
24367
  lastPointer: active,
@@ -24427,7 +24427,7 @@ function usePagination({ items, active, renderItem, pageSize, loop = true }) {
24427
24427
  return pageBuffer.filter((line) => typeof line === "string").join(`
24428
24428
  `);
24429
24429
  }
24430
- // node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.2.3/node_modules/@inquirer/core/dist/lib/create-prompt.js
24430
+ // node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/create-prompt.js
24431
24431
  var import_mute_stream = __toESM(require_lib(), 1);
24432
24432
  import * as readline2 from "node:readline";
24433
24433
  import { AsyncResource as AsyncResource3 } from "node:async_hooks";
@@ -24640,7 +24640,7 @@ var {
24640
24640
  unload
24641
24641
  } = signalExitWrap(processOk(process3) ? new SignalExit(process3) : new SignalExitFallback);
24642
24642
 
24643
- // node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.2.3/node_modules/@inquirer/core/dist/lib/screen-manager.js
24643
+ // node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/screen-manager.js
24644
24644
  import { stripVTControlCharacters } from "node:util";
24645
24645
 
24646
24646
  // node_modules/.pnpm/@inquirer+ansi@2.0.3/node_modules/@inquirer/ansi/dist/index.js
@@ -24659,7 +24659,7 @@ var cursorTo = (x, y) => {
24659
24659
  var eraseLine = ESC2 + "2K";
24660
24660
  var eraseLines = (lines) => lines > 0 ? (eraseLine + cursorUp(1)).repeat(lines - 1) + eraseLine + cursorLeft : "";
24661
24661
 
24662
- // node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.2.3/node_modules/@inquirer/core/dist/lib/screen-manager.js
24662
+ // node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/screen-manager.js
24663
24663
  var height = (content) => content.split(`
24664
24664
  `).length;
24665
24665
  var lastLine = (content) => content.split(`
@@ -24724,7 +24724,7 @@ class ScreenManager {
24724
24724
  }
24725
24725
  }
24726
24726
 
24727
- // node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.2.3/node_modules/@inquirer/core/dist/lib/promise-polyfill.js
24727
+ // node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/promise-polyfill.js
24728
24728
  class PromisePolyfill extends Promise {
24729
24729
  static withResolver() {
24730
24730
  let resolve;
@@ -24737,7 +24737,7 @@ class PromisePolyfill extends Promise {
24737
24737
  }
24738
24738
  }
24739
24739
 
24740
- // node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.2.3/node_modules/@inquirer/core/dist/lib/create-prompt.js
24740
+ // node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/create-prompt.js
24741
24741
  function getCallSites() {
24742
24742
  const _prepareStackTrace = Error.prepareStackTrace;
24743
24743
  let result = [];
@@ -24823,7 +24823,7 @@ function createPrompt(view) {
24823
24823
  };
24824
24824
  return prompt;
24825
24825
  }
24826
- // node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.2.3/node_modules/@inquirer/core/dist/lib/Separator.js
24826
+ // node_modules/.pnpm/@inquirer+core@11.1.3_@types+node@25.3.0/node_modules/@inquirer/core/dist/lib/Separator.js
24827
24827
  import { styleText as styleText2 } from "node:util";
24828
24828
  class Separator {
24829
24829
  separator = styleText2("dim", Array.from({ length: 15 }).join(dist_default.line));
@@ -24837,7 +24837,7 @@ class Separator {
24837
24837
  return Boolean(choice && typeof choice === "object" && "type" in choice && choice.type === "separator");
24838
24838
  }
24839
24839
  }
24840
- // node_modules/.pnpm/@inquirer+confirm@6.0.6_@types+node@25.2.3/node_modules/@inquirer/confirm/dist/index.js
24840
+ // node_modules/.pnpm/@inquirer+confirm@6.0.6_@types+node@25.3.0/node_modules/@inquirer/confirm/dist/index.js
24841
24841
  function getBooleanValue(value, defaultValue) {
24842
24842
  let answer = defaultValue !== false;
24843
24843
  if (/^(y|yes)/i.test(value))
@@ -24882,7 +24882,7 @@ var dist_default4 = createPrompt((config, done) => {
24882
24882
  const message = theme.style.message(config.message, status);
24883
24883
  return `${prefix} ${message}${defaultValue} ${formattedValue}`;
24884
24884
  });
24885
- // node_modules/.pnpm/@inquirer+input@5.0.6_@types+node@25.2.3/node_modules/@inquirer/input/dist/index.js
24885
+ // node_modules/.pnpm/@inquirer+input@5.0.6_@types+node@25.3.0/node_modules/@inquirer/input/dist/index.js
24886
24886
  var inputTheme = {
24887
24887
  validationFailureMode: "keep"
24888
24888
  };
@@ -24966,7 +24966,7 @@ var dist_default5 = createPrompt((config, done) => {
24966
24966
  error
24967
24967
  ];
24968
24968
  });
24969
- // node_modules/.pnpm/@inquirer+select@5.0.6_@types+node@25.2.3/node_modules/@inquirer/select/dist/index.js
24969
+ // node_modules/.pnpm/@inquirer+select@5.0.6_@types+node@25.3.0/node_modules/@inquirer/select/dist/index.js
24970
24970
  import { styleText as styleText3 } from "node:util";
24971
24971
  var selectTheme = {
24972
24972
  icon: { cursor: dist_default.pointer },
@@ -25727,7 +25727,7 @@ class BaseQuery {
25727
25727
  }
25728
25728
  }
25729
25729
 
25730
- // node_modules/.pnpm/@kevisual+api@0.0.52_@types+react@19.2.10_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@kevisual/api/query/query-login/login-cache.ts
25730
+ // node_modules/.pnpm/@kevisual+api@0.0.55_@types+react@19.2.10_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@kevisual/api/query/query-login/login-cache.ts
25731
25731
  class LoginCacheStore {
25732
25732
  cache;
25733
25733
  name;
@@ -26277,7 +26277,7 @@ class BaseLoad3 {
26277
26277
  }
26278
26278
  }
26279
26279
 
26280
- // node_modules/.pnpm/@kevisual+api@0.0.52_@types+react@19.2.10_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@kevisual/api/query/query-login/query-login.ts
26280
+ // node_modules/.pnpm/@kevisual+api@0.0.55_@types+react@19.2.10_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@kevisual/api/query/query-login/query-login.ts
26281
26281
  class QueryLogin extends BaseQuery {
26282
26282
  cacheStore;
26283
26283
  isBrowser;
@@ -26293,6 +26293,9 @@ class QueryLogin extends BaseQuery {
26293
26293
  this.init();
26294
26294
  this.onLoad = opts?.onLoad;
26295
26295
  this.storage = opts?.storage || globalThis?.localStorage;
26296
+ if (!this.storage) {
26297
+ throw new Error("storage is required");
26298
+ }
26296
26299
  }
26297
26300
  setQuery(query) {
26298
26301
  this.query = query;
@@ -26612,22 +26615,21 @@ class QueryLogin extends BaseQuery {
26612
26615
  }
26613
26616
  }
26614
26617
 
26615
- // node_modules/.pnpm/@kevisual+api@0.0.52_@types+react@19.2.10_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@kevisual/api/query/query-login/login-node-cache.ts
26618
+ // node_modules/.pnpm/@kevisual+api@0.0.55_@types+react@19.2.10_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@kevisual/api/query/query-login/login-node-cache.ts
26616
26619
  import { homedir } from "node:os";
26617
26620
  import { join, dirname } from "node:path";
26618
26621
  import fs4 from "node:fs";
26619
- import { readFileSync, writeFileSync, accessSync } from "node:fs";
26620
- import { readFile, writeFile, unlink, mkdir } from "node:fs/promises";
26621
- var fileExists = async (filePath, { createIfNotExists = true, isFile = true, isDir = false } = {}) => {
26622
+ import { readFileSync, writeFileSync, accessSync, unlinkSync, mkdirSync } from "node:fs";
26623
+ var fileExists = (filePath, { createIfNotExists = true, isFile = true, isDir = false } = {}) => {
26622
26624
  try {
26623
26625
  accessSync(filePath, fs4.constants.F_OK);
26624
26626
  return true;
26625
26627
  } catch (error) {
26626
26628
  if (createIfNotExists && isDir) {
26627
- await mkdir(filePath, { recursive: true });
26629
+ mkdirSync(filePath, { recursive: true });
26628
26630
  return true;
26629
26631
  } else if (createIfNotExists && isFile) {
26630
- await mkdir(dirname(filePath), { recursive: true });
26632
+ mkdirSync(dirname(filePath), { recursive: true });
26631
26633
  return false;
26632
26634
  }
26633
26635
  return false;
@@ -26645,33 +26647,45 @@ var readConfigFile = (filePath) => {
26645
26647
  var writeConfigFile = (filePath, data) => {
26646
26648
  writeFileSync(filePath, JSON.stringify(data, null, 2));
26647
26649
  };
26648
- var getHostName = () => {
26650
+ var getHostName = (baseURL) => {
26649
26651
  const configDir = join(homedir(), ".config", "envision");
26650
26652
  const configFile = join(configDir, "config.json");
26651
26653
  const config = readConfigFile(configFile);
26652
- const baseURL = config.baseURL || "https://kevisual.cn";
26653
- const hostname = new URL(baseURL).hostname;
26654
+ const _baseURL = baseURL || config.baseURL || "https://kevisual.cn";
26655
+ const hostname = new URL(_baseURL).hostname;
26654
26656
  return hostname;
26655
26657
  };
26656
26658
 
26657
26659
  class StorageNode {
26658
26660
  cacheData;
26659
- filePath;
26660
- constructor() {
26661
+ filePath = "";
26662
+ hostname = "";
26663
+ constructor(opts) {
26661
26664
  this.cacheData = {};
26665
+ const hostname = getHostName(opts?.baseURL);
26666
+ this.setHostName(hostname, { load: opts?.load });
26667
+ }
26668
+ setHostName(hostname, opts) {
26669
+ const load2 = opts?.load ?? false;
26670
+ if (hostname.startsWith("http")) {
26671
+ hostname = new URL(hostname).hostname;
26672
+ }
26662
26673
  const configDir = join(homedir(), ".config", "envision");
26663
- const hostname = getHostName();
26664
26674
  this.filePath = join(configDir, "config", `${hostname}-storage.json`);
26675
+ this.hostname = hostname;
26665
26676
  fileExists(this.filePath, { isFile: true });
26677
+ if (load2) {
26678
+ this.loadCache();
26679
+ }
26666
26680
  }
26667
- async loadCache() {
26681
+ loadCache() {
26668
26682
  const filePath = this.filePath;
26669
26683
  try {
26670
- const data = await readConfigFile(filePath);
26684
+ const data = readConfigFile(filePath);
26671
26685
  this.cacheData = data;
26672
26686
  } catch (error) {
26673
26687
  this.cacheData = {};
26674
- await writeFile(filePath, JSON.stringify(this.cacheData, null, 2));
26688
+ writeFileSync(filePath, JSON.stringify(this.cacheData, null, 2));
26675
26689
  }
26676
26690
  }
26677
26691
  get length() {
@@ -26682,15 +26696,15 @@ class StorageNode {
26682
26696
  }
26683
26697
  setItem(key, value) {
26684
26698
  this.cacheData[key] = value;
26685
- writeFile(this.filePath, JSON.stringify(this.cacheData, null, 2));
26699
+ writeFileSync(this.filePath, JSON.stringify(this.cacheData, null, 2));
26686
26700
  }
26687
26701
  removeItem(key) {
26688
26702
  delete this.cacheData[key];
26689
- writeFile(this.filePath, JSON.stringify(this.cacheData, null, 2));
26703
+ writeFileSync(this.filePath, JSON.stringify(this.cacheData, null, 2));
26690
26704
  }
26691
26705
  clear() {
26692
26706
  this.cacheData = {};
26693
- writeFile(this.filePath, JSON.stringify(this.cacheData, null, 2));
26707
+ writeFileSync(this.filePath, JSON.stringify(this.cacheData, null, 2));
26694
26708
  }
26695
26709
  key(index) {
26696
26710
  return Object.keys(this.cacheData)[index];
@@ -26699,9 +26713,12 @@ class StorageNode {
26699
26713
 
26700
26714
  class LoginNodeCache {
26701
26715
  filepath;
26702
- constructor(filepath) {
26703
- this.filepath = filepath || join(homedir(), ".config", "envision", "config", `${getHostName()}-login.json`);
26716
+ constructor(opts) {
26717
+ this.filepath = join(homedir(), ".config", "envision", "config", `${getHostName(opts?.baseURL)}-login.json`);
26704
26718
  fileExists(this.filepath, { isFile: true });
26719
+ if (opts?.load) {
26720
+ this.loadCache(this.filepath);
26721
+ }
26705
26722
  }
26706
26723
  async get(_key) {
26707
26724
  try {
@@ -26723,11 +26740,11 @@ class LoginNodeCache {
26723
26740
  }
26724
26741
  }
26725
26742
  async del() {
26726
- await unlink(this.filepath);
26743
+ unlinkSync(this.filepath);
26727
26744
  }
26728
- async loadCache(filePath) {
26745
+ loadCache(filePath) {
26729
26746
  try {
26730
- const data = await readFile(filePath, "utf-8");
26747
+ const data = readFileSync(filePath, "utf-8");
26731
26748
  const jsonData = JSON.parse(data);
26732
26749
  return jsonData;
26733
26750
  } catch (error) {
@@ -26737,21 +26754,24 @@ class LoginNodeCache {
26737
26754
  return defaultData;
26738
26755
  }
26739
26756
  }
26740
- async init() {
26741
- return await this.loadCache(this.filepath);
26757
+ init() {
26758
+ return this.loadCache(this.filepath);
26742
26759
  }
26743
26760
  }
26744
26761
 
26745
- // node_modules/.pnpm/@kevisual+api@0.0.52_@types+react@19.2.10_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@kevisual/api/query/query-login/query-login-node.ts
26746
- var storage = new StorageNode;
26747
- await storage.loadCache();
26762
+ // node_modules/.pnpm/@kevisual+api@0.0.55_@types+react@19.2.10_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@kevisual/api/query/query-login/query-login-node.ts
26763
+ var cache = new LoginNodeCache;
26748
26764
 
26749
26765
  class QueryLoginNode extends QueryLogin {
26750
26766
  constructor(opts) {
26767
+ const baseURL = opts?.query?.baseURL;
26768
+ const storage = new StorageNode({ baseURL, load: true });
26769
+ const cache2 = new LoginNodeCache({ baseURL, load: true });
26751
26770
  super({
26752
26771
  ...opts,
26772
+ isBrowser: false,
26753
26773
  storage,
26754
- cache: new LoginNodeCache
26774
+ cache: cache2
26755
26775
  });
26756
26776
  }
26757
26777
  }
@@ -26759,6 +26779,7 @@ class QueryLoginNode extends QueryLogin {
26759
26779
  // src/module/query.ts
26760
26780
  var config = getConfig2();
26761
26781
  var baseURL = config?.baseURL || "https://kevisual.cn";
26782
+ var storage = new StorageNode({ load: true });
26762
26783
  var getBaseURL = () => {
26763
26784
  return baseURL;
26764
26785
  };
@@ -34486,22 +34507,22 @@ var L = class a2 {
34486
34507
  };
34487
34508
 
34488
34509
  // src/module/cache.ts
34489
- var cache = new L({
34510
+ var cache2 = new L({
34490
34511
  max: 1e4,
34491
34512
  ttl: 1000 * 60 * 60 * 24 * 7
34492
34513
  });
34493
34514
  var sessionStorage2 = {
34494
34515
  setItem: (key, value) => {
34495
- cache.set(key, value);
34516
+ cache2.set(key, value);
34496
34517
  },
34497
34518
  getItem: (key) => {
34498
- return cache.get(key);
34519
+ return cache2.get(key);
34499
34520
  },
34500
34521
  removeItem: (key) => {
34501
- cache.delete(key);
34522
+ cache2.delete(key);
34502
34523
  },
34503
34524
  clear: () => {
34504
- cache.clear();
34525
+ cache2.clear();
34505
34526
  }
34506
34527
  };
34507
34528
 
@@ -35457,10 +35478,10 @@ var isJWK = (key) => isObject(key) && typeof key.kty === "string";
35457
35478
  var isPrivateJWK = (key) => key.kty !== "oct" && (key.kty === "AKP" && typeof key.priv === "string" || typeof key.d === "string");
35458
35479
  var isPublicJWK = (key) => key.kty !== "oct" && key.d === undefined && key.priv === undefined;
35459
35480
  var isSecretJWK = (key) => key.kty === "oct" && typeof key.k === "string";
35460
- var cache2;
35481
+ var cache3;
35461
35482
  var handleJWK = async (key, jwk, alg, freeze = false) => {
35462
- cache2 ||= new WeakMap;
35463
- let cached = cache2.get(key);
35483
+ cache3 ||= new WeakMap;
35484
+ let cached = cache3.get(key);
35464
35485
  if (cached?.[alg]) {
35465
35486
  return cached[alg];
35466
35487
  }
@@ -35468,15 +35489,15 @@ var handleJWK = async (key, jwk, alg, freeze = false) => {
35468
35489
  if (freeze)
35469
35490
  Object.freeze(key);
35470
35491
  if (!cached) {
35471
- cache2.set(key, { [alg]: cryptoKey });
35492
+ cache3.set(key, { [alg]: cryptoKey });
35472
35493
  } else {
35473
35494
  cached[alg] = cryptoKey;
35474
35495
  }
35475
35496
  return cryptoKey;
35476
35497
  };
35477
35498
  var handleKeyObject = (keyObject, alg) => {
35478
- cache2 ||= new WeakMap;
35479
- let cached = cache2.get(keyObject);
35499
+ cache3 ||= new WeakMap;
35500
+ let cached = cache3.get(keyObject);
35480
35501
  if (cached?.[alg]) {
35481
35502
  return cached[alg];
35482
35503
  }
@@ -35589,7 +35610,7 @@ var handleKeyObject = (keyObject, alg) => {
35589
35610
  throw new TypeError("given KeyObject instance cannot be used for this algorithm");
35590
35611
  }
35591
35612
  if (!cached) {
35592
- cache2.set(keyObject, { [alg]: cryptoKey });
35613
+ cache3.set(keyObject, { [alg]: cryptoKey });
35593
35614
  } else {
35594
35615
  cached[alg] = cryptoKey;
35595
35616
  }
@@ -37536,7 +37557,7 @@ var getJWKS = new Command("get").description("获取 JWKS 内容").option("-d ,
37536
37557
  jwksCmd.addCommand(getJWKS);
37537
37558
  program.addCommand(jwksCmd);
37538
37559
 
37539
- // node_modules/.pnpm/@kevisual+cnb@0.0.26_dotenv@17.3.1_idb-keyval@6.2.2/node_modules/@kevisual/cnb/dist/keep.js
37560
+ // node_modules/.pnpm/@kevisual+cnb@0.0.28_dotenv@17.3.1_idb-keyval@6.2.2_ioredis@5.9.3/node_modules/@kevisual/cnb/dist/keep.js
37540
37561
  import { createRequire as createRequire4 } from "node:module";
37541
37562
  var __create4 = Object.create;
37542
37563
  var __getProtoOf4 = Object.getPrototypeOf;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kevisual/cli",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "envision 命令行工具",
5
5
  "type": "module",
6
6
  "basename": "/root/cli",
@@ -46,7 +46,7 @@
46
46
  "@kevisual/auth": "^2.0.3",
47
47
  "@kevisual/context": "^0.0.8",
48
48
  "@kevisual/use-config": "^1.0.30",
49
- "@opencode-ai/sdk": "^1.2.6",
49
+ "@opencode-ai/sdk": "^1.2.10",
50
50
  "@types/busboy": "^1.5.4",
51
51
  "busboy": "^1.6.0",
52
52
  "eventemitter3": "^5.0.4",
@@ -59,8 +59,8 @@
59
59
  "unstorage": "^1.17.4"
60
60
  },
61
61
  "devDependencies": {
62
- "@kevisual/api": "^0.0.52",
63
- "@kevisual/cnb": "^0.0.26",
62
+ "@kevisual/api": "^0.0.55",
63
+ "@kevisual/cnb": "^0.0.28",
64
64
  "@kevisual/dts": "^0.0.4",
65
65
  "@kevisual/load": "^0.0.6",
66
66
  "@kevisual/logger": "^0.0.4",
@@ -69,7 +69,7 @@
69
69
  "@types/crypto-js": "^4.2.2",
70
70
  "@types/jsonwebtoken": "^9.0.10",
71
71
  "@types/micromatch": "^4.0.10",
72
- "@types/node": "^25.2.3",
72
+ "@types/node": "^25.3.0",
73
73
  "@types/semver": "^7.7.1",
74
74
  "chalk": "^5.6.2",
75
75
  "commander": "^14.0.3",