From f6375e7d0f9b08f38a2b2efb1d71b1a1175570d5 Mon Sep 17 00:00:00 2001 From: Nikolay Tatarinov Date: Tue, 3 Mar 2026 23:47:48 +0300 Subject: [PATCH] Update project configuration and documentation - Modified .gitignore to retain rules directory while excluding other cursor files. - Updated backend-go.mdc to clarify compatibility notes. - Enhanced project-conventions.mdc with guidelines on coding practices and running tests. - Added SKILL.md for detailed instructions on running backend and frontend tests in the hnh-map monorepo. --- .cursor/rules/backend-go.mdc | 2 +- .cursor/rules/project-conventions.mdc | 2 + .cursor/skills/run-tests/SKILL.md | 53 +++++++++++++++++++++++++++ .gitignore | 2 - 4 files changed, 56 insertions(+), 3 deletions(-) create mode 100644 .cursor/skills/run-tests/SKILL.md diff --git a/.cursor/rules/backend-go.mdc b/.cursor/rules/backend-go.mdc index 3cc2349..5ace8d9 100644 --- a/.cursor/rules/backend-go.mdc +++ b/.cursor/rules/backend-go.mdc @@ -8,4 +8,4 @@ alwaysApply: false - Entry point: [cmd/hnh-map/main.go](cmd/hnh-map/main.go). All app logic in `internal/app/` (package `app`): `app.go`, `auth.go`, `api.go`, `map.go`, `tile.go`, `admin_*.go`, `client*.go`, `migrations.go`, etc. - Use `go fmt ./...` before committing. Run `go test ./...` when changing behaviour. -- Compatibility note: keep in mind [hnh-auto-mapper-server](https://github.com/APXEOLOG/hnh-auto-mapper-server) when touching client protocol or public API. +- Compatibility note: keep in mind [hnh-auto-mapper-server](https://github.com/APXEOLOG/hnh-auto-mapper-server) when touching client protocol or public API. \ No newline at end of file diff --git a/.cursor/rules/project-conventions.mdc b/.cursor/rules/project-conventions.mdc index b73d257..9ec1a47 100644 --- a/.cursor/rules/project-conventions.mdc +++ b/.cursor/rules/project-conventions.mdc @@ -10,3 +10,5 @@ alwaysApply: true - **Changing config:** Update [.env.example](.env.example) and [docs/configuration.md](docs/configuration.md). - **Local run / build:** [docs/development.md](docs/development.md), [CONTRIBUTING.md](CONTRIBUTING.md). Dev ports: frontend 3000, backend 3080; prod: 8080. - **Docs:** [docs/](docs/) (architecture, API, configuration, development, deployment). Some docs are in Russian. +- **Coding:** Write tests first before implementing any functionality. +- **Running tests:** When the user asks to run tests or to verify changes, use the run-tests skill: [.cursor/skills/run-tests/SKILL.md](.cursor/skills/run-tests/SKILL.md). diff --git a/.cursor/skills/run-tests/SKILL.md b/.cursor/skills/run-tests/SKILL.md new file mode 100644 index 0000000..f6477fb --- /dev/null +++ b/.cursor/skills/run-tests/SKILL.md @@ -0,0 +1,53 @@ +--- +name: run-tests +description: Runs backend (Go) and frontend (Vitest) tests for the hnh-map monorepo. Use when the user asks to run tests, verify tests, or after making code changes that should be validated. +--- + +# Run tests + +## When to run + +- User asks to run tests, run the test suite, or verify tests pass. +- After implementing or changing code that should be validated by tests. + +## What to run + +This repo has two test suites. Run the one(s) that match the changed code, or both if unsure. + +### Backend (Go) + +From repo root: + +```bash +make test +``` + +Or: + +```bash +go test ./... +``` + +Uses temp dirs and in-memory DBs; no external services needed. + +### Frontend (Vitest) + +From repo root: + +```bash +npm --prefix frontend-nuxt run test +``` + +Or from `frontend-nuxt/`: + +```bash +npm test +``` + +## Scope + +- **Backend-only changes** (e.g. `internal/`, `cmd/`): run `make test`. +- **Frontend-only changes** (e.g. `frontend-nuxt/`): run `npm --prefix frontend-nuxt run test`. +- **Both or unclear**: run backend then frontend. + +Report pass/fail and any failing test names or errors. diff --git a/.gitignore b/.gitignore index 791b617..cbccebf 100644 --- a/.gitignore +++ b/.gitignore @@ -23,6 +23,4 @@ frontend/dist # OS / IDE .DS_Store -.cursor/* -!.cursor/rules/ .vscode/ \ No newline at end of file