Skip to content

Latest commit

 

History

History
603 lines (436 loc) · 14.7 KB

File metadata and controls

603 lines (436 loc) · 14.7 KB

Commands Reference

Complete reference for all Octocode commands with examples and options.

Core Commands

octocode index

Index your codebase for semantic search.

# Basic indexing
octocode index

# Verbose output
octocode index --verbose

# Force reindex (ignore cache)
octocode index --force

# Index specific directory
octocode index /path/to/project

What it does:

  • Scans all supported files in your project
  • Extracts code symbols and structure using Tree-sitter
  • Generates embeddings for semantic search
  • Builds knowledge graph relationships (if enabled)
  • Stores everything in local LanceDB database
  • Safe file discovery - Prevents infinite recursion from symlinks
  • Respects ignore patterns - Honors .gitignore and .noindex files

octocode search

Semantic search across your codebase.

# Basic search
octocode search "user authentication"

# Multi-query search (NEW!)
octocode search "authentication" "middleware"
octocode search "jwt" "token" "validation"

# Search specific content types
octocode search "database connection" --mode code
octocode search "API documentation" --mode docs
octocode search "configuration" --mode text
octocode search "error handling" --mode all

# Control result details
octocode search "auth" --detail-level signatures  # Function signatures only
octocode search "auth" --detail-level partial     # Smart truncation (default)
octocode search "auth" --detail-level full        # Complete implementations

# Adjust similarity and results
octocode search "auth" --threshold 0.7 --max-results 10

# Output formats
octocode search "auth" --json     # JSON output
octocode search "auth" --md       # Markdown output

# Symbol expansion
octocode search "user authentication" --expand

Search modes:

  • all - Search across all content types (default)
  • code - Search only in code blocks
  • docs - Search only in documentation files
  • text - Search only in plain text files

octocode view

View code signatures and structure.

# View current directory
octocode view

# View specific files with patterns
octocode view "src/**/*.rs"
octocode view "**/*.py"
octocode view "src/auth/*.ts"

# Output formats
octocode view --json              # JSON format
octocode view --md                # Markdown format
octocode view "src/**/*.rs" --md  # Specific files in markdown

octocode config

Manage configuration settings.

# View current configuration
octocode config --show

# Set embedding models
octocode config --code-embedding-model "voyage:voyage-code-3"
octocode config --text-embedding-model "voyage:voyage-3.5-lite"

# Set LLM model
octocode config --model "anthropic/claude-3.5-sonnet"

# Search settings
octocode config --max-results 20
octocode config --similarity-threshold 0.3

# Enable/disable features
octocode config --graphrag-enabled true
octocode config --graphrag-enabled false

# Performance tuning
octocode config --chunk-size 2000
octocode config --embeddings-batch-size 16

octocode models

Discover and validate embedding models dynamically.

# List all supported models for all providers
octocode models list

# List models for specific provider
octocode models list voyage
octocode models list openai
octocode models list jina

# Get detailed information about a specific model
octocode models info voyage:voyage-code-3
octocode models info openai:text-embedding-3-small
octocode models info jina:jina-embeddings-v4

# Validate model support and get dimensions
octocode models info google:text-embedding-004

Output format:

  • Enumerated lists: Models displayed with numbers and dimensions (e.g., "1. voyage-3.5 (1024d)")
  • Model count headers: Shows total number of models found per provider
  • Dimension information: Each model shows its embedding dimension
  • Unified format: Consistent output across all providers

Supported providers:

  • voyage - Voyage AI models (8 models: voyage-code-3, voyage-3.5-lite, etc.)
  • openai - OpenAI embedding models (text-embedding-3-small, text-embedding-3-large, etc.)
  • jina - Jina AI models (9 models: jina-embeddings-v4, jina-clip-v2, etc.)
  • google - Google AI models (text-embedding-004, gemini-embedding-001, etc.)
  • fastembed - Local FastEmbed models (macOS only)
  • huggingface - HuggingFace models (macOS only)

