use chrono::Utc;
use std::path::PathBuf;
use uuid::Uuid;
use super::constants::GOAL_STATE_FILE;
use super::types::GoalState;
impl GoalState {
pub fn state_file(&self) -> PathBuf {
self.state_dir.join(GOAL_STATE_FILE)
}
}
pub(crate) fn goals_dir() -> PathBuf {
crate::runtime::config::omk_state_dir().join(super::constants::GOALS_DIR)
}
pub(crate) fn generate_goal_id() -> String {
let suffix = Uuid::new_v4().to_string();
format!(
"goal-{}-{}",
Utc::now().format("%Y%m%d-%H%M%S-%3f"),
&suffix[..8]
)
}
pub(crate) fn normalize_goal(goal: &str) -> String {
goal.split_whitespace().collect::<Vec<_>>().join(" ")
}