import { Command } from 'commander'; import { ICommand } from '../lib/command-registry.js'; import { MergeConfiguration } from '../types.js'; /** * Command-line options for the docs:search command. */ export interface DocsSearchOptions { /** Maximum number of results to return */ limit?: string; /** Minimum relevance score (0.0-1.0) */ threshold?: string; /** Output format: pretty (colored, formatted), json (machine-readable), or compact (brief) */ format?: 'pretty' | 'json' | 'compact'; /** Whether colored output is enabled */ color?: boolean; /** Whether to suppress progress messages */ quiet?: boolean; /** Number of tokens of context to show per section (default: 300, ~1200 characters) */ context?: string; /** Filter results by document type: doc (default, user docs), all, api (API operations), schema (data schemas) */ type?: 'all' | 'doc' | 'api' | 'schema'; } /** * CLI command for searching Grepr documentation using semantic search. * * This command provides natural language search over the bundled documentation * index. Users can search with queries like "how to create a pipeline" or * "datadog integration" and get relevant documentation sections. * * Output formats: * - pretty: Human-readable with colors, headings, and previews (default) * - compact: Brief one-line summaries with scores * - json: Machine-readable JSON for scripting * * Example usage: * grepr docs:search "how to create a pipeline" * grepr docs:search "datadog" -l 10 --threshold 0.5 * grepr docs:search "integrations" -f json */ /** * docs:search renders prose, so it keeps its own format vocabulary rather than * the record-oriented one in output-format.ts. Its `compact` is a short prose * preview, not the single-line JSON that `compact` means elsewhere; `json` is * this command's machine-readable rendering. `raw` is accepted as an alias for * `json` because that is the machine-readable name every other command uses. */ declare const DOCS_FORMATS: readonly ["pretty", "json", "compact"]; type DocsFormat = (typeof DOCS_FORMATS)[number]; export declare function parseDocsFormat(value: string): DocsFormat; /** * Pick the default rendering from GREPR_OUTPUT_FORMAT. The env var selects a * CLASS of output rather than a literal format name, because this command's * names do not line up with the record-oriented ones: any machine-readable * setting resolves to this command's JSON rendering, and any human setting to * its prose. An explicit `-f` still names a docs format directly and wins. */ export declare function resolveDocsDefaultFormat(): DocsFormat; export declare class DocsSearchCommand implements ICommand { getCommandName(): string; getCommandDescription(): string; addToProgram(program: Command, _mergeConfiguration: MergeConfiguration): void; /** * Executes the search command. * * @param query - Natural language search query * @param options - Command options from CLI parsing */ private execute; /** * Outputs search results in JSON format. * * Useful for scripting and programmatic processing of search results. * * @param results - Search results to format */ private outputJson; /** * Outputs search results in compact format. * * Shows one result per two lines: URI with score, then brief preview. * The preview shows the most relevant section text (not necessarily from the start). * Multiple sections are separated by ' [...] ' to indicate non-contiguous excerpts. * Useful for quick scanning of many results. * * @param results - Search results to format * @param useColor - Whether to use colored output (default: true) */ private outputCompact; /** * Outputs search results in pretty format with colors and formatting. * * This is the default format optimized for human readability: * - Colored headings and metadata (if color enabled) * - Displays relevant sections from the document (not necessarily from the start) * - Sections are ordered by relevance to the search query * - Multiple sections are separated by '--- [Section N] ---' to indicate non-contiguous excerpts * - Markdown headings (lines starting with #) are bolded (if color enabled) * - Results are well-spaced for easy reading * * @param results - Search results to format * @param useColor - Whether to use colored output (default: true) */ private outputPretty; } export {}; //# sourceMappingURL=docs-command.d.ts.map