Skip to content

feat(repo-maintenance): 組織横断監査の知見を反映した9つのチェックを追加・強化 - #820

Merged
keito4 merged 1 commit into
mainfrom
feat/repo-maintenance-org-audit-checks
Jun 11, 2026
Merged

feat(repo-maintenance): 組織横断監査の知見を反映した9つのチェックを追加・強化#820
keito4 merged 1 commit into
mainfrom
feat/repo-maintenance-org-audit-checks

Conversation

@keito4

@keito4 keito4 commented Jun 11, 2026

Copy link
Copy Markdown
Owner

Summary

Elu-co-jp 配下 10 リポジトリの横断監査で頻出した運用課題(ブランチ保護の片輪設定、CI 非ブロッキング品質チェック、カバレッジ閾値の形骸化など)を /repo-maintenance で機械的に検出・修正できるよう、9 つのチェックを追加・強化する。

Why

横断監査の結果、リポジトリごとに以下のパターンが繰り返し発生していた:

  • 6/10 リポジトリで「レビュー必須 or 必須ステータスチェックの片方のみ」設定(CI 赤マージ or レビューなしマージが可能)
  • lint/typecheck がローカルフックのみで CI に存在しない、または continue-on-error: true で実質非ブロッキング
  • カバレッジ閾値が 0%〜98% でばらつき、実測との乖離が放置
  • SECURITY.md に「secret scanning 有効」と記載しつつ実設定は無効(記載と実態の乖離)
  • coverage/ やデモ動画(約350MB)の git 追跡、submodule の未マージブランチ参照、security 修正ブランチの放置

個別リポジトリの手直しではなく、定期メンテナンスのチェックリスト側に組み込むことで再発を防ぐ。

What

  • 2.9 拡張: SHA 固定チェックを first-party actions(actions/, github/)にも適用(3rd-party=critical / first-party=warning)
  • 3.1 強化: ブランチ保護の両輪検証(reviews≥1 + required checks≥1 + enforce_admins)と delete_branch_on_merge の確認・full mode 自動修正
  • 3.5.4 新設: CI Blocking Gate Check — 品質スクリプトの CI 参照確認 + continue-on-error 検出
  • 3.16 拡張: SECURITY.md のプレースホルダー残存・記載と GitHub 実設定の乖離検証
  • 3.18 新設: CONTRIBUTING.md チェック(欠番を活用、templates/github/ から配布)
  • 3.23 新設: Coverage Threshold Policy Check — ラチェット方式の検証(閾値0%・実測と10pt超乖離を検出)
  • 4.3 新設: 追跡生成物・5MB超ファイル・ルートクラッター検出
  • 4.4 新設: Submodule Health Check — ピン先がデフォルトブランチに含まれるか検証
  • 4.5 新設: Stale PR(14日超)・未マージ security 系ブランチ検出
  • Step 6 サマリーレポートと Related Commands テーブルへ新項目を反映

How to test

  • npx prettier --check .claude/commands/repo-maintenance.md が通る(コミット時の pre-commit で確認済み)
  • セクション番号の整合(3.15→3.23、4.1→4.5)を確認済み
  • 任意のリポジトリで /repo-maintenance --mode check-only を実行し、新チェックが読み取り専用で動作することを確認

Checklist

  • セルフレビュー済み
  • テストを追加・更新した(該当する場合)— ドキュメント(プロンプト定義)のみの変更
  • ドキュメントを更新した(該当する場合)
  • 破壊的変更がない

Related

Elu-co-jp 配下 10 リポジトリの横断監査(2026-06-11 実施)の知見を反映

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation
    • Enhanced repository maintenance guidance with improved GitHub Actions security validation, team protection verification, and CI quality gate checks.
    • Added configuration consistency validation for security and contribution guidelines.
    • Expanded cleanup and dependency monitoring procedures, including coverage threshold policies and stale branch detection.

10リポジトリの横断監査で頻出した運用課題を /repo-maintenance で検出・修正
できるようにする。

- 2.9 拡張: SHA固定チェックを first-party actions にも適用
- 3.1 強化: ブランチ保護の両輪検証(reviews + required checks)と
  delete_branch_on_merge の確認・自動修正
