core

package
v0.29.2 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: Apache-2.0 Imports: 26 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 core is the half of the plugin system the server and the Surveyor link: the manifest and its version ranges, the families and the contribution-point registry, the reader and digest of an in-memory tree, the pinned store and the provider descriptor with its resolver. It is pure data checking and touches disk only to read a stored or local tree.

It must never import internal/provisioning, internal/plugin or internal/mcpbridge, directly or through any dependency: those write into other people's home directories, and the server may not link them (D1884). TestServerNeverLinksTheApply in internal/boundaries pins it; a client-only import creeping into a file of this package fails there. Client loaders register their points with Register from internal/plugin's init; ReadTree classifies by family, so its result does not depend on which are linked.

Index

Constants

View Source
const (
	// Schema1 is the client-only manifest 0.28 shipped; it is read unchanged.
	Schema1 = 1
	// SchemaVersion is the highest manifest schema this version reads: schema 2
	// declares component sides and an sdk level per extension-point family.
	SchemaVersion = 2
	// MinSchema2Floor is the lowest binary floor a schema 2 manifest may state.
	MinSchema2Floor = "0.29.0"
)
View Source
const (
	// ScriptEntry is the plugin's script at the root: the one file that says what
	// the plugin registers.
	ScriptEntry = "plugin.star"
	// SurveyorScript is the script of the surveyor side: the one file that
	// registers its Starlark recipes. It is a single file at the root (it loads
	// no lib/ file, which belongs to the client side) and is stored with the
	// recipes family.
	SurveyorScript = "surveyor.star"
	// LibDir holds the flat *.star files plugin.star may load.
	LibDir = "lib"
	// MaxScriptBytes caps one script file; MaxLibFiles the files of lib/.
	MaxScriptBytes = 256 << 10
	MaxLibFiles    = 32
)
View Source
const (
	// MaxFiles and MaxBytes bound the stored files of one plugin.
	MaxFiles = 2000
	MaxBytes = 8 << 20
)
View Source
const ManifestFile = "cartographer-plugin.yaml"

ManifestFile is the name of the manifest at a plugin's root.

View Source
const ProvidersDir = "providers"

ProvidersDir is the contribution point holding providers/<id>.yaml: an agent client described as data, a fork or in-house build of a built-in client.

Variables

View Source
var (
	// ErrNotFetched: no tree is stored under that name and digest.
	ErrNotFetched = errors.New("plugin: not fetched")
	// ErrModified: the stored tree no longer has the digest it is named by.
	ErrModified = errors.New("plugin: stored tree was modified")
	// ErrInvalid: the stored tree has its digest but fails ReadTree.
	ErrInvalid = errors.New("plugin: stored tree is invalid")
	// ErrReadOnly: Put or GC on a read-only store.
	ErrReadOnly = errors.New("plugin: the store is read-only")
)

The store is a re-fetchable cache under the user's cache directory:

plugins/<name>/<digest>/   exactly the files ReadTree validated, manifest included
plugins/.tmp-<name>-<n>/   a write in progress

A digest directory is immutable: its name is the digest of what it holds, and Open recomputes it. Put and GC are writers: on the user cache they run under the client lock (provisioning.LockClientState), held by the caller; a vendored store (plugin vendor) is written by one process, the temp-dir-and-rename write being race safe. Open takes no lock, so a read racing a write sees either state or ErrNotFetched. A ReadOnly store, which headless components open, refuses both writers.

Functions

func CheckPin

func CheckPin(name string, pin Pin) error

CheckPin reports why a configured pin is malformed: a name that is no plugin name or a digest that is not 64 lowercase hex. Config loaders call it at load so a bad pin stops the start with the key path, before any disk access.

func ExpandAnchor

func ExpandAnchor(env ProviderEnv, name string) (string, error)

ExpandAnchor returns the directory an anchor name ("home", "xdg_config", "app_data", "local_app_data", "documents") stands for, cleaned and in slash form. It lies inside the home directory or the call is an error; the part of the path below it is the caller's to validate.

func Floor

func Floor(running string) string

Floor is the `cartographer` value `plugin new` writes in a schema 2 manifest: the running core version, and never below the lowest floor schema 2 takes.

func GlobProblem

func GlobProblem(g string) string

GlobProblem is the lexical part of a file permission: it starts with one known placeholder, stays in slash form and never climbs with "..". Resolving the placeholder under the home directory is the permission enforcer's.

