Azure / Azure/azure-dev

azd tool: extract package manager command builders into extensible registry

Open
#8,042 0 comments 0 reactions 0 assignees View on GitHub
area/tools epic
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.