Open
Conversation
Signed-off-by: trangevi <trangevi@microsoft.com>
Signed-off-by: trangevi <trangevi@microsoft.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an interactive “start from a template” initialization flow to the azure.ai.agents extension, while refactoring the existing manifest-based init logic into a shared helper.
Changes:
- Extract common manifest initialization logic into
runInitFromManifest. - Add template-catalog fetching, interactive selection, and post-
azd init -tmanifest discovery. - Add unit tests for template type detection, template fetching (via test helper), and manifest discovery.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
cli/azd/extensions/azure.ai.agents/internal/cmd/init.go |
Refactors manifest init into a helper and adds a new interactive branching flow (from code vs template). |
cli/azd/extensions/azure.ai.agents/internal/cmd/init_from_templates_helpers.go |
Implements template catalog retrieval, init-mode/language/template prompts, and manifest search. |
cli/azd/extensions/azure.ai.agents/internal/cmd/init_from_templates_helpers_test.go |
Adds tests for EffectiveType and findAgentManifest, plus HTTP-fetch parsing via a test helper. |
You can also share your feedback on Copilot code review. Take the survey.
Comment on lines
+206
to
214
| } else { | ||
| // No manifest provided - prompt user for init mode | ||
| initMode, err := promptInitMode(ctx, azdClient) | ||
| if err != nil { | ||
| return exterrors.Auth( | ||
| exterrors.CodeCredentialCreationFailed, | ||
| fmt.Sprintf("failed to create Azure credential: %s", err), | ||
| "run 'azd auth login' to authenticate", | ||
| ) | ||
| } | ||
|
|
||
| console := input.NewConsole( | ||
| false, // noPrompt | ||
| true, // isTerminal | ||
| input.Writers{Output: os.Stdout}, | ||
| input.ConsoleHandles{ | ||
| Stderr: os.Stderr, | ||
| Stdin: os.Stdin, | ||
| Stdout: os.Stdout, | ||
| }, | ||
| nil, // formatter | ||
| nil, // externalPromptCfg | ||
| ) | ||
|
|
||
| action := &InitAction{ | ||
| azdClient: azdClient, | ||
| // azureClient: azure.NewAzureClient(credential), | ||
| azureContext: azureContext, | ||
| // composedResources: getComposedResourcesResponse.Resources, | ||
| console: console, | ||
| credential: credential, | ||
| projectConfig: projectConfig, | ||
| environment: environment, | ||
| flags: flags, | ||
| httpClient: httpClient, | ||
| } | ||
|
|
||
| if err := action.Run(ctx); err != nil { | ||
| if exterrors.IsCancellation(err) { | ||
| return exterrors.Cancelled("initialization was cancelled") | ||
| } | ||
| return err | ||
| } |
Comment on lines
+69
to
+72
| resp, err := azdClient.Prompt().Select(ctx, &azdext.SelectRequest{ | ||
| Options: &azdext.SelectOptions{ | ||
| Message: "How do you want to initialize your agent?", | ||
| Choices: choices, |
Comment on lines
+140
to
+145
| langResp, err := azdClient.Prompt().Select(ctx, &azdext.SelectRequest{ | ||
| Options: &azdext.SelectOptions{ | ||
| Message: "Select a language:", | ||
| Choices: languageChoices, | ||
| }, | ||
| }) |
Comment on lines
+177
to
+182
| templateResp, err := azdClient.Prompt().Select(ctx, &azdext.SelectRequest{ | ||
| Options: &azdext.SelectOptions{ | ||
| Message: "Select an agent template:", | ||
| Choices: templateChoices, | ||
| }, | ||
| }) |
Signed-off-by: trangevi <trangevi@microsoft.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds handling to prompt the user when they don't provide a manifest, to select to either use code in the current directory, or select from a curated list of agent templates.