Skip to content

Commit 199d8dc

Browse files
bordumbclaude
andcommitted
feat: add auths pair as a top-level command
Promote device pairing to a first-class command visible in `auths --help`. Pairing is something most users do immediately after `auths init`, so it should be discoverable without `--help-all`. The existing `auths device pair` path continues to work. Also fixes tutorial text to match actual CLI syntax (`auths pair` and `auths pair --join CODE`). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent e5168b2 commit 199d8dc

5 files changed

Lines changed: 18 additions & 2 deletions

File tree

crates/auths-cli/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ auths verify HEAD
1313

1414
That's it. `auths init` generates keys, creates your identity, and configures Git signing.
1515

16+
### Link another device
17+
18+
```bash
19+
auths pair # On existing device — shows QR/code
20+
auths pair --join ABC123 # On new device — enter the code
21+
```
22+
1623
## The Basics
1724

1825
### `auths sign` — Sign a commit or artifact

crates/auths-cli/src/cli.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use crate::commands::completions::CompletionsCommand;
1212
use crate::commands::config::ConfigCommand;
1313
use crate::commands::debug::DebugCmd;
1414
use crate::commands::device::DeviceCommand;
15+
use crate::commands::device::pair::PairCommand;
1516
use crate::commands::doctor::DoctorCommand;
1617
use crate::commands::emergency::EmergencyCommand;
1718
use crate::commands::git::GitCommand;
@@ -91,6 +92,7 @@ pub enum RootCommand {
9192
Whoami(WhoamiCommand),
9293
Tutorial(LearnCommand),
9394
Doctor(DoctorCommand),
95+
Pair(PairCommand),
9496
#[command(hide = true)]
9597
Completions(CompletionsCommand),
9698
#[command(hide = true)]

crates/auths-cli/src/commands/device/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ use crate::commands::executable::ExecutableCommand;
1010
use crate::config::CliConfig;
1111
use anyhow::Result;
1212

13+
impl ExecutableCommand for PairCommand {
14+
fn execute(&self, ctx: &CliConfig) -> Result<()> {
15+
handle_pair(self.clone(), &ctx.env_config)
16+
}
17+
}
18+
1319
impl ExecutableCommand for DeviceCommand {
1420
fn execute(&self, ctx: &CliConfig) -> Result<()> {
1521
handle_device(

crates/auths-cli/src/commands/learn.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -476,11 +476,11 @@ fn section_linking_device() -> Result<()> {
476476
println!(" To link a new device:");
477477
println!();
478478
println!(" {} On your existing device:", "1.".cyan());
479-
println!(" {}", "$ auths pair start".cyan());
479+
println!(" {}", "$ auths pair".cyan());
480480
println!(" {}", "Scan this QR code or enter: ABC123".dimmed());
481481
println!();
482482
println!(" {} On your new device:", "2.".cyan());
483-
println!(" {}", "$ auths pair join --code ABC123".cyan());
483+
println!(" {}", "$ auths pair --join ABC123".cyan());
484484
println!();
485485
println!(
486486
" This creates an {} that authorizes the new device",

crates/auths-cli/src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ fn run() -> Result<()> {
6868
RootCommand::Whoami(cmd) => cmd.execute(&ctx),
6969
RootCommand::Tutorial(cmd) => cmd.execute(&ctx),
7070
RootCommand::Doctor(cmd) => cmd.execute(&ctx),
71+
RootCommand::Pair(cmd) => cmd.execute(&ctx),
7172
RootCommand::Completions(cmd) => cmd.execute(&ctx),
7273
RootCommand::Emergency(cmd) => cmd.execute(&ctx),
7374
RootCommand::Id(cmd) => cmd.execute(&ctx),

0 commit comments

Comments
 (0)