Skip to content

Commit b018521

Browse files
Merge pull request #199 from BlueEventHorizon/fix/196-next-spec-id-branch-scan
[Fix] next-spec-id のブランチスキャンから is-ancestor フィルタを撤廃 (#196)
2 parents b17be5b + 3873f01 commit b018521

16 files changed

Lines changed: 1917 additions & 1871 deletions

File tree

.claude/.doc-advisor/toc/forge-rules-ca07acbf88c2/.toc_checksums.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# ToC checksums for key: forge-rules
22
# Auto-generated - do not edit
3-
generated_at: 2026-07-10T07:40:30Z
3+
generated_at: 2026-07-13T00:41:52Z
44
file_count: 38
55
checksums:
66
plugins/forge/docs/additive_development_spec.md: ff45c1401227966ba98bab5f10bb40d3c5ff09a536aa3e79857f879974e3421f
@@ -12,7 +12,7 @@ checksums:
1212
plugins/forge/docs/document_style_guide.md: aa047d3620a2a020aa4cf12aaa00f21a61279e5db3e3281c61c5a5cd12333b65
1313
plugins/forge/docs/forge_anti_patterns.md: 2315e4bf39c55d2367f9cccc51236915cafadff1d79e50c5d8d8efd8896530d4
1414
plugins/forge/docs/plan_format.md: a06d5398b02f4d605a9a76e4f7e949e9fc3af6f0bbc190ff9ddb15014084d946
15-
plugins/forge/docs/plan_principles_spec.md: 4a22c4dfaa68b560b7ee3ee27e55dc94363ea14016f31ab3f51b560009ee9596
15+
plugins/forge/docs/plan_principles_spec.md: 65ee603af38e876c4976c85ff27543d10c6bc3c1ebb54b3d4af42c419d6ac23d
1616
plugins/forge/docs/requirement_format.md: 400ae580d36cec62c77cbba3255f26bba329e8b21cbf9dacbac53d6cff0f58ff
1717
plugins/forge/docs/review_priorities_spec.md: 797518b97a8dca2002639fa2afe0727c0ef1b30ae8eec2c24b4c73b5e1ee4119
1818
plugins/forge/docs/scope_proportionality_spec.md: d32e77754e8d2d06a2cbafda52e745e95baec08b89be34ff56604e7aabb3ab9b
@@ -21,7 +21,7 @@ checksums:
2121
plugins/forge/docs/spec_format.md: a764056bd3dc434db6e0cc3a18761503aa89b463623c7ceb938354e589cd6b6d
2222
plugins/forge/docs/spec_priorities_spec.md: 9ccba91f19c15cd8613d6ed5bca58fd5bd3f6679ac38f80294540d5918a1abac
2323
plugins/forge/docs/strategy_formulation_spec.md: b77a8920147a4e847c7612adc2aa51c79efa4c7857b4c52edb92d0b88a9acdf1
24-
plugins/forge/docs/task_execution_spec.md: 7d373c42062812c25873dc7bd14ecdd9e3447d72fdca91a12db17221976ca0fb
24+
plugins/forge/docs/task_execution_spec.md: 72556bf3c8dad8cda1a7aee05186df8318c555c372214e6da97625789cd93bf3
2525
plugins/forge/docs/version_migration_spec.md: accb3b2f52c7bc199f110d3f19ac533610bd4d49fc9b7f00173445f4bc97df70
2626
plugins/forge/skills/clean-rules/docs/taxonomy.md: cbe025933f39f74be1d11707b0a4c376c9aab7faa99973f6bfa1a6c09ee9b39a
2727
plugins/forge/skills/review/docs/review_criteria_code.md: 9e7066ad7dd3a9bc7891f9261af5babbfc63b24fc096c57df8cdf6db2a9ac49a

.claude/.doc-advisor/toc/forge-rules-ca07acbf88c2/toc.yaml

Lines changed: 873 additions & 906 deletions
Large diffs are not rendered by default.

docs/readme/forge/guide_implement.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ Executor behavior:
8484
3. Verify with build and tests
8585
4. Report results
8686

87+
When a strategy document (`{feature}_strategy.md`) exists, it is passed as required reading so the executor understands the implementation approach, phase intent, and risk mitigation before working on the single assigned task.
88+
8789
#### Constraints
8890

8991
- **One task per execution** — no touching adjacent tasks

docs/specs/forge/design/DES-019_create_plan_workflow_design.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ flowchart TD
128128
| 4.3 | フォーマット適用(`plan_format.md` に準拠) |
129129
| 4.4 | 完全性チェック [MANDATORY] |
130130

131+
各タスクの `required_reading` には `{feature}_strategy.md` を必ず含める。executor が単一タスクだけを実装する場合でも、全体戦略・フェーズ意図・リスク対策を理解したうえで実装判断できるようにする。
132+
131133
**タスク粒度 [MANDATORY]:**
132134

133135
- 1 Agent が単独で実行・完結できる単位

docs/specs/forge/design/DES-027_plan_strategy_phase_adr.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,4 +117,4 @@ plan.yaml は構造化データ(YAML)であり、`start-implement` が機械
117117
### 変更不要
118118

119119
- `plan_format.md` — plan.yaml のスキーマは変更なし
120-
- `start-implement` — タスク実行ロジックは影響なしstrategy.md は参考文書として required_reading に含めうる)
120+
- `start-implement` — タスク実行ロジックは影響なし。ただし executor が全体戦略・フェーズ意図・リスク対策を理解できるよう、strategy.md は全タスクの `required_reading` に含め、executor への必読文書として渡す

