8000 refactor(gh): split the GitHub adapter by what it reads by dominikwozniak · Pull Request #136 · dominikwozniak/dw-mc · GitHub
[go: up one dir, main page]

Skip to content

refactor(gh): split the GitHub adapter by what it reads - #136

Merged
dominikwozniak merged 1 commit into
mainfrom
refactor/122-split-gh-adapter
Sep 22, 2026
Merged

dominikwozniak merged 1 commit into
mainfrom
refactor/122-split-gh-adapter

Conversation

@dominikwozniak
Copy link
Copy Markdown
Owner

src/adapters/gh.ts holds 502 lines, which is over the repository's source-file limit. The split follows what each call reads, not where the line count falls. gh.ts keeps only the boundary that every call to GitHub crosses. Each call sits in the module for the thing it reads, next to ci.ts, conversation.ts and label.ts, and every read keeps its fixture beside it as ADR 0006 requires.

Closes #122

What changes

  • src/adapters/gh.ts checks whether gh runs and who it runs as. It also names the current repository and defines readJson and failedAs.
  • src/adapters/pr.ts holds the reads of the pull request itself: search, view, list, commits, compare, the mappers for GitHub's words, and mergePr. prViewOf sits beside prView.
  • src/adapters/ci.ts owns CheckEntry. src/adapters/conversation.ts owns the REST reads of comments and reviews that a sweep makes, which the glossary counts as part of the conversation.
  • ADR 0006 says prViewOf lives in pr.ts.

Test plan

  • pnpm check passes: 856/856 tests.
  • The 13 cases from gh.test.ts now sit beside the module each one covers: gh.test.ts, pr.test.ts, conversation.test.ts.
  • no-gh-writes still passes. Every "gh" literal and its argument array stay inline at the call site.

Risk

None: the moved code is byte-identical, and only imports and the doc comments at the top of each module are new.

🤖 Generated with Claude Code

gh.ts had reached 502 lines, over the repository's source-file limit. It now
holds only the boundary every read crosses: whether gh runs and as whom, the
current repository, and readJson/failedAs. The reads move beside it by what
they read, the way ci.ts, conversation.ts and label.ts already do: the pull
request itself into pr.ts with prViewOf beside prView, the rollup entry into
ci.ts, and the REST comment and review reads into conversation.ts, which the
glossary already names as everything said on a PR.

Every gh literal stays at its call site, so no-gh-writes still sees it.

Closes #122

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@dominikwozniak
dominikwozniak merged commit a787dea into main Sep 22, 2026
1 check passed
@dominikwozniak
dominikwozniak deleted the refactor/122-split-gh-adapter branch September 22, 2026 16:30
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.

refactor(gh): split the GitHub adapter before the next read lands in it

1 participant

0