ship

GitHub

自动化代码发布流程,涵盖Git状态检查、分支同步清理、提交信息生成及PR创建。支持UI代码清理和数据库迁移安全审查,确保提交纯净并符合规范。

.agents/skills/ship/SKILL.md simstudioai/sim

Trigger Scenarios

用户执行 /ship 命令 需要提交代码并发布到 staging 环境

Install

npx skills add simstudioai/sim --skill ship -g -y
More Options

Non-standard path

npx skills add https://github.com/simstudioai/sim/tree/main/.agents/skills/ship -g -y

Use without installing

npx skills use simstudioai/sim@ship

指定 Agent (Claude Code)

npx skills add simstudioai/sim --skill ship -a claude-code -g -y

安装 repo 全部 skill

npx skills add simstudioai/sim --all -g -y

预览 repo 内 skill

npx skills add simstudioai/sim --list

SKILL.md

Frontmatter
{
    "name": "ship",
    "description": "Commit, push, and open a PR to staging in one shot — runs the cleanup pass and, when migrations changed, the db-migrate safety review first",
    "argument-hint": "[optional context or scope notes]"
}

Ship Command

You help ship code by creating commits, pushing to the remote branch, and creating PRs in the user's voice.

Your Task

When the user runs /ship:

  1. Check git status - See what files have changed
  2. Sync check: git fetch origin staging && git log --oneline origin/staging..HEAD. The list must contain ONLY commits you can attribute to this session (recognizable subjects/SHAs) — a worktree/branch cut from a stale local staging silently drags in unrelated commits.
    • If it shows commits you don't recognize, fix it now, before staging/committing any new work (step 7 hasn't run yet):
      • If the working tree has uncommitted changes, stash them first — git stash push -u -m ship-sync-fix — so the rebase below isn't blocked by dirty state. Restore with git stash pop once the branch is fixed.
      • Try git rebase origin/staging first.
      • A rebase finishing without conflicts does NOT by itself mean the branch is clean — it can replay stray commits onto the new base with no conflict at all. After the rebase (clean or not), re-run git log --oneline origin/staging..HEAD and re-check the commit list against what you recognize.
      • If the rebase conflicted on unrecognized commits, OR finished cleanly but the log still shows them, abandon it (git rebase --abort if mid-rebase) and rebuild, in this exact order:
        1. Still on <original-branch>, list git log --oneline --reverse origin/staging..<original-branch> and write down ONLY the SHA(s) that are this session's work — the range also contains the stray commits, so cherry-picking the whole range recreates the polluted branch. Capture them now; after step 4 they are no longer in HEAD.
        2. git checkout <original-branch> (required if an interrupted attempt left you on ship-sync-tmp)
        3. git branch -D ship-sync-tmp 2>/dev/null || true
        4. git checkout -b ship-sync-tmp origin/staging
        5. git cherry-pick the captured SHAs, oldest-first. Resolve conflicts.
        6. git branch -f <original-branch> HEAD && git checkout <original-branch> && git branch -D ship-sync-tmp
    • Re-verify with git log --oneline origin/staging..HEAD — it must list only commits you recognize before you proceed to committing new work.
  3. Generate a commit message following this format: type(scope): description
  • Types: fix, feat, improvement, chore
  • Scope: short identifier (e.g., undo-redo, api, ui)
  • Keep it concise
  1. Run the cleanup pass — only if the diff modifies UI code (any .tsx file, or anything under apps/sim/components/, apps/sim/hooks/, or apps/sim/stores/): /cleanup
  • /cleanup fans out the React/UI passes (effects, memo, callbacks, state, React Query, emcn, url-state) plus the comment pass; skip it when no UI was touched. When it runs, it applies fixes so they land in this commit.
  1. Run migration safety — only if the diff touches packages/db/migrations/** or packages/db/schema.ts:
  • Run /db-migrate to review the migration for zero-downtime safety (expand/contract phasing, backward-compatibility with the deployed app version).
  • bun run check:migrations origin/staging must pass (staging is the PR base). Do not silence a flagged statement with a -- migration-safe: annotation unless /db-migrate confirmed the old code no longer depends on it; otherwise split the destructive change into a later deploy.
  1. Run pre-ship checks from the repo root before staging. This has two phases: first regenerate every committed artifact so generated files never drift into a CI failure (this is what catches things like agent-stream-docs going stale after a models.ts edit), then run the full audit suite CI's Lint and Test job enforces. Both phases parallelize — but only across commands that write disjoint outputs — and a bare wait swallows child exit codes, so both phases below explicitly collect each job's status and abort ship if any failed.

Phase A — regenerate the always-in-repo committed artifacts (parallel), then let step 7 stage whatever changed. Regenerate only the generators whose inputs live entirely in this repo and that any ordinary code change can drift — agent-stream-docs:generate (derives from the provider model registry), docs-manifest:generate (derives from docs page paths), and skills:sync (derives from .agents/skills/**). They write disjoint outputs (apps/docs/…/agent.mdx, apps/sim/lib/copilot/generated/docs-manifest.ts, and .claude/skills links), so they parallelize safely, and each is idempotent (a no-op when already in sync):

rm -f /tmp/ship-gen-results
for g in agent-stream-docs:generate docs-manifest:generate skills:sync; do
  ( bun run "$g" >"/tmp/ship-gen-${g//:/-}.log" 2>&1; echo "$? $g" >>/tmp/ship-gen-results ) &
done
wait
# any non-zero line is a FAILED generator — read /tmp/ship-gen-<name>.log and fix before shipping;
# a silently-failed generate leaves a stale artifact that Phase B / CI then rejects. Keep the
# `exit 1`: it is what makes the block's own status non-zero so a caller actually stops.
if grep -vE '^0 ' /tmp/ship-gen-results; then echo "❌ generator(s) failed — do not ship"; exit 1; fi
echo "✅ artifacts regenerated"

Then git status --short to see what regenerated — those files must be staged in step 7 alongside your own changes.

Do NOT blanket-run the domain generators here. mship:generate (generate-mship-contracts.ts) is an umbrella that drives all nine mothership contract generators (mship-contracts, billing-protocol-contract, mship-tools, the four trace-*, metrics-contract, vfs-snapshot-contract) and biome-formats apps/sim/lib/copilot/generated/ — never run it and its constituents (they write the same files and corrupt each other in parallel), and never run it on an ordinary ship: it reads an external copilot-contract source that isn't checked out in most worktrees, so it hard-fails with ENOENT and would abort ship for an unrelated reason. generate:pi-model-catalog (under apps/sim) likewise regenerates from the installed Pi package, not repo source. scripts/generate-docs.ts rewrites the integration docs and client-safe catalog; run it when this PR changes their block/icon/landing-content inputs or when integration-catalog:check reports drift, then review its broad generated diff. Only when this PR's diff actually touches a domain generator's input do you regenerate it deliberately and run its matching :check (bun run mship:check / the individual *:check) — with the external source present.

Phase B — run lint + every audit CI enforces, in parallel, and abort ship if any fails. Before running the commands, compare this list with .github/workflows/test-build.yml; when CI adds an audit, run it and update this skill instead of trusting a stale snapshot. The env-flag audit is currently an inline workflow block rather than a package script: when apps/sim/lib/core/config/env-flags.ts changed, run that current workflow block verbatim instead of copying a second version into this skill. Run bun run lint first (it autofixes formatting and mutates files, so don't parallelize it with the read-only audits), then run the base-sensitive block-registry check, then fan the independent audits out and collect exit codes:

# autofix formatting first (mutating; not parallel-safe with the audits). Gate its exit too —
# a non-zero lint (unfixable errors) must abort before the audits run, not be ignored.
bun run lint || { echo "❌ lint failed — do not ship"; exit 1; }
bun run apps/sim/scripts/check-block-registry.ts origin/staging || {
  echo "❌ block registry audit failed — do not ship"
  exit 1
}
# Runs every audit CI runs, concurrently, and replays the output of any that fail.
# The audit list is derived in scripts/run-audits.ts — do not hand-list audits here.
bun run check:audits || { echo "❌ audit(s) failed — do not ship"; exit 1; }
# CI's "Verify docs manifest is in sync" step is not a `check:*` script, so the runner above
# does not cover it. (CI's "Security audit" `bun audit` step is `continue-on-error` — advisory
# only, not a gate — so it is deliberately not run here.)
bun run docs-manifest:check || { echo "❌ docs manifest out of sync — do not ship"; exit 1; }

If Phase A regenerated a file, its matching :check in Phase B now passes trivially — that parity is the point. Do not ship with any generator or audit failing; fix the cause (never silence it) and re-run. check:migrations and type-check are covered by steps 5 and CI respectively and are not repeated here. 7. Stage and commit the changes with the generated message — including any files Phase A regenerated in step 6 8. Push to origin using the current branch name — --force-with-lease if step 2's sync check did any history rewrite (a clean rebase or a cherry-pick rebuild) on a branch that had already been pushed once; a plain push would be rejected in exactly the polluted-remote case step 2 exists to fix 9. Create a PR to staging with a description in the user's voice, then do a final content check — not a count check — comparing what actually landed:

git fetch origin staging && git log --oneline --reverse origin/staging..HEAD
gh pr view <n> --json commits -q '.commits[].messageHeadline'

Re-fetch first — comparing against a stale local origin/staging ref can mask real drift or flag a false mismatch even when the branch and push are correct. --reverse makes the git log oldest-first, matching the PR commit list's order — plain git log is newest-first, and a positional/line-by-line comparison against the PR's oldest-first list can spuriously fail on any multi-commit branch. These two lists must describe the same commits in the same order (same subjects, the last one being the commit from step 7). If they don't match, the branch still has a problem — redo step 2's fix and git push --force-with-lease.

Commit Message Format

Based on the repo's commit history:

fix(scope): description for bug fixes
feat(scope): description for new features
improvement(scope): description for enhancements
chore(scope): description for maintenance

What to Omit

The repo is public. Everything you publish — title, description, commit messages, and every later comment — must stand on its own without the incident that produced it. Never include:

  • Customer, company, or user names; workspace/user/org/KB/connector IDs; email addresses
  • Prod or staging operational data: log lines, DB rows, metrics, timestamps, incident details, canary/alert output
  • Infrastructure specifics: hostnames (incl. tenant subdomains), ARNs, internal URLs, env var values, secret names
  • Verbatim customer content: file names, document titles, sheet/column names, folder paths

Describe the bug by its mechanism, not by how you found it. "Expired OAuth credentials fail to refresh in the worker" — not "the Sheets canary failed at 16:31Z for workspace abc-123". Aggregate counts are fine once detached from the tenant ("1,379 PDFs failed"); the same number attributed to a named customer is not. Replace real examples with placeholders (<real sheet name>) rather than cutting them — the illustration is usually the useful part.

Measurements are not the problem; absolute production scale is. Keep the numbers that justify a change — durations, ratios, before/after timings, test and audit counts. They are the evidence a reviewer needs, and stripping them makes the rationale unfalsifiable. What does not belong is anything that sizes production or a tenant: table and index byte sizes, row/chunk/document totals, dead-tuple counts, buffer and heap-fetch counts, worker or instance counts. "Visiting four times as many tuples took 5.1s and 9.7s on consecutive runs" is fine; "on a 132k-chunk index" or "reclaims ~19 GB" is not. The same rule applies to code comments and migration comments, which are published exactly like a PR body — this is the most commonly missed case, because they do not feel like publishing.

Scrub before publishing, not after — a leak is public the instant it posts, and editing later does not unsend the notification email. This applies to every PR you open, including ones created directly with gh pr create rather than through this skill. Grep the title, body, git log origin/staging..HEAD, AND the diff itself before publishing:

# identities, IDs, infrastructure
grep -niE 'customer-or-company-name|@[a-z0-9.-]+\.(com|io|ai)|[0-9a-f]{8}-[0-9a-f]{4}-|\.sharepoint\.com|arn:aws|https?://[a-z0-9.-]*\.internal'
# absolute production scale — byte sizes, k/M-scale entity counts, 7-figure totals
grep -niE '[0-9][0-9.,]* ?(TB|GB)\b|[0-9]+(\.[0-9]+)?[kKmM][- ](row|chunk|document|vector|tuple|doc)|[0-9]{1,3}(,[0-9]{3}){2,}'

The second pattern deliberately allows ordinary engineering numbers (5.1s, 46 audits, 2,921 tests) and flags only production sizing.

PR Description Format

Use this exact template in the user's voice (concise, bullet points):

## Summary
- bullet point describing what changed
- another bullet point if needed

## Type of Change
- [x] Bug fix (or appropriate type)

## Testing
Tested manually (or describe testing)

## Checklist
- [x] Code follows project style guidelines
- [x] Self-reviewed my changes
- [ ] Tests added/updated and passing
- [x] No new warnings introduced
- [x] I confirm that I have read and agree to the terms outlined in the [Contributor License Agreement (CLA)](./CONTRIBUTING.md#contributor-license-agreement-cla)

PR Creation Command

Use this command structure:

gh pr create --base staging --title "COMMIT_MESSAGE" --body "PR_BODY"

Important Notes

  • Do not ask the user to confirm the commit message or PR description before executing
  • The PR should be created against staging branch
  • Keep descriptions concise and in active voice
  • Match the user's previous PR style: direct, no fluff, bullet points
  • DO NOT add "Co-Authored-By" lines to commits - keep commit messages clean

User's Voice Characteristics (based on previous PRs)

  • Short, direct bullet points
  • No unnecessary explanation
  • "Tested manually" is acceptable for testing section; include lint, boundary validation, and (when migrations changed) check:migrations results when run
  • Checkboxes filled in appropriately
  • No screenshots section unless UI changes

Version History

  • 6dfb467 Current 2026-09-23 06:36

    优化同步检查逻辑,强调对比实际提交内容而非仅计数;新增对 UI 代码修改时自动运行清理步骤(/cleanup)的支持;增加对数据库迁移文件变更的安全审查触发条件。

  • 336ec07 2026-08-29 03:06

    优化同步检查逻辑,增加对未识别提交的清理机制,避免将无关提交带入发布分支;跳过确认提示提升效率。

  • ceda457 2026-08-20 15:29

Same Skill Collection

.agents/skills/add-block-preview/SKILL.md
.agents/skills/add-block/SKILL.md
.agents/skills/add-column-type/SKILL.md
.agents/skills/add-connector/SKILL.md
.agents/skills/add-enrichment/SKILL.md
.agents/skills/add-feature-flag/SKILL.md
.agents/skills/add-hosted-key/SKILL.md
.agents/skills/add-integration/SKILL.md
.agents/skills/add-managed-cli/SKILL.md
.agents/skills/add-model/SKILL.md
.agents/skills/add-permission-group-item/SKILL.md
.agents/skills/add-selector/SKILL.md
.agents/skills/add-tools/SKILL.md
.agents/skills/add-trigger/SKILL.md
.agents/skills/babysit/SKILL.md
.agents/skills/cleanup/SKILL.md
.agents/skills/council/SKILL.md
.agents/skills/db-migrate/SKILL.md
.agents/skills/design-taste-frontend/SKILL.md
.agents/skills/emcn-design-review/SKILL.md
.agents/skills/emil-design-eng/SKILL.md
.agents/skills/make-interfaces-feel-better/SKILL.md
.agents/skills/memory-load-check/SKILL.md
.agents/skills/react-query-best-practices/SKILL.md
.agents/skills/tool-registry-boundary/SKILL.md
.agents/skills/v2-api-conventions/SKILL.md
.agents/skills/validate-connector/SKILL.md
.agents/skills/validate-integration/SKILL.md
.agents/skills/validate-model/SKILL.md
.agents/skills/validate-permission-group-item/SKILL.md
.agents/skills/validate-selector/SKILL.md
.agents/skills/validate-trigger/SKILL.md
.agents/skills/you-might-not-need-a-callback/SKILL.md
.agents/skills/you-might-not-need-a-comment/SKILL.md
.agents/skills/you-might-not-need-a-memo/SKILL.md
.agents/skills/you-might-not-need-an-effect/SKILL.md
.agents/skills/you-might-not-need-state/SKILL.md
.agents/skills/you-might-not-need-url-state/SKILL.md
.claude/skills/add-settings-page/SKILL.md
helm/sim/.claude/skills/sim-helm/SKILL.md
.agents/skills/migrate-application-operation/SKILL.md

Metadata

Files
0
Version
6dfb467
Hash
d5beaa04
Indexed
2026-08-20 15:29

trang chủ - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-09-23 08:57
浙ICP备14020137号-1