/** * reindex_file Tool * * MCP tool to re-index a single specific file. Useful when the file watcher missed * a change or for manual refresh of a specific file. Does not require confirmation * as it's a fast, low-impact operation. * * Features: * - Single file reindexing * - File validation (exists, passes policy, in index) * - Old chunks removed before adding new * - Fingerprint updated * - No confirmation required (fast operation) */ import { z } from 'zod'; import { IndexingPolicy } from '../engines/indexPolicy.js'; import { ErrorCode } from '../errors/index.js'; import type { ToolContext } from './searchCode.js'; /** * Input schema for reindex_file tool * * Accepts the relative path to the file to reindex. */ export declare const ReindexFileInputSchema: z.ZodObject<{ path: z.ZodString; }, z.core.$strip>; /** * Inferred input type from schema */ export type ReindexFileInput = z.infer; /** * Output status for reindex_file tool */ export type ReindexFileStatus = 'success' | 'error'; /** * Output structure for reindex_file tool */ export interface ReindexFileOutput { /** Result status */ status: ReindexFileStatus; /** Path of the file that was reindexed */ path: string; /** Number of chunks created (if successful) */ chunksCreated?: number; /** Additional message (for errors or information) */ message?: string; } /** * Result of file path validation */ export interface ValidationResult { /** Whether the file is valid for reindexing */ valid: boolean; /** Error code if validation failed */ errorCode?: ErrorCode; /** Error message if validation failed */ errorMessage?: string; /** User-friendly error message if validation failed */ userMessage?: string; } /** * Validate a file path for reindexing * * Checks: * 1. File exists * 2. File is not in hardcoded deny list * 3. File passes indexing policy * * @param relativePath - Relative path to the file * @param projectPath - Absolute path to the project root * @param policy - Initialized IndexingPolicy instance * @returns Validation result */ export declare function validateFilePath(relativePath: string, projectPath: string, policy: IndexingPolicy): Promise; /** * Re-index a single specific file * * Validates the file, removes old chunks, generates new chunks and embeddings, * and updates the index. * * @param input - The input containing the file path * @param context - Tool context containing the project path * @returns Reindex result with chunk count * * @example * ```typescript * const result = await reindexFile( * { path: 'src/auth/login.ts' }, * { projectPath: '/path/to/project' } * ); * * console.log(result.status); // 'success' * console.log(result.chunksCreated); // 5 * ``` */ export declare function reindexFile(input: ReindexFileInput, context: ToolContext): Promise; /** * MCP tool definition for reindex_file * * This tool re-indexes a single specific file. * It does NOT require confirmation as it's a fast, low-impact operation. */ export declare const reindexFileTool: { name: string; description: string; inputSchema: { type: "object"; properties: { path: { type: string; description: string; }; }; required: string[]; }; requiresConfirmation: boolean; }; //# sourceMappingURL=reindexFile.d.ts.map