/** * XanoScript Documentation Module * * This module contains the core logic for XanoScript documentation * handling, separated from the MCP server for testability. */ export interface DocConfig { file: string; applyTo: string[]; description: string; /** * Load order under a `max_tokens` budget for file_path mode: LOWER loads * first (and so survives truncation). Topics sharing a value fall back to * docs_index.json declaration order. Omitted (undefined) sorts last (99). */ priority?: number; } export interface XanoscriptDocsArgs { topic?: string; file_path?: string; mode?: "full" | "quick_reference" | "index"; tier?: "survival" | "working"; max_tokens?: number; exclude_topics?: string[]; } export declare const XANOSCRIPT_DOCS_V2: Record; /** * Resolve a topic name or alias to a canonical topic name. Returns the input * unchanged when it is already canonical or unknown, so callers can still * surface the existing "Unknown topic" error for genuinely bad input. */ export declare function resolveTopic(input?: string): string | undefined; /** Get all alias names (keys of the alias -> canonical topic map). */ export declare function getAliasNames(): string[]; /** * Clear all cached documentation content and version data. * Useful for testing or when docs files change at runtime. */ export declare function clearDocsCache(): void; export interface TierFact { /** Human-readable size, e.g. "5KB". */ kb: string; /** Human-readable token estimate, e.g. "1.2K tokens" or "320 tokens". */ tokens: string; } /** * Single source of truth for the survival/working tier size facts. * * These numbers are advertised in the tool spec, the index output, and the * README. Deriving them from the actual files (instead of hand-syncing literals * in four places) is what stops them drifting stale — the recurring bug this * helper exists to kill. Estimate ratio matches the tool spec: ~250 tokens/KB. */ export declare function getTierFacts(docsPath: string): { survival: TierFact; working: TierFact; }; /** * Get list of topics that apply to a given file path based on applyTo patterns */ export declare function getDocsForFilePath(filePath: string): string[]; /** * Extract the Quick Reference section plus critical sections * (Common Mistakes, Decision/Choosing trees) from a doc. */ export declare function extractQuickReference(content: string, topic: string): string; /** * Get the documentation version from the version.json file */ export declare function getXanoscriptDocsVersion(docsPath: string): string; /** * Read XanoScript documentation with v2 structure */ export declare function readXanoscriptDocsV2(docsPath: string, args?: XanoscriptDocsArgs): string; export interface TopicDoc { topic: string; content: string; } /** * Read documentation as structured per-topic entries for file_path mode. * Returns each matched topic as a separate object for multi-content MCP responses. */ export declare function readXanoscriptDocsStructured(docsPath: string, args: XanoscriptDocsArgs & { file_path: string; }): TopicDoc[]; /** * Get available topic names */ export declare function getTopicNames(): string[]; /** * Get topic descriptions for documentation */ export declare function getTopicDescriptions(): string;