neural-shared

Crates.ioneural-shared
lib.rsneural-shared
version0.1.0
created_at2025-12-24 02:24:22.270798+00
updated_at2025-12-24 02:24:22.270798+00
descriptionShared utilities for Neural Garage code analysis tools - parsers, scanners, and reporters
homepagehttps://github.com/neural-garage/tools
repositoryhttps://github.com/neural-garage/tools
max_upload_size
id2002650
size62,859
Paolo Rechia (paolorechia)

documentation

https://docs.rs/neural-shared

README

neural-shared

Shared utilities for Neural Garage code analysis tools

Crates.io License: MIT OR Apache-2.0

Overview

neural-shared provides common functionality for the Neural Garage suite of code analysis tools. It includes:

  • Parser Module - Tree-sitter-based AST parsing for multiple languages
  • Scanner Module - File system traversal with .gitignore support
  • Report Module - Generic reporting framework for analysis results

Features

Parser Module

Language-agnostic parsing infrastructure:

use neural_shared::parser::{Language, PythonParser, Parser};

let parser = PythonParser::new()?;
let source = "def hello(): pass";
let parsed = parser.parse(source, Path::new("example.py"))?;

// Access definitions, usages, and entry points
for def in parsed.definitions {
    println!("Found: {} at {}:{}", def.name, def.location.line, def.location.column);
}

Supported languages:

  • Python
  • TypeScript
  • JavaScript

Scanner Module

Efficient file system scanning:

use neural_shared::Scanner;

let scanner = Scanner::new(Path::new("./src"));
let files = scanner.scan()?;  // Respects .gitignore

Features:

  • .gitignore support via the ignore crate
  • Parallel file scanning
  • Language-specific file filtering

Report Module

Generic reporting framework with Finding trait:

use neural_shared::report::{Finding, Reporter, JsonReporter};
use serde::Serialize;

#[derive(Serialize)]
struct MyFinding {
    // Your finding data
}

impl Finding for MyFinding {
    fn kind(&self) -> String { /* */ }
    fn name(&self) -> String { /* */ }
    // ... other methods
}

let reporter = JsonReporter;
let json = reporter.report(&findings)?;

Built-in reporters:

  • JsonReporter - LLM-friendly JSON output
  • MarkdownReporter - Human-readable markdown

Part of Neural Garage 🧠🔧

This library is part of the Neural Garage monorepo.

Tools using neural-shared:

  • bury - Dead code detector
  • complexity (coming soon) - Code complexity analyzer

License

Licensed under either of:

at your option.

Contributing

See the main repository for contribution guidelines.

Commit count: 0

cargo fmt