@bonesofspring/ai-rules 0.2.0 → 0.2.2

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 (193) hide show
  1. package/README.md +10 -18
  2. package/bin/cli.js +73 -258
  3. package/package.json +3 -4
  4. package/presets/claude/ios-swift/CLAUDE.md +27 -0
  5. package/presets/claude/ios-swift/README.md +29 -0
  6. package/presets/claude/ios-swift/commands/README.md +3 -0
  7. package/presets/claude/ios-swift/rules/README.md +44 -0
  8. package/presets/claude/ios-swift/rules/api-and-data/README.md +9 -0
  9. package/presets/claude/ios-swift/rules/api-and-data/networking.md +49 -0
  10. package/presets/claude/ios-swift/rules/architecture/README.md +10 -0
  11. package/presets/claude/ios-swift/rules/architecture/boundaries.md +33 -0
  12. package/presets/claude/ios-swift/rules/architecture/feature-delivery.md +60 -0
  13. package/presets/claude/ios-swift/rules/stack/README.md +10 -0
  14. package/presets/claude/ios-swift/rules/stack/ios-app-core.md +42 -0
  15. package/presets/claude/ios-swift/rules/stack/swift-conventions.md +51 -0
  16. package/presets/claude/ios-swift/rules/testing/README.md +10 -0
  17. package/presets/claude/ios-swift/rules/testing/ui.md +41 -0
  18. package/presets/claude/ios-swift/rules/testing/unit.md +41 -0
  19. package/presets/claude/ios-swift/rules/tooling-and-review/README.md +11 -0
  20. package/presets/claude/ios-swift/rules/tooling-and-review/code-quality.md +38 -0
  21. package/presets/claude/ios-swift/rules/tooling-and-review/code-review.md +41 -0
  22. package/presets/claude/ios-swift/rules/tooling-and-review/post-change-build.md +31 -0
  23. package/presets/claude/ios-swift/rules/ui-and-accessibility/README.md +10 -0
  24. package/presets/claude/ios-swift/rules/ui-and-accessibility/swiftui.md +61 -0
  25. package/presets/claude/ios-swift/rules/ui-and-accessibility/viewmodels.md +43 -0
  26. package/presets/claude/next/CLAUDE.md +5 -29
  27. package/presets/claude/next/README.md +0 -10
  28. package/presets/claude/next/agents/README.md +0 -125
  29. package/presets/claude/next/commands/README.md +2 -10
  30. package/presets/claude/next/hooks/README.md +2 -5
  31. package/presets/claude/next/rules/README.md +11 -25
  32. package/presets/claude/next/rules/api-and-data/README.md +1 -7
  33. package/presets/claude/next/rules/architecture/README.md +2 -9
  34. package/presets/claude/next/rules/stack/README.md +1 -9
  35. package/presets/claude/next/rules/testing/README.md +1 -9
  36. package/presets/claude/next/rules/tooling-and-review/README.md +1 -14
  37. package/presets/claude/next/rules/ui-and-accessibility/README.md +1 -8
  38. package/presets/claude/next/skills/README.md +1 -11
  39. package/presets/cursor/ios-swift/README.md +17 -0
  40. package/presets/cursor/ios-swift/commands/README.md +3 -0
  41. package/presets/cursor/ios-swift/rules/README.md +33 -0
  42. package/presets/cursor/ios-swift/rules/architecture-boundaries.mdc +34 -0
  43. package/presets/cursor/ios-swift/rules/code-quality-and-refactoring.mdc +39 -0
  44. package/presets/cursor/ios-swift/rules/code-review-mr.mdc +42 -0
  45. package/presets/cursor/ios-swift/rules/feature-delivery-workflow.mdc +61 -0
  46. package/presets/cursor/ios-swift/rules/ios-app-core.mdc +43 -0
  47. package/presets/cursor/ios-swift/rules/networking-services.mdc +49 -0
  48. package/presets/cursor/ios-swift/rules/post-change-build.mdc +32 -0
  49. package/presets/cursor/ios-swift/rules/state-and-viewmodels.mdc +43 -0
  50. package/presets/cursor/ios-swift/rules/swift-conventions.mdc +51 -0
  51. package/presets/cursor/ios-swift/rules/swiftui-ui.mdc +61 -0
  52. package/presets/cursor/ios-swift/rules/tests-ui.mdc +41 -0
  53. package/presets/cursor/ios-swift/rules/tests-unit.mdc +41 -0
  54. package/presets/cursor/next/commands/README.md +1 -49
  55. package/presets/cursor/next/rules/README.md +0 -47
  56. package/presets/cursor/next/rules/api-services.mdc +10 -12
  57. package/presets/cursor/next/rules/architecture-boundaries.mdc +12 -31
  58. package/presets/cursor/next/rules/code-quality-and-refactoring.mdc +4 -5
  59. package/presets/cursor/next/rules/code-review-mr.mdc +7 -14
  60. package/presets/cursor/next/rules/next-app-core.mdc +61 -18
  61. package/presets/cursor/next/rules/no-props-spread.mdc +4 -27
  62. package/presets/cursor/next/rules/playwright-agents.mdc +1 -2
  63. package/presets/cursor/next/rules/react-ui.mdc +3 -32
  64. package/presets/cursor/next/rules/store-rtk.mdc +6 -13
  65. package/presets/cursor/next/rules/tests-unit.mdc +10 -30
  66. package/CHANGELOG.md +0 -22
  67. package/presets/claude/next/agents/accessibility-reviewer.md +0 -65
  68. package/presets/claude/next/agents/api-contract-reviewer.md +0 -69
  69. package/presets/claude/next/agents/build-verifier.md +0 -64
  70. package/presets/claude/next/agents/ci-investigator.md +0 -62
  71. package/presets/claude/next/agents/code-reviewer.md +0 -62
  72. package/presets/claude/next/agents/debugger.md +0 -63
  73. package/presets/claude/next/agents/feature-developer.md +0 -27
  74. package/presets/claude/next/agents/migration-specialist.md +0 -69
  75. package/presets/claude/next/agents/performance-auditor.md +0 -68
  76. package/presets/claude/next/agents/qa-tester.md +0 -56
  77. package/presets/claude/next/agents/security-reviewer.md +0 -64
  78. package/presets/claude/next/agents/solution-architect.md +0 -70
  79. package/presets/claude/next/agents/task-analyst.md +0 -109
  80. package/presets/claude/next/agents/task-router.md +0 -70
  81. package/presets/claude/next/agents/tech-writer.md +0 -60
  82. package/presets/claude/next/agents/unit-test-generator.md +0 -37
  83. package/presets/claude/next/agents/unit-test-healer.md +0 -38
  84. package/presets/claude/next/agents/unit-test-planner.md +0 -62
  85. package/presets/claude/next/commands/feature-continue.md +0 -51
  86. package/presets/claude/next/commands/feature-start.md +0 -30
  87. package/presets/claude/next/commands/task-continue.md +0 -49
  88. package/presets/claude/next/commands/task.md +0 -50
  89. package/presets/claude/next/commands/technical-retro.md +0 -58
  90. package/presets/claude/next/hooks/chain-team-phases.sh +0 -342
  91. package/presets/claude/next/hooks/guard-shell-command.sh +0 -77
  92. package/presets/claude/next/rules/api-and-data/api-services.md +0 -57
  93. package/presets/claude/next/rules/api-and-data/http-client.md +0 -40
  94. package/presets/claude/next/rules/api-and-data/store-rtk.md +0 -65
  95. package/presets/claude/next/rules/architecture/api-public-imports.md +0 -8
  96. package/presets/claude/next/rules/architecture/architecture-boundaries.md +0 -72
  97. package/presets/claude/next/rules/architecture/feature-delivery-workflow.md +0 -79
  98. package/presets/claude/next/rules/architecture/layer-barrel-exports.md +0 -58
  99. package/presets/claude/next/rules/architecture/public-imports.md +0 -46
  100. package/presets/claude/next/rules/architecture/reference-features.md +0 -37
  101. package/presets/claude/next/rules/architecture/types-public-imports.md +0 -8
  102. package/presets/claude/next/rules/stack/arrow-functions.md +0 -45
  103. package/presets/claude/next/rules/stack/navigation-router.md +0 -61
  104. package/presets/claude/next/rules/stack/next-app-core.md +0 -33
  105. package/presets/claude/next/rules/stack/next-app-router.md +0 -36
  106. package/presets/claude/next/rules/stack/no-type-assertion.md +0 -59
  107. package/presets/claude/next/rules/stack/types-jsdoc.md +0 -37
  108. package/presets/claude/next/rules/testing/playwright-agents.md +0 -74
  109. package/presets/claude/next/rules/testing/tests-e2e-structure.md +0 -52
  110. package/presets/claude/next/rules/testing/tests-unit.md +0 -66
  111. package/presets/claude/next/rules/tooling-and-review/agent-team-intake.md +0 -15
  112. package/presets/claude/next/rules/tooling-and-review/agent-team-orchestrator.md +0 -134
  113. package/presets/claude/next/rules/tooling-and-review/code-quality.md +0 -42
  114. package/presets/claude/next/rules/tooling-and-review/code-review-mr.md +0 -67
  115. package/presets/claude/next/rules/tooling-and-review/package-manager.md +0 -11
  116. package/presets/claude/next/rules/tooling-and-review/post-change-lint.md +0 -33
  117. package/presets/claude/next/rules/ui-and-accessibility/component-styles.md +0 -56
  118. package/presets/claude/next/rules/ui-and-accessibility/css-property-order.md +0 -14
  119. package/presets/claude/next/rules/ui-and-accessibility/no-props-spread.md +0 -57
  120. package/presets/claude/next/rules/ui-and-accessibility/react-a11y-coding.md +0 -37
  121. package/presets/claude/next/rules/ui-and-accessibility/react-ui.md +0 -90
  122. package/presets/claude/next/skills/ci-investigation/SKILL.md +0 -36
  123. package/presets/claude/next/skills/code-review/SKILL.md +0 -26
  124. package/presets/claude/next/skills/debug-investigation/SKILL.md +0 -28
  125. package/presets/claude/next/skills/feature-delivery/SKILL.md +0 -15
  126. package/presets/claude/next/skills/playwright-e2e/SKILL.md +0 -31
  127. package/presets/claude/next/skills/technical-retro/SKILL.md +0 -40
  128. package/presets/claude/next/skills/unit-testing/SKILL.md +0 -32
  129. package/presets/claude/next/team/README.md +0 -46
  130. package/presets/claude/next/team/tasks/.gitkeep +0 -1
  131. package/presets/cursor/next/AGENTS.md +0 -43
  132. package/presets/cursor/next/BUGBOT.md +0 -14
  133. package/presets/cursor/next/agents/README.md +0 -158
  134. package/presets/cursor/next/agents/accessibility-reviewer.md +0 -67
  135. package/presets/cursor/next/agents/api-contract-reviewer.md +0 -71
  136. package/presets/cursor/next/agents/build-verifier.md +0 -66
  137. package/presets/cursor/next/agents/ci-investigator.md +0 -64
  138. package/presets/cursor/next/agents/code-reviewer.md +0 -64
  139. package/presets/cursor/next/agents/debugger.md +0 -64
  140. package/presets/cursor/next/agents/feature-developer.md +0 -27
  141. package/presets/cursor/next/agents/migration-specialist.md +0 -71
  142. package/presets/cursor/next/agents/performance-auditor.md +0 -70
  143. package/presets/cursor/next/agents/playwright-test-generator.md +0 -26
  144. package/presets/cursor/next/agents/playwright-test-healer.md +0 -26
  145. package/presets/cursor/next/agents/playwright-test-planner.md +0 -28
  146. package/presets/cursor/next/agents/qa-tester.md +0 -57
  147. package/presets/cursor/next/agents/security-reviewer.md +0 -66
  148. package/presets/cursor/next/agents/solution-architect.md +0 -71
  149. package/presets/cursor/next/agents/task-analyst.md +0 -112
  150. package/presets/cursor/next/agents/task-router.md +0 -71
  151. package/presets/cursor/next/agents/tech-writer.md +0 -62
  152. package/presets/cursor/next/agents/unit-test-generator.md +0 -39
  153. package/presets/cursor/next/agents/unit-test-healer.md +0 -40
  154. package/presets/cursor/next/agents/unit-test-planner.md +0 -64
  155. package/presets/cursor/next/commands/feature-continue.md +0 -19
  156. package/presets/cursor/next/commands/feature-start.md +0 -33
  157. package/presets/cursor/next/commands/task-continue.md +0 -49
  158. package/presets/cursor/next/commands/task.md +0 -50
  159. package/presets/cursor/next/commands/technical-retro.md +0 -81
  160. package/presets/cursor/next/hooks/README.md +0 -8
  161. package/presets/cursor/next/hooks/chain-team-phases.sh +0 -380
  162. package/presets/cursor/next/hooks/guard-shell-command.sh +0 -77
  163. package/presets/cursor/next/hooks.json +0 -17
  164. package/presets/cursor/next/rules/agent-team-intake.mdc +0 -14
  165. package/presets/cursor/next/rules/agent-team-orchestrator.mdc +0 -139
  166. package/presets/cursor/next/rules/api-public-imports.mdc +0 -8
  167. package/presets/cursor/next/rules/arrow-functions.mdc +0 -46
  168. package/presets/cursor/next/rules/css-property-order-stylelint.mdc +0 -16
  169. package/presets/cursor/next/rules/feature-delivery-workflow.mdc +0 -76
  170. package/presets/cursor/next/rules/http-client.mdc +0 -42
  171. package/presets/cursor/next/rules/layer-barrel-exports.mdc +0 -59
  172. package/presets/cursor/next/rules/navigation-router-stack.mdc +0 -62
  173. package/presets/cursor/next/rules/next-app-router.mdc +0 -36
  174. package/presets/cursor/next/rules/no-cross-component-styles-import.mdc +0 -58
  175. package/presets/cursor/next/rules/no-type-assertion-as-import-export.mdc +0 -60
  176. package/presets/cursor/next/rules/package-manager.mdc +0 -16
  177. package/presets/cursor/next/rules/post-change-lint.mdc +0 -38
  178. package/presets/cursor/next/rules/public-imports.mdc +0 -48
  179. package/presets/cursor/next/rules/react-a11y-coding.mdc +0 -37
  180. package/presets/cursor/next/rules/reference-features.mdc +0 -39
  181. package/presets/cursor/next/rules/technical-retro.mdc +0 -12
  182. package/presets/cursor/next/rules/types-jsdoc.mdc +0 -42
  183. package/presets/cursor/next/rules/types-public-imports.mdc +0 -8
  184. package/presets/cursor/next/skills/README.md +0 -15
  185. package/presets/cursor/next/skills/ci-investigation/SKILL.md +0 -36
  186. package/presets/cursor/next/skills/code-review/SKILL.md +0 -26
  187. package/presets/cursor/next/skills/debug-investigation/SKILL.md +0 -28
  188. package/presets/cursor/next/skills/feature-delivery/SKILL.md +0 -15
  189. package/presets/cursor/next/skills/playwright-e2e/SKILL.md +0 -31
  190. package/presets/cursor/next/skills/technical-retro/SKILL.md +0 -40
  191. package/presets/cursor/next/skills/unit-testing/SKILL.md +0 -32
  192. package/presets/cursor/next/team/README.md +0 -104
  193. package/presets/cursor/next/team/tasks/.gitkeep +0 -0
