Skip to content
Back to skills

Merge To Main

ASecurity

Perform the approved delivery operation — merge the PR (pull_request path), bootstrap-push a new repo, or commit and push to the default branch (direct path)

  • 3 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 7, 2026
toolsgobashnodegit

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned November 25, 2026

npx -y skills add nirecom/agents --skill merge-to-main --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Merge To Main?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Merge To Main
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/nirecom-merge-to-main/badge)](https://www.skillsdirectory.com/skills/nirecom-merge-to-main)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: merge-to-main
description: Perform the approved delivery operation — merge the PR (pull_request path), bootstrap-push a new repo, or commit and push to the default branch (direct path)
user-invocable: false
---

Perform the delivery operation the user approved in `/get-release-approval`, then complete the `merge_to_main` step.
Every step is idempotent: a re-run after a partial delivery resumes without repeating a landed operation.

## Procedure

When a hook blocks a sanctioned command, a fallback path is taken, or any unexpected outcome occurs, report via /supervisor-report (trigger conditions: rules/supervisor-reporting.md).

MM-1. **Confirm the step:** run `node "$AGENTS_MAIN_ROOT/bin/workflow/next-step" --session "<session-id>"`.
   `REASON=` other than `merge_to_main` → stop and follow its `ACTION`; never merge or push before the approval is recorded.

MM-2. **Read the delivery path:** run `node "$AGENTS_MAIN_ROOT/bin/session-close-detect-route.js" --session "<session-id>"` and read `ROUTE=` (the recorded `delivery_path`).
   `pull_request` → run `node "$AGENTS_MAIN_ROOT/bin/workflow/release-channel" --session "<session-id>"` and read `CHANNEL=`, then MM-3.
   `direct` → MM-4.

## Pull request delivery

MM-3. **Merge the PR (pull_request):** run `node "$AGENTS_MAIN_ROOT/bin/workflow/pr-state"` and read `PR_STATE=` / `PR_NUMBER=`.
   `MERGED` → already delivered; go to MM-5.
   `OPEN` with release-channel `CHANNEL=web-merge` → the human merges on the web; never merge here — stop and run `/get-release-approval`.
   `OPEN` and `PR_NUMBER` differs from the PR number in the `/get-release-approval` GA-3 approval reason → stop and re-run `/get-release-approval` instead of merging.
   `OPEN` → issue the merge as one direct Bash call, never wrapped in a helper:
   github: `gh pr merge <PR_NUMBER> --squash --delete-branch`
   gitlab: `glab mr merge <PR_NUMBER> --squash --remove-source-branch`
   Merge failure → surface the error and stop; on success go to MM-3a.

MM-3a. **Notify the PM (fail-open):** run `node "$AGENTS_MAIN_ROOT/bin/pm-notify" record --point merge --issue <ref>` once per `closes_issues` ref, send per `skills/_shared/pm-notify.md`, then go to MM-5.
   `NONE` → run `bash "$AGENTS_MAIN_ROOT/bin/probe-remote-bootstrap.sh" "<WORKTREE_PATH>"`; `preBootstrap` true with `classification` `empty-repo` (the `/commit-push` outcome was `bootstrap_pending`) → MM-3b; otherwise go to MM-5, which accepts an earlier bootstrap push and refuses when `/commit-push` never opened the PR.
   `CLOSED` or `UNKNOWN` → surface the state and stop.

MM-3b. **Bootstrap push (empty remote):** run `bash "$AGENTS_MAIN_ROOT/skills/merge-to-main/scripts/bootstrap-complete.sh" "<WORKTREE_PATH>" "<BRANCH>" "<OWNER_REPO>" "<session-id>"` as one standalone call.
   Exit 0 → read `bootstrap_commit_sha`, `default_branch_set`, and `pushed_ref` from its JSON; warn when `default_branch_set` is false; go to MM-5.
   Exit 2 → the remote is no longer empty; surface stderr, re-run `/commit-push`, and stop.
   Exit 4 → user_verification is not complete; stop and run `/get-release-approval` (never emit USER_VERIFIED here).
   Exit 1 or 3 → surface stderr and stop.

## Direct delivery

MM-4. **Commit and push (direct):** follow `skills/_shared/commit-push-dispatch.md` with handoff step `merge_to_main`.
   `pushed` or `up_to_date` → MM-5.
   Any other outcome → stop per that file's outcome branch.

## Completion

MM-5. **Complete the step:** run `node "$AGENTS_MAIN_ROOT/bin/workflow/next-step" --advance --step merge_to_main --complete --next` and follow its `ACTION`.
   A refusal (`no-release-evidence`) means the delivery is not observable yet — surface it and stop; never re-declare.

## Rules

- Never emit `<<WORKFLOW_USER_VERIFIED>>` here — `/get-release-approval` owns it.
- Issue each merge command as a bare Bash call so the merge gate sees it.
- Never force-push and never use `--admin` to bypass required checks.
- On fallback or step degradation: `node "$AGENTS_MAIN_ROOT/bin/supervisor-report" --categories workflow --severity warning --detail "<describe fallback>" --reporter merge-to-main`.

Files in this skill

  • SKILL.md3.9 KB
  • scripts/bootstrap-complete.sh5.9 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in tools →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.