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--.
GitFlic adapter (gitflic.ru, API api.gitflic.ru; a self-hosted instance answers under <host>/rest-api).
GitFlic has its own API and is not Gitea-compatible. 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
GitFlic.
The defining constraint: GitFlic has no get-by-tag endpoint.
- A release lookup pages through
GET /project/{o}/{p}/release?page=N&size=S(pages are zero-based) and matchestagNameitself, reading_embedded.releaseTagModelList[]withpage.totalPages/page.number. - A tag lookup pages through
GET .../tag?page&sizereading_embedded.tagList[]and matchingname, becauseGET .../tag/{name}answered 400 in the probe.
Because the forge rate-limits (gitflic.ru allows roughly 500 requests per hour), paging is bounded:
FORGE_GITFLIC_MAX_PAGES (default 20) pages of 50 items. Reaching the cap without a match is reported as
GAP readback_page_cap β never "absent" β because "not found in what we were willing to read" and "not
there" are different facts, and conflating them is exactly the fail-open shape the constitution forbids.
FG_TARGET_DERIVED=0: whether GitFlic's commitId is derived from the tag is UNCONFIRMED / not
live-proven, so it is not trusted. FG_PRE_SUPPORTED=1 (the list carries preRelease).
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.
Optional env var: FORGE_GITFLIC_MAX_PAGES (default 20; must match ^[0-9]{1,3}$ and be at least 1,
otherwise it falls back to 20).
Through forge.sh (this file is not invoked directly):
bash scripts/forge/forge.sh detect --url git@gitflic.ru:org/repo.git
bash scripts/forge/forge.sh probe --url git@gitflic.ru:org/repo.git
bash scripts/forge/forge.sh tag-get --url git@gitflic.ru:org/repo.git --tag v1.0.0
# widen the bounded paging when the release lives deeper in the list
FORGE_GITFLIC_MAX_PAGES=40 bash scripts/forge/forge.sh release-get \
--url git@gitflic.ru:org/repo.git --tag v1.0.0Contract check in isolation:
bash -c '. scripts/forge/lib/common.sh; . scripts/forge/providers/gitflic.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"'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. When _gitflic_find cannot decide within its page
budget it sets _GF_FOUND=cap, which surfaces as GAP readback_page_cap (exit 3 through forge.sh).
User-visible exit codes belong to forge.sh β see docs/scripts/forge.md.
- Page cap reached without a match β
FG_REL_STATE=gapwithreadback_page_capfor a release, andFG_TAG_STATE=unknownfor a tag. Deliberately notabsent: the list was not read to its end. - A non-
200from the list mid-paging β_gitflic_findreturns 0 with_GF_FOUNDleft aterror, so the caller reports an unexpected status rather than inventing an answer. page.totalPagesmissing or non-numeric β the loop stops witherrorrather than looping forever.- A jq failure while extracting the match β returns 0 without setting
_GF_FOUND=1, so a parse problem is never upgraded into a found release. FORGE_GITFLIC_MAX_PAGESinvalid β silently normalised to 20 (documented bound, not a crash).- No draft concept β
FG_REL_DRAFTisfalse, notunknown. - No get-by-tag β a tag lookup measures cost in requests; raising the page cap raises the request count against a 500/hour budget.
- Write paths (
POST .../release,PUT .../release/{id}) are LIVE-UNPROVEN.
GITFLIC_SIZE=50β page size, a file-level constant.prov_initβAuthorization: token %s,Accept: application/json,FG_RPATH="/project/$FG_OWNER/$FG_REPO",FG_PRE_SUPPORTED=1,FG_TARGET_DERIVED=0._gitflic_max_pagesvalidatesFORGE_GITFLIC_MAX_PAGESand prints the effective page budget._gitflic_find KIND TAGwalks pages from 0: forkind=releaseit reads_embedded.releaseTagModelListmatchingtagName; forkind=tagit reads_embedded.tagListmatchingname. A singlejqcounts matches; on a hit the best match is written to$FG_TMP/page.json. It stops onp >= page.totalPages, otherwise_GF_FOUND=capwhen the budget is exhausted.prov_release_getmaps_GF_FOUND1/0/captopresent/absent/gap, extractingid,tagName,preRelease,commitIdfrompage.json.prov_release_createbuilds{title,description,tagName,preRelease,attachProjectArchive:false}and POSTs;200|201βcreated,409βexists.prov_release_updatePUTs{title,description,tagName,preRelease}to/release/{id};200βupdated.prov_tag_getreuses_gitflic_find tag, mapping1/0/captopresent/absent/unknownand takingcommitIdas the sha.prov_probeGETs the project and one-item slices of the release and tag lists.
scripts/forge/providers/gitea.shβ the canonical provider-contract statement this file implements.scripts/forge/forge.shβ the driver; turnscapinto GAPreadback_page_cap.scripts/forge/lib/http.shβ the HTTP client.config/forge/hosts.tsvβ mapsgitflic.rutogitflicwith token variableGITFLIC_TOKEN, and records that the release lookup pages through the list.
2026-12-04 β bash -n scripts/forge/providers/gitflic.sh β exit 0. Contract check a reader can repeat:
bash -c '. scripts/forge/lib/common.sh; . scripts/forge/providers/gitflic.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: token %s|/project/o/r|1|0.