web

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: MIT Imports: 49 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package web is the `serve` command's localhost web UI.

Server-rendered html/template pages over the same internal/app functions the CLI and the TUI call, with a little vanilla JavaScript and Tabler's CSS, all embedded in the binary: the page makes no network request beyond this server. It never imports internal/cli, internal/ui or internal/tui, which hold process-wide state a long-lived server cannot share.

Index

Constants

View Source
const (
	KindRegistry = "registry"
	KindPack     = "pack"
	KindManifest = "manifest"
	KindGlobal   = "global"
)

Config file kinds the editor knows how to validate.

View Source
const (
	// HealthPath answers 200 and HealthBody to a request carrying the launch
	// token in HealthTokenHeader, and 401 to anything else. A second
	// no-argument launch probes it to find a live server before starting one.
	HealthPath        = "/healthz"
	HealthTokenHeader = "X-Icon-Sets-Sync-Token"
	HealthBody        = "icon-sets-sync"

	// StopPath is the "Stop server" action: a same-origin POST with the
	// session's CSRF token, which shuts the server down gracefully.
	StopPath = "/server/stop"
)

The single-instance contract a second launch relies on.

View Source
const AppName = "Icon Sets Sync"

AppName is the product's name as the UI shows it: in the header, the page titles and About. The binary, the module and the repository stay icon-sets-sync.

View Source
const ContentSecurityPolicy = "default-src 'none'; script-src 'self'; style-src 'self'; img-src 'self' data:; " +
	"connect-src 'self'; font-src 'self'; form-action 'self'; frame-ancestors 'none'; base-uri 'none'"

ContentSecurityPolicy is sent on every response. Everything is same-origin; nothing is inline. img-src allows data: because Tabler's CSS draws its checkboxes and selects with data: SVG URLs.

View Source
const DefaultPort = 7878

DefaultPort is where serve listens unless told otherwise.

View Source
const DefaultPortAttempts = 20

DefaultPortAttempts bounds how far past a taken default port Listen looks.

View Source
const GlobalName = "global"

GlobalName is the editor's name for the global config file.

View Source
const MaxAPIBody = 1 << 20

MaxAPIBody is the largest request body the API reads.

View Source
const SessionCookie = "iss_session"

SessionCookie is the cookie a valid token is exchanged for.

Variables

View Source
var ErrConflict = errors.New("the file changed on disk after it was opened")

ErrConflict is returned when a file changed on disk after it was opened.

Functions

func AllowedHosts

func AllowedHosts(bindHost string, port int, extra []string) []string

AllowedHosts is the set of Host header values the server answers to.

For a loopback bind that is the three spellings of this machine at the bound port. Anything else is refused, which is the DNS-rebinding defence: a page on evil.example that rebinds its name to 127.0.0.1 still sends Host: evil.example. With a remote bind the bound host and any explicitly allowed names are added.

func DefaultHistoryDir

func DefaultHistoryDir(lookup func(string) (string, bool)) string

DefaultHistoryDir is where finished runs are kept: XDG state, on every platform but Windows, per the house layout ($XDG_STATE_HOME, else ~/.local/state; %LocalAppData% on Windows).

func DefaultStateDir added in v0.1.3

func DefaultStateDir(lookup func(string) (string, bool)) string

DefaultStateDir is the tool's XDG state directory, the parent of the run history: $XDG_STATE_HOME/icon-sets-sync, else ~/.local/state/icon-sets-sync (%LocalAppData%\icon-sets-sync on Windows). It holds the API tokens, the webhook secrets and the logs beside the runs.

func GlobalSeed added in v0.1.3

func GlobalSeed() string

GlobalSeed is what the editor opens on when no global config exists: the $schema line, so an editor that reads it completes every key.

func IsAddrInUse

func IsAddrInUse(err error) bool

IsAddrInUse reports whether a listen error means the port is taken.

func IsLoopback

func IsLoopback(host string) bool

IsLoopback reports whether host only accepts connections from this machine: localhost, or an address in 127.0.0.0/8 or ::1.

func Listen

func Listen(listen ListenFunc, host string, port int, pinned bool, attempts int) (net.Listener, error)

Listen binds host:port.

When pinned is false and the port is in use, it tries the next port up, up to attempts ports in all, and returns the first that binds: the default port being taken by another process is ordinary, and the caller prints the URL actually bound. When pinned is true -- the user asked for this port -- a taken port is an error, because silently serving elsewhere would leave whatever they pointed at this port talking to something else. Any error other than "address in use" stops the search at once.