- 3.5.4 新設: 品質スクリプトの CI 参照確認と continue-on-error 検出
- 3.16 拡張: SECURITY.md のプレースホルダー残存・記載と実態の乖離検証
- 3.18 新設: CONTRIBUTING.md チェック(テンプレート配布)
- 3.23 新設: カバレッジ閾値ラチェット方式チェック
- 4.3 新設: 追跡生成物・大容量ファイル・ルートクラッター検出
- 4.4 新設: submodule ピン先の健全性確認
- 4.5 新設: stale PR・未マージ security ブランチ検出

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The repo-maintenance.md documentation expands GitHub Actions security (first-party + third-party SHA pinning), team protection API validation, SECURITY.md/CONTRIBUTING.md integrity checks, CI blocking-gate enforcement, coverage threshold ratcheting, and repository health scanning (tracked artifacts, submodules, stale PRs). Summary output and related-commands reference are updated to surface all new checkpoints.

Changes

Repository Maintenance Command Extension

Layer / File(s) Summary
GitHub Actions and Team Protection Checks
.claude/commands/repo-maintenance.md
GitHub Actions SHA pinning now detects and categorizes unpinned first-party actions (warning) separately from third-party (critical). Team protection validation adds API checks for reviewer requirements and status checks alignment, ensuring neither is partially unset.
Configuration and Documentation Integrity Checks
.claude/commands/repo-maintenance.md
SECURITY.md check validates absence of TODO/placeholder content and verifies secret scanning/push protection documentation matches actual API-configured settings. CONTRIBUTING.md check detects missing file and provides template-based setup in full mode.
CI Quality Gates and Coverage Policy
.claude/commands/repo-maintenance.md
CI Blocking Gate Check validates that quality scripts (lint, typecheck, test, format:check) are referenced in workflows and actually blocking (detects unused scripts and continue-on-error: true non-blocking patterns). Coverage Threshold Policy validates ratchet-mode operation by comparing thresholds against actual measurements, catching zero/unset thresholds and significant drift.
Repository Cleanup and Health Checks
.claude/commands/repo-maintenance.md
Tracked artifacts/root clutter detection identifies files tracked in version control and root-level directory clutter. Submodule pinning validates references point to default-branch commits (detects unmerged or stale branches). Stale PR and security branch detection identifies pull requests inactive 14+ days and unmerged security/fix branches.
Report Output and Related Commands Updates
.claude/commands/repo-maintenance.md
Final summary report adds result rows for Team Protection, SECURITY/CONTRIBUTING checks, CI Blocking Gates, Coverage Policy, and Cleanup items. Related Commands reference list adds entries for all newly implemented checks (SECURITY.md, CONTRIBUTING, CI Blocking Gate, Coverage Threshold, quality scripts, Push Protection, Dependency Review, Deploy Env Protection, and cleanup tasks).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • keito4/config#541: Both expand repo-maintenance.md Setup category with quality script checks (lint/typecheck/test/format:check) and related validation logic, sharing overlapping check enhancement patterns.
  • keito4/config#580: Both update .claude/commands/repo-maintenance.md security hardening for GitHub Actions SHA pinning (including first-party handling) and push protection/dependency review/deployment environment protection checks.
  • keito4/config#603: Both extend .claude/commands/repo-maintenance.md CI-related checks and report items within the same command workflow.

Suggested labels

documentation

Poem

🐰 The maintenance script grows with care,
First-party actions now aware,
Team guards and coverage metrics tight,
Stale branches flagged for cleanup's might,
A rabbit's guide to repos fair! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately reflects the main change: adding and enhancing 9 checks based on cross-organizational audit findings for the repo-maintenance command.
Description check ✅ Passed The description comprehensively covers all required template sections with detailed explanations of the 9 checks, rationale based on audit findings, and testing instructions.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/repo-maintenance-org-audit-checks

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@claude

claude Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Claude finished @keito4's task in 3m 20s —— View job


PR #820 コードレビュー

