bears/lib.rs
1//! `bears` — a file-based task tracker for AI agent workflows.
2//!
3//! Tasks are markdown files with YAML frontmatter in a `.bears/` directory.
4//! This crate is the core library behind the `bea` CLI, MCP server, and TUI; it
5//! is published so that an independent application can drive a bears repository
6//! directly instead of shelling out to the binary.
7//!
8//! # Layering
9//!
10//! - [`store`] parses and writes the `.bears/` directory, including the archive.
11//! - [`task`] defines [`Task`](task::Task) and the frontmatter format.
12//! - [`graph`] computes the dependency graph, readiness, and effective priority.
13//! - [`service`] is the business logic layer — create, update, reparent, archive,
14//! epic progress and auto-close. Most callers want this.
15//! - [`scaffold`] writes coding-agent integration files (`CLAUDE.md`, skills, MCP config).
16//!
17//! There is no cache and no daemon: [`store::load_all`] re-reads the whole
18//! directory, and mutating functions take the resulting map by reference.
19//!
20//! # Example
21//!
22//! ```no_run
23//! use bears::{service, store};
24//!
25//! # async fn run() -> bears::error::Result<()> {
26//! let base = std::path::Path::new(".");
27//! let tasks = store::load_all(base).await?;
28//!
29//! for task in service::list_ready(&tasks, None, None, None) {
30//! println!("{} {} {}", task.id, task.priority, task.title);
31//! }
32//! # Ok(())
33//! # }
34//! ```
35
36pub mod config;
37pub mod error;
38pub mod graph;
39pub mod scaffold;
40pub mod service;
41pub mod store;
42pub mod task;
43
44pub use error::{Error, Result};
45pub use task::{Priority, Status, Task, TaskType};