Skip to main content

scud_task_core/
lib.rs

1//! # SCUD Core - Shared Types for SCUD Task Management
2//!
3//! This crate provides the core data types and utilities shared between
4//! SCUD CLI and Descartes GUI applications.
5//!
6//! ## Features
7//!
8//! - **Task types**: [`Task`], [`TaskStatus`], [`Priority`]
9//! - **Phase management**: [`Phase`], [`PhaseStats`], [`IdFormat`]
10//! - **SCG format**: Token-efficient text format for task graphs
11//! - **Wave computation**: Parallel execution wave calculation
12//! - **Storage**: File-based task persistence with locking
13//!
14//! ## Example
15//!
16//! ```
17//! use scud_core::{Task, Phase, compute_waves};
18//!
19//! // Create a phase with tasks
20//! let mut phase = Phase::new("my-feature".to_string());
21//!
22//! let task1 = Task::new(
23//!     "1".to_string(),
24//!     "Implement feature".to_string(),
25//!     "Add the new functionality".to_string(),
26//! );
27//!
28//! let mut task2 = Task::new(
29//!     "2".to_string(),
30//!     "Write tests".to_string(),
31//!     "Add test coverage".to_string(),
32//! );
33//! task2.dependencies = vec!["1".to_string()];
34//!
35//! phase.add_task(task1);
36//! phase.add_task(task2);
37//!
38//! // Find tasks ready to work on
39//! if let Some(next) = phase.find_next_task() {
40//!     println!("Ready: {}", next.title);
41//! }
42//!
43//! // Compute parallel execution waves
44//! let task_refs: Vec<&Task> = phase.tasks.iter().collect();
45//! let result = compute_waves(&task_refs);
46//! println!("Waves: {}", result.waves.len());
47//! ```
48
49/// Core data models for tasks and phases.
50///
51/// This module defines the fundamental types used throughout SCUD:
52///
53/// - [`models::Task`] - Individual work items with status, complexity, dependencies
54/// - [`models::Phase`] - A collection of related tasks (identified by a tag)
55/// - [`models::TaskStatus`] - Task lifecycle states (Pending, InProgress, Done, etc.)
56/// - [`models::Priority`] - Task priority levels (Critical, High, Medium, Low)
57/// - [`models::IdFormat`] - ID generation strategy (Sequential or UUID)
58pub mod models;
59
60/// Task graph serialization formats.
61///
62/// Provides parsers and serializers for the SCG (SCUD Graph) format,
63/// a token-efficient text format designed for AI context windows.
64///
65/// Key exports:
66/// - [`formats::parse_scg`] - Parse SCG text into a Phase
67/// - [`formats::serialize_scg`] - Serialize a Phase to SCG text
68/// - [`formats::Format`] - Enum of supported formats (SCG, JSON)
69pub mod formats;
70
71/// Wave computation for parallel task execution.
72///
73/// Computes execution waves using topological sort, grouping tasks
74/// that can run in parallel based on their dependencies.
75pub mod waves;
76
77/// File-based task storage with locking.
78///
79/// Manages reading and writing of task data to the filesystem with:
80/// - File locking for safe concurrent access
81/// - Caching of active phase selection
82/// - Atomic read-modify-write operations
83pub mod storage;
84
85/// Event publishing system using ZMQ.
86///
87/// Provides ZMQ-based event publishing for task management events.
88/// Supports PUB socket for broadcasting events and REP socket for queries.
89pub mod publisher;
90
91// Re-export commonly used types at the crate root for ergonomic API
92pub use models::{IdFormat, Phase, PhaseStats, Priority, Task, TaskStatus};
93
94// Re-export format utilities
95pub use formats::{natural_sort_ids, parse_scg, serialize_scg, Format};
96
97// Re-export wave computation types and functions
98pub use waves::{compute_waves, detect_id_collisions, Wave, WaveResult};
99
100// Re-export storage
101pub use storage::Storage;