metis_docs_cli/commands/create/
mod.rs1mod adr;
2mod initiative;
3mod strategy;
4mod task;
5
6use crate::commands::SyncCommand;
7use anyhow::Result;
8use clap::{Args, Subcommand};
9
10#[derive(Args)]
11pub struct CreateCommand {
12 #[command(subcommand)]
13 pub document_type: CreateCommands,
14}
15
16#[derive(Subcommand)]
17pub enum CreateCommands {
18 Strategy {
20 title: String,
22 #[arg(short, long)]
24 vision: Option<String>,
25 },
26 Initiative {
28 title: String,
30 #[arg(short, long)]
32 strategy: String,
33 },
34 Task {
36 title: String,
38 #[arg(short, long)]
40 initiative: String,
41 },
42 Adr {
44 title: String,
46 },
47}
48
49impl CreateCommand {
50 pub async fn execute(&self) -> Result<()> {
51 match &self.document_type {
52 CreateCommands::Strategy { title, vision } => {
53 strategy::create_new_strategy(title, vision.as_deref()).await?;
54 }
55 CreateCommands::Initiative { title, strategy } => {
56 initiative::create_new_initiative(title, strategy).await?;
57 }
58 CreateCommands::Task { title, initiative } => {
59 task::create_new_task(title, initiative).await?;
60 }
61 CreateCommands::Adr { title } => {
62 adr::create_new_adr(title).await?;
63 }
64 }
65
66 println!("\nSyncing workspace...");
68 let sync_cmd = SyncCommand {};
69 sync_cmd.execute().await?;
70
71 Ok(())
72 }
73}