Features:

  • Dynamic discovery: No hardcoded model lists, real-time API validation
  • Fail-fast validation: Instantly verify if a model is supported
  • Dimension detection: Get exact embedding dimensions for each model
  • Feature-gated: Shows only available providers based on build features

AI-Powered Git Commands

octocode commit

Generate intelligent commit messages with AI.

# Basic usage - analyze staged changes
git add .
octocode commit

# Add all files and commit in one step
octocode commit --all

# Provide context for better commit messages
octocode commit --message "Refactoring authentication system"

# Auto-commit without confirmation
octocode commit --all --yes

# Skip pre-commit hooks
octocode commit --no-verify

# Dry run (show what would be committed)
octocode commit --dry-run

Pre-commit Integration:

  • Automatically runs pre-commit hooks if available
  • Uses --all-files when --all flag is specified
  • Re-stages modified files after pre-commit runs
  • Generates AI commit message after pre-commit completes

octocode review

AI-powered code review for best practices.

# Review staged changes
git add .
octocode review

# Review all changes
octocode review --all

# Focus on specific areas
octocode review --focus security
octocode review --focus performance
octocode review --focus maintainability

# Filter by severity
octocode review --severity critical    # Only critical issues
octocode review --severity high        # Critical and high issues
octocode review --severity low         # All issues

# Output format
octocode review --json                 # JSON output for tooling

octocode release

AI-powered release management with version calculation.

# Preview release (recommended first step)
octocode release --dry-run

# Create release with AI version calculation
octocode release

# Force specific version
octocode release --force-version "2.0.0"

# Skip confirmation prompt
octocode release --yes

# Custom changelog file
octocode release --changelog "HISTORY.md"

Supported project types:

  • Rust (Cargo.toml)
  • Node.js (package.json)
  • PHP (composer.json)
  • Go (go.mod)

MCP Server Commands

octocode mcp

Start Model Context Protocol server for AI assistants.

# 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

Available MCP tools:

  • semantic_search - Semantic code search (supports multi-query)
  • graphrag - Advanced GraphRAG operations (search, get-node, get-relationships, find-path, overview)
  • memorize - Store information for future reference
  • remember - Retrieve stored information (supports multi-query)
  • forget - Remove stored information
  • lsp_* - LSP integration tools (when --with-lsp is used)

octocode mcp-proxy

Start MCP proxy server for multiple repositories.

# Start proxy server
octocode mcp-proxy --bind "127.0.0.1:8080" --path /path/to/parent/directory

# Custom configuration
octocode mcp-proxy --bind "0.0.0.0:9000" --path /workspace --debug

Features:

  • Automatically discovers git repositories
  • Creates MCP instances for each repository
  • Provides unified access to multiple projects

Knowledge Graph Commands

octocode graphrag

Knowledge graph operations using GraphRAG.

# Search the relationship graph
octocode graphrag search --query "authentication modules"

# Get detailed information about a file
octocode graphrag get-node --node-id "src/auth/mod.rs"

# Find relationships for a specific file
octocode graphrag get-relationships --node-id "src/auth/mod.rs"

# Find connections between two modules
octocode graphrag find-path \
  --source-id "src/auth/mod.rs" \
  --target-id "src/database/mod.rs"

# Get graph overview
octocode graphrag overview

# Export formats
octocode graphrag overview --md > project-structure.md
octocode graphrag search --query "auth" --json

Memory Management Commands

octocode memory

Manage the memory system for storing insights and context.

# Store new information
octocode memory memorize \
  --title "Authentication Bug Fix" \
  --content "Fixed JWT token validation race condition" \
  --memory-type bug_fix \
  --importance 0.8 \
  --tags security,jwt,auth \
  --files src/auth.rs,src/middleware/auth.rs

# Search memories semantically
octocode memory remember "JWT authentication issues"
octocode memory remember "authentication" "security" "bugs"

# Retrieve specific memory
octocode memory get abc123

