# gitea - Doramagic AI Context Pack

> Positioning: a pre-install experience and judgment asset. It helps the host AI get off to a good start, but it does not mean the project has already been installed, run, or validated.

## Sufficiency Principle

- **Sufficiency over compression**: The AI Context Pack should be sufficient for the host AI to understand the project's value, capability boundaries, entrypoints, risks, and evidence sources before starting work; it may be layered, but it does not aim for the shortest possible summary.
- **Compression policy**: Compress only noise and duplication, never context that affects judgment or the quality of the work.

## How the Host AI Should Use This

You are reading the AI Context Pack that Doramagic compiled for gitea. Treat it as pre-work context: help the user understand who it fits, what it can do, how to start, what must be verified after install, and where the risks are. Do not claim that you have already installed, run, or executed the target project.

## Claim Consumption Rules

- **Fact source**: Repo Evidence + Claim/Evidence Graph; the Human Wiki only supplies salience, terminology, and narrative structure.
- **Minimum status for a fact**: `supported`
- `supported`: May be used as a project fact, but the answer must cite the claim_id and evidence path.
- `weak`: Usable only as a low-confidence lead; the user must be asked to keep verifying.
- `inferred`: Usable only for risk notes or open questions; must not be packaged as a project fact.
- `unverified`: Must not be used as fact; state clearly that evidence is insufficient.
- `contradicted`: Must show the conflicting sources and must not force a single version on the user's behalf.

## Who It Fits Best

- **Users who want to understand an open-source project's value and boundaries before installing**: Current evidence comes mainly from project documentation. Evidence: `README.md` Claim: `clm_0002` supported 0.86

## What It Can Do

- **Command-Line Startup or Install Flow** (Verify after install): The project documentation contains runnable commands; real use requires running them in a local or host environment. Evidence: `contrib/upgrade.sh`, `docs/build-setup.md` Claim: `clm_0001` supported 0.86

## How to Start

- `git clone https://github.com/go-gitea/gitea` Evidence: `docs/build-setup.md` Claim: `clm_0003` supported 0.86
- `curl --connect-timeout 10 --silent --show-error --fail --location -O "$binurl{,.sha256,.asc}"` Evidence: `contrib/upgrade.sh` Claim: `clm_0004` unverified 0.25
- `curl -fsSL --connect-timeout 10 "https://keys.openpgp.org/vks/v1/by-fingerprint/7C9E68152594688862D62AF62D9AE806EC1592E2" | gpg --import \` Evidence: `contrib/upgrade.sh` Claim: `clm_0005` unverified 0.25

## Continue-or-Stop Decision Card

- **Current recommendation**: Trial role matching first
- **Why**: This project is more of a role library; the core risk is picking the wrong role or treating role copy as execution capability. Trial role matching with Prompt Preview first, then decide whether to sandbox-import it.

### 30-Second Read

- **What to do now**: Trial role matching first
- **Minimum safe next step**: Trial role matching with Prompt Preview first; import in isolation only once satisfied
- **Do not trust yet**: Role quality and task fit cannot be trusted directly.
- **Continuing will touch**: Role selection bias, Command execution, Host AI configuration

### What You Can Trust Now

- **Target-audience signal: Users who want to understand an open-source project's value and boundaries before installing** (supported): Backed by a supported claim or project evidence, but that still is not the same as real install results. Evidence: `README.md` Claim: `clm_0002` supported 0.86
- **Capability exists: Command-Line Startup or Install Flow** (supported): You can trust that the project contains signals of this capability; whether it fits your specific task still needs trial or after-install verification. Evidence: `contrib/upgrade.sh`, `docs/build-setup.md` Claim: `clm_0001` supported 0.86
- **There are Quick Start / install-command signals** (supported): You can trust that the docs mention a startup or install entrypoint; do not run it directly in your primary environment because of that. Evidence: `docs/build-setup.md` Claim: `clm_0003` supported 0.86

### What You Cannot Trust Yet

- **Role quality and task fit cannot be trusted directly.** (unverified): A role library proves there are many roles; it does not prove each one fits your specific task or that a role produces high-quality results.
- **Do not treat role copy as real execution capability.** (unverified): Before install you can only judge whether the role description and task profile match; you cannot prove it can complete the task inside the host AI.
- **Real output quality cannot be trusted before install.** (unverified): Prompt Preview can only show how it guides you; it cannot prove result quality in the real project.
- **Host AI version compatibility cannot be trusted before install.** (unverified): Host loading rules and version differences across Claude, Cursor, Codex, Gemini, and others must be verified in a real environment.
- **That it will not pollute your existing host AI's behavior cannot be trusted directly.** (inferred): Skill, plugin, and AGENTS/CLAUDE/GEMINI instructions may change the host AI's default behavior. Evidence: `AGENTS.md`, `CLAUDE.md`
- **Safe rollback cannot be assumed by default.** (unverified): Unless the project clearly provides uninstall and recovery instructions, verify in an isolated environment first.
- **After a real install, is it compatible with the user's current host AI version?** (unverified): Compatibility can only be verified in the actual host environment.
- **Does the project's output quality meet the user's specific task?** (unverified): The pre-install preview can only show flow and boundaries; it cannot replace real evaluation.

### What Continuing Will Touch

- **Role selection bias**: The user's judgment about which expert role should handle the task. Why: Picking the wrong role makes the AI answer from the wrong expert perspective, wasting time or misleading decisions.
- **Command execution**: Package managers, network downloads, the local plugin directory, project config, or the user's home directory. Why: Running the very first command can already change your environment; decide whether it is worth running first. Evidence: `contrib/upgrade.sh`, `docs/build-setup.md`
- **Host AI configuration**: The plugin, Skill, or rule-loading config of hosts like Claude/Codex/Cursor/Gemini/OpenCode. Why: Host configuration changes how the AI works afterward and may conflict with the user's existing rules. Evidence: `AGENTS.md`, `CLAUDE.md`
- **Local environment or project files**: Install results, plugin caches, project config, or local dependency directories. Why: The write scope and rollback path cannot be proven before install and need isolated verification. Evidence: `contrib/upgrade.sh`, `docs/build-setup.md`
- **Host AI context**: The AI Context Pack, Prompt Preview, Skill routing, risk rules, and project facts. Why: Importing context affects the host AI's later judgment, so avoid packaging unverified items as facts.

### Minimum Safe Next Steps

- **Run Prompt Preview first**: Use an interactive trial to verify the task profile and role match first; do not import the whole role library up front. (applies when: Applies to any project, especially when output quality is unknown.)
- **Trial-install only in an isolated directory or a test account**: Avoid letting install commands pollute your primary host AI, real projects, or home directory. (applies when: When there are signals of command execution, plugin config, or local writes.)
- **Back up your host AI configuration first**: Skill, plugin, and rule files may change the default behavior of Claude/Cursor/Codex. (applies when: When there is a plugin manifest, a Skill, or a host rule entrypoint.)
- **After install, verify just one minimal task**: Verify loading, compatibility, output quality, and rollback first, then decide whether to use it deeply. (applies when: When moving from a trial into a real workflow.)

### Exit Plan

- **Preserve the pre-install state**: Record the original host config and project state so you can later judge whether it is recoverable.
- **Be ready to remove the host plugin / Skill / rule entrypoint**: If behavior is off after the trial install, you can restore the host AI to its pre-trial state.
- **Keep a record of the original role selection**: If output goes off-topic, you can return to the task-profiling stage and reselect a role instead of pushing on with the wrong one.
- **Record the install commands and written paths**: Without clear uninstall instructions, you at least need to know which directories or configs to clean up manually.
- **If there is no rollback path, do not enter your primary environment**: No rollback is a blocker before continuing; do not proceed on trust or luck.

## What Can Only Be Previewed

- Explain who the project fits and what it can do
- Demonstrate a typical conversation flow based on project docs
- Help the user decide whether it is worth installing or researching further

## What Must Be Verified After Install

- Actually installing the Skill, plugin, or CLI
- Running scripts, modifying local files, or accessing external services
- Verifying real output quality, performance, and compatibility

## Boundary & Risk Decision Card

- **Mistaking the pre-install preview for a real run**: The user may overestimate how much configuration, permission, and compatibility verification the project has already done. Mitigation: Clearly separate prompt_preview_can_do from runtime_required. Claim: `clm_0006` inferred 0.45
- **Command execution will modify the local environment**: Install commands may write to the user's home directory, the host plugin directory, or project configuration. Mitigation: Run in an isolated environment or a test account first. Evidence: `contrib/upgrade.sh`, `docs/build-setup.md` Claim: `clm_0007` supported 0.86
- **To confirm**: After a real install, is it compatible with the user's current host AI version?. Why: Compatibility can only be verified in the actual host environment.
- **To confirm**: Does the project's output quality meet the user's specific task?. Why: The pre-install preview can only show flow and boundaries; it cannot replace real evaluation.
- **To confirm**: Do the install commands require network access, permissions, or global writes?. Why: This affects install risk in both enterprise and personal environments.

## Pre-Work Working Context

### Loading Order

- First read how_to_use.host_ai_instruction to establish the boundaries of this pre-install judgment asset.
- Read claim_graph_summary to confirm facts come from the Claim/Evidence Graph, not the Human Wiki narrative.
- Then read intended_users, capabilities, and quick_start_candidates to judge whether the user is a match.
- When you need to carry out a concrete task, check role_skill_index first, then evidence_index.
- For real install, file modification, network access, performance, or compatibility questions, turn to risk_card and boundaries.runtime_required.

### Task Routes

- **Command-Line Startup or Install Flow**: State that this is an after-install capability first, then give a pre-install checklist. Boundary: Must be verified after a real install or run. Evidence: `contrib/upgrade.sh`, `docs/build-setup.md` Claim: `clm_0001` supported 0.86

### Context Scale

- Total files: 4221
- Important-file coverage: 40/4221
- Evidence index entries: 80
- Role / Skill entries: 20

### Handling Insufficient Evidence

- **missing_evidence**: State that evidence is insufficient and ask the user for the target file, a README section, or after-install verification records; do not fill in facts.
- **out_of_scope_request**: State that the task is beyond the current AI Context Pack's evidence scope and suggest the user check the Human Manual or verify after a real install.
- **runtime_request**: Provide a pre-install checklist and command sources, but do not run commands for the user or claim they have been run.
- **source_conflict**: Show the conflicting sources side by side, mark them as unverified, and do not force a single version.

## Prompt Recipes

### Fit assessment

- Goal: Judge whether this project fits the user's current task.
- Expected output: A fit conclusion, key reasons, evidence citations, what can be previewed before install, what must be verified after install, and a next-step recommendation.

```text
Based on the AI Context Pack for gitea, ask me 3 necessary questions first, then judge whether it fits my task. The answer must cover: who it fits, what it can do, what it cannot do, whether it is worth installing, and where the evidence comes from. Every project fact must cite evidence_refs, source_paths, or a claim_id.
```

### Pre-install experience

- Goal: Let the user feel the core workflow before installing, while avoiding packaging the preview as real capability or a marketing promise.
- Expected output: An experience script with boundary labels, an after-install verification checklist, and a cautious recommendation; with no real-run promises or strong marketing language.

```text
Treat gitea as a pre-install experience asset, not an already-installed tool or a real runtime environment.

