refactor(module): migrate module path to dappco.re/go/core/forge
Update Go module path from forge.lthn.ai/core/go-forge to dappco.re/go/core/forge. Migrate all import paths and dependency references (go-io → dappco.re/go/core/io, go-log → dappco.re/go/core/log). Update documentation (CLAUDE.md, README.md, docs/) to reflect new paths. Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
parent
83b4f9da90
commit
0a9564274d
47 changed files with 62 additions and 58 deletions
|
|
@ -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 <virgil@lethean.io>` in commits
|
||||
- `Client` uses functional options pattern (`WithHTTPClient`, `WithUserAgent`)
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
[](https://pkg.go.dev/forge.lthn.ai/core/go-forge)
|
||||
[](https://pkg.go.dev/dappco.re/go/core/forge)
|
||||
[](LICENSE.md)
|
||||
[](go.mod)
|
||||
|
||||
# go-forge
|
||||
|
||||
Go module: `forge.lthn.ai/core/go-forge`
|
||||
Go module: `dappco.re/go/core/forge`
|
||||
|
||||
## License
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
2
admin.go
2
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.
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ package forge
|
|||
import (
|
||||
"os"
|
||||
|
||||
coreerr "forge.lthn.ai/core/go-log"
|
||||
coreerr "dappco.re/go/core/log"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
```
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
8
go.mod
8
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
|
||||
|
|
|
|||
6
go.sum
6
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=
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
2
misc.go
2
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
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
2
orgs.go
2
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.
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import (
|
|||
"net/url"
|
||||
"strconv"
|
||||
|
||||
coreerr "forge.lthn.ai/core/go-log"
|
||||
coreerr "dappco.re/go/core/log"
|
||||
)
|
||||
|
||||
// ListOptions controls pagination.
|
||||
|
|
|
|||
2
pulls.go
2
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.
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
2
repos.go
2
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.
|
||||
|
|
|
|||
2
teams.go
2
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.
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
2
users.go
2
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.
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
2
wiki.go
2
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.
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue