@bonesofspring/ai-rules 0.1.36 → 0.1.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/README.md +7 -3
  2. package/bin/cli.js +55 -31
  3. package/package.json +1 -1
  4. package/presets/claude/next/CLAUDE.md +24 -5
  5. package/presets/claude/next/agents/code-reviewer.md +56 -0
  6. package/presets/claude/next/agents/debugger.md +58 -0
  7. package/presets/claude/next/agents/feature-developer.md +45 -0
  8. package/presets/claude/next/agents/qa-tester.md +54 -0
  9. package/presets/claude/next/agents/solution-architect.md +70 -0
  10. package/presets/claude/next/agents/task-analyst.md +105 -0
  11. package/presets/claude/next/agents/task-router.md +105 -0
  12. package/presets/claude/next/commands/README.md +5 -1
  13. package/presets/claude/next/commands/feature-continue.md +46 -0
  14. package/presets/claude/next/commands/feature-start.md +25 -0
  15. package/presets/claude/next/commands/task-continue.md +43 -0
  16. package/presets/claude/next/commands/task.md +40 -0
  17. package/presets/claude/next/commands/technical-retro.md +53 -0
  18. package/presets/claude/next/rules/README.md +47 -11
  19. package/presets/claude/next/rules/api-and-data/README.md +7 -1
  20. package/presets/claude/next/rules/api-and-data/api-services.md +57 -0
  21. package/presets/claude/next/rules/api-and-data/http-client.md +40 -0
  22. package/presets/claude/next/rules/api-and-data/store-rtk.md +65 -0
  23. package/presets/claude/next/rules/architecture/README.md +11 -1
  24. package/presets/claude/next/rules/architecture/api-public-imports.md +25 -0
  25. package/presets/claude/next/rules/architecture/architecture-boundaries.md +67 -0
  26. package/presets/claude/next/rules/architecture/feature-delivery-workflow.md +99 -0
  27. package/presets/claude/next/rules/architecture/layer-barrel-exports.md +53 -0
  28. package/presets/claude/next/rules/architecture/types-public-imports.md +28 -0
  29. package/presets/claude/next/rules/stack/README.md +9 -1
  30. package/presets/claude/next/rules/stack/arrow-functions.md +40 -0
  31. package/presets/claude/next/rules/stack/navigation-router.md +56 -0
  32. package/presets/claude/next/rules/stack/next-app-core.md +83 -0
  33. package/presets/claude/next/rules/stack/no-type-assertion.md +52 -0
  34. package/presets/claude/next/rules/stack/types-jsdoc.md +37 -0
  35. package/presets/claude/next/rules/testing/README.md +9 -1
  36. package/presets/claude/next/rules/testing/playwright-agents.md +69 -0
  37. package/presets/claude/next/rules/testing/tests-e2e-structure.md +52 -0
  38. package/presets/claude/next/rules/testing/tests-unit.md +66 -0
  39. package/presets/claude/next/rules/tooling-and-review/README.md +12 -1
  40. package/presets/claude/next/rules/tooling-and-review/agent-team-intake.md +9 -0
  41. package/presets/claude/next/rules/tooling-and-review/agent-team-orchestrator.md +97 -0
  42. package/presets/claude/next/rules/tooling-and-review/code-quality.md +50 -0
  43. package/presets/claude/next/rules/tooling-and-review/code-review-mr.md +67 -0
  44. package/presets/claude/next/rules/tooling-and-review/package-manager.md +20 -0
  45. package/presets/claude/next/rules/tooling-and-review/post-change-lint.md +43 -0
  46. package/presets/claude/next/rules/ui-and-accessibility/README.md +8 -1
  47. package/presets/claude/next/rules/ui-and-accessibility/component-styles.md +50 -0
  48. package/presets/claude/next/rules/ui-and-accessibility/css-property-order.md +20 -0
  49. package/presets/claude/next/rules/ui-and-accessibility/no-props-spread.md +52 -0
  50. package/presets/claude/next/rules/ui-and-accessibility/react-ui.md +90 -0
  51. package/presets/claude/next/team/README.md +64 -0
  52. package/presets/claude/next/team/tasks/.gitkeep +1 -0
  53. package/presets/cursor/next/agents/README.md +25 -0
  54. package/presets/cursor/next/agents/code-reviewer.md +57 -0
  55. package/presets/cursor/next/agents/debugger.md +59 -0
  56. package/presets/cursor/next/agents/feature-developer.md +46 -0
  57. package/presets/cursor/next/agents/qa-tester.md +55 -0
  58. package/presets/cursor/next/agents/solution-architect.md +71 -0
  59. package/presets/cursor/next/agents/task-analyst.md +111 -0
  60. package/presets/cursor/next/agents/task-router.md +106 -0
  61. package/presets/cursor/next/commands/README.md +33 -1
  62. package/presets/cursor/next/commands/feature-continue.md +14 -0
  63. package/presets/cursor/next/commands/feature-start.md +28 -0
  64. package/presets/cursor/next/commands/task-continue.md +43 -0
  65. package/presets/cursor/next/commands/task.md +40 -0
  66. package/presets/cursor/next/commands/technical-retro.md +76 -0
  67. package/presets/cursor/next/hooks/chain-team-phases.sh +216 -0
  68. package/presets/cursor/next/hooks.json +11 -0
  69. package/presets/cursor/next/rules/README.md +11 -3
  70. package/presets/cursor/next/rules/agent-team-intake.mdc +14 -0
  71. package/presets/cursor/next/rules/agent-team-orchestrator.mdc +102 -0
  72. package/presets/cursor/next/rules/api-public-imports.mdc +1 -0
  73. package/presets/cursor/next/rules/api-services.mdc +1 -0
  74. package/presets/cursor/next/rules/architecture-boundaries.mdc +1 -1
  75. package/presets/cursor/next/rules/code-quality-and-refactoring.mdc +9 -0
  76. package/presets/cursor/next/rules/code-review-mr.mdc +6 -7
  77. package/presets/cursor/next/rules/css-property-order-stylelint.mdc +25 -0
  78. package/presets/cursor/next/rules/feature-delivery-workflow.mdc +5 -5
  79. package/presets/cursor/next/rules/layer-barrel-exports.mdc +58 -0
  80. package/presets/cursor/next/rules/next-app-core.mdc +1 -1
  81. package/presets/cursor/next/rules/no-cross-component-styles-import.mdc +55 -0
  82. package/presets/cursor/next/rules/no-props-spread.mdc +26 -3
  83. package/presets/cursor/next/rules/package-manager.mdc +25 -0
  84. package/presets/cursor/next/rules/post-change-lint.mdc +48 -0
  85. package/presets/cursor/next/rules/react-ui.mdc +31 -2
  86. package/presets/cursor/next/rules/technical-retro.mdc +5 -51
  87. package/presets/cursor/next/rules/tests-unit.mdc +1 -0
  88. package/presets/cursor/next/rules/types-public-imports.mdc +1 -0
  89. package/presets/cursor/next/team/README.md +106 -0
  90. package/presets/cursor/next/team/tasks/.gitkeep +0 -0
