feat: bootstrap Go project layout (forgejo-mcp-broker-n84)
- Initialize go.mod with module path kode.naiv.no/olemd/forgejo-mcp-broker
- Create directory layout: cmd/broker + internal/{buildinfo,config,log,store,httpserver}
- Add Makefile with build/test/lint/tidy/clean targets and ldflags-injected build info
- Stub cmd/broker/main.go with --version support; real wiring follows in -t37
- Stub doc.go for each internal/* package, pointing to the issue that fills it in
Closes forgejo-mcp-broker-n84.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
021bf0502d
commit
de5ce2de94
10 changed files with 134 additions and 0 deletions
12
internal/buildinfo/buildinfo.go
Normal file
12
internal/buildinfo/buildinfo.go
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
// Package buildinfo exposes compile-time build metadata.
|
||||
//
|
||||
// Values are injected at link time via -ldflags -X (see the Makefile). When
|
||||
// the binary is built without those flags (e.g. go run, go test), the
|
||||
// placeholder defaults below are used.
|
||||
package buildinfo
|
||||
|
||||
var (
|
||||
Version = "dev"
|
||||
GitRevision = "unknown"
|
||||
BuildDate = "unknown"
|
||||
)
|
||||
21
internal/buildinfo/buildinfo_test.go
Normal file
21
internal/buildinfo/buildinfo_test.go
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
package buildinfo_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"kode.naiv.no/olemd/forgejo-mcp-broker/internal/buildinfo"
|
||||
)
|
||||
|
||||
func TestDefaultsArePopulated(t *testing.T) {
|
||||
// Build-info placeholders must never be empty: they are exposed on /healthz
|
||||
// and an empty value would be observable to operators as a broken build.
|
||||
if buildinfo.Version == "" {
|
||||
t.Error("Version is empty")
|
||||
}
|
||||
if buildinfo.GitRevision == "" {
|
||||
t.Error("GitRevision is empty")
|
||||
}
|
||||
if buildinfo.BuildDate == "" {
|
||||
t.Error("BuildDate is empty")
|
||||
}
|
||||
}
|
||||
5
internal/config/doc.go
Normal file
5
internal/config/doc.go
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
// Package config loads broker configuration from flags and environment
|
||||
// variables, applies defaults, and validates the result.
|
||||
//
|
||||
// Implementation lands in forgejo-mcp-broker-9nq.
|
||||
package config
|
||||
6
internal/httpserver/doc.go
Normal file
6
internal/httpserver/doc.go
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
// Package httpserver hosts the broker's HTTP surface: OAuth endpoints, the
|
||||
// gated MCP endpoint, and /healthz. Owns an *http.Server with graceful
|
||||
// shutdown on SIGTERM / SIGINT.
|
||||
//
|
||||
// Implementation lands in forgejo-mcp-broker-8ei.
|
||||
package httpserver
|
||||
6
internal/log/doc.go
Normal file
6
internal/log/doc.go
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
// Package log constructs the process-wide structured logger (log/slog, JSON
|
||||
// handler to stderr) and provides small helpers for attaching build-info and
|
||||
// request-scoped fields.
|
||||
//
|
||||
// Implementation lands alongside forgejo-mcp-broker-8ei / t37.
|
||||
package log
|
||||
6
internal/store/doc.go
Normal file
6
internal/store/doc.go
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
// Package store opens the SQLite-backed persistence layer used by the broker
|
||||
// for OAuth clients, authorization codes, access tokens, and refresh tokens.
|
||||
// Migrations are embedded via embed.FS and applied on open.
|
||||
//
|
||||
// Implementation lands in forgejo-mcp-broker-9jh.
|
||||
package store
|
||||
Loading…
Add table
Add a link
Reference in a new issue