feat(cli): add pic triggers + dead-letters + secrets subcommands

Closes the audit's High-severity CLI coverage gap, raising the count
from ~25 to ~40+ subcommands and bringing the integration test count
from 63 to 73.

- pic triggers {ls, rm, create-kv, create-cron, create-dead-letter,
  create-from-json}: three per-kind wrappers cover the most common
  trigger shapes; the generic create-from-json is the escape hatch
  for docs/files/pubsub/email/queue and any future advanced retry
  knobs — body JSON inline, via @<file>, or "-" for stdin.

- pic dead-letters {ls, show, replay, resolve}: full operator
  workflow for the dispatcher's dead_letters rows, including the
  --unresolved filter and the per-row replay + manual-resolve actions.

- pic secrets {ls, set, rm}: list names + updated_at, set values
  via stdin (the only secure channel — inline values would leak
  into shell history), and delete by name. --json on set treats
  stdin as raw JSON for non-string values.

Ten new integration tests follow the established #[ignore] pattern,
gated on DATABASE_URL. All 73 ignored tests pass against the local
dev stack.

The `pic admin reset-password` server-binary subcommand exists on
the picloud binary side already; the audit's "surface it in pic
--help" note is a one-line addition deferred to Stage 6 with the
other small UX touches.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
MechaCat02
2026-06-10 21:41:57 +02:00
parent 59645e8159
commit 24490d5ddb
10 changed files with 1215 additions and 0 deletions

View File

