1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
//! # Rusty Beads
//!
//! A Git-backed graph issue tracker for AI coding agents.
//!
//! Rusty Beads provides a powerful issue tracking system designed specifically for AI coding
//! agents, with features like dependency graphs, semantic compaction, and a context store
//! for caching file summaries, symbol indexes, and project metadata.
//!
//! ## Features
//!
//! - **Issue Management**: Create, update, and track issues with rich metadata
//! - **Dependency Graphs**: Model complex relationships with cycle detection
//! - **Context Store**: Git-aware caching for file summaries, symbols, and project context
//! - **Semantic Compaction**: Reduce context size while preserving essential information
//! - **SQLite Storage**: Fast, reliable local storage with WAL mode
//! - **JSONL Export**: Git-friendly format for version control
//! - **Background Daemon**: RPC server for concurrent access
//!
//! ## Quick Start
//!
//! ### As a Library
//!
//! Add to your `Cargo.toml`:
//!
//! ```toml
//! [dependencies]
//! rusty-beads = "0.1"
//! ```
//!
//! ### Basic Usage
//!
//! ```rust,no_run
//! use rusty_beads::{SqliteStorage, Storage, Issue, generate_id};
//! use anyhow::Result;
//!
//! fn main() -> Result<()> {
//! // Open or create a database
//! let storage = SqliteStorage::open(".beads/beads.db")?;
//!
//! // Create an issue
//! let id = generate_id("bd");
//! let issue = Issue::new(&id, "Implement new feature", "developer");
//! storage.create_issue(&issue)?;
//!
//! // Get ready work (unblocked issues)
//! let ready = storage.get_ready_work()?;
//! for issue in ready {
//! println!("{}: {}", issue.id, issue.title);
//! }
//!
//! Ok(())
//! }
//! ```
//!
//! ### Context Store
//!
//! The context store helps AI agents cache and retrieve contextual information
//! with automatic git-aware invalidation:
//!
//! ```rust,no_run
//! use rusty_beads::{ContextStore, ContextEntry, FileContext, Namespace};
//! use serde_json::json;
//! use anyhow::Result;
//!
//! fn main() -> Result<()> {
//! // Open context store
//! let store = ContextStore::open(".beads/context.db")?;
//!
//! // Store file context
//! let file_ctx = FileContext {
//! path: "src/main.rs".to_string(),
//! summary: Some("Application entry point".to_string()),
//! language: Some("rust".to_string()),
//! ..Default::default()
//! };
//! store.set_file_context("src/main.rs", &file_ctx)?;
//!
//! // Store arbitrary key-value data
//! let entry = ContextEntry::new(
//! "custom:my-key",
//! json!({"data": "value"})
//! ).with_ttl(3600); // Expires in 1 hour
//! store.set(entry)?;
//!
//! // Retrieve context
//! if let Some(ctx) = store.get_file_context("src/main.rs")? {
//! println!("Summary: {:?}", ctx.summary);
//! }
//!
//! Ok(())
//! }
//! ```
//!
//! ### Dependencies
//!
//! Model complex task relationships:
//!
//! ```rust,no_run
//! use rusty_beads::{SqliteStorage, Storage, Dependency, DependencyType};
//! use anyhow::Result;
//!
//! fn main() -> Result<()> {
//! let storage = SqliteStorage::open(".beads/beads.db")?;
//!
//! // Create a blocking dependency (bd-0002 is blocked by bd-0001)
//! let dep = Dependency::blocks("bd-0002", "bd-0001");
//!
//! // Check for cycles before adding
//! if !storage.would_create_cycle("bd-0002", "bd-0001", DependencyType::Blocks)? {
//! storage.add_dependency(&dep)?;
//! }
//!
//! Ok(())
//! }
//! ```
//!
//! ## Modules
//!
//! - [`types`] - Core data types (Issue, Status, Dependency, etc.)
//! - [`storage`] - Storage backends (SQLite, JSONL export/import)
//! - [`context`] - Context store for AI agents
//! - [`idgen`] - Hash-based ID generation
//! - [`compact`] - Semantic compaction
//! - [`daemon`] - Background RPC server
//! - [`git`] - Git integration utilities
//! - [`cli`] - Command-line interface
//!
//! ## CLI Tool
//!
//! Install the `bd` command-line tool:
//!
//! ```bash
//! cargo install rusty-beads
//! ```
//!
//! Basic commands:
//!
//! ```bash
//! # Initialize a new repository
//! bd init
//!
//! # Create an issue
//! bd create -t "Fix bug in parser"
//!
//! # List ready (unblocked) issues
//! bd ready
//!
//! # Add a dependency
//! bd dep add bd-0002 bd-0001
//!
//! # Use context store
//! bd context set "file:main.rs" '{"summary": "Entry point"}'
//! bd context get "file:main.rs"
//! ```
//!
//! ## Architecture
//!
//! ```text
//! rusty-beads/
//! ├── types/ # Core data types
//! ├── storage/ # SQLite + JSONL backends
//! ├── context/ # Context store with git-aware invalidation
//! ├── idgen/ # Hash-based ID generation (bd-xxxx)
//! ├── compact/ # Semantic compaction (3 levels)
//! ├── daemon/ # Background RPC server
//! ├── git/ # Git integration
//! └── cli/ # Command-line interface
//! ```
// Re-export CLI types for binary
pub use ;
// Re-export commonly used types
pub use ;
pub use ;
pub use generate_id;
pub use ;
/// Library version.
pub const VERSION: &str = env!;
/// Default ID prefix for issues.
pub const DEFAULT_PREFIX: &str = "bd";