From f21a4c51d28649b81acfccfe893f882fb863662f Mon Sep 17 00:00:00 2001 From: SepComet <202308010230@stu.csust.edu.cn> Date: Fri, 27 Mar 2026 13:33:11 +0800 Subject: [PATCH] add AGENTS.md --- .gitignore | 7 ------- AGENTS.md | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 7 deletions(-) create mode 100644 AGENTS.md diff --git a/.gitignore b/.gitignore index 136bb08..63acec8 100644 --- a/.gitignore +++ b/.gitignore @@ -77,16 +77,9 @@ crashlytics-build.properties /Assets/StreamingAssets /Assets/StreamingAssets.meta -/UI参考 -/AGENTS.md /bin /docs/screenshot *.xmind -/数据表/__pycache__/ - -~$*.xlsx -Assets/GameMain/Configs/ResourceBuilder.xml /.dotnet - /.dotnet-home diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..a6f2854 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,52 @@ +# Repository Guidelines + +## Scope + +This file is for AI coding agents working in this repository. Optimize for minimal, correct changes that preserve the shared client/server networking architecture. + +## Workspace Rules + +- Use LF line endings in files you create or edit. +- Do not introduce `UnityEngine` dependencies into shared networking code under `Assets/Scripts/Network/`. +- Keep Unity-only adapters and conversion helpers under `Assets/Scripts/Extensions/` or other host-specific locations. +- Do not revert unrelated user changes in the worktree. + +## Project Layout + +- `Assets/Scripts/Network/`: shared transport, message routing, session lifecycle, and host adapters. +- `Assets/Scripts/Extensions/`: Unity-specific helpers such as protobuf-to-Unity conversions. +- `Assets/Tests/EditMode/Network/`: NUnit edit-mode regression tests. +- `openspec/`: specs, active changes, and archived changes. + +## Commands + +- `dotnet build Network.EditMode.Tests.csproj -v minimal` + Build runtime and edit-mode test assemblies. +- `dotnet test Network.EditMode.Tests.csproj --no-build -v minimal` + Run the CLI regression suite. +- `openspec status --change ""` + Check change progress. +- `openspec instructions apply --change "" --json` + Read current implementation tasks before editing code. + +If needed, set `DOTNET_CLI_HOME=.dotnet-home` and `DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1`. + +## Code Change Guidance + +- Follow existing C# style: 4-space indentation, `PascalCase` for public APIs, `_camelCase` for private fields. +- Prefer focused types. Keep `SessionManager` single-session; use coordinators such as `MultiSessionManager` for per-peer collections. +- Preserve the client single-session path unless the task explicitly changes it. +- Treat `network-main-thread-dispatch` as client-only. Shared/server work should align with `shared-network-foundation`, `network-session-lifecycle`, and `multi-session-lifecycle`. + +## Testing Expectations + +- Add or update NUnit tests with every network-layer behavior change. +- Cover both client single-session and server multi-session behavior when touching lifecycle code. +- Prefer explicit regression-style test names such as `Method_Scenario_ExpectedBehavior`. +- Do not finish a networking change without running `dotnet test` unless blocked. + +## OpenSpec Workflow + +- For substantial work: propose, apply, verify, then archive. +- Sync delta specs to `openspec/specs/` before archive when requirements changed. +- Keep implementation aligned with active change artifacts; update task checkboxes as work completes.