Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var SupportedFormats = []string{ string(Text), string(JSON), string(JSONSchema), }
SupportedFormats is a list of all supported output formats as strings
Functions ¶
func FormatOutput ¶
func FormatOutput(content string, format OutputFormat) string
FormatOutput formats the AI response according to the specified format
func GetHelpText ¶
func GetHelpText() string
GetHelpText returns a formatted string describing all supported formats
func ResolveSchemaRef ¶ added in v1.3.0
ResolveSchemaRef checks a schema map for a root-level "$ref" key pointing to a file path and loads the entire schema from that file. If baseDir is non-empty, relative $ref paths are resolved against it. When no $ref is found the original schema is returned unchanged.
This function should be called on any schema that may originate from user config (CLI flag, .opencode.json, agent markdown frontmatter) before the schema is used to build tool parameters.
func ValidateJSONSchema ¶ added in v1.3.0
ValidateJSONSchema performs basic validation of a JSON schema.
Types ¶
type OutputFormat ¶
type OutputFormat string
OutputFormat represents the output format type for non-interactive mode
const ( // Text format outputs the AI response as plain text. Text OutputFormat = "text" // JSON format outputs the AI response wrapped in a JSON object. JSON OutputFormat = "json" // JSONSchema format outputs the AI response validated against a JSON schema. JSONSchema OutputFormat = "json_schema" )
func ParseWithSchema ¶ added in v1.3.0
func ParseWithSchema(s string) (OutputFormat, map[string]any, error)
ParseWithSchema parses an output format string that may contain an embedded JSON schema or a file path to one.
Supported forms:
json_schema='{"type":"object",...}' — inline JSON schema
json_schema=/path/to/schema.json — load schema from file
json_schema='{"$ref":"/path/to/schema.json"}' — load schema from $ref file
func (OutputFormat) String ¶
func (f OutputFormat) String() string
String returns the string representation of the OutputFormat
type Spinner ¶
type Spinner struct {
// contains filtered or unexported fields
}
Spinner provides a terminal spinner animation for non-interactive mode. It displays a loading indicator while operations are in progress.
func NewSpinner ¶
NewSpinner creates a new spinner with the given message