hive-forge: remove the nine renamed verbs that only throw
pr-status, pr-create, pr-commits, pr-merge, pr-reviews, pr-assign-reviewer, issue-create, issue-edit, and diff existed only to refuse via renamed() and name their namespaced replacement. Zero live callers remain (docs/, /knowledge/, scripts/ checked), so drop the enum variants, their dispatch arms, and the now-unused renamed() helper in one change. The kind-agnostic flat aliases (view, comment, comments, assign, close, labels, timeline) are untouched: each has no single scoped replacement, since it works on either an issue or a PR without knowing which. Refs #3974
This commit is contained in:
parent
d9c8b7ca8f
commit
83595663bb
1 changed files with 12 additions and 78 deletions
|
|
@ -29,7 +29,7 @@ mod client;
|
|||
mod notify;
|
||||
mod verbs;
|
||||
|
||||
use anyhow::{Context, Result, bail};
|
||||
use anyhow::{Context, Result};
|
||||
use clap::{Parser, Subcommand};
|
||||
use std::process::ExitCode;
|
||||
|
||||
|
|
@ -61,21 +61,16 @@ struct Cli {
|
|||
#[derive(Subcommand)]
|
||||
enum Verb {
|
||||
// The hidden verbs below are back-compat aliases of the `pr <verb>` /
|
||||
// `issue <verb>` forms, and they are at two different stages:
|
||||
//
|
||||
// - **Pure renames** (`pr-status`, `pr-create`, `pr-merge`,
|
||||
// `pr-reviews`, `pr-commits`, `pr-assign-reviewer`, `issue-create`,
|
||||
// `issue-edit`, `diff`) now *refuse* and name their replacement —
|
||||
// see `renamed`. They are removed outright in a later release.
|
||||
// The test is PR-only-ness: each has an exact scoped equivalent and
|
||||
// no `issue <verb>` form, so a caller holding just a number can be
|
||||
// sent somewhere unambiguous.
|
||||
// - **Kind-agnostic** (`view`, `comment`, `comments`, `close`,
|
||||
// `assign`, `labels`, `timeline`) **stay** — hidden, not deprecated.
|
||||
// Each exists as both `issue <verb>` and `pr <verb>`, so there is no
|
||||
// single replacement to send a caller to when all they hold is a
|
||||
// number: refusing these would remove a capability rather than
|
||||
// rename one.
|
||||
// `issue <verb>` forms. They're kind-agnostic (`view`, `comment`,
|
||||
// `comments`, `close`, `assign`, `labels`, `timeline`) and stay —
|
||||
// hidden, not deprecated. Each exists as both `issue <verb>` and
|
||||
// `pr <verb>`, so there is no single replacement to send a caller to
|
||||
// when all they hold is a number: refusing these would remove a
|
||||
// capability rather than rename one. Their pure-rename siblings
|
||||
// (`pr-status`, `pr-create`, `pr-merge`, `pr-reviews`, `pr-commits`,
|
||||
// `pr-assign-reviewer`, `issue-create`, `issue-edit`, `diff`) had an
|
||||
// exact scoped equivalent each and no ambiguity, so those were
|
||||
// removed outright rather than kept as forever-refusing aliases.
|
||||
//
|
||||
// `credential-helper` is hidden for a third reason and is in neither
|
||||
// group — git invokes it, no human does. A sweep that reads
|
||||
|
|
@ -85,20 +80,8 @@ enum Verb {
|
|||
View(verbs::view::Args),
|
||||
/// Issue-scoped commands: `issue <show|create|edit|view|comment|comments|close|reopen|labels|assign|dependency|reaction|timeline> …`.
|
||||
Issue(verbs::issue_cmd::Args),
|
||||
/// Create an issue. Prints the issue URL on success.
|
||||
#[command(hide = true)]
|
||||
IssueCreate(verbs::issue_create::Args),
|
||||
/// Edit an issue's title, body, state, or milestone.
|
||||
#[command(hide = true)]
|
||||
IssueEdit(verbs::issue_edit::Args),
|
||||
/// PR-scoped commands: `pr <show|status|create|merge|reviews|assign-reviewer|commits|diff|view|edit|comment|comments|close|reopen|labels|assign-committer|dependency|reaction|timeline> …`.
|
||||
Pr(verbs::pr_cmd::Args),
|
||||
/// List a PR's commits as JSON (sha, message, author date, author).
|
||||
#[command(hide = true)]
|
||||
PrCommits(verbs::pr_commits::Args),
|
||||
/// Create a pull request. Prints the PR URL on success.
|
||||
#[command(hide = true)]
|
||||
PrCreate(verbs::pr_create::Args),
|
||||
/// Post a comment on an issue or PR.
|
||||
#[command(hide = true)]
|
||||
Comment(verbs::comment::Args),
|
||||
|
|
@ -118,11 +101,6 @@ enum Verb {
|
|||
/// List, add, or remove labels on an issue or PR.
|
||||
#[command(hide = true)]
|
||||
Labels(verbs::labels::Args),
|
||||
/// PR health view: mergeable state, CI checks, requested reviewers +
|
||||
/// review verdicts, last-comment time (`--pr <n>`). `--sha` is a
|
||||
/// CI-only fast path. Exit code is a merge-readiness verdict.
|
||||
#[command(hide = true)]
|
||||
PrStatus(verbs::pr_status::Args),
|
||||
/// Clone a forge repo (default `-r`/`HIVE_FORGE_REPO`) with
|
||||
/// credentials autoinjected. Pairs with `pr create --agit`.
|
||||
Clone(verbs::clone::Args),
|
||||
|
|
@ -144,31 +122,15 @@ enum Verb {
|
|||
/// `--json` for raw JSON.
|
||||
// Discovery aliases: the verb is `list`, but `issues` / `issue-list`
|
||||
// are the names people reach for first (and clap's "did you mean"
|
||||
// tip points at `issue` / `issue-create`, not here). Visible so they
|
||||
// show in `--help`.
|
||||
// tip points at `issue`, not here). Visible so they show in `--help`.
|
||||
#[command(visible_alias = "issues", visible_alias = "issue-list")]
|
||||
List(verbs::list::Args),
|
||||
/// Manage milestones (list / create / close).
|
||||
Milestone(verbs::milestone::Args),
|
||||
/// Merge a PR (`--method merge|rebase`, default merge). Refuses unless
|
||||
/// mergeable + CI not red + no changes requested (`--force` overrides).
|
||||
/// Deletes the head branch unless `--keep-branch`. No squash option.
|
||||
#[command(hide = true)]
|
||||
PrMerge(verbs::pr_merge::Args),
|
||||
/// List a PR's reviews, or submit one: `--approve` /
|
||||
/// `--request-changes` / `--comment` (with `-m` for the body).
|
||||
#[command(hide = true)]
|
||||
PrReviews(verbs::pr_reviews::Args),
|
||||
/// Request (or withdraw with `--remove`) a review from a user on a PR.
|
||||
#[command(hide = true)]
|
||||
PrAssignReviewer(verbs::pr_assign_reviewer::Args),
|
||||
/// List branches, optionally filtered.
|
||||
Branches(verbs::branches::Args),
|
||||
/// Print the tree SHA at a branch or commit.
|
||||
TreeSha(verbs::tree_sha::Args),
|
||||
/// Print the unified diff for a PR.
|
||||
#[command(hide = true)]
|
||||
Diff(verbs::diff::Args),
|
||||
/// Get/set this user's watch subscription on a repo, or --list all watched repos.
|
||||
Subscription(verbs::subscription::Args),
|
||||
/// List timeline events on an issue or PR (closes, label adds,
|
||||
|
|
@ -293,34 +255,11 @@ fn run() -> Result<()> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Refuse a flat alias that has an exact scoped replacement, naming it.
|
||||
///
|
||||
/// Deprecation step for the aliases that are **pure renames**: `pr status`
|
||||
/// does precisely what `pr-status` did, so the caller can be sent somewhere
|
||||
/// specific. They still parse, only to say this — the variants come out
|
||||
/// entirely in a later release.
|
||||
///
|
||||
/// The kind-agnostic aliases (`view`, `comments`, `close`, …) are
|
||||
/// deliberately still working: those exist as *both* `issue <verb>` and
|
||||
/// `pr <verb>`, so a caller holding only a number cannot be told which one
|
||||
/// to run, and an error naming neither would be worse than the alias.
|
||||
fn renamed(old: &str, new: &str) -> Result<()> {
|
||||
bail!(
|
||||
"`{old}` is now `{new}` — run `hive-forge {new}` instead. \
|
||||
The old name still parses only to print this, and is removed in a \
|
||||
later release."
|
||||
)
|
||||
}
|
||||
|
||||
fn dispatch(client: &client::Client, verb: Verb) -> Result<()> {
|
||||
match verb {
|
||||
Verb::View(a) => verbs::view::run(client, a),
|
||||
Verb::Issue(a) => verbs::issue_cmd::run(client, a),
|
||||
Verb::IssueCreate(_) => renamed("issue-create", "issue create"),
|
||||
Verb::IssueEdit(_) => renamed("issue-edit", "issue edit"),
|
||||
Verb::Pr(a) => verbs::pr_cmd::run(client, a),
|
||||
Verb::PrCommits(_) => renamed("pr-commits", "pr commits"),
|
||||
Verb::PrCreate(_) => renamed("pr-create", "pr create"),
|
||||
Verb::Comment(a) => verbs::comment::run(client, a),
|
||||
Verb::Comments(a) => verbs::comments::run(client, a),
|
||||
Verb::CommentShow(a) => verbs::comment_show::run(client, a),
|
||||
|
|
@ -328,7 +267,6 @@ fn dispatch(client: &client::Client, verb: Verb) -> Result<()> {
|
|||
Verb::Assign(a) => verbs::assign::run(client, a),
|
||||
Verb::Close(a) => verbs::close::run(client, a),
|
||||
Verb::Labels(a) => verbs::labels::run(client, a),
|
||||
Verb::PrStatus(_) => renamed("pr-status", "pr status"),
|
||||
Verb::Clone(a) => verbs::clone::run(client, a),
|
||||
Verb::RepoCreate(a) => verbs::repo_create::run(client, a),
|
||||
Verb::RepoAddCollaborator(a) => verbs::repo_add_collaborator::run(client, a),
|
||||
|
|
@ -337,12 +275,8 @@ fn dispatch(client: &client::Client, verb: Verb) -> Result<()> {
|
|||
Verb::Lint(a) => verbs::lint::run(client, a),
|
||||
Verb::List(a) => verbs::list::run(client, a),
|
||||
Verb::Milestone(a) => verbs::milestone::run(client, a),
|
||||
Verb::PrMerge(_) => renamed("pr-merge", "pr merge"),
|
||||
Verb::PrReviews(_) => renamed("pr-reviews", "pr reviews"),
|
||||
Verb::PrAssignReviewer(_) => renamed("pr-assign-reviewer", "pr assign-reviewer"),
|
||||
Verb::Branches(a) => verbs::branches::run(client, a),
|
||||
Verb::TreeSha(a) => verbs::tree_sha::run(client, a),
|
||||
Verb::Diff(_) => renamed("diff", "pr diff"),
|
||||
Verb::Subscription(a) => verbs::subscription::run(client, a),
|
||||
Verb::Timeline(a) => verbs::timeline::run(client, a),
|
||||
Verb::AttachIssue(a) => verbs::attach::run_issue(client, a),
|
||||
|
|
|
|||
Loading…
Reference in a new issue