@@ -357,6 +357,128 @@ impl Client {
.await?;
decode_status(resp).await
}
/// `GET /api/v1/admin/apps/{id}/triggers`
pub async fn triggers_list(&self, app: &str) -> Result<TriggerListDto> {
let resp = self
.request(Method::GET, &format!("/api/v1/admin/apps/{app}/triggers"))
.send()
.await?;
decode(resp).await
}
/// `DELETE /api/v1/admin/apps/{id}/triggers/{trigger_id}`
pub async fn triggers_delete(&self, app: &str, trigger_id: &str) -> Result<()> {
let resp = self
.request(
Method::DELETE,
&format!("/api/v1/admin/apps/{app}/triggers/{trigger_id}"),
)
.send()
.await?;
decode_status(resp).await
}
/// `POST /api/v1/admin/apps/{id}/triggers/{kind}` — the body shape
/// depends on `kind`; the CLI passes a pre-built JSON value so
/// each create subcommand can construct its own per-kind body.
pub async fn triggers_create(
&self,
app: &str,
kind: &str,
body: &serde_json::Value,
) -> Result<TriggerDto> {
let resp = self
.request(
Method::POST,
&format!("/api/v1/admin/apps/{app}/triggers/{kind}"),
)
.json(body)
.send()
.await?;
decode(resp).await
}
/// `GET /api/v1/admin/apps/{id}/dead_letters?unresolved={bool}&limit={n}`
pub async fn dead_letters_list(
&self,
app: &str,
unresolved: bool,
limit: u32,
) -> Result<DeadLetterListDto> {
let path =
format!("/api/v1/admin/apps/{app}/dead_letters?unresolved={unresolved}&limit={limit}");
let resp = self.request(Method::GET, &path).send().await?;
decode(resp).await
}
/// `GET /api/v1/admin/apps/{id}/dead_letters/{dl_id}`
pub async fn dead_letters_get(&self, app: &str, dl_id: &str) -> Result<DeadLetterDto> {
let resp = self
.request(
Method::GET,
&format!("/api/v1/admin/apps/{app}/dead_letters/{dl_id}"),
)
.send()
.await?;
decode(resp).await
}
/// `POST /api/v1/admin/apps/{id}/dead_letters/{dl_id}/replay`
pub async fn dead_letters_replay(&self, app: &str, dl_id: &str) -> Result<()> {
let resp = self
.request(
Method::POST,
&format!("/api/v1/admin/apps/{app}/dead_letters/{dl_id}/replay"),
)
.send()
.await?;
decode_status(resp).await
}
/// `POST /api/v1/admin/apps/{id}/dead_letters/{dl_id}/resolve`
pub async fn dead_letters_resolve(&self, app: &str, dl_id: &str, reason: &str) -> Result<()> {
let resp = self
.request(
Method::POST,
&format!("/api/v1/admin/apps/{app}/dead_letters/{dl_id}/resolve"),
)
.json(&serde_json::json!({ "reason": reason }))
.send()
.await?;
decode_status(resp).await
}
/// `GET /api/v1/admin/apps/{id}/secrets`
pub async fn secrets_list(&self, app: &str) -> Result<SecretListDto> {
let resp = self
.request(Method::GET, &format!("/api/v1/admin/apps/{app}/secrets"))
.send()
.await?;
decode(resp).await
}
/// `POST /api/v1/admin/apps/{id}/secrets`
pub async fn secrets_set(&self, app: &str, name: &str, value: serde_json::Value) -> Result<()> {
let resp = self
.request(Method::POST, &format!("/api/v1/admin/apps/{app}/secrets"))
.json(&serde_json::json!({ "name": name, "value": value }))
.send()
.await?;
decode_status(resp).await
}
/// `DELETE /api/v1/admin/apps/{id}/secrets/{name}`
pub async fn secrets_delete(&self, app: &str, name: &str) -> Result<()> {
let resp = self
.request(
Method::DELETE,
&format!("/api/v1/admin/apps/{app}/secrets/{name}"),
)
.send()
.await?;
decode_status(resp).await
}
}
/// `POST /api/v1/admin/auth/login` — sits outside the `Client` because
@@ -505,6 +627,64 @@ pub struct AdminDto {
pub last_login_at: Option<DateTime<Utc>>,
}
#[derive(Debug, Deserialize)]
pub struct TriggerListDto {
pub triggers: Vec<TriggerDto>,
}
#[allow(dead_code)]
#[derive(Debug, Deserialize)]
pub struct TriggerDto {
pub id: String,
pub app_id: AppId,
pub script_id: ScriptId,
pub kind: String,
pub enabled: bool,
pub dispatch_mode: String,
pub retry_max_attempts: u32,
pub created_at: DateTime<Utc>,
#[serde(default)]
pub details: Value,
}
#[derive(Debug, Deserialize)]
pub struct DeadLetterListDto {
pub dead_letters: Vec<DeadLetterDto>,
}
#[allow(dead_code)]
#[derive(Debug, Deserialize)]
pub struct DeadLetterDto {
pub id: String,
pub app_id: AppId,
pub source: String,
pub op: String,
pub trigger_id: Option<String>,
pub script_id: Option<ScriptId>,
pub payload: Value,
pub attempt_count: u32,
pub first_attempt_at: DateTime<Utc>,
pub last_attempt_at: DateTime<Utc>,
pub last_error: String,
pub created_at: DateTime<Utc>,
pub resolved_at: Option<DateTime<Utc>>,
pub resolution: Option<String>,
}
#[derive(Debug, Deserialize)]
pub struct SecretListDto {
pub secrets: Vec<SecretItemDto>,
#[serde(default)]
#[allow(dead_code)]
pub next_cursor: Option<String>,
}
#[derive(Debug, Deserialize)]
pub struct SecretItemDto {
pub name: String,
pub updated_at: DateTime<Utc>,
}
#[derive(Debug, Serialize)]
pub struct CreateScriptBody<'a> {
pub app_id: AppId,

View File