func Ignored

func Ignored(first string) bool

Ignored reports a top-level name that is never stored.

func IsLibPath

func IsLibPath(path string) bool

IsLibPath reports a path that names a loadable lib file.

func IsScriptPath

func IsScriptPath(path string) bool

IsScriptPath reports a path the tree reader treats as script territory: plugin.star itself or anything under lib/ (or a path that starts like them).

func JoinPinProblems

func JoinPinProblems(probs []PinProblem) error

JoinPinProblems folds the problems into one error, nil for none.

func LoadPinned

func LoadPinned(storeDir string, pins map[string]Pin, side Side, opts Options) ([]*Plugin, []PinProblem)

LoadPinned opens every enabled pin of a component through a read-only store rooted at storeDir and returns the active plugins that have the component's side, in name order. Every enabled pin that does not load is a problem: its State when not active, or `no <side> side` for a plugin that never contributes to this component, or the side's unsupported reason. A malformed digest is a problem before any disk access. A disabled pin is skipped. An explicit pin is an assertion, so the caller must start with no problems.

func PrivateHostProblem

func PrivateHostProblem(h string) string

PrivateHostProblem checks one private-network host, of the manifest's net_private or the Surveyor's allow_private_hosts: the grammar of a net host without the *. wildcard, because a private grant names one machine.

func ProviderNameClashes

func ProviderNameClashes(specs []ProviderSpec) []string

ProviderNameClashes lists the providers of one plugin that share a name.

func RangeMet

func RangeMet(rng, running string) (bool, error)

RangeMet reports whether the running Cartographer version satisfies rng. A running version that does not parse (a "dev" build) satisfies every range, and a pre-release or `git describe` build compares as its X.Y.Z core. A malformed range is an error.

func Register

func Register(p Point)

Register adds a point. A duplicate or invalid Dir is an init-time programmer error and panics.

func RegisterFamily

func RegisterFamily(f Family)

RegisterFamily adds a family. It is init-time: a duplicate name on a side, an unknown side, a bad level or a top-level name already claimed panics, so two sides can never both own a file.

func State

func State(name string, e Entry, s Store, opts Options) (Status, *Plugin)

State is the one rule that decides whether a plugin runs: every consumer calls it and nothing else. A plugin is active only when it is enabled, the user approved a digest, and the stored tree of that digest is intact and still valid (for example the running version still satisfies its `cartographer` range). Only an active plugin yields a *Plugin. A newer Installed digest never affects it: the approved tree is what runs.

func Supported

func Supported(side Side, family string, level int) string

Supported reports why this build cannot give a side the sdk level of a family, or "" when it can.

func ValidRange

func ValidRange(rng string) error

ValidRange reports why rng is not a version range, or nil.

Types

type App

type App struct {
	Title, Description string
	Icon               string
	URL                string
}

App is the contribution of apps/<name>.yaml: a link to an app on its own origin, opened in a new tab. The Atlas hands it nothing.

type Component

type Component struct {
	// SDK maps an extension-point family to the level the plugin is written for.
	// A declared entry is a requirement.
	SDK         map[string]int
	Permissions *Permissions
}

Component is what a manifest says about one side of the plugin.

type Contribution

type Contribution struct {
	Point string // the point's Dir
	Kind  string // artifact kind: skill, agent, hook
	Name  string
	// Files are the artifact's files, paths relative to the artifact.
	Files []contract.ArtifactFile
	// Executable lists the paths (relative to the artifact) of every file with
	// the executable bit, for the install preview.
	Executable []string
	// Description is the frontmatter description of a skill or agent: what the
	// agent reads to decide to use it, so the install preview shows it.
	Description string
	// Command, Event and Requires are what a hook declares in hook.json.
	Command, Event string
	Requires       []string
	// Provider is the parsed descriptor of a providers/<id>.yaml; nil for every
	// other kind. A provider is registered with the registries, never installed
	// as an artifact.
	Provider *ProviderSpec
	// Role and Preset are the data a server family contributes (server.go);
	// nil for every other kind.
	Role   *Role
	Preset *Preset
	// View and App are the data the atlas side contributes (atlas.go); nil for
	// every other kind.
	View *View
	App  *App
	// Recipe and Connector are what the surveyor side contributes
	// (surveyor.go); nil for every other kind.
	Recipe    *SurveyorRecipe
	Connector *SurveyorConnector
	// Branding is the data of an atlas-side branding/ folder (one contribution
	// per plugin); nil for every other kind.
	Branding *branding.Spec
}