func NewToken

func NewToken() string

NewToken returns 32 random bytes, base64url-encoded.

func ParseSettingValue added in v0.1.3

func ParseSettingValue(k settings.Key, v any) (value any, note string, err error)

ParseSettingValue checks a JSON value for a setting exactly as the Settings page checks a typed one, and returns what the global config stores. note is a warning that does not refuse.

func ReadNotes

func ReadNotes(path string) map[string]string

ReadNotes returns a config file's top-level annotation keys: those starting with "_". Unreadable or non-JSON files yield none.

func RecipeName

func RecipeName(p *config.PackConfig) string

RecipeName names the recipe a pack runs, for display.

func SaveGlobalSetting added in v0.1.3

func SaveGlobalSetting(eng ConfigStore, key string, value any) error

SaveGlobalSetting sets one key of the global config (nil removes it), keeping every other key, through the engine's WriteConfig: validated, atomic, refused on a concurrent change and kept in the history. It drops the key's aliases. The web UI, the API, the MCP server and the webhooks command all save a setting through it.

func StartSync added in v0.1.3

func StartSync(reg *jobs.Registry, eng Syncer, kind jobs.Kind, packs []*config.PackConfig, req RunRequest) (*jobs.Job, error)

StartSync starts a sync job over packs in reg, recording each pack's progress and outcome as the run page reads them. The web UI, the API and the MCP server all start a sync through it.

func WithRunFlags

func WithRunFlags(stack settings.Stack, req RunRequest) (settings.Stack, error)

WithRunFlags copies stack's flag layer and sets dry_run and force on it -- always, so the form's choice is the effective one -- and concurrency when given.

Types

type APIOptions added in v0.1.3

type APIOptions struct {
	// Enabled serves /api/v1 (api.enabled).
	Enabled bool
	// Tokens is the token store. Required when Enabled.
	Tokens *apitoken.Store
	// RateLimit is requests per minute per token (api.rate_limit); below 1
	// is 60.
	RateLimit int
	// EventsStream serves GET /api/v1/events (events.stream).
	EventsStream bool
	// Audit receives one record per write. Nil keeps none.
	Audit *jsonlog.Log
	// Webhooks is the delivery side, when webhooks.enabled; it answers the
	// test and deliveries endpoints. Nil means webhooks are off.
	Webhooks *webhooks.Dispatcher
	// WebhookEndpoints is webhooks.endpoints, for the test endpoint.
	WebhookEndpoints []settings.Webhook
}

APIOptions configures the REST API.

type AppEngine

type AppEngine struct {
	ConfigDir string
	// ConfigSource is the layer that chose ConfigDir (config.Source*). The
	// embedded configs are read-only.
	ConfigSource string
	Workspace    string
	GlobalPath   string
	// GlobalHome is $XDG_CONFIG_HOME (or ~/.config): where the editor creates
	// a global config when none exists yet.
	GlobalHome string
	// GlobalLocation explains GlobalPath on the Settings page: the layer that
	// chose it, the default, and whether it sits at a legacy location.
	GlobalLocation settings.GlobalLocation
	Stack          settings.Stack
	// History keeps a copy of a config file before every save.
	History confighistory.Store
	// InitRecord is where the global config generator records what it last
	// wrote; empty is beside the history (app.InitRecordPath).
	InitRecord string
	// InitGlobalFrom generates the global config; nil is app.InitialGlobal.
	// A seam for tests.
	InitGlobalFrom func() app.GlobalInit
	Git            *gitx.Git
	// contains filtered or unexported fields
}

AppEngine is the production Engine over internal/app.

func (*AppEngine) AuditManifestPack added in v0.1.2

func (e *AppEngine) AuditManifestPack(ctx context.Context, req AuditRequest, h AuditHooks) ([]manifestpack.Resolution, error)

AuditManifestPack implements Engine.

func (*AppEngine) AuditSets added in v0.1.3

func (e *AppEngine) AuditSets() ([]string, error)

AuditSets implements Engine.

func (*AppEngine) Check

func (e *AppEngine) Check(ctx context.Context, packs []*config.PackConfig) []checker.Result

Check implements Engine.

func (*AppEngine) CheckProgress added in v0.1.3

func (e *AppEngine) CheckProgress(ctx context.Context, packs []*config.PackConfig, done func(int)) []checker.Result

CheckProgress implements ProgressChecker: one pack at a time.

