capabilities

package
v0.69.0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package capabilities is the source of truth for which graith capabilities each frontend surface (CLI, iOS, macOS) supports.

The manifest lives in capabilities.json and is embedded here. The docs page at website/content/docs/capabilities.md renders a table from this manifest inside a generated region; TestDocMatchesManifest fails if the two drift apart, so the doc can never silently disagree with the manifest. Regenerate the doc with `go test ./internal/capabilities -run TestDocMatchesManifest -update`.

Index

Constants

View Source
const (
	BeginMarker = "<!-- BEGIN GENERATED CAPABILITY MATRIX -->"
	EndMarker   = "<!-- END GENERATED CAPABILITY MATRIX -->"
)

Markers bracket the generated matrix region in the docs page. Everything between them is owned by the generator; prose outside them is hand-written and preserved.

Variables

This section is empty.

Functions

func ExtractRegion

func ExtractRegion(doc string) (string, error)

ExtractRegion returns the trimmed content between the two markers.

Types

type Capability

type Capability struct {
	ID       string `json:"id"`
	Category string `json:"category"`
	Name     string `json:"name"`
	CLI      string `json:"cli"`
	IOS      string `json:"ios"`
	MacOS    string `json:"macos"`
	Notes    string `json:"notes,omitempty"`
}

Capability is one unit of behaviour and its support state per surface.

type GUICapability

type GUICapability struct {
	ID    string `json:"id"`
	IOS   string `json:"ios"`
	MacOS string `json:"macos"`
}

GUICapability is one capability projected for the GUI conformance check: its id and its state on the two GUI surfaces. The CLI column is deliberately dropped — the Swift check only reasons about iOS/macOS, and coupling the GUI fixture to CLI churn would make it stale for no reason.

type GUIFixture

type GUIFixture struct {
	Version      int             `json:"version"`
	Capabilities []GUICapability `json:"capabilities"`
}

GUIFixture is the language-neutral projection the Swift GraithSessionKit conformance test reads (issue #1149). It mirrors the #1129/#1144 protocol fixture: the Go manifest is the source of truth, this is committed under gui/ so SwiftPM can bundle it, and a staleness test keeps the two in step.

type Manifest

type Manifest struct {
	Version      int          `json:"version"`
	Surfaces     []Surface    `json:"surfaces"`
	States       []State      `json:"states"`
	Capabilities []Capability `json:"capabilities"`
}

Manifest is the whole capability matrix.

func Load

func Load() (*Manifest, error)

Load parses and validates the embedded manifest.

func (*Manifest) Categories

func (m *Manifest) Categories() []string

Categories returns the capability categories in first-seen order.

func (*Manifest) Coverage

func (m *Manifest) Coverage() map[string]map[string]int

Coverage reports, per surface, how many capabilities are in each state. Handy for a quick "how far behind is macOS" read; sorted by surface order.

func (*Manifest) GUIFixture

func (m *Manifest) GUIFixture() GUIFixture

GUIFixture projects the manifest to the GUI-facing fixture, in manifest order.

func (*Manifest) MarshalGUIFixture

func (m *Manifest) MarshalGUIFixture() ([]byte, error)

MarshalGUIFixture renders the GUI fixture as indented JSON with a trailing newline, so the committed file is diff-friendly and byte-stable.

func (*Manifest) MatrixMarkdown

func (m *Manifest) MatrixMarkdown() string

MatrixMarkdown renders the capability matrix as Markdown: a legend, then one table per category. Deterministic output so it can be diffed against the committed doc.

func (*Manifest) ReplaceRegion

func (m *Manifest) ReplaceRegion(doc string) (string, error)

ReplaceRegion returns doc with the text between BeginMarker and EndMarker replaced by the freshly rendered matrix. It errors if the markers are missing, duplicated, or out of order, so a malformed doc fails loudly rather than being silently rewritten.

func (*Manifest) StateIDs

func (m *Manifest) StateIDs() []string

StateIDs returns state IDs sorted, for stable iteration in callers.

func (*Manifest) SurfaceIDs

func (m *Manifest) SurfaceIDs() []string

SurfaceIDs returns surface IDs in manifest order.

func (*Manifest) Validate

func (m *Manifest) Validate() error

Validate checks the manifest is internally consistent: known surfaces and states, unique capability IDs, and every capability carrying a valid state for every surface.

type State

type State struct {
	ID          string `json:"id"`
	Symbol      string `json:"symbol"`
	Description string `json:"description"`
}

State is a possible support level for a capability on a surface.

type Surface

type Surface struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
}

Surface is one frontend that clients the daemon.

Jump to

Keyboard shortcuts

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