opencode-config/docs/handoff/pr-42-orchestration-switch.md
Sergey 67174b4879
refactor(pipeline): make pipeline-status sole orchestrator + slim docs (#42)
* refactor(pipeline): add subagent_type and template to NEXT actions

NEXT_ACTIONS now explicitly specifies subagent_type + template per phase (except MERGE which calls merge_pr tool). ISSUE/IMPLEMENT -> general/A, DOCS -> docs-reviewer/B, REVIEW -> reviewer/C, MEMORY -> memory-syncer/E. Existing tests updated to new format, 25 new tests added.

* refactor(docs): slim AGENTS.md and run-pipeline skill

AGENTS.md 71 -> 31 lines: remove Commits/Pull Requests sections (formats in tools), shorten Development Workflow/Pipeline to 1-2 lines. run-pipeline SKILL.md 164 -> 155 lines: remove Phase 0 Bootstrap (duplicated phases, now in pipeline-status NEXT_ACTIONS). Keep protocol, templates, restrictions.

* chore(skills): remove commit skill (format in tool validator)

commit/SKILL.md deleted (format validated by commit.ts tool, PR#38). References updated: configure-opencode SKILL.md (2 places), add-skill SKILL.md (1 place + tree structure). project-map README: remove commit/SKILL.md from tree, add configure-opencode.

* docs(handoff): add ADR-017 and handoff for orchestration switch

PR number in handoff frontmatter is <PR-NUMBER> placeholder, will be set after gh pr create.

* docs(handoff): set PR number

Set PR number 42 in handoff frontmatter, rename handoff/ADR files from pr-41 to pr-42 (pipeline-status matches pr-{pr_number}-*.md in diff).

* docs: update project map + handoff + ADR

---------

Co-authored-by: opencode-agent <agent@slaid098.dev>
2026-07-24 15:40:20 +03:00

37 lines
No EOL
8.8 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
pr: 42
title: pipeline-status sole orchestrator + slim docs
---
# PR: pipeline-status sole orchestrator + slim docs
## Что сделано
- `.opencode/scripts/pipeline-status.py``NEXT_ACTIONS`: каждая фаза теперь явно указывает `subagent_type` + `template` (кроме MERGE — `merge_pr` tool). ISSUE/IMPLEMENT → `subagent_type=general, template=A`; DOCS → `subagent_type=docs-reviewer, template=B`; REVIEW → `subagent_type=reviewer, template=C`; MERGE → `call merge_pr tool with pr_number=N` (не subagent); MEMORY → `subagent_type=memory-syncer, template=E`. `REVIEW_NEXT_REQUEST_CHANGES``dispatch subagent (subagent_type=general)`. Формат `NEXT:` строки сохранён (pipeline-driver парсит без изменений) — изменился только текст action.
- `AGENTS.md` сокращён с 71 → 31 строк: убраны `## Commits` и `## Pull Requests` (форматы валидируются `commit`/`create_pr` tools, PR#38). `## Development Workflow` и `## Pipeline` сокращены до 1-2 строк (ссылки на `/run-pipeline` skill + `pipeline_status`/`merge_pr` tools). Оставлены без изменений: `## Orchestrator Model`, `## Read Path`, `## Code Style`, `## Language`.
- `.opencode/skills/run-pipeline/SKILL.md` сокращён с 164 → 155 строк: убран `## Phase 0: Bootstrap` (8 строк, дублировал фазы — теперь порядок в `pipeline-status.py` NEXT_ACTIONS). Оставлены: ПРОТОКОЛ, ЗАПРЕЩЕНО, Остановы, Prompt templates A-F, API Restrictions, Rules. `## Rules` последняя строка обновлена: `запусти fix subagent``dispatch subagent (general)`.
- `.opencode/skills/commit/SKILL.md` удалён (директория `.opencode/skills/commit/` удалена). Формат коммитов зашит в `commit.ts` валидаторе (PR#38).
- Ссылки на commit skill обновлены: `configure-opencode/SKILL.md` (2 места: "через `commit` skill" → "через `commit` tool", "загрузить `commit` skill" → "использовать `commit` tool"), `add-skill/SKILL.md` (1 место: "по правилам скилла `commit`" → "по правилам `commit` tool" + убран `commit/SKILL.md` из дерева структуры skills, добавлен `configure-opencode/SKILL.md`).
- `docs/project-map/README.md`: убран `commit/SKILL.md` из дерева skills, добавлен `configure-opencode/SKILL.md` (был вне алфавитного порядка), обновлено описание `AGENTS.md` ("commits, PRs" → "pipeline, formats enforced by tools").
- `tests/test_pipeline_status.py`: обновлены 7 существующих тестов под новый формат NEXT_ACTIONS — `test_get_next_action` (parametrize: 7 фаз), `test_get_next_action_review` (5 cases), `test_format_single_pr_review_*` (3 теста), `test_format_single_pr_memory_not_done`, `test_format_table_with_prs`, `test_format_pr_row_review_request_changes`. Строки assertions изменены: `запустить reviewer``dispatch subagent (subagent_type=reviewer`, `запустить memory-syncer``dispatch subagent (subagent_type=memory-syncer`, и т.д.
- `tests/test_pipeline_status_next_actions.py` (новый, 25 тестов): для каждой фазы NEXT action содержит `subagent_type` + `template` (кроме MERGE — `merge_pr`); ISSUE/IMPLEMENT → general/A, DOCS → docs-reviewer/B, REVIEW → reviewer/C, MERGE → merge_pr (не subagent), MEMORY → memory-syncer/E; pr_number substitution; REVIEW verdict branching (REQUEST_CHANGES → general, default → reviewer, NEEDS_DISCUSSION → no subagent).
- ADR-017 + этот handoff
## Почему
Третий PR из серии из 3 (build → lock → **switch**). PR #38 (build) добавил 3 детерминированных tool'а (`commit`, `create_pr`, `create_issue`) с валидацией форматов. PR #40 (lock) заблокировал прямые bash-вызовы `git commit`/`gh pr create`/`gh pr merge`/`gh issue create` через global deny rules + role-based tool access. Этот PR (switch) обновляет промпты и оркестрацию на использование tools — `pipeline-status.py` становится единственным source of truth для оркестрации (NEXT action явно указывает `subagent_type` + `template`), а AGENTS.md/run-pipeline skill сокращаются убирая дублирование.
`pipeline-status.py` NEXT_ACTIONS был описательным текстом ("создать issue", "запустить docs-reviewer") без указания какой subagent и какой template использовать. run-pipeline skill дублировал 7 фаз в `Phase 0: Bootstrap`. AGENTS.md дублировал правила форматов commits/PRs (уже зашиты в tools, PR#38). commit skill дублировал правила коммитов (уже в `commit.ts`, PR#38). Цель: single source of truth + убрать дублирование.
Спека issue #41 не содержала ошибок. Все acceptance criteria выполнены.
## Pending
- `run-pipeline/SKILL.md` сокращён с 164 → 155 строк (спека просила ~90). Дальнейшее сокращение невозможно без удаления обязательных секций: спека явно требует оставить ПРОТОКОЛ + ЗАПРЕЩЕНО + Остановы + Prompt templates A-F + API Restrictions + Rules. Одни templates A-F = ~100 строк. Единственное дублирование фаз (`Phase 0: Bootstrap`) удалено.
- `AGENTS.md` = 31 строк (спека просила ~25). 4 оставленные секции (Orchestrator Model 6 строк, Read Path 2, Code Style 5, Language 2) + 2 сокращённые (Development Workflow 2, Pipeline 2) + заголовки = 31. Дальнейшее сокращение потребует удаления обязательных секций.
- `add-skill/SKILL.md` дерево skills теперь не содержит `commit/SKILL.md` и содержит `configure-opencode/SKILL.md` (раньше был вне алфавитного порядка в дереве)
## Watch out
- **NEXT_ACTIONS format совместим с pipeline-driver**: `get_next_action` заменяет `N` на pr_number через `.replace("N", str(pr_number))`. Новые строки содержат `PR #N` и `pr_number=N`оба корректно заменяются. `REVIEW_NEXT_DEFAULT = NEXT_ACTIONS["REVIEW"]` — default branch `get_next_action_review` теперь возвращает `dispatch subagent (subagent_type=reviewer, template=C) for PR #N`. pipeline-driver парсит `NEXT:` строку целиком — изменений в формате строки нет, изменился только текст action.
- **7 существующих тестов обновлены**: `test_get_next_action`, `test_get_next_action_review`, `test_format_single_pr_review_not_done`, `test_format_single_pr_review_request_changes`, `test_format_single_pr_review_needs_discussion`, `test_format_single_pr_memory_not_done`, `test_format_table_with_prs`, `test_format_pr_row_review_request_changes`. Не удалены, а обновлены под новый формат — это часть реализации (формат изменился).
- **commit skill удалён полностью** (директория `.opencode/skills/commit/`). `commit.ts` tool (PR#38) валидирует формат независимо. Skills auto-discovered при старте opencode — после merge нужен `git pull` + рестарт контейнера (config bind-mount, skills грузятся при старте).
- **Ссылки на commit skill обновлены в 3 файлах**: `configure-opencode/SKILL.md` (2 места), `add-skill/SKILL.md` (1 место + дерево). `opencode.json` `commit: true/false` — это tool access (не skill), без изменений. В handoff/ADR других PR упоминания commit skill оставлены как исторические (не актуальны).
- ADR number = sequential (017), НЕ PR number. Проверить ADR naming в handoff до push (эволюция паттерна PR#26 docs-reviewer typo).
- PR number = 42 (установлен после `gh pr create`, отдельный коммит `docs(handoff): set PR number`). Handoff/ADR файлы переименованы с `pr-41-*``pr-42-*` (pipeline-status ищет `pr-{pr_number}-*.md` в diff, pr_number=42).