Contribution is what one folder entry of a point contributes: one skill, one agent, one hook.

type Entry

type Entry interface {
	// PluginEnabled is false for a plugin the user switched off.
	PluginEnabled() bool
	// PluginApproved is the approved tree digest, "" while pending.
	PluginApproved() string
}

Entry is the configuration of one plugin as State reads it: the client's `plugins` entry (clientconfig.PluginEntry) and the pin of a headless component (Pin) both implement it, so no component config is imported here.

type Family

type Family struct {
	Side  Side
	Name  string
	Level int // the highest level this build implements
	Dirs  []string
	Files []string
}

Family is a group of extension points a plugin side declares an sdk level for. A schema 2 manifest requires a family by naming it under components.<side>.sdk; the tree folders and files it owns are Dirs and Files.

func Families

func Families() []Family

Families returns the registered families sorted by side, then name.

func FamilyOf

func FamilyOf(top string) (Family, bool)

FamilyOf returns the family that owns a top-level folder or file name.

type Files

type Files struct {
	Read  []string `yaml:"read"`
	Write []string `yaml:"write"`
}

Files holds the path globs a plugin asks to read and to write.

type Keep

type Keep struct{ Installed, Approved string }

Keep is what GC preserves for one configured plugin.

type Manifest

type Manifest struct {
	Schema       *int               `yaml:"schema"`
	Name         string             `yaml:"name"`
	Version      string             `yaml:"version"`
	DisplayName  string             `yaml:"display_name"`
	Description  string             `yaml:"description"`
	Cartographer string             `yaml:"cartographer"`
	Depends      map[string]string  `yaml:"depends"`
	Permissions  *Permissions       `yaml:"permissions"` // the client side's, in either schema
	Settings     map[string]Setting `yaml:"settings"`

	// Components is the per-side view of both schemas. A schema 1 manifest is a
	// client-only plugin whose sdk levels are the implicit ones.
	Components map[Side]Component `yaml:"-"`
	// UnknownSides are the side names of a schema 2 manifest this build does not
	// know: reported, never an error.
	UnknownSides []string `yaml:"-"`
}

Manifest is cartographer-plugin.yaml, schema 1 or 2. The yaml tags are schema 1's; a schema 2 file is decoded into manifestV2 and normalised here.

func ParseManifest

func ParseManifest(data []byte, opts Options) (Manifest, []string)

ParseManifest reads and checks manifest bytes. The returned problems are every problem it can read (a YAML type error stops the semantic checks, which then run on the next call), each "path: reason" and sorted, except that an unmet `cartographer` range is checked before anything else and is then the only one.

type Options

type Options struct {
	// RunningVersion is the version of this binary, for the `cartographer` range.
	RunningVersion string
	// ReservedName reports a built-in command name a plugin must not take;
	// nil reserves none.
	ReservedName func(string) bool
	// CheckScripts loads the script files of a side's tree (plugin.star and lib/
	// for the client; surveyor.star and the files under recipes/ for the
	// surveyor) and
	// returns why they do not, one problem each; nil checks nothing. It is a hook
	// because the Starlark runtime lives in internal/plugin/star and internal/plugin/starcore, which import
	// this package.
	CheckScripts func(side Side, files []TreeFile) []string
	// Side limits what ReadTree loads to the contribution points of one side:
	// a component loads only its own. Empty loads every side (plugin validate,
	// plugin vendor). The digest and the stored files never depend on it.
	Side Side
	// IgnoreRange skips the `cartographer` range check, so a tree whose range
	// the running version does not meet still reads. Only the commands that
	// retire or show such a plugin (plugin remove, plugin show) set it: a tree
	// read this way is never registered active nor run: State clears it.
	IgnoreRange bool
}

Options carries what the manifest check needs from its caller, so this package imports neither cmd nor the running binary's version.

type Permissions

type Permissions struct {
	KB    string   `yaml:"kb"`
	Net   []string `yaml:"net"`
	Files *Files   `yaml:"files"`
	Env   []string `yaml:"env"`
	// NetPrivate (surveyor side only) names exact hosts of net that may resolve
	// to a private or loopback address. It grants nothing alone:
	// the Surveyor config must list the same host under allow_private_hosts.
	NetPrivate []string `yaml:"net_private"`
}

