Skip to main content

systemprompt_cli/commands/admin/bridge/
mod.rs

1//! `admin bridge` subcommand: operator tools for the bridge helper.
2//!
3//! Exposes [`BridgeCommands`] for enrolling device-certificate fingerprints,
4//! issuing one-shot session exchange codes, listing active bridge sessions,
5//! and rotating the ed25519 manifest signing seed.
6
7mod enroll_cert;
8mod issue_code;
9mod list;
10mod rotate_signing_key;
11mod types;
12
13use crate::CliConfig;
14use crate::shared::render_result;
15use anyhow::Result;
16use clap::Subcommand;
17
18#[derive(Debug, Subcommand)]
19pub enum BridgeCommands {
20    #[command(about = "Enroll a device certificate fingerprint for a user")]
21    EnrollCert(enroll_cert::EnrollCertArgs),
22
23    #[command(about = "Issue a one-shot session exchange code for the bridge helper")]
24    IssueCode(issue_code::IssueCodeArgs),
25
26    #[command(about = "List active bridge sessions (recent heartbeats)")]
27    List(list::ListArgs),
28
29    #[command(
30        about = "Generate a fresh ed25519 manifest signing seed and persist it to the secrets file"
31    )]
32    RotateSigningKey(rotate_signing_key::RotateSigningKeyArgs),
33}
34
35pub async fn execute(cmd: BridgeCommands, config: &CliConfig) -> Result<()> {
36    match cmd {
37        BridgeCommands::EnrollCert(args) => {
38            let result = enroll_cert::execute(args, config).await?;
39            render_result(&result);
40            Ok(())
41        },
42        BridgeCommands::IssueCode(args) => {
43            let result = issue_code::execute(args, config).await?;
44            render_result(&result);
45            Ok(())
46        },
47        BridgeCommands::List(args) => {
48            let result = list::execute(args, config).await?;
49            render_result(&result);
50            Ok(())
51        },
52        BridgeCommands::RotateSigningKey(args) => {
53            let result = rotate_signing_key::execute(args, config)?;
54            render_result(&result);
55            Ok(())
56        },
57    }
58}