feat: AGENTS.md に自動生成セクションを導入し repo-maintenance で更新可能に - #609
Conversation
- AGENTS.md を静的セクション(Agent Guidelines, Development Standards)と 自動生成セクション(Repository Overview, Project Structure, Available Commands, CI/CD Workflows, Quality Gates, Hooks)に分離 - AUTO-GENERATED マーカーで囲まれた範囲を /repo-maintenance 実行時に再生成 - repo-maintenance.md に Step 3.4.1 として AGENTS.md 更新ステップを追加 - Summary Report と Related Commands テーブルにも項目追加 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughThis PR adds an AGENTS.md auto-generation step to repository maintenance docs and replaces AGENTS.md's former agent/config prose with a new auto-generated "Repository Overview" section; it also normalizes Development Standards wording and adds explicit Git conventions and PR guard rules. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🔍 AI Code Review (Local Hook)Models: Codex (default) / Gemini (default) 🤖 Codex Review指摘事項
判定
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: eb71aefa35
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| | `dependabot-auto-merge.yml` | Auto-merge Dependabot PRs | | ||
| | `manual-release.yml` | Manual release trigger | | ||
| | `rebuild-docker-cache.yml` | Weekly Docker cache rebuild | |
There was a problem hiding this comment.
List every workflow file in the auto-generated AGENTS table
This auto-generated workflow table stops at rebuild-docker-cache.yml, but in this same commit .github/workflows also contains coverage-report.yml and quality-gate-fallback.yml (checked via the commit tree). Because this section is intended to reflect repository state for AI agents, omitting existing workflows makes the generated context inaccurate and can cause maintenance/review commands to miss active CI paths.
Useful? React with 👍 / 👎.
| for d in */; do | ||
| [ "$d" = "node_modules/" ] || [ "$d" = "coverage/" ] || [ "$d" = ".git/" ] && continue | ||
| DIRS="$DIRS| \`${d%/}/\` | ... |\n" |
There was a problem hiding this comment.
Include dot-directories when collecting top-level directories
The proposed generation logic uses for d in */, which does not match dot-prefixed directories in Bash unless dotglob is enabled. That means key folders like .claude/, .github/, and .devcontainer/ will be silently excluded from regenerated Project Structure, even though they are core sections in AGENTS metadata.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.claude/commands/repo-maintenance.md:
- Around line 689-695: The skip condition only checks for AGENTS.md existence
and the "BEGIN AUTO-GENERATED" marker but not the corresponding "END
AUTO-GENERATED" marker, which can cause silent failures during the TAIL
extraction; update the shell conditional that guards the replacement logic to
also verify the presence of "END AUTO-GENERATED" in AGENTS.md (i.e., add a grep
check for "END AUTO-GENERATED" to the OR list) so the script explicitly
skips/aborts if either marker is missing and avoids truncating AGENTS.md.
In `@AGENTS.md`:
- Around line 140-142: The documented PR guard in AGENTS.md lists strict
requirements (PR guard: Diff <= 400 lines, <= 25 files, linked issue required,
1+ reviewer) that the repository automation does not enforce; either implement
enforcement or change the doc to a guideline. To fix: either (A) add CI/husky
checks that enforce the exact rules referenced (implement size/file-count checks
and require linked issue/reviewer in your existing CI or husky scripts
referenced in the repo), or (B) update AGENTS.md to reword the “PR guard”
section to clearly state these are recommended guidelines and reflect the
current behavior of the CI/husky snippets, ensuring the text mentions the
thresholds `<= 400 lines`, `<= 25 files`, “linked issue”, and “1+ reviewer” so
readers know what was intended. Ensure the change touches the PR guard wording
in AGENTS.md and/or the CI/husky configuration that performs checks.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 4f1fb4bd-c0be-4cbd-9122-790eefb692b3
📒 Files selected for processing (2)
.claude/commands/repo-maintenance.mdAGENTS.md
| **スキップ条件:** | ||
|
|
||
| ```bash | ||
| # AGENTS.md が存在しない、またはマーカーがない場合はスキップ | ||
| if [ ! -f "AGENTS.md" ] || ! grep -q "BEGIN AUTO-GENERATED" AGENTS.md; then | ||
| echo "⏭️ スキップ(AGENTS.md 未対応)" | ||
| fi |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Verify this section checks both BEGIN and END markers before replacement.
rg -n -C2 'BEGIN AUTO-GENERATED|END AUTO-GENERATED|AGENTS\.md 未対応' .claude/commands/repo-maintenance.mdRepository: keito4/config
Length of output: 1036
Check for both BEGIN and END markers before executing replacement logic.
Line 693 validates only BEGIN AUTO-GENERATED, but the replacement at lines 778–779 depends on both markers. A missing or corrupted END AUTO-GENERATED will cause the TAIL extraction to fail silently, resulting in truncated or corrupted AGENTS.md. Add an explicit check for the END marker in the skip condition.
Suggested fix
-# AGENTS.md が存在しない、またはマーカーがない場合はスキップ
-if [ ! -f "AGENTS.md" ] || ! grep -q "BEGIN AUTO-GENERATED" AGENTS.md; then
+# AGENTS.md が存在しない、または BEGIN/END マーカーが揃っていない場合はスキップ
+if [ ! -f "AGENTS.md" ] \
+ || ! grep -q "BEGIN AUTO-GENERATED" AGENTS.md \
+ || ! grep -q "END AUTO-GENERATED" AGENTS.md; then
echo "⏭️ スキップ(AGENTS.md 未対応)"
fi📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| **スキップ条件:** | |
| ```bash | |
| # AGENTS.md が存在しない、またはマーカーがない場合はスキップ | |
| if [ ! -f "AGENTS.md" ] || ! grep -q "BEGIN AUTO-GENERATED" AGENTS.md; then | |
| echo "⏭️ スキップ(AGENTS.md 未対応)" | |
| fi | |
| **スキップ条件:** | |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.claude/commands/repo-maintenance.md around lines 689 - 695, The skip
condition only checks for AGENTS.md existence and the "BEGIN AUTO-GENERATED"
marker but not the corresponding "END AUTO-GENERATED" marker, which can cause
silent failures during the TAIL extraction; update the shell conditional that
guards the replacement logic to also verify the presence of "END AUTO-GENERATED"
in AGENTS.md (i.e., add a grep check for "END AUTO-GENERATED" to the OR list) so
the script explicitly skips/aborts if either marker is missing and avoids
truncating AGENTS.md.
| - Branch naming: `feat|fix|chore/<issue#>-slug` | ||
| - Commit format: Conventional Commits | ||
| - PR guard: Diff <= 400 lines, <= 25 files, linked issue required, 1+ reviewer |
There was a problem hiding this comment.
Documented PR guard is stricter than what is actually enforced.
Line 142 describes hard PR guard rules (<=400 lines, <=25 files, linked issue, reviewer), but current automation (CI/husky snippets) only warns on much larger PR sizes and does not enforce linked-issue/reviewer requirements. Please either implement these checks or reword this as a guideline to avoid false assurance.
Suggested wording update
-- PR guard: Diff <= 400 lines, <= 25 files, linked issue required, 1+ reviewer
+- PR guideline: Keep diffs <= 400 lines and <= 25 files when possible; linked issue and at least 1 reviewer are recommended. (Current CI posts size warnings; hard enforcement may vary by repository settings.)📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| - Branch naming: `feat|fix|chore/<issue#>-slug` | |
| - Commit format: Conventional Commits | |
| - PR guard: Diff <= 400 lines, <= 25 files, linked issue required, 1+ reviewer | |
| - Branch naming: `feat|fix|chore/<issue#>-slug` | |
| - Commit format: Conventional Commits | |
| - PR guideline: Keep diffs <= 400 lines and <= 25 files when possible; linked issue and at least 1 reviewer are recommended. (Current CI posts size warnings; hard enforcement may vary by repository settings.) |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@AGENTS.md` around lines 140 - 142, The documented PR guard in AGENTS.md lists
strict requirements (PR guard: Diff <= 400 lines, <= 25 files, linked issue
required, 1+ reviewer) that the repository automation does not enforce; either
implement enforcement or change the doc to a guideline. To fix: either (A) add
CI/husky checks that enforce the exact rules referenced (implement
size/file-count checks and require linked issue/reviewer in your existing CI or
husky scripts referenced in the repo), or (B) update AGENTS.md to reword the “PR
guard” section to clearly state these are recommended guidelines and reflect the
current behavior of the CI/husky snippets, ensuring the text mentions the
thresholds `<= 400 lines`, `<= 25 files`, “linked issue”, and “1+ reviewer” so
readers know what was intended. Ensure the change touches the PR guard wording
in AGENTS.md and/or the CI/husky configuration that performs checks.
コードレビュー概要AGENTS.md を静的セクションと自動生成セクションに分離し、 バグ: ディレクトリ除外ロジックの shell 演算子優先順位repo-maintenance.md の参考ロジック (Step 3.4.1) for d in */; do
[ "$d" = "node_modules/" ] || [ "$d" = "coverage/" ] || [ "$d" = ".git/" ] && continuebash では
修正案: for d in */; do
case "$d" in
node_modules/|coverage/|.git/) continue ;;
esac
注意: sed による frontmatter パースfrontmatter の description 取得に テスト計画の未完了項目PR の Test plan に未チェック項目があります:
実際に Unicode アロー文字の変更
良い点
総評コンセプトは良く、構造も整理されています。主な愗念は参考ロジックのシェルスクリプトのバグと、エンドツーエンドテストの未確認です。バグ修正と動作確認を行ってからマージすることを推奨します。 Generated with Claude Code |
- コマンド数を 29 -> 28 に修正 - 欠落ワークフロー追加: coverage-report.yml, quality-gate-fallback.yml - Project Structure に欠落ディレクトリ追加: .agents/, .codex/, .cursor/, .gemini/, .husky/, .vscode/, credentials/ - シェルスクリプトの ||/&& 演算子優先順位バグを case 文で修正 - bun ロックファイル検出の ||/&& バグをグループ化で修正 - sed による frontmatter パースを awk に置き換え Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
🎉 This PR is included in version 1.102.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Summary
/repo-maintenance実行時に自動生成セクション(Repository Overview, Project Structure, Available Commands, CI/CD Workflows, Quality Gates, Hooks)をリポジトリの現在の状態から再生成repo-maintenance.mdに Step 3.4.1 として更新ステップを追加Changes
AGENTS.md
<!-- BEGIN AUTO-GENERATED -->マーカー内に6セクションrepo-maintenance.md
Test plan
/repo-maintenanceで AGENTS.md が正しく更新されることを確認🤖 Generated with Claude Code
Summary by CodeRabbit
Documentation
Chores