@@ -0,0 +1,95 @@
//! `pic dead-letters` subcommands: `ls`, `show`, `replay`, `resolve`.
use anyhow::Result;
use crate::client::Client;
use crate::config;
use crate::output::{KvBlock, OutputMode, Table};
pub async fn ls(app: &str, unresolved: bool, limit: u32, mode: OutputMode) -> Result<()> {
let creds = config::resolve()?;
let client = Client::from_creds(&creds)?;
let resp = client.dead_letters_list(app, unresolved, limit).await?;
let mut table = Table::new([
"id",
"source",
"op",
"attempts",
"resolved",
"last_error",
"created_at",
]);
for d in resp.dead_letters {
let last_err = truncate(&d.last_error, 60);
let resolved = d.resolution.unwrap_or_else(|| "-".into());
table.row([
d.id,
d.source,
d.op,
d.attempt_count.to_string(),
resolved,
last_err,
d.created_at.to_rfc3339(),
]);
}
table.print(mode);
Ok(())
}
pub async fn show(app: &str, dl_id: &str, mode: OutputMode) -> Result<()> {
let creds = config::resolve()?;
let client = Client::from_creds(&creds)?;
let d = client.dead_letters_get(app, dl_id).await?;
let mut block = KvBlock::new();
block
.field("id", d.id)
.field("source", d.source)
.field("op", d.op)
.field("trigger_id", d.trigger_id.unwrap_or_else(|| "-".into()))
.field(
"script_id",
d.script_id
.map(|s| s.to_string())
.unwrap_or_else(|| "-".into()),
)
.field("attempt_count", d.attempt_count.to_string())
.field("first_attempt_at", d.first_attempt_at.to_rfc3339())
.field("last_attempt_at", d.last_attempt_at.to_rfc3339())
.field("last_error", d.last_error)
.field("created_at", d.created_at.to_rfc3339())
.field(
"resolved_at",
d.resolved_at
.map(|t| t.to_rfc3339())
.unwrap_or_else(|| "-".into()),
)
.field("resolution", d.resolution.unwrap_or_else(|| "-".into()))
.field("payload", d.payload.to_string());
block.print(mode);
Ok(())
}
pub async fn replay(app: &str, dl_id: &str) -> Result<()> {
let creds = config::resolve()?;
let client = Client::from_creds(&creds)?;
client.dead_letters_replay(app, dl_id).await?;
println!("Replayed dead-letter {dl_id}");
Ok(())
}
pub async fn resolve(app: &str, dl_id: &str, reason: &str) -> Result<()> {
let creds = config::resolve()?;
let client = Client::from_creds(&creds)?;
client.dead_letters_resolve(app, dl_id, reason).await?;
println!("Resolved dead-letter {dl_id}: {reason}");
Ok(())
}
fn truncate(s: &str, max: usize) -> String {
if s.chars().count() <= max {
return s.to_string();
}
let mut out: String = s.chars().take(max.saturating_sub(1)).collect();
out.push('…');
out
}

View File

@@ -1,9 +1,12 @@
pub mod admins;
pub mod api_keys;
pub mod apps;
pub mod dead_letters;
pub mod login;
pub mod logout;
pub mod logs;
pub mod routes;
pub mod scripts;
pub mod secrets;
pub mod triggers;
pub mod whoami;

View File

@@ -0,0 +1,55 @@
//! `pic secrets` subcommands: `ls`, `set`, `rm`.
//!
//! Set reads the secret value from stdin (the only safe channel —
//! inline values would leak into shell history). The value is sent
//! as a JSON string; pass `--json` to interpret stdin as raw JSON
//! (numbers, maps, …) instead.
use std::io::Read;
use anyhow::{anyhow, Context, Result};
use crate::client::Client;
use crate::config;
use crate::output::{OutputMode, Table};
pub async fn ls(app: &str, mode: OutputMode) -> Result<()> {
let creds = config::resolve()?;
let client = Client::from_creds(&creds)?;
let resp = client.secrets_list(app).await?;
let mut table = Table::new(["name", "updated_at"]);
for s in resp.secrets {
table.row([s.name, s.updated_at.to_rfc3339()]);
}
table.print(mode);
Ok(())
}
pub async fn set(app: &str, name: &str, as_json: bool) -> Result<()> {
let creds = config::resolve()?;
let client = Client::from_creds(&creds)?;
let mut buf = String::new();
std::io::stdin()
.read_to_string(&mut buf)
.context("read secret value from stdin")?;
let trimmed = buf.trim_end_matches(['\n', '\r']);
if trimmed.is_empty() {
return Err(anyhow!("empty stdin — secret value must not be empty"));
}
let value = if as_json {
serde_json::from_str(trimmed).map_err(|e| anyhow!("parse stdin as JSON: {e}"))?
} else {
serde_json::Value::String(trimmed.to_string())
};
client.secrets_set(app, name, value).await?;
println!("Set secret {name}");
Ok(())
}
pub async fn rm(app: &str, name: &str) -> Result<()> {
let creds = config::resolve()?;
let client = Client::from_creds(&creds)?;
client.secrets_delete(app, name).await?;
println!("Deleted secret {name}");
Ok(())
}

View File

