# gotea — AGENTS.md Gotea is a fork of Gitea. The repository backend is moving from `git` to [got](https://got.gameoftrees.org/) (Game of Trees), and the old-browser frontend is a C99/POSIX CGI program serving HTML 4.01 with a CDE/Motif look. The Go forge backend remains the source of truth for accounts, permissions, issues, API, and storage. ## Current state - Base: upstream Gitea v28.4.0, full history, `upstream` remote kept. - Remote: `origin` = `https://git.kropa.tech/hiddenbox/gotea`. This is the only remote to push to; `git.hiddenbox.org` and the 192.168.1.148 SSH host are not gotea's remotes. `upstream` is fetch-only reference to Gitea, never push. - Main module `gotea.dev`; binary `gotea`. Identity strings and the English locale are renamed; upstream copyright notices stay. - The Go backend still calls `modules/git` for most operations. Bare repository creation, `IsEmpty`, `GetDefaultBranch`, `SetDefaultBranch`, `GetBranchCommitID`, and `GetBranchNames` now go through `modules/got`; the rest of the migration is open. - `cgi/gotea-cgi` is the read-only old-browser frontend. It browses bare repositories with `got`; it does not authenticate and has no write path. - Gotea Pages is a prototype: a `pages` branch is checked out with got, built with the vendored `bb` at `third_party/bb`, and served from a separate host. ## Architecture rules - **Do not rewrite the forge backend in C up front.** Authentication, permissions, issues, pull requests, API, and migrations live in Go for good reasons. The C CGI is a presentation tier over the same repositories and can take over UI features incrementally. - The CGI must not call Gotea over HTTP or read its database yet. Its contract is `GOTEA_REPO_ROOT` plus `got`; keep it that way until an auth design exists. - Keep the two tiers separable: the CGI must build and run with only libc, POSIX, and `got`. ## Hard rules - **Brand:** new code, UI strings, docs, and paths use *gotea* / *Gotea*, never *gitea* / *Gitea*. Upstream attribution and compatibility names are exceptions. - **Never blind-replace `git` with `got`.** Keep `git-lfs`, `.git`, `.gitignore`, Git wire-protocol names, `github.com` URLs, and the fact that gotea stores standard Git-format repositories. got is the engine, not a new object format. - **Compatibility renames need an alias or migration, not `sed`:** `GITEA_*` env overrides, `app.ini` keys, DB table/column prefixes, dump formats, and API JSON fields are consumed by users and tooling. - **No new direct `git` subprocesses in runtime code.** New or modified VCS code goes through one got wrapper (`modules/got`). The existing `modules/git` calls are migration debt, not a pattern to copy. - If got genuinely cannot do an operation, stop and record the gap plus a proposed design. Do not silently add a `git` fallback. - **Copyright:** keep upstream Gitea/MIT notices intact. New Go files get `// Copyright The Gotea Authors.` and `// SPDX-License-Identifier: MIT`. New C files use the same SPDX header in C comment form. - **CGI security:** HTML-escape every repository string; never invoke a shell; validate repository names and reject `..`; treat `GOTEA_REPO_ROOT` as public data. Private-repository access needs an auth layer first. ## Frontend rules (cgi/) - HTML 4.01 Transitional. No JavaScript, no `