Skip to main content

core_api/repograph/
mod.rs

1//! Reading a code graph back as answers.
2//!
3//! `ingest-git` writes a repository into the graph; this module reads it out
4//! again, in the shapes a person or an assistant asks for. Each tool computes
5//! a plain data structure and a renderer turns it into a short digest, so the
6//! same answer serves a CLI, an HTTP response and an MCP tool without being
7//! computed three ways.
8//!
9//! | Tool | Answers |
10//! |---|---|
11//! | [`repo_map`] | what is this repository, in one screen |
12//! | [`context`] | everything known about one file or symbol |
13//! | [`impact`] | what else the files in a diff reach |
14//! | [`owners`] | who has written a file, and when |
15//! | [`why`] | what links two things, with the evidence |
16//! | [`recall::recall_digest`] | which nodes a topic is closest to |
17//! | [`remember::remember`] | write a note the graph can later recall |
18//! | [`stale_concepts`] | which learned concepts have drifted from their sources |
19//!
20//! [`rules`] holds the `about_<label>` and `concept_sources` rule
21//! definitions both `structure::ensure_rules_and_fulltext` (CLI) and
22//! [`remember::remember`] need, so the two cannot declare them differently.
23//!
24//! Two rules hold across every tool here. The output is **deterministic** for
25//! the same store state and the same caller-supplied "now": collections are
26//! sorted, ties break on the key, floats print at a fixed precision, and every
27//! answer is decided by the graph. The one value that is not is how long ago
28//! the store was synced, which is measured against the system clock unless the
29//! caller pins the time — see [`MapOptions::now_ts`]. And every string that
30//! came out of the graph passes through [`sanitize`](render::sanitize) before
31//! it reaches a rendered line, so repository content cannot forge a header or a
32//! line break in an assistant's context.
33//!
34//! [`context`] is the one tool that reads anything outside the graph: the
35//! source it quotes comes from the working tree, so what it shows is what is on
36//! disk now.
37
38mod concepts;
39mod context;
40mod facts;
41mod impact;
42mod map;
43mod owners;
44mod path;
45pub mod recall;
46pub mod remember;
47pub mod render;
48pub mod rules;
49mod why;
50
51pub use concepts::stale_concepts;
52pub use context::{context, ContextReport, Target, MAX_SOURCE_LINES};
53pub use impact::{
54    impact, path_excluded, FileImpact, ImpactOptions, ImpactReport, Partner, DEFAULT_EXCLUDES,
55};
56pub use map::{repo_map, MapCommunity, MapOptions, RepoMap, SyncInfo};
57pub use owners::{owners, OwnersReport, QUARTERS};
58pub use path::{shortest_path, MAX_HOPS, PATH_EDGES};
59pub use recall::{
60    or_query, recall_digest, HINT, MAX_EDGES_PER_HIT, MAX_EDGE_CANDIDATES, MAX_HITS,
61    MAX_OUTPUT_BYTES, MAX_QUERY_TERMS, UNTRUSTED_FRAMING,
62};
63pub use remember::{remember, RememberInput, NOTE_KINDS};
64pub use render::{
65    render_context, render_impact, render_map, render_owners, render_why, sanitize,
66    MAX_CONTEXT_LINES, MAX_MAP_LINES, MAX_TOOL_LINES,
67};
68pub use why::{why, WhyLink, WhyReport};