3bc9022c
Add patch comment CLI command
a73x 2026-03-20 20:14
Closes 2605dd6d. Wire up the existing PatchComment action through a new `patch comment` subcommand. Comments are appended to the patch DAG and displayed in both CLI `patch show` and TUI dashboard. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
diff --git a/src/cli.rs b/src/cli.rs index 11fac50..058896d 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -107,6 +107,14 @@ pub enum PatchCmd { /// Patch ID (prefix match) id: String, }, /// Comment on a patch Comment { /// Patch ID (prefix match) id: String, /// Comment body #[arg(short, long)] body: String, }, /// Review a patch Review { /// Patch ID (prefix match) diff --git a/src/main.rs b/src/main.rs index 2b9c91f..b372679 100644 --- a/src/main.rs +++ b/src/main.rs @@ -54,6 +54,7 @@ fn run(cli: Cli) -> Result<(), error::Error> { } PatchCmd::List { all } => patch::list(&repo, all), PatchCmd::Show { id } => patch::show(&repo, &id), PatchCmd::Comment { id, body } => patch::comment(&repo, &id, &body), PatchCmd::Review { id, verdict, body } => { let v = match verdict.as_str() { "approve" => ReviewVerdict::Approve, diff --git a/src/patch.rs b/src/patch.rs index 2bed55c..098e3e8 100644 --- a/src/patch.rs +++ b/src/patch.rs @@ -91,6 +91,21 @@ pub fn show(repo: &Repository, id_prefix: &str) -> Result<(), crate::error::Erro Ok(()) } pub fn comment(repo: &Repository, id_prefix: &str, body: &str) -> Result<(), crate::error::Error> { let (ref_name, _id) = state::resolve_patch_ref(repo, id_prefix)?; let author = get_author(repo)?; let event = Event { timestamp: chrono::Utc::now().to_rfc3339(), author, action: Action::PatchComment { body: body.to_string(), }, }; dag::append_event(repo, &ref_name, &event)?; println!("Comment added."); Ok(()) } pub fn review( repo: &Repository, id_prefix: &str,