Skip to main content

assemble

Function assemble 

Source
pub fn assemble(
    root: PathBuf,
    git: GitSignals,
    touched_files: Vec<FileObservation>,
) -> Result<ContextSnapshot, String>
Expand description

Assemble a ContextSnapshot from already-collected signals. This is the stable seam any future integration layer (HUD, ACP, MCP) plugs into.

Examples found in repository?
examples/snapshot.rs (line 38)
27fn run() -> Result<(), String> {
28    let root = env::args()
29        .nth(1)
30        .map(PathBuf::from)
31        .unwrap_or_else(|| env::current_dir().expect("cwd"));
32    let root = root
33        .canonicalize()
34        .map_err(|error| format!("cannot canonicalize {}: {error}", root.display()))?;
35
36    let git = collect_git(&root)?;
37    let files = context_engine::collect_files(&root)?;
38    let snapshot = context_engine::assemble(root.clone(), git, files)?;
39    let result = state_writer::write(&root, &snapshot)?;
40
41    println!("Wrote:");
42    println!("  {}", result.state_path.display());
43    println!("  {}", result.now_brief_path.display());
44    println!("  {}", result.session_brief_path.display());
45    println!("  {}", result.week_brief_path.display());
46    println!("  {}  <- primary agent surface", result.agent_brief_path.display());
47    println!("  {}  <- Claude Code surface", result.claude_brief_path.display());
48    Ok(())
49}