Skip to main content

Module diagnostics_store

Module diagnostics_store 

Source
Expand description

Active compiler/linter diagnostics as a context-priority signal (#499).

When cargo/tsc/eslint fail, the files they point at are the most task-relevant files in the project — the agent will read them next to fix the build. The shell layer already sees this output (CLI lean-ctx -c and MCP ctx_shell); this store extracts the structured (file, line) pairs and makes them available to auto-mode, relevance ranking and the triage.

Persistence: ~/.lean-ctx/diagnostics.json — the CLI runs as a separate process from the MCP server, so an in-memory store would never be seen by ctx_read’s auto-mode. Entries expire after TTL_SECS; a succeeding run of the same tool clears its diagnostics.

Structs§

Diagnostic
DiagnosticsStore

Enums§

Severity

Functions§

apply_boost
Apply diagnostic boosts to a relevance ranking and re-sort.
details_for
Diagnostics for one path: (line, severity, message) triples.
has_error
Does any tracked file currently carry a compile error?
record_from_shell
Shell-layer hook: parse diagnostics out of a finished command. Success clears the tool’s previous diagnostics; failure replaces them. Cheap for non-diagnostic commands (one contains probe).
relevance_boost
Ranking boost per path: errors dominate, warnings hint (#499).
severity_for
snapshot
Snapshot for ranking/triage consumers: (path, severity) pairs.