hyperhive/hive-forge
Repository files (latest commit first)
Filename Latest commit message Latest commit date
damocles 1be4b81f65 hive-forge: comments/timeline default to newest, timeline gets a real total
Mara's decision on #4179: the default window for comments/timeline (no
flags at all) is now the newest 10, matching an explicit --tail 10 --
agent can still opt into the old oldest-first window via an explicit
--limit. Same restructure in both verbs: limit u64 -> Option<u64>, only
the explicit-limit branch takes the head path now, the tail-or-default
branch covers both --tail N and the no-flags case.

timeline.rs also gets the real fix: TimelineListHeaders.x_total_count is
a genuine field forgejo-api already returns on every timeline call --
verified against the vendored crate source. The old 'no total exists'
premise in the module doc was false, same shape as #3200. Replaced the
over-fetch-by-one boolean 'more' with an exact count via a cheap
page_size=1 fetch_total, mirroring comments.rs's fetch_tail pagination
math for --tail. JSON output reshaped to {events, more_before,
more_after, since_more, since_limit_clamped}, matching comments.rs --
a breaking interface change, intentional.

Also fixed a real pre-existing bug in comments.rs's truncation_note:
the more_before message suggested retrying with --tail, which is
nonsensical since more_before only ever fires from a tail-shaped
window. Now correctly suggests --limit. Added a regression test.

fixes #4179
2026-09-11 19:13:30 +02:00
..
src hive-forge: comments/timeline default to newest, timeline gets a real total 2026-09-11 19:13:30 +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.