AGENT SKILL

代码发布上线

ship

将代码发布到生产环境或合并到主分支。

适用职业发布经理
License 许可
Apache-2.0
所属仓库
usurobor/cnos
最近更新
2026-11-07
Stars
★ 9
Forks
0

01 前言 Front Matter

name
ship
scope
task-local
triggers
[ "ship", "deploy", "deliver", "merge", "land" ]
description
Ship code to production or merge to main.
governing_question
How do we ship a change so the merged state is verifiably what we intended to release?

03 SKILL.md 正文

Ship

Ship code to production or merge to main.

Core Rules

Author never self-merges. Reviewer merges, author gets notified.

  • ❌ Author merges their own branch
  • ✅ Reviewer approves → Reviewer merges → Author notified

Spec first, then tests, then code.

  • ❌ Code → test → spec
  • ✅ Spec → test (fails) → code → test (passes)

Feature Flow (Spec-Driven)

1. Write spec — document expected behavior
2. Write tests — verify the spec
3. Run tests — MUST FAIL (nothing implemented)
4. Implement the code
5. Run tests — MUST PASS (implementation matches spec)
6. Run all tests — no regressions
7. Ship

If tests pass in step 3, the tests aren't testing new behavior. Rewrite them.

Bug Fix Flow (TDD)

1. Write test that reproduces the bug
2. Run test — MUST FAIL (proves test catches bug)
3. Fix the code
4. Run test — MUST PASS (proves fix works)
5. Run all tests — no regressions
6. Ship

If test doesn't fail in step 2, the test doesn't catch the bug. Rewrite it.

Example (Feature)

# 1. Update spec
echo "cn send pushes to MY origin, not peer's" >> spec/PROTOCOL.md

# 2. Write failing test
cat > test/send-protocol.t << 'EOF'
  $ cn sync && git -C my-origin branch | grep "recipient/"
  recipient/hello
EOF

# 3. Verify it fails
dune runtest test/send-protocol.t  # MUST FAIL

# 4. Implement
vim src/cn.ml

# 5. Verify it passes  
dune runtest test/send-protocol.t  # MUST PASS

# 6. All tests
dune runtest

# 7. Ship

Example (Bug Fix)

# 1. Write failing test
cat > test/bug-123.t << 'EOF'
  $ cn inbox | grep "detected"
  ⚠ From pi: 1 inbound
EOF

# 2. Verify it fails
dune runtest test/bug-123.t  # MUST FAIL

# 3. Fix
vim src/cn.ml

# 4. Verify it passes
dune runtest test/bug-123.t  # MUST PASS

# 5. All tests + ship
dune runtest && git commit && git push

Versioning & Releases

Tags trigger releases. Only tag minor versions.

Version Type Example Tag? Release Build?
Patch 2.4.4 No No
Minor 2.5.0 Yes Yes
Major 3.0.0 Yes Yes
  • Patch (2.4.x): Version bump in code, no tag, no release. Git users get it via pull.
  • Minor (2.5.0): Tag → triggers release workflow → binary artifacts built.
  • Major (3.0.0): Same as minor, reserved for breaking changes.
# Patch — just bump and push
sed -i 's/2.4.3/2.4.4/' cn_lib.ml
git commit -am "chore: bump version to 2.4.4"
git push

# Minor — bump, tag, push
sed -i 's/2.4.4/2.5.0/' cn_lib.ml
git commit -am "chore: bump version to 2.5.0"
git tag v2.5.0
git push && git push --tags

Pre-Ship Checklist

  • [ ] Tests pass
  • [ ] Branch rebased on main
  • [ ] PR approved (if required)
  • [ ] No unresolved comments
  • [ ] Features verified working — don't assume, test it yourself

Deprecation Checklist

When deprecating infrastructure (cron jobs, skills, commands, protocols):

  • [ ] Replacement is running — verify new system works before disabling old
  • [ ] Atomic switch — disable old and enable new in same change
  • [ ] Monitoring exists — something will alert if replacement fails
  • [ ] Rollback plan — can re-enable old if new breaks

Never disable old until new is verified running.

❌ Non-atomic ✅ Atomic
Disable old cron Verify new cron runs successfully
"Will create replacement later" Create replacement in same PR
Mark DEPRECATED, move on DEPRECATED + replacement + verification

From RCA 2026-02-20-pi-peer-sync-disabled: Pi's peer-sync-check was disabled without replacement. Inbound mail broken for 11 days. No alert.

Rebase-Collision Integrity

Prevent silent loss of upstream content during integration.

Rebase operations can silently drop upstream-only content from main, leading to manual restoration post-hoc. This failure class was confirmed in γ #268, where upstream-only content was silently dropped during a rebase (e.g. COHERENCE-FOR-AGENTS.md).

The Problem

