Skip to main content

agentic_codebase/workspace/
mod.rs

1//! Multi-context workspaces for loading and querying multiple codebases.
2//!
3//! Enables migration workflows (e.g., C++ to Rust) by loading source and target
4//! codebases into a single workspace, then cross-querying and tracking progress.
5//!
6//! # Architecture
7//!
8//! A **Workspace** holds one or more **CodebaseContext** entries, each wrapping a
9//! [`CodeGraph`] and annotated with a [`ContextRole`] (Source, Target, Reference,
10//! or Comparison). The [`WorkspaceManager`] owns all workspaces, tracks the
11//! currently active one, and provides cross-context query and comparison APIs.
12//!
13//! The [`TranslationMap`] sits on top of a workspace and tracks the porting
14//! status of individual symbols from a source context to a target context.
15//!
16//! # Example
17//!
18//! ```rust,no_run
19//! use agentic_codebase::workspace::{WorkspaceManager, ContextRole, TranslationMap, TranslationStatus};
20//! use agentic_codebase::graph::CodeGraph;
21//!
22//! let mut mgr = WorkspaceManager::new();
23//! let ws_id = mgr.create("cpp-to-rust");
24//!
25//! let cpp_graph = CodeGraph::with_default_dimension();
26//! let rs_graph = CodeGraph::with_default_dimension();
27//!
28//! let src = mgr.add_context(&ws_id, "/src/cpp", ContextRole::Source, Some("C++".into()), cpp_graph).unwrap();
29//! let tgt = mgr.add_context(&ws_id, "/src/rust", ContextRole::Target, Some("Rust".into()), rs_graph).unwrap();
30//!
31//! let mut tmap = TranslationMap::new(src, tgt);
32//! tmap.record("process_payment", Some("process_payment"), TranslationStatus::Ported, None);
33//! let progress = tmap.progress();
34//! ```
35
36mod manager;
37mod translation;
38
39pub use manager::{
40    CodebaseContext, Comparison, ContextComparison, ContextRole, CrossContextResult,
41    CrossReference, SymbolMatch, Workspace, WorkspaceManager,
42};
43pub use translation::{TranslationMap, TranslationMapping, TranslationProgress, TranslationStatus};