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//!
7//! Copyright (c) systemprompt.io — Business Source License 1.1.
8//! See <https://systemprompt.io> for licensing details.
9
10mod enroll_cert;
11mod issue_code;
12mod list;
13mod rotate_signing_key;
14mod types;
15
16use crate::context::CommandContext;
17use crate::shared::render_result;
18use anyhow::Result;
19use clap::Subcommand;
20
21#[derive(Debug, Subcommand)]
22pub enum BridgeCommands {
23    #[command(about = "Enroll a device certificate fingerprint for a user")]
24    EnrollCert(enroll_cert::EnrollCertArgs),
25
26    #[command(about = "Issue a one-shot session exchange code for the bridge helper")]
27    IssueCode(issue_code::IssueCodeArgs),
28
29    #[command(about = "List active bridge sessions (recent heartbeats)")]
30    List(list::ListArgs),
31
32    #[command(
33        about = "Generate a fresh ed25519 manifest signing seed and persist it to the secrets file"
34    )]
35    RotateSigningKey(rotate_signing_key::RotateSigningKeyArgs),
36}
37
38pub async fn execute(cmd: BridgeCommands, ctx: &CommandContext) -> Result<()> {
39    match cmd {
40        BridgeCommands::EnrollCert(args) => {
41            let result = enroll_cert::execute(args, &ctx.cli).await?;
42            render_result(&result, &ctx.cli);
43            Ok(())
44        },
45        BridgeCommands::IssueCode(args) => {
46            let result = issue_code::execute(args, &ctx.cli).await?;
47            render_result(&result, &ctx.cli);
48            Ok(())
49        },
50        BridgeCommands::List(args) => {
51            let result = list::execute(args, &ctx.cli).await?;
52            render_result(&result, &ctx.cli);
53            Ok(())
54        },
55        BridgeCommands::RotateSigningKey(args) => {
56            let result = rotate_signing_key::execute(args, &ctx.cli)?;
57            render_result(&result, &ctx.cli);
58            Ok(())
59        },
60    }
61}