Expand description
§forge-orchestrator
The library behind the forge binary. Its documented, supported surface is core: the types
that read and write a project’s .forge/ directory (state and file locks, tasks, the event log,
the knowledge base and the plan). Other tools can use it to inspect or drive a Forge project
without shelling out to forge.
The other modules are the binary’s internals. They are public only so the binary can use them, are hidden from these docs, and may change in any release.
The crate is at the alpha stage, like the binary: the API may change without notice.
use forge_orchestrator::core::knowledge::{KnowledgeCategory, KnowledgeEntry, KnowledgeManager};
use forge_orchestrator::core::task::{Task, TaskManager, TaskStatus};
let project = tempfile::tempdir()?;
let forge_dir = project.path().join(".forge");
// Create a task, then read the board back.
let tasks = TaskManager::new(&forge_dir);
tasks.create_task(&Task::new("T-001", "Parse the config", "Read forge.toml into Config"))?;
let pending: Vec<Task> = tasks
.list_tasks()?
.into_iter()
.filter(|t| t.status == TaskStatus::Pending)
.collect();
assert_eq!(pending[0].id, "T-001");
// Capture a decision in the knowledge base and list that category.
let knowledge = KnowledgeManager::new(&forge_dir);
let entry = KnowledgeEntry::new("Use TOML", "Config is TOML, not YAML.", &KnowledgeCategory::Decision)
.with_task("T-001");
knowledge.capture(&entry)?;
assert_eq!(knowledge.list(Some("decisions"))?.len(), 1);