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
// SPDX-License-Identifier: Apache-2.0
//! `heddle discuss` — anchored discussions on symbols.
use clap::{Args, Subcommand};
#[derive(Clone, Debug, Subcommand)]
pub enum DiscussCommands {
/// Open a new discussion anchored to a symbol.
Open(DiscussOpenArgs),
/// Append a turn to an existing discussion.
Append(DiscussAppendArgs),
/// Resolve a discussion (into-annotation, by-edit, or dismissed).
Resolve(DiscussResolveArgs),
/// List discussions on a state, symbol, or by status.
List(DiscussListArgs),
/// Show a single discussion.
Show(DiscussShowArgs),
}
#[derive(Clone, Debug, Args)]
pub struct DiscussOpenArgs {
/// Path of the file containing the symbol.
pub file: String,
/// Symbol name (e.g. `Repository::open`).
pub symbol: String,
/// First turn of the discussion.
pub body: String,
/// State the discussion anchors against. Defaults to HEAD.
#[arg(long)]
pub state: Option<String>,
/// Visibility: `public` | `internal` | `team:NAME` | `restricted:LABEL`.
#[arg(long)]
pub visibility: Option<String>,
/// Optional thread reference for grouping.
#[arg(long)]
pub thread: Option<String>,
}
#[derive(Clone, Debug, Args)]
pub struct DiscussAppendArgs {
pub discussion_id: String,
pub body: String,
}
#[derive(Clone, Debug, Args)]
pub struct DiscussResolveArgs {
pub discussion_id: String,
/// Resolution kind: `into-annotation` | `by-edit` | `dismiss`.
#[arg(long, value_enum)]
pub mode: ResolveModeArg,
/// For `into-annotation`: annotation kind (`constraint`|`invariant`|`rationale`).
#[arg(long)]
pub annotation_kind: Option<String>,
/// For `into-annotation`: annotation content.
#[arg(long)]
pub annotation_content: Option<String>,
/// For `into-annotation`: optional comma-separated tags.
#[arg(long)]
pub annotation_tags: Option<String>,
/// For `by-edit`: state the edit lives on (defaults to HEAD).
#[arg(long)]
pub state: Option<String>,
/// For `dismiss`: reason (required).
#[arg(long)]
pub reason: Option<String>,
}
#[derive(Clone, Debug, clap::ValueEnum)]
pub enum ResolveModeArg {
IntoAnnotation,
ByEdit,
Dismiss,
}
#[derive(Clone, Debug, Args)]
pub struct DiscussListArgs {
/// Filter by state. When omitted, lists discussions on HEAD.
#[arg(long)]
pub state: Option<String>,
/// Filter by file path.
#[arg(long)]
pub file: Option<String>,
/// Filter by symbol name.
#[arg(long)]
pub symbol: Option<String>,
/// Status filter: `open`|`resolved`|`all`|`orphaned`. Default `all`.
#[arg(long, default_value = "all")]
pub status: String,
}
#[derive(Clone, Debug, Args)]
pub struct DiscussShowArgs {
pub discussion_id: String,
}