Skip to main content

Crate magellan

Crate magellan 

Source
Expand description

Magellan: A dumb, deterministic codebase mapping tool

Magellan observes files, extracts symbols and references, and persists facts to sqlitegraph.

§Position Conventions

Magellan uses tree-sitter position conventions for all symbol and reference data:

  • Line positions: 1-indexed (line 1 is the first line)
  • Column positions: 0-indexed (column 0 is the first character)
  • Byte offsets: 0-indexed from file start

See MANUAL.md for detailed documentation.

§Feature Flags

§Backend Selection (Choose One)

Magellan supports two storage backends via sqlitegraph:

§SQLite Backend (Default)

  • sqlite-backend: Stable SQLite-based storage
    • Widely compatible, well-tested
    • Use for maximum compatibility
  • native-v3: High-performance native binary storage
    • 10-20× faster traversals than SQLite
    • Unlimited capacity, B+Tree indexing
    • Production-ready with sqlitegraph v2.0.1+

§Feature Selection

# Default: SQLite backend
magellan = "2.3.0"

# Native V3 backend (recommended for performance)
magellan = { version = "2.3.0", default-features = false, features = ["native-v3"] }

§Optional Features

  • llvm-cfg: LLVM IR-based CFG extraction for C/C++ (requires clang)
  • bytecode-cfg: Java bytecode-based CFG extraction (requires Java bytecode library)

Re-exports§

pub use migrate_backend_cmd::detect_backend_format;
pub use migrate_backend_cmd::BackendFormat;
pub use common::detect_language_from_path;
pub use common::extract_context_safe;
pub use common::extract_symbol_content_safe;
pub use common::format_symbol_kind;
pub use common::parse_symbol_kind;
pub use common::resolve_path;
pub use diagnostics::DiagnosticStage;
pub use diagnostics::SkipReason;
pub use diagnostics::WatchDiagnostic;
pub use generation::ChunkStore;
pub use generation::CodeChunk;
pub use graph::filter::FileFilter;
pub use graph::query::cross_file_references_to;
pub use graph::query::SymbolQueryResult;
pub use graph::CrossFileRef;
pub use graph::scan::ScanResult;
pub use graph::CodeGraph;
pub use graph::CondensationGraph;
pub use graph::CondensationResult;
pub use graph::Cycle;
pub use graph::CycleKind;
pub use graph::CycleReport;
pub use graph::DeadSymbol;
pub use graph::DeleteResult;
pub use graph::ExecutionPath;
pub use graph::ExportConfig;
pub use graph::ExportFormat;
pub use graph::PathEnumerationResult;
pub use graph::PathStatistics;
pub use graph::ProgramSlice;
pub use graph::ReconcileOutcome;
pub use graph::ScanProgress;
pub use graph::SliceDirection;
pub use graph::SliceResult;
pub use graph::SliceStatistics;
pub use graph::Supernode;
pub use graph::SymbolInfo;
pub use graph::MAGELLAN_SCHEMA_VERSION;
pub use indexer::run_indexer;
pub use indexer::run_indexer_n;
pub use indexer::run_watch_pipeline;
pub use indexer::WatchPipelineConfig;
pub use ingest::detect::detect_language;
pub use ingest::detect::Language;
pub use ingest::Parser;
pub use ingest::SymbolFact;
pub use ingest::SymbolKind;
pub use output::command::MigrateResponse;
pub use output::command::ReferenceMatch;
pub use output::command::Span;
pub use output::command::SymbolMatch;
pub use output::generate_execution_id;
pub use output::output_json;
pub use output::JsonResponse;
pub use output::OutputFormat;
pub use references::CallFact;
pub use references::ReferenceFact;
pub use validation::canonicalize_path;
pub use validation::normalize_path;
pub use validation::validate_path_within_root;
pub use validation::PathValidationError;
pub use verify::verify_graph;
pub use verify::VerifyReport;
pub use watcher::EventType;
pub use watcher::FileEvent;
pub use watcher::FileSystemWatcher;
pub use watcher::WatcherBatch;
pub use watcher::WatcherConfig;

Modules§

common
Common utility functions shared across command modules
diagnostics
Structured diagnostics for Magellan watch/index operations.
error_codes
Magellan-specific error codes
generation
Code generation and storage module.
graph
Graph persistence layer using sqlitegraph
indexer
Indexer coordinator for Magellan
ingest
migrate_backend_cmd
Cross-backend database migration command implementation
migrate_cmd
Database migration command implementation
output
JSON output module for CLI commands
references
Reference and call extraction from Rust source code
validation
Path validation and canonicalization utilities.
verify
Database verification module
watcher
Filesystem watcher with debounced batch events.

Enums§

FailPoint
Test operations that can be verified during delete.

Functions§

delete_file_facts_with_injection
Delete ALL facts derived from a file path with verification points.