Skip to content

Extract and type the GitHub client module #618

Description

@itsmiso-ai

Parent umbrella issue: #616
Source audit: Weekly tech debt audit: dispatch - 2026-07-15
Source audit date: 2026-07-15

Recommendation

Problem: src/lib/github.ts is 1049 lines spanning JWT auth, issue CRUD, PR queries, CI log fetching, code search, and repo metadata. One helper (fetchRepoJson) returns Promise<any>. Module bloat makes it hard to reason about, test in isolation, and change without risk.

Evidence:

  • src/lib/github.ts — 1049 lines
  • Line 529: async function fetchRepoJson(repoFullName: string, errorPrefix: string): Promise<any>
  • Mixed responsibilities: auth setup (lines 14–100), issue fetch (lines 150–250), PR logic (lines 260–520), log fetching (lines 808–878), code search (lines 1006–1049)

Acceptance: Split into github-auth.ts, github-issues.ts, github-ci.ts, github-code-search.ts (or equivalent domain files). fetchRepoJson typed with Record<string, unknown> instead of any. Each new file under 400 lines.

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