### Install and Run Octomind Source: https://github.com/muvon/octocode/blob/master/doc/MCP_CLIENTS.md Install Octomind, which comes with Octocode pre-configured. Then, run Octomind to start your project with MCP server automatically set up. ```bash curl -fsSL https://raw.githubusercontent.com/muvon/octomind/master/install.sh | bash octomind run developer:rust ``` -------------------------------- ### Start MCP Server with Different LSP Tools Source: https://github.com/muvon/octocode/blob/master/doc/ADVANCED_USAGE.md Configure the MCP server to use different language servers for LSP integration. Examples include 'pylsp' for Python and 'typescript-language-server --stdio' for TypeScript. ```bash # For other language servers octocode mcp --path /path/to/your/project --with-lsp "pylsp" octocode mcp --path /path/to/your/project --with-lsp "typescript-language-server --stdio" ``` -------------------------------- ### Show Installation Script Help Source: https://github.com/muvon/octocode/blob/master/INSTALL.md Display the help message for the OctoCode installation script to see all available options. ```bash curl -fsSL https://raw.githubusercontent.com/muvon/octocode/master/install.sh | sh -s -- --help ``` -------------------------------- ### Build and Install from Source Source: https://github.com/muvon/octocode/blob/master/INSTALL.md Build and install OctoCode from its source code using Cargo. Ensure Rust and protoc are installed first. ```bash git clone https://github.com/muvon/octocode.git cd octocode # Build and install cargo install --path . ``` -------------------------------- ### Install to Custom Directory Source: https://github.com/muvon/octocode/blob/master/INSTALL.md Customize the installation directory by using the --install-dir flag with the installation script. ```bash curl -fsSL https://raw.githubusercontent.com/muvon/octocode/master/install.sh | sh -s -- --install-dir /usr/local/bin ``` -------------------------------- ### Zed Editor Setup Source: https://github.com/muvon/octocode/blob/master/doc/MCP_CLIENTS.md Setup instructions for Zed editor to use Octocode MCP server. ```APIDOC ## Zed Editor Setup **Config location:** `~/.config/zed/settings.json` ```json { "mcp_servers": { "octocode": { "command": "octocode", "args": ["mcp", "--path", "/path/to/your/project"] } } } ``` ``` -------------------------------- ### Install Protoc on Ubuntu/Debian Source: https://github.com/muvon/octocode/blob/master/INSTALL.md Install the Protocol Buffers compiler (protoc) on Ubuntu or Debian-based systems using apt-get. ```bash sudo apt-get install protobuf-compiler ``` -------------------------------- ### Starting MCP Server with LSP Source: https://github.com/muvon/octocode/blob/master/doc/LSP_INTEGRATION.md Instructions on how to start the MCP server with LSP integration enabled, specifying the desired language server. ```APIDOC ## Starting MCP Server with LSP To start the MCP server with LSP integration, use the `--with-lsp` flag followed by the language server name. ### Command ```bash octocode mcp --path /path/to/your/project --with-lsp "rust-analyzer" ``` ### Claude Desktop Configuration For integration with Claude Desktop, configure your `mcpServers` as follows: ```json { "mcpServers": { "octocode": { "command": "octocode", "args": ["mcp", "--path", "/path/to/your/project", "--with-lsp", "rust-analyzer"] } } } ``` ``` -------------------------------- ### Install Protoc on Windows Source: https://github.com/muvon/octocode/blob/master/INSTALL.md Install the Protocol Buffers compiler (protoc) on Windows using Chocolatey in Git Bash or WSL. ```bash choco install protoc ``` -------------------------------- ### Install and Run Octomind Source: https://github.com/muvon/octocode/blob/master/README.md Use this command to install Octomind and initialize the developer environment for Rust projects. ```bash curl -fsSL https://raw.githubusercontent.com/muvon/octomind/master/install.sh | bash octomind run developer:rust ``` -------------------------------- ### Onboarding with AI Source: https://github.com/muvon/octocode/blob/master/README.md Example of querying the AI about authentication system architecture. ```text You: "How does the authentication system work?" AI: *searches and navigates* "Authentication starts in src/middleware/auth.rs which validates JWT tokens. It calls src/auth/jwt.rs for token verification, which uses the public key from config. Failed auth returns 401 via src/errors/auth_error.rs. Sessions are stored in Redis via src/cache/session.rs." ``` -------------------------------- ### Install with sudo and custom directory Source: https://github.com/muvon/octocode/blob/master/INSTALL.md Use sudo with the installation script to install OctoCode to a system-wide directory like /usr/local/bin, especially if permission issues arise. ```bash sudo curl -fsSL https://raw.githubusercontent.com/muvon/octocode/master/install.sh | sh -s -- --install-dir /usr/local/bin ``` -------------------------------- ### Install Protoc on macOS Source: https://github.com/muvon/octocode/blob/master/INSTALL.md Install the Protocol Buffers compiler (protoc) on macOS using Homebrew. ```bash brew install protobuf ``` -------------------------------- ### Start MCP Server with Default Settings Source: https://github.com/muvon/octocode/blob/master/doc/CONFIGURATION.md Initiate the MCP server using default configurations, specifying the project path. ```bash # Start MCP server with default settings octocode mcp --path /path/to/project ``` -------------------------------- ### Start MCP Server with LSP Source: https://github.com/muvon/octocode/blob/master/doc/LSP_INTEGRATION.md Starts the MCP server with LSP integration for a specified language server. Ensure the project path is correct. ```bash octocode mcp --path /path/to/your/project octocode mcp --path /path/to/your/project --with-lsp "rust-analyzer" ``` -------------------------------- ### Start MCP Server and Use CLI Tools Source: https://github.com/muvon/octocode/blob/master/website/index.html Start the MCP server for AI assistants and then use OctoCode CLI tools for AI-powered Git workflows like committing and reviewing code. ```bash # Start MCP server for AI assistants octocode mcp --path . ``` ```bash # Try AI-powered git workflow octocode commit --all ``` ```bash octocode review --focus security ``` -------------------------------- ### Start MCP Server for C/C++ with clangd Source: https://github.com/muvon/octocode/blob/master/doc/LSP_INTEGRATION.md Starts the MCP server with LSP integration for C/C++ projects using the clangd language server. Ensure the correct project path is provided. ```bash octocode mcp --path /path/to/cpp/project --with-lsp "clangd" ``` -------------------------------- ### Start MCP Server Source: https://github.com/muvon/octocode/blob/master/website/index.html Initiates the Octocode MCP server. Specify the project path to index. ```bash octocode mcp --path /your/project ``` -------------------------------- ### Start MCP Server for Go with gopls Source: https://github.com/muvon/octocode/blob/master/doc/LSP_INTEGRATION.md Starts the MCP server with LSP integration for Go projects using the gopls language server. Specify the correct project path. ```bash octocode mcp --path /path/to/go/project --with-lsp "gopls" ``` -------------------------------- ### Install Specific Version Source: https://github.com/muvon/octocode/blob/master/INSTALL.md Install a particular version of OctoCode by specifying the --version flag with the installation script. ```bash curl -fsSL https://raw.githubusercontent.com/muvon/octocode/master/install.sh | sh -s -- --version 0.1.0 ``` -------------------------------- ### Start MCP Server Source: https://github.com/muvon/octocode/blob/master/doc/COMMANDS.md Commands to initialize the MCP server with various configurations including LSP integration, HTTP binding, and debug logging. ```bash # Basic MCP server octocode mcp --path /path/to/your/project # With LSP integration octocode mcp --path /path/to/project --with-lsp "rust-analyzer" octocode mcp --path /path/to/project --with-lsp "pylsp" octocode mcp --path /path/to/project --with-lsp "typescript-language-server --stdio" # HTTP mode (instead of stdin/stdout) octocode mcp --bind "127.0.0.1:8080" --path /path/to/project # Custom port octocode mcp --path /path/to/project --port 3001 # Debug mode with enhanced logging octocode mcp --path /path/to/project --debug ``` -------------------------------- ### Extract and Install Binaries (Unix/Linux/macOS) Source: https://github.com/muvon/octocode/blob/master/INSTALL.md Manually install OctoCode on Unix-like systems by extracting the downloaded archive and moving the binary to a directory in your PATH. ```bash tar xzf octocode-VERSION-TARGET.tar.gz mv octocode ~/.local/bin/ # or sudo mv octocode /usr/local/bin/ ``` -------------------------------- ### Quick Install Universal Script Source: https://github.com/muvon/octocode/blob/master/INSTALL.md Use this command to quickly install OctoCode on Unix/Linux/macOS/Windows systems. It downloads and executes the installation script. ```bash curl -fsSL https://raw.githubusercontent.com/muvon/octocode/master/install.sh | sh ``` -------------------------------- ### Install OctoCode CLI Source: https://github.com/muvon/octocode/blob/master/website/index.html Use this command to install the OctoCode CLI on Linux, macOS, or Windows. Ensure you have curl installed. ```bash curl -fsSL https://raw.githubusercontent.com/Muvon/octocode/master/install.sh | sh ``` -------------------------------- ### Check LSP Server Installation Source: https://github.com/muvon/octocode/blob/master/doc/LSP_INTEGRATION.md Verify if a specific language server executable is available in the system's PATH. ```bash which rust-analyzer ``` ```bash which pylsp ``` -------------------------------- ### Start MCP Server for Rust with rust-analyzer Source: https://github.com/muvon/octocode/blob/master/doc/LSP_INTEGRATION.md Starts the MCP server with LSP integration for Rust projects using the rust-analyzer language server. Specify the correct project path. ```bash octocode mcp --path /path/to/rust/project --with-lsp "rust-analyzer" ``` -------------------------------- ### Environment-Specific MCP Configuration Source: https://github.com/muvon/octocode/blob/master/doc/MCP_INTEGRATION.md Examples of running the MCP server with different configurations for development and production environments. ```bash # Development environment octocode mcp --path . --debug # Production environment octocode mcp --path /app --bind "127.0.0.1:8080" --quiet ``` -------------------------------- ### Start MCP Server for Java with jdtls Source: https://github.com/muvon/octocode/blob/master/doc/LSP_INTEGRATION.md Starts the MCP server with LSP integration for Java projects using the jdtls language server. Specify the correct project path. ```bash octocode mcp --path /path/to/java/project --with-lsp "jdtls" ``` -------------------------------- ### Verify OctoCode Installation Source: https://github.com/muvon/octocode/blob/master/INSTALL.md Check if OctoCode has been installed correctly by running the version command. ```bash octocode --version ``` -------------------------------- ### Start MCP Server for Python with pylsp or pyright Source: https://github.com/muvon/octocode/blob/master/doc/LSP_INTEGRATION.md Starts the MCP server with LSP integration for Python projects. Supports both pylsp and pyright language servers. Ensure the correct language server command is used. ```bash # Using pylsp octocode mcp --path /path/to/python/project --with-lsp "pylsp" # Using pyright octocode mcp --path /path/to/python/project --with-lsp "pyright-langserver --stdio" ``` -------------------------------- ### Install OctoCode using Cargo Source: https://github.com/muvon/octocode/blob/master/website/index.html Alternative installation method using Cargo, Rust's package manager. This requires Rust to be installed. ```bash cargo install --git https://github.com/Muvon/octocode ``` -------------------------------- ### Start MCP Server with LSP Integration (Stdin Mode) Source: https://github.com/muvon/octocode/blob/master/doc/ADVANCED_USAGE.md Enable Language Server Protocol (LSP) integration when starting the MCP server in stdin mode. Specify the language server executable, such as 'rust-analyzer'. ```bash # Stdin mode with LSP integration octocode mcp --path /path/to/your/project --with-lsp "rust-analyzer" ``` -------------------------------- ### Install for Specific Target Source: https://github.com/muvon/octocode/blob/master/INSTALL.md Install OctoCode for a specific target architecture and OS by using the --target flag. ```bash curl -fsSL https://raw.githubusercontent.com/muvon/octocode/master/install.sh | sh -s -- --target x86_64-unknown-linux-musl ``` -------------------------------- ### Extract and Install Binaries (Windows) Source: https://github.com/muvon/octocode/blob/master/INSTALL.md Manually install OctoCode on Windows using Git Bash, WSL, or MSYS2. Extract the archive and move the executable to a directory in your PATH. ```bash tar xzf octocode-VERSION-x86_64-pc-windows-gnu.zip # Move to a directory in your PATH mv octocode.exe ~/.local/bin/ # or copy to Windows PATH directory cp octocode.exe /c/Windows/System32/ # (requires admin) ``` -------------------------------- ### Start Multi-Repository MCP Server Source: https://github.com/muvon/octocode/blob/master/doc/COMMANDS.md Commands to serve multiple git repositories from a single MCP endpoint by scanning subdirectories. ```bash # Multi-repo over stdio (default transport) octocode mcp --multi --path /path/to/parent/directory # Multi-repo over HTTP octocode mcp --multi --bind "127.0.0.1:8080" --path /workspace --debug ``` -------------------------------- ### Basic Search Mode Examples Source: https://github.com/muvon/octocode/blob/master/doc/ADVANCED_USAGE.md Demonstrates how to use the `octocode search` command with different modes to filter search results by content type. ```bash # Search specific content types octocode search "database schema" --mode code # Only code octocode search "API documentation" --mode docs # Only docs octocode search "configuration" --mode text # Only text files octocode search "error handling" --mode all # All content types (excludes commits) octocode search "mcp migration" --mode commits # Git commit history ``` -------------------------------- ### Run Multi-Repository MCP Source: https://github.com/muvon/octocode/blob/master/doc/MCP_INTEGRATION.md Commands to start the MCP server in multi-repository mode over stdio or HTTP. ```bash # Multi-repo over stdio octocode mcp --multi --path /path/to/parent/directory # Multi-repo over HTTP octocode mcp --multi --bind "127.0.0.1:8080" --path /workspace ``` -------------------------------- ### Multiple Language Project Setup Source: https://github.com/muvon/octocode/blob/master/doc/LSP_INTEGRATION.md Run separate MCP servers for different language projects within the same workspace, each configured with its respective LSP server and port. ```bash # Terminal 1: Rust project octocode mcp --path /path/to/rust/project --with-lsp "rust-analyzer" --port 3001 ``` ```bash # Terminal 2: Python project octocode mcp --path /path/to/python/project --with-lsp "pylsp" --port 3002 ``` -------------------------------- ### Start Octocode MCP Server Source: https://github.com/muvon/octocode/blob/master/doc/MCP_INTEGRATION.md Commands to initialize the MCP server with custom paths, debug modes, and network bindings. ```bash octocode mcp \ --path /path/to/project \ --debug ``` ```bash octocode mcp \ --bind "0.0.0.0:8080" \ --path /path/to/project \ --debug ``` -------------------------------- ### Start MCP Server with Custom Port Source: https://github.com/muvon/octocode/blob/master/doc/CONFIGURATION.md Launch the MCP server on a specific port by providing the --port argument. ```bash # Start with custom port octocode mcp --path /path/to/project --port 3001 ``` -------------------------------- ### MCP Client Configuration with Environment Variables Source: https://github.com/muvon/octocode/blob/master/doc/MCP_CLIENTS.md Example MCP client configuration defining servers, commands, and environment variables. This allows setting API keys directly within the client configuration. ```json { "mcpServers": { "octocode": { "command": "octocode", "args": ["mcp", "--path", "/path/to/project"], "env": { "VOYAGE_API_KEY": "your-key" } } } } ``` -------------------------------- ### Start MCP Server with Debug Logging Source: https://github.com/muvon/octocode/blob/master/doc/CONFIGURATION.md Enable debug logging for the MCP server by including the --debug flag. ```bash # Start with debug logging octocode mcp --path /path/to/project --debug ``` -------------------------------- ### Start Octocode HTTP Server Source: https://github.com/muvon/octocode/blob/master/doc/MCP_CLIENTS.md Command to start Octocode in HTTP mode, making it accessible via a web server. ```APIDOC ## HTTP Mode (Custom Integrations) For web-based integrations or testing, Octocode can run as an HTTP server: ```bash # Start HTTP server octocode mcp --bind 0.0.0.0:12345 --path /path/to/your/project # Now accessible at http://localhost:12345 ``` ``` -------------------------------- ### Start Octocode MCP Server Source: https://github.com/muvon/octocode/blob/master/doc/MCP_INTEGRATION.md Commands to launch the MCP server for local projects with optional debug logging. ```bash # Start MCP server for current project octocode mcp --path . # Start for specific project octocode mcp --path /path/to/your/project # Start with debug logging octocode mcp --path . --debug ``` -------------------------------- ### Multiple Projects Configuration Source: https://github.com/muvon/octocode/blob/master/doc/MCP_CLIENTS.md Example configuration for using Octocode with multiple projects by adding multiple server entries. ```APIDOC ### Multiple Projects **Symptom:** Want to use Octocode with multiple projects. **Solution:** Add multiple server entries with different names: ```json { "mcpServers": { "octocode-work": { "command": "octocode", "args": ["mcp", "--path", "/home/user/work-project"] }, "octocode-personal": { "command": "octocode", "args": ["mcp", "--path", "/home/user/personal-project"] } } } ``` ``` -------------------------------- ### MCP Server Debug with Path Source: https://github.com/muvon/octocode/blob/master/doc/ADVANCED_USAGE.md Start the MCP server with debug logging and specify a project path. This helps in debugging specific project configurations. ```bash octocode mcp --debug --path /path/to/project ``` -------------------------------- ### Verify LSP Server Functionality Source: https://github.com/muvon/octocode/blob/master/doc/LSP_INTEGRATION.md Check if the installed language server can be executed and provides basic information like version or help. ```bash rust-analyzer --version ``` ```bash pylsp --help ``` -------------------------------- ### Multi-Query Semantic Search Example Source: https://github.com/muvon/octocode/blob/master/website/index.html Demonstrates how to perform a multi-query semantic search using an array of related terms. The MCP server optimizes and caches these searches. ```bash ["auth", "middleware", "jwt"] ``` -------------------------------- ### Rust Unit and Integration Test Examples Source: https://github.com/muvon/octocode/blob/master/doc/CONTRIBUTING.md Write tests within a `#[cfg(test)] mod tests` block. This includes examples for asynchronous tests using `#[tokio::test]` and synchronous tests with assertions. ```rust #[cfg(test)] mod tests { use super::*; use tempfile::TempDir; #[tokio::test] async fn test_indexing_workflow() { let temp_dir = TempDir::new().unwrap(); // Test implementation } #[test] fn test_symbol_extraction() { let source = "fn main() {}"; let symbols = extract_symbols(source); assert_eq!(symbols.len(), 1); } } ``` -------------------------------- ### Start OctoCode MCP Server Source: https://github.com/muvon/octocode/blob/master/doc/GETTING_STARTED.md Launch the OctoCode MCP (Model Communication Protocol) server to enable AI assistants to interact with your codebase. ```bash octocode mcp --path /path/to/your/project ``` -------------------------------- ### Node.js Project Version in package.json Source: https://github.com/muvon/octocode/blob/master/doc/RELEASE_MANAGEMENT.md Example of a Node.js project's package.json file, showing where the version is automatically updated. ```json { "name": "my-project", "version": "0.1.0" } ``` -------------------------------- ### Multiple Projects Setup in Claude Desktop Source: https://github.com/muvon/octocode/blob/master/doc/CONFIGURATION.md Configure Claude Desktop to manage multiple Octocode MCP servers for different projects. Each entry specifies the command, path, LSP server, and port. ```json { "mcpServers": { "octocode-rust": { "command": "octocode", "args": ["mcp", "--path", "/path/to/rust/project", "--with-lsp", "rust-analyzer", "--port", "3001"] }, "octocode-python": { "command": "octocode", "args": ["mcp", "--path", "/path/to/python/project", "--with-lsp", "pylsp", "--port", "3002"] }, "octocode-typescript": { "command": "octocode", "args": ["mcp", "--path", "/path/to/ts/project", "--with-lsp", "typescript-language-server --stdio", "--port", "3003"] } } } ``` -------------------------------- ### Explain Code with AI Source: https://github.com/muvon/octocode/blob/master/doc/ADVANCED_USAGE.md Utilize 'octocode explain' to get architectural explanations for files, specific symbols, or by search query. Focuses on purpose, design decisions, and system relationships. ```bash # Explain a file octocode explain src/auth/mod.rs # Explain a specific symbol octocode explain src/auth/mod.rs:authenticate_user # Explain by search query octocode explain "how authentication works" ``` -------------------------------- ### PHP Project Version in composer.json Source: https://github.com/muvon/octocode/blob/master/doc/RELEASE_MANAGEMENT.md Example of a PHP project's composer.json file, where the version is automatically updated. ```json { "name": "vendor/my-project", "version": "0.1.0" } ``` -------------------------------- ### Refactoring Dependency Analysis Source: https://github.com/muvon/octocode/blob/master/README.md Example of querying the dependency graph for a specific trait. ```text You: "What depends on the PaymentProcessor trait?" AI: *queries graph* "src/api/handlers/checkout.rs, src/workers/refund_worker.rs, and src/cron/billing.rs all depend on PaymentProcessor. The trait is defined in src/domain/payment.rs and implemented by src/infrastructure/stripe.rs and src/infrastructure/paypal.rs." ``` -------------------------------- ### Debug Logging for MCP Server Source: https://github.com/muvon/octocode/blob/master/doc/LSP_INTEGRATION.md Start the MCP server with debug logging enabled to get detailed information about LSP interactions and symbol resolution. ```bash octocode mcp --path /path/to/project --with-lsp "rust-analyzer" --debug ``` -------------------------------- ### Start MCP Server in HTTP Mode Source: https://github.com/muvon/octocode/blob/master/doc/ADVANCED_USAGE.md Launch the MCP server as an HTTP service. This is useful for web-based integrations and requires specifying a bind address and port. ```bash octocode mcp --bind 0.0.0.0:12345 --path /path/to/your/project ``` -------------------------------- ### Free Tier Setup with Voyage AI and OpenRouter Source: https://github.com/muvon/octocode/blob/master/doc/API_KEYS.md Set up OctoCode using the Voyage AI free tier for embeddings and OpenRouter for AI features. This configuration is recommended for cost-effectiveness. ```bash # Use Voyage AI free tier (200M tokens/month) export VOYAGE_API_KEY="your-voyage-api-key" octocode config \ --code-embedding-model "voyage:voyage-code-3" \ --text-embedding-model "voyage:voyage-3.5-lite" # Optional: Add OpenRouter for AI features export OPENROUTER_API_KEY="your-openrouter-api-key" octocode config --model "openrouter:openai/gpt-4o-mini" ``` -------------------------------- ### Start MCP Server with LSP Integration (HTTP Mode) Source: https://github.com/muvon/octocode/blob/master/doc/ADVANCED_USAGE.md Enable LSP integration for the MCP server running in HTTP mode. This allows web-based tools to utilize language server features. ```bash # HTTP mode with LSP integration octocode mcp --bind 0.0.0.0:12345 --path /path/to/your/project --with-lsp "rust-analyzer" ``` -------------------------------- ### Background Watch with Optimal Settings Source: https://github.com/muvon/octocode/blob/master/doc/ADVANCED_USAGE.md Start the watch mode in the background with specified debouncing and additional delay. This is suitable for continuous development. ```bash octocode watch --quiet --debounce 2 --additional-delay 1000 & ``` -------------------------------- ### Start Octocode MCP HTTP Server Source: https://github.com/muvon/octocode/blob/master/doc/MCP_CLIENTS.md Run Octocode as an HTTP server for custom integrations or testing. Specify the bind address and project path. ```bash # Start HTTP server octocode mcp --bind 0.0.0.0:12345 --path /path/to/your/project # Now accessible at http://localhost:12345 ``` -------------------------------- ### Install OctoCode using Cargo Source: https://github.com/muvon/octocode/blob/master/INSTALL.md Install OctoCode directly from crates.io using the Cargo package manager if you have Rust installed. ```bash cargo install octocode ``` -------------------------------- ### Custom LSP Server with Arguments Source: https://github.com/muvon/octocode/blob/master/doc/CONFIGURATION.md Configure a custom LSP server with specific arguments by providing the command and its configuration file path. ```bash octocode mcp --path /path/to/project --with-lsp "custom-lsp --config config.json" ``` -------------------------------- ### Start MCP Server with Language Server Support Source: https://github.com/muvon/octocode/blob/master/doc/GETTING_STARTED.md Launch the OctoCode MCP server with integrated Language Server Protocol (LSP) support for specific languages like Rust or Python. ```bash # Start with language server support octocode mcp --path /path/to/your/project --with-lsp "rust-analyzer" octocode mcp --path /path/to/python/project --with-lsp "pylsp" ``` -------------------------------- ### GitHub Actions CI/CD Integration Source: https://github.com/muvon/octocode/blob/master/doc/ADVANCED_USAGE.md Example of a GitHub Actions workflow to generate code documentation. It builds the Octocode release, indexes code, and outputs documentation to markdown files. ```yaml # GitHub Actions example - name: Generate Code Documentation run: | cargo build --release ./target/release/octocode index ./target/release/octocode view "src/**/*.rs" --md > docs/api.md ./target/release/octocode graphrag overview --md > docs/structure.md ``` -------------------------------- ### Go Project Module in go.mod Source: https://github.com/muvon/octocode/blob/master/doc/RELEASE_MANAGEMENT.md Example of a Go project's go.mod file. Note that Go projects use a separate VERSION file for version updates as go.mod does not store package version information. ```go module github.com/user/my-project go 1.21 ``` -------------------------------- ### Structural Code Search CLI Examples Source: https://github.com/muvon/octocode/blob/master/doc/ADVANCED_USAGE.md Utilize the `octocode grep` command for structural code search using ast-grep patterns across different languages and with various options. ```bash # Find all .unwrap() calls in Rust octocode grep '$FUNC.unwrap()' --lang rust # Find new expressions in JavaScript octocode grep 'new $CLASS($$$ARGS)' --lang javascript # Find println calls in Java with context octocode grep 'System.out.println($ARG)' --lang java -C 2 # Search specific paths octocode grep 'return nil' --lang go --paths 'src/**/*.go' # JSON output for tooling octocode grep 'puts $ARG' --lang ruby --json ``` -------------------------------- ### OctoCode TOML Configuration File Structure Source: https://github.com/muvon/octocode/blob/master/doc/CONFIGURATION.md Example structure of the OctoCode TOML configuration file, showing settings for LLM, embedding, graphrag, search, and index. ```toml version = 1 [llm] model = "openrouter:openai/gpt-4o-mini" timeout = 120 temperature = 0.7 max_tokens = 4000 [embedding] # Current defaults - provider auto-detected from prefix code_model = "voyage:voyage-code-3" text_model = "voyage:voyage-3.5-lite" [graphrag] enabled = false use_llm = false [graphrag.llm] description_model = "openrouter:openai/gpt-4o-mini" relationship_model = "openrouter:openai/gpt-4o-mini" ai_batch_size = 8 max_batch_tokens = 16384 batch_timeout_seconds = 60 fallback_to_individual = true max_sample_tokens = 1500 confidence_threshold = 0.6 architectural_weight = 0.9 [search] max_results = 20 similarity_threshold = 0.65 output_format = "markdown" max_files = 10 context_lines = 3 search_block_max_characters = 400 [index] chunk_size = 2000 chunk_overlap = 100 embeddings_batch_size = 16 embeddings_max_tokens_per_batch = 100000 flush_frequency = 2 require_git = true quantization = true # RaBitQ quantization for ~32x vector compression contextual_descriptions = false # Contextual Retrieval: enrich chunks with AI context contextual_model = "openrouter:openai/gpt-4o-mini" # Model for contextual descriptions contextual_batch_size = 10 # Chunks per batch for contextual enrichment ``` -------------------------------- ### High-Quality Setup with Jina and Anthropic Source: https://github.com/muvon/octocode/blob/master/doc/API_KEYS.md Configure OctoCode for the highest embedding quality using Jina models and a high-quality LLM from Anthropic. Ensure you have the necessary API keys set. ```bash # Best embedding quality export JINA_API_KEY="your-jina-api-key" export OPENROUTER_API_KEY="your-openrouter-api-key" octocode config \ --code-embedding-model "jina:jina-embeddings-v2-base-code" \ --text-embedding-model "jina:jina-embeddings-v4" \ --model "anthropic:claude-3-5-sonnet-20241022" ``` -------------------------------- ### HTTP API Request Example Source: https://github.com/muvon/octocode/blob/master/doc/MCP_CLIENTS.md Example of sending a JSON-RPC request to the Octocode HTTP API endpoint. ```APIDOC ### HTTP API Send JSON-RPC requests to the HTTP endpoint: ```bash curl -X POST http://localhost:12345 \ -H "Content-Type: application/json" \ -d '{ "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "semantic_search", "arguments": { "query": "authentication", "mode": "code", "max_results": 5 } } }' ``` ``` -------------------------------- ### Async File Reading with Tokio Source: https://github.com/muvon/octocode/blob/master/doc/CONTRIBUTING.md Perform asynchronous file reading operations using `tokio::fs`. This example demonstrates reading a file's content into a string asynchronously. ```rust use tokio::fs; async fn read_file(path: &str) -> Result { let content = fs::read_to_string(path).await?; Ok(content) } ``` -------------------------------- ### Add Installation Directory to PATH (Fish) Source: https://github.com/muvon/octocode/blob/master/INSTALL.md Append the OctoCode installation directory to your PATH environment variable for fish shells. ```bash # For fish echo 'set -gx PATH $HOME/.local/bin $PATH' >> ~/.config/fish/config.fish ``` -------------------------------- ### Set Installation Directory via Environment Variable Source: https://github.com/muvon/octocode/blob/master/INSTALL.md Set the OCTOCODE_INSTALL_DIR environment variable to specify a custom installation path before running the script. ```bash export OCTOCODE_INSTALL_DIR=/opt/bin curl -fsSL https://raw.githubusercontent.com/muvon/octocode/master/install.sh | sh ``` -------------------------------- ### Basic Release Workflow Source: https://github.com/muvon/octocode/blob/master/doc/RELEASE_MANAGEMENT.md Perform a basic release by first previewing changes and then creating the release. Remember to push your changes and tags to the remote repository. ```bash # 1. Preview what would be done (recommended first step) octocode release --dry-run # 2. Create the release octocode release # 3. Push to remote git push origin main --tags ``` -------------------------------- ### Add Installation Directory to PATH (Bash/Zsh) Source: https://github.com/muvon/octocode/blob/master/INSTALL.md Append the OctoCode installation directory to your PATH environment variable for bash or zsh shells and reload the configuration. ```bash # For bash/zsh echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc source ~/.bashrc ``` -------------------------------- ### Conventional Commit Examples Source: https://github.com/muvon/octocode/blob/master/doc/RELEASE_MANAGEMENT.md Examples of good and bad commit messages following conventional commit standards. Use prefixes like 'feat', 'fix', 'docs' for clarity. ```git feat(auth): add OAuth2 authentication support fix(database): resolve connection pool timeout issue docs(api): update authentication endpoint documentation ``` ```git fix stuff update code changes ``` -------------------------------- ### Index Project with OctoCode Source: https://github.com/muvon/octocode/blob/master/website/index.html Run this command to index your project. This prepares your project for OctoCode's AI-powered features. ```bash octocode index ``` -------------------------------- ### View Current Configuration Source: https://github.com/muvon/octocode/blob/master/doc/CONFIGURATION.md Use the `octocode config --show` command to display the current configuration settings. ```bash # View current configuration octocode config --show ``` -------------------------------- ### Automated Code Review Source: https://github.com/muvon/octocode/blob/master/README.md Example of using the AI to identify security vulnerabilities in a pull request. ```text You: "Review this PR for security issues" AI: *analyzes changes* "The PR adds password hashing in src/auth/hash.rs. However, it uses SHA256 which is fast and vulnerable to brute force. Recommend using bcrypt or argon2 instead. Also found 3 instances of .unwrap() that could panic in production." ``` -------------------------------- ### Performing Code Archaeology Source: https://github.com/muvon/octocode/blob/master/README.md Example of using structural search to identify error handling patterns. ```text You: "Find all places we handle database errors" AI: *structural search* "Found 47 error handling patterns: - 32 use Result with proper error types - 15 use .unwrap() (potential issues in src/db/user.rs:23, src/db/order.rs:156) - Recommend adding proper error handling to those locations" ``` -------------------------------- ### Calculate Recall@10 Source: https://github.com/muvon/octocode/blob/master/benchmark/README.md Example calculation for Recall@10 based on ground truth coverage. ```text Recall@10 = 2/3 = 0.67 ``` -------------------------------- ### Documentation Generation Source: https://github.com/muvon/octocode/blob/master/doc/COMMANDS.md Commands to export API references, architecture overviews, and component structures to Markdown files. ```bash # Generate comprehensive documentation octocode view "src/**/*.rs" --md > docs/api-reference.md octocode graphrag overview --md > docs/architecture.md # Create project structure overview octocode search "main components" --md > docs/components.md ``` -------------------------------- ### Index Your Codebase with Octocode Source: https://github.com/muvon/octocode/blob/master/doc/GETTING_STARTED.md Initiate the indexing process for your project to enable Octocode's analysis features. Use the --verbose flag for detailed progress. ```bash # Index current directory octocode index # Watch for progress octocode index --verbose ``` -------------------------------- ### Explain code architecture Source: https://github.com/muvon/octocode/blob/master/doc/COMMANDS.md Commands to generate high-level architectural explanations for files, symbols, or search queries. ```bash # Explain a file octocode explain src/auth/mod.rs # Explain a specific symbol in a file octocode explain src/auth/mod.rs:authenticate_user # Explain by search query (finds relevant code first) octocode explain "how authentication works" # Output formats octocode explain src/main.rs --format md octocode explain src/main.rs --format json ``` -------------------------------- ### Configure Default LLM Model Source: https://github.com/muvon/octocode/blob/master/doc/ADVANCED_USAGE.md Set the default language model for Octocode operations. This example configures it to use Claude. ```bash octocode config --model "anthropic:claude-3-5-sonnet-20241022" ``` -------------------------------- ### Rust Project Version in Cargo.toml Source: https://github.com/muvon/octocode/blob/master/doc/RELEASE_MANAGEMENT.md Example of a Rust project's Cargo.toml file, where the version is automatically updated by Octocode. ```toml [package] name = "my-project" version = "0.1.0" # Updated automatically ``` -------------------------------- ### Pre-release Workflow with Octocode Source: https://github.com/muvon/octocode/blob/master/doc/RELEASE_MANAGEMENT.md Manage pre-releases (beta, release candidates) and final releases using the --force-version flag. ```bash # Create beta release octocode release --force-version "1.0.0-beta.1" # Test the beta... # Create release candidate octocode release --force-version "1.0.0-rc.1" # Final release octocode release --force-version "1.0.0" ``` -------------------------------- ### Build with Local Model Features Source: https://github.com/muvon/octocode/blob/master/doc/API_KEYS.md If local models are not available, ensure your build includes the necessary features like `fastembed` or `huggingface`. ```bash cargo build --features fastembed,huggingface ``` -------------------------------- ### Navigate to Your Project Directory Source: https://github.com/muvon/octocode/blob/master/doc/GETTING_STARTED.md Change your current directory to the root of your project before running Octocode commands. ```bash cd /path/to/your/project ``` -------------------------------- ### Get Node Information in JSON Format Source: https://github.com/muvon/octocode/blob/master/doc/ADVANCED_USAGE.md Retrieve detailed information about a specific node in JSON format from the knowledge graph. ```bash octocode graphrag get-node --node-id "src/main.rs" --json ``` -------------------------------- ### Recommended Code Embedding Models Source: https://github.com/muvon/octocode/blob/master/doc/CONFIGURATION.md Lists recommended models for code understanding, categorized by quality and speed. Includes options for local and cloud deployment. ```bash huggingface:BAAI/bge-base-en-v1.5 # 768 dim, BERT, excellent quality jina:jina-embeddings-v2-base-code # 768 dim, specialized for code voyage:voyage-code-3 # Dynamic dim, latest code model openai:text-embedding-3-small # 1536 dim, versatile for code ``` ```bash fastembed:BAAI/bge-small-en-v1.5 # 384 dim, fast and efficient ``` -------------------------------- ### Configure API Keys Source: https://github.com/muvon/octocode/blob/master/README.md Set environment variables for embedding providers and optional LLM services. ```bash # Required: Embedding provider (Voyage AI has 200M free tokens/month) export VOYAGE_API_KEY="your-voyage-api-key" # Optional: LLM for commit messages, code review export OPENROUTER_API_KEY="your-openrouter-api-key" ``` -------------------------------- ### Configure Multiple Projects in Claude Desktop Source: https://github.com/muvon/octocode/blob/master/doc/MCP_INTEGRATION.md JSON configuration for managing multiple project instances within Claude Desktop. ```json { "mcpServers": { "octocode-rust": { "command": "octocode", "args": ["mcp", "--path", "/path/to/rust/project"] }, "octocode-python": { "command": "octocode", "args": ["mcp", "--path", "/path/to/python/project"] }, "octocode-typescript": { "command": "octocode", "args": ["mcp", "--path", "/path/to/ts/project"] } } } ``` -------------------------------- ### Rewrite JavaScript Code with Specific Paths Source: https://github.com/muvon/octocode/blob/master/doc/ADVANCED_USAGE.md Perform rewrites on JavaScript files within specified paths. This example replaces console.log with logger.info. ```bash octocode grep 'console.log($ARG)' --lang javascript --rewrite 'logger.info($ARG)' --paths 'src/**/*.js' --update-all ``` -------------------------------- ### Enable LSP Integration with Python Source: https://github.com/muvon/octocode/blob/master/doc/CONFIGURATION.md Use this command to enable LSP integration for a Python project. Specify the path to your project and the desired LSP server, such as 'pylsp'. ```bash octocode mcp --path /path/to/python/project --with-lsp "pylsp" ``` -------------------------------- ### JSON Output for View Command Source: https://github.com/muvon/octocode/blob/master/doc/ADVANCED_USAGE.md Get the output of the 'view' command in JSON format, useful for structured data analysis of code signatures. ```bash octocode view "src/**/*.rs" --json ``` -------------------------------- ### AI Assistant LSP Tool Call Source: https://github.com/muvon/octocode/blob/master/doc/LSP_INTEGRATION.md Example of an AI assistant generating a JSON payload to request the definition of a symbol using the lsp_goto_definition tool. ```json { "tool": "lsp_goto_definition", "arguments": { "file_path": "src/auth.rs", "line": 42, "symbol": "authenticate_user" } } ``` -------------------------------- ### Continue.dev Extension Configuration Source: https://github.com/muvon/octocode/blob/master/doc/MCP_CLIENTS.md Configuration for the Continue.dev extension to connect to an Octocode MCP server. ```APIDOC ## Continue.dev Extension Configuration 1. Install [Continue](https://continue.dev/) extension 2. Open Continue sidebar 3. Click the gear icon → **Edit config.json** 4. Add MCP server: ```json { "mcpServers": { "octocode": { "command": "octocode", "args": ["mcp", "--path", "/path/to/your/project"] } } } ``` ``` -------------------------------- ### Add Tree-sitter Grammar Dependency Source: https://github.com/muvon/octocode/blob/master/doc/CONTRIBUTING.md Example of how to add a new tree-sitter grammar as a dependency in your `Cargo.toml` file. Replace `your-language` with the actual language name. ```toml [dependencies] tree-sitter-your-language = "0.x.x" ``` -------------------------------- ### Recommended Text Embedding Models Source: https://github.com/muvon/octocode/blob/master/doc/CONFIGURATION.md Lists recommended models for general text understanding, categorized by quality and speed. Includes options for local and cloud deployment. ```bash huggingface:BAAI/bge-base-en-v1.5 # 768 dim, BERT, excellent quality jina:jina-embeddings-v4 # 2048 dim, latest Jina model voyage:voyage-3.5-lite # Dynamic dim, excellent for text openai:text-embedding-3-large # 3072 dim, highest quality openai:text-embedding-3-small # 1536 dim, cost-effective ``` ```bash fastembed:multilingual-e5-small # 384 dim, supports multiple languages ``` -------------------------------- ### GitLab CI Integration for Release Source: https://github.com/muvon/octocode/blob/master/doc/RELEASE_MANAGEMENT.md Configure GitLab CI to automate releases. This script installs Octocode, creates the release, and pushes tags to the main branch. ```yaml release: stage: release script: - curl -fsSL https://raw.githubusercontent.com/muvon/octocode/master/install.sh | sh - octocode release --yes - git push origin main --tags only: - main variables: OPENROUTER_API_KEY: $OPENROUTER_API_KEY ``` -------------------------------- ### Model Management Commands Source: https://github.com/muvon/octocode/blob/master/doc/COMMANDS.md Commands for listing available models and retrieving detailed information about specific providers. ```bash # List all available models from all providers octocode models list # List models from specific provider octocode models list jina octocode models list voyage octocode models list google octocode models list octohub octocode models list together octocode models list fastembed octocode models list huggingface # Get detailed information about a specific model octocode models info voyage:voyage-code-3 octocode models info jina:jina-embeddings-v4 octocode models info google:gemini-embedding-001 octocode models info fastembed:all-MiniLM-L6-v2 octocode models info huggingface:microsoft/codebert-base ``` -------------------------------- ### Permission Errors Troubleshooting Source: https://github.com/muvon/octocode/blob/master/doc/MCP_CLIENTS.md Troubleshooting steps for permission denied or command not found errors. ```APIDOC ### Permission Errors **Symptom:** "Permission denied" or "Command not found" errors. **Solutions:** 1. Ensure `octocode` is in your PATH: `which octocode` 2. Use absolute path in config: `"command": "/usr/local/bin/octocode"` 3. Check file permissions: `ls -la $(which octocode)` ``` -------------------------------- ### MCP Server Debug Logging Source: https://github.com/muvon/octocode/blob/master/doc/ADVANCED_USAGE.md Start the MCP server with debug logging enabled using the --debug flag. This provides detailed output for troubleshooting. ```bash octocode mcp --debug ``` -------------------------------- ### Preview Release Source: https://github.com/muvon/octocode/blob/master/doc/RELEASE_MANAGEMENT.md Use the --dry-run flag to preview the release process without making any actual changes to your project or Git history. ```bash # Preview release (no changes made) octocode release --dry-run ``` -------------------------------- ### GitHub Actions CI/CD Integration for Release Source: https://github.com/muvon/octocode/blob/master/doc/RELEASE_MANAGEMENT.md Automate releases on the main branch using GitHub Actions. Ensure full git history is fetched and Octocode is installed. ```yaml name: Release on: push: branches: [main] paths-ignore: ['CHANGELOG.md'] jobs: release: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 with: fetch-depth: 0 # Need full history for release analysis - name: Install Octocode run: curl -fsSL https://raw.githubusercontent.com/muvon/octocode/master/install.sh | sh - name: Create Release env: OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }} run: | octocode release --yes git push origin main --tags ```