diff options
Diffstat (limited to 'makima/src/daemon')
| -rw-r--r-- | makima/src/daemon/api/directive.rs | 54 | ||||
| -rw-r--r-- | makima/src/daemon/api/mod.rs | 1 | ||||
| -rw-r--r-- | makima/src/daemon/cli/directive.rs | 40 | ||||
| -rw-r--r-- | makima/src/daemon/cli/mod.rs | 28 | ||||
| -rw-r--r-- | makima/src/daemon/skills/directive.md | 68 | ||||
| -rw-r--r-- | makima/src/daemon/skills/mod.rs | 4 |
6 files changed, 195 insertions, 0 deletions
diff --git a/makima/src/daemon/api/directive.rs b/makima/src/daemon/api/directive.rs new file mode 100644 index 0000000..0c8115a --- /dev/null +++ b/makima/src/daemon/api/directive.rs @@ -0,0 +1,54 @@ +//! Directive API methods. + +use serde::Serialize; +use uuid::Uuid; + +use super::client::{ApiClient, ApiError}; +use super::supervisor::JsonValue; + +/// Request to update a directive. +#[derive(Serialize)] +#[serde(rename_all = "camelCase")] +pub struct UpdateDirectiveRequest { + #[serde(skip_serializing_if = "Option::is_none")] + pub status: Option<String>, + #[serde(skip_serializing_if = "Option::is_none")] + pub version: Option<i32>, +} + +impl ApiClient { + /// Get directive status and details. + pub async fn directive_status(&self, directive_id: Uuid) -> Result<JsonValue, ApiError> { + self.get(&format!("/api/v1/directives/{}", directive_id)) + .await + } + + /// List chains for a directive. + pub async fn directive_chains(&self, directive_id: Uuid) -> Result<JsonValue, ApiError> { + self.get(&format!("/api/v1/directives/{}/chains", directive_id)) + .await + } + + /// Get a chain with its steps. + pub async fn directive_chain( + &self, + directive_id: Uuid, + chain_id: Uuid, + ) -> Result<JsonValue, ApiError> { + self.get(&format!( + "/api/v1/directives/{}/chains/{}", + directive_id, chain_id + )) + .await + } + + /// Update a directive. + pub async fn directive_update( + &self, + directive_id: Uuid, + req: UpdateDirectiveRequest, + ) -> Result<JsonValue, ApiError> { + self.put(&format!("/api/v1/directives/{}", directive_id), &req) + .await + } +} diff --git a/makima/src/daemon/api/mod.rs b/makima/src/daemon/api/mod.rs index 49d80e0..2d1efbf 100644 --- a/makima/src/daemon/api/mod.rs +++ b/makima/src/daemon/api/mod.rs @@ -2,6 +2,7 @@ pub mod client; pub mod contract; +pub mod directive; pub mod supervisor; pub use client::ApiClient; diff --git a/makima/src/daemon/cli/directive.rs b/makima/src/daemon/cli/directive.rs new file mode 100644 index 0000000..5ce88c5 --- /dev/null +++ b/makima/src/daemon/cli/directive.rs @@ -0,0 +1,40 @@ +//! Directive subcommand - directive orchestration commands. + +use clap::Args; +use uuid::Uuid; + +/// Common arguments for directive commands. +#[derive(Args, Debug, Clone)] +pub struct DirectiveArgs { + /// API URL + #[arg(long, env = "MAKIMA_API_URL", default_value = "https://api.makima.jp", global = true)] + pub api_url: String, + + /// API key for authentication + #[arg(long, env = "MAKIMA_API_KEY", global = true)] + pub api_key: String, + + /// Directive ID + #[arg(long, env = "MAKIMA_DIRECTIVE_ID", global = true)] + pub directive_id: Uuid, +} + +/// Arguments for chain command (get specific chain). +#[derive(Args, Debug)] +pub struct ChainArgs { + #[command(flatten)] + pub common: DirectiveArgs, + + /// Chain ID to retrieve + pub chain_id: Uuid, +} + +/// Arguments for update-status command. +#[derive(Args, Debug)] +pub struct UpdateStatusArgs { + #[command(flatten)] + pub common: DirectiveArgs, + + /// New status (draft, planning, active, paused, completed, archived, failed) + pub status: String, +} diff --git a/makima/src/daemon/cli/mod.rs b/makima/src/daemon/cli/mod.rs index 0805edd..9fba216 100644 --- a/makima/src/daemon/cli/mod.rs +++ b/makima/src/daemon/cli/mod.rs @@ -3,6 +3,7 @@ pub mod config; pub mod contract; pub mod daemon; +pub mod directive; pub mod server; pub mod supervisor; pub mod view; @@ -12,6 +13,7 @@ use clap::{Parser, Subcommand}; pub use config::CliConfig; pub use contract::ContractArgs; pub use daemon::DaemonArgs; +pub use directive::DirectiveArgs; pub use server::ServerArgs; pub use supervisor::SupervisorArgs; pub use view::ViewArgs; @@ -41,6 +43,10 @@ pub enum Commands { #[command(subcommand)] Contract(ContractCommand), + /// Directive commands for autonomous goal-driven execution + #[command(subcommand)] + Directive(DirectiveCommand), + /// Interactive TUI browser for contracts and tasks /// /// Provides a drill-down interface for browsing contracts, viewing their @@ -196,6 +202,28 @@ pub enum ContractCommand { CreateFile(contract::CreateFileArgs), } +/// Directive subcommands for autonomous goal-driven execution. +#[derive(Subcommand, Debug)] +pub enum DirectiveCommand { + /// Get directive status and details + Status(DirectiveArgs), + + /// Get goal, requirements, acceptance criteria + Goals(DirectiveArgs), + + /// List chains for the directive + Chains(DirectiveArgs), + + /// Get a chain with its steps + Chain(directive::ChainArgs), + + /// List steps in a chain + Steps(directive::ChainArgs), + + /// Update directive status + UpdateStatus(directive::UpdateStatusArgs), +} + impl Cli { /// Parse command-line arguments pub fn parse_args() -> Self { diff --git a/makima/src/daemon/skills/directive.md b/makima/src/daemon/skills/directive.md new file mode 100644 index 0000000..cdfdaa2 --- /dev/null +++ b/makima/src/daemon/skills/directive.md @@ -0,0 +1,68 @@ +--- +name: makima-directive +description: Directive orchestration tools for autonomous goal-driven execution. Use when working with directives, chains, steps, verifiers, and approvals. +--- + +# Makima Directive Commands + +These commands let orchestrators interact with directive state. Environment variables (`MAKIMA_API_URL`, `MAKIMA_API_KEY`, `MAKIMA_DIRECTIVE_ID`) are pre-configured by the daemon. + +## Status and Information + +### Get directive status +```bash +makima directive status +``` +Returns full directive details including status, autonomy level, thresholds, and tracking info. + +### Get directive goals +```bash +makima directive goals +``` +Returns the goal, requirements, acceptance criteria, constraints, and external dependencies. + +### List chains +```bash +makima directive chains +``` +Returns all chains (plan generations) for the directive, ordered by generation. + +### Get chain with steps +```bash +makima directive chain <chain_id> +``` +Returns a chain and all its steps with status, dependencies, and evaluation info. + +### List steps in a chain +```bash +makima directive steps <chain_id> +``` +Returns just the steps array from a chain. + +## Status Updates + +### Update directive status +```bash +makima directive update-status <status> +``` +Updates the directive status. Valid statuses: `draft`, `planning`, `active`, `paused`, `completed`, `archived`, `failed`. + +## Output Format + +All commands output JSON to stdout. + +Example workflow: +```bash +# Check directive details and goals +makima directive status +makima directive goals + +# List execution chains +makima directive chains + +# Get details of a specific chain +makima directive chain <chain_id> + +# Update status to active +makima directive update-status active +``` diff --git a/makima/src/daemon/skills/mod.rs b/makima/src/daemon/skills/mod.rs index 0b05f3a..6e5d0a8 100644 --- a/makima/src/daemon/skills/mod.rs +++ b/makima/src/daemon/skills/mod.rs @@ -9,8 +9,12 @@ pub const SUPERVISOR_SKILL: &str = include_str!("supervisor.md"); /// Contract skill content - task-contract interaction commands pub const CONTRACT_SKILL: &str = include_str!("contract.md"); +/// Directive skill content - directive orchestration commands +pub const DIRECTIVE_SKILL: &str = include_str!("directive.md"); + /// All skills as (name, content) pairs for installation pub const ALL_SKILLS: &[(&str, &str)] = &[ ("makima-supervisor", SUPERVISOR_SKILL), ("makima-contract", CONTRACT_SKILL), + ("makima-directive", DIRECTIVE_SKILL), ]; |
