- Use the Go version from
go.mod(currently 1.27); README development text may lag it. - Format changed Go files with
gofmt -w <files>. - Run focused tests with
go test ./internal/<package>orgo test ./internal/<package> -run '^TestName$'. - Before finishing, run the CI-equivalent Go checks:
go vet ./...andgo test ./.... - Unit tests inject fake repository commands and do not require Arch Linux or pacman tooling.
- For web changes, also run the exact HTML/CSS commands documented in
internal/httpapi/AGENTS.md.
cmd/pkgdepotis the only binary. Its top-level commands arelogin,logout,serve,package, andrepo.- Server wiring flows from
internal/configtointernal/repositorytointernal/httpapi; keep storage and package-database behavior inrepository, not HTTP handlers. - CLI commands use
internal/httpclient;internal/apiis the stable JSON boundary shared by server and client. internal/alpmparses package archives and gzip repository databases directly; there is no libalpm dependency.- Repository state lives below the data root in
repositories/,staging/, andlocks/. Each database isrepositories/<repo>/<arch>/<repo>.db.tar.gz.
- The server is an OAuth 2.0 protected resource; list/download routes are public and mutations require operation-specific scopes. Identity-provider client restrictions, not local user/role mappings, determine who receives those scopes.
- The CLI discovers RFC 9728 protected-resource metadata and then OIDC metadata. Generic RFC 8414-only providers and direct endpoint overrides are unsupported.
- Keep OAuth mechanics in
golang.org/x/oauth2, OIDC discovery/validation ingo-oidc, URL trust rules ininternal/urlpolicy, and authorization policy ininternal/auth. PKGDEPOT_OIDC_*configures the server;PKGDEPOT_OAUTH_*configures CLI clients. Do not interchange them.
servedefaults to:8080and/var/lib/pkgdepot; configure mutation access through the OIDC provider.- Real mutations execute absolute
/usr/bin/repo-addand/usr/bin/repo-removepaths with--wait-for-lock; changingPATHdoes not substitute them. The Docker runtime must also provide these paths. - Call
repository.Service.Initializebefore serving or publishing so the staging and lock roots exist. - Publish/remove operations are serialized per repository and architecture with both an in-process mutex and filesystem
flock; preserve both layers when changing mutation flow. - Published packages must target the requested architecture or
any. Repository and architecture values, plus package names passed to removal, are restricted bycomponentPatternininternal/repository/service.go.
- Keep the root
README.mdfocused on user installation, deployment, provider configuration, CLI use, and concise developer setup. - Put repository-wide contributor and maintainer rules here. Put implementation contracts in the owning package's
AGENTS.md; do not duplicate protocol mechanics in the README.
- A valid v-prefixed SemVer tag publishes a Linux/amd64
tar.gzarchive, checksums, and a versioned Linux/amd64 GHCR image. - Pushes to
mainpublishghcr.io/trly/pkgdepot:latestfor Linux/amd64. Release mechanics belong here rather than in the user-facing README.