Skip to main content

Crate mana_core

Crate mana_core 

Source
Expand description

§mana-core

Core library for the mana work coordination system.

mana-core provides the full data model, I/O layer, and orchestration logic for managing units (atomic work items) in a .mana/ project directory. It is the single source of truth consumed by the mana CLI, GUI tooling, MCP servers, and any other integration point.

§Crate layout

ModulePurpose
apiHigh-level public API — the recommended entry point
unitCore Unit data model and serialization
configProject and global configuration
indexFast unit cache (index.yaml)
graphDependency graph utilities
opsLow-level operations (create, update, close, claim, …)
errorTyped error and result types
discovery.mana/ directory and unit file discovery

§Quick start

use mana_core::api::{find_mana_dir, load_index, get_unit, list_units};
use mana_core::ops::list::ListParams;
use std::path::Path;

// 1. Locate the .mana/ directory (walks up from the current path)
let mana_dir = find_mana_dir(Path::new(".")).expect("not inside a mana project");

// 2. Load the cached index (rebuilds from unit files if stale)
let index = load_index(&mana_dir).expect("failed to load index");
println!("{} units in project", index.units.len());

// 3. Read a specific unit by ID
let unit = get_unit(&mana_dir, "1").expect("unit not found");
println!("{}: {} ({:?})", unit.id, unit.title, unit.status);

// 4. List all open units
let open = list_units(&mana_dir, &ListParams::default()).expect("list failed");
for entry in open {
    println!("  [{}] {}", entry.id, entry.title);
}

§Design principles

  • &Path as entry point — every function takes mana_dir: &Path. No global state, no singletons.
  • No stdout/stderr side effects — all output is returned as structured data.
  • Serializable — all public types derive Serialize/Deserialize for JSON-RPC, MCP, and Tauri IPC.
  • Thread-safe — no interior mutability or shared mutable globals.

Modules§

agent_presets
Agent presets and detection for known coding-agent CLIs.
api
mana-core Public API
blocking
config
Project and global configuration.
ctx_assembler
discovery
error
failure
graph
Dependency graph utilities.
history
hooks
index
Fast unit index cache.
locks
File locking for concurrent agents.
ops
prompt
Structured agent prompt builder.
relevance
unit
Core unit data model.
util
Utility functions for unit ID parsing and status conversion.
verify_lint
worktree
Git worktree detection and merge utilities.