Watch
0
0
Fork
You've already forked hyperhive
0
hyperhive/hive-forge/README.md
atlas ccc6993703 hive-forge: exit after HIVE_FORGE_DEADLINE instead of hanging on a stalled forge
forgejo-api 0.11.1's sync client builds its own reqwest client with no
timeout and takes no caller-supplied client (sync.rs: new and
with_user_agent are the only constructors), so a forge that accepts a
connection and then stalls blocked every typed verb forever.

A watchdog thread now starts before the client is built. After
HIVE_FORGE_DEADLINE seconds (default 900, five minutes above
DOWNLOAD_TIMEOUT) it prints a hive-forge: FAILED: line and exits 75.
It bounds the whole command, not each request, and a write may already
have landed when it fires; the help text and docs/tools/forge.md say so.
2026-10-17 08:01:23 +02:00

35 lines
1.5 KiB
Markdown

# 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
swarm-UI-linked 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`. `HIVE_FORGE_DEADLINE` (seconds,
default 900) caps one invocation; past it the binary exits 75 (see
`src/deadline.rs`).
## 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`.