plugins/anvil/skills/impl-issue/SKILL.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,11 @@ Phase 8 で作成する成果物は次の 2 つ。**用途・出力先・参照
354354
**書き込む内容**: 解決内容(対策・実装計画・TODO)のみを Issue に追記する。
355355
背景 / 現象・原因はすでに記載済みのため、上書きしない。
356356

357+
> [!WARNING]
358+
> `gh issue edit --body-file` は本文の**完全置換**であり追記コマンドではない。実装計画のみを書いたファイルを
359+
> そのまま渡すと既存の背景・現象・原因が消える。**必ず既存本文を取得してから実装計画を末尾に結合した全文**
360+
> `--body-file` に渡す(手順は `references/phase-09-issue-update.md` 参照)。
361+
357362
実装計画を Issue に記載する。参照は GitHub / Figma で開けるもののみ記載する。
358363

359364
**Issue 更新前に必ず [`references/phase-09-issue-update.md`](references/phase-09-issue-update.md) を読む。**

plugins/anvil/skills/impl-issue/assets/TEMPLATE.md

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,4 @@
7171

7272
## gh コマンド例
7373

74-
特殊文字(バッククォート・`$` 等)に強い `--body-file` 経由で更新する。詳細手順とエンコード規約は [`references/phase-09-issue-update.md`](../references/phase-09-issue-update.md) を参照。
75-
76-
```bash
77-
tee /tmp/issue_body.md <<'BODY'
78-
<上記テンプレートの内容>
79-
BODY
80-
81-
gh issue edit <issue番号> --repo <owner>/<repo> --body-file /tmp/issue_body.md
82-
```
74+
`gh issue edit --body-file` は本文の**完全置換**であり追記ではない。既存本文の取得・検証・結合・更新の具体手順とエンコード規約は [`references/phase-09-issue-update.md`](../references/phase-09-issue-update.md) を参照(本ファイルにコマンド例は重複させない)。

plugins/anvil/skills/impl-issue/references/phase-09-issue-update.md

Lines changed: 50 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,23 +38,67 @@ Issue に記載する参照は **GitHub / Figma で開けるものだけ** に
3838

