hive-forge: add 'reopen' verb (pr reopen / issue reopen)

hive-forge had close but no reopen, so reopening required the non-obvious
workaround 'issue edit <n> --state open'. Add a reopen verb mirroring close
(PATCH state=open), wired into both 'pr reopen' (kind-checked PR) and
'issue reopen' (kind-checked issue). Updates docs/forge.md + the subcommand
enumerations.
This commit is contained in:
atlas 2026-06-23 14:54:45 +02:00 committed by mara
commit 11fb2ac0fc
6 changed files with 50 additions and 5 deletions

View file

@ -0,0 +1,30 @@
//! `reopen <number>` — reopen a closed issue or PR.
//!
//! Mirror of `close`: sends a PATCH setting the issue/PR `state` back to
//! `open`. PRs share the issue number space, so the same `/issues/<n>`
//! endpoint reopens either.
use anyhow::Result;
use clap::Args as ClapArgs;
use serde_json::json;
use crate::client::Client;
use crate::verbs::print_json;
#[derive(ClapArgs)]
pub struct Args {
/// Issue or PR number.
pub(crate) number: u64,
}
pub fn run(client: &Client, args: Args) -> Result<()> {
let repo = client.repo();
let resp = client.patch_json(
&format!("/repos/{repo}/issues/{}", args.number),
&json!({ "state": "open" }),
)?;
print_json(&json!({
"number": resp.get("number"),
"state": resp.get("state"),
}))
}