From 747ff59d76db138923bdff26616d432a87c906fe Mon Sep 17 00:00:00 2001 From: xiong Date: Tue, 28 Jul 2026 12:28:53 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E4=BB=93=E5=BA=93?= =?UTF-8?q?=E6=8C=87=E5=8D=97=E6=96=87=E6=A1=A3=EF=BC=8C=E5=8C=85=E5=90=AB?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E7=BB=93=E6=9E=84=E3=80=81=E6=9E=84=E5=BB=BA?= =?UTF-8?q?=E5=91=BD=E4=BB=A4=E3=80=81=E7=BC=96=E7=A0=81=E9=A3=8E=E6=A0=BC?= =?UTF-8?q?=E5=8F=8A=E6=B5=8B=E8=AF=95=E8=A7=84=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AGENTS.md | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 AGENTS.md diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..00842ad --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,38 @@ +# Repository Guidelines + +## Project Structure & Module Organization + +`TIKU-BACKEND.slnx` groups production projects under `src` and tests under `tests`. `Tiku.Api` contains controllers, middleware, authentication, and OpenAPI setup. `Tiku.Application` defines use cases and provider interfaces; `Tiku.Domain` owns entities and enums; `Tiku.Infrastructure` implements EF Core persistence and external providers. Use `Tiku.DbMigrator` for schema changes and `Tiku.Worker` for background processing. Tests live in `Tiku.UnitTests` and `Tiku.IntegrationTests`; architecture decisions and migration notes belong in `docs/`. + +Keep dependencies pointed inward: Domain must remain infrastructure-free, Application expresses abstractions, and provider SDKs or secret access stay in Infrastructure. + +## Build, Test, and Development Commands + +Run commands from the repository root: + +```bash +dotnet restore TIKU-BACKEND.slnx +dotnet build TIKU-BACKEND.slnx --no-restore +dotnet test TIKU-BACKEND.slnx --no-build +dotnet format TIKU-BACKEND.slnx --verify-no-changes --no-restore +dotnet run --project Tiku.Api +dotnet run --project Tiku.DbMigrator +``` + +The API and migrator require PostgreSQL through `ConnectionStrings:Database` or `DATABASE_URL`. Generate reviewable migration SQL with `dotnet ef migrations script --project Tiku.Infrastructure --startup-project Tiku.DbMigrator`. Also run `git diff --check` before committing. + +## Coding Style & Naming Conventions + +Use standard C# formatting: four-space indentation, file-scoped namespaces, nullable reference types, and implicit usings. Use PascalCase for types and public members, camelCase for locals and parameters, and prefix interfaces with `I`. Keep async methods suffixed `Async`. Database identifiers are mapped to `snake_case`; do not bypass centralized EF configurations or tenant safeguards. + +## Testing Guidelines + +Tests use xUnit and follow `*Tests.cs`; test methods use descriptive behavior names such as `Password_login_can_access_current_user_and_tenant`. Add focused unit tests for isolated logic and integration tests for API, EF model, migration, authorization, and tenant-isolation behavior. PostgreSQL-specific invariants must be proven against real PostgreSQL, not only the in-memory provider. No numeric coverage threshold is configured, but every behavior change needs regression coverage. + +## Commit & Pull Request Guidelines + +History follows Conventional Commit subjects such as `feat:`, `fix:`, `refactor(api):`, `docs:`, and `chore:`. Keep commits narrow and imperative. Pull requests should explain the behavior and architectural impact, link the issue or migration phase, identify schema/configuration changes, and list verification commands. Include screenshots only for generated API documentation or other visible output; never commit credentials or temporary bootstrap passwords. + +## Agent-Specific Instructions + +When `.codegraph/` exists, use `codegraph explore ""` before text search for code discovery. Treat tenant context, authorization, migrations, and provider boundaries as security-sensitive changes requiring targeted integration tests.