func (*AppEngine) ConfigFiles

func (e *AppEngine) ConfigFiles() ([]ConfigFile, error)

ConfigFiles implements Engine.

func (*AppEngine) ConfigHistory added in v0.1.3

func (e *AppEngine) ConfigHistory(name string) ([]confighistory.Entry, error)

ConfigHistory implements Engine.

func (*AppEngine) ConfigHistoryRead added in v0.1.3

func (e *AppEngine) ConfigHistoryRead(name, id string) ([]byte, error)

ConfigHistoryRead implements Engine.

func (*AppEngine) FixConfig added in v0.1.3

func (e *AppEngine) FixConfig(name string, data []byte) (app.Fixed, error)

FixConfig implements Engine.

func (*AppEngine) GlobalInitInfo added in v0.1.3

func (e *AppEngine) GlobalInitInfo() GlobalInitInfo

GlobalInitInfo implements GlobalInitializer.

func (*AppEngine) InitGlobal added in v0.1.3

func (e *AppEngine) InitGlobal(force bool) (GlobalInitResult, error)

InitGlobal implements GlobalInitializer. It writes through WriteConfig, so the file is validated, the previous copy is kept in the history and the running settings reload.

func (*AppEngine) Pack

func (e *AppEngine) Pack(slug string) (*config.PackConfig, error)

Pack implements Engine.

func (*AppEngine) PackNotes

func (e *AppEngine) PackNotes(pack *config.PackConfig) map[string]string

PackNotes implements Engine.

func (*AppEngine) PackSettings

func (e *AppEngine) PackSettings(pack *config.PackConfig) (SettingsView, error)

PackSettings implements Engine.

func (*AppEngine) PackStats

func (e *AppEngine) PackStats(ctx context.Context, pack *config.PackConfig) PackStats

PackStats implements Engine.

func (*AppEngine) Packs

func (e *AppEngine) Packs() ([]*config.PackConfig, error)

Packs implements Engine.

func (*AppEngine) PrivateConfigCandidates added in v0.1.3

func (e *AppEngine) PrivateConfigCandidates() []string

PrivateConfigCandidates implements Engine.

func (*AppEngine) ReadConfig

func (e *AppEngine) ReadConfig(name string) (ConfigDoc, error)

ReadConfig implements Engine.

func (*AppEngine) Recipe

func (e *AppEngine) Recipe(ctx context.Context, pack *config.PackConfig, version string, req RunRequest, hooks RunHooks) (pipeline.Result, error)

Recipe implements Engine.

func (*AppEngine) Settings

func (e *AppEngine) Settings() SettingsView

Settings implements Engine.

func (*AppEngine) Sync

func (e *AppEngine) Sync(ctx context.Context, packs []*config.PackConfig, req RunRequest, hooks RunHooks) []app.Outcome

Sync implements Engine.

func (*AppEngine) ValidateConfig

func (e *AppEngine) ValidateConfig(name string, data []byte) []app.Finding

ValidateConfig implements Engine: the same loaders and checks the CLI uses, run on bytes that are not yet on disk.

func (*AppEngine) ValidatePacks added in v0.1.3

func (e *AppEngine) ValidatePacks(parse bool) ([]packcheck.Report, error)

ValidatePacks implements Engine: every pack under packages_dirs, else every registered pack's checkout.

func (*AppEngine) WriteConfig

func (e *AppEngine) WriteConfig(name string, data []byte, base string) error

WriteConfig implements Engine. It refuses a stale base revision and an invalid document, and otherwise replaces the file atomically. Saving the global config also reloads its layer, so the next run sees it.

type AuditHooks

type AuditHooks struct {
	Logger   *slog.Logger
	Starting func(sets int, filesRoot string)
	SetDone  func(manifestpack.Resolution)
}

AuditHooks route an audit's progress into a job.

type AuditRecord added in v0.1.3

type AuditRecord struct {
	Time   time.Time `json:"time"`
	Token  string    `json:"token"`
	Method string    `json:"method"`
	Path   string    `json:"path"`
	Route  string    `json:"route,omitempty"`
	Status int       `json:"status"`
}

AuditRecord is one line of api-audit.jsonl.

type AuditRequest

type AuditRequest struct{ Set, Package string }

AuditRequest is the audit form: one set, optionally verified against one named package; empty means every set.

type BuildInfo added in v0.1.3

type BuildInfo struct {
	Version, Commit, Date, Go, Platform string
}

BuildInfo is what About reports about the running binary.

