hyperhive/hive-forge
Repository files (latest commit first)
Filename Latest commit message Latest commit date
atlas 84203a3f9b hive-forge: let pr status take the PR number positionally
Every other PR-scoped verb takes the number as a positional — `pr show
42`, `pr comments 42`, `pr assign-reviewer 42 argus`. `pr status` alone
required `--pr 42`, so whichever form you learn first is wrong for the
other, and clap's error for the mistake suggests `-- --pr`, which would
pass the literal string on as the next positional.

The number is positional here too now. `--pr` stays, because it was the
only spelling this verb had; `--sha` keeps its flag because the two are
alternatives rather than one required argument.

Two error strings in this file also named `pr-status`, a form that has
refused to run since the subcommand rename. One of them is the message
you get for passing neither argument — i.e. exactly when you are already
unsure what the verb is called.

The four new cases cover both halves: that clap accepts each spelling,
and that something reads it. `target_pr` is named rather than inlined
for exactly that reason — dropping the positional from the selection
passed every parse-only case while leaving `pr status 42` reporting
"pass a PR number". The conflict case earns its keep the same way: clap
accepting an argument and clap ignoring it are indistinguishable from a
passing parse, so `42 --sha abc` and `42 --pr 42` both have to be
rejected.

Closes #4182.
2026-09-11 09:04:20 +02:00
..
src hive-forge: let pr status take the PR number positionally 2026-09-11 09:04:20 +02:00
Cargo.toml hive-forge: add markdown-docs generator and CI freshness check 2026-09-02 19:38:34 +02:00
README.md treefmt: apply prettier 2026-09-02 15:25:07 +02:00

hive-forge

Typed CLI wrapper around the in-cluster Forgejo's REST API — issues, PRs, comments, labels, reviews, CI status, attachments, triage. Replaces the old bash-script wrapper so agents and operators get consistent error handling, exit codes, and JSON shapes. This is the only supported path to the forge from inside an agent container; never curl it directly.

Reads credentials from the environment (HIVE_FORGE_URL, HYPERHIVE_STATE_DIR); -f/--forge <label> retargets a dashboard-provisioned external forge account instead. The active repo resolves -r/--repo > the origin remote of the cwd's git checkout > HIVE_FORGE_REPO (last-resort override, unset by default) > a hard error — see client::Client::from_env.

When to use it

Reach for this crate when adding or changing a forge verb — it's the single place issue/PR/comment/CI logic lives for every agent and hivectl. Adding a tool an agent's claude session calls is hive-agent-mcp wrapping a shellout to this binary, not new logic here.

Shape

  • verbs/ — one module per subcommand (clap Args + run).
  • client.rs — the Forgejo client wrapper + token loading.
  • notify.rs — the read-before-comment guard, backed by forge's own notification read-state (no local mirror to drift).
  • body.rs — shared --body/--body-file/stdin resolution.

Full verb reference: docs/tools/forge.md.