feat(forge): add forge.Client interface for forge-agnostic API access#602
feat(forge): add forge.Client interface for forge-agnostic API access#602nextlevelshit merged 2 commits intomainfrom
Conversation
Introduce a forge.Client interface with forge-neutral domain types (Issue, PullRequest) and a GitHub adapter wrapping the existing github.Client. Includes token resolution for GitHub, GitLab, Bitbucket, and Gitea, plus an UnsupportedClient stub for non-GitHub forges. Replace all *github.Client usage in webui, doctor, and TUI packages with forge.Client, consolidating duplicated resolveGitHubToken() and detectRepoSlug() functions into the forge package. Closes #600
Code Review (Wave Pipeline)Overall Verdict: REQUEST_CHANGES This PR introduces a well-designed However, one issue must be fixed before merge. Critical Issues (must fix)1.
|
…lient Fixes review finding: UnsupportedClient broke nil-guard pattern causing cryptic errors for non-GitHub forge users. Also removes unused ErrNotConfigured, adds nil validation to NewGitHubClient, and fixes gofmt alignment.
- Remove duplicate replaceBoth block in context.go (lines 110-113) - Hoist 4 regexes to package-level vars in context.go (compiled once) - Log forge API errors in doctor instead of silently swallowing - Add assertions to SSH-with-port test (was a no-op) - Add 5s timeout to `gh auth token` subprocess via CommandContext - Simplify TUI forge detection (remove redundant Detect call)
feat(forge): add forge.Client interface for forge-agnostic API access
- Remove duplicate replaceBoth block in context.go (lines 110-113) - Hoist 4 regexes to package-level vars in context.go (compiled once) - Log forge API errors in doctor instead of silently swallowing - Add assertions to SSH-with-port test (was a no-op) - Add 5s timeout to `gh auth token` subprocess via CommandContext - Simplify TUI forge detection (remove redundant Detect call)
Summary
forge.Clientinterface with forge-neutral domain types (Issue,PullRequest) and options types*github.Clientwith type conversion layerUnsupportedClientstub for GitLab/Bitbucket/Gitea (returnsErrNotSupported)ResolveToken) for all 4 forge types, eliminating 3 duplicateresolveGitHubToken()functions*github.Clientin webui server, doctor, and TUI withforge.Clientforge.DetectFromGitRemotes()+ForgeInfo.Slug()to replacedetectRepoSlug()Test plan
go test -race ./...— all 36 packages passforge/client_test.go(interface satisfaction, UnsupportedClient)forge/github_test.go(conversion functions, nil handling, IsPR flag)forge/token_test.go(env var resolution for all 4 forge types, factory)Closes #600