func BuildInfoOf added in v0.1.3

func BuildInfoOf(v string) BuildInfo

BuildInfoOf reads the running binary's build: its version (the one the server was given, else the module's), commit and date, Go version and platform.

type ConfigDoc

type ConfigDoc struct {
	ConfigFile
	Data   []byte
	Exists bool
	// Rev is the sha256 of the bytes on disk ("" when the file does not
	// exist). A save carries the Rev it was edited from, and is refused if
	// the file has changed since.
	Rev string
	// ReadOnly, with Why, when the directory cannot be written.
	ReadOnly bool
	Why      string
}

ConfigDoc is a file's current contents.

type ConfigFile

type ConfigFile struct {
	Name, Path, Kind, Slug string
}

ConfigFile is one document the editor offers. Name is the only thing a request may name: the editor serves a file only if it is in this list, so no request can reach a path the list did not put there.

type ConfigStore added in v0.1.3

type ConfigStore interface {
	ReadConfig(name string) (ConfigDoc, error)
	WriteConfig(name string, data []byte, base string) error
}

ConfigStore reads and writes the config documents; an Engine is one.

type DirStatus added in v0.1.3

type DirStatus struct {
	Path   string
	Exists bool
}

DirStatus is one directory setting entry and whether it is there.

type Engine

type Engine interface {
	// Packs loads every registered pack, in registry order.
	Packs() ([]*config.PackConfig, error)

	// Check resolves each pack's upstream status. It polls the registries.
	Check(ctx context.Context, packs []*config.PackConfig) []checker.Result

	// PackStats reads a pack repo's local state: SVG count, branch, dirty.
	PackStats(ctx context.Context, pack *config.PackConfig) PackStats

	// Settings is the effective run-wide settings, with where each came from.
	Settings() SettingsView

	// Pack loads one registered pack.
	Pack(slug string) (*config.PackConfig, error)

	// PackSettings is one pack's effective settings, its own layer merged in.
	PackSettings(pack *config.PackConfig) (SettingsView, error)

	// PackNotes returns the authoring annotations (`_note` and the like) of a
	// pack's config file, which loading strips.
	PackNotes(pack *config.PackConfig) map[string]string

	// Sync refreshes packs that are behind upstream (or all, with Force),
	// exactly as `sync` does, with req applied as the flag layer.
	Sync(ctx context.Context, packs []*config.PackConfig, req RunRequest, hooks RunHooks) []app.Outcome

	// Recipe runs one pack's recipe at a version, as `recipe` does.
	Recipe(ctx context.Context, pack *config.PackConfig, version string, req RunRequest, hooks RunHooks) (pipeline.Result, error)

	// ConfigFiles lists the documents the editor offers.
	ConfigFiles() ([]ConfigFile, error)
	// ReadConfig returns one document's bytes and revision.
	ReadConfig(name string) (ConfigDoc, error)
	// ValidateConfig checks bytes as the loader would, without writing.
	ValidateConfig(name string, data []byte) []app.Finding
	// WriteConfig validates and saves, refusing a stale base revision. The
	// file's previous contents go to the history first.
	WriteConfig(name string, data []byte, base string) error
	// ValidatePacks checks the structure of every pack checkout, as the
	// validate command does; parse also parses every SVG.
	ValidatePacks(parse bool) ([]packcheck.Report, error)
	// FixConfig proposes the safe repairs to a document; it writes nothing.
	FixConfig(name string, data []byte) (app.Fixed, error)
	// ConfigHistory lists a document's saved copies, newest first, and
	// ConfigHistoryRead returns one.
	ConfigHistory(name string) ([]confighistory.Entry, error)
	ConfigHistoryRead(name, id string) ([]byte, error)

	// AuditSets lists the manifest pack's sets, for the audit form.
	AuditSets() ([]string, error)
	// PrivateConfigCandidates finds pack checkouts' private config
	// directories, offered when the manifest pack's config is not loaded.
	PrivateConfigCandidates() []string

	// AuditManifestPack surveys where each of the manifest pack's sets came
	// from, as `manifest-pack audit` does.
	AuditManifestPack(ctx context.Context, req AuditRequest, hooks AuditHooks) ([]manifestpack.Resolution, error)
}

Engine is everything the web layer asks of the sync engine. Handlers call it and nothing else, so no handler can re-implement a command.

It is the test seam -- the same idea as the CLI's syncChecker/syncRun -- and has one production implementation, AppEngine, a thin adapter over internal/app.

