diff options
Diffstat (limited to 'makima/src/daemon/cli')
| -rw-r--r-- | makima/src/daemon/cli/contract.rs | 87 | ||||
| -rw-r--r-- | makima/src/daemon/cli/mod.rs | 140 | ||||
| -rw-r--r-- | makima/src/daemon/cli/supervisor.rs | 448 |
3 files changed, 3 insertions, 672 deletions
diff --git a/makima/src/daemon/cli/contract.rs b/makima/src/daemon/cli/contract.rs deleted file mode 100644 index a443b85..0000000 --- a/makima/src/daemon/cli/contract.rs +++ /dev/null @@ -1,87 +0,0 @@ -//! Contract subcommand - task-contract interaction commands. - -use clap::Args; -use uuid::Uuid; - -/// Common arguments for contract commands. -#[derive(Args, Debug, Clone)] -pub struct ContractArgs { - /// 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, - - /// Current task ID (optional) - #[arg(long, env = "MAKIMA_TASK_ID", global = true)] - pub task_id: Option<Uuid>, - - /// Contract ID - #[arg(long, env = "MAKIMA_CONTRACT_ID", global = true)] - pub contract_id: Uuid, -} - -/// Arguments for file command (get specific file). -#[derive(Args, Debug)] -pub struct FileArgs { - #[command(flatten)] - pub common: ContractArgs, - - /// File ID to retrieve - pub file_id: Uuid, -} - -/// Arguments for report command. -#[derive(Args, Debug)] -pub struct ReportArgs { - #[command(flatten)] - pub common: ContractArgs, - - /// Progress message - pub message: String, -} - -/// Arguments for completion-action command. -#[derive(Args, Debug)] -pub struct CompletionActionArgs { - #[command(flatten)] - pub common: ContractArgs, - - /// Comma-separated list of modified files - #[arg(long)] - pub files: Option<String>, - - /// Number of lines added - #[arg(long, default_value = "0")] - pub lines_added: i32, - - /// Number of lines removed - #[arg(long, default_value = "0")] - pub lines_removed: i32, - - /// Whether there are code changes - #[arg(long)] - pub code: bool, -} - -/// Arguments for update-file command. -#[derive(Args, Debug)] -pub struct UpdateFileArgs { - #[command(flatten)] - pub common: ContractArgs, - - /// File ID to update - pub file_id: Uuid, -} - -/// Arguments for create-file command. -#[derive(Args, Debug)] -pub struct CreateFileArgs { - #[command(flatten)] - pub common: ContractArgs, - - /// Name of the new file - pub name: String, -} diff --git a/makima/src/daemon/cli/mod.rs b/makima/src/daemon/cli/mod.rs index 7affc55..b01c161 100644 --- a/makima/src/daemon/cli/mod.rs +++ b/makima/src/daemon/cli/mod.rs @@ -1,21 +1,17 @@ //! Command-line interface for the makima CLI. pub mod config; -pub mod contract; pub mod daemon; pub mod directive; pub mod server; -pub mod supervisor; pub mod view; 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; /// Makima - unified CLI for server, daemon, and task management. @@ -35,28 +31,11 @@ pub enum Commands { /// Run the daemon (connect to server, manage tasks) Daemon(DaemonArgs), - /// Supervisor commands for contract orchestration - #[command(subcommand)] - Supervisor(SupervisorCommand), - - /// Contract commands for task-contract interaction - #[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 - /// tasks, and streaming real-time task output. - /// - /// Keyboard shortcuts: - /// ↑/k: Move up ↓/j: Move down Enter/l: Drill in - /// Esc/h: Go back /: Search q: Quit - /// e: Edit d: Delete c: cd to worktree - /// n: New contract + /// Interactive TUI browser for directives and tasks View(ViewArgs), /// Configure CLI settings (API key, server URL) @@ -86,121 +65,8 @@ pub enum ConfigCommand { Path, } -/// Supervisor subcommands for contract orchestration. -#[derive(Subcommand, Debug)] -pub enum SupervisorCommand { - /// List all tasks in the contract - Tasks(SupervisorArgs), - - /// Get the task tree structure - Tree(SupervisorArgs), - - /// Create and start a new task - Spawn(supervisor::SpawnArgs), - - /// Wait for a task to complete - Wait(supervisor::WaitArgs), - - /// Read a file from a task's worktree - ReadFile(supervisor::ReadFileArgs), - - /// Create a git branch - Branch(supervisor::BranchArgs), - - /// Merge a task's changes to a branch - Merge(supervisor::MergeArgs), - - /// Create a pull request - Pr(supervisor::PrArgs), - - /// View task diff - Diff(supervisor::DiffArgs), - - /// Create a checkpoint - Checkpoint(supervisor::CheckpointArgs), - - /// List checkpoints - Checkpoints(SupervisorArgs), - - /// Get contract status - Status(SupervisorArgs), - - /// Advance the contract to the next phase - AdvancePhase(supervisor::AdvancePhaseArgs), - - /// Ask a question and wait for user feedback - Ask(supervisor::AskArgs), - - /// Get individual task details - Task(supervisor::GetTaskArgs), - - /// Get task output/claude log - Output(supervisor::GetTaskOutputArgs), - - /// View task conversation history - TaskHistory(supervisor::TaskHistoryArgs), - - /// List task checkpoints (with optional diff) - TaskCheckpoints(supervisor::TaskCheckpointsArgs), - - /// Resume supervisor after interruption - Resume(supervisor::ResumeArgs), - - /// Resume task from checkpoint - TaskResumeFrom(supervisor::TaskResumeFromArgs), - - /// Rewind task code to checkpoint - TaskRewind(supervisor::TaskRewindArgs), - - /// Fork task from historical point - TaskFork(supervisor::TaskForkArgs), - - /// Rewind supervisor conversation - RewindConversation(supervisor::ConversationRewindArgs), - - /// Mark the contract as complete and stop the supervisor - Complete(supervisor::CompleteArgs), - - /// Resume a completed contract (reactivate it) - ResumeContract(supervisor::ResumeContractArgs), - - /// Mark a deliverable as complete - MarkDeliverable(supervisor::MarkDeliverableArgs), -} - -/// Contract subcommands for task-contract interaction. -#[derive(Subcommand, Debug)] -pub enum ContractCommand { - /// Get contract status - Status(ContractArgs), - - /// Get the phase checklist - Checklist(ContractArgs), - - /// Get contract goals - Goals(ContractArgs), - - /// List contract files - Files(ContractArgs), - - /// Get a specific file's content - File(contract::FileArgs), - - /// Report progress on the contract - Report(contract::ReportArgs), - - /// Get suggested next action - SuggestAction(ContractArgs), - - /// Get completion recommendation - CompletionAction(contract::CompletionActionArgs), - - /// Update a file (reads content from stdin) - UpdateFile(contract::UpdateFileArgs), - - /// Create a new file (reads content from stdin) - CreateFile(contract::CreateFileArgs), -} +// SupervisorCommand and ContractCommand removed in Phase 5 — contracts +// subsystem is gone. See cli/contract.rs and cli/supervisor.rs deletion. /// Directive subcommands for DAG-based project management. #[derive(Subcommand, Debug)] diff --git a/makima/src/daemon/cli/supervisor.rs b/makima/src/daemon/cli/supervisor.rs deleted file mode 100644 index 82d3900..0000000 --- a/makima/src/daemon/cli/supervisor.rs +++ /dev/null @@ -1,448 +0,0 @@ -//! Supervisor subcommand - contract orchestration commands. - -use clap::Args; -use uuid::Uuid; - -/// Common arguments for supervisor commands. -#[derive(Args, Debug, Clone)] -pub struct SupervisorArgs { - /// API URL - #[arg(long, env = "MAKIMA_API_URL", default_value = "https://api.makima.jp")] - pub api_url: String, - - /// API key for authentication - #[arg(long, env = "MAKIMA_API_KEY")] - pub api_key: String, - - /// Current task ID (optional) - the supervisor's own task ID - #[arg(long, env = "MAKIMA_TASK_ID")] - pub self_task_id: Option<Uuid>, - - /// Contract ID - #[arg(long, env = "MAKIMA_CONTRACT_ID")] - pub contract_id: Uuid, -} - -/// Arguments for spawn command. -#[derive(Args, Debug)] -pub struct SpawnArgs { - #[command(flatten)] - pub common: SupervisorArgs, - - /// Name of the task - #[arg(index = 1)] - pub name: String, - - /// Plan/description for the task - #[arg(index = 2)] - pub plan: String, - - /// Parent task ID to branch from - #[arg(long)] - pub parent: Option<Uuid>, - - /// Checkpoint SHA to start from - #[arg(long)] - pub checkpoint: Option<String>, - - /// Repository URL (local path or remote URL). If not provided, will try to detect from current directory. - #[arg(long)] - pub repo: Option<String>, -} - -/// Arguments for wait command. -#[derive(Args, Debug)] -pub struct WaitArgs { - #[command(flatten)] - pub common: SupervisorArgs, - - /// Task ID to wait for - #[arg(index = 1)] - pub task_id: Uuid, - - /// Timeout in seconds (total wait time) - #[arg(index = 2, default_value = "300")] - pub timeout: i32, - - /// Polling interval in seconds (how often to check task status via client-side polling) - #[arg(long, default_value = "5")] - pub poll_interval: u64, -} - -/// Arguments for read-file command. -#[derive(Args, Debug)] -pub struct ReadFileArgs { - #[command(flatten)] - pub common: SupervisorArgs, - - /// Task ID to read from - #[arg(index = 1)] - pub task_id: Uuid, - - /// File path to read - #[arg(index = 2)] - pub file_path: String, -} - -/// Arguments for branch command. -#[derive(Args, Debug)] -pub struct BranchArgs { - #[command(flatten)] - pub common: SupervisorArgs, - - /// Branch name to create - #[arg(index = 1)] - pub name: String, - - /// Reference (task ID or SHA) to branch from - #[arg(long)] - pub from: Option<String>, -} - -/// Arguments for merge command. -#[derive(Args, Debug)] -pub struct MergeArgs { - #[command(flatten)] - pub common: SupervisorArgs, - - /// Task ID to merge - #[arg(index = 1)] - pub task_id: Uuid, - - /// Target branch to merge into - #[arg(long)] - pub to: Option<String>, - - /// Squash commits on merge - #[arg(long)] - pub squash: bool, -} - -/// Arguments for pr command. -#[derive(Args, Debug)] -pub struct PrArgs { - #[command(flatten)] - pub common: SupervisorArgs, - - /// Branch name to create PR from (e.g., "makima/feature-name") - #[arg(index = 1)] - pub branch: String, - - /// PR title - #[arg(long)] - pub title: String, - - /// PR body/description - #[arg(long)] - pub body: Option<String>, -} - -/// Arguments for diff command. -#[derive(Args, Debug)] -pub struct DiffArgs { - #[command(flatten)] - pub common: SupervisorArgs, - - /// Task ID to get diff for - #[arg(index = 1)] - pub task_id: Uuid, -} - -/// Arguments for checkpoint command. -#[derive(Args, Debug)] -pub struct CheckpointArgs { - #[command(flatten)] - pub common: SupervisorArgs, - - /// Checkpoint message - #[arg(index = 1)] - pub message: String, -} - -/// Arguments for ask command (ask user a question). -#[derive(Args, Debug)] -pub struct AskArgs { - #[command(flatten)] - pub common: SupervisorArgs, - - /// The question to ask - #[arg(index = 1)] - pub question: String, - - /// Optional choices (comma-separated) - #[arg(long)] - pub choices: Option<String>, - - /// Context about what this relates to - #[arg(long)] - pub context: Option<String>, - - /// Timeout in seconds (default: 3600 = 1 hour) - #[arg(long, default_value = "3600")] - pub timeout: i32, - - /// Block indefinitely until user responds (no timeout) - #[arg(long, default_value = "false")] - pub phaseguard: bool, - - /// Allow selecting multiple choices (response will be comma-separated) - #[arg(long, default_value = "false")] - pub multi_select: bool, - - /// Non-blocking mode - returns immediately without waiting for response - #[arg(long, default_value = "false")] - pub non_blocking: bool, - - /// Question type (general, phase_confirmation, contract_complete) - #[arg(long, default_value = "general")] - pub question_type: String, -} - -/// Arguments for status command (get contract status including phase). -#[derive(Args, Debug)] -pub struct StatusArgs { - #[command(flatten)] - pub common: SupervisorArgs, -} - -/// Arguments for advance-phase command. -#[derive(Args, Debug)] -pub struct AdvancePhaseArgs { - #[command(flatten)] - pub common: SupervisorArgs, - - /// The phase to advance to (specify, plan, execute, review) - #[arg(index = 1)] - pub phase: String, - - /// Confirm the phase transition (required when phase_guard is enabled). - /// Without this flag, the command will return deliverables for review. - #[arg(long, short = 'y')] - pub confirmed: bool, -} - -/// Arguments for mark-deliverable command. -#[derive(Args, Debug)] -pub struct MarkDeliverableArgs { - #[command(flatten)] - pub common: SupervisorArgs, - - /// The deliverable ID to mark as complete (e.g., 'plan-document', 'pull-request', 'research-notes') - #[arg(index = 1)] - pub deliverable_id: String, - - /// Phase the deliverable belongs to. Defaults to current contract phase if not specified. - #[arg(long)] - pub phase: Option<String>, -} - -/// Arguments for task command (get individual task details). -#[derive(Args, Debug)] -pub struct GetTaskArgs { - #[command(flatten)] - pub common: SupervisorArgs, - - /// Task ID to get details for - #[arg(index = 1, id = "target_task_id")] - pub target_task_id: Uuid, -} - -/// Arguments for output command (get task output/claude log). -#[derive(Args, Debug)] -pub struct GetTaskOutputArgs { - #[command(flatten)] - pub common: SupervisorArgs, - - /// Task ID to get output for - #[arg(index = 1, id = "target_task_id")] - pub target_task_id: Uuid, -} - -// ============================================================================ -// History Command Args -// ============================================================================ - -/// Arguments for task-history command. -#[derive(Args, Debug)] -pub struct TaskHistoryArgs { - #[command(flatten)] - pub common: SupervisorArgs, - - /// Task ID to view history for - #[arg(index = 1)] - pub task_id: Uuid, - - /// Include tool calls in output - #[arg(long, default_value = "true")] - pub tool_calls: bool, - - /// Maximum messages to return - #[arg(long)] - pub limit: Option<i32>, - - /// Output format (table, json, chat) - #[arg(long, default_value = "chat")] - pub format: String, -} - -/// Arguments for task-checkpoints command (with optional diff). -#[derive(Args, Debug)] -pub struct TaskCheckpointsArgs { - #[command(flatten)] - pub common: SupervisorArgs, - - /// Task ID to list checkpoints for - #[arg(index = 1)] - pub task_id: Uuid, - - /// Include diff summary - #[arg(long)] - pub with_diff: bool, -} - -// ============================================================================ -// Resume Command Args -// ============================================================================ - -/// Arguments for resume command. -#[derive(Args, Debug)] -pub struct ResumeArgs { - #[command(flatten)] - pub common: SupervisorArgs, - - /// Resume mode: continue, restart_phase, from_checkpoint - #[arg(long, default_value = "continue")] - pub mode: String, - - /// Checkpoint ID (required for from_checkpoint mode) - #[arg(long)] - pub checkpoint: Option<Uuid>, - - /// Additional context to inject - #[arg(long)] - pub context: Option<String>, -} - -/// Arguments for task-resume-from command. -#[derive(Args, Debug)] -pub struct TaskResumeFromArgs { - #[command(flatten)] - pub common: SupervisorArgs, - - /// Source task ID - #[arg(index = 1)] - pub task_id: Uuid, - - /// Checkpoint number to resume from - #[arg(long)] - pub checkpoint: i32, - - /// Plan for the new task - #[arg(long)] - pub plan: String, - - /// Name for the new task - #[arg(long)] - pub name: Option<String>, -} - -// ============================================================================ -// Rewind Command Args -// ============================================================================ - -/// Arguments for task-rewind command. -#[derive(Args, Debug)] -pub struct TaskRewindArgs { - #[command(flatten)] - pub common: SupervisorArgs, - - /// Task ID to rewind - #[arg(index = 1)] - pub task_id: Uuid, - - /// Checkpoint number to rewind to - #[arg(long)] - pub checkpoint: i32, - - /// Preserve mode: discard, create_branch, stash - #[arg(long, default_value = "create_branch")] - pub preserve: String, - - /// Branch name (for create_branch mode) - #[arg(long)] - pub branch_name: Option<String>, -} - -/// Arguments for task-fork command. -#[derive(Args, Debug)] -pub struct TaskForkArgs { - #[command(flatten)] - pub common: SupervisorArgs, - - /// Source task ID - #[arg(index = 1)] - pub task_id: Uuid, - - /// Checkpoint number to fork from - #[arg(long)] - pub checkpoint: i32, - - /// Name for the new task - #[arg(long)] - pub name: String, - - /// Plan for the new task - #[arg(long)] - pub plan: String, - - /// Include conversation history - #[arg(long, default_value = "true")] - pub include_conversation: bool, -} - -/// Arguments for rewind-conversation command. -#[derive(Args, Debug)] -pub struct ConversationRewindArgs { - #[command(flatten)] - pub common: SupervisorArgs, - - /// Number of messages to rewind - #[arg(long)] - pub by_messages: Option<i32>, - - /// Message ID to rewind to - #[arg(long)] - pub to_message: Option<String>, - - /// Also rewind code to matching checkpoint - #[arg(long)] - pub rewind_code: bool, -} - -/// Arguments for complete command (mark contract as complete). -#[derive(Args, Debug)] -pub struct CompleteArgs { - #[command(flatten)] - pub common: SupervisorArgs, -} - -// ============================================================================ -// Resume Contract Command Args -// ============================================================================ - -/// Arguments for resume-contract command (reactivate a completed contract). -#[derive(Args, Debug)] -pub struct ResumeContractArgs { - /// API URL - #[arg(long, env = "MAKIMA_API_URL", default_value = "https://api.makima.jp")] - pub api_url: String, - - /// API key for authentication - #[arg(long, env = "MAKIMA_API_KEY")] - pub api_key: String, - - /// Contract ID to resume - #[arg(index = 1)] - pub contract_id: Uuid, -} - |
