Push or PR scope work to the main branch. Mode-aware - detects trunk vs worktree branching from workflow manifest.
Push or create a PR to merge scope work into the main branch.
BRANCHING_MODE=$(grep '^WORKFLOW_BRANCHING_MODE=' .claude/config/workflow-manifest.sh 2>/dev/null | cut -d'"' -f2)
[ -z "$BRANCHING_MODE" ] && BRANCHING_MODE="trunk"
bash .claude/hooks/get-session-id.sh — capture the UUID outputscopes/completed/
(if BATCH_SCOPE_IDS is set, only record on those specific scopes):
sessions.pushToMain in frontmatterCURRENT_BRANCH=$(git branch --show-current)
BRANCHING_MODE=trunk)If on main:
git push origin main
If on a feature branch:
$CURRENT_BRANCH. Create a PR to main, or merge directly?"
gh pr create --base main --title "scope(NNN): title" --body "..."git checkout main && git merge $CURRENT_BRANCH && git push origin mainBRANCHING_MODE=worktree)Always on a feature branch in worktree mode:
gh pr create --base main \
--title "scope(NNN): title" \
--body "## Summary
Merges scope NNN work into main.
## Scopes
- NNN: title"
For each completed scope being pushed:
bash .claude/hooks/scope-transition.sh --from completed --to main --scope NNN
Always emit when finished — this is not optional. Emit success or failure so the dispatch resolves immediately:
# On success — with a scope:
bash .claude/hooks/orbital-emit.sh AGENT_COMPLETED '{"outcome":"success","action":"pr_main"}' --scope "{NNN}"
# On success — without a scope:
bash .claude/hooks/orbital-emit.sh AGENT_COMPLETED '{"outcome":"success","action":"pr_main"}'
# On failure (push rejected, PR failed, merge conflicts, etc.):
bash .claude/hooks/orbital-emit.sh AGENT_COMPLETED '{"outcome":"failure","action":"pr_main"}' --scope "{NNN}"
When BATCH_SCOPE_IDS and MERGE_MODE env vars are set:
MERGE_MODE=${MERGE_MODE:-push} # push, pr, or direct
git push origin maingh pr create --base maingit checkout main && git merge ... && git push origin mainTransition all scopes in BATCH_SCOPE_IDS (comma-separated).