# QuoteForge - Claude Code Instructions ## Overview Корпоративный конфигуратор серверов с offline-first архитектурой. Приложение работает через локальную SQLite базу, синхронизация с MariaDB выполняется фоново. ## Product Scope - Конфигуратор компонентов и расчёт КП - Проекты и конфигурации - Read-only просмотр прайслистов из локального кэша - Sync (pull компонентов/прайслистов, push локальных изменений) Из области исключены: - admin pricing UI/API - stock import - alerts - cron/importer утилиты ## Architecture - Local-first: чтение и запись происходят в SQLite - MariaDB используется как сервер синхронизации - Background worker: периодический sync push+pull ## Guardrails - Не возвращать в проект удалённые legacy-разделы: cron jobs, importer utility, admin pricing, alerts, stock import. - Runtime-конфиг читается из user state (`config.yaml`) или через `-config` / `QFS_CONFIG_PATH`; не хранить рабочий `config.yaml` в репозитории. - `config.example.yaml` остаётся единственным шаблоном конфигурации в репо. - Любые изменения в sync должны сохранять local-first поведение: локальные CRUD не блокируются из-за недоступности MariaDB. ## Key SQLite Data - `connection_settings` - `local_components` - `local_pricelists`, `local_pricelist_items` - `local_configurations` - `local_projects` - `pending_changes` ## API Endpoints | Group | Endpoints | |-------|-----------| | Setup | `GET /setup`, `POST /setup`, `POST /setup/test`, `GET /setup/status` | | Components | `GET /api/components`, `GET /api/components/:lot_name`, `GET /api/categories` | | Quote | `POST /api/quote/validate`, `POST /api/quote/calculate`, `POST /api/quote/price-levels` | | Pricelists (read-only) | `GET /api/pricelists`, `GET /api/pricelists/latest`, `GET /api/pricelists/:id`, `GET /api/pricelists/:id/items`, `GET /api/pricelists/:id/lots` | | Configs | CRUD + refresh/clone/reactivate/rename/project binding via `/api/configs/*` | | Projects | CRUD + nested configs via `/api/projects/*` | | Sync | `GET /api/sync/status`, `GET /api/sync/readiness`, `GET /api/sync/info`, `GET /api/sync/users-status`, `POST /api/sync/components`, `POST /api/sync/pricelists`, `POST /api/sync/all`, `POST /api/sync/push`, `GET /api/sync/pending`, `GET /api/sync/pending/count` | | Export | `POST /api/export/csv` | ## Web Routes - `/configs` - `/configurator` - `/projects` - `/projects/:uuid` - `/pricelists` - `/pricelists/:id` - `/setup` ## Release Notes & Change Log Release notes are maintained in `releases/memory/` directory organized by version tags (e.g., `v1.2.1.md`). Before working on the codebase, review the most recent release notes to understand recent changes. - Check `releases/memory/` for detailed changelog between tags - Each release file documents commits, breaking changes, and migration notes ## Commands ```bash # Development go run ./cmd/qfs make run # Build make build-release CGO_ENABLED=0 go build -o bin/qfs ./cmd/qfs # Verification go build ./cmd/qfs go vet ./... ``` ## Code Style - gofmt - structured logging (`slog`) - explicit error wrapping with context