Release

From shopsys/shopsys · View interactive version

Release is an AI agent skill from the GitHub repository shopsys/shopsys. Drives `php bin/console monorepo:release` end-to-end. Runs pre-flight checks, starts the releaser, watches for confirm prompts, auto-presses Enter on prompts that are safe (waitFor already verified readiness, or ceremonial), and surfaces judgement calls to the operator via AskUserQuestion. Use when

How to use this skill

Skill file

Release Skill

Orchestrates a single stage of the Shopsys release process. The releaser CLI keeps doing the work; this skill drives it and decides what to do at each confirm prompt.

Invocation

/release <version> --stage <stage> --initial-branch <branch> [--resume-step N] [--dry-run]

Reject any other stage with a clear message. The skill does only one stage per invocation.

Phase 1 — Pre-flight (fail fast, do not auto-fix)

Run all of these; abort with the specific fix instruction if any fail. Never start/stop containers, never modify Docker state.

  1. git status --porcelain empty AND git rev-parse --abbrev-ref HEAD equals <initial-branch> (release-candidate stage) or the rc branch (release / after-release stages — the branch name is rc-<webalized-version>; if unsure, surface it to the operator).
  2. Container git status matches host's: docker compose exec -T php-fpm git status --porcelain is empty too. Host and container can diverge when mutagen ignore patterns affect tracked files, or when files are globally-gitignored on the host but not in the repo. If the container reports changes the host doesn't, fix the divergence first — otherwise the releaser's git add . calls inside the container will commit unintended files. For per-clone fixes that don't touch tracked state, append paths to .git/info/exclude (mutagen syncs .git/ so the container sees the same rules).
  3. gh auth token returns a non-empty token (the value is passed to the releaser via the --github-token CLI option, see Phase 2). If gh auth token fails, surface and abort.
  4. docker compose ps --status running --format '{{.Service}}' contains php-fpm and postgres.
  5. macOS only: mutagen sync list 2>/dev/null | grep -q Watching.
  6. docker compose exec -T php-fpm test -f /home/www-data/.gitconfig.
  7. gh auth status succeeds.

If anything fails, print the offending check and the exact command the operator should run, then stop.

Phase 2 — Run the releaser

See Releasing a new version of Shopsys Platform for the up-to-date manual release process this skill automates.

The releaser is interactive — it prints prompts of the shape <info>…</info> [<comment>Enter</comment>] and blocks on stdin. The skill drives it through a named pipe so it can both stream output and inject Enter.

PIPE="/tmp/release-stdin-$$"
LOG="/tmp/release-out-$$"
mkfifo "$PIPE"
# keep the pipe open for writing so the releaser doesn't see EOF
( while sleep 86400; do :; done ) > "$PIPE" &
KEEPALIVE=$!
docker compose exec -T php-fpm \
    php bin/console monorepo:release <version> \
        --stage <stage> --initial-branch <initial-branch> \
        --github-token "$(gh auth token)" -v \
        [--resume-step N] [--dry-run] \
    < "$PIPE" > "$LOG" 2>&1

Important — do not pipe tail -f "$PIPE" into docker compose exec. On macOS, BSD tail block-buffers stdout when piped, so a single echo "" > "$PIPE" never flushes through to the container and the releaser appears hung at the first prompt. Redirecting docker exec's stdin directly from the FIFO (< "$PIPE") has no buffering layer in between.

Run that with run_in_background: true. Then loop:

  1. Prefer Monitor on the bg bash to stream stdout line-by-line. Fallback: tail -c +$OFFSET "$LOG" between iterations, tracking byte offset.
  2. Echo every new line to the operator as one-line status (helps them watch from the chat).
  3. When you see the prompt line, decide per the table in Phase 3. Press Enter by echo "" > "$PIPE". The prompt line matches either of these (ANSI is stripped under -T, so both forms are possible):
  1. Stop when the log contains Stage "<stage>" for version "<version>" is now finished!, or when the bg process exits.
  2. On exit, run a thorough cleanup. The bg bash exiting doesn't reap its descendants — orphaned tail, sleep 86400, and docker compose exec children get reparented to PID 1 and keep holding the FIFO / docker socket:

```bash

kill $KEEPALIVE 2>/dev/null

kill $RELEASER_PID 2>/dev/null

# Sweep any orphans the bg bash didn't reap

ps -ef | grep -E 'monorepo:release|sleep 86400|tail.*release-stdin' | grep -v grep \

| awk '{print $2}' | xargs -I{} kill -9 {} 2>/dev/null

# If the container's PHP releaser is still alive, kill it inside the container too

docker compose exec -T php-fpm bash -c 'pgrep -f "monorepo:release" | xargs -r kill -TERM' 2>/dev/null

rm -f "$PIPE" "$LOG"

```

If a prompt does not appear in the table, surface it to the operator. Never blindly press Enter on something you don't recognize.

