Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: CI

on:
push:
branches: [main, dev]
pull_request:
branches: [main]
pull_request_review:
types: [submitted]

jobs:
test:
if: github.event_name != 'pull_request_review'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dAppCore/build/actions/build/core@dev
with:
go-version: "1.26"
run-vet: "true"

auto-fix:
if: >
github.event_name == 'pull_request_review' &&
github.event.review.user.login == 'coderabbitai' &&
github.event.review.state == 'changes_requested'
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
fetch-depth: 0
- uses: dAppCore/build/actions/fix@dev
with:
go-version: "1.26"

auto-merge:
if: >
github.event_name == 'pull_request_review' &&
github.event.review.user.login == 'coderabbitai' &&
github.event.review.state == 'approved'
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4
- name: Merge PR
run: gh pr merge ${{ github.event.pull_request.number }} --merge --delete-branch
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6 changes: 3 additions & 3 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co

Full-coverage Go client for the Forgejo API (~450 endpoints). Uses a generic `Resource[T,C,U]` pattern for CRUD operations and types generated from `swagger.v1.json`.

**Module:** `forge.lthn.ai/core/go-forge` (Go 1.26, depends on `go-io` and `go-log`)
**Module:** `dappco.re/go/core/forge` (Go 1.26, depends on `go-io` and `go-log`)

## Build & Test

Expand Down Expand Up @@ -51,8 +51,8 @@ The library is a flat package (`package forge`) with a layered design:

- All methods accept `context.Context` as first parameter
- Errors wrapped as `*APIError` with StatusCode, Message, URL; use `IsNotFound()`, `IsForbidden()`, `IsConflict()` helpers
- Internal errors use `coreerr.E()` from `go-log` (imported as `coreerr "forge.lthn.ai/core/go-log"`), never `fmt.Errorf` or `errors.New`
- File I/O uses `go-io` (imported as `coreio "forge.lthn.ai/core/go-io"`), never `os.ReadFile`/`os.WriteFile`/`os.MkdirAll`
- Internal errors use `coreerr.E()` from `go-log` (imported as `coreerr "dappco.re/go/core/log"`), never `fmt.Errorf` or `errors.New`
- File I/O uses `go-io` (imported as `coreio "dappco.re/go/core/io"`), never `os.ReadFile`/`os.WriteFile`/`os.MkdirAll`
- UK English in comments (organisation, colour, etc.)
- `Co-Authored-By: Virgil <virgil@lethean.io>` in commits
- `Client` uses functional options pattern (`WithHTTPClient`, `WithUserAgent`)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[![Go Reference](https://pkg.go.dev/badge/forge.lthn.ai/core/go-forge.svg)](https://pkg.go.dev/forge.lthn.ai/core/go-forge)
[![Go Reference](https://pkg.go.dev/badge/dappco.re/go/core/forge.svg)](https://pkg.go.dev/dappco.re/go/core/forge)
[![License: EUPL-1.2](https://img.shields.io/badge/License-EUPL--1.2-blue.svg)](LICENSE.md)
[![Go Version](https://img.shields.io/badge/Go-1.26-00ADD8?style=flat&logo=go)](go.mod)

# go-forge

Go module: `forge.lthn.ai/core/go-forge`
Go module: `dappco.re/go/core/forge`

## License

Expand Down
2 changes: 1 addition & 1 deletion actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"iter"

"forge.lthn.ai/core/go-forge/types"
"dappco.re/go/core/forge/types"
)

// ActionsService handles CI/CD actions operations across repositories and
Expand Down
2 changes: 1 addition & 1 deletion actions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"net/http/httptest"
"testing"

"forge.lthn.ai/core/go-forge/types"
"dappco.re/go/core/forge/types"
)

func TestActionsService_Good_ListRepoSecrets(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"iter"

"forge.lthn.ai/core/go-forge/types"
"dappco.re/go/core/forge/types"
)

// AdminService handles site administration operations.
Expand Down
2 changes: 1 addition & 1 deletion admin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"net/http/httptest"
"testing"

"forge.lthn.ai/core/go-forge/types"
"dappco.re/go/core/forge/types"
)

func TestAdminService_Good_ListUsers(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion branches.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"iter"

"forge.lthn.ai/core/go-forge/types"
"dappco.re/go/core/forge/types"
)

// BranchService handles branch operations within a repository.
Expand Down
2 changes: 1 addition & 1 deletion branches_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"net/http/httptest"
"testing"

"forge.lthn.ai/core/go-forge/types"
"dappco.re/go/core/forge/types"
)

func TestBranchService_Good_List(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"strconv"
"strings"

coreerr "forge.lthn.ai/core/go-log"
coreerr "dappco.re/go/core/log"
)

// APIError represents an error response from the Forgejo API.
Expand Down
4 changes: 2 additions & 2 deletions cmd/forgegen/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"strings"
"text/template"

coreio "forge.lthn.ai/core/go-io"
coreerr "forge.lthn.ai/core/go-log"
coreio "dappco.re/go/core/io"
coreerr "dappco.re/go/core/log"
)

// typeGrouping maps type name prefixes to output file names.
Expand Down
2 changes: 1 addition & 1 deletion cmd/forgegen/generator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"strings"
"testing"

coreio "forge.lthn.ai/core/go-io"
coreio "dappco.re/go/core/io"
)

func TestGenerate_Good_CreatesFiles(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions cmd/forgegen/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"slices"
"strings"

coreio "forge.lthn.ai/core/go-io"
coreerr "forge.lthn.ai/core/go-log"
coreio "dappco.re/go/core/io"
coreerr "dappco.re/go/core/log"
)

// Spec represents a Swagger 2.0 specification document.
Expand Down
2 changes: 1 addition & 1 deletion commits.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"fmt"

"forge.lthn.ai/core/go-forge/types"
"dappco.re/go/core/forge/types"
)

// CommitService handles commit-related operations such as commit statuses
Expand Down
2 changes: 1 addition & 1 deletion commits_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"net/http/httptest"
"testing"

"forge.lthn.ai/core/go-forge/types"
"dappco.re/go/core/forge/types"
)

