Switch Forgejo MR creation from CLI to REST API #21

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

Summary

Switch Forgejo MR/PR creation from CLI (fj) to REST API calls, following the existing issue-fetching pattern.

Motivation

  • Remove the fj CLI dependency for Forgejo-origin repos.
  • Make MR creation deterministic, unit-testable code.
  • Align with how issue fetching already works (REST via ForgejoIssueClient).

Acceptance Criteria

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

Implementation Steps

  1. Create ForgejoMrClient class mirroring ForgejoIssueClient
  2. Update runMrStage to use deterministic git + REST for Forgejo
  3. Remove Forgejo 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 M1)
## Summary Switch Forgejo MR/PR creation from CLI (`fj`) to REST API calls, following the existing issue-fetching pattern. ## Motivation - Remove the `fj` CLI dependency for Forgejo-origin repos. - Make MR creation deterministic, unit-testable code. - Align with how issue fetching already works (REST via `ForgejoIssueClient`). ## Acceptance Criteria - [ ] New `ForgejoMrClient` class in `src/forgejo/services/forgejoMrClient.ts` - [ ] Implements `MrClient` interface with `createMr(input): Promise<CreateMrResult>` - [ ] Uses `POST /api/v1/repos/{owner}/{repo}/pulls` endpoint - [ ] Reuses existing `HttpFetch`/`withRetry` infrastructure - [ ] Git operations (branch, commit, push) handled deterministically via `gitRunner` - [ ] `runMrStage` updated to use `ForgejoMrClient` for `forgejo` platform - [ ] Unit tests for `ForgejoMrClient` (success, 401, 403, 404, 429, 500, malformed response) - [ ] `mr-result.json` schema unchanged - [ ] No remaining references to `fj` CLI in the Forgejo code path ## Implementation Steps 1. Create `ForgejoMrClient` class mirroring `ForgejoIssueClient` 2. Update `runMrStage` to use deterministic git + REST for Forgejo 3. Remove Forgejo 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 M1)
david closed this issue 2026-07-27 02:30:54 +00:00
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#21
No description provided.