heddle_cli_args/cli/cli_args/
commands_review.rs1use clap::{Args, Subcommand, ValueEnum};
5
6use super::RemoteChoiceArgs;
7
8#[derive(Clone, Debug, Subcommand)]
9pub enum ReviewCommands {
10 Show(ReviewShowArgs),
12 #[command(
14 about = "Approve the exact source and target comparison shown for this thread, using your configured signing identity."
15 )]
16 Approve(ReviewApproveArgs),
17 List(ReviewListArgs),
19 Revoke(ReviewRevokeArgs),
21 Readiness(ReviewReadinessArgs),
23 #[command(hide = true)]
25 Sign(ReviewSignArgs),
26 #[command(hide = true)]
28 Next(ReviewNextArgs),
29 #[command(hide = true)]
31 Health(ReviewHealthArgs),
32}
33
34#[derive(Clone, Debug, Args)]
35pub struct ReviewShowArgs {
36 pub thread: Option<String>,
38 #[command(flatten)]
39 pub remote_choice: RemoteChoiceArgs,
40}
41
42#[derive(Clone, Debug, Args)]
43pub struct ReviewApproveArgs {
44 pub thread: Option<String>,
46 #[arg(short = 'm', long)]
48 pub message: Option<String>,
49 #[command(flatten)]
50 pub remote_choice: RemoteChoiceArgs,
51}
52
53#[derive(Clone, Debug, Args)]
54pub struct ReviewListArgs {
55 pub thread: Option<String>,
57 #[command(flatten)]
58 pub remote_choice: RemoteChoiceArgs,
59}
60
61#[derive(Clone, Debug, Args)]
62pub struct ReviewRevokeArgs {
63 #[arg(value_name = "REVIEW_ID")]
65 pub review_id: String,
66 #[arg(long, value_name = "THREAD")]
68 pub thread: String,
69 #[command(flatten)]
70 pub remote_choice: RemoteChoiceArgs,
71}
72
73#[derive(Clone, Debug, Args)]
74pub struct ReviewReadinessArgs {
75 pub thread: Option<String>,
77 #[arg(long, value_name = "TARGET")]
79 pub into: String,
80 #[command(flatten)]
81 pub remote_choice: RemoteChoiceArgs,
82}
83
84#[derive(Clone, Debug, Args)]
85pub struct ReviewSignArgs {
86 pub state: String,
87 #[arg(long, value_enum)]
89 pub kind: SignKindArg,
90 #[arg(long)]
92 pub justification: Option<String>,
93 #[arg(long)]
96 pub symbols: Vec<String>,
97 #[arg(long, default_value = "ed25519")]
99 pub algorithm: String,
100 #[arg(long)]
102 pub public_key: String,
103 #[arg(long)]
105 pub signature: String,
106 #[arg(long)]
110 pub signed_at_unix: i64,
111}
112
113#[derive(Clone, Debug, ValueEnum)]
114pub enum SignKindArg {
115 Read,
116 AgentPreview,
117 AgentCoReview,
118}
119
120impl SignKindArg {
121 pub fn as_wire(&self) -> &'static str {
122 match self {
123 Self::Read => "read",
124 Self::AgentPreview => "agent_preview",
125 Self::AgentCoReview => "agent_co_review",
126 }
127 }
128
129 pub fn as_proto(&self) -> objects::object::ReviewKind {
130 match self {
131 Self::Read => objects::object::ReviewKind::Read,
132 Self::AgentPreview => objects::object::ReviewKind::AgentPreview,
133 Self::AgentCoReview => objects::object::ReviewKind::AgentCoReview,
134 }
135 }
136}
137
138#[derive(Clone, Debug, Args)]
139pub struct ReviewNextArgs {
140 #[arg(long)]
142 pub mine_only: bool,
143 #[arg(long)]
145 pub kind: Option<String>,
146}
147
148#[derive(Clone, Debug, Args)]
149pub struct ReviewHealthArgs {
150 #[arg(long)]
153 pub window: Option<u32>,
154}