Refactor: Extract shared Foundry project selection logic into helper function
- Dominant language
- Go
- Stars
- 569
- Forks
- 364
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 136
Description
## Background
PR #8292 introduced a two-step Foundry project selection flow in both `init.go` and `init_from_code.go`. The two files now share ~70 lines of near-identical logic:
```
ensureSubscription → selectFoundryProject → nil check → setEnvValue("USE_EXISTING_AI_PROJECT") → fallback to "create new"
```
## Problem
Future fixes may drift between the two files if only one is updated.
## Proposed Solution
Extract a shared helper function (e.g. `promptOrSelectFoundryProject(...)`) that encapsulates the common sequence, and have both callers use it.
## Files
- `cli/azd/extensions/azure.ai.agents/internal/cmd/init.go` (~L1182-1250)
- `cli/azd/extensions/azure.ai.agents/internal/cmd/init_from_code.go` (~L520-590)
## Priority
P3 — non-blocking polish, suggested by @wbreza in PR #8292 review.
Contributor guide
Assessment
This issue has not been assessed yet.