3939
`<owner>/<repo>` は Phase 0 で解決した値を使用する。
4040

41-
1. ユーザーに計画内容を提示し確認する
42-
2. 本文を一時ファイルに書き出してから `--body-file` で渡す(特殊文字・バッククォート・`$` が含まれても安全):
41+
### `gh issue edit --body-file` は本文の完全置換である [MANDATORY]
42+
43+
`gh issue edit --body-file` に diff/追記の概念はない。渡したファイルの内容が Issue 本文を**丸ごと置き換える**
44+
「解決内容(対策・実装計画・TODO)のみを追記する」という本 Phase の原則を守るには、**既存本文を取得してから
45+
末尾に実装計画を結合した「全文」を組み立てて渡す**必要がある。既存本文を持たないファイル(実装計画セクションのみ)を
46+
そのまま `--body-file` に渡すと、背景・現象・原因(`/anvil:create-issue` が作成した課題の内容)を消してしまう。
47+
48+
0. **実行ごとに一意な作業ディレクトリを作る [MANDATORY]**: `/tmp/issue_body*.md` のような固定パスは、並行実行
49+
(複数セッション・複数 Issue の同時作業)や前回異常終了時の残骸ファイルと衝突し、**別 Issue の本文を誤って
50+
結合・上書きするリスク**がある。`mktemp -d` で実行ごとに一意なディレクトリを作り、`trap` でスクリプト終了時に
51+
確実に削除する:
52+
53+
```bash
54+
workdir=$(mktemp -d)
55+
trap 'rm -rf "$workdir"' EXIT
56+
```
57+
58+
以降の Step ではこの `$workdir` 配下のパスのみを使用する(固定パスを直接書かない)。
59+
60+
1. 計画内容を提示したうえで、`AskUserQuestion` を使用して Issue 更新を実行するか確認する。承認後のみ Step 2 へ進む
61+
2. **既存本文を取得し、成否を検証する**(更新前に必ず実行。取得を飛ばして新規ファイルだけを渡さない):
62+
63+
**取得結果を検証する [MANDATORY]**: `gh` コマンドの失敗(認証切れ・レート制限・ネットワーク断)や本文が
64+
null の場合でも、シェルのリダイレクトは空(または `null` という文字列)のファイルをそのまま作成してしまう。
65+
取得コマンドの exit code と出力ファイルの非空を、**取得コマンドと同じシェル実行内で**確認し、失敗または空の
66+
場合は Step 3 へ進まず中断してユーザーに報告する(別のコマンド実行に分けると `$?` が別コマンドの結果に
67+
上書きされ検証が機能しなくなるため、1 ブロックで実行する):
4368

4469
```bash
45-
tee /tmp/issue_body.md <<'BODY'
46-
<本文>
70+
gh issue view <issue番号> --repo <owner>/<repo> --json body --jq '.body' > "$workdir/issue_body_original.md"
71+
rc=$?
72+
if [ $rc -ne 0 ] || [ ! -s "$workdir/issue_body_original.md" ] || [ "$(cat "$workdir/issue_body_original.md")" = "null" ]; then
73+
echo "既存本文の取得に失敗しました。Issue 番号・権限・ネットワークを確認してください。" >&2
74+
exit 1
75+
fi
76+
```
77+
78+
3. 既存本文 + 実装計画(テンプレート)を**1 つのファイルに結合**する。既存本文の内容は変更・削除・要約しない、そのまま末尾に追記する:
79+
80+
```bash
81+
cat "$workdir/issue_body_original.md" > "$workdir/issue_body.md"
82+
echo "" >> "$workdir/issue_body.md"
83+
tee -a "$workdir/issue_body.md" <<'BODY'
84+
<実装計画テンプレートの内容>
4785
BODY
86+
```
87+
88+
4. 結合後のファイルを `--body-file` で渡す:
4889
49-
gh issue edit <issue番号> --repo <owner>/<repo> --body-file /tmp/issue_body.md
90+
```bash
91+
gh issue edit <issue番号> --repo <owner>/<repo> --body-file "$workdir/issue_body.md"
5092
```
5193
52-
3. 更新後、内容を確認する
94+
5. **更新後、本文全体を確認し、既存の背景・現象・原因セクションが残っていることを検証する**(実装計画セクションの追加だけでなく、削れていないかを見る)
5395
5496
```bash
5597
gh issue view <issue番号> --repo <owner>/<repo>
5698
```
5799
100+
既存セクションが失われていた場合は、直前の Issue 内容(本 Phase 開始前に取得したコメント・本文)から手作業で復元し、再度 `--body-file` で修正する。
101+
58102
## Issue 更新テンプレート
59103
60104
[assets/TEMPLATE.md](../assets/TEMPLATE.md) を参照。

