Switch GitHub PR creation from CLI to REST API #22

Open
opened 2026-07-25 21:46:34 +00:00 by david · 0 comments
Owner

Summary

Switch GitHub PR creation from CLI (gh) to REST API calls, following the existing issue-fetching pattern.

Motivation

  • Remove the gh CLI dependency for GitHub-origin repos.
  • Make PR creation deterministic, unit-testable code.
  • Align with how issue fetching already works (REST via GitHubIssueClient).

Acceptance Criteria

  • New GitHubMrClient class in src/github/services/gitHubMrClient.ts
  • Implements MrClient interface with createMr(input): Promise<CreateMrResult>
  • Uses POST /repos/{owner}/{repo}/pulls endpoint
  • Reuses existing HttpFetch/withRetry infrastructure
  • Git operations (branch, commit, push) handled deterministically via gitRunner
  • runMrStage updated to use GitHubMrClient for github platform
  • Unit tests for GitHubMrClient (success, 401, 403, 404, 429, 500, malformed response)
  • mr-result.json schema unchanged
  • No remaining references to gh CLI in the GitHub code path

Implementation Steps

  1. Create GitHubMrClient class mirroring GitHubIssueClient
  2. Update runMrStage to use deterministic git + REST for GitHub
  3. Remove GitHub CLI guidance from defaultMrSkillBody
  4. Add unit tests
  5. Verify npm test and npm run lint pass
  • Design doc: docs/design-rest-mr-creation.md
  • Implementation plan: docs/implementation-plan-rest-mr.md (Milestone M2)
  • See also: Forgejo (#21), GitLab (#22) sibling issues
## Summary Switch GitHub PR creation from CLI (`gh`) to REST API calls, following the existing issue-fetching pattern. ## Motivation - Remove the `gh` CLI dependency for GitHub-origin repos. - Make PR creation deterministic, unit-testable code. - Align with how issue fetching already works (REST via `GitHubIssueClient`). ## Acceptance Criteria - [ ] New `GitHubMrClient` class in `src/github/services/gitHubMrClient.ts` - [ ] Implements `MrClient` interface with `createMr(input): Promise<CreateMrResult>` - [ ] Uses `POST /repos/{owner}/{repo}/pulls` endpoint - [ ] Reuses existing `HttpFetch`/`withRetry` infrastructure - [ ] Git operations (branch, commit, push) handled deterministically via `gitRunner` - [ ] `runMrStage` updated to use `GitHubMrClient` for `github` platform - [ ] Unit tests for `GitHubMrClient` (success, 401, 403, 404, 429, 500, malformed response) - [ ] `mr-result.json` schema unchanged - [ ] No remaining references to `gh` CLI in the GitHub code path ## Implementation Steps 1. Create `GitHubMrClient` class mirroring `GitHubIssueClient` 2. Update `runMrStage` to use deterministic git + REST for GitHub 3. Remove GitHub CLI guidance from `defaultMrSkillBody` 4. Add unit tests 5. Verify `npm test` and `npm run lint` pass ## Related - Design doc: `docs/design-rest-mr-creation.md` - Implementation plan: `docs/implementation-plan-rest-mr.md` (Milestone M2) - See also: Forgejo (#21), GitLab (#22) sibling issues
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
david/pi-loop#22
No description provided.