@base44-preview/cli 0.0.34-pr.320.8bb5555 → 0.0.34-pr.321.775d9f4

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/README.md CHANGED
@@ -57,9 +57,6 @@ The CLI will guide you through project setup. For step-by-step tutorials, see th
57
57
  | [`connectors push`](https://docs.base44.com/developers/references/cli/commands/connectors-push) | Push local connectors to Base44 |
58
58
  | [`entities push`](https://docs.base44.com/developers/references/cli/commands/entities-push) | Push local entities to Base44 |
59
59
  | [`functions deploy`](https://docs.base44.com/developers/references/cli/commands/functions-deploy) | Deploy local functions to Base44 |
60
- | [`secrets delete`](https://docs.base44.com/developers/references/cli/commands/secrets-delete) | Delete one or more secrets |
61
- | [`secrets list`](https://docs.base44.com/developers/references/cli/commands/secrets-list) | List secret names (values are masked) |
62
- | [`secrets set`](https://docs.base44.com/developers/references/cli/commands/secrets-set) | Set one or more secrets (KEY=VALUE format) |
63
60
  | [`site deploy`](https://docs.base44.com/developers/references/cli/commands/site-deploy) | Deploy built site files to Base44 hosting |
64
61
  | [`site open`](https://docs.base44.com/developers/references/cli/commands/site-open) | Open the published site in your browser |
65
62
  | [`types generate`](https://docs.base44.com/developers/references/cli/commands/types-generate) | Generate TypeScript types from project resources |
package/dist/cli/index.js CHANGED
@@ -185411,26 +185411,42 @@ async function readAgentFiles(agentsDir) {
185411
185411
  return { data, raw: raw2, filePath };
185412
185412
  }));
185413
185413
  }
185414
+ function buildNameToEntryMap(entries) {
185415
+ const nameToEntry = new Map;
185416
+ for (const entry of entries) {
185417
+ if (nameToEntry.has(entry.data.name)) {
185418
+ throw new InvalidInputError(`Duplicate agent name "${entry.data.name}"`, {
185419
+ hints: [
185420
+ {
185421
+ message: `Remove duplicate agents with name "${entry.data.name}" - only one agent per name is allowed`
185422
+ }
185423
+ ]
185424
+ });
185425
+ }
185426
+ nameToEntry.set(entry.data.name, entry);
185427
+ }
185428
+ return nameToEntry;
185429
+ }
185414
185430
  async function readAllAgents(agentsDir) {
185415
185431
  const entries = await readAgentFiles(agentsDir);
185416
- const names = new Set;
185417
- for (const { data } of entries) {
185418
- if (names.has(data.name)) {
185419
- throw new Error(`Duplicate agent name "${data.name}"`);
185432
+ const nameToEntry = buildNameToEntryMap(entries);
185433
+ return [...nameToEntry.values()].map((e2) => e2.data);
185434
+ }
185435
+ function findAvailablePath(agentsDir, name2, claimedPaths) {
185436
+ const base = join3(agentsDir, `${name2}.${CONFIG_FILE_EXTENSION}`);
185437
+ if (!claimedPaths.has(base)) {
185438
+ return base;
185439
+ }
185440
+ for (let i = 1;; i++) {
185441
+ const candidate = join3(agentsDir, `${name2}_${i}.${CONFIG_FILE_EXTENSION}`);
185442
+ if (!claimedPaths.has(candidate)) {
185443
+ return candidate;
185420
185444
  }
185421
- names.add(data.name);
185422
185445
  }
185423
- return entries.map((e2) => e2.data);
185424
185446
  }
185425
185447
  async function writeAgents(agentsDir, remoteAgents) {
185426
185448
  const entries = await readAgentFiles(agentsDir);
185427
- const nameToEntry = new Map;
185428
- for (const entry of entries) {
185429
- if (nameToEntry.has(entry.data.name)) {
185430
- throw new Error(`Duplicate agent name "${entry.data.name}"`);
185431
- }
185432
- nameToEntry.set(entry.data.name, entry);
185433
- }
185449
+ const nameToEntry = buildNameToEntryMap(entries);
185434
185450
  const newNames = new Set(remoteAgents.map((a) => a.name));
185435
185451
  const deleted = [];
185436
185452
  for (const [name2, entry] of nameToEntry) {
@@ -185439,13 +185455,20 @@ async function writeAgents(agentsDir, remoteAgents) {
185439
185455
  deleted.push(name2);
185440
185456
  }
185441
185457
  }
185458
+ const claimedPaths = new Set;
185459
+ for (const [name2, entry] of nameToEntry) {
185460
+ if (newNames.has(name2)) {
185461
+ claimedPaths.add(entry.filePath);
185462
+ }
185463
+ }
185442
185464
  const written = [];
185443
185465
  for (const agent of remoteAgents) {
185444
185466
  const existing = nameToEntry.get(agent.name);
185445
185467
  if (existing && isDeepStrictEqual(existing.raw, agent)) {
185446
185468
  continue;
185447
185469
  }
185448
- const filePath = existing?.filePath ?? join3(agentsDir, `${agent.name}.${CONFIG_FILE_EXTENSION}`);
185470
+ const filePath = existing?.filePath ?? findAvailablePath(agentsDir, agent.name, claimedPaths);
185471
+ claimedPaths.add(filePath);
185449
185472
  await writeJsonFile(filePath, agent);
185450
185473
  written.push(agent.name);
185451
185474
  }
@@ -195710,6 +195733,9 @@ function getLogsCommand(context) {
195710
195733
 
195711
195734
  // src/cli/commands/secrets/delete.ts
195712
195735
  async function deleteSecretsAction(keys) {
195736
+ if (keys.length === 0) {
195737
+ throw new InvalidInputError("Provide one or more secret names to delete.");
195738
+ }
195713
195739
  for (const key of keys) {
195714
195740
  await runTask(`Deleting secret "${key}"`, async () => {
195715
195741
  return await deleteSecret(key);
@@ -195724,7 +195750,7 @@ async function deleteSecretsAction(keys) {
195724
195750
  };
195725
195751
  }
195726
195752
  function getSecretsDeleteCommand(context) {
195727
- return new Command("delete").description("Delete one or more secrets").argument("<keys...>", "Secret name(s) to delete").action(async (keys) => {
195753
+ return new Command("delete").description("Delete one or more secrets").argument("[keys...]", "Secret name(s) to delete").action(async (keys) => {
195728
195754
  await runCommand(() => deleteSecretsAction(keys), { requireAuth: true }, context);
195729
195755
  });
195730
195756
  }
@@ -195739,7 +195765,6 @@ async function listSecretsAction() {
195739
195765
  });
195740
195766
  const names = Object.keys(secrets);
195741
195767
  if (names.length === 0) {
195742
- R2.info("No secrets found for this project.");
195743
195768
  return { outroMessage: "No secrets configured." };
195744
195769
  }
195745
195770
  for (const [name2, maskedValue] of Object.entries(secrets)) {
@@ -195805,7 +195830,7 @@ async function setSecretsAction(entries, options) {
195805
195830
  };
195806
195831
  }
195807
195832
  function getSecretsSetCommand(context) {
195808
- return new Command("set").description("Set one or more secrets (KEY=VALUE format)").argument("[entries...]", "KEY=VALUE pairs (e.g. OPENAI_API_KEY=sk-abc123)").option("--env-file <path>", "Path to .env file").action(async (entries, options) => {
195833
+ return new Command("set").description("Set one or more secrets (KEY=VALUE format)").argument("[entries...]", "KEY=VALUE pairs (e.g. KEY1=VALUE1 KEY2=VALUE2)").option("--env-file <path>", "Path to .env file").action(async (entries, options) => {
195809
195834
  await runCommand(() => setSecretsAction(entries, options), { requireAuth: true }, context);
195810
195835
  });
195811
195836
  }
@@ -200802,4 +200827,4 @@ export {
200802
200827
  CLIExitError
200803
200828
  };
200804
200829
 
200805
- //# debugId=5772B05CC453E3F364756E2164756E21
200830
+ //# debugId=68767A23A2D2E4ED64756E2164756E21