catalog

package
v2.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package catalog extracts the exported API of the Foundation runtime module.

The result is written next to the MCP server and embedded in the CLI, so a tool answering questions about Foundation answers from the source of the version it ships with, never from memory. Regeneration is deterministic and checked in continuous integration, which is what keeps the answer aligned with the code as the code moves.

Index

Constants

View Source
const DocsDir = "mcp/docs"

DocsDir is the embedded documentation directory, relative to the development module root.

View Source
const File = "mcp/api.json"

File is the catalog location relative to the development module root.

Variables

This section is empty.

Functions

func Check

func Check(ctx context.Context, devRoot, runtimeRoot string) error

Check reports whether the committed catalog matches the current source.

func Marshal

func Marshal(api *API) ([]byte, error)

Marshal renders the catalog as deterministic JSON.

func Write

func Write(ctx context.Context, devRoot, runtimeRoot string) (string, error)

Write regenerates the catalog file and the embedded documentation under the development module root.

Types

type API

type API struct {
	Module   string    `json:"module"`
	Go       string    `json:"go"`
	Packages []Package `json:"packages"`
}

API is the exported surface of one module.

func Extract

func Extract(ctx context.Context, dir string) (*API, error)

Extract loads the module rooted at dir and returns its exported API.

type Field

type Field struct {
	Name string `json:"name"`
	Type string `json:"type"`
	Tag  string `json:"tag,omitempty"`
	Doc  string `json:"doc,omitempty"`
}

Field is an exported struct field, including its tag.

type Method

type Method struct {
	Name      string `json:"name"`
	Signature string `json:"signature"`
	Doc       string `json:"doc,omitempty"`
}

Method is an exported method of a type.

type Package

type Package struct {
	Path    string   `json:"path"`
	Name    string   `json:"name"`
	Layer   string   `json:"layer"`
	Doc     string   `json:"doc,omitempty"`
	Symbols []Symbol `json:"symbols"`
}

Package is one importable package.

type Symbol

type Symbol struct {
	Kind      string   `json:"kind"`
	Name      string   `json:"name"`
	Signature string   `json:"signature"`
	Doc       string   `json:"doc,omitempty"`
	Fields    []Field  `json:"fields,omitempty"`
	Methods   []Method `json:"methods,omitempty"`
}

Symbol is an exported declaration.

Jump to

Keyboard shortcuts

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