summaryrefslogtreecommitdiff
path: root/makima/src/daemon/cli/chain.rs
diff options
context:
space:
mode:
authorsoryu <soryu@soryu.co>2026-02-03 22:01:29 +0000
committersoryu <soryu@soryu.co>2026-02-03 22:01:37 +0000
commitcf0a25af1d2834bfe6c5ea892ce5769936e5a673 (patch)
tree476ba326ac1752281a441b5c17d2b3be4b23a2a9 /makima/src/daemon/cli/chain.rs
parent8361916ce67f3d2ba191ebf27cb50e79cb42e39c (diff)
downloadsoryu-cf0a25af1d2834bfe6c5ea892ce5769936e5a673.tar.gz
soryu-cf0a25af1d2834bfe6c5ea892ce5769936e5a673.zip
Add makima chain mechanism
Diffstat (limited to 'makima/src/daemon/cli/chain.rs')
-rw-r--r--makima/src/daemon/cli/chain.rs107
1 files changed, 107 insertions, 0 deletions
diff --git a/makima/src/daemon/cli/chain.rs b/makima/src/daemon/cli/chain.rs
new file mode 100644
index 0000000..1d7c167
--- /dev/null
+++ b/makima/src/daemon/cli/chain.rs
@@ -0,0 +1,107 @@
+//! Chain CLI commands for multi-contract orchestration.
+//!
+//! Provides commands for creating, managing, and visualizing chains
+//! (DAGs of contracts).
+
+use clap::Args;
+use std::path::PathBuf;
+use uuid::Uuid;
+
+/// Common arguments for chain commands requiring API access.
+#[derive(Args, Debug, Clone)]
+pub struct ChainArgs {
+ /// 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 the `run` command (create chain from YAML file).
+#[derive(Args, Debug)]
+pub struct RunArgs {
+ #[command(flatten)]
+ pub common: ChainArgs,
+
+ /// Path to the chain YAML file
+ pub file: PathBuf,
+
+ /// Don't actually create the chain, just validate and show what would be created
+ #[arg(long)]
+ pub dry_run: bool,
+}
+
+/// Arguments for the `status` command.
+#[derive(Args, Debug)]
+pub struct StatusArgs {
+ #[command(flatten)]
+ pub common: ChainArgs,
+
+ /// Chain ID
+ pub chain_id: Uuid,
+}
+
+/// Arguments for the `list` command.
+#[derive(Args, Debug)]
+pub struct ListArgs {
+ #[command(flatten)]
+ pub common: ChainArgs,
+
+ /// Filter by status (active, completed, archived)
+ #[arg(long)]
+ pub status: Option<String>,
+
+ /// Limit number of results
+ #[arg(long, default_value = "50")]
+ pub limit: i32,
+}
+
+/// Arguments for the `contracts` command.
+#[derive(Args, Debug)]
+pub struct ContractsArgs {
+ #[command(flatten)]
+ pub common: ChainArgs,
+
+ /// Chain ID
+ pub chain_id: Uuid,
+}
+
+/// Arguments for the `graph` command (ASCII DAG visualization).
+#[derive(Args, Debug)]
+pub struct GraphArgs {
+ #[command(flatten)]
+ pub common: ChainArgs,
+
+ /// Chain ID
+ pub chain_id: Uuid,
+
+ /// Show contract status in nodes
+ #[arg(long)]
+ pub with_status: bool,
+}
+
+/// Arguments for the `validate` command.
+#[derive(Args, Debug)]
+pub struct ValidateArgs {
+ /// Path to the chain YAML file
+ pub file: PathBuf,
+}
+
+/// Arguments for the `preview` command.
+#[derive(Args, Debug)]
+pub struct PreviewArgs {
+ /// Path to the chain YAML file
+ pub file: PathBuf,
+}
+
+/// Arguments for the `archive` command.
+#[derive(Args, Debug)]
+pub struct ArchiveArgs {
+ #[command(flatten)]
+ pub common: ChainArgs,
+
+ /// Chain ID
+ pub chain_id: Uuid,
+}