webui

package
v1.45.1 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: MIT Imports: 43 Imported by: 0

Documentation

Overview

Package webui serves the browser-based GUI: the same review workflow as the TUI — pick an instance, browse MRs, read the diff, comment, run a review, curate findings, publish — rendered as HTML over a loopback-only HTTP server. It is a second frontend over the same core packages (gitlabx, review/runner, review/publisher, resultstore, runlog); no review logic lives here.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Deps

type Deps struct {
	Cfg      config.Config
	Svc      gitlabx.Service
	Reviewer review.Reviewer
	// Chatter answers conversational questions about an MR inside its
	// checkout; nil disables the chat pages.
	Chatter  review.Chatter
	Checkout runner.CheckoutFunc
	CfgFor   func(projectPath string) config.Config
	// Agents is the catalog of available review agents (builtins + user
	// agents); nil means builtins only.
	Agents *agents.Catalog
	// Selection remembers the last agent selection per project; nil is a
	// no-op store.
	Selection *agents.SelectionStore
	// ProjectAgents caches the repo-shipped agent definitions the review
	// form fetches over the API, per (project, MR head); nil fetches
	// uncached.
	ProjectAgents *agents.RemoteCache
	Logs          *runlog.Store
	Results       *resultstore.Store
}

Deps bundles everything the handlers need for one GitLab instance. CfgFor resolves per-project overrides on top of the instance's configuration.

type Options

type Options struct {
	// Instances are the selectable GitLab instance names, in config order.
	// Empty means a single unnamed instance served as "default".
	Instances []string
	// MakeDeps builds the dependencies for one instance; called lazily on
	// first use and cached. It may fail (e.g. an unset token_env variable),
	// which surfaces as an error page for that instance only.
	MakeDeps func(instance string) (*Deps, error)
	// ReviewsDir is where run logs and result records live; record and log
	// links are validated against it.
	ReviewsDir string
	// Version is shown in the page footer.
	Version string
	// SettingsFile is the settings file the settings page reads and writes.
	// Empty falls back to config.DefaultFile().
	SettingsFile string
	// BaseConfig is the effective configuration (before any instance is
	// selected) the settings page shows as the current values.
	BaseConfig config.Config
	// Reload re-reads the settings file from disk, rebuilds the shared
	// config-derived state, and returns the new effective base config. It is
	// called after the settings page writes the file so changes take effect
	// without a restart. Nil disables hot reload: saved changes then apply
	// only on the next launch.
	Reload func() (config.Config, error)
}

Options configure the server.

type Server

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

Server is the browser GUI: an http.Handler plus the session state that backs it (per-instance deps, in-flight review runs, pending comments).

func New

func New(opts Options) (*Server, error)

New builds the server and generates its per-session access token.

func (*Server) Handler

func (s *Server) Handler() http.Handler

Handler returns the routed, authenticated handler.

func (*Server) Serve

func (s *Server) Serve(ctx context.Context, port int, ready func(url string)) error

Serve listens on 127.0.0.1:port (0 picks a free port), reports the tokenised launch URL through ready, and serves until ctx is cancelled.

func (*Server) Token

func (s *Server) Token() string

Token returns the session access token baked into the launch URL.

Jump to

Keyboard shortcuts

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