func TestCommitService_Good_ListStatuses(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion config.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package forge
import (
"os"

coreerr "forge.lthn.ai/core/go-log"
coreerr "dappco.re/go/core/log"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion contents.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"fmt"

"forge.lthn.ai/core/go-forge/types"
"dappco.re/go/core/forge/types"
)

// ContentService handles file read/write operations via the Forgejo API.
Expand Down
2 changes: 1 addition & 1 deletion contents_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"net/http/httptest"
"testing"

"forge.lthn.ai/core/go-forge/types"
"dappco.re/go/core/forge/types"
)

func TestContentService_Good_GetFile(t *testing.T) {
Expand Down
8 changes: 4 additions & 4 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ description: Full-coverage Go client for the Forgejo API with generics-based CRU

# go-forge

`forge.lthn.ai/core/go-forge` is a Go client library for the [Forgejo](https://forgejo.org) REST API. It provides typed access to 18 API domains (repositories, issues, pull requests, organisations, and more) through a single top-level `Forge` client. Types are generated directly from Forgejo's `swagger.v1.json` specification, keeping the library in lockstep with the server.
`dappco.re/go/core/forge` is a Go client library for the [Forgejo](https://forgejo.org) REST API. It provides typed access to 18 API domains (repositories, issues, pull requests, organisations, and more) through a single top-level `Forge` client. Types are generated directly from Forgejo's `swagger.v1.json` specification, keeping the library in lockstep with the server.

**Module path:** `forge.lthn.ai/core/go-forge`
**Module path:** `dappco.re/go/core/forge`
**Go version:** 1.26+
**Licence:** EUPL-1.2

Expand All @@ -22,7 +22,7 @@ import (
"fmt"
"log"

"forge.lthn.ai/core/go-forge"
"dappco.re/go/core/forge"
)

func main() {
Expand Down Expand Up @@ -145,7 +145,7 @@ Services that embed `Resource[T, C, U]` inherit `List`, `ListAll`, `Iter`, `Get`
This module has **zero external dependencies**. It relies solely on the Go standard library (`net/http`, `encoding/json`, `context`, `iter`, etc.) and requires Go 1.26 or later.

```
module forge.lthn.ai/core/go-forge
module dappco.re/go/core/forge

go 1.26.0
```
2 changes: 1 addition & 1 deletion forge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"net/http/httptest"
"testing"

"forge.lthn.ai/core/go-forge/types"
"dappco.re/go/core/forge/types"
)

func TestForge_Good_NewForge(t *testing.T) {
Expand Down
8 changes: 5 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
module forge.lthn.ai/core/go-forge
module dappco.re/go/core/forge

go 1.26.0

require (
forge.lthn.ai/core/go-io v0.1.7
forge.lthn.ai/core/go-log v0.0.4
dappco.re/go/core/io v0.2.0
dappco.re/go/core/log v0.1.0
)

require forge.lthn.ai/core/go-log v0.0.4 // indirect
6 changes: 4 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
forge.lthn.ai/core/go-io v0.1.7 h1:Tdb6sqh+zz1lsGJaNX9RFWM6MJ/RhSAyxfulLXrJsbk=
forge.lthn.ai/core/go-io v0.1.7/go.mod h1:8lRLFk4Dnp5cR/Cyzh9WclD5566TbpdRgwcH7UZLWn4=
dappco.re/go/core/io v0.2.0 h1:zuudgIiTsQQ5ipVt97saWdGLROovbEB/zdVyy9/l+I4=
dappco.re/go/core/io v0.2.0/go.mod h1:1QnQV6X9LNgFKfm8SkOtR9LLaj3bDcsOIeJOOyjbL5E=
dappco.re/go/core/log v0.1.0 h1:pa71Vq2TD2aoEUQWFKwNcaJ3GBY8HbaNGqtE688Unyc=
dappco.re/go/core/log v0.1.0/go.mod h1:Nkqb8gsXhZAO8VLpx7B8i1iAmohhzqA20b9Zr8VUcJs=
forge.lthn.ai/core/go-log v0.0.4 h1:KTuCEPgFmuM8KJfnyQ8vPOU1Jg654W74h8IJvfQMfv0=
forge.lthn.ai/core/go-log v0.0.4/go.mod h1:r14MXKOD3LF/sI8XUJQhRk/SZHBE7jAFVuCfgkXoZPw=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
Expand Down
2 changes: 1 addition & 1 deletion issues.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"iter"

"forge.lthn.ai/core/go-forge/types"
"dappco.re/go/core/forge/types"
)

// IssueService handles issue operations within a repository.
Expand Down
2 changes: 1 addition & 1 deletion issues_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"net/http/httptest"
"testing"

"forge.lthn.ai/core/go-forge/types"
"dappco.re/go/core/forge/types"
)

func TestIssueService_Good_List(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion labels.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"iter"

"forge.lthn.ai/core/go-forge/types"
"dappco.re/go/core/forge/types"
)

// LabelService handles repository labels, organisation labels, and issue labels.
Expand Down
2 changes: 1 addition & 1 deletion labels_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"net/http/httptest"
"testing"

"forge.lthn.ai/core/go-forge/types"
"dappco.re/go/core/forge/types"
)

func TestLabelService_Good_ListRepoLabels(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion misc.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"fmt"

"forge.lthn.ai/core/go-forge/types"
"dappco.re/go/core/forge/types"
)

// MiscService handles miscellaneous Forgejo API endpoints such as
Expand Down
2 changes: 1 addition & 1 deletion misc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"net/http/httptest"
"testing"

"forge.lthn.ai/core/go-forge/types"
"dappco.re/go/core/forge/types"
)

