api

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2026 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const SchemaVersion = "v1"

SchemaVersion is the current schema version string.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attributes

type Attributes struct {
	Mode uint32 `json:"mode,omitempty"` // File mode (e.g., 0644)
}

Attributes defines optional metadata for nodes/leaves.

type Leaf

type Leaf struct {
	// Name of the file. Can be a template string.
	Name string `json:"name"`
	// ContentTemplate is the template string used to generate the file content.
	// Mutually exclusive with ContentSource.
	ContentTemplate string `json:"content_template,omitempty"`
	// ContentSource names an auxiliary table that provides file content.
	// The materializer joins the aux table with construct directories by
	// symbol name to create files. Supported sources: "lsp_hover",
	// "lsp_diagnostics", "lsp_defs", "lsp_refs".
	// Mutually exclusive with ContentTemplate.
	ContentSource string `json:"content_source,omitempty"`
	// Attributes defines file permissions/metadata (optional).
	Attributes *Attributes `json:"attributes,omitempty"`
}

Leaf represents a file in the filesystem.

type Node

type Node struct {
	// Name of the directory. Can be a template string.
	Name string `json:"name"`
	// Selector is a query (e.g., JSONPath) to select data for this node context.
	Selector string `json:"selector,omitempty"`
	// Refs are template strings that generate cross-reference tokens.
	// Each rendered token is added to the ref index, enabling callers/ virtual
	// directories for JSON-projected data (e.g., tool names across MCP servers).
	Refs []string `json:"refs,omitempty"`
	// SkipSelfMatch prevents the selector from matching the current context node itself.
	// Useful for recursive schemas to avoid infinite loops.
	SkipSelfMatch bool `json:"skip_self_match,omitempty"`
	// Language hint for multi-language schemas (e.g., "go", "terraform", "python").
	// Used to filter nodes during ingestion to prevent cross-language query errors.
	Language string `json:"language,omitempty"`
	// Include references named file sets from Topology.FileSets.
	// The referenced leaves are appended to this node's Files during
	// schema resolution.
	Include []string `json:"include,omitempty"`
	// Children directories.
	Children []Node `json:"children,omitempty"`
	// Files within this directory.
	Files []Leaf `json:"files,omitempty"`
}

Node represents a directory in the filesystem. It can contain other nodes or leaves (files).

type Topology

type Topology struct {
	// Version of the Mache schema.
	Version string `json:"version"`
	// Table is the SQLite table name to query (default: "results").
	Table string `json:"table,omitempty"`
	// FileSets defines reusable groups of file definitions that can be
	// included by nodes via the Include field. Avoids duplicating file
	// entries across many construct types.
	FileSets map[string][]Leaf `json:"file_sets,omitempty"`
	// Root nodes of the filesystem.
	Nodes []Node `json:"nodes,omitempty"`
}

Topology represents the root configuration of the semantic overlay. It maps the input data source to a directory structure.

func (*Topology) ResolveIncludes added in v0.6.0

func (t *Topology) ResolveIncludes()

ResolveIncludes expands all Include references in the schema tree, appending the referenced FileSets leaves to each node's Files. Call this once after parsing the schema, before ingestion or materialization.

Jump to

Keyboard shortcuts

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