Repository navigation
Releases
0.4.0
AST-Digger v0.4.0 Release Notes
AST-Digger v0.4.0 introduces the Built-in Model Context Protocol (MCP) Server (ast-digger mcp), Markdown Document Structure Parsing, Automated Dependency Tracing (--follow-imports), Dynamic Agent Self-Inspection, and Enterprise-Grade Security Hardening! 🎉
AI coding agents and developers can now interact with AST-Digger as a native MCP server via stdio transport without external Node.js runtimes. 4 consolidated core tools with negative affordance design prevent context bloat, while path traversal and git flag injection protections establish strict security boundaries.
✨ What's New
-
🤖 Built-in Model Context Protocol (MCP) Server (
ast-digger mcp):- Zero-Dependency Native stdio JSON-RPC Server:
- Integrated Pure-Go
github.com/mark3labs/mcp-go v1.5.0directly into the single compiled binary. - Eliminates external runtime requirements (such as Node.js or Python packages), running seamlessly across Claude Desktop, Antigravity, Cursor, and custom agent harnesses.
- Integrated Pure-Go
- Stdio Stream Isolation & Panic Recovery:
- Enforced complete stdio isolation: standard output (
stdout) is strictly reserved for clean JSON-RPC 2.0 transport frames, while all operational logs are redirected toos.Stderr. - Implemented top-level panic recovery in
internal/mcp/server.goto return structured JSON-RPC error responses rather than crashing agent server sessions.
- Enforced complete stdio isolation: standard output (
- 4 Consolidated Core Tools:
- Cleanly grouped existing CLI subcommands into 4 specialized MCP tools:
ast_explore: Recursive directory tree exploration with symbol signatures and single-file AST skeleton generation.ast_symbol: Targeted symbol code extraction, line range location (locate_only: true), and dependency resolution (follow_imports: true).ast_trace: Import origin resolution (action: "definition") and project-wide call site reference exploration (action: "references").ast_audit: Uncommitted git diff semantic change impact analysis, cyclomatic complexity delta measurement, docstring coverage auditing, and documentation advisories.
- Cleanly grouped existing CLI subcommands into 4 specialized MCP tools:
- Negative Affordance Design (Tool Description Hacking):
- Embedded prescriptive constraints directly inside tool schemas and descriptions (e.g.,
"CRITICAL: Call this tool FIRST before calling read_file"). Overcomes agent cognitive friction and pre-training bias, forcing autonomous agents to dig structures before dumping raw files.
- Embedded prescriptive constraints directly inside tool schemas and descriptions (e.g.,
- Token Minimization & Truncation Guards:
- Applied 300-line automatic truncation (
truncateLines) inHandleSymbolfor both single symbol extraction and--follow-importsconcatenated dependencies. - Added fallback guards in
HandleExplorewhenlimit <= 0to prevent slice boundary panics.
- Applied 300-line automatic truncation (
- Zero-Dependency Native stdio JSON-RPC Server:
-
📝 Markdown Document Structure Analysis (
tree-sitter-markdown):- Integrated CGO bindings for
tree-sitter-markdown(internal/parser/markdown/). - Enables AST parsing of Markdown specifications and design documents:
- Extracts heading hierarchies (
#through######) as structural outlines (kind: "heading"). - Supports pinpoint targeted section extraction (
symbol) and line range location (locate). - Parses Frontmatter metadata and indexes fenced code blocks (
code_block:lang#index).
- Extracts heading hierarchies (
- Integrated CGO bindings for
-
🔗 Targeted Dependency Code Tracing (
symbol --follow-imports):- Extended
symbolsubcommand with--follow-importsflag. - Recursively resolves local module import dependencies and concatenates dependent source code in topological order, with cycle detection (
visitedMap) preventing infinite loops.
- Extended
-
🔍 Dynamic Agent Self-Inspection (
agent-context):- Enhanced
agent-contextoutput schema to dynamically publishsupported_languages(8 languages: Python, TypeScript, Go, Java, JavaScript, Rust, Markdown, SQL) andsupported_extensions(11 extensions:.py,.ts,.tsx,.go,.java,.js,.jsx,.rs,.md,.markdown,.sql).
- Enhanced
-
🔒 Enterprise-Grade Security Hardening:
- Workspace Path Traversal Protection (Requirement H-7):
- Implemented
validateWorkspacePathininternal/mcp/handlers.go. Restricts all MCP file lookups (ast_explore,ast_symbol,ast_trace) to the workspace root directory, blocking traversal attacks (..,../../etc/passwd, foreign drive paths).
- Implemented
- Git Flag Injection Protection (Requirement H-8):
- Sanitized base revision inputs in
internal/impact/git.go. Rejects leading hyphen strings (preventing flag injection attacks like--output=...) and isolates revision arguments using double-dash--separators.
- Sanitized base revision inputs in
- Workspace Path Traversal Protection (Requirement H-7):
-
🏛️ Architecture Decision Records (ADR) & CGO Isolation:
- ADR-0007:
doc/adr/0007-builtin-mcp-server-and-tool-consolidation.mdformalizing built-in MCP server architecture, stdio isolation, tool consolidation, and negative affordance design. - ADR-0005 Update & CGO Quarantine:
- Implemented
internal/parser/languages.go(parser.GetLanguage) as a centralized grammar facade. - Completely eliminated direct CGO grammar binding imports from
internal/impact/analyzer.go, guaranteeing all tree-sitter CGO language bindings are strictly quarantined withininternal/parser.
- Implemented
- ADR-0007:
🌐 CLI Subcommands Summary (10 Total)
The unified ast-digger binary provides 10 CLI subcommands and 4 native MCP tools:
| CLI Subcommand | Purpose | MCP Counterpart |
|---|---|---|
mcp |
Start native stdio JSON-RPC MCP server | Built-in Server Entrypoint |
directory |
Incremental SQLite-cached directory tree outline | ast_explore (path is dir) |
outline |
Single-file skeleton extraction (8 languages) | ast_explore (path is file) |
symbol |
Pinpoint symbol code extraction (--follow-imports) |
ast_symbol |
locate |
Lightweight symbol line range discovery | ast_symbol (locate_only: true) |
resolve-import |
Resolve imported symbol definition file and line | ast_trace (action: "definition") |
references |
Project-wide symbol call-site reference exploration | ast_trace (action: "references") |
change-impact |
Semantic diff statement & complexity delta audit | ast_audit |
agent-context |
Dynamic live Cobra command tree introspection | — |
feedback |
Agent friction logging to .workspace_cache/ |
— |
0.3.1
AST-Digger v0.3.1 Release Notes
AST-Digger v0.3.1 introduces Semantic Change Impact Analysis, Docstring Auditing, and Intent Verification (change-impact)! 🎉
AI coding agents and developers can now evaluate code modifications by AST syntax statements and cyclomatic complexity deltas (eliminating false positives from comments or blank lines), audit docstring completeness on changed symbols, and receive repository-agnostic advisories for documentation and ADR synchronization with built-in self-healing guardrails.
✨ What's New
-
🔍 Semantic Change Impact & Intent Verification (
change-impact):- AST Statement & Cyclomatic Complexity Deltas:
- Implemented AST-aware statement counting and branching complexity analysis (
internal/impact/analyzer.go) across Golang, Python, TypeScript, Rust, Java, and SQL. - Classifies change scale into 4 semantic tiers (
MINOR,MODERATE,SIGNIFICANT,EXTREME).
- Implemented AST-aware statement counting and branching complexity analysis (
- Diff-Aware Symbol Extraction & Docstring Auditing:
- Maps modified lines from git unified diff to AST symbols (
internal/impact/symbols.go), identifying added, modified, and deleted symbols. - Safely excludes deleted symbols from docstring auditing and audits docstring coverage according to visibility (
public/private) and scope (--require-doc=exported|all|none).
- Maps modified lines from git unified diff to AST symbols (
- Repository-Agnostic Documentation Advisories:
- Analyzes module boundaries and cross-cutting changes (
internal/impact/advisory.go) to generate contextual advisories (documentation_advisory), reminding agents to update architecture decision records (ADR) or module-level specifications without assuming specific file conventions.
- Analyzes module boundaries and cross-cutting changes (
- Self-Healing Guardrails for AI Agents:
- Added
--max-statements <N>and--fail-on-missing-docguardrails returning exit code2on violations. - Engineered a "report-first" design: complete text or JSON reports are streamed to
stdoutbefore exiting with code 2, empowering AI agents to inspect missing docstrings or oversized modules and self-correct autonomously.
- Added
- Agent-Native Structured JSON:
- Full JSON output support (
--json) conforming to theChangeImpactReportschema for CI/CD and multi-agent pipelines.
- Full JSON output support (
- AST Statement & Cyclomatic Complexity Deltas:
-
⚡ Zero-Disk-IO In-Memory Parsing:
- Extended
internal/parser.Parserinterface withParseBytes(source []byte, filePath string)across all supported language parsers. - Git tree objects (
git show base:file) and working tree buffers are parsed directly in memory without writing temporary files to disk. - Added unified parser factory
internal/parser.ForPath.
- Extended
-
🏛️ Architecture Decision Record (ADR):
- Recorded ADR-0006:
doc/adr/0006-semantic-change-impact-and-intent-verification.mdformalizing the semantic impact analysis architecture, AST delta heuristics, and report-first guardrail design.
- Recorded ADR-0006:
🌐 CLI & Agent-Context Integration
- Registered
change-impactintoagent-contextlive command discovery (CLI now offers 9 full-featured subcommands). - Updated
README.mdandSKILL.mdwith detailed command syntax, guardrail examples, JSON schema samples, and the 6-step agent workflow.
0.3.0
AST-Digger v0.3.0 Release Notes
AST-Digger v0.3.0 introduces Snowflake SQL (.sql) data-flow and CTE (Common Table Expression) analysis via tree-sitter! 🎉
AI agents can now navigate massive Snowflake SQL transformation scripts, trace upstream CTE dependencies, extract unnamed subqueries, and detect redundant table scans with pinpoint precision and minimal token overhead.
✨ What's New
- ❄️ Snowflake SQL AST Parsing & Data-flow DAG:
- Added tree-sitter based SQL parser (
internal/parser/sql.go) resilient to Snowflake syntax (QUALIFY,LATERAL FLATTEN,MERGE INTO,CONVERT_TIMEZONE, etc.). - CTE & View Extraction:
- Extracted
WITH cte AS (...),CREATE [SECURE | MATERIALIZED] VIEW, andCREATE DYNAMIC TABLEas distinct symbols. - Suppressed duplicate dialect syntax warnings per file.
- Extracted
- Unnamed Subquery Indexing & Aliasing:
- Supported subquery indexing (
cte/subquery[0],subquery#0) and alias targeting (cte/alias) for pin-point extraction (assisting CTE refactoring).
- Supported subquery indexing (
- Data-flow Dependency Tracking (
depends_on) & Skeleton Generation:- Analyzed table and upstream CTE dependencies per block (
depends_on: [t1, t2]). - Generated lightweight skeletons (
-- CTE Outline) collapsing thousands of lines of query logic while preserving structural signatures.
- Analyzed table and upstream CTE dependencies per block (
- Upstream Dependency Tracking (
--follow-imports) & Duplicate Table Scan Search:- Supported topological upstream CTE extraction via
--follow-imports. - Implemented
referencesfor SQL files to search table/CTE references and detect duplicate table scans (optimized for integration with tools likeicepick).
- Supported topological upstream CTE extraction via
- Added tree-sitter based SQL parser (
🌐 CLI & Agent-Context Integration
- Registered SQL (
.sql) inagent-context(now supporting 8 languages and 11 file extensions). - Added comprehensive integration tests covering all CLI subcommands (
outline,symbol,locate,references,resolve-import,agent-context) with SQL fixtures.
🧪 Quality & Verification
- All core packages maintain >90% statement test coverage with Detroit-school unit and end-to-end integration tests.
0.2.0
AST-Digger v0.2.0 Release Notes
AST-Digger v0.2.0 introduces comprehensive Markdown (.md, .markdown) document parsing and section navigation via tree-sitter! 🎉
AI agents can now explore and extract specific sections from documentation and specifications with minimal token overhead.
✨ What's New
- 📝 Markdown AST Parsing & Section Navigation:
- Added tree-sitter based Markdown parser (
internal/parser/markdown.go). - Supported heading hierarchy (H1-H6, ATX and Setext headings) and section extraction across all core commands:
outline: Extract heading outlines from Markdown files.locate: Locate line ranges of specific sections.symbol: Extract targeted section body without reading entire files.references&resolve-import: Find and resolve Markdown links and relative references.directory: Display Markdown files and their top-level headings within directory trees.
- Added tree-sitter based Markdown parser (
📚 Documentation & Refactoring
- Reorganized SDD specification files from
SPECS/to the standarddoc/directory. - Updated
SKILL.mdandREADME.mdwith Markdown exploration best practices for AI agents.
🧪 Testing
- Added end-to-end and unit tests with test fixtures for Markdown AST operations.