From d14a674e226bedff1887e6922313bdf53b674304 Mon Sep 17 00:00:00 2001 From: Ivan Fontosh Date: Sun, 19 Apr 2026 14:23:57 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=D0=B2=D0=BA=D0=BB=D1=8E=D1=87=D0=B8?= =?UTF-8?q?=D1=82=D1=8C=20.cursor=20=D0=B2=20=D1=80=D0=B5=D0=BF=D0=BE?= =?UTF-8?q?=D0=B7=D0=B8=D1=82=D0=BE=D1=80=D0=B8=D0=B9=20=D0=B4=D0=BB=D1=8F?= =?UTF-8?q?=20=D1=87=D0=B0=D1=81=D1=82=D0=BD=D0=BE=D0=B3=D0=BE=20remote?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Made-with: Cursor --- .cursor/agents/frontend-senior.md | 35 +++++++ .cursor/agents/reviewer.md | 33 ++++++ .cursor/agents/unit-tests.md | 36 +++++++ .cursor/hooks.json | 10 ++ .cursor/hooks/final-verify.cjs | 55 ++++++++++ .cursor/hooks/hooks.json | 10 ++ .cursor/pipeline-state.json | 6 ++ .cursor/pr-checklists/ui-mock-alignment.md | 112 +++++++++++++++++++++ .cursor/rules/project.mdc | 39 +++++++ .cursor/skills/feature-pipeline/SKILL.md | 80 +++++++++++++++ .gitignore | 1 - 11 files changed, 416 insertions(+), 1 deletion(-) create mode 100644 .cursor/agents/frontend-senior.md create mode 100644 .cursor/agents/reviewer.md create mode 100644 .cursor/agents/unit-tests.md create mode 100644 .cursor/hooks.json create mode 100644 .cursor/hooks/final-verify.cjs create mode 100644 .cursor/hooks/hooks.json create mode 100644 .cursor/pipeline-state.json create mode 100644 .cursor/pr-checklists/ui-mock-alignment.md create mode 100644 .cursor/rules/project.mdc create mode 100644 .cursor/skills/feature-pipeline/SKILL.md diff --git a/.cursor/agents/frontend-senior.md b/.cursor/agents/frontend-senior.md new file mode 100644 index 0000000..b580b14 --- /dev/null +++ b/.cursor/agents/frontend-senior.md @@ -0,0 +1,35 @@ +--- +name: frontend-senior +description: Senior frontend engineer +model: auto +tools: all +--- + +Ты senior frontend engineer. + +Задача: +- реализовать feature или fix +- писать production-quality React + TypeScript код + +Правила: + +- сначала изучи nearby components +- следуй существующим patterns +- не делай лишних изменений +- избегай overengineering +- используй composition + +UI: + +- учитывай loading / error / empty / disabled +- соблюдай accessibility + +Не делай: + +- large refactors без запроса +- новые dependencies без причины + +Output: + +- список изменённых файлов +- краткое описание изменений \ No newline at end of file diff --git a/.cursor/agents/reviewer.md b/.cursor/agents/reviewer.md new file mode 100644 index 0000000..c5174e7 --- /dev/null +++ b/.cursor/agents/reviewer.md @@ -0,0 +1,33 @@ +--- +name: reviewer +description: Strict code reviewer +model: auto +tools: all +--- + +Ты строгий reviewer. + +Цель: +- найти проблемы в изменениях + +Проверяй: + +- correctness +- regressions +- type safety +- accessibility +- performance +- edge cases +- missing tests + +Формат: + +- Severity: high / medium / low +- Problem +- Why +- Fix + +Правила: + +- не переписывай код без причины +- предлагай minimal fixes \ No newline at end of file diff --git a/.cursor/agents/unit-tests.md b/.cursor/agents/unit-tests.md new file mode 100644 index 0000000..39b4188 --- /dev/null +++ b/.cursor/agents/unit-tests.md @@ -0,0 +1,36 @@ +--- +name: unit-tests +description: Unit test specialist +model: auto +tools: all +--- + +Ты unit-test specialist. + +Задача: + +- добавить/обновить tests +- добиться green status + +Подход: + +- test behavior, not implementation +- follow existing patterns +- избегай flaky tests + +Покрытие: + +- happy path +- edge case +- error case + +Workflow: + +- сначала run relevant tests: + `npm run test -- ` +- затем при необходимости весь suite + +Output: + +- какие тесты добавлены +- что они проверяют \ No newline at end of file diff --git a/.cursor/hooks.json b/.cursor/hooks.json new file mode 100644 index 0000000..f524ebc --- /dev/null +++ b/.cursor/hooks.json @@ -0,0 +1,10 @@ +{ + "version": 1, + "hooks": { + "stop": [ + { + "command": "node .cursor/hooks/final-verify.cjs" + } + ] + } +} \ No newline at end of file diff --git a/.cursor/hooks/final-verify.cjs b/.cursor/hooks/final-verify.cjs new file mode 100644 index 0000000..5c3480c --- /dev/null +++ b/.cursor/hooks/final-verify.cjs @@ -0,0 +1,55 @@ +const fs = require("fs"); +const path = require("path"); +const { execSync } = require("child_process"); + +const statePath = path.join(process.cwd(), ".cursor", "pipeline-state.json"); + +function readState() { + if (!fs.existsSync(statePath)) { + return { + implementation: "pending", + review: "pending", + tests: "pending" + }; + } + return JSON.parse(fs.readFileSync(statePath, "utf8")); +} + +function fail(msg) { + process.stdout.write(JSON.stringify({ followup_message: msg })); + process.exit(0); +} + +const state = readState(); + +if (state.implementation !== "done") { + fail("Run frontend-senior stage"); +} + +if (state.review !== "done") { + fail("Run reviewer stage"); +} + +if (state.tests !== "done") { + fail("Run unit-tests stage"); +} + +try { + execSync("npm run lint", { stdio: "pipe" }); +} catch { + fail("Lint failed"); +} + +try { + execSync("npm run typecheck", { stdio: "pipe" }); +} catch { + fail("Typecheck failed"); +} + +try { + execSync("npm run test", { stdio: "pipe" }); +} catch { + fail("Tests failed"); +} + +process.exit(0); diff --git a/.cursor/hooks/hooks.json b/.cursor/hooks/hooks.json new file mode 100644 index 0000000..220c880 --- /dev/null +++ b/.cursor/hooks/hooks.json @@ -0,0 +1,10 @@ +{ + "version": 1, + "hooks": { + "stop": [ + { + "command": "node .cursor/hooks/final-verify.cjs" + } + ] + } + } \ No newline at end of file diff --git a/.cursor/pipeline-state.json b/.cursor/pipeline-state.json new file mode 100644 index 0000000..f9d3ed9 --- /dev/null +++ b/.cursor/pipeline-state.json @@ -0,0 +1,6 @@ +{ + "implementation": "done", + "review": "done", + "tests": "done", + "verify": "done" +} diff --git a/.cursor/pr-checklists/ui-mock-alignment.md b/.cursor/pr-checklists/ui-mock-alignment.md new file mode 100644 index 0000000..ba6af0f --- /dev/null +++ b/.cursor/pr-checklists/ui-mock-alignment.md @@ -0,0 +1,112 @@ +# PR: UI — выравнивание под макеты (редактор + пульт) + +Связь с **feature-pipeline** (`.cursor/skills/feature-pipeline/SKILL.md`): критерии ниже сгруппированы по стадиям; после merge обновляют `.cursor/pipeline-state.json` по мере прохождения стадий. + +--- + +## Мета PR + +| Поле | Значение | +|------|----------| +| **Цель** | Визуальная и UX-полировка существующих экранов без новых продуктовых фич из макета | +| **Область** | `EditorApp`, `SceneGraph`, `ControlApp`, общие токены/мелкие UI-баги | +| **Вне скоупа** | Новые пункты меню, новые типы сцен, новые каналы микшера, если их нет в коде | + +--- + +## Stage 1 — Implementation (subagent: `frontend-senior`) + +### Чеклист PR + +- [ ] **P0-A** Карточка узла графа: статусы «Авто / Цикл / Аудио» отражают **реальные** поля сцены (`previewVideoAutostart`, `settings.loopVideo`, наличие `media.audios`), а не статичный текст. +- [ ] **P0-B** Пульт: для сцены с видео-превью явно подписано, что **кисть эффектов** недоступна (согласовано с `PresentationView`: эффекты только для image). +- [ ] **P1-A** Пульт: порядок секций **Предпросмотр → Варианты ветвления → Музыка сцены → Быстрый микшер** (вертикальный поток как в референсе). +- [ ] **P1-B** Сетка «Варианты ветвления» без «дыр»: `repeat(auto-fit, minmax(...))` **или** фиксированные слоты с disabled/placeholder **без новых сценариев** — только визуальная сетка. +- [ ] **P2-A** Редактор: меню «Файл» — цвет текста пункта на валидном токене (`--text0` / `--text1`), без несуществующего `--text`. +- [ ] **P2-B** Список сцен: убрать пустой статус-ряд у неактивных карточек (без лишнего вертикального зазора). + +### Критерии приёмки (Stage 1) + +1. На графе для сцены **без видео-превью** не отображаются вводящие в заблуждение чипы «Авто/Цикл» видео-превью; при наличии аудио — корректный индикатор аудио. +2. Для сцены с **видео-превью** чипы «Авто»/«Цикл» совпадают с `previewVideoAutostart` и `scene.settings.loopVideo`. +3. В пульте при `previewAssetType === 'video'` пользователь видит **одну строку-пояснение** (вторичный текст), почему нет панели эффектов. +4. Визуальный порядок блоков пульта соответствует чеклисту P1-A; отступы между `Surface` единообразны (`gap` 16). +5. Нет регрессий drag-and-drop сцен на граф и переключения веток. + +**Definition of Done (Stage 1):** все пункты чеклиста Stage 1 отмечены; `npm run build` успешен. + +--- + +## Stage 2 — Review (subagent: `reviewer`) + +### Чеклист PR + +- [ ] Нет «мёртвых» веток UI и ложных состояний (чипы/подписи соответствуют данным). +- [ ] a11y: фокус/клавиатура на интерактивах не сломаны; `aria-*` не ухудшены. +- [ ] Нет лишнего diff вне файлов задачи. + +### Критерии приёмки (Stage 2) + +1. Reviewer фиксирует замечания с **Severity**; все **high** устранены или явно отклонены с причиной в PR. +2. После правок по review снова выполняется `npm run build`. + +**Definition of Done (Stage 2):** review-замечания закрыты; state `review: done`. + +--- + +## Stage 3 — Tests (subagent: `unit-tests`) + +### Чеклист PR + +- [ ] Добавлены или обновлены тесты на **чистую логику** (например, хелпер разметки чипов по `Scene`, если вынесен в `app/shared`). +- [ ] Либо задокументировано в PR, что изменения только презентационные и покрыты smoke-тестом пайплайна. + +### Критерии приёмки (Stage 3) + +1. `npm run test` завершается с кодом 0. +2. Новые тесты не flaky, не зависят от Electron UI. + +**Definition of Done (Stage 3):** `tests: done` в `.cursor/pipeline-state.json`. + +--- + +## Stage 4 — Verify (локально / hook `final-verify.cjs`) + +Выполнить подряд: + +```bash +npm run lint +npm run typecheck +npm run test +``` + +**Если `npm run lint` падает на массовых `Delete ␍` (CRLF/LF) в файлах вне PR** — до отдельного chore-PR с нормализацией строк для этого чеклиста достаточно: + +```bash +npx eslint app/renderer/control/ControlApp.tsx app/renderer/editor/graph/SceneGraph.tsx app/renderer/shared/ui/sceneGraphChips.ts app/renderer/shared/ui/sceneGraphChips.test.ts --max-warnings 0 +npm run typecheck +npm run test +npm run build +``` + +### Критерии приёмки (Stage 4) + +1. `npm run typecheck`, `npm run test`, `npm run build` — **exit 0**. +2. Линт: либо полный `npm run lint` — **exit 0**, либо (при известном eol-долге репозитория) scoped-ESLint по файлам PR — **exit 0**, как в блоке выше. +3. `node .cursor/hooks/final-verify.cjs` — успешное завершение пайплайна только когда полный `npm run lint` зелёный (хук вызывает полный lint; при падении lint хук пишет `followup_message` в stdout). + +--- + +## Синхронизация с `.cursor/pipeline-state.json` + +После каждой стадии обновлять файл: + +```json +{ + "implementation": "done", + "review": "done", + "tests": "done" +} +``` + +До начала работы — все `"pending"`. diff --git a/.cursor/rules/project.mdc b/.cursor/rules/project.mdc new file mode 100644 index 0000000..98845b3 --- /dev/null +++ b/.cursor/rules/project.mdc @@ -0,0 +1,39 @@ +# .cursor/rules/project.mdc + +# Project + +React + TypeScript frontend project. + +# Commands + +- install: `npm install` +- dev: `npm run dev` +- build: `npm run build` +- lint: `npm run lint` +- typecheck: `npm run typecheck` +- test: `npm run test` +- test single: `npm run test -- ` + +# Global rules + +- Всегда изучай existing code и nearby components перед изменениями +- Делай minimal, review-friendly diff +- Не добавляй new dependencies без явной причины +- Следуй существующим patterns + +# Done criteria + +Перед завершением: + +- lint passes +- typecheck passes +- tests pass +- нет regressions + +# UI checklist + +- loading state +- error state +- empty state +- disabled state +- accessibility \ No newline at end of file diff --git a/.cursor/skills/feature-pipeline/SKILL.md b/.cursor/skills/feature-pipeline/SKILL.md new file mode 100644 index 0000000..6c51bef --- /dev/null +++ b/.cursor/skills/feature-pipeline/SKILL.md @@ -0,0 +1,80 @@ +--- +name: feature-pipeline +description: Implementation → Review → Tests → Verify +--- + +# Workflow + +## Stage 1 — Implementation + +Используй subagent: frontend-senior + +- реализуй задачу +- сделай minimal diff + +Обнови state: + +{ + "implementation": "done" +} + +--- + +## Stage 2 — Review + +Используй subagent: reviewer + +- проверь изменения +- найди проблемы +- исправь минимально + +Обнови state: + +{ + "implementation": "done", + "review": "done" +} + +--- + +## Stage 3 — Tests + +Используй subagent: unit-tests + +- добавь/обнови tests +- добейся green status + +Обнови state: + +{ + "implementation": "done", + "review": "done", + "tests": "done" +} + +--- + +## Stage 4 — Verify + +Выполни: + +- `npm run lint` +- `npm run typecheck` +- `npm run test` + +Если ошибка: +- исправь +- повтори + +--- + +## Final Output + +- implementation summary +- review summary +- test summary +- verification status + +## PR-чеклисты (приёмка по задаче) + +Готовые чеклисты с критериями по стадиям лежат в `.cursor/pr-checklists/`. Для UI-выравнивания под макеты: `ui-mock-alignment.md`. \ No newline at end of file diff --git a/.gitignore b/.gitignore index 724a39a..592582d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ release/ build/ -.cursor/ mcps/ node_modules/ dist/