Gitea/Forgejo adapter for v1 operations #6

Closed
opened 2026-10-01 21:55:16 -05:00 by deadstyle · 1 comment
Owner

Problem

v1 targets Forgejo/Gitea. The core and UI need a real adapter that implements the Forge interface against git.bobparsons.dev for every v1 operation.

Plan

Implement internal/forge/gitea, using the client chosen in the SDK spike:

  • list repos for the current user, sorted by last activity (compute it if the API's "updated" isn't accurate enough; see docs/architecture.md)
  • list, get, merge, close change requests, including CI state from commit statuses
  • approve (the forge.Approver capability)
  • list issues (excluding PRs), edit an issue body (for Renovate dashboard ticks), comment, close
  • list releases
  • Actions capabilities, limited to what the Actions spike found available
  • pagination, ErrNotFound/ErrUnauthorized/ErrRateLimited mapping, Forgejo/Gitea version detection

Tests: run the forgetest contract suite against httptest servers that serve recorded responses from testdata/.

Plan-review additions (#17)

  • Report capability availability per the shape #4 settles: adapter support, plus server-version gates (detected once at connect) and repo permissions (from the repo's permissions field), each with a disabled reason.
  • Merge sends head_commit_id from MergeOpts; a mismatch maps to a distinct, typed error so the UI can say "this PR changed since you confirmed".
  • Comment and Close route on the typed resource reference from #4.

Depends on

The SDK spike, the domain model / Forge interface ticket, and the Actions spike (for the Actions capabilities only).

Context

  • docs/architecture.md → API mapping (Gitea / Forgejo column).
  • ADR 0002, and go-development → Layering (no SDK type leaves the adapter) and Errors.

Out of scope

The GitHub and GitLab adapters.

## Problem v1 targets Forgejo/Gitea. The core and UI need a real adapter that implements the `Forge` interface against git.bobparsons.dev for every v1 operation. ## Plan Implement `internal/forge/gitea`, using the client chosen in the SDK spike: - list repos for the current user, sorted by last activity (compute it if the API's "updated" isn't accurate enough; see `docs/architecture.md`) - list, get, merge, close change requests, including CI state from commit statuses - approve (the `forge.Approver` capability) - list issues (excluding PRs), edit an issue body (for Renovate dashboard ticks), comment, close - list releases - Actions capabilities, limited to what the Actions spike found available - pagination, `ErrNotFound`/`ErrUnauthorized`/`ErrRateLimited` mapping, Forgejo/Gitea version detection Tests: run the `forgetest` contract suite against `httptest` servers that serve recorded responses from `testdata/`. ### Plan-review additions (#17) - Report capability availability per the shape #4 settles: adapter support, plus server-version gates (detected once at connect) and repo permissions (from the repo's `permissions` field), each with a disabled reason. - Merge sends `head_commit_id` from `MergeOpts`; a mismatch maps to a distinct, typed error so the UI can say "this PR changed since you confirmed". - Comment and Close route on the typed resource reference from #4. ## Depends on The SDK spike, the domain model / `Forge` interface ticket, and the Actions spike (for the Actions capabilities only). ## Context - `docs/architecture.md` → API mapping (Gitea / Forgejo column). - ADR 0002, and `go-development` → Layering (no SDK type leaves the adapter) and Errors. ## Out of scope The GitHub and GitLab adapters.
Author
Owner

🤖 Merged in #27. lazyforge can now sign in to a Forgejo or Gitea host, list repos with your access level, read and merge PRs (a merge refuses if the PR changed since you looked), read and edit issues, comment, close, list releases, and on Forgejo list Actions runs, jobs and logs.

🤖 Merged in #27. lazyforge can now sign in to a Forgejo or Gitea host, list repos with your access level, read and merge PRs (a merge refuses if the PR changed since you looked), read and edit issues, comment, close, list releases, and on Forgejo list Actions runs, jobs and logs.
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
deadstyle/lazyforge#6
No description provided.