xtrm-tools 2.1.11 → 2.1.13

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.
@@ -41430,6 +41430,16 @@ var PI_AGENT_DIR = import_path12.default.join((0, import_node_os4.homedir)(), ".
41430
41430
  function fillTemplate(template, values) {
41431
41431
  return template.replace(/\{\{(\w+)\}\}/g, (_, key) => values[key] ?? "");
41432
41432
  }
41433
+ function readExistingPiValues(piAgentDir) {
41434
+ const values = {};
41435
+ try {
41436
+ const auth = JSON.parse(require("fs").readFileSync(import_path12.default.join(piAgentDir, "auth.json"), "utf8"));
41437
+ if (auth?.dashscope?.key) values["DASHSCOPE_API_KEY"] = auth.dashscope.key;
41438
+ if (auth?.zai?.key) values["ZAI_API_KEY"] = auth.zai.key;
41439
+ } catch {
41440
+ }
41441
+ return values;
41442
+ }
41433
41443
  function isPiInstalled() {
41434
41444
  return (0, import_node_child_process.spawnSync)("pi", ["--version"], { encoding: "utf8" }).status === 0;
41435
41445
  }
@@ -41454,9 +41464,14 @@ function createInstallPiCommand() {
41454
41464
  `));
41455
41465
  }
41456
41466
  const schema = await import_fs_extra12.default.readJson(import_path12.default.join(piConfigDir, "install-schema.json"));
41457
- const values = {};
41467
+ const existing = readExistingPiValues(PI_AGENT_DIR);
41468
+ const values = { ...existing };
41458
41469
  console.log(t.bold(" API Keys\n"));
41459
41470
  for (const field of schema.fields) {
41471
+ if (existing[field.key]) {
41472
+ console.log(t.success(` ${sym.ok} ${field.label} [already set]`));
41473
+ continue;
41474
+ }
41460
41475
  if (!field.required && !yes) {
41461
41476
  const { include } = await (0, import_prompts2.default)({ type: "confirm", name: "include", message: ` Configure ${field.label}? (optional)`, initial: false });
41462
41477
  if (!include) continue;