/** * reindex_project Tool * * MCP tool to rebuild the entire search index from scratch. Useful when the index * seems stale or corrupt. Preserves user configuration (include/exclude patterns) * but regenerates all chunks and embeddings. Requires user confirmation. * * Features: * - Preserves user configuration * - Deletes existing index data * - Performs full re-indexing * - Requires user confirmation (destructive operation) * - Progress reporting during reindexing */ import { z } from 'zod'; import { Config } from '../storage/config.js'; import { type ProgressCallback } from './createIndex.js'; import type { ToolContext } from './searchCode.js'; /** * Input schema for reindex_project tool * * No required inputs - uses current directory context from the MCP client. */ export declare const ReindexProjectInputSchema: z.ZodObject<{}, z.core.$strip>; /** * Inferred input type from schema */ export type ReindexProjectInput = z.infer; /** * Output status for reindex_project tool */ export type ReindexProjectStatus = 'success' | 'cancelled'; /** * Output structure for reindex_project tool */ export interface ReindexProjectOutput { /** Result status */ status: ReindexProjectStatus; /** Number of files indexed (if successful) */ filesIndexed?: number; /** Number of chunks created (if successful) */ chunksCreated?: number; /** Duration string like "45s" or "2m 30s" (if successful) */ duration?: string; /** Additional message (for errors or information) */ message?: string; } /** * Extended tool context with optional progress callback */ export interface ReindexProjectContext extends ToolContext { /** Optional callback for progress updates */ onProgress?: ProgressCallback; /** Whether user has confirmed the operation (for MCP confirmation flow) */ confirmed?: boolean; } /** * Check if an index exists for the project * * @param projectPath - Absolute path to the project root * @returns true if an index exists */ export declare function checkIndexExists(projectPath: string): Promise; /** * Load the existing configuration for the project * * Preserves user configuration (include/exclude patterns) during reindex. * * @param indexPath - Absolute path to the index directory * @returns The existing configuration or null if not found */ export declare function loadExistingConfig(indexPath: string): Promise; /** * Delete index data while preserving configuration * * Removes: * - LanceDB database * - Fingerprints file * - Metadata file * * Preserves: * - config.json (user configuration) * * @param indexPath - Absolute path to the index directory */ export declare function deleteIndexData(indexPath: string): Promise; /** * Rebuild the entire search index from scratch * * Deletes the existing index data (preserving configuration) and creates * a fresh index. Useful when the index is corrupted or out of sync. * * Uses the IndexingLock to prevent concurrent indexing operations. * * @param input - The input (empty object, uses project context) * @param context - Tool context containing the project path and optional callbacks * @returns Reindex result with statistics * * @example * ```typescript * const result = await reindexProject( * {}, * { * projectPath: '/path/to/project', * confirmed: true, * onProgress: (progress) => console.log(formatProgressMessage(progress)) * } * ); * * console.log(result.status); // 'success' * console.log(result.filesIndexed); // 150 * console.log(result.duration); // '45s' * ``` */ export declare function reindexProject(input: ReindexProjectInput, context: ReindexProjectContext): Promise; /** * MCP tool definition for reindex_project * * This tool rebuilds the entire search index from scratch. * It REQUIRES confirmation as it is a destructive operation * that deletes existing index data. */ export declare const reindexProjectTool: { name: string; description: string; inputSchema: { type: "object"; properties: {}; required: string[]; }; requiresConfirmation: boolean; }; /** * Get confirmation message for the tool * * Returns a user-friendly message asking for confirmation before reindexing. * * @returns Confirmation message string */ export declare function getReindexConfirmationMessage(): string; //# sourceMappingURL=reindexProject.d.ts.map