Skip to main content

Crate ast_doc_core

Crate ast_doc_core 

Source
Expand description

Core library for ast-doc: a four-stage pipeline for generating optimized llms.txt documentation from codebases.

§Pipeline

  1. Ingestion — File discovery, git metadata capture, directory tree generation.
  2. Parser — tree-sitter AST extraction with pre-computed strategy variants.
  3. Scheduler — Token budget optimization with intelligent degradation.
  4. Renderer — Markdown assembly with anti-bloat rules.

§Quick Start

use std::path::PathBuf;

use ast_doc_core::{AstDocConfig, OutputStrategy};

let config = AstDocConfig {
    path: PathBuf::from("."),
    output: None,
    max_tokens: 128_000,
    core_patterns: vec![],
    default_strategy: OutputStrategy::Full,
    include_patterns: vec![],
    exclude_patterns: vec![],
    no_git: false,
    no_tree: false,
    copy: false,
    verbose: false,
};

let result = ast_doc_core::run_pipeline(&config).expect("pipeline failed");
println!("{}", result.output);

Re-exports§

pub use config::AstDocConfig;
pub use config::OutputStrategy;
pub use error::AstDocError;
pub use ingestion::DiscoveredFile;
pub use ingestion::GitContext;
pub use ingestion::IngestionResult;
pub use parser::Language;
pub use parser::ParsedFile;
pub use parser::StrategyData;
pub use scheduler::ScheduleResult;
pub use scheduler::ScheduledFile;

Modules§

config
Configuration types for the ast-doc pipeline.
error
Error types for the ast-doc pipeline.
ingestion
Phase 1: File discovery and ingestion.
parser
Phase 2: AST parsing and strategy extraction.
renderer
Phase 4: Output rendering.
scheduler
Phase 3: Token budget scheduling.

Structs§

PipelineResult
Result of running the full pipeline.

Functions§

run_pipeline
Run the full ast-doc pipeline and return the rendered output plus scheduling metadata.