Skip to main content

Crate code_analyze_core

Crate code_analyze_core 

Source
Expand description

Multi-language code structure analysis library using tree-sitter.

This crate provides core analysis functionality for extracting code structure from multiple programming languages. It is designed to be used as a library by MCP servers and other tools.

§Features

  • Language support: Rust, Go, Java, Python, TypeScript, TSX, Fortran (feature-gated)
  • Schema generation: Optional JSON schema support via the schemars feature
  • Async-friendly: Uses tokio for concurrent analysis
  • Cancellation support: Built-in cancellation token support

§Examples

use code_analyze_core::analyze::analyze_directory;
use std::path::Path;

let output = analyze_directory(Path::new("src"), None)?;
println!("Files: {:?}", output.files.len());

Re-exports§

pub use analyze::AnalysisOutput;
pub use analyze::FileAnalysisOutput;
pub use analyze::FocusedAnalysisConfig;
pub use analyze::FocusedAnalysisOutput;
pub use analyze::analyze_directory;
pub use analyze::analyze_directory_with_progress;
pub use analyze::analyze_file;
pub use analyze::analyze_focused;
pub use analyze::analyze_focused_with_progress;
pub use analyze::analyze_focused_with_progress_with_entries;
pub use analyze::analyze_module_file;
pub use lang::language_for_extension;
pub use lang::supported_languages;
pub use parser::ParserError;
pub use types::*;

Modules§

analyze
Main analysis engine for extracting code structure from files and directories.
cache
LRU cache for analysis results indexed by path, modification time, and mode.
completion
Path completion support for file and directory paths.
formatter
Output formatting for analysis results across different modes.
graph
Call graph construction and analysis.
lang
Language detection by file extension.
languages
Language-specific handlers and query definitions for tree-sitter parsing.
pagination
Cursor-based pagination for large result sets.
parser
Tree-sitter-based parser for extracting semantic structure from source code.
schema_helpers
test_detection
Test file detection using path heuristics.
traversal
Directory traversal with .gitignore support.
types

Structs§

AnalysisConfig
Resource limits and configuration for analysis operations.
QueryCapture
Captures from a custom tree-sitter query.

Functions§

execute_query
Execute a custom tree-sitter query against source code.