docs, prompts, hive-forge: stop handing readers the renamed verbs
docs/tools/forge.md already listed the nine renamed verbs as removed, then used them ~30 more times in pasteable blocks. Sweeps every occurrence a reader would type, including three runtime messages that told the user to run a verb the same binary rejects. The renamed-verb list itself keeps the old names; it is what documents them. Refs #4155
This commit is contained in:
parent
d2175c84b3
commit
55f01942a2
23 changed files with 73 additions and 73 deletions
|
|
@ -10,7 +10,7 @@ use anyhow::{Context, Result, bail};
|
|||
/// Resolve the body to send, given the user's explicit flags and the
|
||||
/// current stdin state. Returns `None` when none of the sources are
|
||||
/// available (the caller decides whether that's allowed — e.g.
|
||||
/// `issue-edit` treats absent body as "leave unchanged", while
|
||||
/// `issue edit` treats absent body as "leave unchanged", while
|
||||
/// `comment` treats absent body as a hard error).
|
||||
pub fn resolve(body: Option<&str>, file: Option<&str>) -> Result<Option<String>> {
|
||||
if body.is_some() && file.is_some() {
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ enum Verb {
|
|||
#[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`.
|
||||
/// credentials autoinjected. Pairs with `pr create --agit`.
|
||||
Clone(verbs::clone::Args),
|
||||
/// Create a forge repo under the current user (or `--org`). Prints
|
||||
/// the repo URL.
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
//! the only path is the web UI's download route,
|
||||
//! `<base>/<owner>/<repo>/actions/runs/<run-id>/artifacts/<name>`. That
|
||||
//! route is keyed by the run's GLOBAL id, **not** the per-repo run number
|
||||
//! the UI shows in run-page URLs (`/actions/runs/51`) and that `pr-status`
|
||||
//! the UI shows in run-page URLs (`/actions/runs/51`) and that `pr status`
|
||||
//! surfaces as a CI context's `target_url`. The REST artifacts *list*
|
||||
//! route, confusingly, keys off the run number instead — so the two can't
|
||||
//! be chained directly. We therefore translate the caller's run number
|
||||
|
|
@ -32,7 +32,7 @@ pub struct Args {
|
|||
/// Artifact name, as shown on the run page (for example `pr1ma-paper-pdf`).
|
||||
name: String,
|
||||
/// Workflow run number — the `runs/<n>` in the run-page URL, which
|
||||
/// `pr-status` surfaces as a CI context's `target_url`. (This is the
|
||||
/// `pr status` surfaces as a CI context's `target_url`. (This is the
|
||||
/// per-repo run number, not the global run id; the verb translates.)
|
||||
#[arg(long)]
|
||||
run: u64,
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ use forgejo_api::structs::{ActionRun, ListActionRunsQuery};
|
|||
use crate::client::Client;
|
||||
|
||||
/// The per-repo run NUMBER from a run object's `html_url` (`…/runs/<n>`
|
||||
/// tail) — the number the UI shows, `pr-status` surfaces, and every
|
||||
/// tail) — the number the UI shows, `pr status` surfaces, and every
|
||||
/// `--run <n>` flag takes.
|
||||
///
|
||||
/// ⚠️ NOT [`ActionRun::id`]: Forgejo's `GET
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ use crate::client::Client;
|
|||
#[derive(ClapArgs)]
|
||||
pub struct Args {
|
||||
/// Workflow run number — the `runs/<n>` in the run-page URL (shown
|
||||
/// by `pr-status`).
|
||||
/// by `pr status`).
|
||||
#[arg(long)]
|
||||
run: u64,
|
||||
/// Job index within the run (0-based, default 0).
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
//!
|
||||
//! Dispatch re-runs the whole workflow (no single-job variant). ⚠️ `--pr`
|
||||
//! verifies the code but doesn't reliably move the PR's own status
|
||||
//! checks — see `docs/scheduler/ci.md`'s "CI checks" for why; re-check `pr-status`.
|
||||
//! checks — see `docs/scheduler/ci.md`'s "CI checks" for why; re-check `pr status`.
|
||||
|
||||
use anyhow::{Context as _, Result, bail};
|
||||
use clap::Args as ClapArgs;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
//! with credentials auto-injected, so agents don't hand-assemble
|
||||
//! token-bearing URLs. The repo is the standard `-r/--repo` (see
|
||||
//! `client::Client::from_env` for the full resolution chain). Pairs
|
||||
//! with `pr-create --agit`: clone, edit + commit normally, then open a
|
||||
//! with `pr create --agit`: clone, edit + commit normally, then open a
|
||||
//! PR via the `AGit` ref.
|
||||
//!
|
||||
//! The clone URL itself carries no credentials, and the resulting
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
//! `issue-create --title <t> [body sources] [--assignee <u>]
|
||||
//! `issue create --title <t> [body sources] [--assignee <u>]
|
||||
//! [--label <name>]... [repo]` — create an issue. Prints the issue URL.
|
||||
|
||||
use anyhow::Result;
|
||||
|
|
@ -46,7 +46,7 @@ pub fn run(client: &Client, args: Args) -> Result<()> {
|
|||
let body = body::resolve_required(
|
||||
args.body.as_deref(),
|
||||
args.body_file.as_deref(),
|
||||
"issue-create",
|
||||
"issue create",
|
||||
)?;
|
||||
let (owner, name) = client.owner_repo()?;
|
||||
let label_ids = if args.labels.is_empty() {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
//! `issue-edit <number> [--title <t>] [body sources] [--state s]
|
||||
//! `issue edit <number> [--title <t>] [body sources] [--state s]
|
||||
//! [--milestone id] [repo]` — partial update of an issue. Fields not
|
||||
//! provided are left unchanged. Also backs `pr edit`: Forgejo serves
|
||||
//! both kinds off the same `/issues/<n>` endpoint, so this is shared
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ pub fn run(client: &Client, args: Args) -> Result<()> {
|
|||
}
|
||||
|
||||
/// The repo's whole label set, for name → id resolution. `pub(crate)` so
|
||||
/// other verbs (`issue-create`, `pr-create`, `list`) can resolve a label
|
||||
/// other verbs (`issue create`, `pr create`, `list`) can resolve a label
|
||||
/// name without duplicating the lookup.
|
||||
///
|
||||
/// Paginated, where this used to ask for one page of 100 — **a page size
|
||||
|
|
@ -127,7 +127,7 @@ pub(crate) fn repo_labels(client: &Client) -> Result<Vec<Label>> {
|
|||
/// Resolve label names to ids, hard-erroring if any name doesn't match an
|
||||
/// existing repo label. A typo used to silently produce fewer labels than
|
||||
/// intended with no signal — not even a nonzero exit code — so callers
|
||||
/// (`labels add`, `issue-create --label`, `pr-create --label`) had no way
|
||||
/// (`labels add`, `issue create --label`, `pr create --label`) had no way
|
||||
/// to notice without manually diffing what they asked for against what
|
||||
/// landed. The error lists both the exact names that didn't resolve and
|
||||
/// every label actually available on the repo, so it's fixable from the
|
||||
|
|
|
|||
|
|
@ -299,8 +299,8 @@ fn reviewed_older_head(reviewed_sha: Option<&str>, head_sha: Option<&str>) -> bo
|
|||
/// Latest non-comment review per reviewer on a PR. Reviews come
|
||||
/// oldest-first, so a later verdict from the same user supersedes an
|
||||
/// earlier one; `COMMENT` / `PENDING` reviews carry no verdict and are
|
||||
/// skipped. Shared by `pr-status` (health view + readiness verdict) and
|
||||
/// `pr-merge` (pre-merge changes-requested gate) so the verdict semantics
|
||||
/// skipped. Shared by `pr status` (health view + readiness verdict) and
|
||||
/// `pr merge` (pre-merge changes-requested gate) so the verdict semantics
|
||||
/// stay in one place.
|
||||
///
|
||||
/// # Errors
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
//! `pr-commits <number> [repo]` — list a PR's commits as JSON
|
||||
//! `pr commits <number> [repo]` — list a PR's commits as JSON
|
||||
//! (sha, message, author date, author login), paginated.
|
||||
//!
|
||||
//! The forge stores a PR's commits against its branch ref, so this
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
//! `pr-create --title <t> --head <branch> [--base <b>] [body sources]
|
||||
//! `pr create --title <t> --head <branch> [--base <b>] [body sources]
|
||||
//! [--draft] [--push] [--remote <name>] [repo]` — create a PR. Prints
|
||||
//! the PR URL.
|
||||
//!
|
||||
|
|
@ -71,7 +71,7 @@ pub struct Args {
|
|||
/// Label name to attach, repeatable (for example `--label area/ops --label
|
||||
/// type/bug`). Same spelling `labels add` accepts — an unresolved name
|
||||
/// errors out rather than silently attaching fewer labels than asked
|
||||
/// for. In `--agit` mode `pr-create` applies this as a follow-up call
|
||||
/// for. In `--agit` mode `pr create` applies this as a follow-up call
|
||||
/// once it learns the PR number (the `AGit` push itself has no label
|
||||
/// field), so it silently skips them (not a label-resolution error) if
|
||||
/// it couldn't parse the PR URL back out of the push output — same
|
||||
|
|
@ -146,7 +146,7 @@ pub fn run(client: &Client, args: Args) -> Result<()> {
|
|||
/// single-line body still rides along as a push option (it's guaranteed
|
||||
/// to land even if we can't parse the PR URL back out); a multi-line
|
||||
/// body is pushed title-only and then set on the resulting PR via a REST
|
||||
/// PATCH, mirroring the manual `pr-create --title …` + `issue-edit
|
||||
/// PATCH, mirroring the manual `pr create --title …` + `issue edit
|
||||
/// --body-file` two-step.
|
||||
fn agit_create(client: &Client, args: &Args, body: &str) -> Result<()> {
|
||||
let remote = args.remote.as_deref().unwrap_or("origin");
|
||||
|
|
@ -192,7 +192,7 @@ fn agit_create(client: &Client, args: &Args, body: &str) -> Result<()> {
|
|||
if deferred_body {
|
||||
eprintln!(
|
||||
"warning: multi-line body NOT set — PR URL not parsed, so it could \
|
||||
not be PATCHed. Set it manually: hive-forge issue-edit <pr#> --body-file -"
|
||||
not be PATCHed. Set it manually: hive-forge issue edit <pr#> --body-file -"
|
||||
);
|
||||
}
|
||||
println!(
|
||||
|
|
@ -224,7 +224,7 @@ fn agit_create(client: &Client, args: &Args, body: &str) -> Result<()> {
|
|||
} else {
|
||||
eprintln!(
|
||||
"warning: multi-line body NOT set — could not parse PR number from {url}. \
|
||||
Set it manually: hive-forge issue-edit <pr#> --body-file -"
|
||||
Set it manually: hive-forge issue edit <pr#> --body-file -"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
//! `pr-merge <number> [--method merge|rebase] [--keep-branch] [--force]`
|
||||
//! `pr merge <number> [--method merge|rebase] [--keep-branch] [--force]`
|
||||
//! — merge a pull request.
|
||||
//!
|
||||
//! Wraps `POST /api/v1/repos/{owner}/{repo}/pulls/{n}/merge` so agents on a
|
||||
//! peer-review-and-merge workflow (e.g. the paper repo, where agents merge
|
||||
//! each other's PRs without an operator approval) have a CLI path instead of
|
||||
//! reaching for the raw API. Pairs with `pr-status` (the merge-readiness
|
||||
//! verdict this verb pre-checks) and `pr-create`.
|
||||
//! reaching for the raw API. Pairs with `pr status` (the merge-readiness
|
||||
//! verdict this verb pre-checks) and `pr create`.
|
||||
//!
|
||||
//! Safe by default: refuses unless the PR is mergeable, CI is not red, and no
|
||||
//! review requests changes — pass `--force` to override (which also sets
|
||||
|
|
@ -120,7 +120,7 @@ pub fn run(client: &Client, args: Args) -> Result<()> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// Pre-merge readiness gate, mirroring `pr-status`'s verdict: the PR must be
|
||||
/// Pre-merge readiness gate, mirroring `pr status`'s verdict: the PR must be
|
||||
/// mergeable, CI must not be red/pending, and no review may request changes.
|
||||
/// Bails with an actionable message (pointing at `--force`) on the first
|
||||
/// failure.
|
||||
|
|
@ -133,7 +133,7 @@ fn check_ready(client: &Client, repo: &str, number: u64, pull: &PullRequest) ->
|
|||
// correct for one of those causes and actively wrong advice for the
|
||||
// others (rebasing a draft does nothing). Only name the
|
||||
// cause when the API actually confirms it (draft); otherwise report
|
||||
// the bare observation and let `pr-status` be consulted for detail.
|
||||
// the bare observation and let `pr status` be consulted for detail.
|
||||
// Report the confirmed cause without prescribing the fix — a draft
|
||||
// can be a deliberate signal (from the author, or the operator)
|
||||
// rather than an oversight, so don't tell the caller to just
|
||||
|
|
@ -142,7 +142,7 @@ fn check_ready(client: &Client, repo: &str, number: u64, pull: &PullRequest) ->
|
|||
"pr-merge: PR #{number} is a draft, not mergeable. Pass --force, or check with whoever set draft before un-drafting it."
|
||||
),
|
||||
Some(false) => bail!(
|
||||
"pr-merge: PR #{number} is not mergeable. Check `pr-status --pr {number}` for detail, or pass --force."
|
||||
"pr-merge: PR #{number} is not mergeable. Check `pr status --pr {number}` for detail, or pass --force."
|
||||
),
|
||||
None => bail!(
|
||||
"pr-merge: PR #{number} mergeability is still being computed. Retry shortly, or pass --force."
|
||||
|
|
@ -165,7 +165,7 @@ fn check_ready(client: &Client, repo: &str, number: u64, pull: &PullRequest) ->
|
|||
// (latest-per-reviewer, so a later APPROVED clears an earlier
|
||||
// REQUEST_CHANGES). A superseded REQUEST_CHANGES — stale (older head) or
|
||||
// dismissed — no longer applies, so it doesn't block. Shares the verdict
|
||||
// logic with `pr-status`.
|
||||
// logic with `pr status`.
|
||||
let blockers: Vec<String> = super::latest_reviews(client, repo, number)?
|
||||
.into_iter()
|
||||
.filter(|r| r.state == "REQUEST_CHANGES" && !r.superseded())
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
//! `pr-reviews <number>` — list reviews, or submit one via `--approve` /
|
||||
//! `pr reviews <number>` — list reviews, or submit one via `--approve` /
|
||||
//! `--request-changes` / `--comment`.
|
||||
|
||||
use anyhow::{Result, bail};
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
//! `pr-status --pr <n>` — one-stop PR health view: mergeable state, CI
|
||||
//! `pr status --pr <n>` — one-stop PR health view: mergeable state, CI
|
||||
//! checks, requested reviewers + review verdicts, and the last-comment
|
||||
//! timestamp. `--sha <sha>` is a CI-only fast path for a raw commit.
|
||||
//! Removes the need for raw `curl` to the statuses / reviews endpoints,
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
//!
|
||||
//! Exit code is a merge-readiness verdict for `--pr`: 0 only when CI is
|
||||
//! green AND the PR is mergeable AND no review requests changes — so it
|
||||
//! composes (`hive-forge pr-status --pr 42 && …`). `--sha` mirrors the
|
||||
//! composes (`hive-forge pr status --pr 42 && …`). `--sha` mirrors the
|
||||
//! CI verdict alone (0 = success).
|
||||
|
||||
use anyhow::{Context, Result, bail};
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ pub fn run(client: &Client, args: Args) -> Result<()> {
|
|||
if client.json_mode() {
|
||||
return print_json(&serde_json::to_value(&resp)?);
|
||||
}
|
||||
// Default human path: print the web URL, like issue-create / pr-create.
|
||||
// Default human path: print the web URL, like issue create / pr create.
|
||||
if let Some(url) = resp.html_url {
|
||||
println!("{url}");
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue