-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathworkflow_helpers.rs
More file actions
64 lines (58 loc) · 1.87 KB
/
Copy pathworkflow_helpers.rs
File metadata and controls
64 lines (58 loc) · 1.87 KB
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
use crate::phase_metadata::PhaseExecutionMetadata;
use serde::{Deserialize, Serialize};
use serde_json::Value;
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PhaseExecutionEvent {
pub event_type: String,
pub project_root: String,
pub workflow_id: String,
pub task_id: String,
pub phase_id: String,
pub phase_mode: String,
pub metadata: PhaseExecutionMetadata,
pub payload: Value,
}
pub fn task_requires_research(task: &orchestrator_core::OrchestratorTask) -> bool {
if task.workflow_metadata.requires_architecture {
return true;
}
if task.tags.iter().any(|tag| {
matches!(
tag.trim().to_ascii_lowercase().as_str(),
"needs-research" | "research" | "discovery" | "investigation" | "spike"
)
}) {
return true;
}
let haystack = format!("{} {}", task.title, task.description).to_ascii_lowercase();
[
"research",
"investigate",
"evaluate",
"compare",
"benchmark",
"unknown",
"spike",
"decision record",
"validate approach",
]
.iter()
.any(|needle| haystack.contains(needle))
}
pub fn workflow_has_completed_research(workflow: &orchestrator_core::OrchestratorWorkflow) -> bool {
workflow
.phases
.iter()
.any(|phase| phase.phase_id == "research" && phase.status == orchestrator_core::WorkflowPhaseStatus::Success)
}
pub fn workflow_has_active_research(workflow: &orchestrator_core::OrchestratorWorkflow) -> bool {
workflow.phases.iter().any(|phase| {
phase.phase_id == "research"
&& matches!(
phase.status,
orchestrator_core::WorkflowPhaseStatus::Pending
| orchestrator_core::WorkflowPhaseStatus::Ready
| orchestrator_core::WorkflowPhaseStatus::Running
)
})
}