diff options
| author | soryu <soryu@soryu.co> | 2026-02-07 00:01:50 +0000 |
|---|---|---|
| committer | soryu <soryu@soryu.co> | 2026-02-07 00:01:50 +0000 |
| commit | b8d563d45f14a2b1db1f684aa0a8dcd7e5b6ad56 (patch) | |
| tree | 95543fd150270018e384fbcf9d3df3dc45f052f6 /makima/src/bin/makima.rs | |
| parent | cececbf326e258211ceae7afce716a5d1e46014f (diff) | |
| download | soryu-b8d563d45f14a2b1db1f684aa0a8dcd7e5b6ad56.tar.gz soryu-b8d563d45f14a2b1db1f684aa0a8dcd7e5b6ad56.zip | |
Remove directives for reimplementation
Diffstat (limited to 'makima/src/bin/makima.rs')
| -rw-r--r-- | makima/src/bin/makima.rs | 151 |
1 files changed, 1 insertions, 150 deletions
diff --git a/makima/src/bin/makima.rs b/makima/src/bin/makima.rs index d7646c2..ee5895c 100644 --- a/makima/src/bin/makima.rs +++ b/makima/src/bin/makima.rs @@ -7,7 +7,7 @@ use std::sync::Arc; use makima::daemon::api::{ApiClient, CreateContractRequest}; use makima::daemon::cli::{ Cli, CliConfig, Commands, ConfigCommand, ContractCommand, - DirectiveCommand, SupervisorCommand, ViewArgs, + SupervisorCommand, ViewArgs, }; use makima::daemon::tui::{self, Action, App, ListItem, ViewType, TuiWsClient, WsEvent, OutputLine, OutputMessageType, WsConnectionState, RepositorySuggestion}; use makima::daemon::config::{DaemonConfig, RepoEntry}; @@ -31,7 +31,6 @@ async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> { Commands::Contract(cmd) => run_contract(cmd).await, Commands::View(args) => run_view(args).await, Commands::Config(cmd) => run_config(cmd).await, - Commands::Directive(cmd) => run_directive(cmd).await, } } @@ -802,154 +801,6 @@ async fn run_config(cmd: ConfigCommand) -> Result<(), Box<dyn std::error::Error } } -/// Run directive commands. -async fn run_directive( - cmd: DirectiveCommand, -) -> Result<(), Box<dyn std::error::Error + Send + Sync>> { - match cmd { - DirectiveCommand::Create(args) => { - let client = ApiClient::new(args.common.api_url, args.common.api_key)?; - let result = client - .create_directive(&args.goal, args.repository.as_deref(), &args.autonomy) - .await?; - println!("{}", serde_json::to_string(&result.0)?); - } - DirectiveCommand::Status(args) => { - let client = ApiClient::new(args.common.api_url, args.common.api_key)?; - let result = client.get_directive(args.directive_id).await?; - println!("{}", serde_json::to_string(&result.0)?); - } - DirectiveCommand::List(args) => { - let client = ApiClient::new(args.common.api_url, args.common.api_key)?; - let result = client - .list_directives(args.status.as_deref(), args.limit) - .await?; - println!("{}", serde_json::to_string(&result.0)?); - } - DirectiveCommand::Steps(args) => { - let client = ApiClient::new(args.common.api_url, args.common.api_key)?; - let result = client.get_directive_chain(args.directive_id).await?; - println!("{}", serde_json::to_string(&result.0)?); - } - DirectiveCommand::Graph(args) => { - let client = ApiClient::new(args.common.api_url, args.common.api_key)?; - let result = client.get_directive_graph(args.directive_id).await?; - - if args.with_status { - // Enhanced ASCII visualization with status - if let Some(nodes) = result.0.get("nodes").and_then(|v| v.as_array()) { - let mut by_depth: std::collections::HashMap<i32, Vec<(&str, &str)>> = - std::collections::HashMap::new(); - - for node in nodes { - let name = node.get("name").and_then(|v| v.as_str()).unwrap_or("?"); - let status = node - .get("status") - .and_then(|v| v.as_str()) - .unwrap_or("pending"); - let depth = node.get("depth").and_then(|v| v.as_i64()).unwrap_or(0) as i32; - by_depth.entry(depth).or_default().push((name, status)); - } - - let directive_name = result - .0 - .get("name") - .and_then(|v| v.as_str()) - .unwrap_or("Directive"); - println!("Directive: {}", directive_name); - println!(); - - let max_depth = by_depth.keys().max().copied().unwrap_or(0); - for depth in 0..=max_depth { - if let Some(steps) = by_depth.get(&depth) { - let indent = " ".repeat(depth as usize); - for (name, status) in steps { - let status_icon = match *status { - "passed" | "completed" => "\u{2713}", - "running" | "evaluating" => "\u{21bb}", - "failed" | "blocked" => "\u{2717}", - "rework" => "\u{21ba}", - "skipped" => "\u{2212}", - "ready" => "\u{25b7}", - _ => "\u{25cb}", - }; - println!("{}[{}] {} {}", indent, name, status_icon, status); - } - if depth < max_depth { - println!("{} |", indent); - println!("{} v", indent); - } - } - } - } - } else { - println!("{}", serde_json::to_string_pretty(&result.0)?); - } - } - DirectiveCommand::Events(args) => { - let client = ApiClient::new(args.common.api_url, args.common.api_key)?; - let result = client - .list_directive_events(args.directive_id, args.limit) - .await?; - println!("{}", serde_json::to_string(&result.0)?); - } - DirectiveCommand::Approve(args) => { - let client = ApiClient::new(args.common.api_url, args.common.api_key)?; - let result = client - .approve_directive_request( - args.directive_id, - args.approval_id, - args.response.as_deref(), - ) - .await?; - println!("{}", serde_json::to_string(&result.0)?); - } - DirectiveCommand::Deny(args) => { - let client = ApiClient::new(args.common.api_url, args.common.api_key)?; - let result = client - .deny_directive_request( - args.directive_id, - args.approval_id, - args.reason.as_deref(), - ) - .await?; - println!("{}", serde_json::to_string(&result.0)?); - } - DirectiveCommand::Start(args) => { - let client = ApiClient::new(args.common.api_url, args.common.api_key)?; - eprintln!("Starting directive {}...", args.directive_id); - let result = client.start_directive(args.directive_id).await?; - println!("{}", serde_json::to_string(&result.0)?); - } - DirectiveCommand::Pause(args) => { - let client = ApiClient::new(args.common.api_url, args.common.api_key)?; - eprintln!("Pausing directive {}...", args.directive_id); - let result = client.pause_directive(args.directive_id).await?; - println!("{}", serde_json::to_string(&result.0)?); - } - DirectiveCommand::Resume(args) => { - let client = ApiClient::new(args.common.api_url, args.common.api_key)?; - eprintln!("Resuming directive {}...", args.directive_id); - let result = client.resume_directive(args.directive_id).await?; - println!("{}", serde_json::to_string(&result.0)?); - } - DirectiveCommand::Stop(args) => { - let client = ApiClient::new(args.common.api_url, args.common.api_key)?; - eprintln!("Stopping directive {}...", args.directive_id); - let result = client.stop_directive(args.directive_id).await?; - println!("{}", serde_json::to_string(&result.0)?); - } - DirectiveCommand::Archive(args) => { - let client = ApiClient::new(args.common.api_url, args.common.api_key)?; - eprintln!("Archiving directive {}...", args.directive_id); - let result = client.archive_directive(args.directive_id).await?; - println!("{}", serde_json::to_string(&result.0)?); - } - } - - Ok(()) -} - /// Load contracts from API async fn load_contracts(client: &ApiClient) -> Result<Vec<ListItem>, Box<dyn std::error::Error + Send + Sync>> { let result = client.list_contracts().await?; |