type GlobalInitInfo added in v0.1.3

type GlobalInitInfo struct {
	State     app.GlobalState
	Generated time.Time
	Notes     []string
}

GlobalInitInfo is the editor's banner.

type GlobalInitResult added in v0.1.3

type GlobalInitResult struct {
	Path    string
	State   app.GlobalState // before
	Changed bool
	Notes   []string
}

GlobalInitResult is what an initialisation did.

type GlobalInitializer added in v0.1.3

type GlobalInitializer interface {
	// GlobalInitInfo says how the global config stands, when it was last
	// generated, and what a generation would find now.
	GlobalInitInfo() GlobalInitInfo
	// InitGlobal writes the generated config unless the file is a person's
	// (force writes it anyway, keeping the old copy in the history).
	InitGlobal(force bool) (GlobalInitResult, error)
}

GlobalInitializer is an Engine that keeps the global config initialised: generated from what the machine has until a person edits it, and regenerated on request.

type ListenFunc

type ListenFunc func(network, address string) (net.Listener, error)

ListenFunc is net.Listen's signature, injectable so the port fallback can be tested without binding a socket.

type Options

type Options struct {
	// Engine is the sync engine. Required.
	Engine Engine

	// Tools reports the external programs a run needs; nil is app.Tools.
	// Tests pin it so a page does not depend on what the machine has.
	Tools func() []app.Tool

	// Token is the launch token printed in the URL. Required.
	Token string

	// AllowedHosts are the Host header values answered (see AllowedHosts).
	AllowedHosts []string

	// AllowRemote records that the bind is not loopback; it lets a TLS
	// reverse proxy's X-Forwarded-Proto mark the session cookie Secure.
	AllowRemote bool

	// ReadOnly registers no route that runs a sync or writes a file.
	ReadOnly bool

	// Version, BindAddr and ConfigDir are shown on the settings page.
	Version  string
	BindAddr string
	// Build is what the About page reports about this binary. Zero means
	// the running binary's own (BuildInfoOf); tests pin it.
	Build BuildInfo

	// HistoryDir keeps finished jobs as JSON Lines. Empty keeps them in
	// memory only. See DefaultHistoryDir.
	HistoryDir string

	// CheckTTL is how old a cached upstream check may be before a page load
	// starts a new one. Zero means ten minutes.
	CheckTTL time.Duration

	// Now is the clock. Nil means time.Now.
	Now func() time.Time

	// Bus receives what the server and its runs do (see internal/events).
	// Nil makes one; serve passes its own so webhooks can subscribe.
	Bus *events.Bus

	// TLS records that the listener terminates TLS, for server.started.
	TLS bool

	// API configures the REST API. Its zero value leaves it off, and then
	// nothing under /api/ answers but the UI's sign-in refusal.
	API APIOptions
}

Options configures a Server.

type PackStats

type PackStats struct {
	SVGs   int
	Branch string
	Dirty  bool
	// Err explains why the repo could not be read; the other fields are then
	// zero.
	Err string
}

PackStats is the local state of one pack repository.

func ReadPackStats

func ReadPackStats(ctx context.Context, git *gitx.Git, pack *config.PackConfig) PackStats

ReadPackStats counts a pack's vendored SVGs and reads its git state. A missing checkout is reported, not fatal: the dashboard still renders.

type Problem added in v0.1.3

type Problem struct {
	Type     string `json:"type"`
	Title    string `json:"title"`
	Status   int    `json:"status"`
	Detail   string `json:"detail,omitempty"`
	Instance string `json:"instance,omitempty"`
	// JobID names the run a 409 is about.
	JobID string `json:"job_id,omitempty"`
}

Problem is an RFC 9457 problem details document.

type ProgressChecker added in v0.1.3

type ProgressChecker interface {
	CheckProgress(ctx context.Context, packs []*config.PackConfig, done func(int)) []checker.Result
}

ProgressChecker is an Engine that reports a check's progress: done is called with the number of packs finished after each one. The dashboard uses it for "n of N"; an engine without it is checked in one call.

type RunHooks

type RunHooks struct {
	Logger   *slog.Logger
	Observer pipeline.Observer
	Starting func(pack *config.PackConfig, result checker.Result, dryRun bool)
	Done     func(app.Outcome)
}

RunHooks route a run's output into a job.

func RunHooksFor added in v0.1.3

func RunHooksFor(j *jobs.Job) RunHooks

RunHooksFor routes a run's logger, stage events and pack boundaries into a job, as the run page reads them.

