Revision: 1 Last modified: 2026-12-04T18:15:21Z
This is a library. It is sourced by scripts/forge/forge.sh, never executed. No shebang, mode
rw-rw-r--.
GitVerse adapter (gitverse.ru, API api.gitverse.ru) — a GitHub-shaped own API. It implements the same
provider contract as scripts/forge/providers/gitea.sh; read that guide for the contract. This guide records
what is specific to GitVerse, which is the most anomalous of the five and the reason two opt-in flags exist.
Three facts drive the design:
- A mandatory
Acceptheader.Accept: application/vnd.gitverse.object+json;version=1— without it the API answers 415. Auth isAuthorization: Bearer. - The release list is unreliable in a very specific way.
GET /repos/{o}/{r}/releasesanswers404 {"code":"REPO_NOT_FOUND"}for a repository thatGET /repos/{o}/{r}answers200, and/releases/tags/{tag}also answers404. That state cannot be told apart from "no release yet" or "releases unsupported", so it is the GAPreleases_unsupported_or_empty— neverabsent, never success. This is whyforge.sh release-ensurehas the explicit opt-in--try-create-on-ambiguous: on this forge the create is attempted and then only the read-back decides. - Tag endpoints are partly broken.
git/matching-refs/tags/{tag}works;git/tags/{sha}and/tagsanswer400(live 2026-11-12). An annotated tag is peeled throughcommits/{tag-object-sha}(live 2026-11-16), which answers200with the commit the forge peels from the tag. Asked by the tag-object sha, never by the tag name, because a branch of the same name could shadow it.
FG_TARGET_DERIVED=0 — GitHub-shaped, so target_commitish is the stored request field.
FG_PRE_SUPPORTED=1, but the prerelease field is not documented; when the read-back does not report it,
forge.sh prints NOTE: prerelease_unverified rather than assuming.
As for every provider: sourced by forge.sh after lib/common.sh / lib/credentials.sh / lib/http.sh, with
FG_OWNER, FG_REPO, FG_API_BASE, FG_API_ORIGIN and an initialised FG_TMP. Needs jq.
Through forge.sh (this file is not invoked directly):
bash scripts/forge/forge.sh detect --url git@gitverse.ru:org/repo.git
bash scripts/forge/forge.sh probe --url git@gitverse.ru:org/repo.git
bash scripts/forge/forge.sh tag-get --url git@gitverse.ru:org/repo.git --tag v1.0.0
# the release list is ambiguous here; without the opt-in this is a GAP
bash scripts/forge/forge.sh release-get --url git@gitverse.ru:org/repo.git --tag v1.0.0
# opt in: try the create, and let the read-back decide
bash scripts/forge/forge.sh release-ensure --url git@gitverse.ru:org/repo.git --tag v1.0.0 \
--sha <sha40> --notes-file notes.md --try-create-on-ambiguousContract check in isolation:
bash -c '. scripts/forge/lib/common.sh; . scripts/forge/providers/gitverse.sh; FG_OWNER=o FG_REPO=r; prov_init; \
printf "%s|%s|%s|%s|%s\n" "$FG_AUTH_FMT" "$FG_HDRS" "$FG_RPATH" "$FG_PRE_SUPPORTED" "$FG_TARGET_DERIVED"'Library: functions return 0 when a state was determined and 1 only when no HTTP answer arrived
(FG_NET set). HTTP statuses are results encoded in state. A 404 on the release list surfaces as GAP
releases_unsupported_or_empty (exit 3 through forge.sh). User-visible exit codes belong to forge.sh —
see docs/scripts/forge.md.
404on/releases/tags/{tag}— this file does not immediately call it absent. It re-checks the release list:200on the list →absent(releases work, there is simply none of this tag);404on the list →gap/releases_unsupported_or_empty. That second check is the whole point.- Anything other than
200/404on the release-by-tag lookup — returns 0 withFG_REL_STATElefterror, so the caller reports an unexpected status instead of guessing. - Create returns
403or404—FG_CREATE=refused, whichforge.shturns into GAPreleases_unsupported_or_emptyunder--try-create-on-ambiguous("the create was refused: releases look unsupported here"). 409or422on create —FG_CREATE=exists, soforge.shreads the existing release back and compares rather than creating a duplicate.- An annotated tag —
git/tags/{sha}answers400; the fallback iscommits/{tag-object-sha}. Only a full commit id that is not the tag-object sha itself counts; anything else yieldsTAG: present sha=unknown(commit unverified), never a fabricated commit. - A branch named like the tag — cannot shadow the result, because the peel is asked by tag-object sha.
- The prerelease flag missing from the read-back —
NOTE: prerelease_unverified. - Write paths (
POST /releases,PATCH /releases/{id}) are LIVE-UNPROVEN.
prov_init—Authorization: Bearer %s; headerAccept: application/vnd.gitverse.object+json;version=1;FG_RPATH="/repos/$FG_OWNER/$FG_REPO";FG_PRE_SUPPORTED=1;FG_TARGET_DERIVED=0.prov_release_getGETs/releases/tags/{tag}.200→presentwithid,tag_name,prerelease,draft,target_commitish.404falls through to the list check; any other status leaveserror.- The list check: GET
/releases?per_page=1→200meansabsent,404meansgap/releases_unsupported_or_empty. prov_release_createbuilds{tag_name,target_commitish,name,body,draft:false,prerelease}and POSTs;200|201→created,409|422→exists,403|404→refused.prov_release_updatePATCHes{name,body,prerelease}to/releases/{id};200→updated.prov_tag_getGETs/git/matching-refs/tags/{tag}, selects the entry whoserefequalsrefs/tags/<tag>, then: ifobject.type == tagand the sha is full, GET/git/tags/{sha}; when that is not200, GET/commits/{tag-object-sha}and accept its.shaonly if it is a full commit id different from the tag-object sha. FinallyFG_TAG_SHAis set only when the resolved type iscommit.prov_probeGETs the repo,/releases?per_page=1, and/git/matching-refs/tags/.
scripts/forge/providers/gitea.sh— the canonical provider-contract statement this file implements.scripts/forge/forge.sh— the driver; owns--try-create-on-ambiguousand thereleases_unsupported_or_emptyreporting.scripts/forge/lib/http.sh— the HTTP client.config/forge/hosts.tsv— mapsgitverse.rutogitversewith token variableGITVERSE_TOKEN, and records that the release list answers 404 (ambiguous).
2026-12-04 — bash -n scripts/forge/providers/gitverse.sh → exit 0. Contract check a reader can repeat:
bash -c '. scripts/forge/lib/common.sh; . scripts/forge/providers/gitverse.sh; FG_OWNER=o FG_REPO=r; prov_init; \
printf "%s|%s|%s|%s\n" "$FG_AUTH_FMT" "$FG_RPATH" "$FG_PRE_SUPPORTED" "$FG_TARGET_DERIVED"'Expected: Authorization: Bearer %s|/repos/o/r|1|0.