@@ -0,0 +1,158 @@
//! `pic triggers` subcommands.
//!
//! Three per-kind create helpers cover the most common trigger shapes
//! (KV, cron, dead_letter). For docs/files/pubsub/email/queue the
//! generic `create-from-json` accepts a raw JSON body so headless
//! operators don't get blocked waiting for per-kind wrappers.
use anyhow::{anyhow, Context, Result};
use serde_json::json;
use crate::client::Client;
use crate::config;
use crate::output::{KvBlock, OutputMode, Table};
pub async fn ls(app: &str, mode: OutputMode) -> Result<()> {
let creds = config::resolve()?;
let client = Client::from_creds(&creds)?;
let resp = client.triggers_list(app).await?;
let mut table = Table::new([
"id",
"kind",
"script_id",
"enabled",
"dispatch",
"retry_max",
"created_at",
]);
for t in resp.triggers {
table.row([
t.id,
t.kind,
t.script_id.to_string(),
t.enabled.to_string(),
t.dispatch_mode,
t.retry_max_attempts.to_string(),
t.created_at.to_rfc3339(),
]);
}
table.print(mode);
Ok(())
}
pub async fn rm(app: &str, trigger_id: &str) -> Result<()> {
let creds = config::resolve()?;
let client = Client::from_creds(&creds)?;
client.triggers_delete(app, trigger_id).await?;
println!("Deleted trigger {trigger_id}");
Ok(())
}
/// Common create body shape — every kind shares `script_id`,
/// `dispatch_mode`, and the retry knobs. Per-kind fields layer on
/// top via `serde_json::json!`.
fn base_body(script_id: &str, dispatch: &str) -> serde_json::Value {
json!({
"script_id": script_id,
"dispatch_mode": dispatch,
})
}
pub async fn create_kv(
app: &str,
script_id: &str,
collection_glob: &str,
ops: &[String],
dispatch: &str,
mode: OutputMode,
) -> Result<()> {
let creds = config::resolve()?;
let client = Client::from_creds(&creds)?;
let mut body = base_body(script_id, dispatch);
body["collection_glob"] = json!(collection_glob);
if !ops.is_empty() {
body["ops"] = json!(ops);
}
let created = client.triggers_create(app, "kv", &body).await?;
print_created(&created, mode);
Ok(())
}
pub async fn create_cron(
app: &str,
script_id: &str,
schedule: &str,
timezone: Option<&str>,
dispatch: &str,
mode: OutputMode,
) -> Result<()> {
let creds = config::resolve()?;
let client = Client::from_creds(&creds)?;
let mut body = base_body(script_id, dispatch);
body["schedule"] = json!(schedule);
if let Some(tz) = timezone {
body["timezone"] = json!(tz);
}
let created = client.triggers_create(app, "cron", &body).await?;
print_created(&created, mode);
Ok(())
}
pub async fn create_dead_letter(
app: &str,
script_id: &str,
source_filter: Option<&str>,
trigger_id_filter: Option<&str>,
script_id_filter: Option<&str>,
dispatch: &str,
mode: OutputMode,
) -> Result<()> {
let creds = config::resolve()?;
let client = Client::from_creds(&creds)?;
let mut body = base_body(script_id, dispatch);
if let Some(s) = source_filter {
body["source_filter"] = json!(s);
}
if let Some(t) = trigger_id_filter {
body["trigger_id_filter"] = json!(t);
}
if let Some(s) = script_id_filter {
body["script_id_filter"] = json!(s);
}
let created = client.triggers_create(app, "dead_letter", &body).await?;
print_created(&created, mode);
Ok(())
}
pub async fn create_from_json(app: &str, kind: &str, body: &str, mode: OutputMode) -> Result<()> {
let creds = config::resolve()?;
let client = Client::from_creds(&creds)?;
let body_json: serde_json::Value = if body == "-" {
let mut s = String::new();
std::io::Read::read_to_string(&mut std::io::stdin(), &mut s)
.context("read body JSON from stdin")?;
serde_json::from_str(&s).map_err(|e| anyhow!("parse JSON from stdin: {e}"))?
} else if let Some(path) = body.strip_prefix('@') {
let raw =
std::fs::read_to_string(path).with_context(|| format!("read JSON body from {path}"))?;
serde_json::from_str(&raw).map_err(|e| anyhow!("parse JSON body in {path}: {e}"))?
} else {
serde_json::from_str(body).map_err(|e| anyhow!("parse inline JSON body: {e}"))?
};
let created = client.triggers_create(app, kind, &body_json).await?;
print_created(&created, mode);
Ok(())
}
fn print_created(t: &crate::client::TriggerDto, mode: OutputMode) {
let mut block = KvBlock::new();
block
.field("id", t.id.clone())
.field("kind", t.kind.clone())
.field("script_id", t.script_id.to_string())
.field("enabled", t.enabled.to_string())
.field("dispatch_mode", t.dispatch_mode.clone())
.field("retry_max_attempts", t.retry_max_attempts.to_string())
.field("created_at", t.created_at.to_rfc3339());
block.print(mode);
}

View File