# Update existing memory
octocode memory update abc123 --add-tags performance

# Filter memories
octocode memory by-type bug_fix
octocode memory by-tags security,auth
octocode memory for-files src/auth.rs

# List recent memories
octocode memory recent --limit 10

# Memory statistics
octocode memory stats

# Create relationships between memories
octocode memory relate source-id target-id

# Cleanup old memories
octocode memory cleanup

# Delete specific memory
octocode memory forget --memory-id abc123

# Delete all memories (careful!)
octocode memory clear-all --yes

Memory types:

  • code - Code-related insights
  • architecture - Architectural decisions
  • bug_fix - Bug reports and solutions
  • feature - Feature implementations
  • documentation - Documentation notes
  • user_preference - User preferences
  • decision - Project decisions
  • learning - Insights and lessons
  • configuration - Setup notes
  • testing - Test strategies
  • performance - Performance optimizations
  • security - Security considerations
  • insight - General observations

Utility Commands

octocode format

Format code according to .editorconfig rules.

# Format all supported files
octocode format

# Preview changes without applying
octocode format --dry-run

# Format specific files
octocode format src/main.rs src/lib.rs

# Format and commit changes
octocode format --commit

# Verbose output
octocode format --verbose

octocode logs

View MCP server logs.

# View logs for current project
octocode logs

# Follow logs in real-time
octocode logs --follow

# Show only error logs
octocode logs --errors-only

# Show more/fewer lines
octocode logs --lines 50

# View logs for all projects
octocode logs --all

octocode models

Model management and discovery commands.

# 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 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

Features:

  • Dynamic model discovery - No hardcoded model lists
  • Provider validation - Checks if providers are available
  • Model dimensions - Shows embedding dimensions for each model
  • Feature detection - Indicates which providers are compiled in

octocode watch

Auto-index files when they change.

# Basic watch mode
octocode watch

# Custom debounce timing (1-30 seconds)
octocode watch --debounce 5

# Custom additional delay (0-5000ms)
octocode watch --additional-delay 2000

# Combine timing options
octocode watch --debounce 3 --additional-delay 1500

# Quiet mode (less output)
octocode watch --quiet

# Watch without git requirements
octocode watch --no-git

octocode clear

Clear database tables (preserves memory tables).

# Clear all data (preserves memory tables)
octocode clear --mode all

# Clear specific data types
octocode clear --mode code
octocode clear --mode docs
octocode clear --mode text

# Default mode (all)
octocode clear

Note: The clear command now preserves memory-related tables to maintain your memory system data. Use octocode memory clear-all to clear memories specifically.

octocode completion

Generate shell completion scripts.

# Generate completions for your shell
octocode completion bash > ~/.bash_completion.d/octocode
octocode completion zsh > ~/.zsh/completions/_octocode
octocode completion fish > ~/.config/fish/completions/octocode.fish

# Or install using make (if available)
make install-completions

Global Options

Most commands support these global options:

# Verbose output
octocode <command> --verbose

# JSON output (where applicable)
octocode <command> --json

# Markdown output (where applicable)
octocode <command> --md

# Help for any command
octocode <command> --help
octocode help <command>

Command Combinations

Complete Reindex Workflow

# Clear old data and reindex
octocode clear --all --yes
octocode index --verbose

# Start MCP server
octocode mcp --path . &

Daily Development Workflow

# Start watching for changes
octocode watch --quiet &

# Work on code...
# Files are automatically indexed

# Search for relevant code
octocode search "error handling patterns"

# Commit with AI assistance
git add .
octocode commit

# Review changes
octocode review --focus security

Documentation Generation

# 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

Batch Memory Operations

# Store multiple related memories
octocode memory memorize --title "Auth System" --content "..." --tags auth,security
octocode memory memorize --title "DB Layer" --content "..." --tags database,performance

# Search across all memories
octocode memory remember "system architecture"

# Get statistics
octocode memory stats

For more detailed information about specific features, see: