import { MAX_DESCRIBE_ENTRIES } from "./cli"; export function renderHelp(): string { return JSON.stringify({ status: "ok", commands: { search: { input: { query: "" }, output: { status: "ok | metadata_required", matches: [""] }, }, describe: { input: { entries: [{ name: "", description: "" }], }, max_entries: MAX_DESCRIBE_ENTRIES, }, "seed-export": { input: { directory: "", batch_size: 20 }, output: { status: "ok", files: [""], entries: 0, batch_size: 20 }, }, "seed-import": { input: { directory: "" }, output: { status: "ok", imported: 0, hydrated: 0 }, }, list: { input: {}, output: { status: "ok", commands: [""] } }, scan: { input: {}, output: { status: "ok", commands: [""] } }, help: { input: {}, output: { status: "ok" } }, }, }); } export function renderCommands(commands: string[]): string { return JSON.stringify({ status: "ok", commands }); } export function renderMatches(matches: string[]): string { return JSON.stringify({ status: "ok", matches }); } export function renderDocumented(documented: string[]): string { return JSON.stringify({ status: "ok", documented }); } export function renderSeedExport(files: string[], entries: number, batchSize: number): string { return JSON.stringify({ status: "ok", files, entries, batch_size: batchSize }); } export function renderSeedImport(imported: number, hydrated: number): string { return JSON.stringify({ status: "ok", imported, hydrated }); } export function renderMetadataBlock(undocumented: string[]): string { return JSON.stringify({ status: "metadata_required", next_action: "describe", max_entries_per_describe: MAX_DESCRIBE_ENTRIES, undocumented, instructions: [ "Use tool-query describe next with a JSON payload.", "Do not assume what an undocumented command does.", "Use web search when a command is unclear.", "If web search is unreliable, ask the user for clarification.", "Each description must be exactly one sentence.", ], }); } export function renderError(code: string, message: string): string { return JSON.stringify({ status: "error", error: code, message }); }