diff --git a/.claude/settings.json b/.claude/settings.json new file mode 100644 index 0000000..09c360a --- /dev/null +++ b/.claude/settings.json @@ -0,0 +1,14 @@ +{ + "permissions": { + "allow": [ + "mcp__codegraph__codegraph_explore", + "mcp__codegraph__codegraph_search", + "mcp__codegraph__codegraph_node", + "mcp__codegraph__codegraph_callers", + "mcp__codegraph__codegraph_callees", + "mcp__codegraph__codegraph_impact", + "mcp__codegraph__codegraph_files", + "mcp__codegraph__codegraph_status" + ] + } +} diff --git a/.codegraph/.gitignore b/.codegraph/.gitignore new file mode 100644 index 0000000..9de0f16 --- /dev/null +++ b/.codegraph/.gitignore @@ -0,0 +1,16 @@ +# CodeGraph data files +# These are local to each machine and should not be committed + +# Database +*.db +*.db-wal +*.db-shm + +# Cache +cache/ + +# Logs +*.log + +# Hook markers +.dirty diff --git a/.codegraph/daemon.pid b/.codegraph/daemon.pid new file mode 100644 index 0000000..6dabc54 --- /dev/null +++ b/.codegraph/daemon.pid @@ -0,0 +1,6 @@ +{ + "pid": 44608, + "version": "0.9.9", + "socketPath": "\\\\.\\pipe\\codegraph-97b92efdcc5351da", + "startedAt": 1781240018712 +} diff --git a/.cursor/mcp.json b/.cursor/mcp.json new file mode 100644 index 0000000..0a8af90 --- /dev/null +++ b/.cursor/mcp.json @@ -0,0 +1,14 @@ +{ + "mcpServers": { + "codegraph": { + "type": "stdio", + "command": "codegraph", + "args": [ + "serve", + "--mcp", + "--path", + "C:\\Users\\shats\\Dev\\EvoBGP" + ] + } + } +} diff --git a/.cursor/rules/context7-stack.mdc b/.cursor/rules/context7-stack.mdc new file mode 100644 index 0000000..1f86181 --- /dev/null +++ b/.cursor/rules/context7-stack.mdc @@ -0,0 +1,93 @@ +--- +description: Context7 — закреплённые ID библиотек и документации стека EvoBGP +alwaysApply: true +--- + +# Context7 — стек EvoBGP + +При вопросах об API, синтаксисе, конфигурации и миграциях библиотек **сначала** `query-docs` с ID из таблицы ниже. Шаг `resolve-library-id` **пропускать**, если библиотека уже перечислена (кроме неоднозначного случая). + +Локальные версии: `go.mod`, `web/package.json`. При расхождении с ID — предпочитать версию из репозитория. + +--- + +## Backend (Go) + +| Библиотека | Context7 ID | Версия в проекте | Когда | +|------------|-------------|------------------|-------| +| Go stdlib | `/golang/go/go1_24_6` | Go 1.24 | `net/http`, `context`, тесты, concurrency | +| pgx | `/websites/pkg_go_dev_github_com_jackc_pgx_v5` | v5.7.2 | PostgreSQL, pool, транзакции, типы | +| Prometheus Go client | `/prometheus/client_golang` | v1.20.5 | метрики, `/metrics`, middleware | +| modernc SQLite | `/websites/pkg_go_dev_modernc_org_sqlite` | v1.34.5 | SQLite-бэкенд, миграции sqlite | +| miekg/dns | `/miekg/dns` | v1.1.72 | DNS-запросы, DoH, pipeline | + +--- + +## HTTP-контракт и спецификации + +| Библиотека | Context7 ID | Версия в проекте | Когда | +|------------|-------------|------------------|-------| +| OpenAPI | `/oai/openapi-specification` | 3.x в `docs/openapi.yaml` | схемы, operationId, problem+json | +| Redocly CLI | `/redocly/redocly-cli` | CI `@redocly/cli` | lint OpenAPI, `npx @redocly/cli lint` | + +--- + +## Web UI (`web/`) + +| Библиотека | Context7 ID | Версия в проекте | Когда | +|------------|-------------|------------------|-------| +| Svelte | `/websites/svelte_dev` | ^5.54 | runes, компоненты, реактивность | +| SvelteKit | `/sveltejs/kit` | ^2.50 | routing, `load`, adapters, SSR | +| Vite | `/vitejs/vite/v7.3.1` | ^7.3.1 | dev server, build, plugins | +| TypeScript | `/microsoft/typescript/v5.9.3` | ^5.9.3 | типы, strict, tsconfig | +| Tailwind CSS | `/tailwindlabs/tailwindcss.com` | ^4.1 | v4, `@tailwindcss/vite`, утилиты | +| shadcn-svelte | `/websites/shadcn-svelte` | CLI | примитивы `ui/core`, theming | +| Bits UI | `/llmstxt/bits-ui_llms_txt` | ^2.17 | headless-примитивы под shadcn | +| sveltekit-superforms | `/ciscoheat/sveltekit-superforms` | ^2.30 | формы, server actions | +| Formsnap | `/svecosystem/formsnap` | ^2.0 | доступные поля форм | +| Zod | `/websites/zod_dev_v4` | ^4.4 | схемы валидации | +| TanStack Table | `/websites/tanstack_table` | table-core ^8.21 | `AppDataTable`, колонки, сортировка | + +UI-правила репозитория: `.cursor/rules/web-shadcn.mdc` (shadcn-svelte docs — первичный источник для компонентов). + +--- + +## Data plane / BGP + +| Библиотека | Context7 ID | Версия в проекте | Когда | +|------------|-------------|------------------|-------| +| BIRD 2 | `/llmstxt/bird_xmsl_dev_llms_txt` | BIRD2 в compose | `birdfmt`, фильтры, протоколы | +| BIRD (исходники) | `/cz-nic/bird` | — | низкоуровневый синтаксис daemon | + +Сетевые правила: `.cursor/rules/networking-bird.mdc`. + +--- + +## DevOps + +| Библиотека | Context7 ID | Версия в проекте | Когда | +|------------|-------------|------------------|-------| +| Docker Compose | `/docker/compose` | `deploy/compose/` | сервисы, profiles, volumes | +| Docker | `/docker/docs` | — | образы, bake, networking | + +--- + +## Приоритет источников + +1. **Контракт HTTP** — `docs/openapi.yaml` (не Context7). +2. **Context7** — синтаксис и API библиотек из таблицы. +3. **Локальные docs** — `docs/`, `web/README.md`, `AGENTS.md`. +4. **Официальный сайт** — BIRD: https://bird.network.cz/?get_doc (если Context7 не покрыл кейс). + +## Примеры запросов + +``` +/docs /websites/svelte_dev runes $state $derived +/docs /golang/go/go1_24_6 net/http ServeMux pattern matching +/docs /websites/pkg_go_dev_github_com_jackc_pgx_v5 pool acquire rows +/docs /llmstxt/bird_xmsl_dev_llms_txt filter bgp import +``` + +## Не через Context7 + +Рефакторинг `internal/*`, бизнес-логика EvoBGP, code review — код репозитория и `codegraph`. Context7 — только внешние библиотеки и инструменты. diff --git a/.cursor/settings.json b/.cursor/settings.json index 6595b05..1f01b6d 100644 --- a/.cursor/settings.json +++ b/.cursor/settings.json @@ -2,6 +2,9 @@ "plugins": { "svelte": { "enabled": true + }, + "claude-plugins-official/gopls-lsp": { + "enabled": true } } } diff --git a/.cursor/skills/context7-evobgp/SKILL.md b/.cursor/skills/context7-evobgp/SKILL.md new file mode 100644 index 0000000..59a2c24 --- /dev/null +++ b/.cursor/skills/context7-evobgp/SKILL.md @@ -0,0 +1,31 @@ +--- +name: context7-evobgp +description: Context7 lookup для стека EvoBGP — использовать закреплённые library ID из .cursor/rules/context7-stack.mdc вместо resolve-library-id. +--- + +# Context7 — EvoBGP stack + +Перед `query-docs` открой `.cursor/rules/context7-stack.mdc` и выбери ID из таблицы по области задачи. + +## Workflow + +1. Определи область: `internal/` (Go), `web/` (Svelte), `docs/openapi.yaml`, `birdfmt`/`pipeline` (BIRD), `deploy/compose` (Docker). +2. Найди строку в таблице `context7-stack.mdc`. +3. Вызови `query-docs` с `libraryId` из таблицы и полным вопросом пользователя. +4. `resolve-library-id` — только если библиотеки нет в таблице или нужна другая major-версия. + +## Быстрые ID (частые) + +| Задача | libraryId | +|--------|-----------| +| Svelte 5 runes | `/websites/svelte_dev` | +| SvelteKit load/forms | `/sveltejs/kit` | +| shadcn-svelte компонент | `/websites/shadcn-svelte` | +| pgx pool/query | `/websites/pkg_go_dev_github_com_jackc_pgx_v5` | +| Go net/http | `/golang/go/go1_24_6` | +| OpenAPI lint | `/redocly/redocly-cli` | +| BIRD config | `/llmstxt/bird_xmsl_dev_llms_txt` | +| Tailwind v4 | `/tailwindlabs/tailwindcss.com` | +| Zod 4 schema | `/websites/zod_dev_v4` | + +Полный список и версии — в `context7-stack.mdc`. diff --git a/.gemini/settings.json b/.gemini/settings.json new file mode 100644 index 0000000..87ca7de --- /dev/null +++ b/.gemini/settings.json @@ -0,0 +1,12 @@ +{ + "mcpServers": { + "codegraph": { + "type": "stdio", + "command": "codegraph", + "args": [ + "serve", + "--mcp" + ] + } + } +} diff --git a/.mcp.json b/.mcp.json new file mode 100644 index 0000000..87ca7de --- /dev/null +++ b/.mcp.json @@ -0,0 +1,12 @@ +{ + "mcpServers": { + "codegraph": { + "type": "stdio", + "command": "codegraph", + "args": [ + "serve", + "--mcp" + ] + } + } +} diff --git a/AGENTS.md b/AGENTS.md index 44dbf92..0d356a8 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -4,7 +4,7 @@ ## С чего начать (минимум чтения) -0. **Инженерные правила** — при изменении кода следовать [.cursor/rules/engineering.mdc](.cursor/rules/engineering.mdc); для `web/` — [.cursor/rules/web-shadcn.mdc](.cursor/rules/web-shadcn.mdc); для `birdfmt` / `pipeline` / BIRD — [.cursor/rules/networking-bird.mdc](.cursor/rules/networking-bird.mdc). +0. **Инженерные правила** — при изменении кода следовать [.cursor/rules/engineering.mdc](.cursor/rules/engineering.mdc); для `web/` — [.cursor/rules/web-shadcn.mdc](.cursor/rules/web-shadcn.mdc); для `birdfmt` / `pipeline` / BIRD — [.cursor/rules/networking-bird.mdc](.cursor/rules/networking-bird.mdc). **Context7 (документация библиотек)** — закреплённые ID стека: [.cursor/rules/context7-stack.mdc](.cursor/rules/context7-stack.mdc); скилл [.cursor/skills/context7-evobgp/SKILL.md](.cursor/skills/context7-evobgp/SKILL.md). 1. **[docs/README.md](docs/README.md)** — оглавление и роли читателя. 2. **[docs/architecture.md](docs/architecture.md)** — компоненты `cmd/`, карта `internal/`, потоки данных (одного этого файла обычно достаточно для ориентации). 3. Задача-специфично: [docs/api.md](docs/api.md), [docs/access.md](docs/access.md), [web/README.md](web/README.md) — только если меняете API, доступ или фронт. diff --git a/opencode.jsonc b/opencode.jsonc new file mode 100644 index 0000000..2c2509a --- /dev/null +++ b/opencode.jsonc @@ -0,0 +1,14 @@ +{ + "$schema": "https://opencode.ai/config.json", + "mcp": { + "codegraph": { + "type": "local", + "command": [ + "codegraph", + "serve", + "--mcp" + ], + "enabled": true + } + } +}