### TypeScript Example: Index and Search Codebase Source: https://coderag.sylphx.com/index Demonstrates how to use the CodebaseIndexer and PersistentStorage from '@sylphx/coderag' to index a local codebase with file watching and perform a semantic search for code snippets. It initializes storage and the indexer, starts the indexing process, and then searches for a given query, returning ranked results. ```typescript import { CodebaseIndexer, PersistentStorage } from '@sylphx/coderag' // Create persistent storage (SQLite) const storage = new PersistentStorage({ codebaseRoot: './my-project' }) // Initialize indexer const indexer = new CodebaseIndexer({ codebaseRoot: './my-project', storage, }) // Index codebase with file watching await indexer.index({ watch: true }) // Search for code const results = await indexer.search('authentication logic', { limit: 10, includeContent: true, }) console.log(results) // [{ path: 'src/auth.ts', score: 0.85, snippet: '...', chunkType: 'FunctionDeclaration' }] ``` -------------------------------- ### Install CodeRAG using bun Source: https://coderag.sylphx.com/index Provides the command to install the CodeRAG package using bun, a fast all-in-one JavaScript runtime. This command adds the package as a project dependency. ```bash bun add @sylphx/coderag ``` -------------------------------- ### Install CodeRAG using npm Source: https://coderag.sylphx.com/index Provides the command to install the CodeRAG package using npm, the Node Package Manager. This is a standard way to add project dependencies in a Node.js environment. ```bash npm install @sylphx/coderag ``` -------------------------------- ### Install CodeRAG using pnpm Source: https://coderag.sylphx.com/index Provides the command to install the CodeRAG package using pnpm, a fast and efficient package manager for Node.js. This command adds the package as a project dependency. ```bash pnpm add @sylphx/coderag ``` -------------------------------- ### Run MCP Server with CodeRAG CLI Source: https://coderag.sylphx.com/index Shows how to launch the CodeRAG Model Context Protocol (MCP) server using the command-line interface (CLI). This server enables integration with AI assistants like Claude and Cursor by specifying the project root directory. ```bash npx @sylphx/coderag-mcp --root=/path/to/project ``` -------------------------------- ### Configure MCP Server in Claude Desktop Source: https://coderag.sylphx.com/index Illustrates how to configure the CodeRAG MCP server within the `claude_desktop_config.json` file. This allows Claude's desktop application to automatically discover and use the CodeRAG server for code-related queries. ```json { "mcpServers": { "coderag": { "command": "npx", "args": ["-y", "@sylphx/coderag-mcp", "--root=/path/to/project"] } } } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.