Description
AuditOptions (pkg/cli/audit.go:25-40) and ViewOptions (pkg/cli/view_command.go:109-115) both declare Owner, Repo, Hostname, OutputDir string — ViewOptions is a field-for-field prefix of AuditOptions. Related repo-identifier shapes also exist in pkg/parser/github_urls.go (GitHubURLComponents{Host, Owner, Repo string}) and pkg/parser/import_remote.go (remoteImportOrigin). pkg/repoutil/ already exists as the natural home for repo-spec utilities but has no canonical RepoTarget-style value type these could converge on.
Suggested Changes
- Add a
RepoTarget{Owner, Repo, Hostname string} type in pkg/repoutil
- Embed
RepoTarget in AuditOptions and ViewOptions, updating field access at call sites
- Optionally consider it for the parser-side URL/import types in a follow-up (out of scope for this issue if it grows too large)
Files Affected
pkg/repoutil/ (new type)
pkg/cli/audit.go
pkg/cli/view_command.go
Success Criteria
AuditOptions and ViewOptions both embed the shared RepoTarget type
- No behavior change;
ViewOptions no longer silently diverges from AuditOptions field-for-field
make test-unit and make build pass
Source
Extracted from Typist - Go Type Consistency Analysis discussion #49330 (Cluster 3, estimated 2-3 hours)
Priority
Medium - guards against field drift between two option structs that currently must be kept in sync by hand
🔍 Task mining by Discussion Task Miner - Code Quality Improvement Agent · auto · 57.7 AIC · ⌖ 5.34 AIC · ⊞ 10.2K · ◷
Description
AuditOptions(pkg/cli/audit.go:25-40) andViewOptions(pkg/cli/view_command.go:109-115) both declareOwner, Repo, Hostname, OutputDir string—ViewOptionsis a field-for-field prefix ofAuditOptions. Related repo-identifier shapes also exist inpkg/parser/github_urls.go(GitHubURLComponents{Host, Owner, Repo string}) andpkg/parser/import_remote.go(remoteImportOrigin).pkg/repoutil/already exists as the natural home for repo-spec utilities but has no canonicalRepoTarget-style value type these could converge on.Suggested Changes
RepoTarget{Owner, Repo, Hostname string}type inpkg/repoutilRepoTargetinAuditOptionsandViewOptions, updating field access at call sitesFiles Affected
pkg/repoutil/(new type)pkg/cli/audit.gopkg/cli/view_command.goSuccess Criteria
AuditOptionsandViewOptionsboth embed the sharedRepoTargettypeViewOptionsno longer silently diverges fromAuditOptionsfield-for-fieldmake test-unitandmake buildpassSource
Extracted from Typist - Go Type Consistency Analysis discussion #49330 (Cluster 3, estimated 2-3 hours)
Priority
Medium - guards against field drift between two option structs that currently must be kept in sync by hand