type RunRequest

type RunRequest struct {
	DryRun      bool
	Force       bool
	Concurrency int // 0 leaves the setting alone
}

RunRequest is what a run form may set. It enters the settings as the flag layer -- the same way the TUI's dry-run choice does -- so nothing below it, not a pack config and not the environment, can turn a dry run into a real commit.

type Server

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

Server is the web UI.

func New

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

New builds a Server. It parses every template once, so a template error is a startup error rather than a 500 on first visit.

func (*Server) Bus added in v0.1.3

func (s *Server) Bus() *events.Bus

Bus is the server's event bus.

func (*Server) Close

func (s *Server) Close()

Close stops background work without serving; for tests.

func (*Server) Handler

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

Handler returns the full middleware chain and routes.

func (*Server) Serve

func (s *Server) Serve(ctx context.Context, ln net.Listener) error

Serve answers on ln until ctx is cancelled or Stop is called, then shuts down with a ten-second grace for requests in flight and cancels background work.

func (*Server) Stop added in v0.1.3

func (s *Server) Stop()

Stop asks Serve to shut down, as Ctrl-C does. Safe to call more than once.

func (*Server) Stopped added in v0.1.3

func (s *Server) Stopped() <-chan struct{}

Stopped is closed once Stop has been called.

type SettingRow

type SettingRow struct {
	Name, Value, Origin, Help string
	PackScoped                bool
	// Env is the environment variable that sets it, which wins over the
	// global config the page writes.
	Env string
	// Input is the control the page offers: enum, bool, int, list, dir,
	// file, textarea or text (see settingInput).
	Input string
	Enum  []string
	// Min and Max bound an int (Max 0 is unbounded).
	Min, Max int
	// Default is the registry default, as text.
	Default string
	// Items is a list setting's entries; On is a boolean's value.
	Items []string
	On    bool
	// Group is the page section: "" or settings.GroupIntegrations.
	Group string
	// Typed is the value as its own type, for the API.
	Typed any
}

SettingRow is one line of the settings table, with what the page needs to offer an input for it.

func (SettingRow) Anchor added in v0.1.3

func (r SettingRow) Anchor() string

Anchor is the row's id on the settings page.

func (SettingRow) Overridden added in v0.1.3

func (r SettingRow) Overridden() bool

Overridden reports whether a layer above the global config sets it, so a value saved from the page would not take effect while that layer does.

type SettingsSection added in v0.1.3

type SettingsSection struct {
	ID, Title string
	Rows      []SettingRow
}

SettingsSection is one card of settings on the Settings page.

type SettingsView

type SettingsView struct {
	Rows       []SettingRow
	ConfigDir  string
	GlobalPath string
	// ConfigSource names the layer that chose ConfigDir: flag, env, cwd,
	// executable or embedded (config.Source*).
	ConfigSource string
	// Global is where the global config was found and where it belongs.
	Global settings.GlobalLocation
	// PackagesDirs is the packages_dirs setting, each entry with whether it
	// exists, and the layer that set it.
	PackagesDirs       []DirStatus
	PackagesDirsOrigin string
	// PageSize is the page_size setting: rows per page in the UI's lists.
	PageSize int
}

SettingsView is the effective settings and the paths they came from.

func BuildSettingsView

func BuildSettingsView(r settings.Resolved, configDir, globalPath string) SettingsView

BuildSettingsView flattens resolved settings into display rows, in the registry's order, with each key's origin and help.

func (SettingsView) Sections added in v0.1.3

func (v SettingsView) Sections() []SettingsSection

Sections splits the settings between the page's cards: the run settings, then the integrations (API, events, webhooks, MCP).

type Syncer added in v0.1.3

type Syncer interface {
	Sync(ctx context.Context, packs []*config.PackConfig, req RunRequest, hooks RunHooks) []app.Outcome
}

Syncer is the part of an Engine a sync job calls.

type ValidationError

type ValidationError struct{ Findings []app.Finding }

ValidationError carries the findings that refused a save.

func (*ValidationError) Error

func (e *ValidationError) Error() string

Directories

Path Synopsis
Package jobs runs the web UI's long operations -- syncs, recipes, audits -- in the background, records what each one did as a stream of typed events, and keeps a bounded history on disk.
Package jobs runs the web UI's long operations -- syncs, recipes, audits -- in the background, records what each one did as a stream of typed events, and keeps a bounded history on disk.

Jump to

Keyboard shortcuts

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