Files
gitea/AGENTS.md
T
TheFox0x7 1b1274486c fix(git)!: use internal proxy for all git operations (#39426)
Introduces gitproxy module which spawns a small forward proxy as scanner
for git calls
Replaces hostmatcher with matchlist which supports port rules
Deprecates ALLOWED_DOMAINS/BLOCKED_DOMAINS and ALLOW_LOCALNETWORKS
settings in migration in favor of full names we have in security
configs.
Removes `external` preset in favor of lax/strict modes, strict mode
requiring explicit ports if they aren't standard http/s ones.

Breaking changes:
- `external` preset no longer works as deny rule. To enforce that, use
`strict` mode and allow ranges to connect to
- Wildcards are no longer accepted in IP addresses
- `*` is no longer allowed as entry in lists
- domain rules now use curl like syntax `*.example.com` matching
subdomains but not `example.com`, `example.com` matching itself and all
subdomains. `example.*` is not a valid rule
- In the default `lax` mode, `[security] ALLOWED_HOST_LIST` no longer
restricts public hosts, set `EGRESS_MODE = strict` to keep an exclusive
list. A startup warning flags this
- Invalid list entries are logged at startup, invalid
`BLOCKED_HOST_LIST`/`BLOCKED_DOMAINS` entries stop it

Docs: https://gitea.com/gitea/docs/pulls/557
Signed-off-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: bircni <bircni@icloud.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-09-29 14:43:36 +02:00

2.4 KiB

  • Never assume, verify before claiming
  • List development targets with make help
  • Read relevant developer documentation in the docs folder
  • PR descriptions: minimal, only what and why, no task or file listings. Include screenshots for UI changes, before and after when modifying existing UI. Aim for less than 1000 characters
  • Reference issues and PRs by full URL, not by number
  • Use Conventional Commits for commit messages and PR titles, plus Gitea's enhance type for user-facing enhancements
  • Add an Assisted-by: AGENT_NAME:MODEL_VERSION trailer to commit messages, never Co-Authored-By or Signed-off-by
  • Attribute agent authorship on one trailing line in issue and PR comments, never as a PR description section
  • Never rewrite git history unless asked, update PRs with new commits and normal push
  • Comments: write almost none, short and preferably same-line, explaining why for a future reader. Never narrate code, the change or the prompt. Preserve existing ones that still apply. If you need to write a paragraph-long comment, rethink your implementation, it is likely too complicated
  • Add the current year to copyright headers of new .go files
  • In options/locale, only edit locale_en-US.json, other locales are synced automatically
  • In TS, use ! instead of ?./?? when a value always exists
  • In Go, prefer to use modern language features wherever possible
  • Write sizes as multiplications like 64 * 1024, not bit shifts like 64 << 10
  • Prefer tw-* utilities over inline style and flex-* helpers over per-child tw-ml-*/tw-mr-* margins, falling back to tw-* where specificity requires !important
  • Run make fmt after .go edits, make tidy after go.mod edits, make generate-swagger after API changes, and lint what changed with make lint-go, lint-js, lint-css or lint-templates
  • Fix the cause rather than disabling a linter or weakening a test. Where unavoidable, use the narrowest scope with a trailing comment giving the reason
  • Run single tests with go test -run '^TestName$' ./modulepath/ for Go, pnpm exec vitest <path-filter> for TS and GITEA_TEST_E2E_FLAGS='<filepath>' make test-e2e for e2e
  • Write the fewest, fastest tests covering the behavior, extending an existing one where possible. Prefer unit tests where logic is testable in isolation
  • Aim for sub-2s per integration test and sub-4s per e2e test. Wait on a deterministic condition rather than sleep, and prefer semantic locators in e2e tests