feat: 複数リポジトリの共通設定をテンプレート化 - #670
Conversation
ohana, calendar_management, cyber_ace_1on1, nomad_japan, activity_bookings, goal_dashboard, emp_track_extension, raycast-extensions 等で繰り返し使われている 設定ファイルを config リポジトリのテンプレートとして共通化する。 - Prettier: base (80) / wide (120) の2パターン + prettierignore - lint-staged: ESLint+Prettier / Biome / Prettier-only の3パターン - Husky hooks: pre-commit, commit-msg, pre-push のベーステンプレート - E2E Playwright CI ジョブテンプレート (workflow_call 対応) - Claude Code ワークフローテンプレート (Bot 除外ロジック統一) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds documentation and multiple tooling templates: Prettier configs and ignore, three lint-staged presets, Husky hook scripts, two GitHub Actions workflows (Claude Code and reusable Playwright E2E), and README layout updates documenting workflows, code style, and hooks. Changes
Sequence Diagram(s)sequenceDiagram
participant GitHub as "GitHub (event)"
participant Runner as "Actions Runner"
participant Repo as "Repository (checkout)"
participant Claude as "anthropics/claude-code-action"
Note over GitHub,Claude: Claude workflow (templates/workflows/claude.yml)
GitHub->>Runner: issue/comment/PR review event (contains `@claude`)
Runner->>Repo: checkout (fetch-depth: 1)
Runner->>Claude: invoke action (secrets + settings)
Claude->>Runner: run allowed tools / produce changes
Runner->>Repo: push branch / create PR (if issue -> create PR flow)
Runner->>GitHub: update PR/issue with results
sequenceDiagram
participant Caller as "Caller workflow"
participant Runner as "Actions Runner"
participant Repo as "Repository (checkout)"
participant Node as "Node / Package manager"
participant Playwright as "Playwright (browsers/tests)"
Note over Runner,Playwright: E2E reusable workflow (templates/workflows/e2e-playwright.yml)
Caller->>Runner: workflow_call (node-version, package-manager, build, e2e-command)
Runner->>Repo: checkout
Runner->>Node: setup Node + install deps (npm ci / pnpm)
Runner->>Runner: optional build step (if provided)
Runner->>Playwright: install browsers (npx playwright install)
Runner->>Playwright: run e2e command
Playwright-->>Runner: test results / artifacts
Runner->>Repo: upload artifacts (report, test-results)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 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 |
|
Claude finished @keito4's task in 1m 17s —— View job コードレビュータスク
全体評価複数リポジトリの設定をテンプレート化する意図は明確で、構成も整理されています。README の選択ガイドも有用です。ただし、セキュリティ面で修正が必要な問題が 1 件あります。 Security[major]
|
| 観点 | 結果 |
|---|---|
| Security | |
| Quality | minor 指摘 2 件(Draft 判定・pre-push の出力) |
| 全体構成 | テンプレートの選択ガイドは充実しており良好 |
e2e-playwright.yml のアクション SHA ピン留めのみ対応いただければ LGTM です。
🔍 AI Code Review (Local Hook)Models: Codex (default) / Gemini (default) 🤖 Codex Review指摘事項(重大度順)
判定: patch is incorrect — 公開リポジトリでの不特定ユーザー起動 + 書き込み権限の組み合わせが重大なセキュリティリスクで、 ✨ Gemini ReviewMCP issues detected. Run /mcp list for status.コード変更のレビュー結果を報告します。 指摘事項
判定: patch is incorrect 理由: 信頼度スコア: 0.95
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: de6301dace
ℹ️ 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".
| fi | ||
|
|
||
| # テスト | ||
| if npm run --silent test -- --ci --passWithNoTests 2>/dev/null; then |
There was a problem hiding this comment.
Guard test run with --if-present
This hook claims to run checks only when scripts exist, but unlike typecheck and lint, the test invocation is unconditional. In repositories that adopt this template without a test script, npm run test exits with a missing-script error and blocks every push, which makes the template unusable for projects that intentionally skip tests.
Useful? React with 👍 / 👎.
| github.event.sender.type != 'Bot' && | ||
| ( | ||
| (github.event_name == 'issue_comment' && contains(github.event.comment.body || '', '@claude') && | ||
| !(github.event.issue.pull_request && github.event.issue.pull_request.url && github.event.issue.draft == true)) || |
There was a problem hiding this comment.
Fix draft-PR exclusion check for issue comments
The issue_comment branch tries to exclude draft PRs via github.event.issue.draft, but this field is not present on issue_comment payloads, so the negated condition remains true for PR comments and @claude still runs on draft PRs. This contradicts the documented behavior in this template and causes unnecessary bot runs on drafts.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Nitpick comments (3)
templates/husky/pre-push (1)
6-10: Stderr suppression hides diagnostic output.The
2>/dev/nullredirection suppresses all error messages. When checks fail, users only see "TypeScript check failed" without the actual error details (e.g., which files have type errors), making debugging difficult.Consider removing the stderr suppression or redirecting to a log file:
Option: Remove stderr suppression to show errors
# TypeScript 型チェック(typecheck スクリプトが存在する場合) -if npm run --silent typecheck --if-present 2>/dev/null; then +if npm run --silent typecheck --if-present; then echo "-> TypeScript check passed" else echo "TypeScript check failed"; exit 1 fiApply similarly to
lintandtestcommands.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@templates/husky/pre-push` around lines 6 - 10, The pre-push hook currently silences TypeScript diagnostics by redirecting stderr in the command `npm run --silent typecheck --if-present 2>/dev/null`; remove the `2>/dev/null` redirection so that `npm run --silent typecheck --if-present` emits real error output on failure, and apply the same change to the analogous `lint` and `test` invocations in this script so users see the actual diagnostic details instead of only "TypeScript check failed".templates/workflows/e2e-playwright.yml (2)
66-71: Inconsistent action version pinning compared toclaude.yml.This workflow uses mutable version tags (
@v4) whileclaude.ymlpins actions to specific commit SHAs. Mutable tags can change unexpectedly, potentially introducing breaking changes or security issues.For template consistency and supply-chain security, consider pinning to commit SHAs:
Example with pinned versions
- name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.2.2 - name: Setup pnpm if: inputs.package-manager == 'pnpm' - uses: pnpm/action-setup@v4 + uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0 - name: Setup Node.js - uses: actions/setup-node@v4 + uses: actions/setup-node@1a4442cacd436585916779f2e4f56136f7a2b01e # v4.2.0 with: node-version: ${{ inputs.node-version || '22' }} cache: ${{ inputs.package-manager || 'npm' }}🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@templates/workflows/e2e-playwright.yml` around lines 66 - 71, The workflow uses mutable action tags for the "Checkout" and "Setup pnpm" steps (uses: actions/checkout@v4 and uses: pnpm/action-setup@v4); replace those mutable tags with pinned commit SHAs for each action (e.g., uses: actions/checkout@<commit-sha> and uses: pnpm/action-setup@<commit-sha>) by finding the corresponding action repository commits/releases and copying the full SHA, and update these two steps so they match the pinned approach used in claude.yml for supply-chain consistency.
86-87: Only Chromium browser installed—cross-browser tests will fail.The workflow installs only Chromium, but projects may configure Playwright for cross-browser testing (Firefox, WebKit). Consider adding a
browsersinput parameter for flexibility:Add configurable browser input
build-command: description: 'Build command (empty to skip)' type: string default: 'npm run build' + browsers: + description: 'Playwright browsers to install (space-separated)' + type: string + default: 'chromium'- name: Install Playwright browsers - run: npx playwright install --with-deps chromium + run: npx playwright install --with-deps ${{ inputs.browsers || 'chromium' }}🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@templates/workflows/e2e-playwright.yml` around lines 86 - 87, The workflow step "Install Playwright browsers" currently runs "npx playwright install --with-deps chromium" which only installs Chromium; change the workflow to accept a configurable input (e.g., inputs.browsers) and use that input in the install command so callers can request "chromium firefox webkit" or a subset; update the workflow metadata to add a "browsers" input with a sensible default like "chromium firefox webkit" and replace the hardcoded install command in the step (the step named "Install Playwright browsers") to reference the input variable when running the install.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@templates/husky/pre-push`:
- Around line 19-24: The pre-push hook's test invocation should use npm run
--if-present consistently and avoid Jest-specific flags; update the pre-push
script's test command (the npm run invocation in the husky pre-push hook) to
call npm run --if-present test --silent (omitting or making framework-specific
flags like --ci --passWithNoTests optional), so that absence of a test script
does not fail the push and non-Jest runners aren't fed Jest-only flags.
In `@templates/lintstagedrc-biome.json`:
- Around line 2-3: Update the staged file patterns to include YAML files so they
aren’t skipped: add "yaml" and "yml" to the formatting/check globs in
templates/lintstagedrc-biome.json (i.e., extend the existing "*.{json,md}" entry
to "*.{json,md,yaml,yml}" and also include yaml/yml in the check entry or add a
separate "*.{yaml,yml}" mapping to "biome format --write
--no-errors-on-unmatched" so Prettier/biome runs on YAML/YML staged files.
In `@templates/workflows/claude.yml`:
- Around line 83-96: The workflow's allowedTools list (the settings ->
"permissions" -> "allowedTools" array) lacks git permissions while the
claude_args system-prompt instructs Claude to push branches and run gh pr
create; either add the git permission (e.g., include Bash(git:*) in
allowedTools) so git push/pull/etc. are available to satisfy the system-prompt,
or modify the system-prompt in claude_args to remove/disable automated pushes
and instruct manual push/PR creation if git access is intentionally restricted.
- Around line 50-51: The condition in the workflow branch uses
github.event.issue.draft which doesn't exist for issues and thus the check never
works; update the logic in the clause that references github.event_name,
github.event.comment.body, github.event.issue.pull_request and
github.event.issue.draft to remove or replace the invalid draft check—either
drop the draft check entirely for issue_comment events (accepting draft PRs may
trigger), or switch to using the pull_request_review / pull_request_comment
event which exposes draft status, or implement an API call to fetch the PR and
inspect its draft field before deciding; ensure the final condition only relies
on valid fields (e.g., github.event.issue.pull_request and comment body) or
moves to an event that reliably exposes draft.
---
Nitpick comments:
In `@templates/husky/pre-push`:
- Around line 6-10: The pre-push hook currently silences TypeScript diagnostics
by redirecting stderr in the command `npm run --silent typecheck --if-present
2>/dev/null`; remove the `2>/dev/null` redirection so that `npm run --silent
typecheck --if-present` emits real error output on failure, and apply the same
change to the analogous `lint` and `test` invocations in this script so users
see the actual diagnostic details instead of only "TypeScript check failed".
In `@templates/workflows/e2e-playwright.yml`:
- Around line 66-71: The workflow uses mutable action tags for the "Checkout"
and "Setup pnpm" steps (uses: actions/checkout@v4 and uses:
pnpm/action-setup@v4); replace those mutable tags with pinned commit SHAs for
each action (e.g., uses: actions/checkout@<commit-sha> and uses:
pnpm/action-setup@<commit-sha>) by finding the corresponding action repository
commits/releases and copying the full SHA, and update these two steps so they
match the pinned approach used in claude.yml for supply-chain consistency.
- Around line 86-87: The workflow step "Install Playwright browsers" currently
runs "npx playwright install --with-deps chromium" which only installs Chromium;
change the workflow to accept a configurable input (e.g., inputs.browsers) and
use that input in the install command so callers can request "chromium firefox
webkit" or a subset; update the workflow metadata to add a "browsers" input with
a sensible default like "chromium firefox webkit" and replace the hardcoded
install command in the step (the step named "Install Playwright browsers") to
reference the input variable when running the install.
🪄 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: 3f7c794a-fb51-4e42-b509-fbf237ea2945
📒 Files selected for processing (12)
templates/README.mdtemplates/husky/commit-msgtemplates/husky/pre-committemplates/husky/pre-pushtemplates/lintstagedrc-biome.jsontemplates/lintstagedrc-eslint.jsontemplates/lintstagedrc-prettier-only.jsontemplates/prettierignoretemplates/prettierrc-base.jsontemplates/prettierrc-wide.jsontemplates/workflows/claude.ymltemplates/workflows/e2e-playwright.yml
- prettierrc-wide.json に jsxSingleQuote / quoteProps を明示追加 - husky/pre-push の --silent を除去し --if-present のコメントを明確化 - e2e-playwright.yml の actions を SHA ピン留めに統一 - e2e-playwright.yml のスタンドアロン用コメントを明確化 - husky テンプレートに実行権限を付与 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
(aside) |
|
Claude finished @keito4's task in 9m 54s —— View job タスク
調査結果と修正内容CI 失敗の原因:
修正内容(新規コミット
新しいコミットが CI をトリガーし、startup_failure が一時的な GitHub 内部エラーであれば今回のランでは解消される見込みです。 |
- lintstagedrc-biome.json: YAML/YML ファイルの prettier 処理を追加 - claude.yml: issue_comment での無効な Draft PR 判定を削除(github.event.issue.draft は存在しない) - claude.yml: allowedTools に Bash(git:*) を追加(システムプロンプトが git push を必要とするため) Co-authored-by: keito4 <keito4@users.noreply.github.com>
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 `@templates/workflows/claude.yml`:
- Line 4: The header comment claiming "Draft PRs are excluded" is inaccurate
because the issue_comment branch (the issue_comment workflow/job) lacks a
draft-PR guard; either update the header comment to state that Draft PRs are
generally excluded except for the issue_comment path, or add an explicit draft
check to the issue_comment branch so drafts are excluded consistently; locate
the top-of-file header comment and the issue_comment branch (the workflow
job/branch labeled issue_comment) and make the comment or logic change
accordingly.
- Around line 47-56: The current if condition controlling when the claude job
runs only filters out bots, allowing any external user to trigger a job that has
write permissions (contents, pull-requests, issues); update the condition used
for the claude job to also require the sender association be in a trusted set
(e.g., github.event.sender.association in
['OWNER','MEMBER','COLLABORATOR','CONTRIBUTOR'] or a narrower allowed list)
before granting write-scoped permissions, and ensure the permissions block for
the claude job remains write-only when that association check passes so
untrusted callers cannot trigger write access.
🪄 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: 3379993e-5859-4019-9c93-1e67443d8507
📒 Files selected for processing (2)
templates/lintstagedrc-biome.jsontemplates/workflows/claude.yml
🚧 Files skipped from review as they are similar to previous changes (1)
- templates/lintstagedrc-biome.json
|
(aside) |
|
Claude finished @keito4's task in 6m 18s —— View job タスク
調査結果CI ブロック原因: 新しいコミット 実施した修正(コミット
|
- templates/husky/pre-push: Jest固有フラグ(--ci --passWithNoTests)を除去し 汎用的な `npm run --if-present test` に変更 - templates/workflows/claude.yml: ヘッダーコメントを実態に合わせて修正 (issue_commentではDraft判定不可の旨を明記) - templates/workflows/claude.yml: OWNER/MEMBER/COLLABORATORのみ@claudeを 実行可能にする author_association チェックを追加(セキュリティ強化) Co-authored-by: keito4 <keito4@users.noreply.github.com>
|
(aside) |
|
Claude finished @keito4's task in 7m 57s —— View job タスク
調査結果と修正内容CI ブロック原因: 現在の HEAD( 修正内容(コミット
- "*.{js,jsx,ts,tsx,md,json,yaml,yml}": ["prettier --write"]
+ "*.{js,jsx,ts,tsx,css,md,json,yaml,yml}": ["prettier --write"]これにより ローカル品質ゲート:
|
lintstagedrc-eslint.json と整合させ css ファイルも Prettier フォーマット対象に追加。 CI paths filter (.json) にマッチさせ Quality Gate チェックを再トリガー。 Co-authored-by: keito4 <keito4@users.noreply.github.com>
|
(aside) |
|
Claude finished @keito4's task in 6m 6s —— View job タスク
調査結果と対応根本原因: 対応策: PR を close → reopen することで 現在のステータス
CIはすべて通過しています。ただし、ブランチ保護の設定で レビュー承認が必須( |
|
(aside) |
|
Claude finished @keito4's task in 5m 9s —— View job タスク
調査結果と対応CI の状況
実施した修正(コミット
|
エラー発生時に診断情報が見えるよう stderr 抑制を除去。 Co-authored-by: keito4 <keito4@users.noreply.github.com>
|
(aside) |
|
Claude finished @keito4's task in 3m 1s —— View job タスク
結果CI ステータスチェック(全件 ✅):
原因と対応根本原因: 対応: PR を close → reopen して
|
|
CI トリガーのため一時クローズ (Quality Gate 再実行) |
|
🎉 This PR is included in version 1.109.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Summary
追加テンプレート一覧
prettierrc-base.jsonprettierrc-wide.jsonprettierignorelintstagedrc-eslint.jsonlintstagedrc-biome.jsonlintstagedrc-prettier-only.jsonhusky/pre-commithusky/commit-msghusky/pre-pushworkflows/e2e-playwright.ymlworkflows/claude.ymlTest plan
npm run format:checkパスnpm run lintパスnpm test全95テストパス/repo-maintenanceで正しく検出されることを確認🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Documentation