An operator now links an agent's external forge account (label, base URL, token) in the swarm UI. swarm-controller stores it at swarm/agents/<agent>/forge/<label>. There is no index: the store's listing of the agent's forge/ directory is the set of accounts. In the agent, hive-agent-forge-accounts (oneshot + 2-minute timer, as the agent user, under its own store certificate) lists swarm/agents/<agent>/forge/ with the `list` #4866 grants an agent on its own metadata subtree, reads each account, and writes <state>/forge-<label>-token and forge-<label>.json in the names and shape hive-forge -f already reads. An empty listing (a 404, which `bao kv list -format=json` answers with `{}` and an empty stderr) is zero accounts; a denial or an unreachable store fails the unit. It never deletes: files for labels not listed, including ones the hive wrote, stay as they are. Removed: the dashboard FORGES tab (credentials.js/html section and its CSS), hive-c0re's extra_forges.rs and its routes, priv_client's extra-forge calls, and hive-priv's WriteAgentExtraForgeAccount / DeleteAgentExtraForgeAccount with their helpers. The GITHUB tab and WriteAgentGithubToken stay. Also: persistence.md's matrix avatar note names the exit-75 restart on a changed account listing, not the dashboard, as what brings a linked account up. Refs #4348
33 lines
1.4 KiB
Markdown
33 lines
1.4 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`.
|
|
|
|
## 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`.
|