• Query a stored project by directory path and return results as Markdown

    This is a convenience function that:

    1. Computes the project ID from the root directory path
    2. Performs vector similarity search against that project
    3. Returns formatted Markdown results

    The project must have been previously embedded and stored using embed_and_store_directory().

    Parameters

    • query: string

      Natural language query to search for

    • rootDir: string

      Root directory path of the project (used to compute project ID)

    • options: {
          dimensions?: number;
          fileExtensions?: string[];
          limit?: number;
          model?: string;
          threshold?: number;
      } = {}

      Search options

      • Optionaldimensions?: number

        Embedding dimensions (default: 1536)

      • OptionalfileExtensions?: string[]

        Filter results by file extensions (e.g., ['.ts', '.js'])

      • Optionallimit?: number

        Maximum number of results to return (default: 10)

      • Optionalmodel?: string

        Embedding model to use (default: 'text-embedding-3-small')

      • Optionalthreshold?: number

        Minimum similarity score 0-1 (default: 0.3)

    Returns Promise<string>

    Markdown-formatted search results with relevance scores

    // Query a previously embedded project
    const markdown = await query_project(
    "How does authentication work?",
    "/path/to/project",
    { limit: 5, threshold: 0.6 }
    );
    console.log(markdown);
    // Filter by file type
    const results = await query_project(
    "database connection logic",
    "/home/user/my-app",
    {
    limit: 3,
    threshold: 0.5,
    fileExtensions: ['.ts', '.js']
    }
    );
    // Full workflow: embed, store, then query
    await embed_and_store_directory('/path/to/project', {
    fileExtensions: ['.ts'],
    costLimit: 1.0
    });

    const results = await query_project(
    "error handling patterns",
    "/path/to/project",
    { limit: 10 }
    );
    console.log(results);