Skip to content

fix: validate unique API name before generating authoring bundle @W-21258874@#327

Merged
WillieRuemmele merged 4 commits intomainfrom
ml/W-21258874-validate-agent-script-creation
Feb 17, 2026
Merged

fix: validate unique API name before generating authoring bundle @W-21258874@#327
WillieRuemmele merged 4 commits intomainfrom
ml/W-21258874-validate-agent-script-creation

Conversation

@marcelinollano
Copy link
Collaborator

What does this PR do?

Prevents overwriting existing local agent script bundles by checking if an authoring bundle with the same API name already exists on disk before generating a new one. When a duplicate is detected, the user is prompted to overwrite (yes), enter a new name (no), or cancel. A --force-overwrite flag is also added for non-interactive usage.

What issues does this PR fix or reference?

@W-21258874@

Functionality Before

Running sf agent generate authoring-bundle with an API name that already exists locally would silently overwrite the existing bundle files without warning.

Functionality After

  • If the target aiAuthoringBundles/<api-name>/ directory already exists, the user is prompted: "An authoring bundle with the API name X already exists. Overwrite it? (y/N/cancel)"
  • Yes: proceeds with overwrite
  • No: restarts the flow, re-prompting for both bundle name and API name
  • Cancel: exits gracefully
  • --force-overwrite flag skips the check entirely

Testing Setup Notes

  1. Create an authoring bundle: sf agent generate authoring-bundle --no-spec --name "Test Agent" --api-name TestAgent --target-org <org>
  2. Run the same command again with the same API name to trigger the duplicate detection prompt
  3. Verify all three prompt responses (yes/no/cancel) behave as expected
  4. Verify --force-overwrite bypasses the prompt

Prevent overwriting existing local agent script bundles by checking if
an authoring bundle with the same API name already exists on disk.
Prompts the user to overwrite, enter a new name, or cancel. Adds
--force-overwrite flag to skip the check in non-interactive usage.
@marcelinollano marcelinollano requested a review from a team as a code owner February 13, 2026 20:41
@WillieRuemmele
Copy link
Contributor

QA Notes


✅ : given y/n/cancel prompt when AAB exists

 ➜  ../../oss/plugin-agent/bin/run.js agent generate authoring-bundle
✔ Select an authoring bundle template Default template (Recommended)
✔ Enter the authoring bundle name ForQA
✔ Enter authoring bundle API name ForQA
✔ An authoring bundle with the API name "ForQA" already exists. Overwrite it? No
✔ Enter the authoring bundle name ForQA1
✔ Enter authoring bundle API name ForQA1
Generating authoring bundle: ForQA1... done
Authoring bundle "ForQA1" was generated successfully.

✅ : cancel -> cancels command

@WillieRuemmele WillieRuemmele merged commit a77bcda into main Feb 17, 2026
15 checks passed
@WillieRuemmele WillieRuemmele deleted the ml/W-21258874-validate-agent-script-creation branch February 17, 2026 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments