hive-forge: infer active repo from cwd's git remote, demote HIVE_FORGE_REPO

This commit is contained in:
damocles 2026-07-29 18:37:37 +02:00
commit f034ffb9d8
9 changed files with 201 additions and 25 deletions

View file

@ -2,9 +2,12 @@
//! REST API. Reads credentials from the environment:
//!
//! `HIVE_FORGE_URL` — base URL, e.g. `http://localhost:3000`
//! `HIVE_FORGE_REPO` — default repo, e.g. `hyperhive/hyperhive`
//! `HYPERHIVE_STATE_DIR` — state dir; `forge-token` lives here
//!
//! 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`.
//!
//! The global `-f/--forge <label>` flag targets a dashboard-provisioned
//! external forge account instead: it reads `forge-<label>-token` +
//! `forge-<label>.json` (base URL) from the state dir rather than
@ -37,8 +40,9 @@ use std::process::ExitCode;
disable_help_subcommand = true
)]
struct Cli {
/// Repo to act on, as `owner/name` (default: `HIVE_FORGE_REPO`).
/// Works with any verb.
/// Repo to act on, as `owner/name` (default: inferred from the
/// cwd's git `origin` remote, then `HIVE_FORGE_REPO`). Works with
/// any verb.
#[arg(short = 'r', long, global = true)]
repo: Option<String>,
/// Act as a dashboard-provisioned external forge account (by its