func TestMiscService_Good_RenderMarkdown(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion notifications.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"iter"

"forge.lthn.ai/core/go-forge/types"
"dappco.re/go/core/forge/types"
)

// NotificationService handles notification operations via the Forgejo API.
Expand Down
2 changes: 1 addition & 1 deletion notifications_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"net/http/httptest"
"testing"

"forge.lthn.ai/core/go-forge/types"
"dappco.re/go/core/forge/types"
)

func TestNotificationService_Good_List(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion orgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"iter"

"forge.lthn.ai/core/go-forge/types"
"dappco.re/go/core/forge/types"
)

// OrgService handles organisation operations.
Expand Down
2 changes: 1 addition & 1 deletion orgs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"net/http/httptest"
"testing"

"forge.lthn.ai/core/go-forge/types"
"dappco.re/go/core/forge/types"
)

func TestOrgService_Good_List(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion packages.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"iter"

"forge.lthn.ai/core/go-forge/types"
"dappco.re/go/core/forge/types"
)

// PackageService handles package registry operations via the Forgejo API.
Expand Down
2 changes: 1 addition & 1 deletion packages_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"net/http/httptest"
"testing"

"forge.lthn.ai/core/go-forge/types"
"dappco.re/go/core/forge/types"
)

func TestPackageService_Good_List(t *testing.T) {
Expand Down
Loading
Loading