Skip to content
quarry Artifact [39d53eea5d]
Login

Artifact [39d53eea5d]

Artifact 39d53eea5d406b5804731b76b032315b9f730097501a388ab75d84a1406a3898:


// Package api owns RegisterAll — the one explicit wiring point where every
// op joins the registry (0003 §2: no init() magic; the wiring stays
// greppable). Consumers build a registry by calling RegisterAll exactly
// once at startup.
package api

import (
	"context"

	"craftdesign.group/quarry/internal/ops"
)

type versionIn struct{}

type versionOut struct {
	Version string `json:"version"`
}

// RegisterAll wires every op. version is the build-stamped quarry version
// (0001 Principle 1: every surface reports it).
func RegisterAll(r *ops.Registry, version string) error {
	return ops.Register(r, ops.Op[versionIn, versionOut]{
		Name:  "meta.version",
		Doc:   "Report the quarry build version.",
		Kind:  ops.Query,
		Auth:  ops.Anonymous,
		Route: "GET /api/v1/version",
		Run: func(_ context.Context, _ versionIn) (versionOut, error) {
			return versionOut{Version: version}, nil
		},
	})
}