Permissions is what a plugin asks for. Here it is validated as data; nothing in this package enforces or grants it.

type Pin

type Pin struct {
	// Enabled false skips the plugin; the zero value is therefore "off".
	Enabled bool
	// Digest is the tree digest the operator approved: 64 lowercase hex.
	Digest string
}

Pin is the configuration of a plugin in a headless component (the server or the Surveyor config): a digest the operator wrote, no install state. It is an Entry, so State stays the one rule that decides whether a plugin runs.

func (Pin) PluginApproved

func (p Pin) PluginApproved() string

PluginApproved implements Entry.

func (Pin) PluginEnabled

func (p Pin) PluginEnabled() bool

PluginEnabled implements Entry.

type PinProblem

type PinProblem struct {
	Name   string
	Reason string
}

PinProblem is a pin that cannot load: the caller refuses to start (fail closed).

func (PinProblem) Error

func (p PinProblem) Error() string

type Plugin

type Plugin struct {
	Manifest      Manifest
	Contributions map[string][]Contribution // by point Dir
	Artifacts     []contract.Artifact
	Files         []TreeFile // every stored file, manifest included, sorted by path
	Digest        string     // identifies the validated tree
	// Sides are the sides the manifest declares, in canonical order (a schema 1
	// plugin is client only); Unsupported says why a side cannot load in this
	// build; Unknown lists what a schema 2 manifest or tree holds that this
	// build knows no family or side for (`entry x`, `side y`): stored and
	// digested, never loaded.
	Sides       []Side
	Unsupported map[Side]string
	Unknown     []string
}

Plugin is a validated plugin tree.

func ReadTree

func ReadTree(files []TreeFile, opts Options) (Plugin, []string)

ReadTree validates a plugin tree and returns every problem it finds, sorted. The result does not depend on the order of files.

func (Plugin) Providers

func (p Plugin) Providers(env ProviderEnv) []ResolvedProvider

Providers returns the providers of p resolved for env, in name order, with the reasons paths were left out kept in each one's LeftOut.

type Point

type Point struct {
	Dir  string // top-level folder name
	Side Side
	// Family is the registered family (family.go) that owns Dir; Register fills
	// it, and refuses a Dir no family of Side owns.
	Family string
	// Load validates the files under Dir (paths are tree-relative, so they start
	// with Dir+"/") and returns the contributions with every problem found.
	Load func(files []TreeFile) ([]Contribution, []string)
	// Check, when set, judges one contribution against the plugin's name, which
	// Load does not know; ReadTree reports its problems as tree problems, so a
	// tree that passes `plugin vendor` and the preview also loads at start.
	Check func(plugin string, c Contribution) []string
	// Preview prints what the install preview shows for one contribution.
	Preview func(w io.Writer, c Contribution)
	// Executable marks a point whose files run (hooks).
	Executable bool
}

Point is a place of the plugin tree that contributes something.

func RegisteredPoints

func RegisteredPoints() []Point

RegisteredPoints returns the points sorted by Dir.

type Preset

type Preset struct {
	Description string
	Kind        string
	Create      json.RawMessage // the map_create arguments, minus name
	Templates   []PresetTemplate
}

Preset is the contribution of presets/<name>/: the arguments of map_create (minus name) and the templates its contract names, handed to an authorised writer by preset_list. It carries no KB data.

type PresetTemplate

type PresetTemplate struct {
	Slug    string
	Content []byte
}

PresetTemplate is a template of a preset: a plugin-local slug and its file.

type ProviderCell

type ProviderCell struct {
	Dir, File   []string // skill, agent and hook directory; instructions file
	AgentFormat string   // agent only; the file suffix follows from it
}

ProviderCell is one destination of a provider: a path relative to the home directory (global) or to a project root (project). No write cell lies under {documents}: only a detect dir takes that anchor.

type ProviderEnv

type ProviderEnv struct {
	GOOS, Home string
	Getenv     func(string) string
	// Documents answers the Documents folder of home; nil is
	// safewrite.DocumentsDir, the resolver Cline's hooks and rules use.
	Documents func(home string) string
}

ProviderEnv is what ResolveProvider reads from the machine; tests inject it.

type ProviderScope

type ProviderScope struct{ Skill, Agent, Instructions, Hook *ProviderCell }

