2.9 KiB
2.9 KiB
AI Agent Guidance for this Repository
Repository overview
- Backend:
backend/using FastAPI, Python 3.11+,uvicorn --reloadfor development. - Frontend:
frontend/using React 18 + Vite + TypeScript, with Zustand for state. - Runtime data is stored under
data/as JSON/files; do not treat it as source code. - Docker support exists via
docker-compose.ymlanddocs/DOCKER_DEV.md.
What an AI coding agent should do first
- Read
README.mdanddocs/DOCKER_DEV.mdbefore proposing environment or run commands. - Identify whether a change belongs in
backend/orfrontend/. - Prefer small, incremental edits.
- When in doubt, ask the user before making large refactors or architectural changes.
Build / run commands
Backend local
python -m venv venvvenv\Scripts\activate(Windows)pip install -r backend/requirements.txtcd backend && python main.py
Frontend local
cd frontendnpm installnpm run dev
Docker development
.\scripts\docker-up.ps1.\scripts\docker-restart.ps1 -Service backend.\scripts\docker-rebuild.ps1 -Service backend.\scripts\docker-logs.ps1docker compose -f docker-compose.yml -f docker-compose.dev.yml up -d
Testing and quality checks
- Backend tests live in
backend/tests/. - Use
python -m pytest backend/testsfor automated backend test runs. - Frontend has lint/type-check scripts in
frontend/package.json:npm run lintnpm run type-check
- Prefer adding or updating tests for bug fixes, new features, and non-trivial behavior changes.
- Keep changes tidy and consistent with the repository's existing style.
Code conventions and review preferences
- The user prefers code that is:
- 基本审查过的
- 规范整洁的
- 严谨测试覆盖的
- Do not perform sweeping refactors without explicit user approval.
- If a change affects core logic, clearly explain the reason and the hypothesis for the fix.
- For any change, state whether it is:
- bug fix
- cleanup/refactor
- feature addition
Important paths and domains
backend/main.py— FastAPI app entrypointbackend/api/— HTTP route definitionsbackend/services/— core business logic and domain servicesbackend/models/— data models and convertersbackend/utils/— shared helper modulesfrontend/src/— React source codefrontend/package.json— frontend scripts and dependenciesdocs/DOCKER_DEV.md— Docker development guidance
Practical guidance for AI agents
- Avoid editing generated or runtime content in
data/unless explicitly asked. - Prefer changes that are easy to reason about and test.
- Use existing test tools rather than inventing new workflows.
- Link to repository docs instead of duplicating long explanations.
- If a requested change is uncertain, ask for clarification rather than guessing.
References
README.mddocs/DOCKER_DEV.mdfrontend/package.jsonbackend/requirements.txt