@mutagent/cli 0.1.56 → 0.1.58

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/bin/cli.js CHANGED
@@ -7471,29 +7471,41 @@ init_errors();
7471
7471
  function registerDeleteCommand(parent) {
7472
7472
  parent.command("delete").description("Delete a provider configuration").argument("<id>", "Provider ID (from: mutagent providers list)").option("-f, --force", "Skip confirmation prompt").addHelpText("after", `
7473
7473
  Examples:
7474
+ ${chalk24.dim("$")} mutagent providers delete <id>
7474
7475
  ${chalk24.dim("$")} mutagent providers delete <id> --force
7475
7476
  ${chalk24.dim("$")} mutagent providers delete <id> --force --json
7476
7477
 
7477
- Safety:
7478
- --force is required in non-interactive (--json) mode.
7479
- Idempotent: deleting a non-existent provider returns success.
7478
+ ${chalk24.dim("Note: --force is required. The CLI is non-interactive — confirm with the user via your native flow, then pass --force.")}
7479
+ ${chalk24.dim("Warning: API keys are AES-256-GCM encrypted and irrecoverable after deletion. Agents referencing this provider will lose their model config.")}
7480
7480
  `).action(async (id, options) => {
7481
7481
  const isJson = getJsonFlag(parent);
7482
7482
  const output = new OutputFormatter(isJson ? "json" : "table");
7483
7483
  try {
7484
- if (isJson && !options.force) {
7485
- throw new MutagentError("CONFIRMATION_REQUIRED", "Delete requires --force flag in non-interactive (--json) mode", "Add --force to confirm deletion: mutagent providers delete <id> --force --json");
7486
- }
7487
- if (!isJson && !options.force) {
7488
- throw new MutagentError("CONFIRMATION_REQUIRED", `Deleting provider ${id} requires explicit confirmation`, `Add --force to confirm: mutagent providers delete ${id} --force`);
7484
+ if (!options.force && !isJson) {
7485
+ throw new MutagentError("CONFIRMATION_REQUIRED", `Deleting provider ${id} requires confirmation. ` + "Warning: encrypted API keys are irrecoverable after deletion.", `Run: mutagent providers delete --help
7486
+ ` + `[Agent: Ask the user to confirm via MultiChoice, then pass --force]
7487
+ ` + `Use --force to confirm: mutagent providers delete ${id} --force`);
7489
7488
  }
7490
7489
  const client = getSDKClient();
7491
7490
  try {
7492
7491
  await client.deleteProvider(id);
7493
7492
  } catch (error) {
7494
- if (error instanceof ApiError && error.statusCode === 404) {} else {
7495
- throw error;
7493
+ if (error instanceof ApiError && error.statusCode === 404) {
7494
+ if (isJson) {
7495
+ const directive = buildProviderDeletedDirective(id);
7496
+ output.output({
7497
+ success: true,
7498
+ deletedId: id,
7499
+ _links: { providers: providerSettingsLink() },
7500
+ _directive: directive
7501
+ });
7502
+ echoDirectiveToStderr(directive);
7503
+ } else {
7504
+ output.success(`Provider ${id} already deleted (idempotent)`);
7505
+ }
7506
+ return;
7496
7507
  }
7508
+ throw error;
7497
7509
  }
7498
7510
  if (isJson) {
7499
7511
  const directive = buildProviderDeletedDirective(id);
@@ -7501,10 +7513,11 @@ Safety:
7501
7513
  output.output({
7502
7514
  success: true,
7503
7515
  deletedId: id,
7516
+ _links: { providers: providerSettingsLink() },
7504
7517
  _directive: directive
7505
7518
  });
7506
7519
  } else {
7507
- output.success(`Provider deleted: ${id}`);
7520
+ output.success(`Deleted provider: ${id}`);
7508
7521
  console.log(` Settings: ${providerSettingsLink()}`);
7509
7522
  }
7510
7523
  } catch (error) {
@@ -8875,5 +8888,5 @@ program.addCommand(createUsageCommand());
8875
8888
  program.addCommand(createHooksCommand());
8876
8889
  program.parse();
8877
8890
 
8878
- //# debugId=D85A29437F9ED75264756E2164756E21
8891
+ //# debugId=5AE0DCCBB0C5BF5A64756E2164756E21
8879
8892
  //# sourceMappingURL=cli.js.map