Skip to main content

vvv_engine/
lib.rs

1//! The engine: a graph of the tree built from a [`Workspace`] and a language
2//! registry, and one entry point that runs a [`Command`] against it — a
3//! [`protocol`] intent or query, answering with the protocol type of the
4//! same name; a mutation answers with a [`Planned`] result that [`Apply`]
5//! writes.
6//!
7//! Interfaces (CLI, TUI, JSON) talk only to [`Engine::run`]; they never touch
8//! a language or the file system directly. Each command lives with its
9//! components in its own module — `rewrite`, `rename`, `move_file`,
10//! `answers`, `understanding`, `batch`, `history` — as `impl Command for
11//! <request>`.
12
13mod answers;
14mod batch;
15mod change;
16mod command;
17mod engine;
18mod error;
19mod graph;
20mod history;
21mod move_file;
22mod plan;
23pub mod protocol;
24mod rename;
25pub mod report;
26mod request;
27mod rewrite;
28mod understanding;
29mod vfs;
30mod workspace;
31
32pub use command::{Command, Context};
33pub use engine::Engine;
34pub use error::EngineError;
35pub use graph::Retention;
36pub use history::{Apply, HistoryError};
37pub use plan::{ApplyError, FilePreview, Planned};
38pub use protocol::{
39    Answer, Batch, BatchIntent, Call, Confidence, Consumer, Dead, DeadQuery, Dep, Deps, DepsQuery,
40    ErrorCode, ExplainQuery, Explanation, Exposed, Failure, File, FileChange, FileQuery, History,
41    HistoryEntry, HistoryQuery, Impact, ImpactQuery, ImportSite, Importer, ImportsQuery,
42    ImportsReport, Intent, Locations, Match, MatchId, Move, MoveIntent, MoveSymbol,
43    MoveSymbolIntent, Mutation, Notice, NoticeKind, Occurrence, Outline, OutlineItem, OutlineQuery,
44    Placed, Reach, Reason, References, ReferencesQuery, Rename, RenameIntent, Reply, Request,
45    Respelling, Rewrite, RewriteIntent, RewriteOf, Search, Selection, SelectionError, Site,
46    Skipped, Surface, SurfaceQuery, Template, TemplateError, Undo, UndoLast, Unreferenced,
47    WhereQuery,
48};
49pub use vfs::{DiskVfs, MemoryVfs, Stamp, Vfs, VfsError};
50pub use workspace::Workspace;
51
52/// The nouns of the plugin contract that appear in the engine's answers, so
53/// an interface needs nothing but this crate.
54pub use vvv_core::{
55    RelPath,
56    {
57        Address, CaptureValue, Edit, Highlight, HighlightKind, ImportGroup, ImportRef, LanguageId,
58        LanguageRegistry as Languages, Modifier, ModulePath, Name, Oracle, PackageId, PathHead,
59        PathSyntax, Position, Query, QueryBuilder, QueryError, ReachKind, Referent, Role, Span,
60        Symbol, SymbolKind,
61    },
62};
63
64pub(crate) use graph::Candidate;
65pub(crate) use plan::Receipt;
66pub(crate) use vfs::Overlay;
67pub(crate) use workspace::SourceFile;