1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
// SPDX-License-Identifier: Apache-2.0
//! `heddle review` — signed Thread comparison review workflow.
use clap::{Args, Subcommand, ValueEnum};
use super::RemoteChoiceArgs;
#[derive(Clone, Debug, Subcommand)]
pub enum ReviewCommands {
/// Show the exact source and target comparison for a Thread.
Show(ReviewShowArgs),
/// Approve the exact source and target comparison shown for this thread, using your configured signing identity.
#[command(
about = "Approve the exact source and target comparison shown for this thread, using your configured signing identity."
)]
Approve(ReviewApproveArgs),
/// List signed review decisions for a Thread.
List(ReviewListArgs),
/// Revoke one of your signed approvals.
Revoke(ReviewRevokeArgs),
/// Check whether a Thread's exact comparison is ready to land into a target.
Readiness(ReviewReadinessArgs),
/// Submit a low-level review signature on a state.
#[command(hide = true)]
Sign(ReviewSignArgs),
/// Walk to the next pending review when review selection is configured.
#[command(hide = true)]
Next(ReviewNextArgs),
/// Per-module signal health over a rolling window.
#[command(hide = true)]
Health(ReviewHealthArgs),
}
#[derive(Clone, Debug, Args)]
pub struct ReviewShowArgs {
/// Thread to review. Defaults to the current Thread.
pub thread: Option<String>,
#[command(flatten)]
pub remote_choice: RemoteChoiceArgs,
}
#[derive(Clone, Debug, Args)]
pub struct ReviewApproveArgs {
/// Thread to approve. Defaults to the current Thread.
pub thread: Option<String>,
/// Human note attached to the approval.
#[arg(short = 'm', long)]
pub message: Option<String>,
#[command(flatten)]
pub remote_choice: RemoteChoiceArgs,
}
#[derive(Clone, Debug, Args)]
pub struct ReviewListArgs {
/// Thread whose review decisions to list. Defaults to the current Thread.
pub thread: Option<String>,
#[command(flatten)]
pub remote_choice: RemoteChoiceArgs,
}
#[derive(Clone, Debug, Args)]
pub struct ReviewRevokeArgs {
/// UUID of the approval to revoke.
#[arg(value_name = "REVIEW_ID")]
pub review_id: String,
/// Thread containing the approval.
#[arg(long, value_name = "THREAD")]
pub thread: String,
#[command(flatten)]
pub remote_choice: RemoteChoiceArgs,
}
#[derive(Clone, Debug, Args)]
pub struct ReviewReadinessArgs {
/// Source Thread to assess. Defaults to the current Thread.
pub thread: Option<String>,
/// Target Thread that would receive the source.
#[arg(long, value_name = "TARGET")]
pub into: String,
#[command(flatten)]
pub remote_choice: RemoteChoiceArgs,
}
#[derive(Clone, Debug, Args)]
pub struct ReviewSignArgs {
pub state: String,
/// Review kind.
#[arg(long, value_enum)]
pub kind: SignKindArg,
/// Optional justification (unused for read/preview/co-review).
#[arg(long)]
pub justification: Option<String>,
/// Optional symbol-level scope. Format: `file:symbol`. Repeat for
/// multiple. Without any, the signature covers the whole change.
#[arg(long)]
pub symbols: Vec<String>,
/// Cryptographic algorithm. Defaults to `ed25519`.
#[arg(long, default_value = "ed25519")]
pub algorithm: String,
/// Public key in hex. Required.
#[arg(long)]
pub public_key: String,
/// Signature bytes in hex. Required.
#[arg(long)]
pub signature: String,
/// Unix timestamp (seconds) the client signed at. Required — the
/// server verifies the signature over this exact timestamp and rejects
/// values outside a small skew window.
#[arg(long)]
pub signed_at_unix: i64,
}
#[derive(Clone, Debug, ValueEnum)]
pub enum SignKindArg {
Read,
AgentPreview,
AgentCoReview,
}
impl SignKindArg {
pub fn as_wire(&self) -> &'static str {
match self {
Self::Read => "read",
Self::AgentPreview => "agent_preview",
Self::AgentCoReview => "agent_co_review",
}
}
pub fn as_proto(&self) -> objects::object::ReviewKind {
match self {
Self::Read => objects::object::ReviewKind::Read,
Self::AgentPreview => objects::object::ReviewKind::AgentPreview,
Self::AgentCoReview => objects::object::ReviewKind::AgentCoReview,
}
}
}
#[derive(Clone, Debug, Args)]
pub struct ReviewNextArgs {
/// Only show reviews assigned to the current actor.
#[arg(long)]
pub mine_only: bool,
/// Filter by review kind.
#[arg(long)]
pub kind: Option<String>,
}
#[derive(Clone, Debug, Args)]
pub struct ReviewHealthArgs {
/// Number of recent states to consider. Server clamps to a sensible
/// default when unset.
#[arg(long)]
pub window: Option<u32>,
}