diff --git a/crates/forest/src/cli.rs b/crates/forest/src/cli.rs index fa7aecc..a9e02ef 100644 --- a/crates/forest/src/cli.rs +++ b/crates/forest/src/cli.rs @@ -5,7 +5,7 @@ use kdl::KdlDocument; use rusty_s3::{Bucket, Credentials, S3Action}; use crate::{ - model::{Plan, Project}, + model::{Context, Plan, Project}, plan_reconciler::PlanReconciler, state::SharedState, }; @@ -70,16 +70,22 @@ pub async fn execute() -> anyhow::Result<()> { let project: Project = project_doc.try_into()?; tracing::trace!("found a project name: {}", project.name); - if let Some(plan_file_path) = PlanReconciler::new() + let plan = if let Some(plan_file_path) = PlanReconciler::new() .reconcile(&project, &project_path) .await? { let plan_file = tokio::fs::read_to_string(&plan_file_path).await?; let plan_doc: KdlDocument = plan_file.parse()?; - let project: Plan = plan_doc.try_into()?; + let plan: Plan = plan_doc.try_into()?; tracing::trace!("found a plan name: {}", project.name); - } + + Some(plan) + } else { + None + }; + + let context = Context { project, plan }; } Commands::Serve { diff --git a/crates/forest/src/model.rs b/crates/forest/src/model.rs index 0a393fa..bce63c8 100644 --- a/crates/forest/src/model.rs +++ b/crates/forest/src/model.rs @@ -2,6 +2,12 @@ use std::path::PathBuf; use kdl::{KdlDocument, KdlNode, KdlValue}; +#[derive(Debug, Clone)] +pub struct Context { + pub project: Project, + pub plan: Option, +} + #[derive(Debug, Clone)] pub struct Plan { pub name: String, diff --git a/todos/hyperlog/graph.lock b/todos/hyperlog/graph.lock new file mode 100644 index 0000000..016d04c --- /dev/null +++ b/todos/hyperlog/graph.lock @@ -0,0 +1 @@ +hyperlog-lock \ No newline at end of file