From 0467df4760e1a3f251dbefd1ef7aa10162d8c6fd Mon Sep 17 00:00:00 2001 From: hemarina Date: Mon, 12 Jan 2026 15:26:15 -0800 Subject: [PATCH 1/7] update workflow --- cli/azd/cmd/init.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/cli/azd/cmd/init.go b/cli/azd/cmd/init.go index b55f8bd36fd..e0fdb0fddfc 100644 --- a/cli/azd/cmd/init.go +++ b/cli/azd/cmd/init.go @@ -594,11 +594,7 @@ func promptInitType(console input.Console, ctx context.Context, featuresManager options := []string{ "Scan current directory", // This now covers minimal project creation too "Select a template", - } - - // Only include AZD agent option if the LLM feature is enabled - if featuresManager.IsEnabled(llm.FeatureLlm) { - options = append(options, fmt.Sprintf("Use agent mode %s", color.YellowString("(Alpha)"))) + fmt.Sprintf("Use agent mode %s", color.YellowString("(Alpha)")), } selection, err := console.Select(ctx, input.ConsoleOptions{ @@ -618,8 +614,11 @@ func promptInitType(console input.Console, ctx context.Context, featuresManager // Only return initWithCopilot if the LLM feature is enabled and we have 3 options if featuresManager.IsEnabled(llm.FeatureLlm) { return initWithAgent, nil + } else { + return initUnknown, errors.New("To use this feature, run `azd config set alpha.llm on`, " + + "set the agent model type with `azd config set ai.agent.model.type github-copilot`, " + + "then run `azd init` again.") } - fallthrough default: panic("unhandled selection") } From 6ddcf30cc404bc521dff1991f35362707cb528c9 Mon Sep 17 00:00:00 2001 From: hemarina <104857065+hemarina@users.noreply.github.com> Date: Mon, 12 Jan 2026 15:36:56 -0800 Subject: [PATCH 2/7] Update cli/azd/cmd/init.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- cli/azd/cmd/init.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/azd/cmd/init.go b/cli/azd/cmd/init.go index e0fdb0fddfc..2f588021daa 100644 --- a/cli/azd/cmd/init.go +++ b/cli/azd/cmd/init.go @@ -611,7 +611,7 @@ func promptInitType(console input.Console, ctx context.Context, featuresManager case 1: return initAppTemplate, nil case 2: - // Only return initWithCopilot if the LLM feature is enabled and we have 3 options + // Only return initWithAgent if the LLM feature is enabled and we have 3 options if featuresManager.IsEnabled(llm.FeatureLlm) { return initWithAgent, nil } else { From 9289e6c7413edb00772af2eb93cdf15b2e77afda Mon Sep 17 00:00:00 2001 From: hemarina Date: Tue, 13 Jan 2026 10:15:53 -0800 Subject: [PATCH 3/7] add suggestion on error message --- cli/azd/pkg/llm/manager.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cli/azd/pkg/llm/manager.go b/cli/azd/pkg/llm/manager.go index cc66d010204..9c9fd542eb6 100644 --- a/cli/azd/pkg/llm/manager.go +++ b/cli/azd/pkg/llm/manager.go @@ -135,7 +135,8 @@ func (m Manager) GetDefaultModel(ctx context.Context, opts ...ModelOption) (*Mod defaultModelType, ok := userConfig.GetString("ai.agent.model.type") if !ok { - return nil, fmt.Errorf("Default model type has not been set") + return nil, fmt.Errorf("Default model type has not been set. Set the agent model type with" + + " `azd config set ai.agent.model.type github-copilot`.") } return m.ModelFactory.CreateModelContainer(ctx, LlmType(defaultModelType), opts...) From 4423dbeb9bfc5882afe46a319d83940070d1a3eb Mon Sep 17 00:00:00 2001 From: hemarina Date: Wed, 14 Jan 2026 18:51:08 -0800 Subject: [PATCH 4/7] address feedback --- cli/azd/cmd/init.go | 66 ++++++++++++++++++++++++++++++++++++++------- 1 file changed, 57 insertions(+), 9 deletions(-) diff --git a/cli/azd/cmd/init.go b/cli/azd/cmd/init.go index 2f588021daa..474cf5db322 100644 --- a/cli/azd/cmd/init.go +++ b/cli/azd/cmd/init.go @@ -23,6 +23,7 @@ import ( "github.com/azure/azure-dev/cli/azd/internal/tracing" "github.com/azure/azure-dev/cli/azd/internal/tracing/fields" "github.com/azure/azure-dev/cli/azd/pkg/alpha" + "github.com/azure/azure-dev/cli/azd/pkg/config" "github.com/azure/azure-dev/cli/azd/pkg/environment" "github.com/azure/azure-dev/cli/azd/pkg/environment/azdcontext" "github.com/azure/azure-dev/cli/azd/pkg/exec" @@ -141,6 +142,7 @@ type initAction struct { azd workflow.AzdCommandRunner agentFactory *agent.AgentFactory consentManager consent.ConsentManager + configManager config.UserConfigManager } func newInitAction( @@ -157,6 +159,7 @@ func newInitAction( azd workflow.AzdCommandRunner, agentFactory *agent.AgentFactory, consentManager consent.ConsentManager, + configManager config.UserConfigManager, ) actions.Action { return &initAction{ lazyAzdCtx: lazyAzdCtx, @@ -172,6 +175,7 @@ func newInitAction( azd: azd, agentFactory: agentFactory, consentManager: consentManager, + configManager: configManager, } } @@ -252,7 +256,7 @@ func (i *initAction) Run(ctx context.Context) (*actions.ActionResult, error) { initTypeSelect = initEnvironment } else { // Prompt for init type for new projects - initTypeSelect, err = promptInitType(i.console, ctx, i.featuresManager) + initTypeSelect, err = promptInitType(i.console, ctx, i.featuresManager, i.configManager) if err != nil { return nil, err } @@ -590,7 +594,7 @@ const ( initWithAgent ) -func promptInitType(console input.Console, ctx context.Context, featuresManager *alpha.FeatureManager) (initType, error) { +func promptInitType(console input.Console, ctx context.Context, featuresManager *alpha.FeatureManager, configManager config.UserConfigManager) (initType, error) { options := []string{ "Scan current directory", // This now covers minimal project creation too "Select a template", @@ -611,14 +615,58 @@ func promptInitType(console input.Console, ctx context.Context, featuresManager case 1: return initAppTemplate, nil case 2: - // Only return initWithAgent if the LLM feature is enabled and we have 3 options - if featuresManager.IsEnabled(llm.FeatureLlm) { - return initWithAgent, nil - } else { - return initUnknown, errors.New("To use this feature, run `azd config set alpha.llm on`, " + - "set the agent model type with `azd config set ai.agent.model.type github-copilot`, " + - "then run `azd init` again.") + if !featuresManager.IsEnabled(llm.FeatureLlm) { + confirm, err := console.Confirm(ctx, input.ConsoleOptions{ + Message: "alpha.llm feature is not enabled. Do you want to enable it to use agent mode?", + DefaultValue: true, + }) + + if !confirm { + return initUnknown, errors.New("To use this feature, run `azd config set alpha.llm on`, " + + "set the agent model type with `azd config set ai.agent.model.type github-copilot`, " + + "then run `azd init` again.") + } + + azdConfig, err := configManager.Load() + if err != nil { + return initUnknown, fmt.Errorf("failed to load config: %w", err) + } + + err = azdConfig.Set("alpha.llm", "on") + if err != nil { + return initUnknown, fmt.Errorf("failed to set alpha.llm config: %w", err) + } + + err = configManager.Save(azdConfig) + if err != nil { + return initUnknown, fmt.Errorf("failed to save config: %w", err) + } + + console.Message(ctx, "\nThe azd agent feature has been enabled to support this new experience."+ + " To turn off in the future run `azd config unset alpha.llm`.") + + console.Message(ctx, "") + confirm, err = console.Confirm(ctx, input.ConsoleOptions{ + Message: "This feature requires a LLM model. Do you want to enable it with github copilot?", + DefaultValue: true, + }) + console.Message(ctx, "") + + if !confirm { + return initUnknown, errors.New("To set the agent model type, run `azd config set ai.agent.model.type github-copilot`, " + + "then run `azd init` again.") + } + + err = azdConfig.Set("ai.agent.model.type", "github-copilot") + if err != nil { + return initUnknown, fmt.Errorf("failed to set ai.agent.model.type config: %w", err) + } + + console.Message(ctx, "\nGitHub Copilot has been enabled to support this new experience."+ + " To turn off in the future run `azd config unset ai.agent.model.type`.") } + + return initWithAgent, nil default: panic("unhandled selection") } From dd8840e32c45e65f9fe7ac8b4ee8bff17a37ec65 Mon Sep 17 00:00:00 2001 From: hemarina Date: Wed, 14 Jan 2026 21:22:08 -0800 Subject: [PATCH 5/7] lll --- cli/azd/cmd/init.go | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/cli/azd/cmd/init.go b/cli/azd/cmd/init.go index 474cf5db322..48bec17a87b 100644 --- a/cli/azd/cmd/init.go +++ b/cli/azd/cmd/init.go @@ -594,7 +594,12 @@ const ( initWithAgent ) -func promptInitType(console input.Console, ctx context.Context, featuresManager *alpha.FeatureManager, configManager config.UserConfigManager) (initType, error) { +func promptInitType( + console input.Console, + ctx context.Context, + featuresManager *alpha.FeatureManager, + configManager config.UserConfigManager, +) (initType, error) { options := []string{ "Scan current directory", // This now covers minimal project creation too "Select a template", @@ -620,6 +625,9 @@ func promptInitType(console input.Console, ctx context.Context, featuresManager Message: "alpha.llm feature is not enabled. Do you want to enable it to use agent mode?", DefaultValue: true, }) + if err != nil { + return initUnknown, err + } if !confirm { return initUnknown, errors.New("To use this feature, run `azd config set alpha.llm on`, " + @@ -650,10 +658,14 @@ func promptInitType(console input.Console, ctx context.Context, featuresManager Message: "This feature requires a LLM model. Do you want to enable it with github copilot?", DefaultValue: true, }) + if err != nil { + return initUnknown, err + } console.Message(ctx, "") if !confirm { - return initUnknown, errors.New("To set the agent model type, run `azd config set ai.agent.model.type github-copilot`, " + + return initUnknown, errors.New("To set the agent model type, run " + + "`azd config set ai.agent.model.type github-copilot`, " + "then run `azd init` again.") } From 4332732d6d71a93c11bd435e87fb0dc6abcae53d Mon Sep 17 00:00:00 2001 From: hemarina Date: Thu, 15 Jan 2026 12:36:00 -0800 Subject: [PATCH 6/7] address feedback --- cli/azd/cmd/init.go | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/cli/azd/cmd/init.go b/cli/azd/cmd/init.go index 48bec17a87b..e56de9050be 100644 --- a/cli/azd/cmd/init.go +++ b/cli/azd/cmd/init.go @@ -621,20 +621,6 @@ func promptInitType( return initAppTemplate, nil case 2: if !featuresManager.IsEnabled(llm.FeatureLlm) { - confirm, err := console.Confirm(ctx, input.ConsoleOptions{ - Message: "alpha.llm feature is not enabled. Do you want to enable it to use agent mode?", - DefaultValue: true, - }) - if err != nil { - return initUnknown, err - } - - if !confirm { - return initUnknown, errors.New("To use this feature, run `azd config set alpha.llm on`, " + - "set the agent model type with `azd config set ai.agent.model.type github-copilot`, " + - "then run `azd init` again.") - } - azdConfig, err := configManager.Load() if err != nil { return initUnknown, fmt.Errorf("failed to load config: %w", err) @@ -653,22 +639,6 @@ func promptInitType( console.Message(ctx, "\nThe azd agent feature has been enabled to support this new experience."+ " To turn off in the future run `azd config unset alpha.llm`.") - console.Message(ctx, "") - confirm, err = console.Confirm(ctx, input.ConsoleOptions{ - Message: "This feature requires a LLM model. Do you want to enable it with github copilot?", - DefaultValue: true, - }) - if err != nil { - return initUnknown, err - } - console.Message(ctx, "") - - if !confirm { - return initUnknown, errors.New("To set the agent model type, run " + - "`azd config set ai.agent.model.type github-copilot`, " + - "then run `azd init` again.") - } - err = azdConfig.Set("ai.agent.model.type", "github-copilot") if err != nil { return initUnknown, fmt.Errorf("failed to set ai.agent.model.type config: %w", err) From 7b74570718a940b496befd862b9a3301de448643 Mon Sep 17 00:00:00 2001 From: hemarina <104857065+hemarina@users.noreply.github.com> Date: Fri, 16 Jan 2026 22:39:46 -0800 Subject: [PATCH 7/7] Update cli/azd/cmd/init.go --- cli/azd/cmd/init.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cli/azd/cmd/init.go b/cli/azd/cmd/init.go index e56de9050be..02cf8186f3a 100644 --- a/cli/azd/cmd/init.go +++ b/cli/azd/cmd/init.go @@ -644,6 +644,11 @@ func promptInitType( return initUnknown, fmt.Errorf("failed to set ai.agent.model.type config: %w", err) } + err = configManager.Save(azdConfig) + if err != nil { + return initUnknown, fmt.Errorf("failed to save config: %w", err) + } + console.Message(ctx, "\nGitHub Copilot has been enabled to support this new experience."+ " To turn off in the future run `azd config unset ai.agent.model.type`.") }