httpserver

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2026 License: MIT Imports: 39 Imported by: 0

Documentation

Overview

Package httpserver is gitrakz's only servicepack service: it boots the whole app — SQLite storage + migrations, the gh sync engine, the transform/template engine, the LLM adapters, and an aichteeteapee/serbewr HTTP server mounting the generated API under /api/v1/ plus the embedded Svelte SPA — and runs a background sync ticker for the lifetime of the process.

Index

Constants

View Source
const ServiceName = "http-server"

ServiceName is this service's registry key, matching the folder name convention (http-server -> package httpserver) per wiring-servicepack.md.

Variables

This section is empty.

Functions

func BuildDeps added in v0.7.0

func BuildDeps(cfg config.Config, store *db.Store) (httpapi.Deps, error)

BuildDeps wires every dependency downstream of store: the gh sync engine, the transform registry (the 7 deterministic primitives plus the LLM-backed describe-work and llm-step primitives), the template engine, and the LLM adapters — returning the shared httpapi.Deps both the generated HTTP API (wire, below) and the MCP server (wire, below, and the `gitrakz mcp` stdio command in cmd/) are built from. Exported so cmd/ can wire the exact same production stack without duplicating this logic.

func SeedBuiltinTemplates added in v0.7.0

func SeedBuiltinTemplates(ctx context.Context, store *db.Store) error

SeedBuiltinTemplates upserts every templates.Builtins() entry into store. SaveTemplate is an idempotent upsert (clause.OnConflict on id, UpdateAll), so calling this on every boot is safe and keeps a running service's built-ins in sync with whatever version of the templates package it ships. A seed failure aborts boot, per New's fail-fast contract. Exported so the `gitrakz mcp` stdio command (see cmd/) seeds the same built-ins the HTTP service would.

Types

type Service

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

Service implements servicemanager.Service. New wires every dependency eagerly and fails fast; Run starts the HTTP server and the background sync ticker and blocks until ctx is done; Stop tears both down.

func New

func New() (*Service, error)

New builds every dependency the service needs (config, storage, migrations, the gh sync engine, the transform/template engine, the LLM adapters, and the HTTP server) and fails fast on the first error — no partially-wired Service is ever returned.

func (*Service) Name

func (s *Service) Name() string

Name returns this service's registry key.

func (*Service) Run

func (s *Service) Run(ctx context.Context) error

Run starts the HTTP server and the background sync ticker, and blocks until ctx is done or the server fails. serbewr.Server.Start already performs its own graceful shutdown internally once ctx is done (or Stop is called), so Run does not repeat that step.

func (*Service) Stop

func (s *Service) Stop(ctx context.Context) error

Stop shuts down the HTTP server (a no-op if Run's own shutdown already ran — serbewr.Server.Stop is idempotent) and closes the db store.

Jump to

Keyboard shortcuts

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