Skip to content

[Code Quality] refactor: extract shared RepoTarget type for AuditOptions/ViewOptions Owner/Repo/Hostname fields #49344

Description

@github-actions

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 · ◷

  • expires on Aug 1, 2026, 5:24 AM UTC-08:00

Activity

  1. github-actions commented on Aug 1, 2026

    @github-actions
    ContributorAuthor

    This issue was automatically closed because it expired on 2026-08-01T13:24:18.500Z.

    Closed by Workflow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions