summaryrefslogtreecommitdiff
path: root/makima/src/daemon/cli
diff options
context:
space:
mode:
Diffstat (limited to 'makima/src/daemon/cli')
-rw-r--r--makima/src/daemon/cli/directive.rs101
-rw-r--r--makima/src/daemon/cli/mod.rs49
2 files changed, 150 insertions, 0 deletions
diff --git a/makima/src/daemon/cli/directive.rs b/makima/src/daemon/cli/directive.rs
new file mode 100644
index 0000000..5de60ed
--- /dev/null
+++ b/makima/src/daemon/cli/directive.rs
@@ -0,0 +1,101 @@
+//! Directive subcommand - directive management commands for orchestrator tasks.
+
+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 listing directives (no directive_id required).
+#[derive(Args, Debug, Clone)]
+pub struct DirectiveListArgs {
+ /// 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,
+}
+
+/// Arguments for add-step command.
+#[derive(Args, Debug)]
+pub struct AddStepArgs {
+ #[command(flatten)]
+ pub common: DirectiveArgs,
+
+ /// Step name
+ pub name: String,
+
+ /// Step description
+ #[arg(long)]
+ pub description: Option<String>,
+
+ /// Task plan for the step
+ #[arg(long)]
+ pub task_plan: Option<String>,
+
+ /// Comma-separated UUIDs of dependency steps
+ #[arg(long)]
+ pub depends_on: Option<String>,
+
+ /// Order index
+ #[arg(long, default_value = "0")]
+ pub order_index: i32,
+}
+
+/// Arguments for remove-step command.
+#[derive(Args, Debug)]
+pub struct RemoveStepArgs {
+ #[command(flatten)]
+ pub common: DirectiveArgs,
+
+ /// Step ID to remove
+ pub step_id: Uuid,
+}
+
+/// Arguments for set-deps command.
+#[derive(Args, Debug)]
+pub struct SetDepsArgs {
+ #[command(flatten)]
+ pub common: DirectiveArgs,
+
+ /// Step ID to update
+ pub step_id: Uuid,
+
+ /// Comma-separated UUIDs of dependency steps
+ pub depends_on: String,
+}
+
+/// Arguments for complete-step/fail-step/skip-step commands.
+#[derive(Args, Debug)]
+pub struct StepActionArgs {
+ #[command(flatten)]
+ pub common: DirectiveArgs,
+
+ /// Step ID
+ pub step_id: Uuid,
+}
+
+/// Arguments for update-goal command.
+#[derive(Args, Debug)]
+pub struct UpdateGoalArgs {
+ #[command(flatten)]
+ pub common: DirectiveArgs,
+
+ /// New goal text
+ pub goal: String,
+}
diff --git a/makima/src/daemon/cli/mod.rs b/makima/src/daemon/cli/mod.rs
index 0805edd..faafaea 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 DAG-based project management
+ #[command(subcommand)]
+ Directive(DirectiveCommand),
+
/// Interactive TUI browser for contracts and tasks
///
/// Provides a drill-down interface for browsing contracts, viewing their
@@ -196,6 +202,49 @@ pub enum ContractCommand {
CreateFile(contract::CreateFileArgs),
}
+/// Directive subcommands for DAG-based project management.
+#[derive(Subcommand, Debug)]
+pub enum DirectiveCommand {
+ /// List all directives
+ List(directive::DirectiveListArgs),
+
+ /// Get directive status with steps
+ Get(DirectiveArgs),
+
+ /// Get directive status (alias for get)
+ Status(DirectiveArgs),
+
+ /// Add a step to the directive
+ AddStep(directive::AddStepArgs),
+
+ /// Remove a step from the directive
+ RemoveStep(directive::RemoveStepArgs),
+
+ /// Set dependencies for a step
+ SetDeps(directive::SetDepsArgs),
+
+ /// Start the directive (begin executing steps)
+ Start(DirectiveArgs),
+
+ /// Pause the directive
+ Pause(DirectiveArgs),
+
+ /// Advance the DAG (find newly-ready steps)
+ Advance(DirectiveArgs),
+
+ /// Mark a step as completed
+ CompleteStep(directive::StepActionArgs),
+
+ /// Mark a step as failed
+ FailStep(directive::StepActionArgs),
+
+ /// Mark a step as skipped
+ SkipStep(directive::StepActionArgs),
+
+ /// Update the directive's goal (triggers re-planning)
+ UpdateGoal(directive::UpdateGoalArgs),
+}
+
impl Cli {
/// Parse command-line arguments
pub fn parse_args() -> Self {