ochna 0.0.3

A structural code graph indexing and analysis CLI using Tree-sitter and SQLite
ochna-0.0.3 is not a library.

ochna 🌳

ochna is a local codebase intelligence CLI. It recursively parses Rust, Go, Java, C, C++, and Zig source files using Tree-sitter ASTs, indexes symbols and call edges into a local SQLite database, and provides high-performance search and dependency-graph queries with minimal overhead.


🚀 Key Features

  • Fast Indexing: Scans and parses files recursively, using content hashes to only re-index modified files.
  • Call Graph Resolution: Traces callers and callees structurally across files to map codebase dependencies.
  • FTS5 Full-Text Search: Instantly searches signatures, symbols, and docstrings via SQLite's FTS5 engine.
  • Git Baseline Mapping: Links indexed database states with Git metadata (current commit SHA, branch, status), ensuring queries are matched against a known codebase version.
  • Machine-Readable Output: Accepts a global --json flag to emit structured JSON for programmatic consumption (diagnostics and progress go to stderr).

🛠 Installation

Install ochna directly from crates.io:

cargo install ochna

To build and install from source:

git clone https://github.com/azusachino/ochna.git
cd ochna
cargo install --path .

🎯 Quick Start & Command Guide

1. Initialize Index

Create a local database at <workspace_root>/.ochna/ochna.db and perform the initial scan:

ochna init

2. Update/Sync Index

Incrementally update the index after code changes (only modified files are re-parsed):

ochna sync

3. Check Statistics

Display details about the indexed database and the Git commit baseline:

ochna status

4. Search Symbols

Search for symbols (names, comments, signatures) using full-text search:

ochna search <query_term>

5. Trace Callers

Trace who invokes/calls a specific function or constructor across the project:

ochna callers <symbol_name_or_id>

6. Inspect Symbol or File Node

Inspect definitions, code slices, and local scopes:

# View metadata and implementation source of a symbol
ochna node --symbol <name> --include-code

# View symbol list of a file
ochna node --file <path_to_file> --symbols-only

7. Explore Codebase

Unified view combining search, file scopes, code snippets, and call graph relationships:

ochna explore <query_term>

📜 License

This project is licensed under the Apache License, Version 2.0. See LICENSE for details.