gleamunison/codebase_index

Types

A datalog datom for the codebase index: entity is a stable per-def int, value is always a string (hashes, names, kinds) so q-val joins work.

pub type Datom {
  Datom(entity: Int, attr: String, value: String)
}

Constructors

  • Datom(entity: Int, attr: String, value: String)

Values

pub fn datoms_of(
  defs: List(#(String, elab_types.SurfaceDef)),
) -> List(Datom)

The index schema: one entity per definition, carrying name/hash/kind, plus one def/dep datom per in-corpus name the body references.

pub fn datoms_of_entries(
  entries: List(agent_read_model.Entry),
) -> List(Datom)
pub fn eval_index_source(
  script: String,
) -> Result(String, String)

Evaluate an index script under the native datalog engine. The engine sources are prepended (same path the datalog CLI uses).

pub fn index_source(
  defs: List(#(String, elab_types.SurfaceDef)),
) -> String

Build index data as a flat list of triples, not a nested let per datom. The native engine folds the data; generated source obeys normal admission.

pub fn kind_of(def: elab_types.SurfaceDef) -> String

The definition kind as the index reports it.

pub fn kind_of_entry(entry: agent_read_model.Entry) -> String
pub fn ref_hex(
  name: String,
  def: elab_types.SurfaceDef,
) -> String

The ref hex for a definition: the genesis ref for builtins, the name-hash for surface defs. Single source of ref identity for the index, MCP search, and graph tools.

pub fn ref_hex_entry(entry: agent_read_model.Entry) -> String
✨ Search Document