你说得对，前一版建议更多是基于你给的两篇文章做工程推理。重新查 Unity 官方文档、Unity 官方发布页和 Gitea 官方文档后，我会把建议调整成下面这版。重点变化是：**Unity 6.2+ 的验证脚本、Gitea Actions、本地 Gitea LFS、分支保护、Build Profile、测试命令细节，都要更实际一些。**

---

## 先给结论

针对你的环境：**Unity 6.2+ + 本地自建 Gitea**，我建议优先做这 8 件事：

1. **Unity 版本不要写“6.2+”，要锁定到精确 `6000.2.xf1` 或迁到当前 LTS。**
2. **Gitea 必须启用 Git LFS，并在仓库强制 LFS 规则。**
3. **`.meta` 必须提交，Asset Serialization 保持 Force Text。**
4. **UnityYAMLMerge 要在每个开发机和 Gitea runner 上配置，不是只写 `.gitattributes`。**
5. **把验证脚本拆成 `validate-fast.sh` 和 `validate-full.sh`。**
6. **修正 Unity 测试命令：`-runTests` 不要搭配普通 `-quit`。**
7. **Gitea Actions runner 建议单独机器跑，不要和 Gitea 服务抢资源。**
8. **Gitea 分支保护开启：禁止直接推主分支、要求 PR、要求状态检查、要求审批。**

