Documentation
¶
Overview ¶
Package reference assembles Pando's own documentation from Pando.
R-261 says the API is the product and that the console, the CLI and MCP are clients of it with no capability it lacks. A description of those three that is written by hand is a fourth artifact with its own drift: it is correct on the day it is written and wrong on the day after a route is added, and the people it is wrong for are the ones automating against it.
So it is built from the things themselves. The CLI half is walked out of the cobra tree that `pando` actually runs; the MCP half is the tool list the MCP server actually announces; the error codes are the catalog `errs` is tested against. The API half is the one part that cannot be read from the router — chi knows a route's method and pattern but not what it is for — so httpapi keeps a table of summaries beside its routes, and a test walks the real router and fails when the two disagree in either direction.
The endpoint serving this is the console's source, and `cmd/gen-reference` writes the same document to `docs/`. One assembly, three readers.
Index ¶
- func APIMarkdown(doc Document) string
- func AuditFormatsMarkdown() string
- func CLIMarkdown(doc Document) string
- func EventsMarkdown(doc Document) string
- func JSON(v any) ([]byte, error)
- func MCPMarkdown(doc Document) string
- func Markdown(doc Document) string
- type API
- type AdapterCategory
- type AdaptersData
- type Auth
- type CLICommand
- type CLIData
- type CLIFlag
- type CodeExample
- type Command
- type ConfigData
- type Connect
- type Document
- type ErrorDoc
- type ErrorsData
- type EventDoc
- type EventsData
- type EventsGuide
- type Flag
- type Install
- type MCPData
- type MCPTool
- type Route
- type WebhookGuide
- type WebhookHeader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func APIMarkdown ¶
func AuditFormatsMarkdown ¶
func AuditFormatsMarkdown() string
AuditFormatsMarkdown is docs/audit-formats.md: the formats an audit stream, export or archive is written in (design 12 §6, R-384). The native columns come from audit.Line and the OCSF mapping from the ocsf package, so the page describes what the encoder does.
func CLIMarkdown ¶
func EventsMarkdown ¶
EventsMarkdown is docs/events.md: every event a subscription can name, what a webhook receives, and how to check it came from Pando. Written from the catalog in internal/core/events and from eventsGuide, like the rest of the reference.
func JSON ¶
JSON renders a reference file: indented, with a trailing newline, and with <, > and & left as they are — the text is read by people as often as by programs.
func MCPMarkdown ¶
Types ¶
type API ¶
type API struct {
BasePath string `json:"base_path"`
Auth []Auth `json:"auth"`
Routes []Route `json:"routes"`
}
API describes the HTTP surface.
type AdapterCategory ¶
type AdapterCategory struct {
Category api.Category `json:"category"`
Kinds []api.KindInfo `json:"kinds"`
}
AdapterCategory is one category's kinds, sorted by kind.
type AdaptersData ¶
type AdaptersData struct {
Categories []AdapterCategory `json:"categories"`
}
AdaptersData is docs/adapters.json.
type Auth ¶
type Auth struct {
Name string `json:"name"`
How string `json:"how"`
Description string `json:"description"`
}
Auth is one way to authenticate.
type CLICommand ¶
type CLICommand struct {
Path string `json:"path"`
Use string `json:"use"`
Short string `json:"short"`
Long string `json:"long"`
Example string `json:"example"`
Aliases []string `json:"aliases"`
Hidden bool `json:"hidden"`
Deprecated string `json:"deprecated"`
Flags []CLIFlag `json:"flags"`
InheritedFlags []CLIFlag `json:"inherited_flags"`
Subcommands []string `json:"subcommands"`
}
CLICommand is one command as cobra has it.
type CLIData ¶
type CLIData struct {
Commands []CLICommand `json:"commands"`
}
CLIData is docs/cli.json.
type CLIFlag ¶
type CLIFlag struct {
Name string `json:"name"`
Shorthand string `json:"shorthand"`
Type string `json:"type"`
Default string `json:"default"`
Usage string `json:"usage"`
Required bool `json:"required"`
}
CLIFlag is one flag. Default is as cobra renders it in --help.
type CodeExample ¶
CodeExample is a code sample in one language.
type Command ¶
type Command struct {
Name string `json:"name"`
Use string `json:"use"`
Summary string `json:"summary"`
Details string `json:"details,omitempty"`
Flags []Flag `json:"flags,omitempty"`
Children []Command `json:"children,omitempty"`
}
Command is one CLI command, as cobra has it.
type ConfigData ¶
type ConfigData struct {
Settings []config.SettingDoc `json:"settings"`
}
ConfigData is docs/config.json.
func Config ¶
func Config() ConfigData
Config is every startup setting, then every host policy field, which can also be fixed at startup as PANDO_POLICY_<FIELD> or under policy: in the config file (R-271).
type Connect ¶
type Connect struct {
ServerEnv string `json:"server_env"`
TokenEnv string `json:"token_env"`
LoginCmd string `json:"login_cmd"`
MCPCmd string `json:"mcp_cmd"`
}
Connect is how a machine authenticates, named from the constants the code reads rather than from what somebody wrote down once.
type Document ¶
type Document struct {
API API `json:"api"`
CLI []Command `json:"cli"`
MCP []mcp.ToolDoc `json:"mcp"`
Errors []errs.CodeDoc `json:"errors"`
Events []events.Def `json:"events"`
Connect Connect `json:"connect"`
Install Install `json:"install"`
}
Document is everything a person or an agent needs to use Pando without the console.
type ErrorDoc ¶
type ErrorDoc struct {
Code errs.Code `json:"code"`
Status int `json:"status,omitempty"`
Meaning string `json:"meaning"`
}
ErrorDoc is one error code: what a client branches on, the HTTP status it comes with, and what it means. Status is omitted for a code the error package gives none.
type ErrorsData ¶
type ErrorsData struct {
Errors []ErrorDoc `json:"errors"`
}
ErrorsData is docs/errors.json.
func Errors ¶
func Errors() ErrorsData
Errors is errs.Catalog, sorted by code rather than by status, so a reader looking a code up finds it where the alphabet says.
type EventDoc ¶
type EventDoc struct {
Type string `json:"type"`
Description string `json:"description"`
Scope events.Scope `json:"scope"`
Source events.Source `json:"source"`
Fields []events.Field `json:"fields"`
}
EventDoc is one event a subscription can name: what it is about (one app, or the installation), where Pando learns of it (the audit log, a change of state, or core itself), and the fields its data carries.
type EventsData ¶
type EventsData struct {
EventsGuide
Events []EventDoc `json:"events"`
}
EventsData is docs/events.json.
The guide's fields come first, beside the events, so a site can render the whole of docs/events.md from this file.
type EventsGuide ¶
type EventsGuide struct {
Subscribing string `json:"subscribing"`
Matching string `json:"matching"`
Webhook WebhookGuide `json:"webhook"`
// DataNote is what every audit-sourced event's data also carries.
DataNote string `json:"data_note"`
}
EventsGuide is what a person needs to subscribe to events and receive them: how to subscribe, how events are chosen, and what a webhook receives and how to check it came from Pando (R-364, R-369).
One copy of the text. EventsMarkdown renders it as docs/events.md and Events puts it in docs/events.json, so the page and the site cannot say different things. Plain text: paragraphs separated by a blank line, `backticks` for code, and nothing else of Markdown.
type Flag ¶
type Flag struct {
Name string `json:"name"`
Shorthand string `json:"shorthand,omitempty"`
Description string `json:"description"`
Default string `json:"default,omitempty"`
}
Flag is one flag on a command.
type Install ¶
type Install struct {
// Repo is where releases are published.
Repo string `json:"repo"`
// Module is the `go install` path.
Module string `json:"module"`
// Homebrew is the cask, tap included.
Homebrew string `json:"homebrew"`
// Packages are the Linux package formats each release attaches.
Packages []string `json:"packages"`
// Archive is how a tarball is named, with the parts a person substitutes.
Archive string `json:"archive"`
// WindowsArchive is how Windows's zip is named. A zip rather than a
// tarball, holding pando.exe.
WindowsArchive string `json:"windows_archive"`
// Package is how a Linux package is named. Same shape as Archive, so one
// download line covers every format.
Package string `json:"package"`
// Download is where a release's files are, with the version substituted.
Download string `json:"download"`
// Platforms are the os/arch pairs built.
Platforms []string `json:"platforms"`
// InContainer runs the copy already inside a Compose installation, for
// somebody who would rather install nothing.
InContainer string `json:"in_container"`
}
How to get the CLI.
The server is installed with the Compose file — it needs Postgres, a container runtime and Railpack, none of which a package manager supplies. What ships as a package is the CLI, which is the same binary (R-253) pointed at an installation over its API.
These are constants rather than a read of `.goreleaser.yaml`, because the server serves this document at runtime and there is no release config next to a running container. `install_test.go` reads the release config and go.mod and fails when they and these disagree — so the page describes what a tag actually publishes, and renaming the tap or dropping a package format breaks the build rather than the instructions.
type MCPTool ¶
type MCPTool struct {
Name string `json:"name"`
Description string `json:"description"`
InputSchema map[string]any `json:"input_schema"`
}
MCPTool is one tool as tools/list announces it.
type Route ¶
type Route struct {
Method string `json:"method"`
Path string `json:"path"`
Group string `json:"group"`
Title string `json:"title"`
Summary string `json:"summary"`
Verb string `json:"verb,omitempty"`
Public bool `json:"public,omitempty"`
}
Route is one endpoint.
Verb is the authorization verb the endpoint asks for, in Pando's own vocabulary (design 06 §5) — empty where the endpoint asks for nothing beyond being signed in, because "no verb" is an answer somebody needs.
Public is an endpoint that takes no Pando credential at all: the sign-in steps a browser makes before it has one, the passcode page's, and the webhook a git host signs with the app's own secret.
Title is a few words naming what the endpoint does — "List apps" — for a list of endpoints; Summary is the whole of it.
type WebhookGuide ¶
type WebhookGuide struct {
Intro string `json:"intro"`
BodyExample json.RawMessage `json:"body_example"`
Notes string `json:"notes"`
Headers []WebhookHeader `json:"headers"`
Verifying string `json:"verifying"`
Examples []CodeExample `json:"examples"`
Retries string `json:"retries"`
PrivateAddresses string `json:"private_addresses"`
Shaping string `json:"shaping"`
TemplateExample string `json:"template_example"`
TemplateNotes string `json:"template_notes"`
}
WebhookGuide is what a webhook endpoint receives.
type WebhookHeader ¶
WebhookHeader is one header Pando sends with a delivery.