タスクリスト

  • コンテキスト収集
  • 変更ファイルの詳細レビュー(diff 全体を確認)
  • フィードバックの作成・投稿

全体評価

横断監査の知見を的確にチェックリストへ反映した、実用性の高い変更です。追加された 9 チェックはどれも背景・ロジック・結果パターンが整理されており、読み手にとって意図が明確です。セクション番号の整合も PR 説明通り確認できました。

以下に気になる点を severity 別に列挙します。


指摘事項

⚠️ Minor

[Section 3.5.4] CI Blocking Gate Check — パッケージマネージャー検出の false negative

# 現在
grep -rqE "run (-w [^ ]+ )?$script_name\b|npx $script_name\b" .github/workflows/*.yml

yarn lintrun を省略する慣用形)はパターンにマッチしません。pnpm run lintbun run lintrun lint を含むため問題なし、yarn lint のみ false negative になります。ただし yarn run lint は一般的なのでほとんどの実態では問題にならないと判断できます。

Fix this →


[Section 3.5.4] continue-on-error 検出ロジックの精度

grep -B5 "continue-on-error: true" "$workflow" | grep -qiE "(lint|typecheck|...)"

-B5(前 5 行)はヒューリスティックで、以下の誤検知・見逃しリスクがあります:

  • continue-on-error: true がジョブレベルに設定されている場合(全ステップに適用)は、品質ステップが 5 行以内にある保証がない
  • 品質ツール名がコメントとして登場している場合に false positive

現状は注記に「意図を確認してから解除提案」と書かれており、自動修正しない設計なのでリスクは低いですが、ドキュメントにこの精度限界を明示すると親切です。


[Section 3.16] SECURITY.md — TODO|FIXME パターンの false positive

if grep -qE "TODO|FIXME|security@example\.com|\[INSERT|<!-- 要記入" "$SEC_FILE"; then

TODO / FIXME は既存の SECURITY.md に開発メモとして含まれることがあり、false positive が発生する可能性があります。\[TODO\]# TODO など、マーカー形式に絞るか、FIXME は省略する方が実用的かもしれません。


[Section 3.23] Coverage — bc の可用性と算術の境界

[ "$(echo "$ACTUAL - $THRESHOLD > 10" | bc 2>/dev/null)" = "1" ]

bc がない環境では 2>/dev/null で黙ってスキップされるため動作上の問題はありませんが、awk を使う方がポータブルです:

awk "BEGIN { exit (($ACTUAL - $THRESHOLD) > 10 ? 0 : 1) }" && ISSUES+=(...)

[Section 4.3] git ls-files -z | xargs -0 du -k のパフォーマンス

追跡ファイルが多いリポジトリ(数千ファイル)で xargs du を全ファイルに実行すると遅くなります。上限として git ls-files -z | head -c 10000 | xargs -0 du -kgit ls-tree -rl HEAD | awk '$4 > 5242880 {print $5}'(blob サイズを直接取得)の方が効率的です。


[Section 3.18] templates/github/CONTRIBUTING.md テンプレートの存在確認

PR の変更対象ファイルは repo-maintenance.md 1 件のみですが、Section 3.18 は templates/github/CONTRIBUTING.md の存在を前提にしています。このテンプレートがリポジトリに存在しない場合、full mode で curl fallback が走ります(その後の curl が 404 になる)。テンプレートが未作成なら別 PR or このコミットで追加が望ましいです。


📝 Recommendation

[Section 2.9] grep -v "uses: ./" の冗長性

ローカルアクション(uses: ./path)はそもそも @version を持たないため、元の regex uses: [^/]+/[^@]+@[^ ]+ にマッチしません。フィルターは無害ですが、将来読む人が混乱するかもしれないので、コメントで意図を補記すると良いと思います。


[Section 4.4] Submodule DEFAULT 変数の空チェック

DEFAULT=$(git remote show origin 2>/dev/null | sed -n "s/.*HEAD branch: //p")
git fetch origin "$DEFAULT" --quiet 2>/dev/null

DEFAULT が空の場合(ネットワークなし、リモートなし)、git fetch origin "" がエラーになります。[ -z "$DEFAULT" ] && continue を入れるとより堅牢です。


良かった点

  • Section 3.1「両輪」検証: reviews >= 1 かつ required_status_checks >= 1 かつ enforce_admins の 3 点セットを API で直接検証する設計は、実際のリポジトリ状態を確実に捕捉できます。/setup-team-protection の実行有無に依存しない点が特に優れています。
  • Section 2.9 の first-party/3rd-party 分離: 同じ SHA 未固定でも severity を分けることで、チームが対応の優先度を正しく判断できます。
  • Section 3.23 ラチェット方式: 閾値の「形骸化」ではなく「実測値追従」という具体的な運用指針が示されており、単純な閾値チェックより実用的です。
  • Section 4.5 の security 系ブランチ検出: PR の放置と security 修正の未マージという 2 つの別問題を 1 チェックで扱いつつ、それぞれの対応(draft 化 / クローズ / 優先マージ)を分けて提示している点が丁寧です。

総評

PR の説明に書かれた audit findings と実装内容が一致しており、バグリスクのある変更はありません。上記の Minor 指摘はいずれも軽微で、このままマージしても実用上の問題は生じません。CONTRIBUTING.md テンプレートの有無だけ確認してから進めることを推奨します。

@keito4 keito4 self-assigned this Jun 11, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8bbd9fc1ed

ℹ️ 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".

/setup-team-protection の実行有無に関わらず、現在の実態を API で直接検証する:

```bash
PROTECTION=$(gh api "repos/$REPO/branches/main/protection" 2>/dev/null)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Handle unprotected branches before parsing protection JSON

When main has no branch protection, gh api repos/$REPO/branches/main/protection returns a 404 and PROTECTION is empty; the following jq commands then leave REVIEWS/CHECKS empty, so the numeric -lt tests emit integer expression expected and do not add the intended missing-review / missing-status-check issues. This is the exact case the new check needs to catch, so default the failed API call to {} or explicitly flag a missing protection response before these comparisons.

Useful? React with 👍 / 👎.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.claude/commands/repo-maintenance.md:
- Around line 1210-1215: The grep pattern interpolates $script_name directly (in
the for loop and the grep -rqE line), which can be broken by regex
metacharacters; fix it by escaping regex metacharacters in $script_name before
using it in grep or by switching to fixed-string matching. For example, compute
an escaped variable (e.g., escaped_script=$(printf '%s' "$script_name" | sed -e
's/[][.*^$(){}+?|\\/]/\\&/g')) and then use grep -rqE "run (-w [^ ]+
)?$escaped_script\b|npx $escaped_script\b" ... or replace grep -E with grep -F
and adjust the patterns to avoid regex constructs; update the grep invocation in
the loop that checks scripts to use the escaped variable (or fixed-string mode)
so names like "format:check" or any with special chars are matched safely.
- Line 2782: The check using bc in the conditional that reads 'elif [ -n
"$ACTUAL" ] && [ "$(echo "$ACTUAL - $THRESHOLD > 10" | bc 2>/dev/null)" = "1" ];
then' can silently fail if bc is not installed; update this to either ensure bc
is available in CI/devcontainer or wrap the numeric gap check with a fallback
that uses awk when bc is missing (detect via command -v bc), keeping the
existing behavior of appending to ISSUES when ACTUAL - THRESHOLD > 10; modify
the conditional around ACTUAL/THRESHOLD to first branch on bc presence and
otherwise compute the boolean with awk and compare to "1" before adding the same
ISSUES entry.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7e76edf8-d293-486b-89d1-f3c6e2ce9997

📥 Commits

Reviewing files that changed from the base of the PR and between e1997dc and 8bbd9fc.

📒 Files selected for processing (1)
  • .claude/commands/repo-maintenance.md

Comment on lines +1210 to +1215
for script_name in lint typecheck type-check format:check test; do
jq -e --arg s "$script_name" '.scripts[$s]' package.json >/dev/null 2>&1 || continue
if ! grep -rqE "run (-w [^ ]+ )?$script_name\b|npx $script_name\b" .github/workflows/*.yml 2>/dev/null; then
ISSUES+=("品質スクリプト '$script_name' が CI のどのワークフローからも実行されていない(ローカルフックのみ)")
fi
done

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Potential regex injection in script name matching.

The $script_name variable (e.g., format:check, type-check) is interpolated directly into the grep regex pattern without escaping. While colons and hyphens are safe in ERE, this pattern could break or produce false matches if script names contain other regex metacharacters.

🛡️ Recommended fix to escape regex metacharacters
   jq -e --arg s "$script_name" '.scripts[$s]' package.json >/dev/null 2>&1 || continue
-  if ! grep -rqE "run (-w [^ ]+ )?$script_name\b|npx $script_name\b" .github/workflows/*.yml 2>/dev/null; then
+  # Escape special regex characters in script name
+  escaped_name=$(printf '%s' "$script_name" | sed 's/[.[\*^$]/\\&/g')
+  if ! grep -rqE "run (-w [^ ]+ )?$escaped_name\b|npx $escaped_name\b" .github/workflows/*.yml 2>/dev/null; then
     ISSUES+=("品質スクリプト '$script_name' が CI のどのワークフローからも実行されていない(ローカルフックのみ)")
   fi
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.claude/commands/repo-maintenance.md around lines 1210 - 1215, The grep
pattern interpolates $script_name directly (in the for loop and the grep -rqE
line), which can be broken by regex metacharacters; fix it by escaping regex
metacharacters in $script_name before using it in grep or by switching to
fixed-string matching. For example, compute an escaped variable (e.g.,
escaped_script=$(printf '%s' "$script_name" | sed -e
's/[][.*^$(){}+?|\\/]/\\&/g')) and then use grep -rqE "run (-w [^ ]+
)?$escaped_script\b|npx $escaped_script\b" ... or replace grep -E with grep -F
and adjust the patterns to avoid regex constructs; update the grep invocation in
the loop that checks scripts to use the escaped variable (or fixed-string mode)
so names like "format:check" or any with special chars are matched safely.

ISSUES+=("coverage 閾値が未設定(テストがあるのにゲートがない)")
elif [ "${THRESHOLD%%.*}" -eq 0 ]; then
ISSUES+=("coverage 閾値が 0%(ゲート実質無効)→ 実測値直下へのラチェット設定を推奨")
elif [ -n "$ACTUAL" ] && [ "$(echo "$ACTUAL - $THRESHOLD > 10" | bc 2>/dev/null)" = "1" ]; then

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Check if bc is available in common execution environments

# Check local environment
echo "=== Local environment ==="
which bc && bc --version || echo "bc not found"

# Check if bc is listed in DevContainer features or installed packages
echo ""
echo "=== DevContainer configuration ==="
if [ -f ".devcontainer/devcontainer.json" ]; then
  jq -r '.features // {} | keys[]' .devcontainer/devcontainer.json 2>/dev/null
fi

# Check GitHub Actions workflow for bc installation
echo ""
echo "=== GitHub Actions workflows ==="
grep -rn "apt-get install.*bc\|apk add.*bc" .github/workflows/ 2>/dev/null || echo "No explicit bc installation found in workflows"

Repository: keito4/config

Length of output: 915


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Locate bc usage in the cited script file and show surrounding lines
echo "=== bc usage in repo-maintenance.md ==="
rg -n '\bbc\b' .claude/commands/repo-maintenance.md || true
echo "--- context around first match (if any) ---"
rg -n '\bbc\b' .claude/commands/repo-maintenance.md | head -n 5 | cut -d: -f1 | head -n 1 | \
  awk -v file=".claude/commands/repo-maintenance.md" '{start=$1-5; if(start<1)start=1; end=$1+5; print "----- lines " start "-" end " -----"; system("sed -n \"" start "," end "p\" " file)}'

# Show the exact line/snippet around the provided line number (2782)
echo
echo "=== Exact snippet around line 2782 ==="
sed -n '2775,2790p' .claude/commands/repo-maintenance.md

# Check for any bc installation hints in DevContainer / workflows (more targeted)
echo
echo "=== DevContainer files mentioning bc ==="
fd -a devcontainer.json .devcontainer 2>/dev/null || true
rg -n '\bbc\b' .devcontainer 2>/dev/null || true

echo
echo "=== Workflow files mentioning bc installation ==="
rg -n 'apt-get.*bc|apk.*bc|brew.*bc|Install.*bc' .github/workflows 2>/dev/null || true

Repository: keito4/config

Length of output: 1624


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== DevContainer config files ==="
ls -la .devcontainer || true
echo
for f in .devcontainer/devcontainer.json .devcontainer/codespaces/devcontainer.json; do
  if [ -f "$f" ]; then
    echo "----- $f -----"
    sed -n '1,200p' "$f"
    echo
  fi
done

echo "=== Any bc mentions in .devcontainer/ ==="
rg -n '\bbc\b' .devcontainer || true

echo
echo "=== Any package-manager installs in .devcontainer/ (bc-related patterns) ==="
rg -n 'apt-get.*(install|update)|apk add|yum install|dnf install|brew install' .devcontainer || true

echo
echo "=== Any bc mentions in workflow / scripts ==="
rg -n '\bbc\b' .github/workflows .github/scripts . || true

Repository: keito4/config

Length of output: 7241


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== Search for bc installation hints in the repo ==="
rg -n '\bapt-get\b.*\bbc\b|\bapk\b.*\bbc\b|\bbrew\b.*\bbc\b|\binstall\b.*\bbc\b|\bc\+.*\bbc\b' . || true
echo

echo "=== Search for any use of 'bc' (wide scan) ==="
rg -n '\bbc\b' . | head -n 80
echo

echo "=== Inspect .devcontainer/Dockerfile apt-get install section ==="
sed -n '1,120p' .devcontainer/Dockerfile
echo
sed -n '120,240p' .devcontainer/Dockerfile

Repository: keito4/config

Length of output: 12168


Ensure bc is installed or guard with an awk fallback for float gap checks

.claude/commands/repo-maintenance.md:2782 relies on bc for the "$ACTUAL - $THRESHOLD > 10" comparison, but .devcontainer/Dockerfile doesn’t install bc and there’s no explicit bc install found in workflows—if bc is missing, the check silently won’t fire because stderr is suppressed and the comparison becomes false.

Fix by either installing bc in the DevContainer/CI image, or falling back when it’s unavailable:

if ! command -v bc >/dev/null 2>&1; then
  gap=$(awk -v a="$ACTUAL" -v t="$THRESHOLD" 'BEGIN {print (a - t > 10) ? "1" : "0"}')
  [ "$gap" = "1" ] && ISSUES+=("coverage 実測 ${ACTUAL}% に対し閾値 ${THRESHOLD}%(乖離 10pt 超)→ ラチェット引き上げを推奨")
else
  if [ "$(echo "$ACTUAL - $THRESHOLD > 10" | bc 2>/dev/null)" = "1" ]; then
    ISSUES+=("coverage 実測 ${ACTUAL}% に対し閾値 ${THRESHOLD}%(乖離 10pt 超)→ ラチェット引き上げを推奨")
  fi
fi
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.claude/commands/repo-maintenance.md at line 2782, The check using bc in the
conditional that reads 'elif [ -n "$ACTUAL" ] && [ "$(echo "$ACTUAL - $THRESHOLD
> 10" | bc 2>/dev/null)" = "1" ]; then' can silently fail if bc is not
installed; update this to either ensure bc is available in CI/devcontainer or
wrap the numeric gap check with a fallback that uses awk when bc is missing
(detect via command -v bc), keeping the existing behavior of appending to ISSUES
when ACTUAL - THRESHOLD > 10; modify the conditional around ACTUAL/THRESHOLD to
first branch on bc presence and otherwise compute the boolean with awk and
compare to "1" before adding the same ISSUES entry.

@keito4
keito4 merged commit f60901f into main Jun 11, 2026
11 checks passed
@keito4
keito4 deleted the feat/repo-maintenance-org-audit-checks branch June 11, 2026 14:52
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 1.116.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@github-actions github-actions Bot added the released リリース済み label Jun 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released リリース済み

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant