Skip to content

feat(forgejo): add the Forgejo SDK - #541

Open
wyattjoh wants to merge 1 commit into
alchemy-run:mainfrom
wyattjoh:wyattjoh/forgejo
Open

feat(forgejo): add the Forgejo SDK#541
wyattjoh wants to merge 1 commit into
alchemy-run:mainfrom
wyattjoh:wyattjoh/forgejo

Conversation

@wyattjoh

@wyattjoh wyattjoh commented Sep 2, 2026

Copy link
Copy Markdown

Adds @distilled.cloud/forgejo, generated from the Swagger 2.0 template Forgejo ships in its repository at a release tag. The spec-mirror-forgejo fetch script (stacks/distilled-submodules/spec-repos/forgejo) pins the tag (v16.0.3) and fills in the two server-side placeholders the way a root-mounted instance renders them. One service module per API tag.

import * as Forgejo from "@distilled.cloud/forgejo";

const repo = yield* Forgejo.Services.repository.repoGet({ owner: "acme", repo: "api" });
  • Credentials carry the instance URL alongside the token, since a self-hosted forge has no default API root; FORGEJO_URL / FORGEJO_TOKEN drive CredentialsFromEnv.
  • The protocol sends Forgejo's token authorization scheme and reads the { message, url } error envelope.
  • No pagination trait: list endpoints return bare arrays and signal the last page only through X-Total-Count, so page/limit stay plain inputs.

Patches type what the document leaves out:

  • OrganizationOwnsRepositories on orgDelete: Forgejo answers a 500 with user still has ownership of repositories.
  • 403 on the list endpoints (teams, members, labels, hooks, Actions secrets and variables) and 403/404 on the branch-protection list, which declares no failures at all.
  • 409 on createOrgRepo for a taken name, matching what createCurrentUserRepo already declares.
  • adminCreateOrg's path parameter renamed to owner: the body's username (the org login) collided with it and was dropped.
  • required on the always-present members of the response definitions, which the Go structs never omit, and sha1 on AccessToken marked sensitive.

The .gitmodules stanza is the inert one pnpm specs:link writes before the mirror exists; the gitlink follows in a follow-up once the stack has deployed spec-mirror-forgejo.

Consumer: alchemy-run/alchemy#1425.

Add @distilled.cloud/forgejo: one service module per API tag, compiled
from the Swagger 2.0 template Forgejo ships at a release tag. The
spec-mirror-forgejo fetch script (stacks/distilled-submodules/spec-repos/
forgejo) pins the tag and fills in the two server-side placeholders the
way a root-mounted instance renders them. Credentials carry the instance
URL alongside the token, since a self-hosted forge has no default API
root; the protocol sends Forgejo's `token` authorization scheme.

Patches type what the document leaves out: the 500 an organization
delete answers while it still owns repositories, the 403s the list
endpoints answer for a non-member, the 409 an organization repository
create answers for a taken name, the path/body `username` clash on
adminCreateOrg, and the always-present members of the response
definitions the Go structs never omit.
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.

1 participant