schema

package
v0.5.5 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package schema provides a self-describing schema registry for glean-cli commands. Each command registers a CommandSchema describing its flags, required fields, defaults, and an example invocation. The `glean schema` command exposes this registry to callers (human or agent) without needing documentation in context.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func List

func List() []string

List returns all registered command names in sorted order.

func MarshalList

func MarshalList() ([]byte, error)

MarshalList returns JSON for all registered schemas, keyed by command name.

func Register

func Register(s CommandSchema)

Register adds a CommandSchema to the global registry. Call this from each command's init or constructor.

Types

type CommandSchema

type CommandSchema struct {
	Command     string                `json:"command"`
	Description string                `json:"description"`
	Flags       map[string]FlagSchema `json:"flags"`
	Example     string                `json:"example"`
}

CommandSchema describes one glean command for agent introspection.

func Get

func Get(command string) (CommandSchema, error)

Get returns the schema for a single command, or an error if not found.

type FlagSchema

type FlagSchema struct {
	Description string   `json:"description"`
	Type        string   `json:"type"`
	Default     any      `json:"default,omitempty"`
	Enum        []string `json:"enum,omitempty"`
	Required    bool     `json:"required,omitempty"`
}

FlagSchema describes a single CLI flag.

Jump to

Keyboard shortcuts

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