Rename init to repo init with backwards-compat shim

Move `fabro init` under `fabro repo init` subcommand group.
The old `fabro init` still works but is hidden from help and
prints a deprecation warning before executing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Bryan Helmkamp 2026-03-18 17:41:49 -04:00
parent 25dba5dfb0
commit 076430cddc
No known key found for this signature in database
4 changed files with 38 additions and 3 deletions

View file

@ -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(())
}

View file

@ -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 => {

View file

@ -0,0 +1,6 @@
```console
$ fabro repo --help
[..]
...
```

View file

@ -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");