Skip to main content

Crate codingest

Crate codingest 

Source
Expand description

Code-tree: parse polyglot codebases into kglite knowledge graphs.

Originally extracted from kglite’s in-tree code_tree component (which KGLite removed on 2026-07-16, leaving this crate the sole builder) — it depends on the kglite engine crate for the graph core (kglite::api::DirGraph), the columnar data model (kglite::datatypes), and .kgl persistence (kglite::api::io). Tree-sitter grammars are direct dependencies of this crate.

Entry points:

Re-exports§

pub use builder::run_with_options as build_code_tree;
pub use parsers::language_for_path;
pub use rev::archive_and_build;
pub use rev::build_code_tree_revs;
pub use rev::dedup_revs;

Modules§

builder
Builder: orchestrates parse → model → load phases.
cross_lang
Cross-language HTTP boundary edges — links client calls to server routes. Cross-language HTTP boundary edges (Phase C.1).
docs
Optional docs pass — ingests a repo’s markdown as :Doc nodes and links them to code symbols. Reuses the OKF parser, so it’s gated on the docs feature. Optional docs pass for code_tree.
manifest
Project manifest readers — pyproject.toml, Cargo.toml.
models
Data models for parsed code entities (ported from parsers/models.py).
parsers
Language parsers: one file per language grammar.
repo
GitHub shallow-clone helper (ported from repo.py).
rev
Build a code graph from a git revision (git-archive → tempdir → build), without disturbing the working tree. Exposed as code_tree.build(rev=…). Build a code graph from a git revision without disturbing the working tree.

Structs§

CodeEntityContext
Resolved code-entity neighborhood, kept directional for neutral bindings.
SourceLocation
Resolved code-entity location returned by KnowledgeGraph::source_location. All optional fields mirror what code-graph builders (e.g. codingest) store on the node — graphs built from non-code-tree sources may have fewer populated.

Enums§

CodeContextLookup
Outcome of resolving a code entity for code_entity_context.
CodeEntityMatch
Name-matching strategy for find_code_entities.
SourceLookup
Outcome of a KnowledgeGraph::source_location lookup.

Constants§

CODE_TYPES
Code-entity node types used by source_location / resolve_code_entity when the caller doesn’t specify a node_type. Matches what the code-graph builders (e.g. codingest) emit — language-specific subsets (Rust: Struct/Enum/Trait; Python: Class/Mixin/Protocol; etc.) are all listed so a single search covers every supported source language.

Functions§

code_entity_context
Resolve a code entity and collect its neighborhood up to hops away.
find_code_entities
Search code-entity type indices by name or title.
resolve_code_entity
Resolve a name (or qualified-name suffix) to a single code-entity NodeIndex. Returns (Some(idx), Vec::new()) for an unambiguous match, (None, matches) when 0 or >1 candidates matched.
source_location
Look up the source-file location for a code-entity node.