agcodex_core/code_tools/
mod.rs

1//! Unified code tools scaffolding for AGCodex.
2//!
3//! Policy per ISSUE: Do not use Comby; prefer Tree-sitter as the primary
4//! structural engine. Offer AST-Grep as optional internal tooling.
5
6use thiserror::Error;
7
8#[derive(Debug, Error)]
9pub enum ToolError {
10    #[error("tool not implemented: {0}")]
11    NotImplemented(&'static str),
12
13    #[error(transparent)]
14    Io(#[from] std::io::Error),
15
16    #[error("invalid query: {0}")]
17    InvalidQuery(String),
18
19    #[error("parse error: {0}")]
20    ParseError(String),
21
22    #[error("not found: {0}")]
23    NotFound(String),
24
25    #[error("unsupported language: {0}")]
26    UnsupportedLanguage(String),
27}
28
29/// A generic interface that concrete tools may adopt.
30pub trait CodeTool {
31    type Query;
32    type Output;
33    fn search(&self, _query: Self::Query) -> Result<Self::Output, ToolError>;
34}
35
36pub mod fd_find;
37pub mod tree_sitter;
38
39/// Comprehensive tree-sitter query library for structural code analysis
40pub mod queries;
41
42/// AST-based agent tools for code analysis and transformation
43pub mod ast_agent_tools;
44
45/// Optional: AST-Grep internal tooling. Kept as a stub for now.
46pub mod ast_grep;
47
48/// Multi-layer search engine with Tantivy integration
49pub mod search;
50
51// Intentionally no `comby` module: Comby is not used in AGCodex.
52
53// Include comprehensive tests for AST agent tools
54#[cfg(test)]
55mod ast_agent_tools_test;