@@ -1,49 +0,0 @@
1
- ---
2
- name: task-continue
3
- description: Continue an agent-team task after a human gate, pause, or review changes request using pipeline.json and status.json.
4
- ---
5
-
6
- # Task continue — после human gate или паузы
7
-
8
- Продолжение пайплайна из `pipeline.json`. Алиас по смыслу: `/feature-continue`.
9
-
10
- ## Аргументы
11
-
12
- `<slug>` — идентификатор задачи.
13
-
14
- ## Preconditions
15
-
16
- 1. Прочитай `.cursor/team/tasks/<slug>/pipeline.json` и `status.json`.
17
- 2. Продолжай если:
18
- - `awaitingHumanGate: true` или `state: awaiting_approval`, **или**
19
- - `state: changes_requested` (после review), **или**
20
- - задача прервана и нужно возобновить с `pipelineIndex`.
21
-
22
- ## Алгоритм
23
-
24
- 1. Запиши `.cursor/team/active-task.json` → `{ "slug": "<slug>" }`.
25
- 2. Сбрось gate: `awaitingHumanGate: false`.
26
- 3. Определи **следующий шаг**:
27
- - После approval analyst/architect: `pipelineIndex + 1` → следующий agent в `steps`.
28
- - После `changes_requested`: снова **feature-developer** (тот же index или найди developer в steps).
29
- 4. Обнови `status.json`:
30
- ```json
31
- {
32
- "pipelineIndex": <n>,
33
- "currentAgent": "<steps[n].agent>",
34
- "phase": "executing",
35
- "state": "in_progress",
36
- "awaitingHumanGate": false
37
- }
38
- ```
39
- 5. Вызови subagent для `currentAgent` с контекстом slug и артефактов.
40
- 6. Hook `chain-team-phases.sh` продолжит цепочку по `pipeline.json`, если `autoChain: true`.
41
-
42
- ## Артефакты для handoff
43
-
44
- | Agent | Прочитать |
45
- |-------|-----------|
46
- | feature-developer | brief.md, decomposition.md, validation-report.md (if retry), review.md (if retry), architecture.md |
47
- | build-verifier | git diff, decomposition.md |
48
- | code-reviewer | brief.md, validation-report.md, git diff |
49
- | qa-tester | brief.md, decomposition.md, scope from pipeline step |
@@ -1,50 +0,0 @@
1
- ---
2
- name: task
3
- description: Route a natural-language task through the agent-team pipeline: task-router, pipeline.json, and the first planned specialist.
4
- ---
5
-
6
- # Task — единая точка входа (router + pipeline)
7
-
8
- Главная команда для постановки задачи. Родительский агент = оркестратор (`agent-team-orchestrator.mdc`). Intake для work-запросов без `/task` — `agent-team-intake.mdc`.
9
-
10
- ## Аргументы
11
-
12
- Всё после `/task` — описание задачи на естественном языке.
13
-
14
- Примеры:
15
-
16
- - `/task Добавить фильтр по дате в Order History`
17
- - `/task Order History падает при пустом списке — пофикси`
18
- - `/task CI упал на type-check в PR`
19
- - `/task Миграция HTTP-клиента на fetch`
20
- - `/task Проверь a11y формы логина`
21
- - `/task Покрой unit-тестами mapper payments`
22
- - `/task Напиши changelog для релиза фильтров`
23
- - `/task Сделай ревью моих изменений в store/orders`
24
- - `/task Напиши e2e для сценария оплаты`
25
-
26
- ## Алгоритм
27
-
28
- 1. **Slug** — kebab-case из описания (≤48 символов). Создай `.cursor/team/tasks/<slug>/`.
29
- 2. **Router** — вызови subagent **task-router** с описанием задачи и путём к slug.
30
- 3. **План** — покажи пользователю таблицу из `pipeline.json`: intent, steps, skipped, humanGates.
31
- 4. **Intent retro** — если `intent === "retro"`, выполни `/technical-retro` и **остановись**.
32
- 5. **Старт** — вызови subagent для `pipeline.steps[0].agent`:
33
- - передай slug, пути к артефактам, scope из step (если есть);
34
- - обнови `status.json`: `pipelineIndex: 0`, `currentAgent`, `state: in_progress`.
35
- 6. **Human gate** — если после текущего шага есть gate в `humanGates` (`after:<agent>`), после завершения агента **остановись** и попроси `/task-continue <slug>` (или `/feature-continue <slug>`).
36
-
37
- ## Не делать
38
-
39
- - Не вызывать developer до router и (если в pipeline) analyst/architect.
40
- - Не hardcode порядок ролей — только `pipeline.json`.
41
- - Не пропускать human gate без явного continue.
42
-
43
- ## Если slug занят
44
-
45
- - `awaitingHumanGate` / `state: awaiting_approval` → предложи ревью артефактов или `/task-continue <slug>`.
46
- - `in_progress` → спроси: продолжить или новый slug.
47
-
48
- ## Legacy
49
-
50
- `/feature-start` и `/feature-continue` остаются совместимыми; для новых задач предпочитай `/task`.
@@ -1,81 +0,0 @@
1
- ---
2
- name: technical-retro
3
- description: Facilitate a technical retrospective for a period, incident, release, or completed agent-team task slug.
4
- ---
5
-
6
- # Техническое ретро
7
-
8
- Агент выступает как **нейтральный фасилитатор технической ретроспективы**, а не как ревьюер кода или оценщик людей. Используй skill **`technical-retro`** как основной сценарий.
9
-
10
- ## Когда включать
11
-
12
- - Пользователь просит: «ретро», «техническое ретро», «разбор спринта/итерации», «action items после релиза».
13
- - После завершения пайплайна команды агентов (`/feature-start` → `/feature-continue`).
14
- - Есть контекст: период, тема (релиз, инцидент), slug задачи, заметки.
15
-
16
- ## Входные данные (собрать, не выдумывать)
17
-
18
- Запросить при нехватке:
19
-
20
- - **Период и фокус**.
21
- - **Slug задачи** (если ретро по работе команды агентов).
22
- - **Участники/роли** (если важно).
23
- - **Ограничения**: время, формат (async vs синхрон).
24
-
25
- ### Артефакты команды агентов (если есть slug)
26
-
27
- Прочитать из репозитория:
28
-
29
- - `.cursor/team/tasks/<slug>/pipeline.json`
30
- - `.cursor/team/tasks/<slug>/brief.md`
31
- - `.cursor/team/tasks/<slug>/decomposition.md`
32
- - `.cursor/team/tasks/<slug>/status.json`
33
- - Git diff / `git status` для изменённых файлов
34
-
35
- Не приписывать факты, которых нет в артефактах, diff или сообщении пользователя.
36
-
37
- ## Принципы фасилитации
38
-
39
- - **Безопасность**: процесс и система, не «виноватые».
40
- - **Конкретика**: от абстракций к наблюдаемым событиям.
41
- - **Баланс**: позитив и зоны роста.
42
- - **Action items**: владелец и срок у каждого.
43
- - **Не смешивать с code review** — развести блоки, если запросили оба.
44
-
45
- ## Структура сессии (по умолчанию)
46
-
47
- 1. **Цель и рамки**.
48
- 2. **Сбор фактов**: хорошо / мешало / сюрпризы.
49
- 3. **Группировка тем** (3–7).
50
- 4. **Корневые причины** для 1–2 болезненных тем.
51
- 5. **Эксперименты** (1–3 изменения процесса).
52
- 6. **Action items**: что / владелец / до когда / критерий успеха.
53
-
54
- ## Блок «Работа агентов» (обязателен при slug)
55
-
56
- Если ретро связано с пайплайном `/feature-start`:
57
-
58
- | Вопрос | Что фиксировать |
59
- |--------|-----------------|
60
- | Router | Ошибка intent, лишние/пропущенные steps в pipeline |
61
- | Аналитик | Ошибки в assumptions, пропущенные AC, лишние/недостающие таски |
62
- | Декомпозиция | Неполное покрытие слоёв, неверный порядок, blocked-зависимости |
63
- | Developer | Scope creep, пропущенные правила, lint/type gaps |
64
- | Reviewer | Пропущенные дефекты, false positives, качество чеклиста |
65
- | QA | Покрытие AC тестами, flakiness, пробелы в e2e планах |
66
-
67
- **Action items** в этом блоке — на улучшение **промптов, subagents и rules** (не только кода).
68
-
69
- ## Формат ответа
70
-
71
- - Шапка: период, фокус, slug (если есть), допущения.
72
- - Повестка по этапам.
73
- - Блок **«Работа агентов»** (если применимо).
74
- - Темы — буллеты; спорное — **вопросы команде**.
75
- - **Action items** в конце.
76
-
77
- ## Ограничения
78
-
79
- - Не приписывать цитаты и факты без входа.
80
- - Не выдавать HR‑рекомендации.
81
- - Если просят только шаблон — **шаблон повестки** без выдуманного контента.
@@ -1,8 +0,0 @@
1
- # `.cursor/hooks` (preset next)
2
-
3
- | File | Purpose |
4
- |------|---------|
5
- | `chain-team-phases.sh` | Continues pipeline after subagent completes; supports `skipIf`, parallel steps, `validation_failed`, `retryAfterFix` |
6
- | `guard-shell-command.sh` | Blocks/asks on destructive git commands and package-manager mismatches (`failClosed: true`) |
7
-
8
- `hooks.json`: `loop_limit: 15` for long pipelines (build-verifier + parallel reviewers + e2e).
@@ -1,380 +0,0 @@
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 TEAM_ROOT = path.join(process.cwd(), '.cursor', 'team');
14
-
15
- const inputRaw = process.env.INPUT || '';
16
- let hookInput;
17
- try {
18
- hookInput = JSON.parse(inputRaw);
19
- } catch {
20
- process.stdout.write('{}');
21
- process.exit(0);
22
- }
23
-
24
- if (hookInput.status !== 'completed') {
25
- process.stdout.write('{}');
26
- process.exit(0);
27
- }
28
-
29
- const activePath = path.join(TEAM_ROOT, 'active-task.json');
30
-
31
- if (!fs.existsSync(activePath)) {
32
- process.stdout.write('{}');
33
- process.exit(0);
34
- }
35
-
36
- let active;
37
- try {
38
- active = JSON.parse(fs.readFileSync(activePath, 'utf8'));
39
- } catch {
40
- process.stdout.write('{}');
41
- process.exit(0);
42
- }
43
-
44
- const slug = active.slug;
45
- if (!slug) {
46
- process.stdout.write('{}');
47
- process.exit(0);
48
- }
49
-
50
- const taskDir = path.join(TEAM_ROOT, 'tasks', slug);
51
- const statusPath = path.join(taskDir, 'status.json');
52
- const pipelinePath = path.join(taskDir, 'pipeline.json');
53
-
54
- if (!fs.existsSync(statusPath)) {
55
- process.stdout.write('{}');
56
- process.exit(0);
57
- }
58
-
59
- let status;
60
- try {
61
- status = JSON.parse(fs.readFileSync(statusPath, 'utf8'));
62
- } catch {
63
- process.stdout.write('{}');
64
- process.exit(0);
65
- }
66
-
67
- const now = new Date().toISOString();
68
-
69
- function writeStatus(next) {
70
- status = { ...status, ...next, slug, updatedAt: now };
71
- fs.writeFileSync(statusPath, JSON.stringify(status, null, 2) + '\n');
72
- }
73
-
74
- function out(message) {
75
- process.stdout.write(JSON.stringify({ followup_message: message }));
76
- }
77
-
78
- function readArtifact(name) {
79
- const p = path.join(taskDir, name);
80
- if (!fs.existsSync(p)) return '';
81
- try {
82
- return fs.readFileSync(p, 'utf8');
83
- } catch {
84
- return '';
85
- }
86
- }
87
-
88
- function getStepAgents(step) {
89
- if (!step) return [];
90
- return Array.isArray(step.agent) ? step.agent : [step.agent];
91
- }
92
-
93
- function skipIfMatches(skipIf, dir) {
94
- if (!skipIf) return false;
95
- if (skipIf === 'debugger.fixed') {
96
- const text = readArtifact('debug-report.md');
97
- return /fixApplied:\s*true/i.test(text) || /\*\*Fix applied:\*\*\s*true/i.test(text);
98
- }
99
- if (skipIf === 'ci-investigator.resolved') {
100
- const text = readArtifact('ci-report.md');
101
- return /fixApplied:\s*true/i.test(text) || /## Verdict\s*\nPASS/i.test(text);
102
- }
103
- return false;
104
- }
105
-
106
- function findNextExecutableStep(steps, startIdx, dir) {
107
- for (let i = startIdx; i < steps.length; i++) {
108
- if (!skipIfMatches(steps[i].skipIf, dir)) {
109
- return { step: steps[i], index: i };
110
- }
111
- }
112
- return null;
113
- }
114
-
115
- const AGENT_HANDOFF = {
116
- 'task-analyst': (s) =>
117
- `Invoke task-analyst for slug "${s}". Write brief.md and decomposition.md under .cursor/team/tasks/${s}/. ` +
118
- `Set status.json: phase executing, state awaiting_approval if human gate applies. Do not use legacy phase analysis.`,
119
- debugger: (s) =>
120
- `Invoke debugger subagent for slug "${s}". Investigate root cause; write debug-report.md with fixApplied: true/false. ` +
121
- `Update status.json when done.`,
122
- 'solution-architect': (s) =>
123
- `Invoke solution-architect for slug "${s}". Read brief.md; write architecture.md. Update status.json when done.`,
124
- 'migration-specialist': (s) =>
125
- `Invoke migration-specialist for slug "${s}". Read brief.md; write migration-plan.md. Update status.json when done.`,
126
- 'api-contract-reviewer': (s) =>
127
- `Invoke api-contract-reviewer (readonly) for slug "${s}". Write api-contract-review.md. Update status.json when done.`,
128
- 'ci-investigator': (s) =>
129
- `Invoke ci-investigator for slug "${s}". Diagnose CI failure; write ci-report.md; apply minimal fix. ` +
130
- `Use ci-investigation skill. Update status.json when done.`,
131
- 'feature-developer': (s) =>
132
- `Invoke feature-developer for slug "${s}". Read brief.md, decomposition.md, validation-report.md, review.md, architecture.md, migration-plan.md, api-contract-review.md, debug-report.md if present. ` +
133
- `Follow feature-delivery-workflow.mdc and reference-features.mdc. Include unit tests for mappers/logic before handoff. Update status.json when done.`,
134
- 'build-verifier': (s) =>
135
- `Invoke build-verifier (readonly) for slug "${s}". Run lint:js, lint:css, type-check, and targeted unit tests from app/. ` +
136
- `Write validation-report.md. Set state completed or validation_failed. Do not edit production code.`,
137
- 'accessibility-reviewer': (s) =>
138
- `Invoke accessibility-reviewer (readonly) for slug "${s}". Review UI diff; write a11y-review.md. Update status.json when done.`,
139
- 'performance-auditor': (s) =>
140
- `Invoke performance-auditor (readonly) for slug "${s}". Write perf-report.md. Update status.json when done.`,
141
- 'code-reviewer': (s) =>
142
- `Invoke code-reviewer subagent (readonly) for slug "${s}". Review git diff vs brief.md per code-review-mr.mdc. ` +
143
- `Update status.json when done.`,
144
- 'security-reviewer': (s) =>
145
- `Invoke security-reviewer (readonly) for slug "${s}". Write security-review.md. Update status.json when done.`,
146
- 'qa-tester': (s, scope) =>
147
- `Invoke qa-tester for slug "${s}"${scope ? ` (scope: ${scope})` : ''}. ` +
148
- `Add/update tests per brief. Follow playwright-agents.mdc. Update status.json when done.`,
149
- 'unit-test-planner': (s) =>
150
- `Invoke unit-test-planner for slug "${s}". Write unit-test-plan.md. Use unit-testing skill. Update status.json when done.`,
151
- 'unit-test-generator': (s) =>
152
- `Invoke unit-test-generator for slug "${s}". Implement specs from unit-test-plan.md. Use unit-testing skill. Update status.json when done.`,
153
- 'unit-test-healer': (s) =>
154
- `Invoke unit-test-healer for slug "${s}". Fix failing unit tests. Use unit-testing and debug-investigation skills. Update status.json when done.`,
155
- 'playwright-test-planner': (s) =>
156
- `Invoke playwright-test-planner for slug "${s}". Create/update app/__tests__/e2e/**/*.cases.md. ` +
157
- `Follow playwright-agents.mdc and the playwright-e2e skill. Update status.json when done.`,
158
- 'playwright-test-generator': (s) =>
159
- `Invoke playwright-test-generator for slug "${s}". Generate/update *.spec.ts from matching *.cases.md. ` +
160
- `Use user-playwright MCP when available. Follow playwright-agents.mdc and the playwright-e2e skill. Update status.json when done.`,
161
- 'playwright-test-healer': (s) =>
162
- `Invoke playwright-test-healer for slug "${s}". Fix failing/flaky e2e while preserving cases.md assertions. ` +
163
- `Use user-playwright MCP when available. Follow playwright-agents.mdc and debug-investigation. Update status.json when done.`,
164
- 'tech-writer': (s) =>
165
- `Invoke tech-writer for slug "${s}". Write documentation.md from task artifacts. Update status.json when done.`,
166
- };
167
-
168
- const REVIEW_AGENTS = new Set([
169
- 'code-reviewer',
170
- 'accessibility-reviewer',
171
- 'security-reviewer',
172
- 'api-contract-reviewer',
173
- ]);
174
-
175
- function handoffForAgent(agent, scope) {
176
- const fn = AGENT_HANDOFF[agent];
177
- return fn ? fn(slug, scope) : `Invoke ${agent} subagent for slug "${slug}". Update status.json when done.`;
178
- }
179
-
180
- function handoffForParallelStep(step) {
181
- const agents = getStepAgents(step);
182
- return (
183
- `Invoke IN PARALLEL (one message, multiple Task calls): ${agents.join(' AND ')} for slug "${slug}". ` +
184
- `Each agent writes its artifact and appends itself to status.json parallelCompleted when done.`
185
- );
186
- }
187
-
188
- function hasGateAfter(agent, humanGates) {
189
- return Array.isArray(humanGates) && humanGates.includes(`after:${agent}`);
190
- }
191
-
192
- function hasGateAfterStep(step, humanGates) {
193
- return getStepAgents(step).some((a) => hasGateAfter(a, humanGates));
194
- }
195
-
196
- function legacyFlow() {
197
- if (status.phase === 'analysis') {
198
- process.stdout.write('{}');
199
- process.exit(0);
200
- }
201
- if (status.phase === 'development' && (status.state === 'completed' || status.state === 'in_progress')) {
202
- writeStatus({ phase: 'executing', state: 'in_progress', currentAgent: 'build-verifier' });
203
- out(handoffForAgent('build-verifier'));
204
- process.exit(0);
205
- }
206
- if (status.currentAgent === 'build-verifier' && status.state === 'completed') {
207
- writeStatus({ phase: 'executing', state: 'in_progress', currentAgent: 'code-reviewer' });
208
- out(handoffForAgent('code-reviewer'));
209
- process.exit(0);
210
- }
211
- if (status.phase === 'review' && status.state === 'completed') {
212
- writeStatus({ phase: 'executing', state: 'in_progress', currentAgent: 'qa-tester' });
213
- out(handoffForAgent('qa-tester'));
214
- process.exit(0);
215
- }
216
- if (status.state === 'changes_requested' && REVIEW_AGENTS.has(status.currentAgent)) {
217
- writeStatus({
218
- currentAgent: 'feature-developer',
219
- state: 'in_progress',
220
- phase: 'executing',
221
- retryAfterFix: status.currentAgent,
222
- });
223
- out(
224
- handoffForAgent('feature-developer') +
225
- ` After fixes, re-run ${status.currentAgent}.`,
226
- );
227
- process.exit(0);
228
- }
229
- if (status.state === 'validation_failed' && status.currentAgent === 'build-verifier') {
230
- writeStatus({
231
- currentAgent: 'feature-developer',
232
- state: 'in_progress',
233
- phase: 'executing',
234
- retryAfterFix: 'build-verifier',
235
- });
236
- out(
237
- handoffForAgent('feature-developer') +
238
- ` Read validation-report.md. After fixes, re-run build-verifier.`,
239
- );
240
- process.exit(0);
241
- }
242
- if (status.state === 'completed' && status.retryAfterFix) {
243
- const retry = status.retryAfterFix;
244
- writeStatus({ currentAgent: retry, state: 'in_progress', retryAfterFix: null });
245
- out(handoffForAgent(retry));
246
- process.exit(0);
247
- }
248
- if (status.phase === 'testing' && status.state === 'completed') {
249
- writeStatus({ phase: 'done', state: 'completed' });
250
- out(`Pipeline complete for "${slug}". Run /technical-retro ${slug}.`);
251
- process.exit(0);
252
- }
253
- process.stdout.write('{}');
254
- process.exit(0);
255
- }
256
-
257
- if (!fs.existsSync(pipelinePath)) {
258
- legacyFlow();
259
- }
260
-
261
- let pipeline;
262
- try {
263
- pipeline = JSON.parse(fs.readFileSync(pipelinePath, 'utf8'));
264
- } catch {
265
- legacyFlow();
266
- }
267
-
268
- const steps = pipeline.steps || [];
269
- if (steps.length === 0 || pipeline.autoChain === false) {
270
- process.stdout.write('{}');
271
- process.exit(0);
272
- }
273
-
274
- if (status.awaitingHumanGate || status.state === 'awaiting_approval') {
275
- process.stdout.write('{}');
276
- process.exit(0);
277
- }
278
-
279
- if (status.state === 'changes_requested' && REVIEW_AGENTS.has(status.currentAgent)) {
280
- const reviewer = status.currentAgent;
281
- writeStatus({
282
- currentAgent: 'feature-developer',
283
- state: 'in_progress',
284
- phase: 'executing',
285
- retryAfterFix: reviewer,
286
- });
287
- out(
288
- handoffForAgent('feature-developer') +
289
- ` After fixes, re-run ${reviewer}.`,
290
- );
291
- process.exit(0);
292
- }
293
-
294
- if (status.state === 'validation_failed' && status.currentAgent === 'build-verifier') {
295
- writeStatus({
296
- currentAgent: 'feature-developer',
297
- state: 'in_progress',
298
- phase: 'executing',
299
- retryAfterFix: 'build-verifier',
300
- });
301
- out(
302
- handoffForAgent('feature-developer') +
303
- ` Read validation-report.md. After fixes, re-run build-verifier.`,
304
- );
305
- process.exit(0);
306
- }
307
-
308
- if (status.state === 'completed' && status.retryAfterFix) {
309
- const retry = status.retryAfterFix;
310
- writeStatus({ currentAgent: retry, state: 'in_progress', retryAfterFix: null });
311
- out(handoffForAgent(retry));
312
- process.exit(0);
313
- }
314
-
315
- const idx = typeof status.pipelineIndex === 'number' ? status.pipelineIndex : 0;
316
- const currentStep = steps[idx];
317
- if (!currentStep) {
318
- writeStatus({ phase: 'done', state: 'completed', currentAgent: null });
319
- out(`Pipeline complete for "${slug}". Run /technical-retro ${slug}.`);
320
- process.exit(0);
321
- }
322
-
323
- const completedAgent = status.currentAgent || getStepAgents(currentStep)[0];
324
- const stepAgents = getStepAgents(currentStep);
325
-
326
- if (currentStep.parallel && stepAgents.length > 1) {
327
- const done = [...(status.parallelCompleted || [])];
328
- if (completedAgent && !done.includes(completedAgent)) {
329
- done.push(completedAgent);
330
- }
331
- writeStatus({ parallelCompleted: done });
332
- const remaining = stepAgents.filter((a) => !done.includes(a));
333
- if (remaining.length > 0) {
334
- process.stdout.write('{}');
335
- process.exit(0);
336
- }
337
- writeStatus({ parallelCompleted: [] });
338
- }
339
-
340
- if (hasGateAfterStep(currentStep, pipeline.humanGates)) {
341
- writeStatus({
342
- awaitingHumanGate: true,
343
- state: 'awaiting_approval',
344
- currentAgent: completedAgent,
345
- });
346
- process.stdout.write('{}');
347
- process.exit(0);
348
- }
349
-
350
- const next = findNextExecutableStep(steps, idx + 1, taskDir);
351
- if (!next) {
352
- writeStatus({
353
- pipelineIndex: steps.length,
354
- phase: 'done',
355
- state: 'completed',
356
- currentAgent: null,
357
- awaitingHumanGate: false,
358
- });
359
- out(`Pipeline complete for "${slug}". Run /technical-retro ${slug}.`);
360
- process.exit(0);
361
- }
362
-
363
- const { step: nextStep, index: nextIdx } = next;
364
- const nextAgents = getStepAgents(nextStep);
365
-
366
- writeStatus({
367
- pipelineIndex: nextIdx,
368
- currentAgent: nextAgents[0],
369
- phase: 'executing',
370
- state: 'in_progress',
371
- awaitingHumanGate: false,
372
- parallelCompleted: [],
373
- });
374
-
375
- if (nextStep.parallel && nextAgents.length > 1) {
376
- out(handoffForParallelStep(nextStep));
377
- } else {
378
- out(handoffForAgent(nextAgents[0], nextStep.scope));
379
- }
380
- NODE
@@ -1,77 +0,0 @@
1
- #!/usr/bin/env bash
2
- # Lightweight shell guard for Cursor projects using this preset.
3
-
4
- set -euo pipefail
5
-
6
- input=$(cat)
7
-
8
- INPUT="$input" node <<'NODE'
9
- const fs = require('fs');
10
-
11
- const raw = process.env.INPUT || '';
12
- let event;
13
- try {
14
- event = JSON.parse(raw);
15
- } catch {
16
- process.stdout.write('{ "permission": "allow" }');
17
- process.exit(0);
18
- }
19
-
20
- const command = String(event.command || event.input?.command || '');
21
- if (!command.trim()) {
22
- process.stdout.write('{ "permission": "allow" }');
23
- process.exit(0);
24
- }
25
-
26
- function out(permission, userMessage, agentMessage) {
27
- process.stdout.write(JSON.stringify({
28
- permission,
29
- user_message: userMessage,
30
- agent_message: agentMessage || userMessage,
31
- }));
32
- }
33
-
34
- const dangerousGit = /\bgit\s+(reset\s+--hard|clean\s+-[^\n]*f|push\s+--force|push\s+-f|checkout\s+--\s+)/;
35
- if (dangerousGit.test(command)) {
36
- out(
37
- 'ask',
38
- 'This command looks destructive for git state. Review it before continuing.',
39
- 'A project hook flagged a destructive git command. Ask the user before running it.',
40
- );
41
- process.exit(0);
42
- }
43
-
44
- const managerByFile = [
45
- ['yarn.lock', 'yarn'],
46
- ['pnpm-lock.yaml', 'pnpm'],
47
- ['package-lock.json', 'npm'],
48
- ].find(([file]) => fs.existsSync(file));
49
-
50
- let expected = managerByFile?.[1];
51
- if (!expected && fs.existsSync('package.json')) {
52
- try {
53
- const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'));
54
- const pm = typeof pkg.packageManager === 'string' ? pkg.packageManager : '';
55
- expected = pm.split('@')[0] || undefined;
56
- } catch {
57
- // Ignore invalid package.json in the hook; the agent can diagnose it later.
58
- }
59
- }
60
-
61
- if (!expected) {
62
- process.stdout.write('{ "permission": "allow" }');
63
- process.exit(0);
64
- }
65
-
66
- const used = command.match(/(^|[;&|]\s*)(npm|yarn|pnpm)\s+/)?.[2];
67
- if (used && used !== expected) {
68
- out(
69
- 'ask',
70
- `This repository appears to use ${expected}, but the command uses ${used}. Confirm before continuing.`,
71
- `Use ${expected} for package scripts and installs unless the user explicitly approves ${used}.`,
72
- );
73
- process.exit(0);
74
- }
75
-
76
- process.stdout.write('{ "permission": "allow" }');
77
- NODE
@@ -1,17 +0,0 @@
1
- {
2
- "version": 1,
3
- "hooks": {
4
- "beforeShellExecution": [
5
- {
6
- "command": ".cursor/hooks/guard-shell-command.sh",
7
- "failClosed": true
8
- }
9
- ],
10
- "subagentStop": [
11
- {
12
- "command": ".cursor/hooks/chain-team-phases.sh",
13
- "loop_limit": 15
14
- }
15
- ]
16
- }
17
- }
@@ -1,14 +0,0 @@
1
- ---
2
- description: Use when user posts a work request without /task — suggest or use /task to run the agent team router. Lightweight intake hint only.
3
- alwaysApply: false
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.