When a branch rebases onto main during integration:

  • Upstream commits may have added new files or content
  • The rebase operation can silently exclude this upstream-only content
  • No existing skill or CI mechanism detects this loss
  • Detection depends on manual post-merge content review

The Solution: Pre-push Hook

Use a pre-push git hook to catch upstream content loss before it reaches the remote.

Hook scope: Fires only when HEAD has been rebased since the last push. Routine fast-forward pushes pass instantly.

Detection method: Compare upstream-added files (--diff-filter=A) and upstream-modified content since merge-base(HEAD, origin/main). Block on:

  • LOST-NEW — upstream-added files missing after rebase
  • LOST-MOD — upstream content removed from modified files

False-positive policy: Any apparent upstream-content loss blocks the push. Author must either:

  • (a) Prove the deletion was intentional (cite commit/issue authorizing removal) and bypass with --allow-content-loss flag
  • (b) Fix the rebase (re-rebase with --strategy=ort -X theirs, or switch to --no-ff merge)

Hook Installation

Use the project installer script for automated setup:

./src/packages/cnos.eng/scripts/install-hooks.sh

This configures git config core.hooksPath src/packages/cnos.eng/hooks/ and verifies hook executability.

Manual installation:

git config core.hooksPath src/packages/cnos.eng/hooks/

Bypass when needed:

ALLOW_CONTENT_LOSS=1 git push

Evidence

From γ #268 close-out analysis and β #268 finding #5 ("Local clone and origin/main were divergent at session start").

Principle

Don't assume features work — test them. Before shipping, verify the feature actually works. Before using a new feature, verify it's implemented. Assumptions cause stale state, silent failures, and RCAs.

Ship

git checkout main
git pull
git merge <branch> --no-ff
git push

Or squash if history is noisy:

git merge <branch> --squash
git commit -m "feat: <description>"
git push

Branch Lifecycle

Only creator deletes.

Step Actor Action
1 Author Creates branch, pushes
2 Reviewer Reviews, merges to main
3 Reviewer Notifies author
4 Author Deletes branch (local and remote)

The reviewer never deletes the author's branch. The author is responsible for cleanup after confirmation.

Post-Ship Checklist

  • [ ] Announce to peers — outbox message: "shipped X to main"
  • [ ] Delete branch — local and remote (author only)
  • [ ] Update daily thread — log what shipped

Announce Template

---
to: <peer>
created: <timestamp>
subject: Shipped <feature>
---

Merged to main: <commit-hash>
Branch deleted: <branch-name>

—<your-name>

Why Announce?

Peers track your work via branches and inbox. If you merge without announcing:

  • Stale branches cause confusion ("59 commits behind")
  • Peers don't know work is done
  • Escalations happen unnecessarily

Ship = merge + announce + cleanup. Not just merge.

04 同仓库更多 Skills

usurobor
usurobor/cnos

Issue 分诊与判定

issues/triage

Issue 分诊规则指引。在对新 issue 进行分类、判定其是否符合派发条件,或决定将其关闭/取代/延后时使用。

软件开发工程师工单与问题跟踪管理
★ 9
usurobor
usurobor/cnos

Issue 标签分类体系

issues/taxonomy

Issue 标签分类体系指引。在对 issue 的 kind/area/priority/effort/status/protocol/dispatch 标签进行分类,或看板需要解读这些标签时使用。

软件开发工程师工单与问题跟踪管理
★ 9
usurobor
usurobor/cnos

issues/map

Issue-board (Issue Pivot) generation domain. Use when reasoning about `cn issues map`'s fetch, taxonomy-parse, effort-computation, and render pipeline, or about the board's JSON/HTML output contract.

★ 9
usurobor
usurobor/cnos

issues

cnos.issues package entrypoint. Use when reasoning about issue taxonomy, the Issue Pivot / issue-board (`cn issues map`), the read-only CDS issue-state evaluator (`cn issues fsm evaluate`), or the current command-dispatch disposition of issue tooling.

★ 9
usurobor
usurobor/cnos

receipt-stream

Cross-cycle receipt-stream doctrine for protocol-iteration. Use when γ closes a cycle and writes the per-cycle iteration artifact (`cdd-iteration.md`), when γ updates the cross-cycle aggregator at `.cdd/iterations/INDEX.md`, when ε reads the receipt stream across cycles to surface protocol-gap patterns, when a finding's disposition lands a cross-repo patch and the cross-repo trace bundle attaches, or when a courtesy empty-findings stub is written for a `protocol_gap_count == 0` cycle.

★ 9
usurobor
usurobor/cnos

mid-flight

Mid-flight γ→in-flight-α rescue channel. Use when γ needs to change a load-bearing fact (pinned axis, scope, AC, blocker) after α has begun coding, when γ edits the cycle's GitHub issue body mid-cycle, or when a spec change lands on origin/main while α/β polling sessions are in-flight.

★ 9