Publish oh-my-opencode to npm by triggering the GitHub Actions publish workflow and verifying its artifacts. Ship-only: never runs pre-publish-review or re-reviews merged code unless the user explicitly asks. Argument: <patch|minor|major|explicit-semver>. Triggers: publish, release, deploy, npm publish.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Publish?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/code-yeongyu-publish)
---
name: publish
description: "Publish oh-my-opencode to npm by triggering the GitHub Actions publish workflow and verifying its artifacts. Ship-only: never runs pre-publish-review or re-reviews merged code unless the user explicitly asks. Argument: <patch|minor|major|explicit-semver>. Triggers: publish, release, deploy, npm publish."
---
You are the release manager for oh-my-opencode. Execute the FULL publish workflow from start to finish.
## CRITICAL: PUBLISH IS SHIP-ONLY — GO STRAIGHT TO THE WORKFLOW
`origin/dev` is already gated: every PR and push ran CI (test/typecheck/codex-compatibility on 3 OSes). The publish workflow does not re-run tests or typecheck: its `gate-reuse` job reuses the green push CI run of the pinned source (or of the exact prepared stamp) and fails closed when that CI failed, was cancelled, or cannot be read.
- **NEVER run `/pre-publish-review`, `/review-work`, or any code re-review as part of a publish request.** Those run ONLY when the user explicitly asks for a review.
- **NEVER "fix" code, open PRs, or enter fix-and-re-audit loops during a publish.** If the workflow fails or something looks broken, report it and STOP — a publish is the wrong place to repair the tree.
- **NEVER push to `dev` to "sync" before a publish.** The dispatch builds the remote `dev` commit it pins; local commits and uncommitted changes play no part, and a local push to `dev` would bypass PR review.
- A publish request with a release selector goes from Step 0 to Step 2 (dispatch) in minutes. Everything the workflow verifies itself (registry reads, platform packages, LazyCodex sync, the stable Discord post) is read back from its job results, not re-checked by hand. The only human-scale work is the release summary, drafted while the runs are in flight.
## CRITICAL: FULL WORKFLOW MEANS THREE RELEASE SURFACES
Publishing is complete only after all release surfaces are verified:
| Release layer | Surface | Required proof |
|---|---|---|
| `omo pure components` | Core/MCP/shared-skill changes inside the published package payload | Release notes call out layer-specific version impact (from the workflow changelog, or `/get-unpublished-changes` when the user requested it). |
| `omo opencode` | `oh-my-opencode` and `oh-my-openagent` npm packages plus platform packages | `release`, `post-publish-verify` and `registry-wait` succeeded in the child publish run. |
| `omo codex` | `lazycodex-ai`, Codex plugin metadata, and `code-yeongyu/lazycodex` marketplace release | `release` (LazyCodex marketplace sync and release) and `post-publish-verify` (LazyCodex smoke) succeeded in the child publish run. |
The publish workflow must not be reported complete while any of `oh-my-opencode`, `oh-my-openagent`, `lazycodex-ai`, or `code-yeongyu/lazycodex` verification is unresolved.
## CRITICAL: FULL WORKFLOW MEANS DISCORD TOO
Publishing is not complete until the Discord release announcement is accounted for (Step 7).
- A stable release is announced by the workflow's `release-announce` job. Read its result; do not post by hand.
- A prerelease (dist-tagged version such as `5.0.0-beta.9`) is never announced by the workflow, so you post it by hand.
- **DO NOT stop after creating the GitHub release or after applying release notes.**
- **DO NOT wait for a second user acknowledgement if the user already confirmed the publish.**
## CRITICAL: NO EARLY TURN-END AFTER TRIGGER (COMPLETION CONTRACT)
Once `gh workflow run publish` succeeds, the publish is NOT done. A prior session forgot this: it triggered the workflow and ended its turn, leaving the release unverified, the enhanced summary unwritten, and the Discord announcement unsent. That mistake is why this section exists.
After Step 2 (dispatch), you MUST drive both runs to a terminal conclusion AND complete every post-trigger step before ending your turn. You may NOT end the turn, hand off, or stop for the day while ANY of these is unresolved:
1. **Run conclusions** — Step 3: the dispatched (parent) run and the child publish run it dispatches both conclude `success`.
2. **Job results** — Step 4: `release`, `post-publish-verify` and `registry-wait` in the child run are `success`.
3. **Enhanced summary applied** — Step 5 + Step 6: draft (mandatory for patch/minor/major) AND `gh release edit --notes-file` applied. "Patch is optional" is wrong; patch summaries are MANDATORY.
4. **Discord accounted for** — Step 7: `release-announce` is `success` (stable), or the manual post was attempted and either a message id is recorded OR a clear failure is reported (prerelease).
Only after all four are green may you end the turn. If a run fails, run `gh run view <id> --log-failed`, report it, and STOP (do not repair the tree mid-publish). If a post-trigger step fails for an external reason (registry propagation, Discord auth), report it clearly and continue the remaining steps — do not let one failure abort the rest.
This contract applies to the slash-command copies (`.agents/command/publish.md`, `.opencode/command/publish.md`) too; their bodies are kept byte-identical to this skill per the `.agents/AGENTS.md` drift rule.
## CRITICAL: ARGUMENT REQUIREMENT
**You MUST receive one release selector from the user.** Valid options:
- `patch`: Bug fixes, backward-compatible (1.1.7 → 1.1.8)
- `minor`: New features, backward-compatible (1.1.7 → 1.2.0)
- `major`: Breaking changes (1.1.7 → 2.0.0)
- An explicit valid semantic version, including a prerelease such as `5.0.0-beta.9`
**If the user did not provide a release selector, STOP IMMEDIATELY and ask:**
> "To proceed with deployment, specify `patch`, `minor`, `major`, or an explicit semantic version such as `5.0.0-beta.9`."
Reject any other value. Do not infer or repair malformed versions.
---
## STEP 0: REGISTER TODO LIST (MANDATORY FIRST ACTION)
**Before doing ANYTHING else**, create a detailed todo list using TodoWrite:
```
[
{ "id": "confirm-release-input", "content": "Confirm release selector with user (patch/minor/major or explicit semver)", "status": "in_progress", "priority": "high" },
{ "id": "run-workflow", "content": "Dispatch the publish workflow pinned to the remote dev head", "status": "pending", "priority": "high" },
{ "id": "wait-workflow", "content": "Watch the parent run, resolve the child publish run, watch it to the end", "status": "pending", "priority": "high" },
{ "id": "read-job-results", "content": "Read release, post-publish-verify and registry-wait results of the child run", "status": "pending", "priority": "high" },
{ "id": "draft-summary", "content": "Draft enhanced release summary (mandatory for all release types)", "status": "pending", "priority": "high" },
{ "id": "apply-summary", "content": "Prepend enhanced summary to release", "status": "pending", "priority": "high" },
{ "id": "discord-announce", "content": "MANDATORY: check release-announce (stable) or post to Discord by hand (prerelease)", "status": "pending", "priority": "high" },
{ "id": "final-confirmation", "content": "Final confirmation to user with links", "status": "pending", "priority": "low" }
]
```
**Mark each todo as `in_progress` when starting, `completed` when done. ONE AT A TIME.**
---
## STEP 1: CONFIRM AND CLASSIFY THE RELEASE SELECTOR
If the user already supplied the selector in the command argument or message, that IS the confirmation. Parse it exactly once:
```bash
RELEASE_INPUT="${ARGUMENTS}"
if [[ "$RELEASE_INPUT" =~ ^(patch|minor|major)$ ]]; then
RELEASE_KIND=bump
elif [[ "$RELEASE_INPUT" =~ ^([0-9]+\.){2}[0-9]+(-[0-9A-Za-z]+(\.[0-9A-Za-z]+)*)?$ ]]; then
RELEASE_KIND=version
else
echo "Invalid release selector: $RELEASE_INPUT" >&2
exit 1
fi
```
Only ask and wait when no selector was provided.
Release notes are written BEFORE the release: the user-facing notes are `changes/unreleased/<pr-number>.md` fragments (one per PR) that must already be on `dev`. Release-state preparation stamps them into `## [<version>] - <UTC date>` in `CHANGELOG.md`, and the workflow's `verify-release-notes` job fails the release before any build when that section is absent, empty, or duplicated. If `changes/unreleased/` on `dev` holds no fragments, STOP and say so — the release cannot proceed.
---
## STEP 2: TRIGGER GITHUB ACTIONS WORKFLOW
Dispatch from `dev`, pass bump selectors through `bump`, and pass exact versions through `version`. The required `bump` input remains `patch` for explicit-version dispatches but is ignored by the workflow because `version` takes precedence.
Always pin the source with `source_sha` set to the current remote `dev` head. A pinned release stamps exactly that commit and tolerates `dev` moving while the cut runs; an unpinned one stamps whatever `dev` is when preparation starts, and its recovery can reuse a merged stamp only while `dev`'s tree still equals it, so a merge landing mid-cut can strand the stamp and burn the version.
```bash
SOURCE_SHA="$(git ls-remote origin refs/heads/dev | cut -f1)"
if ! [[ "$SOURCE_SHA" =~ ^[0-9a-f]{40}$ ]]; then
echo "Could not read the remote dev head: $SOURCE_SHA" >&2
exit 1
fi
if [ "$RELEASE_KIND" = bump ]; then
RUN_URL="$(gh workflow run publish.yml --ref dev -f "bump=${RELEASE_INPUT}" -f "source_sha=${SOURCE_SHA}")"
else
RUN_URL="$(gh workflow run publish.yml --ref dev -f bump=patch -f "version=${RELEASE_INPUT}" -f "source_sha=${SOURCE_SHA}")"
fi
if ! [[ "$RUN_URL" =~ ^https://github.com/code-yeongyu/oh-my-openagent/actions/runs/[0-9]+$ ]]; then
echo "Publish dispatch did not return an exact workflow run URL: $RUN_URL" >&2
exit 1
fi
RUN_ID="${RUN_URL##*/}"
if ! [[ "$RUN_ID" =~ ^[0-9]+$ ]]; then
echo "Publish dispatch returned an invalid run ID: $RUN_ID" >&2
exit 1
fi
gh run view "${RUN_ID}" --json databaseId,status,url --jq '{databaseId,status,url}'
```
The returned run ID owns this release attempt. Never replace it with a latest-run lookup.
---
## STEP 3: WATCH THE PARENT RUN, THEN THE CHILD PUBLISH RUN
A release is two runs of `publish.yml`. The dispatched (parent) run prepares and tags the release state, then dispatches a child run from the tag `v<version>` so npm provenance matches the built source. Everything that publishes, verifies, or announces runs in the child.
| Run | Stage (job) | What it does |
|---|---|---|
| parent | `pin-ci` → `gate-reuse` | Runs push CI for the pinned source on its own ref and reuses that green run; no tests run in publish itself |
| parent | `release-metadata` → `prepare-release-state` | Resolves the version, stamps it, opens + auto-merges the `release: vX.Y.Z` PR (typically the longest parent stage) |
| parent | `verify-exact-pinned-stamp` → `dispatch-provenance-safe-publish` | Proves the stamp sits on the pin, tags `v<version>`, dispatches the child |
| child | `tag-prepared-source` → `verify-release-notes` → `publish-platform` | Checks the tag and the CHANGELOG section, builds and publishes both platform package families |
| child | `publish-main` / `publish-wrapper` → `release` | Publishes the npm packages, creates the GitHub release, syncs `code-yeongyu/lazycodex` |
| child | `post-publish-verify` / `registry-wait` / `installer-mirror*` → `release-announce` | Reads every package back from npm (up to 90 min when npm is slow), moves the installer channel, announces stable releases |
Watch the parent to its end (no hand-rolled polling loop), then resolve the child by its source pin and watch it too:
```bash
gh run watch "${RUN_ID}" --exit-status || { gh run view "${RUN_ID}" --log-failed; exit 1; }
# The child runs on tag v<version>; its commit is the stamp whose first parent is SOURCE_SHA.
PARENT_CREATED="$(gh run view "${RUN_ID}" --json createdAt --jq '.createdAt')"
git fetch -q --tags origin
CHILD_RUN_ID="" NEW_VERSION=""
while read -r ID TAG SHA; do
if [ "$(git rev-parse "${SHA}^1")" = "${SOURCE_SHA}" ]; then
if [ -n "$CHILD_RUN_ID" ]; then
echo "More than one child publish run stamps ${SOURCE_SHA}; report both and stop." >&2
exit 1
fi
CHILD_RUN_ID="$ID" NEW_VERSION="${TAG#v}"
fi
done < <(gh run list --workflow=publish.yml --event=workflow_dispatch --created ">=${PARENT_CREATED}" \
--json databaseId,headBranch,headSha \
--jq '.[] | select(.headBranch | test("^v[0-9]")) | "\(.databaseId) \(.headBranch) \(.headSha)"')
if [ -z "$CHILD_RUN_ID" ] || { [ "$RELEASE_KIND" = version ] && [ "$NEW_VERSION" != "$RELEASE_INPUT" ]; }; then
echo "No child publish run for ${SOURCE_SHA} (version '${NEW_VERSION}'); report and stop." >&2
exit 1
fi
gh run watch "${CHILD_RUN_ID}" --exit-status || gh run view "${CHILD_RUN_ID}" --log-failed
```
Run the child watch in a background session and draft the enhanced release summary (Step 5) meanwhile — do not sit idle, and do not start any review activity. If the parent fails, show its failed log and stop. If the child fails, still read Step 4's job results: they tell whether the release exists and which surface is missing.
---
## STEP 4: READ THE CHILD RUN'S VERIFICATION RESULTS
The child run already verified every published surface. Read the results instead of re-checking npm, platform packages, or the GitHub release by hand:
```bash
gh run view "${CHILD_RUN_ID}" --json jobs \
--jq '.jobs[] | select(.name | test("^(release|post-publish-verify|registry-wait)$")) | {name, conclusion}'
```
- `release` — the GitHub release `v${NEW_VERSION}` exists with its assets, and the LazyCodex marketplace sync and release ran.
- `post-publish-verify` — omo-ai readiness and dist-tags, the published-package probes, and the LazyCodex smoke passed.
- `registry-wait` — every main and platform package of this release is served by npm at its exact version.
All three must be `success`. A red `post-publish-verify` or `registry-wait` after a green `release` means the packages are published and the release exists: report the failing job and its `--log-failed` output; do not re-run publishes yourself.
---
## STEP 5: DRAFT ENHANCED RELEASE SUMMARY
<decision-gate>
| Release Type | Action |
|-------------|--------|
| **patch** | MANDATORY. Draft a concise bug-fix / change summary. Do NOT proceed without one. |
| **minor** | MANDATORY. Draft a concise feature summary. Do NOT proceed without one. |
| **major** | MANDATORY. Draft a full release narrative with migration notes if applicable. Do NOT proceed without one. |
</decision-gate>
### LAST RELEASE BEFORE THE OMO NATIVE CLI PUBLIC RELEASE
When the user identifies this as the final release before the OmO Native CLI public release, the GitHub summary MUST begin with this dedicated heading and any Discord announcement you post by hand MUST repeat it as a dedicated heading immediately after `@here`:
`## LAST RELEASE BEFORE THE OMO NATIVE CLI PUBLIC RELEASE`
### What You're Writing (and What You're NOT)
You are writing the **headline layer** — a product announcement that sits ABOVE the auto-generated commit log. Think "release blog post", not "git log".
<rules>
- NEVER duplicate commit messages. The auto-generated section already lists every commit.
- NEVER write generic filler like "Various bug fixes and improvements" or "Several enhancements".
- ALWAYS focus on USER IMPACT: what can users DO now that they couldn't before?
- ALWAYS group by THEME or CAPABILITY, not by commit type (feat/fix/refactor).
- ALWAYS use concrete language: "You can now do X" not "Added X feature".
- NEVER include internal adapter changes matching `senpi`, `omo-senpi`, `senpi-task`, `pi-goal`, or `pi-webfetch` in either release-note variant.
</rules>
<examples>
<bad title="Commit regurgitation — DO NOT do this">
## What's New
- feat(auth): add JWT refresh token rotation
- fix(auth): handle expired token edge case
- refactor(auth): extract middleware
</bad>
<good title="User-impact narrative — DO this">
## 🔐 Smarter Authentication
Token refresh is now automatic and seamless. Sessions no longer expire mid-task — the system silently rotates credentials in the background. If you've been frustrated by random logouts, this release fixes that.
</good>
<bad title="Vague filler — DO NOT do this">
## Improvements
- Various performance improvements
- Bug fixes and stability enhancements
</bad>
<good title="Specific and measurable — DO this">
## ⚡ 3x Faster Rule Parsing
Rules are now cached by file modification time. If your project has 50+ rule files, you'll notice startup is noticeably faster — we measured a 3x improvement in our test suite.
</good>
</examples>
### Drafting Process
1. **Analyze** the `changes/unreleased/` fragments at `${SOURCE_SHA}` (`git show "${SOURCE_SHA}:changes/unreleased/"` lists them) while the runs are in flight; they are exactly what the release body will hold. Once `release` succeeds, reconcile with `gh release view "v${NEW_VERSION}" --json body`. Identify 2-5 themes that matter to users.
2. **Write** the summary to `/tmp/release-summary-v${NEW_VERSION}.md`.
3. **Present** the draft to the user for review and approval before applying.
```bash
# Write your draft here
cat > /tmp/release-summary-v${NEW_VERSION}.md << 'SUMMARY_EOF'
{your_enhanced_summary}
SUMMARY_EOF
cat /tmp/release-summary-v${NEW_VERSION}.md
```
<agent-instruction>
Present the draft to the user:
> "Here's the release summary I drafted. This will appear AT THE TOP of the release notes, above the auto-generated commit changelog and contributor thanks."
**APPROVAL GATE (single, binary):** The user's initial publish request with a release selector IS the only approval this workflow requires. Present the draft, then IMMEDIATELY proceed to Step 6 (apply) and Step 7 (Discord). Do NOT stop to wait for approval unless the user explicitly requested a release-note review hold before the publish started. Step 7 is mandatory and must not be blocked by a review hold that was never requested.
</agent-instruction>
---
## STEP 6: APPLY ENHANCED SUMMARY TO RELEASE
This step is MANDATORY. The enhanced summary from Step 5 must always be applied, once the child run's `release` job has succeeded.
<architecture>
The final release note structure:
```
┌─────────────────────────────────────┐
│ Enhanced Summary (from Step 5) │ ← You wrote this
│ - Theme-based, user-impact focused │
├─────────────────────────────────────┤
│ --- (separator) │
├─────────────────────────────────────┤
│ Auto-generated Commit Changelog │ ← Workflow wrote this
│ - feat/fix/refactor grouped │
│ - Contributor thank-you messages │
└─────────────────────────────────────┘
```
</architecture>
<zero-content-loss-policy>
- Fetch the existing release body FIRST
- PREPEND your summary above it
- The existing auto-generated content must remain 100% INTACT
- NOT A SINGLE CHARACTER of existing content may be removed or modified
</zero-content-loss-policy>
```bash
# 1. Fetch existing auto-generated body
EXISTING_BODY=$(gh release view "v${NEW_VERSION}" --json body --jq '.body')
# 2. Combine: enhanced summary on top, auto-generated below
{
cat /tmp/release-summary-v${NEW_VERSION}.md
echo ""
echo "---"
echo ""
echo "$EXISTING_BODY"
} > /tmp/final-release-v${NEW_VERSION}.md
# 3. Update the release (additive only)
gh release edit "v${NEW_VERSION}" --notes-file /tmp/final-release-v${NEW_VERSION}.md
# 4. Confirm
echo "✅ Release v${NEW_VERSION} updated with enhanced summary."
gh release view "v${NEW_VERSION}" --json url --jq '.url'
```
---
## STEP 7: DISCORD ANNOUNCEMENT
**Stable release (`NEW_VERSION` has no `-`):** the child run's `release-announce` job posts it. It runs only for a stable version (empty dist tag) and only after `release`, `post-publish-verify`, `registry-wait` and the installer mirror succeeded. Read its result:
```bash
gh run view "${CHILD_RUN_ID}" --json jobs \
--jq '.jobs[] | select(.name | startswith("release-announce")) | {name, conclusion}'
```
`success` is the proof; do not post by hand as well. If it was skipped or failed, `release-announce-recovery` names the recovery command (`gh workflow run release-announce.yml -f tag=v${NEW_VERSION} -f dry_run=false`): report it to the user and run it only after confirming no post exists.
**Prerelease (dist-tagged, `NEW_VERSION` contains `-`):** the workflow never announces it. Post by hand:
<hard-gate>
A prerelease is not complete until this step has either:
1. Sent a Discord message successfully and recorded the message ID, or
2. Failed after `agent-discordbot auth status` plus one send retry, with the release bot-token failure reported to the user.
Never skip this step because the release summary was awaiting approval. If the user already confirmed the publish, continue through Discord before stopping.
</hard-gate>
<agent-discord-instruction>
1. Use the release bot token through `agent-discordbot` for release announcements. This is the required release path; do not use the personal `agent-discord` token unless the bot path is unavailable and the user explicitly approves the fallback. Pin the bot id so release messages go out as the release bot even if the local `agent-discordbot` current bot changes.
```bash
RELEASE_BOT_ID=1486173823354146917
agent-discordbot auth status --bot "$RELEASE_BOT_ID"
```
2. **Read recent messages** in the channel to match the existing announcement style:
```bash
RELEASE_BOT_ID=1486173823354146917
agent-discordbot message list 1454708427392680067 --bot "$RELEASE_BOT_ID" --limit 5
```
3. If `agent-discordbot` is unavailable or unauthorized, stop and report that the release bot token path failed. Only then may a human decide whether to use `agent-discord`.
4. Post the release announcement to channel `1454708427392680067` matching the style of previous announcements. The message should follow this structure:
```
@here
🎉 **oh-my-opencode v{VERSION} — {Short Tagline}**
**Feature 1** — one-line description.
**Feature 2** — one-line description.
**Feature 3** — one-line description.
Plus {summary of remaining changes}.
📦 Install / upgrade:
`bun i -g oh-my-opencode@{VERSION}` (or `npm`)
📝 Full release notes: {RELEASE_URL}
```
```bash
RELEASE_BOT_ID=1486173823354146917
RELEASE_URL=$(gh release view "v${NEW_VERSION}" --json url --jq '.url')
agent-discordbot message send 1454708427392680067 "{your message following the style above}" --bot "$RELEASE_BOT_ID"
```
If the message fails to send, warn the user and continue — do NOT block the publish workflow on Discord errors.
</agent-discord-instruction>
---
## STEP 8: FINAL CONFIRMATION
Report success to user with:
- New version number
- Parent and child run URLs
- GitHub release URL: https://github.com/code-yeongyu/oh-my-opencode/releases/tag/v{version}
- npm package URL: https://www.npmjs.com/package/oh-my-opencode
- Conclusions of `release`, `post-publish-verify`, `registry-wait` and `release-announce` (or the manual Discord message id for a prerelease)
---
## ERROR HANDLING
- **Parent run fails**: Show `gh run view "${RUN_ID}" --log-failed` and stop. The `prepare-release-state` error names the recovery: with a pin, re-dispatch with the same `version` and `source_sha` to reuse a stamp already merged into `dev`; otherwise publish an unused version.
- **Child run fails**: Show its failed logs and name the failing job. `publish-main` is blocked by design until the `publish-platform` targets pass; a failure after `release` leaves the published packages and the release in place.
- **`registry-wait` / `post-publish-verify` red**: registry propagation, not a failed publish — report it; never re-publish.
- **No child run found**: the parent did not reach `dispatch-provenance-safe-publish`; read that job's log.
- **Permission denied**: User may need to re-authenticate with `gh auth login`
## LANGUAGE
Respond to user in English.