rtb_forge/lib.rs
1//! Release-provider abstractions and git operations for the
2//! phpboyscout Rust toolkit.
3//!
4//! Formerly `rtb-vcs` in the
5//! [rust-tool-base](https://gitlab.com/phpboyscout/rust-tool-base)
6//! monorepo — renamed to `rtb-forge` at extraction for name
7//! convergence with the GTB family. Only the crate identity changed:
8//! types, modules, Cargo features, and the `RTB_VCS_GIT_TOKEN` auth
9//! environment variable are exactly those of `rtb-vcs` 0.7.0.
10//!
11//! # What this crate is
12//!
13//! A narrow, read-only abstraction over release-source APIs. Tool
14//! authors pick one of six backends — GitHub, GitLab, Bitbucket, Gitea,
15//! Codeberg, or Direct (bare HTTPS URL) — and `rtb-update` consumes the
16//! trait to list, fetch, and download release artefacts.
17//!
18//! # What this crate is not
19//!
20//! - **Not Git.** Repository operations (`Repo`, clone, fetch, commit
21//! walk) land as `rtb-forge` v0.2 at the v0.5 roadmap milestone.
22//! - **Not writeable.** `ReleaseProvider` has four methods, all of them
23//! read-only. Creating releases, uploading assets, and editing tags
24//! are deliberately out of scope.
25//! - **Not a caching layer.** Every call hits the wire. Downstream
26//! tools add HTTP caching via `reqwest::ClientBuilder::middleware`
27//! if they need it.
28//!
29//! # Foundation
30//!
31//! The v0.1.1 release ships the foundation only — trait, value types,
32//! error enum, config structs, and the `linkme`-backed factory
33//! registry. Backend implementations land in follow-up releases,
34//! feature-gated so downstream tools only compile what they use.
35
36// `deny` rather than `forbid` — identical in strictness but allows the
37// targeted `#[allow(unsafe_code)]` below for the built-in backends'
38// `#[distributed_slice(RELEASE_PROVIDERS)]` registrations. `linkme`
39// emits `#[link_section]` attributes at the registration sites, and
40// Rust 1.95+ attributes that behaviour to the `unsafe_code` lint.
41// Every other rtb-* crate keeps `forbid` because they register into
42// slices declared in *other* crates (`rtb_app::BUILTIN_COMMANDS`),
43// which puts the emission behind a cross-crate boundary and out of
44// the `forbid`'s view. `rtb-forge` is the first crate that declares
45// AND registers in the same library, so it needs the override.
46// Consumers still get the guarantee via the `[lints.rust]`
47// `unsafe_code = "deny"` in Cargo.toml — nothing in this crate
48// writes hand-rolled `unsafe` blocks.
49#![deny(unsafe_code)]
50
51pub mod config;
52pub mod release;
53
54// v0.5 git-operations slice — entire module gated on the `git` feature.
55// See `docs/development/specs/2026-05-11-v0.5-scope.md`.
56#[cfg(feature = "git")]
57pub mod git;
58
59// Shared HTTP helpers for the REST-API backends. `pub(crate)` —
60// downstream custom backends roll their own.
61#[cfg(feature = "_http")]
62pub(crate) mod http;
63
64#[cfg(feature = "bitbucket")]
65pub mod bitbucket;
66#[cfg(feature = "codeberg")]
67pub mod codeberg;
68#[cfg(feature = "direct")]
69pub mod direct;
70#[cfg(feature = "gitea")]
71pub mod gitea;
72#[cfg(feature = "github")]
73pub mod github;
74#[cfg(feature = "gitlab")]
75pub mod gitlab;
76
77pub use config::{
78 BitbucketParams, CodebergParams, DirectParams, GiteaParams, GithubParams, GitlabParams,
79 ReleaseSourceConfig,
80};
81pub use release::{
82 lookup, registered_types, ProviderError, ProviderFactory, ProviderRegistration,
83 RegisteredProvider, Release, ReleaseAsset, ReleaseProvider, RELEASE_PROVIDERS,
84};