hive-forge: add markdown-docs generator and CI freshness check

This commit is contained in:
damocles 2026-09-02 19:01:51 +02:00 committed by mara
commit d27cf6ce3e
8 changed files with 1453 additions and 1 deletions

View file

@ -195,6 +195,13 @@ enum Verb {
/// remote URL.
#[command(hide = true)]
CredentialHelper(verbs::credential_helper::Args),
/// Emit the full CLI reference as Markdown, walking hive-forge's own
/// clap command tree.
///
/// Hidden tooling command used by the docs build to keep the published
/// `hive-forge` reference in lockstep with the code.
#[command(hide = true)]
MarkdownDocs,
}
/// Wrapper over [`run`] that owns how a failure reaches the operator.
@ -245,6 +252,13 @@ fn run() -> Result<()> {
if let Verb::CredentialHelper(args) = verb {
return verbs::credential_helper::run(args, cli.forge.as_deref());
}
// Same reasoning as `credential-helper` above: no repo, no forge
// credentials — just a pure render of the clap tree the docs build
// pipes into `docs/tools/forge-cli.md`.
if let Verb::MarkdownDocs = verb {
print!("{}", clap_markdown::help_markdown::<Cli>());
return Ok(());
}
let client = client::Client::from_env(cli.repo, cli.json, cli.forge)
.context("initialize forge client")?;
// Attach the resolved repo to every verb's error uniformly here,
@ -330,7 +344,7 @@ fn dispatch(client: &client::Client, verb: Verb) -> Result<()> {
Verb::CiLog(a) => verbs::ci_log::run(client, a),
Verb::CiRerun(a) => verbs::ci_rerun::run(client, a),
Verb::CiRuns(a) => verbs::ci_runs::run(client, a),
Verb::CredentialHelper(_) => {
Verb::CredentialHelper(_) | Verb::MarkdownDocs => {
unreachable!("handled in `run` before client construction")
}
}