Skip to main content

roder_roadmap/
document.rs

1use std::path::PathBuf;
2
3use serde::{Deserialize, Serialize};
4use time::OffsetDateTime;
5
6#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
7pub struct Document {
8    pub id: String,
9    pub path: PathBuf,
10    pub title: String,
11    pub goal: String,
12    pub architecture: String,
13    pub tech_stack: String,
14    pub owned_paths: Vec<String>,
15    pub tasks: Vec<Task>,
16    pub acceptance: Vec<ChecklistItem>,
17    pub diagnostics: Vec<Diagnostic>,
18}
19
20#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
21pub struct DocumentSummary {
22    pub id: String,
23    pub path: PathBuf,
24    pub title: String,
25    pub checked_tasks: usize,
26    pub unchecked_tasks: usize,
27}
28
29#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
30pub struct Task {
31    pub id: String,
32    pub heading: String,
33    pub checked: bool,
34    pub line: usize,
35    pub level: usize,
36    pub body_range: LineRange,
37    pub run_blocks: Vec<String>,
38    pub paths: Vec<String>,
39}
40
41#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
42pub struct LineRange {
43    pub start: usize,
44    pub end: usize,
45}
46
47#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
48pub struct ChecklistItem {
49    pub id: String,
50    pub text: String,
51    pub checked: bool,
52    pub line: usize,
53}
54
55#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
56pub struct Diagnostic {
57    pub path: PathBuf,
58    pub line: Option<usize>,
59    pub severity: DiagnosticSeverity,
60    pub message: String,
61}
62
63#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
64#[serde(rename_all = "camelCase")]
65pub enum DiagnosticSeverity {
66    Error,
67    Warning,
68}
69
70#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
71pub struct ValidationResult {
72    pub document_id: String,
73    pub diagnostics: Vec<Diagnostic>,
74}
75
76#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
77pub struct ThreadAttachment {
78    pub thread_id: String,
79    pub task_id: Option<String>,
80    pub title: Option<String>,
81    pub status: Option<String>,
82    #[serde(with = "time::serde::rfc3339")]
83    pub created_at: OffsetDateTime,
84    #[serde(with = "time::serde::rfc3339")]
85    pub updated_at: OffsetDateTime,
86}
87
88#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
89pub struct RoadmapState {
90    pub document_id: String,
91    pub path: PathBuf,
92    pub focused_task_id: Option<String>,
93    pub primary_thread_id: Option<String>,
94    pub attached_thread_id: Option<String>,
95    pub threads: Vec<ThreadAttachment>,
96    #[serde(with = "time::serde::rfc3339::option")]
97    pub last_validation: Option<OffsetDateTime>,
98    pub last_diagnostics: Vec<Diagnostic>,
99    #[serde(with = "time::serde::rfc3339")]
100    pub updated_at: OffsetDateTime,
101}