Skip to main content

kaptein_viewmodel/
lib.rs

1//! Kaptein view-model: the renderer-agnostic domain layer (the product).
2//!
3//! This crate owns all *semantics* — columns, sorting, filtering, status inference,
4//! permission decisions, and action graphs. The frontends (TUI, GUI, headless, serve)
5//! consume the render contract defined here and own only *geometry*.
6//!
7//! See ADR-0005 (`docs/adr/0005-render-intent-three-layers.md`) for the three-layer
8//! model this crate implements.
9
10#![forbid(unsafe_code)]
11
12pub mod audit;
13pub mod diff;
14pub mod error;
15pub mod fuzzy;
16pub mod lens;
17pub mod logparse;
18pub mod mem_plane;
19pub mod render;
20pub mod semantic;
21pub mod sink;
22pub mod surface;
23pub mod table;
24pub mod versioned;
25
26pub use audit::{Actor, ActorKind, AuditEvent, Operation, Outcome, ResourceRef, Source};
27pub use diff::{DiffLine, UnifiedDiff, render_unified, unified_diff};
28pub use error::Error;
29pub use fuzzy::{FuzzyMatch, fuzzy_jump};
30pub use lens::{
31    ConditionRule, GroupVersionKind, LENS_SCHEMA_VERSION, LensAction, RuleOp, StatusRule,
32    ViewDefinition, evaluate_status, render_row, validate_viewdef,
33};
34pub use logparse::{LogCell, ParsedLogLine, infer_columns, parse_json_line, parse_log_stream};
35pub use mem_plane::{MemPlane, Schema};
36pub use render::{
37    Cell, DataPlane, Filter, Page, Query, Revision, Row, RowId, RowPatch, SortSpec, StatusLevel,
38};
39pub use semantic::{Action, ActionState, Status};
40pub use sink::{AuditConfig, AuditSink};
41pub use surface::{
42    Column, ColumnKind, EditorMode, Field, FieldKind, Projection, SupportLevel, Surface,
43    SurfaceKind, support_level,
44};
45pub use table::{cell_text, cmp_cells, filter_rows, sort_rows};
46pub use versioned::{
47    ApiVersion, MCP_API_VERSION, MCP_VERSION_META_KEY, is_compatible, parse_api_version,
48};
49
50#[cfg(test)]
51mod contract_tests;