diff --git a/lib/crates/fabro-cli/src/install.rs b/lib/crates/fabro-cli/src/install.rs index 8181a0bdf..3183cae1f 100644 --- a/lib/crates/fabro-cli/src/install.rs +++ b/lib/crates/fabro-cli/src/install.rs @@ -914,7 +914,7 @@ pub async fn run_install() -> Result<()> { eprintln!(); eprintln!( " Setup complete! Go to your project and run {} to get started.", - s.bold_cyan.apply_to("fabro init") + s.bold_cyan.apply_to("fabro repo init") ); Ok(()) } diff --git a/lib/crates/fabro-cli/src/main.rs b/lib/crates/fabro-cli/src/main.rs index bf7b96a66..76b89b0ac 100644 --- a/lib/crates/fabro-cli/src/main.rs +++ b/lib/crates/fabro-cli/src/main.rs @@ -114,7 +114,8 @@ enum Command { #[arg(long)] dry_run: bool, }, - /// Initialize a new project + /// Initialize a new project (deprecated: use `repo init`) + #[command(hide = true)] Init, /// Set up the Fabro environment (LLMs, certs, GitHub) Install, @@ -148,6 +149,11 @@ enum Command { Docs, /// Upgrade fabro to the latest version Upgrade(upgrade::UpgradeArgs), + /// Repository commands + Repo { + #[command(subcommand)] + command: RepoCommand, + }, /// System maintenance commands System { #[command(subcommand)] @@ -189,6 +195,12 @@ enum SystemCommand { Df(commands::runs::DfArgs), } +#[derive(Subcommand)] +enum RepoCommand { + /// Initialize a new project + Init, +} + #[derive(Subcommand)] enum SkillCommand { /// Install a built-in skill @@ -436,6 +448,9 @@ async fn main_inner() -> (String, Result<()>) { #[cfg(feature = "server")] Command::Serve(_) => "serve", Command::Doctor { .. } => "doctor", + Command::Repo { command } => match command { + RepoCommand::Init => "repo init", + }, Command::Init => "init", Command::Install => "install", Command::Ps(_) => "ps", @@ -506,7 +521,11 @@ async fn main_inner() -> (String, Result<()>) { let upgrade_handle = if matches!( cli.command, - Command::Run(_) | Command::Exec(_) | Command::Init | Command::Install + Command::Run(_) + | Command::Exec(_) + | Command::Repo { .. } + | Command::Init + | Command::Install ) { upgrade::spawn_upgrade_check(cli.no_upgrade_check, upgrade_check_enabled) } else { @@ -760,7 +779,16 @@ async fn main_inner() -> (String, Result<()>) { Command::Docs => { open::that("https://docs.fabro.sh/")?; } + Command::Repo { command } => match command { + RepoCommand::Init => { + init::run_init().await?; + } + }, Command::Init => { + eprintln!( + "{} `fabro init` is deprecated, use `fabro repo init` instead", + console::Style::new().yellow().apply_to("warning:") + ); init::run_init().await?; } Command::Install => { diff --git a/lib/crates/fabro-cli/tests/cmd/repo/help.trycmd b/lib/crates/fabro-cli/tests/cmd/repo/help.trycmd new file mode 100644 index 000000000..5fe17b3da --- /dev/null +++ b/lib/crates/fabro-cli/tests/cmd/repo/help.trycmd @@ -0,0 +1,6 @@ +```console +$ fabro repo --help +[..] +... + +``` diff --git a/lib/crates/fabro-cli/tests/trycmd.rs b/lib/crates/fabro-cli/tests/trycmd.rs index dca631493..f4a432055 100644 --- a/lib/crates/fabro-cli/tests/trycmd.rs +++ b/lib/crates/fabro-cli/tests/trycmd.rs @@ -17,6 +17,7 @@ trycmd_subcommand!(cli_install, "install"); trycmd_subcommand!(cli_llm, "llm"); trycmd_subcommand!(cli_model, "model"); trycmd_subcommand!(cli_pr, "pr"); +trycmd_subcommand!(cli_repo, "repo"); trycmd_subcommand!(cli_preview, "preview"); trycmd_subcommand!(cli_run, "run"); trycmd_subcommand!(cli_ssh, "ssh");