scriptdocs

package
v0.45.1 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package scriptdocs embeds the documentation an AI assistant reads to write scripts for the run_script tool: an OKF 0.2 bundle (okf/knot-scripting) holding the guide (writing-scripts.md) and one page per knot.* library a script may import (libraries/<module>.md). The script_docs MCP tool and docs() inside a script serve it.

Index

Constants

This section is empty.

Variables

View Source
var NotForScripts = map[string]string{
	"knot.ai":         "calls the AI model",
	"knot.mcp":        "calls other MCP tools",
	"knot.event":      "event sink accessors, and imports requests",
	"knot.secret":     "reads secret values",
	"knot.token":      "manages API tokens",
	"knot.mcp_server": "MCP server configurations hold credentials, and listing tools reaches the remote server",
}

NotForScripts are the knot.* modules AI-written scripts may not import, and so have no page in the bundle. Keep in step with aiScriptLibraries in internal/service/ai_script.go; the drift test checks every module under internal/scriptling/lib/knot is documented or listed here.

Functions

func FS

func FS() fs.FS

FS returns the embedded bundle, rooted at its index.md.

func Guide

func Guide() string

Guide returns the guide to writing scripts, followed by the list of libraries with their descriptions.

func Library

func Library(name string) (string, error)

Library returns the page of one library, named with or without the "knot." prefix. An unknown name is an error listing the valid names.

func Lookup

func Lookup(spec string) (string, error)

Lookup serves the script_docs tool: spec is empty (the guide) or one or more comma-separated names, each a library ("space", "knot.pool") or "guide". The pages are returned in the order named, separated by rules.

func ModuleName

func ModuleName(name string) string

ModuleName normalises a library name to its module ("pool", "knot.pool" and " Knot.Pool " are all "knot.pool"); "" for a blank name.

func Names

func Names() []string

Names lists the documented library names.

func SplitFrontmatter

func SplitFrontmatter(page string) (map[string]any, string, error)

SplitFrontmatter separates a page's YAML frontmatter from its body. A page without frontmatter has a nil map; frontmatter that does not parse is an error.

Types

type LibraryInfo

type LibraryInfo struct {
	Name        string // full module name, e.g. "knot.space"
	Description string // the page's frontmatter description
}

LibraryInfo names one documented library and what it is for.

func Libraries

func Libraries() []LibraryInfo

Libraries lists the documented libraries, sorted by name, with the description from each page's frontmatter.

Jump to

Keyboard shortcuts

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