Skip to content

refactor(#443): consolidate remaining gh CLI calls into GitHubProvider - #470

Merged
admarble merged 3 commits into
mainfrom
feature/443-consolidate-remaining-gh-cli-calls-into-githubprov
Mar 26, 2026
Merged

admarble merged 3 commits into
mainfrom
feature/443-consolidate-remaining-gh-cli-calls-into-githubprov

Conversation

@admarble

Copy link
Copy Markdown
Contributor

Summary

  • Route all 9 remaining direct gh CLI invocations (across 4 modules) through GitHubProvider
  • Add 7 new repo-aware sync methods to GitHubProvider for upstream/utility callers
  • Remove orphaned execCommand helpers from upstream modules
  • Update assessment tests to mock GitHubProvider instead of raw spawn

AC Verification

AC Description Status Evidence
AC-1 No direct gh CLI calls outside github.ts ✅ grep scan confirms zero matches
AC-2 Existing tests continue to pass ✅ 2281/2282 pass (1 pre-existing flaky timeout)
AC-3 Skills and hooks out of scope ✅ No .claude/skills/ or hook files modified
AC-4 Unit tests for new methods ✅ 15 new tests in github.test.ts
AC-5 Remove orphaned execCommand helpers ✅ grep confirms zero matches in upstream/

Test plan

  • npm run build passes
  • npm run lint passes
  • npm test — 2281 passed, 1 known flaky timeout (pre-existing)
  • grep verification: spawnSync("gh" only in github.ts

Closes #443

Route all 9 remaining direct gh CLI invocations through GitHubProvider:
- merge-check/index.ts: fetchIssueTitle → GitHubProvider.fetchIssueTitleSync
- worktree-discovery.ts: fetchIssueTitle → GitHubProvider.fetchIssueTitleSync
- upstream/assessment.ts: gh --version, gh auth status, gh release view/list
  → GitHubProvider.checkGhInstalledSync, checkAuthSync, fetchReleaseSync, listReleasesSync
- upstream/issues.ts: gh issue list/create/comment
  → GitHubProvider.searchIssuesSync, createIssueWithBodyFileSync, commentOnIssueWithBodyFileSync

Remove orphaned execCommand helpers from upstream modules.
Add unit tests for all new GitHubProvider methods.
The issues.ts module had zero test coverage for 5 exported async
functions that use the GitHubProvider singleton (checkForDuplicate,
createIssue, addIssueComment, createOrLinkFinding, createAssessmentIssue).
Adds 29 tests covering success paths, error handling, temp file cleanup,
input validation, and dry run behavior.
The assessment.ts module had zero test coverage for fetchRelease,
listReleases, and getReleasesSince — all now routed through the
GitHubProvider singleton. Hoists mockFetchReleaseSync and
mockListReleasesSync for test control and adds 14 tests covering
success paths, error handling, validation, and arg verification.
@admarble
admarble merged commit 839ba0f into main Mar 26, 2026
5 checks passed
@admarble
admarble deleted the feature/443-consolidate-remaining-gh-cli-calls-into-githubprov branch April 6, 2026 21:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Consolidate remaining gh CLI calls into GitHubProvider

1 participant