http

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 3, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package http is the REST API server that backs `clu web`. It exposes the internal/store surface as JSON over net/http so the web UI (and any other client) can drive the tracker without shelling out.

Layout mirrors internal/store:

server.go       Server struct, mux, helpers
issues.go       /api/issues (list, create, get, patch, close, reopen, claim)
labels.go       /api/issues/:id/labels
deps.go         /api/issues/:id/deps
comments.go     /api/issues/:id/comments
checkpoints.go  /api/checkpoints/:id/approve|fail
meta.go         /api/meta, /api/agents, /api/tags

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server is the REST API bound to a single Store. Construct with New, then call Start(ctx) before serving so the change-stream broker begins polling. Mux returns the routed handler.

func New

func New(s *store.Store) *Server

New constructs a Server. Background goroutines don't start until Start(ctx) is called.

func (*Server) Mux

func (s *Server) Mux() stdhttp.Handler

Mux returns the routed handler. Routes use Go 1.22 method-aware patterns ("GET /api/issues", "PATCH /api/issues/{id}"); the package requires Go ≥ 1.22, which the project already uses (see go.mod).

func (*Server) Start

func (s *Server) Start(ctx context.Context)

Start launches background goroutines (currently: the change-stream poll loop that fans out to /api/events subscribers). They exit when ctx is cancelled. Idempotent for tests is not guaranteed — call once per server lifetime.

func (*Server) WithTemplatesDir

func (s *Server) WithTemplatesDir(dir string) *Server

WithTemplatesDir tells the server where to load workflow templates from. Defaults to disabled — /api/templates returns 503 until set. Wired by the CLI from `<project-dir>/templates`.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL