xtrm-cli 2.1.11 → 2.1.14

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.cjs CHANGED
@@ -41264,6 +41264,7 @@ async function bootstrapProjectInit() {
41264
41264
  }
41265
41265
  await runBdInitForProject(projectRoot);
41266
41266
  await runGitNexusInitForProject(projectRoot);
41267
+ await syncProjectMcpServers(projectRoot);
41267
41268
  }
41268
41269
  async function runBdInitForProject(projectRoot) {
41269
41270
  console.log(kleur_default.bold("Running beads initialization (bd init)..."));
@@ -41430,6 +41431,23 @@ var PI_AGENT_DIR = import_path12.default.join((0, import_node_os4.homedir)(), ".
41430
41431
  function fillTemplate(template, values) {
41431
41432
  return template.replace(/\{\{(\w+)\}\}/g, (_, key) => values[key] ?? "");
41432
41433
  }
41434
+ function readExistingPiValues(piAgentDir) {
41435
+ const values = {};
41436
+ try {
41437
+ const auth = JSON.parse(require("fs").readFileSync(import_path12.default.join(piAgentDir, "auth.json"), "utf8"));
41438
+ if (auth?.dashscope?.key) values["DASHSCOPE_API_KEY"] = auth.dashscope.key;
41439
+ if (auth?.zai?.key) values["ZAI_API_KEY"] = auth.zai.key;
41440
+ } catch {
41441
+ }
41442
+ try {
41443
+ const models = JSON.parse(require("fs").readFileSync(import_path12.default.join(piAgentDir, "models.json"), "utf8"));
41444
+ if (!values["DASHSCOPE_API_KEY"] && models?.providers?.dashscope?.apiKey) {
41445
+ values["DASHSCOPE_API_KEY"] = models.providers.dashscope.apiKey;
41446
+ }
41447
+ } catch {
41448
+ }
41449
+ return values;
41450
+ }
41433
41451
  function isPiInstalled() {
41434
41452
  return (0, import_node_child_process.spawnSync)("pi", ["--version"], { encoding: "utf8" }).status === 0;
41435
41453
  }
@@ -41454,9 +41472,14 @@ function createInstallPiCommand() {
41454
41472
  `));
41455
41473
  }
41456
41474
  const schema = await import_fs_extra12.default.readJson(import_path12.default.join(piConfigDir, "install-schema.json"));
41457
- const values = {};
41475
+ const existing = readExistingPiValues(PI_AGENT_DIR);
41476
+ const values = { ...existing };
41458
41477
  console.log(t.bold(" API Keys\n"));
41459
41478
  for (const field of schema.fields) {
41479
+ if (existing[field.key]) {
41480
+ console.log(t.success(` ${sym.ok} ${field.label} [already set]`));
41481
+ continue;
41482
+ }
41460
41483
  if (!field.required && !yes) {
41461
41484
  const { include } = await (0, import_prompts2.default)({ type: "confirm", name: "include", message: ` Configure ${field.label}? (optional)`, initial: false });
41462
41485
  if (!include) continue;