ProviderScope is the cells of one scope. Hook is global only.

type ProviderSpec

type ProviderSpec struct {
	Schema      int    `yaml:"schema"`
	Name        string `yaml:"name"`
	DisplayName string `yaml:"display_name"`
	Base        string `yaml:"base"`
	Detect      struct {
		Binaries []string          `yaml:"binaries"`
		Dirs     osValue[[]string] `yaml:"dirs"`
	} `yaml:"detect"`
	Paths struct {
		Global  globalCells  `yaml:"global"`
		Project projectCells `yaml:"project"`
	} `yaml:"paths"`
	Capabilities map[string]string `yaml:"capabilities"`
	MCP          struct {
		Mode   string            `yaml:"mode"`
		Config osValue[string]   `yaml:"config"`
		Stale  osValue[[]string] `yaml:"stale"`
	} `yaml:"mcp"`
	InvokeHint string `yaml:"invoke_hint"`
}

ProviderSpec is a providers/<id>.yaml as written. It is built only by ParseProvider.

func ParseProvider

func ParseProvider(stem string, data []byte) (ProviderSpec, []string)

ParseProvider reads providers/<stem>.yaml: strict (size cap, no alias, one document, unknown key = error) and complete, every problem listed as "path: reason", sorted.

type ResolvedProvider

type ResolvedProvider struct {
	Name, DisplayName, Base string
	Binaries                []string
	DetectDirs              [][]string // home-relative; one segment may hold *
	Global, Project         ProviderScope
	MCPMode                 string
	MCPConfig               []string   // home-relative; nil keeps the base's file; one segment may hold *
	MCPStale                [][]string // home-relative
	Capabilities            map[string]string
	InvokeHint              string
	// LeftOut is the reasons ResolveProvider dropped paths, one per path: a
	// cell behind a link, a path outside its root. The caller says them; a
	// provider that lost a cell resolves all the same.
	LeftOut []string
}

ResolvedProvider is a providers/<id>.yaml resolved for one OS. Data only.

func ResolveProvider

func ResolveProvider(spec ProviderSpec, env ProviderEnv) (ResolvedProvider, []string)

ResolveProvider picks the per-OS values of spec, expands the anchors against env and returns the provider with the reasons paths were left out. A path outside its root, or one the walk from the root finds behind a link, is dropped with a reason, never an error, so the rest still resolves. Home-family anchors must stay inside the home directory (safewrite.CheckPath(home, path), the check the hook writers run); {documents} is read by detect dirs only, and counts when the Documents folder lies below home.

func (ResolvedProvider) Paths

func (r ResolvedProvider) Paths(home string) []string

Paths lists every path the provider resolved to on this machine, one "scope kind: path" line per cell, sorted: the global ones absolute, the project ones relative to a project root. It is what the install preview prints: the approval is of the tree, and these are the places it would write.

func (ResolvedProvider) Registration

func (r ResolvedProvider) Registration(origin string, active bool) configurator.PluginSpec

Registration is the registry entry of the provider, declared by plugin origin. An active provider is detected; an inactive one stays resolvable so what it installed can be retired.

type Role

type Role struct {
	Description string
	Rules       []RoleRule
}

Role is the contribution of roles/<name>.yaml: allow rules with no KB, which the operator maps onto KBs of the deployment (auth.roles[].from, kbs).

type RoleRule

type RoleRule struct {
	Access             string
	Maps, Journals     []string
	Types              []string
	Artifacts, Secrets string
	// Declared records the selector keys the file wrote ("maps", "journals",
	// "types"), so a key present but empty is judged as the operator's is.
	Declared map[string]bool
}

