* feat(tools): add merge_pr TS tool wrapper * refactor(run-pipeline): replace raw gh pr merge with merge_pr tool * fix(scripts): update pipeline-status MERGE NEXT action * docs(handoff): add pr-16 handoff + ADR-010 * fix(handoff): remove dangling ADR-012/ADR-016 references * docs(handoff): set PR number 30 * docs(project-map): add merge-pr.ts tool (PR#30) --------- Co-authored-by: opencode-agent <agent@slaid098.dev>
4.5 KiB
4.5 KiB
PR: run-pipeline rewrite + merge_pr tool
Что сделано
- Created merge_pr TS tool (
.opencode/tools/merge-pr.ts) — orchestrator-safe wrapper forgh pr merge N --squash --delete-branch. Built with@opencode-ai/plugintool({...})pattern (matchingpipeline-status.ts/spec-status.ts), auto-discovered from.opencode/tools/— noopencode.jsonregistration needed. - run-pipeline skill: replaced raw
gh pr mergewithmerge_pr({ pr_number: M })tool call in Rules + added explicitTemplate F (merge)MERGE phase section. - Fixed
config/scripts/scaffold-handoff.sh→.opencode/scripts/scaffold-handoff.sh(Template A, step 3). - Fixed Phase 0 ambiguity: "load issue skill" → "dispatch subagent (general) with instruction to load
issueskill and create issue N" (main agent = pure orchestrator, не пишет issue body). - Updated
pipeline-status.pyNEXT_ACTIONS["MERGE"]: "смержить PR (gh pr merge N...)" → "вызвать merge_pr tool ({pr_number: N})" (краткая форма — verbose вариант— orchestrator-safe wrapper ...превышал ruff E501 100 chars в тестеtest_get_next_action; суть в tool call, детали в ADR-010). - Updated test
test_pipeline_status.py::test_get_next_actionMERGE assertion to new string. - Reformulated restriction line 29 to keep
--adminban but remove actionable raw-bash phrasing.
Почему
MERGE by main agent via raw bash = orchestrator conflict (main agent = plan only, не исполняет mutations). merge_pr tool wrapper aligns with tool-led philosophy (обёртка side-effects в tools для orchestrator-контракта + uniform API + centralized guards). config/ paths stale after PR#23 migration (config/ → .opencode/). Phase 0 ambiguity resolved in direction of PR#28 issue-skill rewrite (full subagent delegation). Stale "load pipeline-driver before PR" reference — не найдена в файле (переименование в #14 уже очистило); AGENTS.md ещё не существует (#10 не смержен), правки по AGENTS.md пропущены.
Pending
- AGENTS.md orchestrator rewrite (#10) — references
/run-pipeline+/spec(после rename в #29), collapse Dev Workflow + Pipeline section в pointer. pipeline_statusoracle AMBIGUOUS bug — root cause не изолирован (PR#25-#29 pattern: oracle branch-matching стабильно не детектит runs отalways-ci.yml). Надёжная альтернатива:gh pr view N --json statusCheckRollup.opencode.jsontools section НЕ добавлен — tools auto-discovered из.opencode/tools/*.tsчерез@opencode-ai/plugin(проверено по существующимpipeline-status.ts,spec-status.ts). Issue спека предполагала регистрацию, но это не соответствует фактической конвенции репо.check-permissions.pymerge guard НЕ реализован —merge_prtool не имеет pre-flight security guard. Guard потенциально полезен (subagent deny merge), ноcheck-permissions.pyсейчас только linting permission rules, не runtime guard. Follow-up.
Watch out
merge_prtool = TS wrapper, вызываетgh pr merge --squash --delete-branchчерезspawnSync.cwd = context.worktree(как вpipeline-status.ts).pipeline_statustool name unchanged (independent от command rename в #29).merge_pr— новый tool, экспонирует programmatic API.get_next_actionвpipeline-status.pyделаетaction.replace("N", str(pr_number))— placeholder в NEXT_ACTIONS должен бытьN(НЕM), иначе replace не сработает. MERGE action использует{pr_number: N}.- run-pipeline skill renamed from pipeline-driver in #14/#29 (command
/run-pipeline, skill dirrun-pipeline/). @opencode-ai/plugintool({...})pattern — НЕ plainexport default async function(как в issue спеке). Issue спека показывала старый/упрощённый signature; фактическая конвенция репо —tool({...})сargsschema.- ADR numbering в этом репо sequential (001..009 на момент PR). ADRs из приватного
slaid098/opencode(tool-led philosophy, subagent deny merge) НЕ мигрировали — references убраны, оставлен смысл (см. ADR-010 Контекст/Альтернативы).