Skip to main content

heddle_cli_args/cli/cli_args/
commands_discuss.rs

1// SPDX-License-Identifier: Apache-2.0
2//! `heddle discuss` — durable repository collaboration.
3
4use clap::{Args, Subcommand};
5
6#[derive(Clone, Debug, Subcommand)]
7pub enum DiscussCommands {
8    /// Open a discussion anchored to a symbol.
9    Open(DiscussOpenArgs),
10    /// Append a durable turn to a discussion.
11    Append(DiscussAppendArgs),
12    /// Resolve a discussion.
13    Resolve(DiscussResolveArgs),
14    /// Reopen a resolved discussion.
15    Reopen(DiscussReopenArgs),
16    /// List repository discussions.
17    List(DiscussListArgs),
18    /// Show one discussion and its causal heads.
19    Show(DiscussShowArgs),
20}
21
22#[derive(Clone, Debug, Args)]
23pub struct DiscussOpenArgs {
24    /// Path of the file containing the symbol.
25    pub file: String,
26    /// Symbol name (for example `Repository::open`).
27    pub symbol: String,
28    /// First turn of the discussion.
29    pub body: String,
30    /// Human-readable summary. Defaults to the first line of the first turn.
31    #[arg(long)]
32    pub title: Option<String>,
33    /// State the symbol anchor was observed against. Defaults to HEAD.
34    #[arg(long)]
35    pub state: Option<String>,
36    /// Visibility: `public` | `internal` | `team:NAME` | `restricted:LABEL` | `private:LABEL`.
37    #[arg(long)]
38    pub visibility: Option<String>,
39}
40
41#[derive(Clone, Debug, Args)]
42pub struct DiscussAppendArgs {
43    pub discussion_id: String,
44    pub body: String,
45}
46
47#[derive(Clone, Debug, Args)]
48pub struct DiscussResolveArgs {
49    pub discussion_id: String,
50    /// Resolution kind: `by-edit` or `dismiss`.
51    #[arg(long, value_enum)]
52    pub mode: ResolveModeArg,
53    /// For `by-edit`: state containing the edit (defaults to HEAD).
54    #[arg(long)]
55    pub state: Option<String>,
56    /// For `dismiss`: non-empty reason.
57    #[arg(long)]
58    pub reason: Option<String>,
59}
60
61#[derive(Clone, Debug, clap::ValueEnum)]
62pub enum ResolveModeArg {
63    ByEdit,
64    Dismiss,
65}
66
67#[derive(Clone, Debug, Args)]
68pub struct DiscussReopenArgs {
69    pub discussion_id: String,
70    /// Why the prior resolution no longer applies.
71    #[arg(long)]
72    pub reason: String,
73}
74
75#[derive(Clone, Debug, Args)]
76pub struct DiscussListArgs {
77    /// Filter by the state named in the discussion anchor.
78    #[arg(long)]
79    pub state: Option<String>,
80    /// Filter by anchored file path.
81    #[arg(long)]
82    pub file: Option<String>,
83    /// Filter by anchored symbol. Requires `--file`.
84    #[arg(long)]
85    pub symbol: Option<String>,
86    /// Status filter: `open`, `resolved`, `conflicted`, or `all`.
87    #[arg(long, default_value = "open")]
88    pub status: String,
89}
90
91#[derive(Clone, Debug, Args)]
92pub struct DiscussShowArgs {
93    pub discussion_id: String,
94}