Unity 官方现在的 Unity 6 发布策略里，LTS 推荐用于即将锁版本或线上运营项目，Update release 推荐用于新项目或中期项目；官方页面也显示 Unity 6.3 LTS 是当前 LTS，并说明 Update release 是 production-ready，但支持到下个 release 为止。所以如果你项目已经生产化，最好不要长期停留在模糊的“6.2+”，而是**锁死具体 patch 版本**，或者单独评估迁到 Unity 6.3 LTS。([unity.com](https://unity.com/releases/lts-vs-tech-stream))

---

# 1. Unity 6.2+ 下，原文里的验证脚本需要改

你原文里的 `validate-unity.sh` 思路是对的，但有一个关键细节要修正：

> **跑 Unity Test Framework 的 `-runTests` 时，不要加普通 `-quit`。**

Unity 6.2 Test Framework 文档明确给出的命令是 `Unity.exe -runTests -batchmode -projectPath ... -testResults ... -testPlatform ...`，并且命令行参考里写了：Editor 的普通 `-quit` 在测试运行时不受支持。([docs.unity.cn](https://docs.unity.cn/6000.2/Documentation/Manual/test-framework/run-tests-from-command-line.html))

所以我建议这样拆：

```bash
tools/
  validate-fast.sh      # EditMode tests + project validation
  validate-full.sh      # PlayMode tests + build/profile validation
  unity-env.sh          # 统一找 Unity 路径
```

### `tools/unity-env.sh`

```bash
#!/usr/bin/env bash
set -euo pipefail

: "${UNITY_PATH:=}"

if [ -z "$UNITY_PATH" ]; then
  if command -v Unity >/dev/null 2>&1; then
    UNITY_PATH="Unity"
  else
    echo "UNITY_PATH is not set and Unity was not found in PATH." >&2
    echo "Example:" >&2
    echo "  export UNITY_PATH=/home/build/Unity/Hub/Editor/6000.2.xf1/Editor/Unity" >&2
    exit 1
  fi
fi

export UNITY_PATH
export PROJECT_PATH="${PROJECT_PATH:-$(pwd)}"
export LOG_DIR="${LOG_DIR:-$PROJECT_PATH/Logs}"
mkdir -p "$LOG_DIR"
```

### `tools/validate-fast.sh`

```bash
#!/usr/bin/env bash
set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$SCRIPT_DIR/unity-env.sh"

echo "Unity version:"
"$UNITY_PATH" -version || true

echo "Running EditMode tests..."
"$UNITY_PATH" \
  -batchmode \
  -projectPath "$PROJECT_PATH" \
  -runTests \
  -testPlatform EditMode \
  -testResults "$LOG_DIR/editmode-results.xml" \
  -logFile "$LOG_DIR/editmode.log"

echo "Running project validation..."
"$UNITY_PATH" \
  -quit \
  -batchmode \
  -projectPath "$PROJECT_PATH" \
  -executeMethod Project.Editor.Validation.ProjectValidationCommand.RunAll \
  -logFile "$LOG_DIR/project-validation.log"
```

### `tools/validate-full.sh`

```bash
#!/usr/bin/env bash
set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$SCRIPT_DIR/unity-env.sh"

echo "Running PlayMode tests..."
"$UNITY_PATH" \
  -batchmode \
  -projectPath "$PROJECT_PATH" \
  -runTests \
  -testPlatform PlayMode \
  -testResults "$LOG_DIR/playmode-results.xml" \
  -logFile "$LOG_DIR/playmode.log"

echo "Running build validation..."
"$UNITY_PATH" \
  -quit \
  -batchmode \
  -projectPath "$PROJECT_PATH" \
  -executeMethod Project.Editor.Build.BuildValidationCommand.RunAll \
  -logFile "$LOG_DIR/build-validation.log"
```

`-executeMethod` 适合 CI、构建、数据准备、项目验证这类任务；Unity 文档也说明该方法必须是 static，脚本要放在 Editor 代码路径里，失败时可以抛异常或 `EditorApplication.Exit` 返回非零退出码。([docs.unity.cn](https://docs.unity.cn/6000.2/Documentation/Manual/EditorCommandLineArguments.html))

---

# 2. Unity 6.2+ 要把 Build Settings 建议升级成 Build Profiles 建议

你的 Unity 版本是 6.2+，所以我建议文档里不要只写传统 Build Settings。Unity 6.2 的命令行参数已经有 `-activeBuildProfile <pathname>` 和 `-build <pathName>`，可以直接从命令行指定 Build Profile 后构建。([docs.unity.cn](https://docs.unity.cn/6000.2/Documentation/Manual/EditorCommandLineArguments.html))

因此 `docs/build-and-release.md` 建议写成：

```markdown
## Build Profiles

Build profiles live under:

Assets/_Project/BuildProfiles/

Known profiles:

- WindowsDev.asset
- WindowsRelease.asset
- AndroidDev.asset
- AndroidRelease.asset

Agents must not create or modify Build Profiles unless the task explicitly requires build configuration changes.

## CI Build Example

Unity \
  -quit \
  -batchmode \
  -projectPath . \
  -activeBuildProfile "Assets/_Project/BuildProfiles/WindowsRelease.asset" \
  -build "Builds/Windows/Game.exe" \
  -logFile Logs/build-windows.log
```

如果你的项目已经有自定义 `BuildPipeline.BuildPlayer` 脚本，也可以继续保留。但在 Unity 6.2+ 文档里，我会明确补一句：

> Build Profile 是一等配置资产，修改它等同于修改构建策略，属于高风险变更。

---

# 3. Gitea 本地部署下，Git LFS 是 P0，不是可选项

Unity 项目有大量 `.psd`、`.fbx`、`.png`、`.wav`、`.mp4`、`.blend`、贴图、音频、模型等二进制资源。用本地 Gitea 时，要先确认 Gitea 服务器启用了内置 LFS。Gitea 官方文档要求在 `app.ini` 中启用 `LFS_START_SERVER = true`，并设置 `[lfs] PATH`；文档也注明 LFS server 支持需要服务器安装至少 Git v2.1.2。([docs.gitea.com](https://docs.gitea.com/next/administration/git-lfs-setup))

Gitea `app.ini` 建议：

```ini
[server]
LFS_START_SERVER = true

[lfs]
PATH = /var/lib/gitea/data/lfs
```

仓库里建议执行：

```bash
git lfs install

git lfs track "*.psd"
git lfs track "*.fbx"
git lfs track "*.blend"
git lfs track "*.png"
git lfs track "*.tga"
git lfs track "*.wav"
git lfs track "*.mp3"
git lfs track "*.mp4"
git lfs track "*.mov"
git lfs track "*.zip"
git lfs track "*.unitypackage"
```

并提交 `.gitattributes`。

如果你们 Gitea 走 SSH，而且想用 LFS pure SSH，需要额外谨慎。Gitea 官方文档说 pure SSH LFS 支持可以开启，但默认关闭，并提到 git-lfs 客户端存在会导致 SSH transfers hang 的 open bug， workaround 是客户端设置 `git config --global lfs.ssh.automultiplex false`。除非你非常确定需要纯 SSH LFS，否则建议先用 HTTPS LFS 或常规配置。([docs.gitea.com](https://docs.gitea.com/next/administration/git-lfs-setup))

---

# 4. `.meta`、Force Text、UnityYAMLMerge：建议保留，但要更精确

Unity 官方文档确认：Visible Meta Files 是给 Unity 不直接支持的版本控制系统使用的模式，可以用你选择的 VCS 管理源资产和 metadata。([docs.unity.cn](https://docs.unity.cn/6000.0/Documentation/Manual/class-VersionControlSettings.html))

Unity Editor 设置里，Asset Serialization 的 `Force Text` 会把所有资产转成 Text 模式，包括新资产；文档也说明 Unity 可以用文本格式保存 Scene 来帮助版本控制合并。([docs.unity.cn](https://docs.unity.cn/Manual/class-EditorManager.html))

因此这几条要保留在 `AGENTS.md`：

```markdown
## Unity Version Control Rules

- Version Control Mode must be Visible Meta Files.
- Asset Serialization Mode must be Force Text.
- `.meta` files must be committed.
- Do not manually edit `.meta` files.
- Move and rename assets inside Unity Editor whenever possible.
- Do not move or rename `.unity`, `.prefab`, `.asset`, `.meta`, `.asmdef` unless the task explicitly requires it.
```

Unity 官方的项目组织建议也强调 `.meta` 记录导入设置，应该提交；并提醒移动资产时最好在 Editor 内移动，这样 `.meta` 会随资产一起移动。官方还提到 Git 默认忽略空目录，空目录的 `.meta` 可能导致协作问题，所以空目录要么避免，要么放 `.keep`。([unity.com](https://unity.com/how-to/organizing-your-project?ampDeviceId=bd73ee3b-a36f-4585-8d3e-967cba74f006&ampSessionId=1771632000345&ampTimestamp=1771718400359))

UnityYAMLMerge 这块也要保留，但要补一句：

> `.gitattributes` 只是声明某些文件用 `unityyamlmerge`，每个开发机和 runner 还要配置 Git merge driver。

Unity 官方 Smart Merge 文档说明 UnityYAMLMerge 随 Unity Editor 提供，可用于语义正确地合并 scene 和 prefab，并给出了 Git mergetool 配置方式。([docs.unity.cn](https://docs.unity.cn/2021.1/Documentation/Manual/SmartMerge.html))

建议 `.gitattributes`：

```gitattributes
*.cs text eol=lf
*.asmdef text eol=lf
*.asmref text eol=lf

*.unity text eol=lf merge=unityyamlmerge
*.prefab text eol=lf merge=unityyamlmerge
*.asset text eol=lf merge=unityyamlmerge
*.meta text eol=lf merge=unityyamlmerge
*.controller text eol=lf merge=unityyamlmerge
*.anim text eol=lf merge=unityyamlmerge
*.mat text eol=lf merge=unityyamlmerge

*.psd filter=lfs diff=lfs merge=lfs -text
*.fbx filter=lfs diff=lfs merge=lfs -text
*.blend filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.tga filter=lfs diff=lfs merge=lfs -text
*.wav filter=lfs diff=lfs merge=lfs -text
*.mp3 filter=lfs diff=lfs merge=lfs -text
*.mp4 filter=lfs diff=lfs merge=lfs -text
*.mov filter=lfs diff=lfs merge=lfs -text
```

---

# 5. Gitea Actions：建议用专门 Unity runner，不要和 Gitea 服务混跑

Gitea Actions 需要 act runner 执行任务，Gitea 官方 quick start 明确建议 runner 跑在和 Gitea instance 分开的机器上，避免消耗过多资源影响 Gitea 本体。Unity CI 会吃 CPU、内存、磁盘 IO、Library cache 和许可证，所以这条对 Unity 项目尤其重要。([docs.gitea.com](https://docs.gitea.com/1.24/usage/actions/quickstart))

Gitea runner 注册时，不要用 `localhost` 或 `127.0.0.1` 作为 instance 地址。Gitea 文档特别提醒，runner 和 job containers 会连接这个地址，使用 loopback 地址通常是坏主意，LAN 地址通常才是正确选择。([docs.gitea.com](https://docs.gitea.com/1.24/usage/actions/quickstart))

建议 runner 标签按 Unity 版本区分，例如：

```bash
./act_runner register \
  --no-interactive \
  --instance "http://gitea.lan:3000" \
  --token "$GITEA_RUNNER_TOKEN" \
  --name "unity-6000-2-runner-01" \
  --labels "unity-6000-2,self-hosted"
```

Gitea act runner 可以 Docker 容器模式或 host 模式运行；官方推荐 Docker 更安全、更好管理，但也说明可以直接在 host 跑。Unity Editor + license + platform modules 往往更适合固定 host runner。注意：如果把 runner 用户加入 docker group，Gitea 文档提醒这实际上给了该用户 root 级别系统权限，所以 runner 机器应该隔离，不要和代码仓库主服务混在一起。([docs.gitea.com](https://docs.gitea.com/usage/actions/act-runner))

---

# 6. Gitea 工作流文件建议放 `.gitea/workflows/`

Gitea 文档说明 workflow YAML 放在仓库的 `.gitea/workflows/` 目录，例如 `.gitea/workflows/demo.yaml`；Gitea Actions 设计上尽可能兼容 GitHub Actions，但官方也提醒某些 actions 在 SHA256 仓库或 Gitea 运行在 subpath 时可能不正常，包括 `actions/checkout`。([docs.gitea.com](https://docs.gitea.com/1.24/usage/actions/quickstart))

建议最小 CI：

```yaml
# .gitea/workflows/unity-validate.yaml
name: Unity Validate

on:
  pull_request:
  push:
    branches:
      - main
      - develop

jobs:
  unity-fast:
    runs-on: unity-6000-2
    steps:
      - name: Checkout
        uses: actions/checkout@v4
        with:
          lfs: true

      - name: Ensure LFS files are present
        run: |
          git lfs install
          git lfs pull

      - name: Validate Unity version pin
        run: |
          cat ProjectSettings/ProjectVersion.txt
          "$UNITY_PATH" -version

      - name: Run fast validation
        run: |
          chmod +x tools/*.sh
          ./tools/validate-fast.sh

  unity-full:
    runs-on: unity-6000-2
    needs: unity-fast
    if: gitea.event_name == 'pull_request'
    steps:
      - name: Checkout
        uses: actions/checkout@v4
        with:
          lfs: true

      - name: Ensure LFS files are present
        run: |
          git lfs install
          git lfs pull

      - name: Run full validation
        run: |
          chmod +x tools/*.sh
          ./tools/validate-full.sh
```

如果你的 Gitea 是纯内网、不能访问 GitHub，那么 `actions/checkout@v4` 需要镜像到本地，或者换成你们内部可访问的 checkout action。Gitea 官方示例使用 `actions/checkout@v4`，但也明确说“尽可能兼容”，不是所有场景都保证无差异。([docs.gitea.com](https://docs.gitea.com/1.24/usage/actions/quickstart))

---

# 7. Gitea 分支保护要作为 AI Agent 的硬护栏

这点我会比前一版说得更强：如果用 Gitea，本地 pre-commit 不够，必须用 Gitea 的 protected branches。

Gitea 官方文档说明 protected branches 可以对 push、merge、review、status check 做策略限制；还可以禁用直接 push、禁用 force push、要求审批、dismiss stale approvals、阻止 rejected review 的 PR 合并、要求 PR 分支保持最新、要求状态检查成功后才能合并。([docs.gitea.com](https://docs.gitea.com/1.26/usage/access-control/protected-branches))

建议 `main` / `release/*`：

```plaintext
Protected branch: main

Push:
- Disable push

Force push:
- Disable force push

Pull request:
- Required approvals: 1 or 2
- Dismiss stale approvals: enabled
- Block merge on rejected reviews: enabled
- Block merge if pull request is outdated: enabled
- Administrators must follow branch protection rules: enabled

Status checks:
- Enable status check
- Required patterns:
  - actions/unity-fast
  - actions/unity-full
```

Gitea 支持 status check patterns，要求匹配的 CI context 在 PR head commit 上成功后才能合并。这个适合把 `validate-fast`、`validate-full` 变成硬门槛。([docs.gitea.com](https://docs.gitea.com/1.26/usage/access-control/protected-branches))

注意：Gitea 的 protected file patterns 是“阻止修改敏感文件”，不是“要求额外审核”。所以不要轻易把 `ProjectSettings/**`、`Packages/**` 全部加成 protected file pattern，否则以后合法改构建设置也合不了。更好的做法是：这些文件改动时由 PR 模板和 reviewer 检查，同时用 CI 状态检查拦截。Gitea 文档说明 protected file patterns 会阻止触碰这些文件的 commit 或 merge。([docs.gitea.com](https://docs.gitea.com/1.26/usage/access-control/protected-branches))

---

# 8. asmdef 建议是正确的，但要补两条官方依据

Unity 官方 asmdef 文档确认：`.asmdef` 会把所在文件夹及子文件夹脚本编译进独立 assembly，除非子文件夹有自己的 asmdef 或 asmref；不同 assembly 之间依赖必须显式声明引用；循环 assembly 引用不允许。([docs.unity.cn](https://docs.unity.cn/Manual/ScriptCompilationAssemblyDefinitionFiles.html))

所以原文里“用 asmdef 控制爆炸半径”的建议是成立的。但我建议补两条：

### 第一，Editor assembly 不一定非要所有脚本放顶层 `Editor/`

Unity 官方说明，Editor assembly 允许把 Editor 脚本放在项目任意位置，不只限于顶层 `Editor` 文件夹；做法是创建平台特定 assembly，并只包含 Editor 平台。([docs.unity.cn](https://docs.unity.cn/6000.0/Documentation/Manual/assembly-definitions-creating.html))

建议：

```plaintext
Assets/_Project/Scripts/Runtime/Core/Project.Core.asmdef
Assets/_Project/Scripts/Runtime/Gameplay/Project.Gameplay.asmdef
Assets/_Project/Scripts/Runtime/UI/Project.UI.asmdef
Assets/_Project/Scripts/Editor/Project.Editor.asmdef
```

`Project.Editor.asmdef`：

```json
{
  "name": "Project.Editor",
  "rootNamespace": "Project.Editor",
  "includePlatforms": ["Editor"],
  "references": [
    "Project.Core",
    "Project.Gameplay",
    "Project.UI"
  ]
}
```

### 第二，测试 assembly 要按 Unity Test Framework 的规则配置

Unity 官方说明 test assembly 可以把测试代码和 shipped application code 分开；并说明 Unity 会通过 `nunit.framework.dll`、`UnityEngine.TestRunner`、`UnityEditor.TestRunner` 等引用识别测试 assembly。([docs.unity.cn](https://docs.unity.cn/6000.0/Documentation/Manual/assembly-definitions-creating.html))

所以建议文档里明确：

```plaintext
Project.Tests.EditMode.asmdef
Project.Tests.PlayMode.asmdef
```

并在 `docs/testing.md` 写清楚每个 test asmdef 引用哪些 runtime assembly。

---

# 9. 序列化迁移协议要加强，这是官方文档支持的高风险点

Unity 官方序列化规则说明，Unity serializer 直接处理字段，不是属性；字段通常需要是 public 或 `[SerializeField]`，且不能是 static、const、readonly，还必须是 Unity 支持的类型。([docs.unity.cn](https://docs.unity.cn/6000.1/Documentation/Manual/script-serialization-rules.html))

所以 AI Agent 的 Unity 规则里应该明确：

```markdown
## Serialization Rules

- Prefer `[SerializeField] private` fields for Inspector wiring.
- Do not rename serialized fields casually.
- Do not convert serialized fields into properties unless migration is intentional.
- Do not make serialized fields `static`, `const`, or `readonly`.
- Do not assume properties are serialized.
```

字段重命名必须用 `[FormerlySerializedAs]`。Unity 官方 API 文档明确说明这个 attribute 用于 rename 字段而不丢失 serialized value。([docs.unity.cn](https://docs.unity.cn/ScriptReference/Serialization.FormerlySerializedAsAttribute.html))

```csharp
using UnityEngine;
using UnityEngine.Serialization;

namespace Project.Gameplay
{
    public sealed class PlayerMovement : MonoBehaviour
    {
        [FormerlySerializedAs("moveSpeed")]
        [SerializeField] private float movementSpeed = 5f;
    }
}
```

`[SerializeReference]` 要列为高风险。Unity 官方文档说明它会让 Unity 按 reference 而不是 value 序列化，支持多态、null、循环图等，但也有额外开销；文档还说明 managed reference 会记录 ID、fully qualified class name 和字段值。因此类名、命名空间、程序集移动都会更敏感。([docs.unity.cn](https://docs.unity.cn/Documentation/ScriptReference/SerializeReference.html))

建议在 `AGENTS.md` 加：

```markdown
## High-Risk Serialization Changes

Treat these as high risk:

- Renaming serialized fields
- Moving MonoBehaviour or ScriptableObject classes between namespaces
- Moving classes between asmdefs
- Changing `[SerializeReference]` type names
- Changing ScriptableObject schema
- Changing prefab or scene serialized data

Required:

- Add `[FormerlySerializedAs]` for field renames.
- Document affected prefabs, scenes, ScriptableObjects, and assets.
- Run `./tools/validate-full.sh`.
```

---

# 10. `AGENTS.md` 里要加入 Unity 6.2 + Gitea 专属规则

我建议你的 Unity 版文章里把 `AGENTS.md` 改成更贴近实际环境：

```markdown
# Project Unity Agent Rules

## Environment

- Unity version is pinned by `ProjectSettings/ProjectVersion.txt`.
- Do not upgrade Unity version or packages unless explicitly asked.
- Repository is hosted on self-managed Gitea.
- CI runs through Gitea Actions on dedicated Unity runners.
- Large binary assets are stored with Git LFS.

## Required Validation

For normal C# and editor-tooling changes:

./tools/validate-fast.sh

For scene, prefab, ScriptableObject, Addressables, ProjectSettings, Packages, Build Profiles, input, animation, or asmdef changes:

./tools/validate-full.sh

## Version Control

- Commit `.meta` files.
- Do not manually edit `.meta`.
- Do not move or rename Unity assets outside the Editor unless explicitly required.
- Do not modify `ProjectSettings/`, `Packages/`, or Build Profiles unless the task requires it.
- Do not add large binary files outside Git LFS tracking.

## Test Command Rule

When running Unity Test Framework from command line, use `-runTests -batchmode`.
Do not add normal `-quit` to test commands.

## Build Profile Rule

Build Profiles are build configuration assets.
Changing them is high risk and must be mentioned in the final response.

## Final Response

Always state:

- Files changed
- Asset, prefab, scene, ScriptableObject, asmdef, Build Profile, or ProjectSettings impact
- Validation command run
- Whether Unity/Gitea CI still needs to verify anything
```

这版比原文章更准确，尤其是测试命令和 Gitea CI 部分。

---

# 11. 我会调整原文中的落地优先级

## P0：立即做

1. 锁定 Unity 精确版本，不写模糊 `6.2+`
2. Gitea 启用 LFS
3. 仓库提交 `.gitattributes`
4. Unity 设置 Visible Meta Files
5. Unity 设置 Force Text
6. 配置 UnityYAMLMerge 到开发机和 runner
7. 建立 `tools/validate-fast.sh`
8. 建立 Gitea Actions runner，独立机器运行
9. Gitea `main` 分支保护，禁止直接 push
10. CI 要求 `unity-fast` 状态检查通过

## P1：一周内做

1. `validate-full.sh`
2. PlayMode smoke tests
3. Build Profile 验证命令
4. asmdef 依赖检查
5. 序列化字段迁移协议
6. PR 模板加入 Unity 风险清单
7. Gitea 要求 PR approval 和 stale approval dismiss

## P2：项目变大后做

1. Addressables Analyze / content build 验证
2. Dedicated build runner
3. Unity Accelerator 或共享 Library cache 方案
4. 资源体积预算
5. 自动生成 project index 给 Agent 读取
6. AI cleanup 先 report-only

---

## 最后一句总结

根据 Unity 官方文档和 Gitea 官方文档校准后，我会把你文章里的建议从：

> “给 Agent 写规则”

升级成：

> **Unity 6.2+ 项目在 Gitea 上通过 LFS、UnityYAMLMerge、asmdef、分层验证脚本、Gitea Actions、分支保护和序列化迁移协议，给 Agent 设置不能绕过的工程护栏。**

最重要的修正是这三条：

1. **Unity Test Framework 命令不要加普通 `-quit`。**
2. **Gitea 本地部署必须先把 LFS、runner、分支保护、状态检查打通。**
3. **Unity 6.2+ 要把 Build Profile 当成高风险配置资产纳入 Agent 规则。**
