diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..4963a87 --- /dev/null +++ b/.github/workflows/ci.yml @@ -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 }} diff --git a/CLAUDE.md b/CLAUDE.md index b3f56a2..1c1fe29 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -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 @@ -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 ` in commits - `Client` uses functional options pattern (`WithHTTPClient`, `WithUserAgent`) diff --git a/README.md b/README.md index c7f76c7..a62f79b 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/actions.go b/actions.go index dad82c0..ba110b8 100644 --- a/actions.go +++ b/actions.go @@ -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 diff --git a/actions_test.go b/actions_test.go index ea648e0..9304440 100644 --- a/actions_test.go +++ b/actions_test.go @@ -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) { diff --git a/admin.go b/admin.go index f621251..a887316 100644 --- a/admin.go +++ b/admin.go @@ -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. diff --git a/admin_test.go b/admin_test.go index 79566a7..8901d7f 100644 --- a/admin_test.go +++ b/admin_test.go @@ -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) { diff --git a/branches.go b/branches.go index ab2e903..66af9a4 100644 --- a/branches.go +++ b/branches.go @@ -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. diff --git a/branches_test.go b/branches_test.go index 7e4a2d1..22d1302 100644 --- a/branches_test.go +++ b/branches_test.go @@ -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) { diff --git a/client.go b/client.go index 8b7cd06..cb10233 100644 --- a/client.go +++ b/client.go @@ -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. diff --git a/cmd/forgegen/generator.go b/cmd/forgegen/generator.go index e1beb25..aea2da5 100644 --- a/cmd/forgegen/generator.go +++ b/cmd/forgegen/generator.go @@ -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. diff --git a/cmd/forgegen/generator_test.go b/cmd/forgegen/generator_test.go index fcad069..9f60e45 100644 --- a/cmd/forgegen/generator_test.go +++ b/cmd/forgegen/generator_test.go @@ -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) { diff --git a/cmd/forgegen/parser.go b/cmd/forgegen/parser.go index a667fb1..f32bb8e 100644 --- a/cmd/forgegen/parser.go +++ b/cmd/forgegen/parser.go @@ -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. diff --git a/commits.go b/commits.go index 95fa8d2..1c38c82 100644 --- a/commits.go +++ b/commits.go @@ -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 diff --git a/commits_test.go b/commits_test.go index d96d467..4c44a0f 100644 --- a/commits_test.go +++ b/commits_test.go @@ -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) { diff --git a/config.go b/config.go index afa48c5..b4ad6fa 100644 --- a/config.go +++ b/config.go @@ -3,7 +3,7 @@ package forge import ( "os" - coreerr "forge.lthn.ai/core/go-log" + coreerr "dappco.re/go/core/log" ) const ( diff --git a/contents.go b/contents.go index 6e74973..8a6f48e 100644 --- a/contents.go +++ b/contents.go @@ -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. diff --git a/contents_test.go b/contents_test.go index 4208b2b..1716276 100644 --- a/contents_test.go +++ b/contents_test.go @@ -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) { diff --git a/docs/index.md b/docs/index.md index 53ce237..18e5d58 100644 --- a/docs/index.md +++ b/docs/index.md @@ -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 @@ -22,7 +22,7 @@ import ( "fmt" "log" - "forge.lthn.ai/core/go-forge" + "dappco.re/go/core/forge" ) func main() { @@ -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 ``` diff --git a/forge_test.go b/forge_test.go index 6ea3631..c13feaa 100644 --- a/forge_test.go +++ b/forge_test.go @@ -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) { diff --git a/go.mod b/go.mod index bad9b62..f973b82 100644 --- a/go.mod +++ b/go.mod @@ -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 diff --git a/go.sum b/go.sum index 6562a5f..76d01ec 100644 --- a/go.sum +++ b/go.sum @@ -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= diff --git a/issues.go b/issues.go index 11dc441..a6ab01d 100644 --- a/issues.go +++ b/issues.go @@ -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. diff --git a/issues_test.go b/issues_test.go index 273763c..8ad5fbf 100644 --- a/issues_test.go +++ b/issues_test.go @@ -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) { diff --git a/labels.go b/labels.go index 5f8d4a8..acb1146 100644 --- a/labels.go +++ b/labels.go @@ -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. diff --git a/labels_test.go b/labels_test.go index d461be6..c4af73d 100644 --- a/labels_test.go +++ b/labels_test.go @@ -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) { diff --git a/misc.go b/misc.go index 62b4a83..b05526a 100644 --- a/misc.go +++ b/misc.go @@ -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 diff --git a/misc_test.go b/misc_test.go index 9d922bc..25cf7f4 100644 --- a/misc_test.go +++ b/misc_test.go @@ -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) { diff --git a/notifications.go b/notifications.go index ccefaae..e3b8af2 100644 --- a/notifications.go +++ b/notifications.go @@ -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. diff --git a/notifications_test.go b/notifications_test.go index e461996..a497451 100644 --- a/notifications_test.go +++ b/notifications_test.go @@ -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) { diff --git a/orgs.go b/orgs.go index 7c4ed27..36d4dc2 100644 --- a/orgs.go +++ b/orgs.go @@ -5,7 +5,7 @@ import ( "fmt" "iter" - "forge.lthn.ai/core/go-forge/types" + "dappco.re/go/core/forge/types" ) // OrgService handles organisation operations. diff --git a/orgs_test.go b/orgs_test.go index 57d3ad2..bec5198 100644 --- a/orgs_test.go +++ b/orgs_test.go @@ -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) { diff --git a/packages.go b/packages.go index 4fc9133..ee724ea 100644 --- a/packages.go +++ b/packages.go @@ -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. diff --git a/packages_test.go b/packages_test.go index 1c45332..a8cfc8d 100644 --- a/packages_test.go +++ b/packages_test.go @@ -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) { diff --git a/pagination.go b/pagination.go index d72d43b..26e8565 100644 --- a/pagination.go +++ b/pagination.go @@ -7,7 +7,7 @@ import ( "net/url" "strconv" - coreerr "forge.lthn.ai/core/go-log" + coreerr "dappco.re/go/core/log" ) // ListOptions controls pagination. diff --git a/pulls.go b/pulls.go index 1bdf582..408f438 100644 --- a/pulls.go +++ b/pulls.go @@ -5,7 +5,7 @@ import ( "fmt" "iter" - "forge.lthn.ai/core/go-forge/types" + "dappco.re/go/core/forge/types" ) // PullService handles pull request operations within a repository. diff --git a/pulls_test.go b/pulls_test.go index 3800911..cdc9512 100644 --- a/pulls_test.go +++ b/pulls_test.go @@ -7,7 +7,7 @@ import ( "net/http/httptest" "testing" - "forge.lthn.ai/core/go-forge/types" + "dappco.re/go/core/forge/types" ) func TestPullService_Good_List(t *testing.T) { diff --git a/releases.go b/releases.go index ef3287c..ae32d49 100644 --- a/releases.go +++ b/releases.go @@ -5,7 +5,7 @@ import ( "fmt" "iter" - "forge.lthn.ai/core/go-forge/types" + "dappco.re/go/core/forge/types" ) // ReleaseService handles release operations within a repository. diff --git a/releases_test.go b/releases_test.go index ef7f933..1520fd2 100644 --- a/releases_test.go +++ b/releases_test.go @@ -7,7 +7,7 @@ import ( "net/http/httptest" "testing" - "forge.lthn.ai/core/go-forge/types" + "dappco.re/go/core/forge/types" ) func TestReleaseService_Good_List(t *testing.T) { diff --git a/repos.go b/repos.go index 8bfb39e..13a9f0b 100644 --- a/repos.go +++ b/repos.go @@ -4,7 +4,7 @@ import ( "context" "iter" - "forge.lthn.ai/core/go-forge/types" + "dappco.re/go/core/forge/types" ) // RepoService handles repository operations. diff --git a/teams.go b/teams.go index cdd81f3..32470ec 100644 --- a/teams.go +++ b/teams.go @@ -5,7 +5,7 @@ import ( "fmt" "iter" - "forge.lthn.ai/core/go-forge/types" + "dappco.re/go/core/forge/types" ) // TeamService handles team operations. diff --git a/teams_test.go b/teams_test.go index cc93e48..dc2d9f0 100644 --- a/teams_test.go +++ b/teams_test.go @@ -7,7 +7,7 @@ import ( "net/http/httptest" "testing" - "forge.lthn.ai/core/go-forge/types" + "dappco.re/go/core/forge/types" ) func TestTeamService_Good_Get(t *testing.T) { diff --git a/users.go b/users.go index efaa13b..2aba489 100644 --- a/users.go +++ b/users.go @@ -5,7 +5,7 @@ import ( "fmt" "iter" - "forge.lthn.ai/core/go-forge/types" + "dappco.re/go/core/forge/types" ) // UserService handles user operations. diff --git a/users_test.go b/users_test.go index 63faae7..015f7f8 100644 --- a/users_test.go +++ b/users_test.go @@ -7,7 +7,7 @@ import ( "net/http/httptest" "testing" - "forge.lthn.ai/core/go-forge/types" + "dappco.re/go/core/forge/types" ) func TestUserService_Good_Get(t *testing.T) { diff --git a/webhooks.go b/webhooks.go index 8a55026..b814b28 100644 --- a/webhooks.go +++ b/webhooks.go @@ -5,7 +5,7 @@ import ( "fmt" "iter" - "forge.lthn.ai/core/go-forge/types" + "dappco.re/go/core/forge/types" ) // WebhookService handles webhook (hook) operations within a repository. diff --git a/webhooks_test.go b/webhooks_test.go index 5368152..4098061 100644 --- a/webhooks_test.go +++ b/webhooks_test.go @@ -7,7 +7,7 @@ import ( "net/http/httptest" "testing" - "forge.lthn.ai/core/go-forge/types" + "dappco.re/go/core/forge/types" ) func TestWebhookService_Good_List(t *testing.T) { diff --git a/wiki.go b/wiki.go index 6c109e5..898c5ca 100644 --- a/wiki.go +++ b/wiki.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - "forge.lthn.ai/core/go-forge/types" + "dappco.re/go/core/forge/types" ) // WikiService handles wiki page operations for a repository. diff --git a/wiki_test.go b/wiki_test.go index 58138e2..7889f78 100644 --- a/wiki_test.go +++ b/wiki_test.go @@ -7,7 +7,7 @@ import ( "net/http/httptest" "testing" - "forge.lthn.ai/core/go-forge/types" + "dappco.re/go/core/forge/types" ) func TestWikiService_Good_ListPages(t *testing.T) {