RoleRule is one allow rule of a role template; the fields are those of config.RuleSpec minus KB (a plugin does not know the deployment's KB names).

type Setting

type Setting struct {
	Type        string `yaml:"type"`
	Default     any    `yaml:"default"`
	Description string `yaml:"description"`
}

Setting declares one user-settable value of the plugin.

type Side

type Side string

Side is where a contribution point is loaded.

const (
	// SideClient points are loaded by the client of the machine.
	SideClient Side = "client"
	// SideSurveyor, SideServer and SideAtlas are the other components a schema 2
	// manifest declares. A point of a side loads only when that side is asked
	// for (Options.Side) or every side is (empty).
	SideSurveyor Side = "surveyor"
	SideServer   Side = "server"
	SideAtlas    Side = "atlas"
)

func Sides

func Sides() []Side

Sides lists every side in canonical order.

type Status

type Status string

Status is where an installed plugin stands.

const (
	StatusActive     Status = "active"
	StatusPending    Status = "pending approval"
	StatusDisabled   Status = "disabled"
	StatusNotFetched Status = "not fetched"
	StatusModified   Status = "modified"
	StatusInvalid    Status = "invalid"
)

type Store

type Store struct {
	Root     string
	ReadOnly bool
}

Store is the plugin cache rooted at Root.

func DefaultStore

func DefaultStore() (Store, error)

DefaultStore is <cache dir>/plugins, the cache dir being the update check's.

func (Store) GC

func (s Store) GC(keep map[string]Keep) error

GC removes every digest directory but the two of a configured plugin, and every plugin directory that is not configured. It is best effort: a failure is reported and the rest goes on. It never removes the approved tree, and it leaves alone a name that is not a valid plugin name. The caller holds the client lock.

func (Store) Open

func (s Store) Open(name, digest string, opts Options) (Plugin, error)

Open reads the stored tree back through ReadTree and compares its digest.

func (Store) Put

func (s Store) Put(name string, files []TreeFile, want string, opts Options) error

Put stores files under name after validating them: ReadTree must report no problem and the digest must be want. The tree is written to a temp directory, read back through ReadTree, checked against want again (the bytes validated are the bytes stored) and renamed into place, never over a directory that exists. An existing digest directory that verifies is kept; one that does not is a corrupt cache and is replaced. The caller holds the client lock.

type SurveyorConnector

type SurveyorConnector struct {
	Transport     string
	Command       string
	CommandOnPath bool
	Args          []string
	Env           []string
	URL           string
	TokenEnv      string
	Headers       map[string]string
	Tools         []string
	CallTimeout   time.Duration
	MaxResult     int
}

SurveyorConnector is the contribution of connectors/<name>.yaml. Command is a slash path inside connectors/ (a file of the tree) or, when CommandOnPath, a bare program name looked up on the Surveyor's PATH. Env, TokenEnv and the values of Headers are NAMES declared in the manifest's permissions.env.

type SurveyorRecipe

type SurveyorRecipe struct {
	Shape        string // feed or system
	Command      string
	Args         []string
	Timeout      time.Duration // 0 = the Surveyor's default
	MaxOutput    int
	MaxContent   int
	Connector    string // a local connector of the plugin, git or fetch; "" = none
	Instructions string
	// Script marks a recipe whose folder holds instructions.md alone: it runs as
	// Starlark, registered by surveyor.star, and has no command, shape or
	// limits of its own here (the registration gives the shape).
	Script bool
}

SurveyorRecipe is the contribution of an exec recipe folder. Command is a slash path inside the recipe folder; Env is never here, because a plugin names no operator variable (the manifest's permissions.env does).

type TreeFile

type TreeFile struct {
	Path       string // canonical slash form, relative to the plugin root
	Content    []byte
	Executable bool
	// Special marks a symlink or any non-regular file: always an error.
	Special bool
}

TreeFile is a file of a plugin tree in memory: what an acquisition produces and the store reads back.

func ReadFolder

func ReadFolder(root string) ([]TreeFile, error)

ReadFolder walks root with Lstat: a symlink or any non-regular file is returned as a Special entry, for ReadTree to list among the findings (a stored tree holding one is ErrModified, see specialIn), and the entries ReadTree ignores are not read.

type View

type View struct {
	Title, Description string
	Icon               string // one of the Atlas's icon names
	Scope              string // "kb" or "global"
	Source             ViewSource
	Renderer           string // table, list, stats, keyvalue
	Columns            []ViewColumn
	Limit              int
}

View is the contribution of views/<name>.yaml.

type ViewColumn

type ViewColumn struct {
	Key    string // a dotted path in the item
	Label  string
	Format string // text, number, date, relative, badge, concept
}

ViewColumn is one column of a table, or one field of stats and keyvalue.

type ViewSource

type ViewSource struct {
	Route string            // a path template; {kb} is the only placeholder
	Query map[string]string // values may hold {kb}
	Items string            // dotted path to the array in the answer, or ""
}

ViewSource is the public read-only route a view draws.

Jump to

Keyboard shortcuts

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