Skip to content

feat: repo-maintenance に推奨ファイル同期ステップを追加 - #597

Merged
keito4 merged 2 commits into
mainfrom
feat/repo-maintenance-config-template-sync
Mar 20, 2026
Merged

feat: repo-maintenance に推奨ファイル同期ステップを追加#597
keito4 merged 2 commits into
mainfrom
feat/repo-maintenance-config-template-sync

Conversation

@keito4

@keito4 keito4 commented Mar 20, 2026

Copy link
Copy Markdown
Owner

Summary

  • repo-maintenance コマンドに Step 3.22「Config Template Sync」を追加
  • config リポジトリの推奨ワークフローやフックファイルを他リポジトリに自動同期する機能

背景

/setup-new-repo で初期構築したリポジトリのワークフローやフックは、config リポジトリの更新に追従しない。例えば claude.ymlcancel-in-progress 修正(#595)のような変更が全リポジトリに反映されない問題があった。

同期ポリシー

カテゴリ ファイル ポリシー
マネージド claude.yml, claude-code-review.yml, Claude hooks (3件) 常に最新版で上書き
テンプレート ci.yml, security.yml 差分確認後に上書き
テンプレート Issue/PR テンプレート 欠落ファイルのみ追加

Test plan

  • config リポジトリ自身で実行時にスキップされること
  • 他リポジトリで /repo-maintenance 実行時に差分が検出・同期されること
  • サマリーレポートに Config Template Sync の結果が表示されること

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Adds automatic configuration-template synchronization during setup to keep repos aligned with the central config source.
    • Adds conditional skip logic so sync runs only for applicable repositories and avoids syncing the config source itself.
    • Implements per-file policies (managed vs. template vs. issue/PR templates) with safe diff previews and configurable overwrite modes.
    • Enhances setup progress reporting to show configuration sync status.

Step 3.22 として Config Template Sync を追加。
config リポジトリの推奨ワークフローやフックファイルを
他のリポジトリに自動同期する機能。

マネージドファイル(claude.yml, hooks等)は常に最新版で上書き、
テンプレートファイル(ci.yml, security.yml等)は差分確認後に更新。

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Mar 20, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c23b0a07-2378-43f3-acc7-0771ac5d7ca9

📥 Commits

Reviewing files that changed from the base of the PR and between be4a893 and dcbb61e.

📒 Files selected for processing (1)
  • .claude/commands/repo-maintenance.md
✅ Files skipped from review due to trivial changes (1)
  • .claude/commands/repo-maintenance.md

📝 Walkthrough

Walkthrough

Adds a new Setup sub-step "Config Template Sync" that compares selected config-managed/template files against keito4/config and synchronizes missing or out-of-date files with per-file policies and skip logic for keito4/config and non-config-base repos.

Changes

Cohort / File(s) Summary
Config Template Sync docs
​.claude/commands/repo-maintenance.md
Adds Setup step 3.22: implements config-template comparison/sync, skip conditions (if repo is keito4/config or not under config-base), per-file policies (managed, template, issue/PR templates), and updates Setup progress/summary output.

Sequence Diagram(s)

sequenceDiagram
  participant Runner as Runner / CI
  participant RepoCmd as repo-maintenance command
  participant RepoFS as Target Repo FS
  participant ConfigSrc as keito4/config

  Runner->>RepoCmd: invoke "Config Template Sync"
  RepoCmd->>RepoFS: read repo metadata (.devcontainer/devcontainer.json)
  alt repo is keito4/config
    RepoCmd->>Runner: skip sync (self-repo)
  else not under config-base
    RepoCmd->>Runner: skip sync (not config-base)
  else proceed
    RepoCmd->>ConfigSrc: fetch listed template/managed files
    ConfigSrc-->>RepoCmd: return file contents
    RepoCmd->>RepoFS: for each file
    loop per-file policy
      RepoCmd->>RepoFS: check existence & diff
      alt managed file (.github/workflows/claude*.yml, .claude/hooks/*.py)
        RepoCmd->>RepoFS: copy if missing or different
      else template file (.github/workflows/security.yml, ci.yml)
        RepoCmd->>Runner: show diff
        alt MODE=full
          RepoCmd->>RepoFS: overwrite with source
        else
          RepoCmd->>Runner: report diff only
        end
      else issue/pr templates (.github/ISSUE_TEMPLATE/*, pull_request_template.md)
        RepoCmd->>RepoFS: copy missing entries only
      end
    end
    RepoCmd->>Runner: update Setup progress line "Config Template Sync: …"
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

🐰 I hopped across repos at dawn's first light,
Fetching templates, making file sets right.
Managed files copied, templates shown with care,
Missing issues added — sync done with flair! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding a recommended file sync step to the repo-maintenance command.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ 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-config-template-sync
📝 Coding Plan
  • Generate coding plan for human review comments

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.

@keito4

keito4 commented Mar 20, 2026

Copy link
Copy Markdown
Owner Author

🔍 AI Code Review (Local Hook)

Models: Codex (default) / Gemini (default)

🤖 Codex Review

指摘事項

  1. テンプレート同期の「確認後に上書き」と矛盾
    MODE=full の分岐で「上書きしますか? (y/n)」と出力していますが、入力受付や分岐がなく無条件で cp されています。記述どおりの対話確認になっておらず、手順として誤解を招きます。
    .claude/commands/repo-maintenance.md:1875-1881

  2. MODE の定義・前提がこのセクション内に存在しない
    MODE を参照して処理を分岐していますが、どこで設定する想定かこの手順内に記載がありません。利用者が再現できず、結果が不明瞭です。
    .claude/commands/repo-maintenance.md:1875-1879

全体判定
patch is incorrect
理由: 新規追加の手順が「確認後に上書き」という仕様と一致せず、MODE の前提も不足しており、実行手順として正確性に欠けます。
信頼度: 0.62


⚠️ 修正が必要です

上記のレビューで問題が指摘されています。修正してからマージしてください。


🤖 Generated by post_pr_ai_review.py hook

@keito4

keito4 commented Mar 20, 2026

Copy link
Copy Markdown
Owner Author

🔍 AI Code Review (Local Hook)

Models: Codex (default) / Gemini (default)

🤖 Codex Review

以下は変更差分に対するレビューです。

  1. ユーザー確認が実装されておらず、指示と実挙動が矛盾
    影響: テンプレートファイル更新時に「確認後に上書き」と書かれているのに、実際の手順では確認待ちの入力を受けずに cp が実行されます。これだと確認せず上書きされ、意図しない変更が発生し得ます。
    影響箇所: .claude/commands/repo-maintenance.md:1875(1875-1881付近)

  2. スキップ条件の具体的な判定ロジックが手順内に存在しない
    影響: 手順冒頭で「config 自身や管理外リポジトリではスキップ」とありますが、提示された同期ロジックには該当チェックがありません。利用者がそのままコピペ運用すると誤って同期してしまう恐れがあります。
    影響箇所: .claude/commands/repo-maintenance.md:1762(1762-1766付近)

判定: patch is incorrect
理由: 手順内で明示された動作と実際のコマンド手順が一致しておらず、意図しない上書きや誤運用に繋がるため。
信頼度: 0.62


⚠️ 修正が必要です

上記のレビューで問題が指摘されています。修正してからマージしてください。


🤖 Generated by post_pr_ai_review.py hook

@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: be4a893d05

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

Comment thread .claude/commands/repo-maintenance.md Outdated
Comment on lines +1878 to +1881
echo "上書きしますか? (y/n)"
# Claude による対話的確認
cp "$SRC" "$DST"
UPDATED+=("$file (更新)")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Respect overwrite confirmation for template sync

This branch asks the user whether to overwrite (上書きしますか?) but then immediately copies the source file without reading or checking any response, so full-mode runs will always overwrite customized ci.yml/security.yml once a diff is found. That makes the confirmation prompt ineffective and can silently discard repository-specific workflow changes.

Useful? React with 👍 / 👎.

Comment on lines +1838 to +1842
elif ! diff -q "$SRC" "$DST" >/dev/null 2>&1; then
# 差分あり → 上書き
diff --color=auto -u "$DST" "$SRC" | head -30
cp "$SRC" "$DST"
UPDATED+=("$file (更新)")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Guard sync writes behind full mode only

The mode contract at the top says quick and check-only should not update files, but this managed-file sync path performs cp as soon as a diff is detected with no MODE check. As written, non-full runs can still modify the working tree, which breaks the command’s read-only/check semantics and can create unexpected changes during audit-only usage.

Useful? React with 👍 / 👎.

@keito4 keito4 self-assigned this Mar 20, 2026
@claude

claude Bot commented Mar 20, 2026

Copy link
Copy Markdown
Contributor

Claude Code レビュー

PR の目的・背景は明確で有益な機能追加です。ただし、スクリプトロジックにいくつか問題点があります。


バグ・重大な問題

1. テンプレートファイルの確認が機能していない
MODE=full のとき、確認メッセージの直後に入力を待たず即座に cp を実行しています。echo と コメントを削除して意図を明示してください。

2. MODE 変数が未定義
MODE がドキュメント内のどこにも定義されていません。未定義の場合は空文字となり、テンプレートファイルの差分は表示されるだけで一切更新されません。

3. TMPDIR 変数のシャドウイング
TMPDIR はシステム予約の環境変数です。副作用を避けるため TEMP_CONFIG_DIR などに改名してください。

4. 一時ディレクトリのリーク
mktemp -d で作成した一時ディレクトリが処理後も残ります。trap 'rm -rf $DIR' EXIT を追加してください。


注意点

5. 空ディレクトリでの glob: for src_file in "$SRC_DIR"/* は空ディレクトリで * がリテラル展開されます。

6. diff --color=auto: 非インタラクティブ環境では --color=never の方が安全です。


良い点
マネージド/テンプレートの 2 段階ポリシー設計は明快です。config リポジトリ自身をスキップする設計はセルフループを防ぎます。ローカルクローン → GitHub API フォールバックの優先順位は合理的です。


まとめ

優先度: 必須 → MODE 定義の明記 or 確認ロジック削除 / trap によるクリーンアップ / TMPDIR リネーム
優先度: 推奨 → 空ディレクトリでの glob 対策

テンプレートファイルの確認ロジックが実装と矛盾している点を中心に、マージ前に修正をお願いします。

@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: 4

🧹 Nitpick comments (2)
.claude/commands/repo-maintenance.md (2)

1840-1840: Consider showing full diff or configurable limit.

The diff output is truncated to 30 lines with head -30. For managed files with extensive changes, this might hide important modifications from the user. Consider either showing the full diff, using a larger limit, or making it configurable.

💡 Alternative approaches

Option 1: Show full diff

-    diff --color=auto -u "$DST" "$SRC" | head -30
+    diff --color=auto -u "$DST" "$SRC"

Option 2: Use a pager for large diffs

-    diff --color=auto -u "$DST" "$SRC" | head -30
+    DIFF_OUTPUT=$(diff --color=auto -u "$DST" "$SRC")
+    LINE_COUNT=$(echo "$DIFF_OUTPUT" | wc -l)
+    if [ "$LINE_COUNT" -gt 50 ]; then
+      echo "$DIFF_OUTPUT" | less -R
+    else
+      echo "$DIFF_OUTPUT"
+    fi

Option 3: Configurable limit

+    DIFF_LINES=${DIFF_PREVIEW_LINES:-30}
-    diff --color=auto -u "$DST" "$SRC" | head -30
+    diff --color=auto -u "$DST" "$SRC" | head -n "$DIFF_LINES"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.claude/commands/repo-maintenance.md at line 1840, The current command
truncates diffs with a hard-coded head -30 which can hide important changes;
update the invocation that uses diff --color=auto -u "$DST" "$SRC" | head -30 to
either remove the head pipe to show the full diff, or replace the fixed limit
with a configurable variable (e.g., DIFF_LIMIT) and only pipe to head when that
variable is set, or instead pipe to a pager (LESS/most) when running
interactively; locate the invocation referencing "$DST" and "$SRC" and change
the pipeline accordingly so the limit is not hard-coded.

1754-1932: Consider adding backup mechanism for overwritten files.

The managed files sync overwrites local files without creating backups. If a repository has legitimate customizations to managed files (e.g., for testing or temporary fixes), those changes will be lost without warning.

Consider adding an optional backup mechanism:

🔄 Proposed enhancement
BACKUP_DIR=".git/config-sync-backup/$(date +%Y%m%d-%H%M%S)"

for file in "${MANAGED_FILES[@]}"; do
  SRC="$CONFIG_REPO/$file"
  DST="./$file"
  
  if [ ! -f "$SRC" ]; then
    continue
  fi
  
  mkdir -p "$(dirname "$DST")"
  
  if [ ! -f "$DST" ]; then
    cp "$SRC" "$DST"
    UPDATED+=("$file (新規追加)")
  elif ! diff -q "$SRC" "$DST" >/dev/null 2>&1; then
    # Create backup before overwriting
    mkdir -p "$BACKUP_DIR/$(dirname "$file")"
    cp "$DST" "$BACKUP_DIR/$file"
    
    diff --color=auto -u "$DST" "$SRC" | head -30
    cp "$SRC" "$DST"
    UPDATED+=("$file (更新、バックアップ: $BACKUP_DIR/$file)")
  else
    SKIPPED+=("$file (最新)")
  fi
done

This allows users to review and restore customizations if needed.

🤖 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 1754 - 1932, Add an
optional backup step before overwriting managed files: define a timestamped
BACKUP_DIR (e.g., .git/config-sync-backup/$(date ...)), and in the managed-files
loop that iterates over MANAGED_FILES, when you detect a diff (! diff -q "$SRC"
"$DST"), create the target backup directory with mkdir -p "$BACKUP_DIR/$(dirname
"$file")", copy the existing DST to the backup location (cp "$DST"
"$BACKUP_DIR/$file"), then show the diff and proceed to overwrite via cp "$SRC"
"$DST"; update the UPDATED entry to include backup path, and ensure the same
safe mkdir -p logic is used for new files so backups never fail; make the backup
behavior optional via a flag or env var (e.g., BACKUP=true) so it can be
toggled.
🤖 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 1802-1806: Add robust error handling around the GitHub API
fallback block that sets CONFIG_REPO and TMPDIR: ensure the `gh` CLI is present
and the `gh api repos/keito4/config/tarball/main | tar xz -C "$TMPDIR"
--strip-components=1` pipeline succeeds by checking exit statuses, and if either
`gh` or `tar` fails, remove the created TMPDIR, print a clear error to stderr,
and exit non-zero so the script does not continue with an invalid CONFIG_REPO;
reference the CONFIG_REPO and TMPDIR variables and the `gh api ... | tar xz`
pipeline when adding these checks and cleanup.
- Around line 1803-1806: The temporary directory created by TMPDIR=$(mktemp -d)
is not removed; after creating TMPDIR and setting CONFIG_REPO, add a cleanup
trap (e.g., trap 'rm -rf "$TMPDIR"' EXIT or trap with INT TERM for robustness)
so the temp directory is removed when the script exits or is interrupted; place
this trap immediately after TMPDIR is created to ensure CONFIG_REPO and
subsequent gh/tar operations still use the directory but it is always cleaned
up.
- Around line 1877-1882: The prompt "上書きしますか? (y/n)" is printed but no
confirmation is read; update the block that runs when MODE="full" to actually
read user input (e.g., using read -r answer) and only run cp "$SRC" "$DST" and
append to UPDATED if the answer is "y" or "Y"; for other answers skip copying
(and consider printing a message). Ensure this uses the existing variables MODE,
SRC, DST, and UPDATED and handle non-interactive environments by treating
empty/no input as "no".
- Around line 1763-1765: Add early-exit checks at the top of the first bash sync
block to skip running on the config repo or on repos not managed by config:
detect the current repository identity (e.g. from git remote origin URL or
GITHUB_REPOSITORY/GIT_REPO env) and if it equals "keito4/config" exit 0; then
check for the marker string "config-base" inside .devcontainer/devcontainer.json
(e.g. test -f .devcontainer/devcontainer.json && grep -q '"config-base"'
.devcontainer/devcontainer.json) and if not found exit 0; place these checks
before any main sync logic so the script returns early for those cases.

---

Nitpick comments:
In @.claude/commands/repo-maintenance.md:
- Line 1840: The current command truncates diffs with a hard-coded head -30
which can hide important changes; update the invocation that uses diff
--color=auto -u "$DST" "$SRC" | head -30 to either remove the head pipe to show
the full diff, or replace the fixed limit with a configurable variable (e.g.,
DIFF_LIMIT) and only pipe to head when that variable is set, or instead pipe to
a pager (LESS/most) when running interactively; locate the invocation
referencing "$DST" and "$SRC" and change the pipeline accordingly so the limit
is not hard-coded.
- Around line 1754-1932: Add an optional backup step before overwriting managed
files: define a timestamped BACKUP_DIR (e.g., .git/config-sync-backup/$(date
...)), and in the managed-files loop that iterates over MANAGED_FILES, when you
detect a diff (! diff -q "$SRC" "$DST"), create the target backup directory with
mkdir -p "$BACKUP_DIR/$(dirname "$file")", copy the existing DST to the backup
location (cp "$DST" "$BACKUP_DIR/$file"), then show the diff and proceed to
overwrite via cp "$SRC" "$DST"; update the UPDATED entry to include backup path,
and ensure the same safe mkdir -p logic is used for new files so backups never
fail; make the backup behavior optional via a flag or env var (e.g.,
BACKUP=true) so it can be toggled.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2efcdac0-3188-4211-af06-18c26f25d1ed

📥 Commits

Reviewing files that changed from the base of the PR and between 5d03167 and be4a893.

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

Comment thread .claude/commands/repo-maintenance.md Outdated
Comment on lines +1802 to +1806
if [ -z "$CONFIG_REPO" ]; then
TMPDIR=$(mktemp -d)
CONFIG_REPO="$TMPDIR"
gh api repos/keito4/config/tarball/main | tar xz -C "$TMPDIR" --strip-components=1
fi

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

Add error handling for GitHub API fallback.

The GitHub API tarball fetch and extraction has no error handling. If gh CLI is unavailable, the user lacks access, or the network request fails, the script will continue with an invalid CONFIG_REPO path.

🛡️ Proposed fix to add error handling
 if [ -z "$CONFIG_REPO" ]; then
   TMPDIR=$(mktemp -d)
+  trap 'rm -rf "$TMPDIR"' EXIT
   CONFIG_REPO="$TMPDIR"
-  gh api repos/keito4/config/tarball/main | tar xz -C "$TMPDIR" --strip-components=1
+  if ! gh api repos/keito4/config/tarball/main | tar xz -C "$TMPDIR" --strip-components=1 2>/dev/null; then
+    echo "❌ config リポジトリの取得に失敗しました"
+    echo "   gh CLI が利用可能か、keito4/config へのアクセス権があるか確認してください"
+    exit 1
+  fi
 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.

Suggested change
if [ -z "$CONFIG_REPO" ]; then
TMPDIR=$(mktemp -d)
CONFIG_REPO="$TMPDIR"
gh api repos/keito4/config/tarball/main | tar xz -C "$TMPDIR" --strip-components=1
fi
if [ -z "$CONFIG_REPO" ]; then
TMPDIR=$(mktemp -d)
trap 'rm -rf "$TMPDIR"' EXIT
CONFIG_REPO="$TMPDIR"
if ! gh api repos/keito4/config/tarball/main | tar xz -C "$TMPDIR" --strip-components=1 2>/dev/null; then
echo "❌ config リポジトリの取得に失敗しました"
echo " gh CLI が利用可能か、keito4/config へのアクセス権があるか確認してください"
exit 1
fi
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 1802 - 1806, Add robust
error handling around the GitHub API fallback block that sets CONFIG_REPO and
TMPDIR: ensure the `gh` CLI is present and the `gh api
repos/keito4/config/tarball/main | tar xz -C "$TMPDIR" --strip-components=1`
pipeline succeeds by checking exit statuses, and if either `gh` or `tar` fails,
remove the created TMPDIR, print a clear error to stderr, and exit non-zero so
the script does not continue with an invalid CONFIG_REPO; reference the
CONFIG_REPO and TMPDIR variables and the `gh api ... | tar xz` pipeline when
adding these checks and cleanup.

Comment thread .claude/commands/repo-maintenance.md Outdated
Comment on lines +1877 to +1882
if [ "$MODE" = "full" ]; then
echo "上書きしますか? (y/n)"
# Claude による対話的確認
cp "$SRC" "$DST"
UPDATED+=("$file (更新)")
fi

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 | 🔴 Critical

Implement missing interactive confirmation for template files.

The code comment indicates "Claude による対話的確認" (Claude interactive confirmation), but the actual confirmation logic is not implemented. The code prints "上書きしますか? (y/n)" but then immediately copies the file without waiting for user response. This violates the documented template file policy that requires "差分表示 → 確認後に上書き".

🔧 Proposed fix to implement actual confirmation
     if [ "$MODE" = "full" ]; then
       echo "上書きしますか? (y/n)"
-      # Claude による対話的確認
-      cp "$SRC" "$DST"
-      UPDATED+=("$file (更新)")
+      read -r response
+      if [[ "$response" =~ ^[Yy] ]]; then
+        cp "$SRC" "$DST"
+        UPDATED+=("$file (更新)")
+      else
+        echo "スキップしました: $file"
+        SKIPPED+=("$file (ユーザーがスキップ)")
+      fi
     fi

Note: If this is intended to be handled by Claude Code's interactive capabilities rather than shell read, the documentation should clarify this implementation detail.

📝 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.

Suggested change
if [ "$MODE" = "full" ]; then
echo "上書きしますか? (y/n)"
# Claude による対話的確認
cp "$SRC" "$DST"
UPDATED+=("$file (更新)")
fi
if [ "$MODE" = "full" ]; then
echo "上書きしますか? (y/n)"
read -r response
if [[ "$response" =~ ^[Yy] ]]; then
cp "$SRC" "$DST"
UPDATED+=("$file (更新)")
else
echo "スキップしました: $file"
SKIPPED+=("$file (ユーザーがスキップ)")
fi
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 1877 - 1882, The prompt
"上書きしますか? (y/n)" is printed but no confirmation is read; update the block that
runs when MODE="full" to actually read user input (e.g., using read -r answer)
and only run cp "$SRC" "$DST" and append to UPDATED if the answer is "y" or "Y";
for other answers skip copying (and consider printing a message). Ensure this
uses the existing variables MODE, SRC, DST, and UPDATED and handle
non-interactive environments by treating empty/no input as "no".

- スキップ条件の具体的な判定ロジックを追加
- TMPDIR → TEMP_CONFIG_DIR に変更(システム予約変数のシャドウイング回避)
- trap による一時ディレクトリのクリーンアップを追加
- テンプレートファイルの確認ロジックを明確化(MODE=full は Claude が確認、それ以外は報告のみ)
- 空ディレクトリでの glob 対策を追加
- diff の --color=auto を削除(非インタラクティブ環境対応)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@keito4
keito4 merged commit 3ae336f into main Mar 20, 2026
3 of 4 checks passed
@keito4
keito4 deleted the feat/repo-maintenance-config-template-sync branch March 20, 2026 04:52
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 1.98.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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