-
Notifications
You must be signed in to change notification settings - Fork 267
azure.ai.agents - Improve azd ai agent init -m validation
#6482
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
azure.ai.agents - Improve azd ai agent init -m validation
#6482
Conversation
321de6f to
d16ceaa
Compare
azd ai agent init -m validation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR enhances the validation and user experience when initializing AI agents from local manifest files, specifically improving the azd ai agent init -m <local path> command. The changes focus on preventing common errors and providing better warnings when copying files.
Key changes:
- Added comprehensive validation to prevent copying directories into themselves or their subtrees
- Implemented a confirmation prompt with preview when copying more than 10 files/folders
- Fixed panic when providing paths to non-existent files by adding proper error handling
- Improved in-place re-initialization by detecting when manifest already exists in target directory
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| cli/azd/extensions/azure.ai.agents/internal/cmd/init_test.go | Added unit tests for copy validation logic, including subtree prevention and same-path handling |
| cli/azd/extensions/azure.ai.agents/internal/cmd/init_copy.go | New file containing refactored copy validation and directory operations with safety checks |
| cli/azd/extensions/azure.ai.agents/internal/cmd/init.go | Refactored to use new validation functions, improved error handling for non-existent files, and better in-place initialization logic |
| cli/azd/extensions/azure.ai.agents/go.mod | Updated azd CLI dependency version |
| cli/azd/extensions/azure.ai.agents/go.sum | Updated checksums for new azd CLI dependency |
Fixes #5975
Fixes #6440
This PR improves the validation and UX when initializing agents from a local manifest file (
azd ai agent init -m <local path>) and when initializing from GitHub URL in an unauthenticated/expired auth state.Changes
Add warning and confirmation prompt when agent initialization would result in copying more than 10 top-level files/folders (with preview):

Prevent initialization when target dir is inside the manifest dir to avoid accidentally copying the entire project into itself:

Fix panic when providing path to non-existent file

Improve in-place initialization when the manifest already lives in the target directory (skips copying):

Update
github.com/azure/azure-dev/cli/azdin go.mod with GitHub URL parsing fix from Check GitHub authentication before branch resolution in ParseGitHubUrl #6478