2.5 KiB
2.5 KiB
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
UnityEnginedependencies into shared networking code underAssets/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 minimalBuild runtime and edit-mode test assemblies.dotnet test Network.EditMode.Tests.csproj --no-build -v minimalRun the CLI regression suite.openspec status --change "<name>"Check change progress.openspec instructions apply --change "<name>" --jsonRead 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,
PascalCasefor public APIs,_camelCasefor private fields. - Prefer focused types. Keep
SessionManagersingle-session; use coordinators such asMultiSessionManagerfor per-peer collections. - Preserve the client single-session path unless the task explicitly changes it.
- Treat
network-main-thread-dispatchas client-only. Shared/server work should align withshared-network-foundation,network-session-lifecycle, andmulti-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 testunless 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.