一键导入
linear-cleanup-feature
Merge approved PR, migrate open tasks, archive OpenSpec proposal, and cleanup branches
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Merge approved PR, migrate open tasks, archive OpenSpec proposal, and cleanup branches
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Execute roadmap items iteratively with policy-aware vendor routing and learning feedback
Orchestrate the full plan-review-implement-validate-PR lifecycle with multi-vendor review convergence
OpenBao/Vault credential seeding and management scripts
Comprehensive project health diagnostic — collects signals from CI tools, existing reports, deferred issues, and code markers into a prioritized finding report
Generate changelog entries and suggest semantic version bumps from git history
HTTP fallback bridge for coordinator when MCP transport is unavailable
| name | linear-cleanup-feature |
| description | Merge approved PR, migrate open tasks, archive OpenSpec proposal, and cleanup branches |
| category | Git Workflow |
| tags | ["openspec","archive","cleanup","merge","linear"] |
| triggers | ["cleanup feature","merge feature","finish feature","archive feature","close feature","linear cleanup feature"] |
Merge an approved PR, migrate any open tasks to beads or a follow-up proposal, archive the OpenSpec proposal, and cleanup branches.
$ARGUMENTS - OpenSpec change-id (optional, will detect from current branch or open PR)
/implement-feature first if PR doesn't exist/validate-feature first to verify live deploymentUse OpenSpec-generated runtime assets first, then CLI fallback:
.claude/commands/opsx/*.md or .claude/skills/openspec-*/SKILL.md.codex/skills/openspec-*/SKILL.md.gemini/commands/opsx/*.toml or .gemini/skills/openspec-*/SKILL.mdopenspec CLI commandsUse docs/coordination-detection-template.md as the shared detection preamble.
CAN_* flag is trueAt skill start, run the coordination detection preamble and set:
COORDINATOR_AVAILABLECOORDINATION_TRANSPORT (mcp|http|none)CAN_LOCK, CAN_QUEUE_WORK, CAN_HANDOFF, CAN_MEMORY, CAN_GUARDRAILSIf CAN_HANDOFF=true, read latest handoff context before merge/archive actions:
read_handoff"<skill-base-dir>/../coordination-bridge/scripts/coordination_bridge.py" try_handoff_read(...)On handoff failure/unavailability, continue with standalone cleanup and log informationally.
# From argument or current branch
CHANGE_ID=$ARGUMENTS
# Or: CHANGE_ID=$(git branch --show-current | sed 's/^openspec\///')
# Verify
openspec show $CHANGE_ID
Launcher Invariant: The shared checkout is read-only. Perform all cleanup operations in a worktree:
python3 "<skill-base-dir>/../worktree/scripts/worktree.py" setup "$CHANGE_ID" --agent-id cleanup
cd $WORKTREE_PATH
# Check PR status
gh pr status
# Or check specific PR
gh pr view openspec/<change-id>
Confirm PR is approved and CI is passing before proceeding.
# Squash merge (recommended)
gh pr merge openspec/<change-id> --squash --delete-branch
# Or merge commit
gh pr merge openspec/<change-id> --merge --delete-branch
# From the cleanup worktree, fetch the merged main
git fetch origin main
After merge, refresh project-global architecture artifacts:
make architecture
Before archiving, check for incomplete tasks in the proposal. Open tasks must not be silently dropped.
Read openspec/changes/<change-id>/tasks.md and scan for unchecked items (- [ ]).
If all tasks are checked (- [x]), skip to Step 6.
If there are open tasks, collect them with their context:
3.2 Add retry logic for failed requests)### 3. Error Handling)**Dependencies**: line**Files**: lineAsk the user which migration strategy to use:
Option A — Beads issues (if .beads/ directory exists):
For each open task group that has unchecked items:
# Create a beads issue per open task
bd create "<task description>" \
--label "followup,openspec:<change-id>" \
--priority medium
# If tasks have dependencies on each other, link them
bd dep add <child-id> <parent-id>
Include in each issue description:
proposal.md or design.mdOption B — Follow-up OpenSpec proposal (default if beads is not initialized):
Create a new proposal using runtime-native new/continue workflow (or CLI fallback) with:
followup-<original-change-id> (e.g., followup-add-retry-logic)Let the user review and confirm the follow-up proposal before proceeding.
After migration, annotate the original tasks.md to record where open tasks went:
## Migration Notes
Open tasks migrated to [beads issues labeled `openspec:<change-id>`] | [follow-up proposal `followup-<change-id>`] on YYYY-MM-DD.
This annotation is preserved in the archive for traceability.
Preferred path:
opsx:archive equivalent for the active agent).CLI fallback path:
openspec archive <change-id> --yes
openspec validate --strict
This archives the change, merges delta specs, and validates repository integrity.
# Confirm specs updated
openspec list --specs
# Confirm change archived
ls openspec/changes/archive/<change-id>/
# Validate everything
openspec validate --strict
# Delete local feature branch (if not already deleted)
git branch -d openspec/<change-id> 2>/dev/null || true
# Prune remote tracking branches
git fetch --prune
If CAN_LOCK=true, perform best-effort lock cleanup for files touched on the feature branch:
main...openspec/<change-id> changed filesRemove all worktrees for this feature (including the cleanup worktree):
# Return to shared checkout first (cleanup worktree is about to be removed)
cd "$(git rev-parse --git-common-dir | sed 's|/.git$||')"
# Remove cleanup worktree
python3 "<skill-base-dir>/../worktree/scripts/worktree.py" teardown "${CHANGE_ID}" --agent-id cleanup
# Remove implementation worktree (if exists from linear-implement-feature)
AGENT_FLAG=""
if [[ -n "${AGENT_ID:-}" ]]; then
AGENT_FLAG="--agent-id ${AGENT_ID}"
fi
python3 "<skill-base-dir>/../worktree/scripts/worktree.py" teardown "${CHANGE_ID}" ${AGENT_FLAG}
# Garbage-collect stale worktrees
python3 "<skill-base-dir>/../worktree/scripts/worktree.py" gc
# Confirm clean state
git status
# Run tests on main
pytest
CLAUDE.md if applicableCAN_HANDOFF=true, write a final handoff summary with merge status, migration notes, archive outcome, and follow-up referencesopenspec/specs//plan-feature <description> # Create proposal → approval gate
/implement-feature <change-id> # Build + PR → review gate
/validate-feature <change-id> # Deploy + test → validation gate (optional)
/cleanup-feature <change-id> # Merge + archive → done