Repository navigation
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: none
goal_ref: "post-merge-cleanup skill の Step 3 gone branch 検出を inline bash one-liner から classify-git-state.py の新モードに集約し、scripts 層の一貫性を保つ"
change_kind: mixedParent Issue
なし(単独改善)
Parent Goal Ref
- Goal: N/A(単独改善 Issue のため親なし)
- Desired Destination: N/A
Current Validated Scope
.claude/skills/post-merge-cleanup/scripts/classify-git-state.pyを新規作成し--list-gone-branchesモードを追加.claude/skills/post-merge-cleanup/SKILL.mdStep 3 のgit branch -vv | grep ': gone]'をclassify-git-state.py --list-gone-branches呼び出しに置き換え.claude/skills/post-merge-cleanup/tests/に新モードの pytest テストを追加
Remaining Parent Gaps
なし
Outcome
.claude/skills/post-merge-cleanup/SKILL.md Step 3 の gone branch 検出が classify-git-state.py --list-gone-branches モード経由に統一され、同モードの pytest が PASS し、かつ inline python3 -c パイプラインが SKILL.md に存在しない状態で PR がマージされている。
Background
PR #37(Issue #31)で edit-issue / create-issue / post-merge-cleanup の inline bash を .py / .sh script に集約した。PR レビュー(pr-reviewer 追加観測)により、post-merge-cleanup/SKILL.md Step 3 周辺に gone branch 検出のための inline 記述が残存する可能性が観測された(具体例: classify-git-state.py 出力を python3 -c "import json,sys; ..." でパイプする形式)。また現行 SKILL.md には git branch -vv | grep ': gone]' という raw bash one-liner が Step 3 に直書きされており、Issue #31 で確立した「scripts 集約」原則と整合していない。本 Issue は classify-git-state.py に --list-gone-branches モードを追加して内部完結させることで、この不整合を解消する。
観測元: PR #37 pr-reviewer 追加観測 / post-merge-cleanup follow-up 候補
Issue #31 で確立した「scripts 集約 + subprocess 配列形式 + 入力 validation」原則を継承する。
In Scope
.claude/skills/post-merge-cleanup/scripts/classify-git-state.pyを新規作成し--list-gone-branchesモードを実装(gone branch 名を改行区切りで stdout 出力).claude/skills/post-merge-cleanup/SKILL.mdStep 3 のgit branch -vv | grep ': gone]'をuv run python3 .claude/skills/post-merge-cleanup/scripts/classify-git-state.py --list-gone-branchesに置き換え.claude/skills/post-merge-cleanup/tests/test_classify_git_state.pyを新規作成し、--list-gone-branchesモードの期待動作を pytest でカバー
Out of Scope
- 他 skill の inline python / bash one-liner 集約(別 Issue)
- post-merge-cleanup-worker SubAgent の責務変更
- Bash allowlist の追加更新
--format yaml/--format json等の将来モード(今回は--list-gone-branchesのみ)
Acceptance Criteria
- AC1:
! grep -nE "^[^#]*python3 -c" .claude/skills/post-merge-cleanup/SKILL.mdが exit 0(inline python 不在) - AC2:
grep -nE "list-gone-branches|--list-gone|extract.*gone" .claude/skills/post-merge-cleanup/scripts/classify-git-state.pyがヒット(モード実装済み) - AC3:
uv run python3 .claude/skills/post-merge-cleanup/scripts/classify-git-state.py --list-gone-branchesが gone branch 名リストを返す動作テストが pytest で PASS - AC4:
git branch -vv | grep ': gone]'の記述が SKILL.md から除去され、classify-git-state.py --list-gone-branches呼び出し形式に置き換わっている - AC5: 既存 pytest(
.claude/skills/post-merge-cleanup/tests/配下)が全件 PASS - AC6:
pnpm typecheck && pnpm lint && pnpm test && pnpm buildが PASS
Verification Commands
# AC1: inline python3 -c が SKILL.md に存在しないこと
! grep -nE "^[^#]*python3 -c" .claude/skills/post-merge-cleanup/SKILL.md && echo "PASS: AC1" || echo "FAIL: AC1"
# AC2: --list-gone-branches モードが classify-git-state.py に存在すること
grep -nE "list-gone-branches|--list-gone|extract.*gone" .claude/skills/post-merge-cleanup/scripts/classify-git-state.py && echo "PASS: AC2" || echo "FAIL: AC2"
# AC3: pytest で新モードのテストが PASS
uv run pytest .claude/skills/post-merge-cleanup/tests/ -v
# AC4: SKILL.md に git branch -vv | grep gone が残存していないこと
! grep -n "git branch -vv | grep.*gone" .claude/skills/post-merge-cleanup/SKILL.md && echo "PASS: AC4" || echo "FAIL: AC4"
# AC5: 既存テスト全件 PASS(AC3 と同コマンド、残存テスト後方互換確認)
uv run pytest .claude/skills/post-merge-cleanup/tests/ -v
# AC6: プロジェクト品質ゲート
pnpm typecheck && pnpm lint && pnpm test && pnpm buildAllowed Paths
.claude/skills/post-merge-cleanup/scripts/classify-git-state.py(新規作成).claude/skills/post-merge-cleanup/SKILL.md(Step 3 修正).claude/skills/post-merge-cleanup/tests/test_classify_git_state.py(新規作成)
Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合
- In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
classify-git-state.pyの既存--format出力スキーマ(yaml / json)を破壊する場合
Required Skills
- Python 3 / argparse / subprocess
- pytest
Scope Delta(任意)
N/A
Delivery Rule
1 Issue = 1 PR。worktree を使う場合は issue-<N>-classify-git-state-gone-mode を推奨。Draft PR 既定。
Activity