docs

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package docs ships the framework's user-facing markdown docs as an embedded filesystem. Two consumers:

  1. `gofastr docs` CLI subcommand — list + show + search.
  2. `framework.WithMCPIntrospection()` — exposes framework_docs_list and framework_docs_get tools so agents connected to a running app can answer "how do I use hooks" without leaving the session.

The embedded tree is the source of truth for shipped docs; the repo's canonical edit location IS framework/docs/content/. There's no generation step — every commit changes the binary's docs the next build.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get(name string) ([]byte, error)

Get returns the raw markdown body for the named topic. Returns a "not found" error for unknown names — never panics. Pass the topic name without the .md suffix.

Types

type SearchHit

type SearchHit struct {
	Topic   string
	Line    int
	Heading string // the nearest preceding `# `-level heading, if any
	Excerpt string // the matching line itself
}

SearchHit is a single grep match: which topic, which line, the line text, and a window of surrounding context for the CLI's --grep output.

func Search(term string) ([]SearchHit, error)

Search returns every line across all topics that contains the (case- insensitive) substring `term`, up to defaultSearchHitCap hits. Use SearchWithLimit for a caller-supplied cap.

func SearchWithLimit

func SearchWithLimit(term string, limit int) ([]SearchHit, error)

SearchWithLimit is the explicit-cap variant. limit <= 0 falls back to defaultSearchHitCap. The first `limit` matching lines are returned; the function stops scanning once the cap is reached so the cost is O(limit) for common queries.

type Topic

type Topic struct {
	// Name is the short identifier — the filename without .md.
	// Use this with Get().
	Name string

	// Title is the first H1 heading from the file's content, or the
	// humanised file name when no heading is present.
	Title string

	// Summary is the first non-heading paragraph, truncated to ~200
	// chars. Empty when the file has no prose body.
	Summary string

	// Bytes is the size of the underlying markdown in bytes.
	Bytes int
}

Topic describes a single doc file in the embedded tree.

func List

func List() ([]Topic, error)

List enumerates every embedded doc topic. Result is sorted by Name so the order is stable across builds.

Jump to

Keyboard shortcuts

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