Phase 3 — Prompt handler table

The releaser prints each step as <N>/<TOTAL>) <description> before the worker runs. Use that line + the prompt text together to pick a handler. Categories:

A. Auto-press Enter

Ceremonial or already-verified prompts. Press Enter without asking.

Never auto-press the fallback confirm("Continue when \"…\" is satisfied") printed by waitFor() after MAX_WAIT_SECONDS — that one means polling gave up. Surface it.

B. Side-task then surface (skill does the safe automatable work; operator confirms)

Run the listed work, report results, ask the operator to confirm before Enter is sent. Never post, never commit, never push.

C. Surface only (judgement call, no useful side-task)

Call AskUserQuestion with options Done — press Enter / Pause — exit and resume later. On Pause, kill the bg process cleanly and tell the operator to re-run with --resume-step <N>.

Polling status lines

waitFor() prints attempt N: <progressDescription>; sleeping Ms. Echo each to the operator as one short line; do not treat them as prompts.

Phase 4 — Side-task helpers

These are the safe checks the skill runs locally while the releaser is between prompts or during a long waitFor():

```sh

printf '\n.playwright-mcp/\n/.claude/settings.json\n' >> .git/info/exclude

```

Mutagen sync reload (_macOS only_; when you've edited mutagen.yml/mutagen.yml.dist and need ignore patterns to re-evaluate):

mutagen project terminate && mutagen project start

This reloads config without touching containers. Do NOT run the project's mutagen-up.sh — it also performs docker compose up --force-recreate, which kills any paused bg releaser.

Report results inline so the operator can decide.

Constraints

UPGRADE sanity-check agent

Invoked from category B when UpdateUpgradeReleaseWorker finishes its commit and the releaser prints its three confirm() prompts. Goal: decide if it's safe to auto-press Enter on all three, or if the operator needs to fix something first.

Spawn a single Agent (subagent_type general-purpose) with this prompt, then act on its JSON output.

You're checking the staged changes to UPGRADE-<initial-branch>.md for guideline violations before the release script proceeds. Important: UpdateUpgradeReleaseWorker runs phing upgrade-merge + version replacement + git add ., but commits AFTER all three confirm() prompts. At the moment this agent runs, the changes are staged, not yet committed — inspect via git diff --cached -- UPGRADE-<initial-branch>.md (NOT git show HEAD). Re-read docs/contributing/guidelines-for-writing-upgrade.md first — it's the source of truth. Then examine the staged diff and check:

1. PR-link integrity — every #<number> link to github.com/shopsys/shopsys/pull/<n> points to a real merged PR. Use gh pr view <n> --json state,mergedAt per link. Closed-without-merge or non-existent → error.

2. Section ordering — sections in the new block follow the canonical order from the guidelines. Misordered → error.

3. Duplicate docker instructions — flag any two subsections with near-identical "modify your docker-compose.yml" blocks.

4. #project-base-diff placeholders — grep -n '#project-base-diff' UPGRADE-<initial-branch>.md; remaining occurrences at the time of the first confirm are expected (the worker replaces them between confirms 1 and 2) — treat as a warning so the operator knows what's still pending, not an error. If they're still present at the time of confirm 3, then escalate to error.

5. Branch correctness in links — every URL to github.com/shopsys/project-base/... references <initial-branch> (or the right tag/commit), not master. Wrong-branch → warning.

Return a single JSON object: {"clean": true|false, "issues": [{"severity": "error"|"warning", "section": "...", "line": N, "message": "..."}], "summary": "..."}. Nothing else.

After the agent returns:

Slack message draft agent

Invoked from category B for the three Slack workers. Produces a single message body that the operator pastes into Slack. The skill never posts to Slack on the operator's behalf.

Spawn a single Agent (subagent_type general-purpose) with this prompt, substituting <variant> for the worker name:

Draft a single Slack message for #sho_group_ssp about the Shopsys release <version> on initial branch <initial-branch>, release date <YYYY-MM-DD>. Variant: <variant>.

- StopMergingReleaseWorker — announce that PRs targeting <initial-branch> are temporarily frozen for the release cut, and the freeze will be lifted once the release ships.

- EnableMergingReleaseWorker — announce that the freeze on <initial-branch> is lifted and merging is allowed again.

- PostInfoToSlackReleaseWorker — announce the release: include the version, a link to https://github.com/shopsys/shopsys/releases/tag/<version>, a one-line summary of the headline change (use gh pr list --base <initial-branch> --state merged --search 'merged:>=<last-tag-date>' to find it), and a link to UPGRADE-<initial-branch>.md.

Keep it short enough to read at a glance in the channel. Plain text only, no code fences, no preamble, no trailing notes. Output the message body and nothing else.

Print the agent's output verbatim to chat, then use the standard category-B confirm — operator pastes the message to Slack and presses "Done — press Enter".

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.