Output exactly four parts:
1. Ask me 3 necessary questions first.
2. Give an "experience script": use the three labels [Previewable before install], [Must verify after install], and [Insufficient evidence] to show how it might guide the workflow.
3. Give an after-install verification checklist: list which capabilities can only be confirmed after a real install, real host loading, and a real project run.
4. Give a cautious recommendation: only "worth researching/trialing further", "add information before deciding", or "not recommended to continue"; do not endorse the project.

Hard boundaries:
- Do not claim you have installed, run, executed tests, modified files, or produced real results.
- Do not write promise-like phrasing such as "auto-adapts", "guarantees passing", "perfect fit", or "strongly recommend installing".
- If you describe how it works after install, you must use a conditional such as "if installed successfully and the host loads the Skill correctly, it might...".
- The experience script may only be written as "example lines / hypothetical flow": use "might ask / might suggest / might show", not "has written, has generated, has passed, is running, is generating".
- Prompt Preview does not hand out install commands; if the user is ready to trial, only prompt them to read Quick Start and the Risk Card first and to verify in an isolated environment.
- Every project fact must come from a supported claim, evidence_refs, or source_paths; inferred/unverified items can only be risks or open questions.

```

### Role / Skill selection

- Goal: Pick the best-matching asset from the project's roles or Skills.
- Expected output: A list of candidate roles or Skills, each with an applicable scenario, evidence paths, risk boundary, and whether after-install verification is needed.

```text
Read role_skill_index and recommend 3-5 of the most relevant roles or Skills for my target task. For each recommendation, state the applicable scenario, likely output, risk boundary, and evidence_refs.
```

### Risk pre-check

- Goal: Identify environment, permission, rule-conflict, and quality risks before installing or adopting.
- Expected output: A checklist of environment, permission, dependency, license, host-conflict, quality risk, and unknown items.

```text
Based on risk_card, boundaries, and quick_start_candidates, give me a pre-install risk pre-check list. Do not run commands for me; only explain what I should check, why, and what impact a failure would have.
```

### Host AI kickoff instruction

- Goal: Turn the project context into a host AI instruction for the start of a conversation.
- Expected output: A pre-work instruction with clear boundaries and clear evidence citations, suitable to copy to a host AI.

```text
Based on the AI Context Pack for gitea, generate a pre-work instruction I can paste to my host AI. This instruction must obey not_runtime=true and must not claim the project has been installed, run, or produced real results.
```

## Role / Skill Index

- Indexed 20 role / Skill / project-doc entries.

- **Agents** (project_doc): - Use make help to find available development targets - Run make fmt to format .go files, and run make lint-go to lint them - Run make lint-js to lint .ts files - Run make tidy after any go.mod changes - Run single go tests with go test -run '^TestName$' ./modulepath/ - Run single js test files with pnpm exec vitest - Run single playwright e2e test files with GITEA TEST E2E FLAGS=' ' make test-e2e - Add the current… Activation hint: Reference this when the user needs to understand the project's structure, install path, or boundaries. Evidence: `AGENTS.md`
- **Claude** (project_doc):  Activation hint: Reference this when the user needs to understand the project's structure, install path, or boundaries. Evidence: `CLAUDE.md`
- **Gitea** (project_doc): ! https://github.com/go-gitea/gitea/actions/workflows/release-nightly.yml/badge.svg?branch=main https://github.com/go-gitea/gitea/actions/workflows/release-nightly.yml?query=branch%3Amain "Release Nightly" ! https://img.shields.io/discord/322538954119184384.svg?logo=discord&logoColor=white&label=Discord&color=5865F2 https://discord.gg/Gitea "Join the Discord chat at https://discord.gg/Gitea" ! https://goreportcard.c… Activation hint: Reference this when the user needs to understand the project's structure, install path, or boundaries. Evidence: `README.md`
- **Gitea - Docker** (project_doc): Dockerfile is found in the root of the repository. Activation hint: Reference this when the user needs to understand the project's structure, install path, or boundaries. Evidence: `docker/README.md`
- **IDE and code editor configuration** (project_doc): - IDE and code editor configuration ide-and-code-editor-configuration - Microsoft Visual Studio Code microsoft-visual-studio-code Activation hint: Reference this when the user needs to understand the project's structure, install path, or boundaries. Evidence: `contrib/development/README.md`
- **Gitea Mixin** (project_doc): Gitea Mixin is a set of configurable Grafana dashboards based on the metrics exported by the Gitea built-in metrics endpoint. Activation hint: Reference this when the user needs to understand the project's structure, install path, or boundaries. Evidence: `contrib/grafana-monitoring-mixin/README.md`
- **Git Module** (project_doc): This module is merged from https://github.com/go-gitea/git which is a Go module to access Git through shell commands. Now it's a part of gitea's main repository for easier pull request. Activation hint: Reference this when the user needs to understand the project's structure, install path, or boundaries. Evidence: `modules/git/README.md`
- **Gitea Package Registry** (project_doc): This document gives a brief overview how the package registry is organized in code. Activation hint: Reference this when the user needs to understand the project's structure, install path, or boundaries. Evidence: `routers/api/packages/README.md`
- **Gitea LDAP Authentication Module** (project_doc): This authentication module attempts to authorize and authenticate a user against an LDAP server. It provides two methods of authentication: LDAP via BindDN, and LDAP simple authentication. Activation hint: Reference this when the user needs to understand the project's structure, install path, or boundaries. Evidence: `services/auth/source/ldap/README.md`
- **Web Components** (project_doc): This webcomponents directory contains the source code for the web components used in the Gitea Web UI. Activation hint: Reference this when the user needs to understand the project's structure, install path, or boundaries. Evidence: `web_src/js/webcomponents/README.md`
- **Contribution Guidelines** (project_doc): This document explains how to contribute changes to the Gitea project. Topic-specific guides live in separate files so the essentials are easier to find. Activation hint: Reference this when the user needs to understand the project's structure, install path, or boundaries. Evidence: `CONTRIBUTING.md`
- **Setup and requirements** (project_doc): This document lists the tools you need to build Gitea from source and how to get the code. Once your environment is ready, see development.md development.md for the build and development workflow, and testing.md testing.md for running tests. Activation hint: Reference this when the user needs to understand the project's structure, install path, or boundaries. Evidence: `docs/build-setup.md`
- **Prepare build environment** (project_doc): Complete the steps in build-setup.md build-setup.md to prepare your environment for building Gitea from source. Activation hint: Reference this when the user needs to understand the project's structure, install path, or boundaries. Evidence: `docs/build-source.md`
- **Community governance and review process** (project_doc): Community governance and review process Activation hint: Reference this when the user needs to understand the project's structure, install path, or boundaries. Evidence: `docs/community-governance.md`
- **Development** (project_doc): This document describes how to build Gitea from source and the day-to-day development workflow. For prerequisites and how to obtain the code, see build-setup.md build-setup.md . For running tests, see testing.md testing.md . For the contribution workflow and review process, see CONTRIBUTING.md ../CONTRIBUTING.md . Activation hint: Reference this when the user needs to understand the project's structure, install path, or boundaries. Evidence: `docs/development.md`
- **Backend development guidelines** (project_doc): This document covers backend-specific architecture and contribution expectations. For the general workflow see CONTRIBUTING.md ../CONTRIBUTING.md , and for building and testing see development.md development.md and testing.md testing.md . Activation hint: Reference this when the user needs to understand the project's structure, install path, or boundaries. Evidence: `docs/guidelines-backend.md`
- **Frontend development guidelines** (project_doc): This document covers frontend-specific architecture and contribution expectations. For the general workflow see CONTRIBUTING.md ../CONTRIBUTING.md , and for building and testing see development.md development.md and testing.md testing.md . Activation hint: Reference this when the user needs to understand the project's structure, install path, or boundaries. Evidence: `docs/guidelines-frontend.md`
- **Refactoring guidelines** (project_doc): This document covers expectations for refactoring work. For the general workflow see CONTRIBUTING.md ../CONTRIBUTING.md . Activation hint: Reference this when the user needs to understand the project's structure, install path, or boundaries. Evidence: `docs/guidelines-refactoring.md`
- **Release management** (project_doc): This document describes the release cycle, backports, versioning, and the release manager checklist. For everyday contribution workflow, see CONTRIBUTING.md ../CONTRIBUTING.md . Activation hint: Reference this when the user needs to understand the project's structure, install path, or boundaries. Evidence: `docs/release-management.md`
- **Testing** (project_doc): Gitea has four kinds of automated tests: backend unit tests, integration tests, end-to-end e2e tests, and migration tests. Local runs default to SQLite, so no extra services are required to get started. Activation hint: Reference this when the user needs to understand the project's structure, install path, or boundaries. Evidence: `docs/testing.md`

## Evidence Index

- Indexed 80 evidence entries.

- **Agents** (documentation): - Use make help to find available development targets - Run make fmt to format .go files, and run make lint-go to lint them - Run make lint-js to lint .ts files - Run make tidy after any go.mod changes - Run single go tests with go test -run '^TestName$' ./modulepath/ - Run single js test files with pnpm exec vitest - Run single playwright e2e test files with GITEA TEST E2E FLAGS=' ' make test-e2e - Add the current year into the copyright header of new .go files - Ensure no trailing whitespace in edited files - Use Conventional Commits for commit messages and PR titles, e.g. type scope : subject ; ! before the colon if breaking. Use test type for test-only changes. - Never force-push, amend… Evidence: `AGENTS.md`
- **Claude** (documentation): @AGENTS.md Evidence: `CLAUDE.md`
- **Gitea** (documentation): ! https://github.com/go-gitea/gitea/actions/workflows/release-nightly.yml/badge.svg?branch=main https://github.com/go-gitea/gitea/actions/workflows/release-nightly.yml?query=branch%3Amain "Release Nightly" ! https://img.shields.io/discord/322538954119184384.svg?logo=discord&logoColor=white&label=Discord&color=5865F2 https://discord.gg/Gitea "Join the Discord chat at https://discord.gg/Gitea" ! https://goreportcard.com/badge/gitea.dev https://goreportcard.com/report/gitea.dev "Go Report Card" ! https://pkg.go.dev/badge/gitea.dev?status.svg https://pkg.go.dev/gitea.dev "GoDoc" ! https://img.shields.io/github/release/go-gitea/gitea.svg https://github.com/go-gitea/gitea/releases/latest "GitHub… Evidence: `README.md`
- **Gitea - Docker** (documentation): Dockerfile is found in the root of the repository. Evidence: `docker/README.md`
- **IDE and code editor configuration** (documentation): - IDE and code editor configuration ide-and-code-editor-configuration - Microsoft Visual Studio Code microsoft-visual-studio-code Evidence: `contrib/development/README.md`
- **Gitea Mixin** (documentation): Gitea Mixin is a set of configurable Grafana dashboards based on the metrics exported by the Gitea built-in metrics endpoint. Evidence: `contrib/grafana-monitoring-mixin/README.md`
- **Git Module** (documentation): This module is merged from https://github.com/go-gitea/git which is a Go module to access Git through shell commands. Now it's a part of gitea's main repository for easier pull request. Evidence: `modules/git/README.md`
- **Gitea Package Registry** (documentation): This document gives a brief overview how the package registry is organized in code. Evidence: `routers/api/packages/README.md`
- **Gitea LDAP Authentication Module** (documentation): This authentication module attempts to authorize and authenticate a user against an LDAP server. It provides two methods of authentication: LDAP via BindDN, and LDAP simple authentication. Evidence: `services/auth/source/ldap/README.md`
- **Web Components** (documentation): This webcomponents directory contains the source code for the web components used in the Gitea Web UI. Evidence: `web_src/js/webcomponents/README.md`
- **Package** (package_manifest): { "type": "module", "packageManager": "pnpm@11.9.0", "engines": { "node": " = 22.18.0", "pnpm": " = 11.0.0" }, "dependencies": { "@citation-js/core": "0.7.21", "@citation-js/plugin-bibtex": "0.7.21", "@citation-js/plugin-csl": "0.7.22", "@citation-js/plugin-software-formats": "0.6.2", "@codemirror/autocomplete": "6.20.3", "@codemirror/commands": "6.10.4", "@codemirror/lang-json": "6.0.2", "@codemirror/lang-markdown": "6.5.0", "@codemirror/language": "6.12.4", "@codemirror/language-data": "6.5.2", "@codemirror/legacy-modes": "6.5.3", "@codemirror/lint": "6.9.7", "@codemirror/search": "6.7.1", "@codemirror/state": "6.7.0", "@codemirror/view": "6.43.4", "@deltablot/dropzone": "7.4.3", "@github… Evidence: `package.json`
- **Contribution Guidelines** (documentation): This document explains how to contribute changes to the Gitea project. Topic-specific guides live in separate files so the essentials are easier to find. Evidence: `CONTRIBUTING.md`
- **License** (source_file): Copyright c 2016 The Gitea Authors Copyright c 2015 The Gogs Authors Evidence: `LICENSE`
- **License** (source_file): Copyright c 2016 The Gitea Authors Copyright c GitHub, Inc. and LFS Test Server contributors Evidence: `modules/lfs/LICENSE`
- **Setup and requirements** (documentation): This document lists the tools you need to build Gitea from source and how to get the code. Once your environment is ready, see development.md development.md for the build and development workflow, and testing.md testing.md for running tests. Evidence: `docs/build-setup.md`
- **Prepare build environment** (documentation): Complete the steps in build-setup.md build-setup.md to prepare your environment for building Gitea from source. Evidence: `docs/build-source.md`
- **Community governance and review process** (documentation): Community governance and review process Evidence: `docs/community-governance.md`
- **Development** (documentation): This document describes how to build Gitea from source and the day-to-day development workflow. For prerequisites and how to obtain the code, see build-setup.md build-setup.md . For running tests, see testing.md testing.md . For the contribution workflow and review process, see CONTRIBUTING.md ../CONTRIBUTING.md . Evidence: `docs/development.md`
- **Backend development guidelines** (documentation): This document covers backend-specific architecture and contribution expectations. For the general workflow see CONTRIBUTING.md ../CONTRIBUTING.md , and for building and testing see development.md development.md and testing.md testing.md . Evidence: `docs/guidelines-backend.md`
- **Frontend development guidelines** (documentation): This document covers frontend-specific architecture and contribution expectations. For the general workflow see CONTRIBUTING.md ../CONTRIBUTING.md , and for building and testing see development.md development.md and testing.md testing.md . Evidence: `docs/guidelines-frontend.md`
- **Refactoring guidelines** (documentation): This document covers expectations for refactoring work. For the general workflow see CONTRIBUTING.md ../CONTRIBUTING.md . Evidence: `docs/guidelines-refactoring.md`
- **Release management** (documentation): This document describes the release cycle, backports, versioning, and the release manager checklist. For everyday contribution workflow, see CONTRIBUTING.md ../CONTRIBUTING.md . Evidence: `docs/release-management.md`
- **Testing** (documentation): Gitea has four kinds of automated tests: backend unit tests, integration tests, end-to-end e2e tests, and migration tests. Local runs default to SQLite, so no extra services are required to get started. Evidence: `docs/testing.md`
- **Admin User** (source_file): package cmd ⋮---- import "github.com/urfave/cli/v3" ⋮---- "github.com/urfave/cli/v3" ⋮---- func newUserCommand cli.Command Evidence: `cmd/admin_user.go`
- **Dump Repo** (source_file): package cmd ⋮---- import "context" "errors" "fmt" "os" "strings" "gitea.dev/modules/git" "gitea.dev/modules/log" base "gitea.dev/modules/migration" "gitea.dev/modules/setting" "gitea.dev/modules/structs" "gitea.dev/modules/util" "gitea.dev/services/convert" "gitea.dev/services/migrations" "github.com/urfave/cli/v3" ⋮---- "context" "errors" "fmt" "os" "strings" ⋮---- "gitea.dev/modules/git" "gitea.dev/modules/log" base "gitea.dev/modules/migration" "gitea.dev/modules/setting" "gitea.dev/modules/structs" "gitea.dev/modules/util" "gitea.dev/services/convert" "gitea.dev/services/migrations" ⋮---- "github.com/urfave/cli/v3" ⋮---- func newDumpRepositoryCommand cli.Command ⋮---- func runDumpReposi… Evidence: `cmd/dump_repo.go`
- **Main** (source_file): package cmd ⋮---- import "context" "errors" "fmt" "io" "os" "gitea.dev/modules/log" "gitea.dev/modules/setting" "github.com/urfave/cli/v3" ⋮---- "context" "errors" "fmt" "io" "os" ⋮---- "gitea.dev/modules/log" "gitea.dev/modules/setting" ⋮---- "github.com/urfave/cli/v3" ⋮---- var cliHelpPrinterOld = cli.HelpPrinter ⋮---- func init ⋮---- func cliHelpPrinterNew out io.Writer, templ string, data any ⋮---- func PrepareSubcommandWithGlobalFlags originCmd cli.Command ⋮---- // prepareWorkPathAndCustomConf tries to prepare the work path, custom path and custom config from various inputs: // command line flags, environment variables, config file func prepareWorkPathAndCustomConf cmd cli.Command ⋮---… Evidence: `cmd/main.go`
- **Restore Repo** (source_file): package cmd ⋮---- import "context" "strings" "gitea.dev/modules/private" "gitea.dev/modules/setting" "github.com/urfave/cli/v3" ⋮---- "context" "strings" ⋮---- "gitea.dev/modules/private" "gitea.dev/modules/setting" ⋮---- "github.com/urfave/cli/v3" ⋮---- func newRestoreRepositoryCommand cli.Command ⋮---- func runRestoreRepository ctx context.Context, c cli.Command error ⋮---- var units string Evidence: `cmd/restore_repo.go`
- **Web** (source_file): package cmd ⋮---- import "context" "fmt" "net" "net/http" "net/http/pprof" "os" "path/filepath" "strconv" "strings" "time" "gitea.dev/modules/container" "gitea.dev/modules/graceful" "gitea.dev/modules/gtprof" "gitea.dev/modules/log" "gitea.dev/modules/process" "gitea.dev/modules/public" "gitea.dev/modules/setting" "gitea.dev/modules/templates" "gitea.dev/modules/util" "gitea.dev/routers" "gitea.dev/routers/install" "github.com/felixge/fgprof" "github.com/urfave/cli/v3" ⋮---- "context" "fmt" "net" "net/http" "net/http/pprof" "os" "path/filepath" "strconv" "strings" "time" ⋮---- "gitea.dev/modules/container" "gitea.dev/modules/graceful" "gitea.dev/modules/gtprof" "gitea.dev/modules/log" "gite… Evidence: `cmd/web.go`
- **Main** (source_file): package main ⋮---- import "os" "runtime" "strings" "time" "gitea.dev/cmd" "gitea.dev/modules/log" "gitea.dev/modules/setting" "gitea.dev/modules/markup/console" "gitea.dev/modules/markup/csv" "gitea.dev/modules/markup/jupyter" "gitea.dev/modules/markup/markdown" "gitea.dev/modules/markup/orgmode" "github.com/urfave/cli/v3" ⋮---- "os" "runtime" "strings" "time" ⋮---- "gitea.dev/cmd" "gitea.dev/modules/log" "gitea.dev/modules/setting" ⋮---- "gitea.dev/modules/markup/console" "gitea.dev/modules/markup/csv" "gitea.dev/modules/markup/jupyter" "gitea.dev/modules/markup/markdown" "gitea.dev/modules/markup/orgmode" ⋮---- "github.com/urfave/cli/v3" ⋮---- var Version = "development" Tags = "" // the… Evidence: `main.go`
- **Repo** (source_file): package models ⋮---- import "context" "strconv" "strings" "gitea.dev/models/db" issues model "gitea.dev/models/issues" repo model "gitea.dev/models/repo" "gitea.dev/models/unit" user model "gitea.dev/models/user" "gitea.dev/modules/log" "image/jpeg" "xorm.io/builder" ⋮---- "context" "strconv" "strings" ⋮---- "gitea.dev/models/db" issues model "gitea.dev/models/issues" repo model "gitea.dev/models/repo" "gitea.dev/models/unit" user model "gitea.dev/models/user" "gitea.dev/modules/log" ⋮---- "image/jpeg" ⋮---- "xorm.io/builder" ⋮---- func Init ctx context.Context error ⋮---- type repoChecker struct { querySQL func ctx context.Context int64, error correctSQL func ctx context.Context, id int64… Evidence: `models/repo.go`
- **Init** (source_file): package routers ⋮---- import "context" "net/http" "reflect" "runtime" "gitea.dev/models" authmodel "gitea.dev/models/auth" "gitea.dev/modules/cache" "gitea.dev/modules/eventsource" "gitea.dev/modules/git" "gitea.dev/modules/git/gitcmd" "gitea.dev/modules/log" "gitea.dev/modules/markup" "gitea.dev/modules/markup/external" "gitea.dev/modules/setting" "gitea.dev/modules/ssh" "gitea.dev/modules/storage" "gitea.dev/modules/svg" "gitea.dev/modules/system" "gitea.dev/modules/translation" "gitea.dev/modules/util" "gitea.dev/modules/web" "gitea.dev/modules/web/routing" actions router "gitea.dev/routers/api/actions" packages router "gitea.dev/routers/api/packages" apiv1 "gitea.dev/routers/api/v1" "gi… Evidence: `routers/init.go`
- **Run** (source_file): package actions ⋮---- import "context" "errors" "fmt" "net/url" "strings" "time" "gitea.dev/models/db" repo model "gitea.dev/models/repo" user model "gitea.dev/models/user" "gitea.dev/modules/git" "gitea.dev/modules/json" "gitea.dev/modules/log" "gitea.dev/modules/setting" api "gitea.dev/modules/structs" "gitea.dev/modules/timeutil" "gitea.dev/modules/util" webhook module "gitea.dev/modules/webhook" "xorm.io/builder" ⋮---- "context" "errors" "fmt" "net/url" "strings" "time" ⋮---- "gitea.dev/models/db" repo model "gitea.dev/models/repo" user model "gitea.dev/models/user" "gitea.dev/modules/git" "gitea.dev/modules/json" "gitea.dev/modules/log" "gitea.dev/modules/setting" api "gitea.dev/module… Evidence: `models/actions/run.go`
- **Runner** (source_file): package actions ⋮---- import "context" "errors" "fmt" "strings" "time" runnerv1 "gitea.dev/actions-proto-go/runner/v1" "gitea.dev/models/db" repo model "gitea.dev/models/repo" "gitea.dev/models/shared/types" user model "gitea.dev/models/user" "gitea.dev/modules/container" "gitea.dev/modules/optional" "gitea.dev/modules/setting" "gitea.dev/modules/timeutil" "gitea.dev/modules/translation" "gitea.dev/modules/util" "xorm.io/builder" ⋮---- "context" "errors" "fmt" "strings" "time" ⋮---- runnerv1 "gitea.dev/actions-proto-go/runner/v1" "gitea.dev/models/db" repo model "gitea.dev/models/repo" "gitea.dev/models/shared/types" user model "gitea.dev/models/user" "gitea.dev/modules/container" "gitea.de… Evidence: `models/actions/runner.go`
- **Task** (source_file): package actions ⋮---- import "context" "crypto/subtle" "errors" "fmt" "strings" "time" runnerv1 "gitea.dev/actions-proto-go/runner/v1" auth model "gitea.dev/models/auth" "gitea.dev/models/db" "gitea.dev/models/unit" "gitea.dev/modules/actions/jobparser" "gitea.dev/modules/log" "gitea.dev/modules/setting" "gitea.dev/modules/timeutil" "gitea.dev/modules/util" lru "github.com/hashicorp/golang-lru/v2" "google.golang.org/protobuf/types/known/timestamppb" "xorm.io/builder" ⋮---- "context" "crypto/subtle" "errors" "fmt" "strings" "time" ⋮---- runnerv1 "gitea.dev/actions-proto-go/runner/v1" auth model "gitea.dev/models/auth" "gitea.dev/models/db" "gitea.dev/models/unit" "gitea.dev/modules/actions/j… Evidence: `models/actions/task.go`
- **Task** (source_file): package admin ⋮---- import "context" "fmt" "gitea.dev/models/db" repo model "gitea.dev/models/repo" user model "gitea.dev/models/user" "gitea.dev/modules/json" "gitea.dev/modules/log" "gitea.dev/modules/migration" "gitea.dev/modules/secret" "gitea.dev/modules/setting" "gitea.dev/modules/structs" "gitea.dev/modules/timeutil" "gitea.dev/modules/util" "xorm.io/builder" ⋮---- "context" "fmt" ⋮---- "gitea.dev/models/db" repo model "gitea.dev/models/repo" user model "gitea.dev/models/user" "gitea.dev/modules/json" "gitea.dev/modules/log" "gitea.dev/modules/migration" "gitea.dev/modules/secret" "gitea.dev/modules/setting" "gitea.dev/modules/structs" "gitea.dev/modules/timeutil" "gitea.dev/modules/… Evidence: `models/admin/task.go`
- **Context** (source_file): package db ⋮---- import "context" "database/sql" "errors" "runtime" "slices" "sync" "gitea.dev/modules/setting" "xorm.io/builder" "xorm.io/xorm" ⋮---- "context" "database/sql" "errors" "runtime" "slices" "sync" ⋮---- "gitea.dev/modules/setting" ⋮---- "xorm.io/builder" "xorm.io/xorm" ⋮---- type contextKey struct{ key string } ⋮---- var contextKeyEngine = contextKey{"engine"} ContextKeyTestFixtures = contextKey{"test-fixtures"} ⋮---- func withContextEngine ctx context.Context, e Engine context.Context ⋮---- var contextSafetyOnce sync.Once contextSafetyDeniedFuncPCs uintptr ⋮---- func contextSafetyCheck e Engine ⋮---- type m struct{} ⋮---- func GetEngine ctx context.Context Engine ⋮---- func G… Evidence: `models/db/context.go`
- **Engine** (source_file): package db ⋮---- import "context" "database/sql" "fmt" "reflect" "strings" "github.com/go-sql-driver/mysql" "github.com/lib/pq" "github.com/microsoft/go-mssqldb" "xorm.io/xorm" "xorm.io/xorm/core" "xorm.io/xorm/dialects" "xorm.io/xorm/names" "xorm.io/xorm/schemas" ⋮---- "context" "database/sql" "fmt" "reflect" "strings" ⋮---- "github.com/go-sql-driver/mysql" "github.com/lib/pq" "github.com/microsoft/go-mssqldb" ⋮---- "xorm.io/xorm" "xorm.io/xorm/core" "xorm.io/xorm/dialects" "xorm.io/xorm/names" "xorm.io/xorm/schemas" ⋮---- var xormEngine xorm.Engine registeredModels any registeredInitFuncs func error ⋮---- type SQLSession interface { Count ...any int64, error Decr column string, arg ...any… Evidence: `models/db/engine.go`
- **Engine Init** (source_file): package db ⋮---- import "context" "fmt" "gitea.dev/modules/log" "gitea.dev/modules/setting" "xorm.io/xorm" "xorm.io/xorm/names" ⋮---- "context" "fmt" ⋮---- "gitea.dev/modules/log" "gitea.dev/modules/setting" ⋮---- "xorm.io/xorm" "xorm.io/xorm/names" ⋮---- func init ⋮---- func newXORMEngine xorm.Engine, error ⋮---- func InitEngine ctx context.Context error ⋮---- func SetDefaultEngine ctx context.Context, eng xorm.Engine ⋮---- func UnsetDefaultEngine ⋮---- func InitEngineWithMigration ctx context.Context, migrateFunc func context.Context, EngineMigration error err error Evidence: `models/db/engine_init.go`
- **Gituser** (source_file): package gituser ⋮---- import "context" "net/url" "gitea.dev/models/user" "gitea.dev/modules/container" "gitea.dev/modules/git" ⋮---- "context" "net/url" ⋮---- "gitea.dev/models/user" "gitea.dev/modules/container" "gitea.dev/modules/git" ⋮---- type CommitParticipant struct { GitIdentity git.CommitIdentity GiteaUser user.User } ⋮---- type UserCommit struct { GitCommit git.Commit AuthorUser user.User AvatarStackData AvatarStackData } ⋮---- func RepoCommitSearchByEmailLink repoLink string, ref git.RefName string ⋮---- // GetUserCommitsByGitCommits checks if authors' e-mails of commits are corresponding to users. func GetUserCommitsByGitCommits ctx context.Context, gitCommits git.Commit, repoLin… Evidence: `models/gituser/gituser.go`
- **Issue User** (source_file): package issues ⋮---- import "context" "fmt" "gitea.dev/models/db" repo model "gitea.dev/models/repo" ⋮---- "context" "fmt" ⋮---- "gitea.dev/models/db" repo model "gitea.dev/models/repo" ⋮---- type IssueUser struct { ID int64 xorm:"pk autoincr" UID int64 xorm:"INDEX unique uid to issue " IssueID int64 xorm:"INDEX unique uid to issue " IsRead bool IsMentioned bool } ⋮---- func init ⋮---- func NewIssueUsers ctx context.Context, repo repo model.Repository, issue Issue error ⋮---- func UpdateIssueUserByRead ctx context.Context, uid, issueID int64 error ⋮---- func UpdateIssueUsersByMentions ctx context.Context, issueID int64, uids int64 error ⋮---- func GetIssueMentionIDs ctx context.Context, iss… Evidence: `models/issues/issue_user.go`
- **Migrations** (source_file): package migrations ⋮---- import "context" "errors" "fmt" "gitea.dev/models/db" "gitea.dev/models/migrations/v1 10" "gitea.dev/models/migrations/v1 11" "gitea.dev/models/migrations/v1 12" "gitea.dev/models/migrations/v1 13" "gitea.dev/models/migrations/v1 14" "gitea.dev/models/migrations/v1 15" "gitea.dev/models/migrations/v1 16" "gitea.dev/models/migrations/v1 17" "gitea.dev/models/migrations/v1 18" "gitea.dev/models/migrations/v1 19" "gitea.dev/models/migrations/v1 20" "gitea.dev/models/migrations/v1 21" "gitea.dev/models/migrations/v1 22" "gitea.dev/models/migrations/v1 23" "gitea.dev/models/migrations/v1 24" "gitea.dev/models/migrations/v1 25" "gitea.dev/models/migrations/v1 26" "gitea.d… Evidence: `models/migrations/migrations.go`
- **Org** (source_file): package organization ⋮---- import "context" "fmt" "strings" "gitea.dev/models/db" "gitea.dev/models/perm" "gitea.dev/models/unit" user model "gitea.dev/models/user" "gitea.dev/modules/log" "gitea.dev/modules/setting" "gitea.dev/modules/structs" "gitea.dev/modules/util" "xorm.io/builder" ⋮---- "context" "fmt" "strings" ⋮---- "gitea.dev/models/db" "gitea.dev/models/perm" "gitea.dev/models/unit" user model "gitea.dev/models/user" "gitea.dev/modules/log" "gitea.dev/modules/setting" "gitea.dev/modules/structs" "gitea.dev/modules/util" ⋮---- "xorm.io/builder" ⋮---- type ErrOrgNotExist struct { ID int64 Name string } ⋮---- func IsErrOrgNotExist err error bool ⋮---- func err ErrOrgNotExist Error st… Evidence: `models/organization/org.go`
- **Org User** (source_file): package organization ⋮---- import "context" "fmt" "gitea.dev/models/db" "gitea.dev/models/perm" user model "gitea.dev/models/user" "gitea.dev/modules/log" "xorm.io/builder" ⋮---- "context" "fmt" ⋮---- "gitea.dev/models/db" "gitea.dev/models/perm" user model "gitea.dev/models/user" "gitea.dev/modules/log" ⋮---- "xorm.io/builder" ⋮---- type OrgUser struct { ID int64 xorm:"pk autoincr" UID int64 xorm:"INDEX UNIQUE s " OrgID int64 xorm:"INDEX UNIQUE s " IsPublic bool xorm:"INDEX" } ⋮---- func init ⋮---- type ErrUserHasOrgs struct { UID int64 } ⋮---- func IsErrUserHasOrgs err error bool ⋮---- func err ErrUserHasOrgs Error string ⋮---- func GetOrganizationCount ctx context.Context, u user model.U… Evidence: `models/organization/org_user.go`
- **Team** (source_file): package organization ⋮---- import "context" "fmt" "strings" "gitea.dev/models/db" "gitea.dev/models/perm" "gitea.dev/models/unit" user model "gitea.dev/models/user" "gitea.dev/modules/log" "gitea.dev/modules/structs" "gitea.dev/modules/util" "xorm.io/builder" ⋮---- "context" "fmt" "strings" ⋮---- "gitea.dev/models/db" "gitea.dev/models/perm" "gitea.dev/models/unit" user model "gitea.dev/models/user" "gitea.dev/modules/log" "gitea.dev/modules/structs" "gitea.dev/modules/util" ⋮---- "xorm.io/builder" ⋮---- type ErrTeamAlreadyExist struct { OrgID int64 Name string } ⋮---- func IsErrTeamAlreadyExist err error bool ⋮---- func err ErrTeamAlreadyExist Error string ⋮---- func err ErrTeamAlreadyExis… Evidence: `models/organization/team.go`
- **Team Repo** (source_file): package organization ⋮---- import "context" "gitea.dev/models/db" "gitea.dev/models/perm" "gitea.dev/models/unit" "xorm.io/builder" ⋮---- "context" ⋮---- "gitea.dev/models/db" "gitea.dev/models/perm" "gitea.dev/models/unit" ⋮---- "xorm.io/builder" ⋮---- type TeamRepo struct { ID int64 xorm:"pk autoincr" OrgID int64 xorm:"INDEX" TeamID int64 xorm:"UNIQUE s " RepoID int64 xorm:"UNIQUE s " } ⋮---- func HasTeamRepo ctx context.Context, orgID, teamID, repoID int64 bool ⋮---- func AddTeamRepo ctx context.Context, orgID, teamID, repoID int64 error ⋮---- func RemoveTeamRepo ctx context.Context, teamID, repoID int64 error ⋮---- func GetTeamsWithAccessToAnyRepoUnit ctx context.Context, orgID, repoID… Evidence: `models/organization/team_repo.go`
- **Team Unit** (source_file): package organization ⋮---- import "context" "gitea.dev/models/db" "gitea.dev/models/perm" "gitea.dev/models/unit" ⋮---- "context" ⋮---- "gitea.dev/models/db" "gitea.dev/models/perm" "gitea.dev/models/unit" ⋮---- type TeamUnit struct { ID int64 xorm:"pk autoincr" OrgID int64 xorm:"INDEX" TeamID int64 xorm:"UNIQUE s " Type unit.Type xorm:"UNIQUE s " AccessMode perm.AccessMode } ⋮---- func t TeamUnit Unit unit.Unit ⋮---- func getUnitsByTeamID ctx context.Context, teamID int64 units TeamUnit, err error Evidence: `models/organization/team_unit.go`
- **Team User** (source_file): package organization ⋮---- import "context" "gitea.dev/models/db" user model "gitea.dev/models/user" "xorm.io/builder" ⋮---- "context" ⋮---- "gitea.dev/models/db" user model "gitea.dev/models/user" ⋮---- "xorm.io/builder" ⋮---- type TeamUser struct { ID int64 xorm:"pk autoincr" OrgID int64 xorm:"INDEX" TeamID int64 xorm:"UNIQUE s " UID int64 xorm:"UNIQUE s " } ⋮---- func IsTeamMember ctx context.Context, orgID, teamID, userID int64 bool, error ⋮---- type SearchMembersOptions struct { db.ListOptions TeamID int64 } ⋮---- func GetTeamMembers ctx context.Context, opts SearchMembersOptions user model.User, error ⋮---- var members user model.User ⋮---- func IsUserInTeams ctx context.Context, user… Evidence: `models/organization/team_user.go`
- **Repo Permission** (source_file): package access ⋮---- import "context" "errors" "fmt" "maps" "slices" "strings" actions model "gitea.dev/models/actions" "gitea.dev/models/db" "gitea.dev/models/organization" perm model "gitea.dev/models/perm" repo model "gitea.dev/models/repo" "gitea.dev/models/unit" user model "gitea.dev/models/user" "gitea.dev/modules/container" "gitea.dev/modules/log" "gitea.dev/modules/setting" "gitea.dev/modules/util" ⋮---- "context" "errors" "fmt" "maps" "slices" "strings" ⋮---- actions model "gitea.dev/models/actions" "gitea.dev/models/db" "gitea.dev/models/organization" perm model "gitea.dev/models/perm" repo model "gitea.dev/models/repo" "gitea.dev/models/unit" user model "gitea.dev/models/user" "g… Evidence: `models/perm/access/repo_permission.go`
- **Access Mode** (source_file): package perm ⋮---- import "fmt" "slices" "gitea.dev/modules/util" ⋮---- "fmt" "slices" ⋮---- "gitea.dev/modules/util" ⋮---- type AccessMode int ⋮---- const AccessModeNone AccessMode = iota AccessModeRead AccessModeWrite AccessModeAdmin AccessModeOwner ⋮---- func mode AccessMode ToString string ⋮---- func mode AccessMode LogString string ⋮---- func ParseAccessMode permission string, allowed ...AccessMode AccessMode ⋮---- var ErrInvalidAccessMode = util.NewInvalidArgumentErrorf "Invalid access mode" Evidence: `models/perm/access_mode.go`
- **Org Repo** (source_file): package repo ⋮---- import "context" "fmt" "strings" "gitea.dev/models/db" org model "gitea.dev/models/organization" user model "gitea.dev/models/user" "xorm.io/builder" ⋮---- "context" "fmt" "strings" ⋮---- "gitea.dev/models/db" org model "gitea.dev/models/organization" user model "gitea.dev/models/user" ⋮---- "xorm.io/builder" ⋮---- func GetOrgRepositories ctx context.Context, orgID int64 RepositoryList, error ⋮---- var orgRepos Repository ⋮---- func GetOrgRepositoryIDs ctx context.Context, orgID int64 repoIDs int64, error ⋮---- type SearchTeamRepoOptions struct { db.ListOptions TeamID int64 } ⋮---- func GetTeamRepositories ctx context.Context, opts SearchTeamRepoOptions RepositoryList, er… Evidence: `models/repo/org_repo.go`
- **Repo** (source_file): package repo ⋮---- import "context" "errors" "fmt" "html/template" "maps" "net" "net/url" "path/filepath" "regexp" "strconv" "strings" "sync" "gitea.dev/models/db" "gitea.dev/models/unit" user model "gitea.dev/models/user" "gitea.dev/modules/base" "gitea.dev/modules/git" giturl "gitea.dev/modules/git/url" "gitea.dev/modules/htmlutil" "gitea.dev/modules/httplib" "gitea.dev/modules/log" "gitea.dev/modules/markup" "gitea.dev/modules/optional" "gitea.dev/modules/setting" api "gitea.dev/modules/structs" "gitea.dev/modules/timeutil" "gitea.dev/modules/util" "xorm.io/builder" ⋮---- "context" "errors" "fmt" "html/template" "maps" "net" "net/url" "path/filepath" "regexp" "strconv" "strings" "sync" ⋮… Evidence: `models/repo/repo.go`
- **Repo Unit** (source_file): package repo ⋮---- import "context" "gitea.dev/models/db" "gitea.dev/models/perm" "gitea.dev/models/unit" "gitea.dev/modules/json" "gitea.dev/modules/setting" "gitea.dev/modules/timeutil" "gitea.dev/modules/util" "xorm.io/xorm" "xorm.io/xorm/convert" ⋮---- "context" ⋮---- "gitea.dev/models/db" "gitea.dev/models/perm" "gitea.dev/models/unit" "gitea.dev/modules/json" "gitea.dev/modules/setting" "gitea.dev/modules/timeutil" "gitea.dev/modules/util" ⋮---- "xorm.io/xorm" "xorm.io/xorm/convert" ⋮---- type ErrUnitTypeNotExist struct { UT unit.Type } ⋮---- func IsErrUnitTypeNotExist err error bool ⋮---- func err ErrUnitTypeNotExist Error string ⋮---- func err ErrUnitTypeNotExist Unwrap error ⋮----… Evidence: `models/repo/repo_unit.go`
- **User Repo** (source_file): package repo ⋮---- import "context" "strings" "gitea.dev/models/db" "gitea.dev/models/organization" "gitea.dev/models/perm" "gitea.dev/models/unit" user model "gitea.dev/models/user" "gitea.dev/modules/container" "xorm.io/builder" ⋮---- "context" "strings" ⋮---- "gitea.dev/models/db" "gitea.dev/models/organization" "gitea.dev/models/perm" "gitea.dev/models/unit" user model "gitea.dev/models/user" "gitea.dev/modules/container" ⋮---- "xorm.io/builder" ⋮---- type StarredReposOptions struct { db.ListOptions StarrerID int64 RepoOwnerID int64 IncludePrivate bool } ⋮---- func opts StarredReposOptions ApplyPublicOnly publicOnly bool ⋮---- func opts StarredReposOptions ToConds builder.Cond ⋮---- var… Evidence: `models/repo/user_repo.go`
- **Unit** (source_file): package unit ⋮---- import "errors" "fmt" "slices" "strings" "sync/atomic" "gitea.dev/models/perm" "gitea.dev/modules/container" "gitea.dev/modules/log" "gitea.dev/modules/setting" ⋮---- "errors" "fmt" "slices" "strings" "sync/atomic" ⋮---- "gitea.dev/models/perm" "gitea.dev/modules/container" "gitea.dev/modules/log" "gitea.dev/modules/setting" ⋮---- type Type int ⋮---- const TypeInvalid Type = iota TypeCode TypeIssues TypePullRequests TypeReleases TypeWiki TypeExternalWiki TypeExternalTracker TypeProjects TypePackages TypeActions ⋮---- func u Type Value int ⋮---- func u Type LogString string ⋮---- var AllRepoUnitTypes = Type{ TypeCode, TypeIssues, TypePullRequests, TypeReleases, TypeWiki, T… Evidence: `models/unit/unit.go`
- **External Login User** (source_file): package user ⋮---- import "context" "fmt" "time" "gitea.dev/models/db" "gitea.dev/modules/util" "xorm.io/builder" ⋮---- "context" "fmt" "time" ⋮---- "gitea.dev/models/db" "gitea.dev/modules/util" ⋮---- "xorm.io/builder" ⋮---- type ErrExternalLoginUserAlreadyExist struct { ExternalID string UserID int64 LoginSourceID int64 } ⋮---- func err ErrExternalLoginUserAlreadyExist Error string ⋮---- func err ErrExternalLoginUserAlreadyExist Unwrap error ⋮---- type ErrExternalLoginUserNotExist struct { UserID int64 LoginSourceID int64 } ⋮---- type ExternalLoginUser struct { ExternalID string xorm:"pk NOT NULL" UserID int64 xorm:"INDEX NOT NULL" LoginSourceID int64 xorm:"pk NOT NULL" RawData map string… Evidence: `models/user/external_login_user.go`
- **User** (source_file): package user ⋮---- import "context" "encoding/hex" "errors" "fmt" "html/template" "mime" "net/mail" "net/url" "path/filepath" "regexp" "strconv" "strings" "sync" "time" "unicode" "gitea.dev/models/auth" "gitea.dev/models/db" "gitea.dev/modules/auth/openid" "gitea.dev/modules/auth/password/hash" "gitea.dev/modules/base" "gitea.dev/modules/container" "gitea.dev/modules/git" "gitea.dev/modules/htmlutil" "gitea.dev/modules/httplib" "gitea.dev/modules/log" "gitea.dev/modules/optional" "gitea.dev/modules/setting" "gitea.dev/modules/structs" "gitea.dev/modules/timeutil" "gitea.dev/modules/util" "gitea.dev/modules/validation" "image/jpeg" "golang.org/x/text/runes" "golang.org/x/text/transform" "gol… Evidence: `models/user/user.go`
- **Hooktask** (source_file): package webhook ⋮---- import "context" "errors" "time" "gitea.dev/models/db" "gitea.dev/modules/json" "gitea.dev/modules/log" "gitea.dev/modules/setting" "gitea.dev/modules/timeutil" webhook module "gitea.dev/modules/webhook" gouuid "github.com/google/uuid" "xorm.io/builder" ⋮---- "context" "errors" "time" ⋮---- "gitea.dev/models/db" "gitea.dev/modules/json" "gitea.dev/modules/log" "gitea.dev/modules/setting" "gitea.dev/modules/timeutil" webhook module "gitea.dev/modules/webhook" ⋮---- gouuid "github.com/google/uuid" "xorm.io/builder" ⋮---- type HookRequest struct { URL string json:"url" HTTPMethod string json:"http method" Headers map string string json:"headers" Body string json:"body" }… Evidence: `models/webhook/hooktask.go`
- **Jobparser** (source_file): package jobparser ⋮---- import "bytes" "fmt" "sort" "strings" "gitea.com/gitea/runner/act/exprparser" "gitea.com/gitea/runner/act/model" "go.yaml.in/yaml/v4" ⋮---- "bytes" "fmt" "sort" "strings" ⋮---- "gitea.com/gitea/runner/act/exprparser" "gitea.com/gitea/runner/act/model" "go.yaml.in/yaml/v4" ⋮---- func Parse content byte, options ...ParseOption SingleWorkflow, error ⋮---- var ret SingleWorkflow ⋮---- func WithGitContext context model.GithubContext ParseOption ⋮---- func WithVars vars map string string ParseOption ⋮---- func WithInputs inputs map string any ParseOption ⋮---- type parseContext struct { jobResults map string string gitContext model.GithubContext vars map string string inpu… Evidence: `modules/actions/jobparser/jobparser.go`
- **Scoped Workflows** (source_file): package actions ⋮---- import "gitea.dev/modules/actions/jobparser" "gitea.dev/modules/git" "gitea.dev/modules/log" "gitea.dev/modules/setting" api "gitea.dev/modules/structs" webhook module "gitea.dev/modules/webhook" ⋮---- "gitea.dev/modules/actions/jobparser" "gitea.dev/modules/git" "gitea.dev/modules/log" "gitea.dev/modules/setting" api "gitea.dev/modules/structs" webhook module "gitea.dev/modules/webhook" ⋮---- func ListScopedWorkflows commit git.Commit string, git.Entries, error ⋮---- type ParsedScopedWorkflow struct { EntryName string DisplayName string Content byte Events jobparser.Event } ⋮---- func ParseScopedWorkflows sourceCommit git.Commit ParsedScopedWorkflow, error ⋮---- func… Evidence: `modules/actions/scoped_workflows.go`
- **Workflow Pattern** (source_file): package workflowpattern ⋮---- import "strings" "gitea.dev/modules/glob" ⋮---- "strings" ⋮---- "gitea.dev/modules/glob" ⋮---- type WorkflowPattern struct { negative bool glob glob.Glob } ⋮---- func CompilePatterns patterns ...string WorkflowPattern, error ⋮---- func Skip sequence WorkflowPattern, input string bool ⋮---- func Filter sequence WorkflowPattern, input string bool Evidence: `modules/actions/workflowpattern/workflow_pattern.go`
- The remaining 20 evidence entries are in `AI_CONTEXT_PACK.json` or `EVIDENCE_INDEX.json`.

## Rules the Host AI Must Follow

- **Treat this asset as pre-work context, not a runtime environment.**: The AI Context Pack contains only an evidence-backed understanding of the project, not the project's executable state. Evidence: `AGENTS.md`, `CLAUDE.md`, `README.md`
- **When answering the user, distinguish what can be previewed from what can only be verified after install.**: The consumer value of the pre-install experience comes from reducing bad installs and misjudgments, not from pretending to be a real run. Evidence: `AGENTS.md`, `CLAUDE.md`, `README.md`

## Questions the User Should Answer First

- Which host AI or local environment do you plan to use it in?
- Do you just want to experience the workflow first, or are you ready to actually install?
- What matters most to you: install cost, output quality, or conflicts with your existing rules?

## Acceptance Checks

- Every capability claim can be traced back to a file path in evidence_refs.
- AI_CONTEXT_PACK.md does not package previews as a real run.
- The user can understand who it fits, what it can do, how to start, and the risk boundaries within 3 minutes.

---

## Doramagic Context Augmentation

The following sections strengthen the repository context for a host AI. Human Manual data is a reading route, and pitfall notes become operating constraints.

## Human Manual Outline

Usage rule: this is only a reading route and salience signal, not factual authority. Concrete claims must still return to repo evidence or Claim Graph.

Host AI hard rules:
- Do not treat page titles, section order, summaries, or importance values as factual project evidence.
- When explaining the Human Manual outline, state that it is only a reading route or salience signal.
- Capability, installation, compatibility, runtime state, and risk claims must cite repo evidence, source paths, or Claim Graph.

- **Gitea Overview & System Architecture**: importance `high`
  - source_paths: main.go, cmd/web.go, cmd/main.go, routers/init.go, routers/web/web.go
- **Data Models & Database Layer**: importance `high`
  - source_paths: models/db/engine.go, models/db/context.go, models/migrations/migrations.go, models/unittest/testdb.go, models/repo/repo.go
- **Actions / CI-CD System**: importance `high`
  - source_paths: modules/actions/jobparser/jobparser.go, modules/actions/workflows.go, modules/actions/workflowpattern/workflow_pattern.go, models/actions/run.go, models/actions/runner.go
- **Organizations, Teams & Repository Management**: importance `high`
  - source_paths: models/organization/org.go, models/organization/team.go, models/unit/unit.go, models/perm/access_mode.go, services/org/org.go

## Repo Inspection Evidence

- repo_clone_verified: true
- repo_inspection_verified: true
- repo_commit: `582217a0da4cd4be95d404d89d1a20b773ce2398`
- inspected_files: `Dockerfile`, `README.md`, `package.json`, `pnpm-lock.yaml`, `pyproject.toml`, `uv.lock`, `docs/build-setup.md`, `docs/build-source.md`, `docs/community-governance.md`, `docs/development.md`, `docs/guidelines-backend.md`, `docs/guidelines-frontend.md`, `docs/guidelines-refactoring.md`, `docs/release-management.md`, `docs/testing.md`

Host AI hard rules:
- Without repo_clone_verified=true, do not claim that the source code has been read.
- Without repo_inspection_verified=true, do not write README, docs, or package-file conclusions as facts.
- Without quick_start_verified=true, do not claim that the Quick Start path has run successfully.

## Doramagic Pitfall Constraints

These rules come from Doramagic discovery, validation, or compilation findings. The host AI must treat them as operating constraints, not background notes.

### Constraint 1: Capability evidence risk requires verification

- Trigger: README/documentation is current enough for a first validation pass.
- Host AI rule: Reproduce the official install and quickstart path in an isolated environment.
- Why it matters: May increase setup, validation, or first-run risk for the user.
- Evidence: capability.assumptions | https://github.com/go-gitea/gitea
- Hard boundary: Do not present this pitfall as solved, verified, or ignorable unless later evidence explicitly closes it.

### Constraint 2: Security or permission risk requires verification

- Trigger: no_demo
- Host AI rule: Reproduce the official install and quickstart path in an isolated environment.
- Why it matters: May increase setup, validation, or first-run risk for the user.
- Evidence: downstream_validation.risk_items | https://github.com/go-gitea/gitea
- Hard boundary: Do not present this pitfall as solved, verified, or ignorable unless later evidence explicitly closes it.

### Constraint 3: Security or permission risk requires verification

- Trigger: no_demo
- Host AI rule: Reproduce the official install and quickstart path in an isolated environment.
- Why it matters: May increase setup, validation, or first-run risk for the user.
- Evidence: risks.scoring_risks | https://github.com/go-gitea/gitea
- Hard boundary: Do not present this pitfall as solved, verified, or ignorable unless later evidence explicitly closes it.
