Skip to content

Releases

0.4.0

Choose a tag to compare

@snaga snaga released this 22 Nov 11:13

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.0 directly 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.
    • 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 to os.Stderr.
      • Implemented top-level panic recovery in internal/mcp/server.go to return structured JSON-RPC error responses rather than crashing agent server sessions.
    • 4 Consolidated Core Tools:
      • Cleanly grouped existing CLI subcommands into 4 specialized MCP tools:
        1. ast_explore: Recursive directory tree exploration with symbol signatures and single-file AST skeleton generation.
        2. ast_symbol: Targeted symbol code extraction, line range location (locate_only: true), and dependency resolution (follow_imports: true).
        3. ast_trace: Import origin resolution (action: "definition") and project-wide call site reference exploration (action: "references").
        4. ast_audit: Uncommitted git diff semantic change impact analysis, cyclomatic complexity delta measurement, docstring coverage auditing, and documentation advisories.
    • 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.
    • Token Minimization & Truncation Guards:
      • Applied 300-line automatic truncation (truncateLines) in HandleSymbol for both single symbol extraction and --follow-imports concatenated dependencies.
      • Added fallback guards in HandleExplore when limit <= 0 to prevent slice boundary panics.
  • 📝 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).
  • 🔗 Targeted Dependency Code Tracing (symbol --follow-imports):

    • Extended symbol subcommand with --follow-imports flag.
    • Recursively resolves local module import dependencies and concatenates dependent source code in topological order, with cycle detection (visitedMap) preventing infinite loops.
  • 🔍 Dynamic Agent Self-Inspection (agent-context):

    • Enhanced agent-context output schema to dynamically publish supported_languages (8 languages: Python, TypeScript, Go, Java, JavaScript, Rust, Markdown, SQL) and supported_extensions (11 extensions: .py, .ts, .tsx, .go, .java, .js, .jsx, .rs, .md, .markdown, .sql).
  • 🔒 Enterprise-Grade Security Hardening:

    • Workspace Path Traversal Protection (Requirement H-7):
      • Implemented validateWorkspacePath in internal/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).
    • 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.
  • 🏛️ Architecture Decision Records (ADR) & CGO Isolation:

    • ADR-0007: doc/adr/0007-builtin-mcp-server-and-tool-consolidation.md formalizing 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 within internal/parser.

🌐 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

Choose a tag to compare

@snaga snaga released this 21 Oct 14:28

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).
    • 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).
    • 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.
    • Self-Healing Guardrails for AI Agents:
      • Added --max-statements <N> and --fail-on-missing-doc guardrails returning exit code 2 on violations.
      • Engineered a "report-first" design: complete text or JSON reports are streamed to stdout before exiting with code 2, empowering AI agents to inspect missing docstrings or oversized modules and self-correct autonomously.
    • Agent-Native Structured JSON:
      • Full JSON output support (--json) conforming to the ChangeImpactReport schema for CI/CD and multi-agent pipelines.
  • ⚡ Zero-Disk-IO In-Memory Parsing:

    • Extended internal/parser.Parser interface with ParseBytes(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.
  • 🏛️ Architecture Decision Record (ADR):

    • Recorded ADR-0006: doc/adr/0006-semantic-change-impact-and-intent-verification.md formalizing the semantic impact analysis architecture, AST delta heuristics, and report-first guardrail design.

🌐 CLI & Agent-Context Integration

  • Registered change-impact into agent-context live command discovery (CLI now offers 9 full-featured subcommands).
  • Updated README.md and SKILL.md with detailed command syntax, guardrail examples, JSON schema samples, and the 6-step agent workflow.

0.3.0

Choose a tag to compare

@snaga snaga released this 21 Sep 06:44

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, and CREATE DYNAMIC TABLE as distinct symbols.
      • Suppressed duplicate dialect syntax warnings per file.
    • Unnamed Subquery Indexing & Aliasing:
      • Supported subquery indexing (cte/subquery[0], subquery#0) and alias targeting (cte/alias) for pin-point extraction (assisting CTE refactoring).
    • 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.
    • Upstream Dependency Tracking (--follow-imports) & Duplicate Table Scan Search:
      • Supported topological upstream CTE extraction via --follow-imports.
      • Implemented references for SQL files to search table/CTE references and detect duplicate table scans (optimized for integration with tools like icepick).

🌐 CLI & Agent-Context Integration

  • Registered SQL (.sql) in agent-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

Choose a tag to compare

@snaga snaga released this 15 Aug 14:09

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.

📚 Documentation & Refactoring

  • Reorganized SDD specification files from SPECS/ to the standard doc/ directory.
  • Updated SKILL.md and README.md with Markdown exploration best practices for AI agents.

🧪 Testing

  • Added end-to-end and unit tests with test fixtures for Markdown AST operations.

0.1.0

Choose a tag to compare

@snaga snaga released this 26 Jul 08:24

Initial release.