azd tool: extract package manager command builders into extensible registry
- Dominant language
- Go
- Stars
- 569
- Forks
- 364
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 136
Description
## Summary
The `buildManagerCommand` function in `installer.go` uses a hardcoded switch statement for package managers (winget, brew, apt, npm, code). Adding new managers (choco, scoop, dnf, pacman, snap) requires modifying this switch. Notably, `snap` is already listed in `platformManagers` but has no corresponding case in `buildManagerCommand`, causing a silent failure.
## Proposal
Define a `PackageManagerStrategy` interface or a `map[string]CommandBuilder` registry that new managers can be added to without modifying the switch.
## Acceptance Criteria
- [ ] New package managers can be added without modifying `buildManagerCommand`
- [ ] `snap` support is either properly implemented or explicitly documented as unsupported
- [ ] Existing package manager behavior is unchanged
## Related
- Epic: #7845
- PR: #7450
Contributor guide
Assessment
This issue has not been assessed yet.