plugins/forge/docs/plan_principles_spec.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,12 @@
5858
```yaml
5959
required_reading:
6060
- specs/feature/design/DES-001_foo_design.md
61+
- specs/feature/plan/feature_strategy.md
6162
- rules/architecture/domain_core.md
6263
```
6364
65+
**実装戦略書 [MANDATORY]**: `/forge:start-plan` が `{feature}_strategy.md` を作成した場合、すべてのタスクの `required_reading` にその戦略書パスを含める。戦略書は executor が全体戦略・フェーズ意図・リスク対策を理解するための必読文書である。
66+
6467
**誤った例**:
6568

6669
- `foo_design` ❌(曖昧名)

plugins/forge/docs/task_execution_spec.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,15 @@ Step 5: 完了処理(結果報告、終了)
4646

4747
オーケストレーターから以下の情報が提供される:
4848

49-
| 項目 | 内容 |
50-
| -------- | -------------------------------------------------- |
51-
| タスクID | 実装するタスクの識別子 |
52-
| タスク名 | タスクのタイトル |
53-
| 優先度 | タスクの優先度(数値) |
54-
| 実装内容 | やるべき内容の詳細リスト |
55-
| 必読文書 | 設計書、要件定義書、ルール文書、参照コードのリスト |
56-
| 実装指示 | タスク固有の実装方針 |
57-
| 検証要件 | ビルド確認・テスト実行の要否とスキップ理由 |
49+
| 項目 | 内容 |
50+
| -------- | ---------------------------------------------------------- |
51+
| タスクID | 実装するタスクの識別子 |
52+
| タスク名 | タスクのタイトル |
53+
| 優先度 | タスクの優先度(数値) |
54+
| 実装内容 | やるべき内容の詳細リスト |
55+
| 必読文書 | 設計書、要件定義書、戦略書、ルール文書、参照コードのリスト |
56+
| 実装指示 | タスク固有の実装方針 |
57+
| 検証要件 | ビルド確認・テスト実行の要否とスキップ理由 |
5858

5959
---
6060

@@ -66,8 +66,9 @@ Step 5: 完了処理(結果報告、終了)
6666

6767
1. **設計書**(必須): タスクの直接根拠。最優先で全文読了
6868
2. **要件定義書**(必須): 仕様の確認用。関連仕様が離れた場所に記載されている可能性あり
69-
3. **ルール文書**(必須): 実装ルール・コーディング規約
70-
4. **参照コード**(推奨): 既存の関連コードを網羅的に確認。量が多い場合は実装に直接関連する部分を優先
69+
3. **戦略書**(必須): 全体戦略・フェーズ意図・リスク対策を把握し、指定タスク内の実装判断に反映
70+
4. **ルール文書**(必須): 実装ルール・コーディング規約
71+
5. **参照コード**(推奨): 既存の関連コードを網羅的に確認。量が多い場合は実装に直接関連する部分を優先
7172

7273
### 2.2 既存コード確認 [MANDATORY]
7374

0 commit comments

Comments
 (0)