@@ -84,6 +84,32 @@ enum Cmd {
#[command(subcommand)]
cmd: AdminsCmd,
},
/// Trigger management — list / create / delete the triggers that
/// fire scripts on KV mutations, cron schedules, dead-letter rows,
/// etc. `create-from-json` is the escape hatch for kinds the CLI
/// doesn't expose a per-kind wrapper for (docs/files/pubsub/email/
/// queue) — pass the body JSON inline, via `@<file>`, or `-` to
/// read from stdin.
Triggers {
#[command(subcommand)]
cmd: TriggersCmd,
},
/// Dead-letter management — inspect, replay, and resolve rows the
/// dispatcher wrote after exhausting a trigger's retries.
#[command(name = "dead-letters")]
DeadLetters {
#[command(subcommand)]
cmd: DeadLettersCmd,
},
/// Per-app secret storage — list names, set values from stdin,
/// delete by name. Values never leave the server after `set`.
Secrets {
#[command(subcommand)]
cmd: SecretsCmd,
},
}
#[derive(Args)]
@@ -214,6 +240,15 @@ impl From<DispatchModeArg> for picloud_shared::DispatchMode {
}
}
/// Wire form for trigger dispatch — the trigger handlers accept
/// `"sync"` / `"async"` as JSON strings, so we send that directly.
const fn dispatch_wire(d: DispatchModeArg) -> &'static str {
match d {
DispatchModeArg::Sync => "sync",
DispatchModeArg::Async => "async",
}
}
#[derive(Clone, Copy, ValueEnum)]
enum HostKindArg {
/// Any host (default).
@@ -338,6 +373,167 @@ enum RoutesCmd {
},
}
#[derive(Subcommand)]
enum TriggersCmd {
/// List every trigger in an app.
Ls {
#[arg(long)]
app: String,
},
/// Delete a trigger by id.
Rm {
#[arg(long)]
app: String,
trigger_id: String,
},
/// Create a KV trigger.
#[command(name = "create-kv")]
CreateKv {
#[arg(long)]
app: String,
#[arg(long)]
script: String,
/// Glob over collection names (`*`, `users`, `events_*`, …).
#[arg(long)]
collection: String,
/// Repeat to filter ops: `--op insert --op delete`. Empty
/// (the default) means any op fires the trigger.
#[arg(long = "op")]
ops: Vec<String>,
#[arg(long, value_enum, default_value_t = DispatchModeArg::Async)]
dispatch: DispatchModeArg,
},
/// Create a cron trigger.
#[command(name = "create-cron")]
CreateCron {
#[arg(long)]
app: String,
#[arg(long)]
script: String,
/// 6-field cron expression (with seconds).
#[arg(long)]
schedule: String,
/// IANA timezone name. Defaults to UTC.
#[arg(long)]
timezone: Option<String>,
#[arg(long, value_enum, default_value_t = DispatchModeArg::Async)]
dispatch: DispatchModeArg,
},
/// Create a dead-letter trigger — fires when ANOTHER trigger's
/// retries exhaust. Filters narrow the match: omit to fire on
/// every DL in the app.
#[command(name = "create-dead-letter")]
CreateDeadLetter {
#[arg(long)]
app: String,
#[arg(long)]
script: String,
/// Source filter — match only DL rows that originated from
/// `kv` / `docs` / `queue` / etc.
#[arg(long = "source-filter")]
source_filter: Option<String>,
/// Trigger id filter — match only DL rows from one trigger.
#[arg(long = "trigger-id-filter")]
trigger_id_filter: Option<String>,
/// Script id filter — match only DL rows from one script.
#[arg(long = "script-id-filter")]
script_id_filter: Option<String>,
#[arg(long, value_enum, default_value_t = DispatchModeArg::Async)]
dispatch: DispatchModeArg,
},
/// Create a trigger of any kind from a raw JSON body — escape
/// hatch for kinds the CLI doesn't expose per-kind wrappers for
/// (docs/files/pubsub/email/queue) and for advanced retry/dispatch
/// settings beyond the per-kind defaults.
#[command(name = "create-from-json")]
CreateFromJson {
#[arg(long)]
app: String,
/// Trigger kind: `kv`, `docs`, `cron`, `files`, `pubsub`,
/// `dead_letter`, `email`, or `queue`.
#[arg(long)]
kind: String,
/// Body JSON. Pass inline, `@<file>`, or `-` for stdin.
#[arg(long)]
body: String,
},
}
#[derive(Subcommand)]
enum DeadLettersCmd {
/// List dead-letter rows for an app.
Ls {
#[arg(long)]
app: String,
/// Show only unresolved rows.
#[arg(long)]
unresolved: bool,
#[arg(long, default_value_t = 50)]
limit: u32,
},
/// Show a single dead-letter row's full payload.
Show {
#[arg(long)]
app: String,
dl_id: String,
},
/// Re-enqueue the original event so the trigger fires again. The
/// DL row is marked resolved with reason `replayed`.
Replay {
#[arg(long)]
app: String,
dl_id: String,
},
/// Mark a DL row resolved without replaying. Useful for permanent
/// failures the operator has already addressed manually.
Resolve {
#[arg(long)]
app: String,
dl_id: String,
/// Free-form resolution reason. Required by the server.
#[arg(long)]
reason: String,
},
}
#[derive(Subcommand)]
enum SecretsCmd {
/// List secret names + last-modified for an app. Values never
/// leave the server.
Ls {
#[arg(long)]
app: String,
},
/// Set a secret. Reads the value from stdin (the only safe
/// channel — inline values would land in shell history). Pipe
/// the value in: `echo -n "mysecret" | pic secrets set --app foo my_key`.
Set {
#[arg(long)]
app: String,
name: String,
/// Treat stdin as raw JSON (numbers, maps, …) instead of a
/// string literal.
#[arg(long)]
json: bool,
},
/// Delete a secret by name.
Rm {
#[arg(long)]
app: String,
name: String,
},
}
#[derive(Subcommand)]
enum AdminsCmd {
/// List admin accounts.
@@ -555,6 +751,103 @@ async fn main() -> ExitCode {
Cmd::Admins {
cmd: AdminsCmd::Rm { id },
} => cmds::admins::rm(&id).await,
Cmd::Triggers {
cmd: TriggersCmd::Ls { app },
} => cmds::triggers::ls(&app, mode).await,
Cmd::Triggers {
cmd: TriggersCmd::Rm { app, trigger_id },
} => cmds::triggers::rm(&app, &trigger_id).await,
Cmd::Triggers {
cmd:
TriggersCmd::CreateKv {
app,
script,
collection,
ops,
dispatch,
},
} => {
cmds::triggers::create_kv(
&app,
&script,
&collection,
&ops,
dispatch_wire(dispatch),
mode,
)
.await
}
Cmd::Triggers {
cmd:
TriggersCmd::CreateCron {
app,
script,
schedule,
timezone,
dispatch,
},
} => {
cmds::triggers::create_cron(
&app,
&script,
&schedule,
timezone.as_deref(),
dispatch_wire(dispatch),
mode,
)
.await
}
Cmd::Triggers {
cmd:
TriggersCmd::CreateDeadLetter {
app,
script,
source_filter,
trigger_id_filter,
script_id_filter,
dispatch,
},
} => {
cmds::triggers::create_dead_letter(
&app,
&script,
source_filter.as_deref(),
trigger_id_filter.as_deref(),
script_id_filter.as_deref(),
dispatch_wire(dispatch),
mode,
)
.await
}
Cmd::Triggers {
cmd: TriggersCmd::CreateFromJson { app, kind, body },
} => cmds::triggers::create_from_json(&app, &kind, &body, mode).await,
Cmd::DeadLetters {
cmd:
DeadLettersCmd::Ls {
app,
unresolved,
limit,
},
} => cmds::dead_letters::ls(&app, unresolved, limit, mode).await,
Cmd::DeadLetters {
cmd: DeadLettersCmd::Show { app, dl_id },
} => cmds::dead_letters::show(&app, &dl_id, mode).await,
Cmd::DeadLetters {
cmd: DeadLettersCmd::Replay { app, dl_id },
} => cmds::dead_letters::replay(&app, &dl_id).await,
Cmd::DeadLetters {
cmd: DeadLettersCmd::Resolve { app, dl_id, reason },
} => cmds::dead_letters::resolve(&app, &dl_id, &reason).await,
Cmd::Secrets {
cmd: SecretsCmd::Ls { app },
} => cmds::secrets::ls(&app, mode).await,
Cmd::Secrets {
cmd: SecretsCmd::Set { app, name, json },
} => cmds::secrets::set(&app, &name, json).await,
Cmd::Secrets {
cmd: SecretsCmd::Rm { app, name },
} => cmds::secrets::rm(&app, &name).await,
};
match result {