@@ -0,0 +1,106 @@
1
+ ---
2
+ name: task-router
3
+ description: Task routing specialist. Analyzes user prompt, detects intent (feature, bugfix, review-only, test-only, refactor, spike, retro), and writes pipeline.json with ordered agent steps. Use first for /task or when determining which subagents to run and in what order. Readonly — never writes production code.
4
+ readonly: true
5
+ model: fast
6
+ ---
7
+
8
+ You are a task router for a Next.js frontend agent team. You **do not** implement tasks — you classify intent and plan the agent pipeline.
9
+
10
+ ## Inputs
11
+
12
+ - User task description (from `/task` or orchestrator).
13
+ - Optional: existing files under `.cursor/team/tasks/<slug>/`.
14
+
15
+ ## Intent detection
16
+
17
+ | intent | Signals in prompt | Default steps |
18
+ |--------|-------------------|---------------|
19
+ | `feature` | «добавь», «новая», «реализуй», «сделай», new UI/API/store | task-analyst → feature-developer → code-reviewer → qa-tester |
20
+ | `bugfix` | «баг», «fix», «не работает», «падает», «ошибка», regression | debugger → feature-developer → code-reviewer → qa-tester (scope regression) |
21
+ | `review-only` | «ревью», «review MR», «проверь diff», «code review» | code-reviewer |
22
+ | `test-only` | «e2e», «покрой тестами», «напиши тесты» (no impl) | task-analyst → qa-tester |
23
+ | `refactor` | «рефакторинг», «без изменения поведения», «почисти» | task-analyst → feature-developer → code-reviewer |
24
+ | `spike` | «исследуй», «оцени», «можно ли», «spike», proof of concept | task-analyst → solution-architect |
25
+ | `retro` | «ретро», «разбор», «postmortem» | (no pipeline — orchestrator runs /technical-retro) |
26
+
27
+ Adjust steps when context is clear:
28
+
29
+ - **Skip task-analyst** if AC and scope are fully specified in the prompt (document reason in `skipped`).
30
+ - **Add solution-architect** for cross-layer features (API + store + UI), new public APIs, or architecture uncertainty.
31
+ - **Skip qa-tester** for review-only, spike (no code), or trivial one-line fixes (document risk).
32
+ - **Skip feature-developer** for review-only, test-only (tests only), retro.
33
+
34
+ ## Output: pipeline.json
35
+
36
+ Write to `.cursor/team/tasks/<slug>/pipeline.json`:
37
+
38
+ ```json
39
+ {
40
+ "slug": "<slug>",
41
+ "intent": "feature",
42
+ "summary": "One-line task summary",
43
+ "steps": [
44
+ { "agent": "task-analyst", "label": "Clarify and decompose" },
45
+ { "agent": "feature-developer", "label": "Implement" },
46
+ { "agent": "code-reviewer", "label": "Code review" },
47
+ { "agent": "qa-tester", "label": "Unit and e2e tests", "scope": "full" }
48
+ ],
49
+ "humanGates": ["after:task-analyst"],
50
+ "autoChain": true,
51
+ "skipped": []
52
+ }
53
+ ```
54
+
55
+ ### Step fields
56
+
57
+ | Field | Required | Description |
58
+ |-------|----------|-------------|
59
+ | `agent` | yes | Subagent name (kebab-case) |
60
+ | `label` | yes | Short human-readable step name |
61
+ | `scope` | no | e.g. `full`, `regression`, `e2e-only` — passed to qa-tester |
62
+
63
+ ### humanGates
64
+
65
+ Values: `after:<agent-name>` — orchestrator stops after that agent; user runs `/task-continue <slug>` or `/feature-continue <slug>`.
66
+
67
+ - Default for `feature`, `refactor`, `test-only`: `["after:task-analyst"]`
68
+ - Default for `bugfix`, `review-only`: `[]` (unless analyst added)
69
+ - `spike`: `["after:solution-architect"]`
70
+
71
+ ### skipped (optional)
72
+
73
+ ```json
74
+ "skipped": [{ "agent": "task-analyst", "reason": "AC provided in ticket" }]
75
+ ```
76
+
77
+ ## Initial status.json
78
+
79
+ After writing pipeline.json, write:
80
+
81
+ ```json
82
+ {
83
+ "slug": "<slug>",
84
+ "intent": "<intent>",
85
+ "pipelineIndex": 0,
86
+ "currentAgent": "<steps[0].agent>",
87
+ "phase": "executing",
88
+ "state": "in_progress",
89
+ "awaitingHumanGate": false,
90
+ "updatedAt": "<ISO8601>"
91
+ }
92
+ ```
93
+
94
+ Also write `.cursor/team/active-task.json` → `{ "slug": "<slug>" }`.
95
+
96
+ ## Handoff to orchestrator
97
+
98
+ Respond with:
99
+
100
+ 1. **Intent** and one-line summary.
101
+ 2. **Planned steps** (table: #, agent, label).
102
+ 3. **Skipped roles** and why.
103
+ 4. **Human gates** (if any).
104
+ 5. Tell orchestrator to invoke `steps[0].agent` now (unless intent is `retro` — then run `/technical-retro`).
105
+
106
+ Do not invoke implementation agents yourself.
@@ -1,3 +1,35 @@
1
1
  # Cursor commands (next preset)
2
2
 
3
- Place command definitions for this preset here. They are copied to `.cursor/commands` when you run `ai-rules init cursor --preset next`.
3
+ Slash-команды копируются в `.cursor/commands/` при `ai-rules init cursor --preset next`.
4
+
5
+ ## Команда агентов
6
+
7
+ | Command | Назначение |
8
+ |---------|------------|
9
+ | **`/task <описание>`** | **Главная точка входа:** router → pipeline.json → нужные роли по порядку |
10
+ | `/task-continue <slug>` | После human gate или паузы |
11
+ | `/feature-start <описание>` | Legacy: только analyst (без router) |
12
+ | `/feature-continue <slug>` | Alias task-continue |
13
+ | `/technical-retro [slug]` | Ретро; с slug — блок «Работа агентов» |
14
+
15
+ ## Примеры `/task`
16
+
17
+ ```
18
+ /task Добавить фильтр по дате в Order History
19
+ → analyst → developer → reviewer → QA
20
+
21
+ /task Order History падает при пустом списке
22
+ → debugger → developer → reviewer → QA (regression)
23
+
24
+ /task Сделай ревью изменений в store/orders
25
+ → reviewer only
26
+ ```
27
+
28
+ ## Связанные файлы
29
+
30
+ - Subagents: `../agents/` (включая `task-router.md`)
31
+ - Оркестратор: `../rules/agent-team-orchestrator.mdc`
32
+ - Артефакты: `../team/README.md` (`pipeline.json`, `status.json`)
33
+ - Hooks: `../hooks.json`, `../hooks/chain-team-phases.sh`
34
+
35
+ Создавать и редактировать команды можно через `/commands` в Cursor или напрямую в этой папке пресета.
@@ -0,0 +1,14 @@
1
+ # Feature continue — legacy alias
2
+
3
+ > **Предпочтительно:** `/task-continue <slug>` — то же поведение, учитывает `pipeline.json`.
4
+
5
+ Продолжение после human gate. Полная логика — в **`task-continue.md`**.
6
+
7
+ ## Кратко
8
+
9
+ 1. Прочитай `pipeline.json` (если есть) и `status.json`.
10
+ 2. Сбрось `awaitingHumanGate`; определи следующий step по `pipelineIndex`.
11
+ 3. Вызови subagent для `currentAgent`.
12
+ 4. Hook продолжит цепочку при `autoChain: true`.
13
+
14
+ См. `task-continue.md` для деталей и таблицы handoff.
@@ -0,0 +1,28 @@
1
+ # Feature start — legacy (analyst only)
2
+
3
+ > **Предпочтительно:** `/task <описание>` — router выберет роли и порядок автоматически.
4
+
5
+ Запуск **фазы анализа** без router. Родительский агент действует как оркестратор (см. `agent-team-orchestrator.mdc`).
6
+
7
+ ## Что делать
8
+
9
+ 1. Извлеки описание задачи из аргументов команды (всё после `/feature-start`).
10
+ 2. Сгенерируй **slug** (kebab-case, до 48 символов) из заголовка задачи.
11
+ 3. Создай каталог `.cursor/team/tasks/<slug>/` если его ещё нет.
12
+ 4. Запиши `.cursor/team/active-task.json` → `{ "slug": "<slug>" }`.
13
+ 5. Опционально: минимальный `pipeline.json` с фиксированными steps (analyst → developer → reviewer → qa-tester).
14
+ 6. Вызови subagent **task-analyst** (Task tool) с полным описанием задачи и путём к артефактам.
15
+ 7. Дождись завершения аналитика. **Не вызывай developer** на этом этапе.
16
+
17
+ ## Human gate
18
+
19
+ После аналитика:
20
+
21
+ - Покажи пользователю ссылки на `brief.md` и `decomposition.md`.
22
+ - Попроси проверить и утвердить или прислать правки.
23
+ - Для продолжения: `/task-continue <slug>` или `/feature-continue <slug>`.
24
+
25
+ ## Если slug уже существует
26
+
27
+ - Если `status.json` в `awaiting_approval` — предложи ревью или continue.
28
+ - Если задача в работе — спроси, продолжать или начать новый slug.
@@ -0,0 +1,43 @@
1
+ # Task continue — после human gate или паузы
2
+
3
+ Продолжение пайплайна из `pipeline.json`. Алиас по смыслу: `/feature-continue`.
4
+
5
+ ## Аргументы
6
+
7
+ `<slug>` — идентификатор задачи.
8
+
9
+ ## Preconditions
10
+
11
+ 1. Прочитай `.cursor/team/tasks/<slug>/pipeline.json` и `status.json`.
12
+ 2. Продолжай если:
13
+ - `awaitingHumanGate: true` или `state: awaiting_approval`, **или**
14
+ - `state: changes_requested` (после review), **или**
15
+ - задача прервана и нужно возобновить с `pipelineIndex`.
16
+
17
+ ## Алгоритм
18
+
19
+ 1. Запиши `.cursor/team/active-task.json` → `{ "slug": "<slug>" }`.
20
+ 2. Сбрось gate: `awaitingHumanGate: false`.
21
+ 3. Определи **следующий шаг**:
22
+ - После approval analyst/architect: `pipelineIndex + 1` → следующий agent в `steps`.
23
+ - После `changes_requested`: снова **feature-developer** (тот же index или найди developer в steps).
24
+ 4. Обнови `status.json`:
25
+ ```json
26
+ {
27
+ "pipelineIndex": <n>,
28
+ "currentAgent": "<steps[n].agent>",
29
+ "phase": "executing",
30
+ "state": "in_progress",
31
+ "awaitingHumanGate": false
32
+ }
33
+ ```
34
+ 5. Вызови subagent для `currentAgent` с контекстом slug и артефактов.
35
+ 6. Hook `chain-team-phases.sh` продолжит цепочку по `pipeline.json`, если `autoChain: true`.
36
+
37
+ ## Артефакты для handoff
38
+
39
+ | Agent | Прочитать |
40
+ |-------|-----------|
41
+ | feature-developer | brief.md, decomposition.md, architecture.md (if exists), debug-report.md (if exists) |
42
+ | code-reviewer | brief.md, git diff |
43
+ | qa-tester | brief.md, decomposition.md, scope from pipeline step |
@@ -0,0 +1,40 @@
1
+ # Task — единая точка входа (router + pipeline)
2
+
3
+ Главная команда для постановки задачи. Родительский агент = оркестратор (`agent-team-orchestrator.mdc`).
4
+
5
+ ## Аргументы
6
+
7
+ Всё после `/task` — описание задачи на естественном языке.
8
+
9
+ Примеры:
10
+
11
+ - `/task Добавить фильтр по дате в Order History`
12
+ - `/task Order History падает при пустом списке — пофикси`
13
+ - `/task Сделай ревью моих изменений в store/orders`
14
+ - `/task Напиши e2e для сценария оплаты`
15
+
16
+ ## Алгоритм
17
+
18
+ 1. **Slug** — kebab-case из описания (≤48 символов). Создай `.cursor/team/tasks/<slug>/`.
19
+ 2. **Router** — вызови subagent **task-router** с описанием задачи и путём к slug.
20
+ 3. **План** — покажи пользователю таблицу из `pipeline.json`: intent, steps, skipped, humanGates.
21
+ 4. **Intent retro** — если `intent === "retro"`, выполни `/technical-retro` и **остановись**.
22
+ 5. **Старт** — вызови subagent для `pipeline.steps[0].agent`:
23
+ - передай slug, пути к артефактам, scope из step (если есть);
24
+ - обнови `status.json`: `pipelineIndex: 0`, `currentAgent`, `state: in_progress`.
25
+ 6. **Human gate** — если после текущего шага есть gate в `humanGates` (`after:<agent>`), после завершения агента **остановись** и попроси `/task-continue <slug>` (или `/feature-continue <slug>`).
26
+
27
+ ## Не делать
28
+
29
+ - Не вызывать developer до router и (если в pipeline) analyst/architect.
30
+ - Не hardcode порядок ролей — только `pipeline.json`.
31
+ - Не пропускать human gate без явного continue.
32
+
33
+ ## Если slug занят
34
+
35
+ - `awaitingHumanGate` / `state: awaiting_approval` → предложи ревью артефактов или `/task-continue <slug>`.
36
+ - `in_progress` → спроси: продолжить или новый slug.
37
+
38
+ ## Legacy
39
+
40
+ `/feature-start` и `/feature-continue` остаются совместимыми; для новых задач предпочитай `/task`.
@@ -0,0 +1,76 @@
1
+ # Техническое ретро
2
+
3
+ Агент выступает как **нейтральный фасилитатор технической ретроспективы**, а не как ревьюер кода или оценщик людей.
4
+
5
+ ## Когда включать
6
+
7
+ - Пользователь просит: «ретро», «техническое ретро», «разбор спринта/итерации», «action items после релиза».
8
+ - После завершения пайплайна команды агентов (`/feature-start` → `/feature-continue`).
9
+ - Есть контекст: период, тема (релиз, инцидент), slug задачи, заметки.
10
+
11
+ ## Входные данные (собрать, не выдумывать)
12
+
13
+ Запросить при нехватке:
14
+
15
+ - **Период и фокус**.
16
+ - **Slug задачи** (если ретро по работе команды агентов).
17
+ - **Участники/роли** (если важно).
18
+ - **Ограничения**: время, формат (async vs синхрон).
19
+
20
+ ### Артефакты команды агентов (если есть slug)
21
+
22
+ Прочитать из репозитория:
23
+
24
+ - `.cursor/team/tasks/<slug>/pipeline.json`
25
+ - `.cursor/team/tasks/<slug>/brief.md`
26
+ - `.cursor/team/tasks/<slug>/decomposition.md`
27
+ - `.cursor/team/tasks/<slug>/status.json`
28
+ - Git diff / `git status` для изменённых файлов
29
+
30
+ Не приписывать факты, которых нет в артефактах, diff или сообщении пользователя.
31
+
32
+ ## Принципы фасилитации
33
+
34
+ - **Безопасность**: процесс и система, не «виноватые».
35
+ - **Конкретика**: от абстракций к наблюдаемым событиям.
36
+ - **Баланс**: позитив и зоны роста.
37
+ - **Action items**: владелец и срок у каждого.
38
+ - **Не смешивать с code review** — развести блоки, если запросили оба.
39
+
40
+ ## Структура сессии (по умолчанию)
41
+
42
+ 1. **Цель и рамки**.
43
+ 2. **Сбор фактов**: хорошо / мешало / сюрпризы.
44
+ 3. **Группировка тем** (3–7).
45
+ 4. **Корневые причины** для 1–2 болезненных тем.
46
+ 5. **Эксперименты** (1–3 изменения процесса).
47
+ 6. **Action items**: что / владелец / до когда / критерий успеха.
48
+
49
+ ## Блок «Работа агентов» (обязателен при slug)
50
+
51
+ Если ретро связано с пайплайном `/feature-start`:
52
+
53
+ | Вопрос | Что фиксировать |
54
+ |--------|-----------------|
55
+ | Router | Ошибка intent, лишние/пропущенные steps в pipeline |
56
+ | Аналитик | Ошибки в assumptions, пропущенные AC, лишние/недостающие таски |
57
+ | Декомпозиция | Неполное покрытие слоёв, неверный порядок, blocked-зависимости |
58
+ | Developer | Scope creep, пропущенные правила, lint/type gaps |
59
+ | Reviewer | Пропущенные дефекты, false positives, качество чеклиста |
60
+ | QA | Покрытие AC тестами, flakiness, пробелы в e2e планах |
61
+
62
+ **Action items** в этом блоке — на улучшение **промптов, subagents и rules** (не только кода).
63
+
64
+ ## Формат ответа
65
+
66
+ - Шапка: период, фокус, slug (если есть), допущения.
67
+ - Повестка по этапам.
68
+ - Блок **«Работа агентов»** (если применимо).
69
+ - Темы — буллеты; спорное — **вопросы команде**.
70
+ - **Action items** в конце.
71
+
72
+ ## Ограничения
73
+
74
+ - Не приписывать цитаты и факты без входа.
75
+ - Не выдавать HR‑рекомендации.
76
+ - Если просят только шаблон — **шаблон повестки** без выдуманного контента.
@@ -0,0 +1,216 @@
1
+ #!/usr/bin/env bash
2
+ # Chains agent team steps from pipeline.json after subagentStop.
3
+ # Falls back to legacy phase-based flow when pipeline.json is absent.
4
+
5
+ set -euo pipefail
6
+
7
+ input=$(cat)
8
+
9
+ INPUT="$input" node <<'NODE'
10
+ const fs = require('fs');
11
+ const path = require('path');
12
+
13
+ const inputRaw = process.env.INPUT || '';
14
+ let hookInput;
15
+ try {
16
+ hookInput = JSON.parse(inputRaw);
17
+ } catch {
18
+ process.stdout.write('{}');
19
+ process.exit(0);
20
+ }
21
+
22
+ if (hookInput.status !== 'completed') {
23
+ process.stdout.write('{}');
24
+ process.exit(0);
25
+ }
26
+
27
+ const teamRoot = path.join(process.cwd(), '.cursor', 'team');
28
+ const activePath = path.join(teamRoot, 'active-task.json');
29
+
30
+ if (!fs.existsSync(activePath)) {
31
+ process.stdout.write('{}');
32
+ process.exit(0);
33
+ }
34
+
35
+ let active;
36
+ try {
37
+ active = JSON.parse(fs.readFileSync(activePath, 'utf8'));
38
+ } catch {
39
+ process.stdout.write('{}');
40
+ process.exit(0);
41
+ }
42
+
43
+ const slug = active.slug;
44
+ if (!slug) {
45
+ process.stdout.write('{}');
46
+ process.exit(0);
47
+ }
48
+
49
+ const taskDir = path.join(teamRoot, 'tasks', slug);
50
+ const statusPath = path.join(taskDir, 'status.json');
51
+ const pipelinePath = path.join(taskDir, 'pipeline.json');
52
+
53
+ if (!fs.existsSync(statusPath)) {
54
+ process.stdout.write('{}');
55
+ process.exit(0);
56
+ }
57
+
58
+ let status;
59
+ try {
60
+ status = JSON.parse(fs.readFileSync(statusPath, 'utf8'));
61
+ } catch {
62
+ process.stdout.write('{}');
63
+ process.exit(0);
64
+ }
65
+
66
+ const now = new Date().toISOString();
67
+
68
+ function writeStatus(next) {
69
+ status = { ...status, ...next, slug, updatedAt: now };
70
+ fs.writeFileSync(statusPath, JSON.stringify(status, null, 2) + '\n');
71
+ }
72
+
73
+ function out(message) {
74
+ process.stdout.write(JSON.stringify({ followup_message: message }));
75
+ }
76
+
77
+ const AGENT_HANDOFF = {
78
+ 'task-analyst': (s) =>
79
+ `Invoke task-analyst for slug "${s}". Write brief.md and decomposition.md under .cursor/team/tasks/${s}/. ` +
80
+ `Set status.json state to awaiting_approval if human gate applies.`,
81
+ debugger: (s) =>
82
+ `Invoke debugger subagent for slug "${s}". Investigate root cause; write debug-report.md. ` +
83
+ `Update status.json when done.`,
84
+ 'solution-architect': (s) =>
85
+ `Invoke solution-architect for slug "${s}". Read brief.md; write architecture.md. ` +
86
+ `Update status.json when done.`,
87
+ 'feature-developer': (s) =>
88
+ `Invoke feature-developer for slug "${s}". Read brief.md, decomposition.md, architecture.md and debug-report.md if present. ` +
89
+ `Follow feature-delivery-workflow.mdc. Update status.json when done.`,
90
+ 'code-reviewer': (s) =>
91
+ `Invoke code-reviewer subagent (readonly) for slug "${s}". Review git diff vs brief.md per code-review-mr.mdc. ` +
92
+ `Update status.json when done.`,
93
+ 'qa-tester': (s, scope) =>
94
+ `Invoke qa-tester for slug "${s}"${scope ? ` (scope: ${scope})` : ''}. ` +
95
+ `Add/update unit and e2e tests per brief. Follow playwright-agents.mdc. Update status.json when done.`,
96
+ };
97
+
98
+ function handoffForAgent(agent, scope) {
99
+ const fn = AGENT_HANDOFF[agent];
100
+ return fn ? fn(slug, scope) : `Invoke ${agent} subagent for slug "${slug}". Update status.json when done.`;
101
+ }
102
+
103
+ function hasGateAfter(agent, humanGates) {
104
+ return Array.isArray(humanGates) && humanGates.includes(`after:${agent}`);
105
+ }
106
+
107
+ // --- Legacy flow (no pipeline.json) ---
108
+ function legacyFlow() {
109
+ if (status.phase === 'analysis') {
110
+ process.stdout.write('{}');
111
+ process.exit(0);
112
+ }
113
+ if (status.phase === 'development' && (status.state === 'completed' || status.state === 'in_progress')) {
114
+ writeStatus({ phase: 'review', state: 'in_progress', currentAgent: 'code-reviewer' });
115
+ out(handoffForAgent('code-reviewer'));
116
+ process.exit(0);
117
+ }
118
+ if (status.phase === 'review' && status.state === 'completed') {
119
+ writeStatus({ phase: 'testing', state: 'in_progress', currentAgent: 'qa-tester' });
120
+ out(handoffForAgent('qa-tester'));
121
+ process.exit(0);
122
+ }
123
+ if (status.phase === 'review' && status.state === 'changes_requested') {
124
+ out(
125
+ `Review requested changes for slug "${slug}". Invoke feature-developer with fix list, then code-reviewer.`,
126
+ );
127
+ process.exit(0);
128
+ }
129
+ if (status.phase === 'testing' && status.state === 'completed') {
130
+ writeStatus({ phase: 'done', state: 'completed' });
131
+ out(`Pipeline complete for "${slug}". Run /technical-retro ${slug}.`);
132
+ process.exit(0);
133
+ }
134
+ process.stdout.write('{}');
135
+ process.exit(0);
136
+ }
137
+
138
+ if (!fs.existsSync(pipelinePath)) {
139
+ legacyFlow();
140
+ }
141
+
142
+ let pipeline;
143
+ try {
144
+ pipeline = JSON.parse(fs.readFileSync(pipelinePath, 'utf8'));
145
+ } catch {
146
+ legacyFlow();
147
+ }
148
+
149
+ const steps = pipeline.steps || [];
150
+ if (steps.length === 0 || pipeline.autoChain === false) {
151
+ process.stdout.write('{}');
152
+ process.exit(0);
153
+ }
154
+
155
+ // Human gate active — do not chain
156
+ if (status.awaitingHumanGate || status.state === 'awaiting_approval') {
157
+ process.stdout.write('{}');
158
+ process.exit(0);
159
+ }
160
+
161
+ // Review blocked — re-run developer
162
+ if (status.state === 'changes_requested' && status.currentAgent === 'code-reviewer') {
163
+ writeStatus({
164
+ currentAgent: 'feature-developer',
165
+ state: 'in_progress',
166
+ phase: 'executing',
167
+ });
168
+ out(handoffForAgent('feature-developer'));
169
+ process.exit(0);
170
+ }
171
+
172
+ const idx = typeof status.pipelineIndex === 'number' ? status.pipelineIndex : 0;
173
+ const currentStep = steps[idx];
174
+ if (!currentStep) {
175
+ writeStatus({ phase: 'done', state: 'completed', currentAgent: null });
176
+ out(`Pipeline complete for "${slug}". Run /technical-retro ${slug}.`);
177
+ process.exit(0);
178
+ }
179
+
180
+ const completedAgent = status.currentAgent || currentStep.agent;
181
+
182
+ // Gate after the step that just finished
183
+ if (hasGateAfter(completedAgent, pipeline.humanGates)) {
184
+ writeStatus({
185
+ awaitingHumanGate: true,
186
+ state: 'awaiting_approval',
187
+ currentAgent: completedAgent,
188
+ });
189
+ process.stdout.write('{}');
190
+ process.exit(0);
191
+ }
192
+
193
+ const nextIdx = idx + 1;
194
+ if (nextIdx >= steps.length) {
195
+ writeStatus({
196
+ pipelineIndex: nextIdx,
197
+ phase: 'done',
198
+ state: 'completed',
199
+ currentAgent: null,
200
+ awaitingHumanGate: false,
201
+ });
202
+ out(`Pipeline complete for "${slug}". Run /technical-retro ${slug}.`);
203
+ process.exit(0);
204
+ }
205
+
206
+ const nextStep = steps[nextIdx];
207
+ writeStatus({
208
+ pipelineIndex: nextIdx,
209
+ currentAgent: nextStep.agent,
210
+ phase: 'executing',
211
+ state: 'in_progress',
212
+ awaitingHumanGate: false,
213
+ });
214
+
215
+ out(handoffForAgent(nextStep.agent, nextStep.scope));
216
+ NODE
@@ -0,0 +1,11 @@
1
+ {
2
+ "version": 1,
3
+ "hooks": {
4
+ "subagentStop": [
5
+ {
6
+ "command": ".cursor/hooks/chain-team-phases.sh",
7
+ "loop_limit": 5
8
+ }
9
+ ]
10
+ }
11
+ }
@@ -11,9 +11,11 @@
11
11
 
12
12
  - То есть .mdc = “markdown + config для Cursor”, .md = просто текст без управляющего смысла для ассистента.
13
13
 
14
- ### С чего начать новую фичу
14
+ ### С чего начать новую задачу
15
15
 
16
- См. **`feature-delivery-workflow.mdc`** (сквозной чеклист слоёв и матрица «зона репозитория какое правило перечитать»).
16
+ - **Команда агентов (рекомендуется):** `/task <описание>` — router выберет роли и порядок; при human gate `/task-continue <slug>`. См. **`agent-team-orchestrator.mdc`** и `.cursor/team/README.md`.
17
+ - **Legacy:** `/feature-start` → `/feature-continue`.
18
+ - **Сквозной чеклист слоёв (для developer):** **`feature-delivery-workflow.mdc`**.
17
19
 
18
20
  ### Эталонные фичи (заполняет команда)
19
21
 
@@ -23,19 +25,25 @@
23
25
 
24
26
  | Файл | Назначение |
25
27
  |------|------------|
28
+ | `agent-team-orchestrator.mdc` | `/task`, router, `pipeline.json`, динамический пайплайн subagents |
29
+ | `agent-team-intake.mdc` | Автоподсказка `/task` при постановке задачи (alwaysApply) |
30
+ | `package-manager.mdc` | Перед `install` / `run` в терминале определить менеджер пакетов репо (lockfile, `packageManager`) и использовать только его |
26
31
  | `feature-delivery-workflow.mdc` | Сквозной порядок работ по фиче, mermaid‑поток, матрица слой → правило `.mdc` |
27
- | `next-app-core.mdc` | Стек, слои, порты‑адаптеры (кратко), доменная логика vs state, общие требования к агенту и линтам |
32
+ | `next-app-core.mdc` | Стек, слои, порты‑адаптеры (кратко), доменная логика vs state, общие требования к агенту |
33
+ | `post-change-lint.mdc` | **Обязательный** прогон ESLint + Stylelint после любых изменений кода, исправление срабатываний |
28
34
  | `architecture-boundaries.mdc` | Границы UI / store / API, импорты (`@/types`, `@/api`), порты‑адаптеры, фича как срез |
29
35
  | `http-client.mdc` | Один HTTP‑стек, контракты из `@/types`, без разбросанного низкоуровневого API |
30
36
  | `api-services.mdc` | Сервисы, мапперы, вызовы через прикладные API‑клиенты |
31
37
  | `store-rtk.mdc` | Redux Toolkit, thunk’и, типизация ошибок/ответов как в коде репо |
32
38
  | `types-public-imports.mdc` | Импорты только через barrel `@/types` |
33
39
  | `api-public-imports.mdc` | Импорты только через barrel `@/api` (вне `app/src/api/**`) |
40
+ | `layer-barrel-exports.mdc` | Двухуровневые barrel для слоёв с public API (`@/api`, `@/types`, `@/core`, …) |
34
41
  | `types-jsdoc.mdc` | JSDoc для типов в `app/src/types` (русский текст, `[computed]`, без `@param`/`@returns`) |
35
42
  | `no-type-assertion-as-import-export.mdc` | Ограничение `as`, в т.ч. `instanceof` для ошибок транспорта в `catch` |
36
43
  | `code-review-mr.mdc` | Чеклист ревью MR, в т.ч. HTTP‑клиент и тесты |
37
44
  | `tests-unit.mdc` | Unit‑тесты и behavior‑тесты HTTP‑клиента |
38
45
  | `playwright-agents.mdc`, `tests-e2e-structure.mdc` | E2E |
46
+ | `react-ui.mdc` | React/Next UI: структура компонентов, соседние `ComponentName.data.ts` / `.utils.ts`, стили, пропсы |
39
47
 
40
48
  **Коллизии формулировок:** если в разных `.mdc` расходятся детали **импорта типов**, источник правды — **`types-public-imports.mdc`** (`@/types`, `@/types/enums`); по **импорту из API‑слоя** (store, UI, прочий код вне `app/src/api/**`) — **`api-public-imports.mdc`** (`@/api`), в том же смысле что правило ESLint `no-restricted-imports` в `app/eslint.config.mjs`.
41
49
 
@@ -0,0 +1,14 @@
1
+ ---
2
+ description: When the user describes a new task, feature, bug, or implementation request (not a pure question), suggest or use /task to run the agent team router. Lightweight intake hint only.
3
+ alwaysApply: true
4
+ ---
5
+
6
+ # Agent team intake
7
+
8
+ When the user message looks like a **work request** (implement, add, fix, refactor, review MR, write tests, spike) — not a question about how code works:
9
+
10
+ 1. Prefer **`/task <their request>`** or invoke **task-router** first.
11
+ 2. Do not jump straight to coding without router + pipeline when scope is non-trivial.
12
+ 3. Pure questions («как работает X», «объясни») — answer normally, no `/task`.
13
+
14
+ Exceptions: user explicitly says «без pipeline», «просто сделай», or continues an active slug.