manifest

package
v0.14.2 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package manifest provides types and validation for AILANG example manifests. The manifest system ensures documentation stays in sync with reality.

Package manifest provides the JSON schema definition for AILANG manifests.

Index

Constants

View Source
const ExampleHeaderSchema = `` /* 663-byte string literal not displayed */

ExampleHeaderSchema defines the schema for example file headers

View Source
const ManifestSchemaJSON = `` /* 5598-byte string literal not displayed */

ManifestSchemaJSON defines the JSON schema for ailang.manifest/v1

View Source
const SchemaVersion = "ailang.manifest/v1"

SchemaVersion is the current manifest schema version

Variables

This section is empty.

Functions

This section is empty.

Types

type BrokenInfo

type BrokenInfo struct {
	Reason       string   `json:"reason"`
	ErrorCode    string   `json:"error_code"`
	Requires     []string `json:"requires"`
	TrackedIssue string   `json:"tracked_issue,omitempty"`
}

BrokenInfo provides details about why an example is broken

type Environment

type Environment struct {
	Seed     int    `json:"seed"`
	Locale   string `json:"locale"`
	Timezone string `json:"timezone"`
}

Environment captures execution environment settings

type Example

type Example struct {
	Path             string       `json:"path"`
	Status           Status       `json:"status"`
	Mode             Mode         `json:"mode"`
	Tags             []string     `json:"tags,omitempty"`
	Description      string       `json:"description,omitempty"`
	Expected         *Expected    `json:"expected,omitempty"`
	Environment      *Environment `json:"environment,omitempty"`
	Broken           *BrokenInfo  `json:"broken,omitempty"`
	RequiresFeatures []string     `json:"requires_features,omitempty"`
	SkipReason       string       `json:"skip_reason,omitempty"`
}

Example represents a single example file in the manifest

type Expected

type Expected struct {
	Stdout       string `json:"stdout,omitempty"`
	Stderr       string `json:"stderr,omitempty"`
	ExitCode     int    `json:"exit_code"`
	ErrorPattern string `json:"error_pattern,omitempty"`
}

Expected captures expected output for validation

type Manifest

type Manifest struct {
	Schema        string     `json:"schema"`
	SchemaVersion string     `json:"schema_version"`
	SchemaDigest  string     `json:"schema_digest"`
	GeneratedAt   time.Time  `json:"generated_at"`
	Generator     string     `json:"generator"`
	Examples      []Example  `json:"examples"`
	Statistics    Statistics `json:"statistics"`
}

Manifest represents the complete example manifest

func Load

func Load(path string) (*Manifest, error)

Load reads and validates a manifest from a file

func New

func New() *Manifest

New creates a new manifest with defaults

func (*Manifest) FindExample

func (m *Manifest) FindExample(path string) (*Example, bool)

FindExample locates an example by path

func (*Manifest) GenerateREADMESection

func (m *Manifest) GenerateREADMESection() string

GenerateREADMESection generates the status table for README

func (*Manifest) GetBrokenExamples

func (m *Manifest) GetBrokenExamples() []Example

GetBrokenExamples returns all broken examples

func (*Manifest) GetWorkingExamples

func (m *Manifest) GetWorkingExamples() []Example

GetWorkingExamples returns all working examples

func (*Manifest) Save

func (m *Manifest) Save(path string) error

Save writes the manifest to a file with deterministic JSON

func (*Manifest) UpdateSchemaDigest

func (m *Manifest) UpdateSchemaDigest()

UpdateSchemaDigest recalculates the schema digest

func (*Manifest) UpdateStatistics

func (m *Manifest) UpdateStatistics()

UpdateStatistics recalculates the statistics

func (*Manifest) Validate

func (m *Manifest) Validate() error

Validate checks the manifest for consistency

type Mode

type Mode string

Mode represents how an example should be executed

const (
	ModeFile Mode = "file"
	ModeREPL Mode = "repl"
)

type Statistics

type Statistics struct {
	Total        int     `json:"total"`
	Working      int     `json:"working"`
	Broken       int     `json:"broken"`
	Experimental int     `json:"experimental"`
	Coverage     float64 `json:"coverage"`
}

Statistics provides aggregate information about examples

type Status

type Status string

Status represents the status of an example

const (
	StatusWorking      Status = "working"
	StatusBroken       Status = "broken"
	StatusExperimental Status = "experimental"
)

Jump to

Keyboard shortcuts

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