Skip to content

chore(ai): 🤖 AIツール設定の最適化とサーチサービス連携の導入 - #101

Merged
genzouw merged 5 commits into
mainfrom
chore/ai-tool-optimization-15915065158647014581
May 23, 2026
Merged

genzouw merged 5 commits into
mainfrom
chore/ai-tool-optimization-15915065158647014581

Conversation

@genzouw

@genzouw genzouw commented May 23, 2026

Copy link
Copy Markdown
Owner

概要

生成AIツールの活用とCI/CDパイプラインでの自動化品質を向上させるため、最新の設定とサーチサービスとの連携を導入しました。

変更内容

  • PR-Agent (Qodo Merge) の最適化: 最新のモデルと機能を活用するため、GitHub Actions のバージョンを @main にアップデートしました。
  • サーチサービス連携 (RAG): Pinecone を使用した Vector DB 連携を .pr_agent.toml で有効化し、過去の Issue や PR を検索してより精度の高いレビューと修正提案ができるようにしました。
  • AI 開発環境のコンテキスト共有: Cursor や GitHub Copilot などモダンなAIエディタ向けに、.cursorrules および .github/copilot-instructions.md を追加しました。これにより「monopo」の呼称徹底や、セキュリティルール(getSecureRandomIntの利用など)、フロントエンド構成を事前にAIに学習させます。
  • セキュリティ対策強化: .gitignore.cursor/, .claude/ などの AI ツール関連の作業ディレクトリや、.env, *.tfstate などの機密ファイルを追加し、誤ってコミットされるのを防ぎます。

マージ前の手動事前作業 (重要)

この PR をマージし、Qodo Merge のサーチサービスを完全に機能させるには、GitHub リポジトリの Secrets に Pinecone の API キー を設定する必要があります。

  1. Pinecone に登録(無料枠利用)し、API キーを発行してください。
  2. 対象リポジトリの Settings > Secrets and variables > Actions に移動します。
  3. 新しいリポジトリシークレットとして以下を追加してください:
    • Name: PINECONE_API_KEY
    • Secret: 発行されたAPIキーの値

PR created automatically by Jules for task 15915065158647014581 started by @genzouw

Summary by CodeRabbit

リリースノート

  • Documentation

    • 日本語のコーディング/運用ガイドライン(「monopo」表記、JSDoc要件、乱数・localStorage・空状態の運用指針等)を追加しました(.github/copilot-instructions.md、.cursorrules)。
    • PRエージェント設定を追加しました(.pr_agent.toml)。
  • Chores

    • CI ワークフローを更新し実行条件とアクション参照を変更、環境変数設定を追加しました(.github/workflows/pr-agent.yml)。
    • .gitignore を強化し機密・AIワークスペースを除外しました。

Review Change Stack

- Qodo Merge (旧 PR-Agent) のバージョンを `@main` にアップデートし、最新機能を有効化
- Pinecone を利用した Vector DB 検索 (RAG) 機能を設定し、過去 Issue や PR を参照可能に設定
- `auto_best_practices` および各種自動化機能を有効化
- `.cursorrules` と `.github/copilot-instructions.md` を追加し、生成AIによるコードアシストにプロジェクト規約(日本語、セキュリティ、アーキテクチャ)を強制
- `.gitignore` に AI エージェントの作業ディレクトリおよび機密ファイル (`.env`, `*.tfstate` 等) を追加して漏洩を防止

Co-authored-by: genzouw <29957+genzouw@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@gemini-code-assist

Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

本プルリクエストは、開発効率とコード品質の向上を目的として、AI ツール設定の最適化と外部サーチサービスとの連携を導入するものです。プロジェクト全体で一貫したコーディング規約を AI に学習させるための設定ファイルを追加し、PR-Agent の機能を拡張することで、より文脈に沿った自動レビューと提案が可能になります。

Highlights

  • AI 開発環境の最適化: .cursorrules および .github/copilot-instructions.md を導入し、AI エディタに対してプロジェクト固有のコーディング規約、セキュリティルール、および技術スタックを明示しました。
  • サーチサービス連携 (RAG) の導入: .pr_agent.toml を更新し、Pinecone を用いた Vector DB 連携を有効化することで、過去の Issue や PR を活用した高精度なレビュー支援を実現しました。
  • セキュリティ対策の強化: .gitignore に機密ファイル(.env, *.tfstate 等)および AI ツール関連の作業ディレクトリを追加し、誤コミットを防止する設定を行いました。
Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/pr-agent.yml
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@qodo-code-review

Copy link
Copy Markdown

Review Summary by Qodo

AI開発ツール統合とQodo Mergeの最適化設定

✨ Enhancement 📝 Documentation

Grey Divider

Walkthroughs

Description
• AI開発ツール向けのコーディングガイドラインを新規追加
• Qodo Mergeの最新バージョンへアップデートし自動化機能を有効化
• Pinecone Vector DBを統合したRAG検索機能を設定
• プロジェクト規約(日本語、セキュリティ、技術スタック)をAIに強制
Diagram
flowchart LR
  A["PR-Agent設定"] -->|バージョンアップ| B["Qodo Merge @main"]
  B -->|自動化有効化| C["自動レビュー・説明生成"]
  D["Pinecone API"] -->|RAG検索| E["過去Issue/PR参照"]
  E -->|精度向上| C
  F["AIガイドライン"] -->|Cursor/Copilot| G["プロジェクト規約強制"]
  G -->|品質保証| C

Loading

File Changes

1. .cursorrules 📝 Documentation +22/-0

Cursorエディタ向けAIガイドライン設定

• Cursorエディタ向けのAIコーディングガイドラインを新規作成
• 日本語記述、monopo命名規則、React/Vite/TypeScript技術スタックを定義
• セキュリティ要件(getSecureRandomInt使用)とJSDocコメント記述を強制
• GitHub ActionsでBunランタイムの使用を指定

.cursorrules


2. .github/copilot-instructions.md 📝 Documentation +27/-0

GitHub Copilot向けAIガイドライン設定

• GitHub Copilot向けのAIコーディングガイドラインを新規作成
• .cursorrules と同一内容で、プロジェクト規約をCopilotに学習させる
• 言語ルール、技術スタック、セキュリティ、テスト/CI/CDガイドラインを記載
• localStorage検証やセキュア乱数生成の要件を明記

.github/copilot-instructions.md


3. .github/workflows/pr-agent.yml ✨ Enhancement +2/-1

Qodo Mergeへのアップグレードと連携設定

• PR-Agentアクション参照を the-pr-agent/pr-agent@e6ef3c0adfbe1c5ffc6818f8dd420c74c8dc6ea8 から
 qodo-ai/pr-agent@main に変更
• Pinecone API キーを環境変数として追加し、RAG検索機能を有効化
• 最新のQodo Merge機能を利用可能に

.github/workflows/pr-agent.yml


View more (1)
4. .pr_agent.toml ⚙️ Configuration changes +15/-0

Qodo Merge自動化とPinecone RAG設定

auto_review, auto_describe, auto_improve を有効化し自動化機能を強化
• Pinecone Vector DBを vectordb として設定し、過去500件のIssueを検索対象に
• auto_best_practices を有効化してベストプラクティスの自動提案を実装
• GitHub Actionsトリガーを「opened」「reopened」「ready_for_review」「synchronize」に設定

.pr_agent.toml


Grey Divider

Qodo Logo

@qodo-code-review

qodo-code-review Bot commented May 23, 2026

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (4) 📘 Rule violations (0)

Grey Divider


Action required

1. Unpinned action reference 🐞 Bug ⛨ Security
Description
PR Agent ワークフローが qodo-ai/pr-agent@main を参照しており、外部アクションの実行コードがレビューなしに変化し得ます。さらに当該ジョブは write 権限と
Secrets を伴うため、サプライチェーン侵害時にリポジトリ改変や Secrets 悪用の影響が大きくなります。
Code

.github/workflows/pr-agent.yml[19]

Evidence
問題箇所は @main の浮動参照で、同ファイル内に write 権限と Secrets 注入が存在します。加えて、同リポジトリの他ワークフローでは actions
をSHA固定しており、本変更がセキュリティ基準から外れていることが確認できます。

.github/workflows/pr-agent.yml[9-23]
.github/workflows/ci.yml[13-27]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`.github/workflows/pr-agent.yml` が `qodo-ai/pr-agent@main` を使用しており、外部アクションの内容がブランチ更新で無告知に変わります。write 権限と Secrets を渡しているため、想定外のコード実行リスクが高いです。

## Issue Context
このリポジトリ内の他ワークフローは action をコミットSHAで pin しています(例: CI で `actions/checkout@<sha>` 等)。同等の運用に揃えるべきです。

## Fix Focus Areas
- .github/workflows/pr-agent.yml[18-23]

## Suggested fix
- `uses: qodo-ai/pr-agent@main` を、リリースタグまたはコミットSHA(推奨)に置き換えてください(例: `uses: qodo-ai/pr-agent@<commit_sha>`)。
- 可能なら Dependabot の `github-actions` updates を有効化して、更新をPR経由にしてください。

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Unrestricted comment trigger 🐞 Bug ⛨ Security
Description
ワークフローが issue_comment の作成/編集で実行され、Bot 以外をすべて許可しているため、誰のコメントでも PR Agent が起動します。外部 API
キー(OPENAI/Pinecone)を利用する処理が走るため、意図しない実行・コスト増・PR/Issue への書き込み実行が第三者により誘発され得ます。
Code

.github/workflows/pr-agent.yml[R16-23]

Evidence
issue_comment が created/edited で有効化されており、同ジョブが write 権限を持つこと、かつ Secrets が env
として投入されることが同一ファイル内で確認できます。これによりコメント経由での任意起動が成立します。

.github/workflows/pr-agent.yml[3-23]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`issue_comment` イベントで無条件に PR Agent を実行しており(Bot 以外)、任意のコメントで外部APIを伴う処理が起動します。ジョブには `pull-requests: write` / `issues: write` が付与されているため、悪用/誤爆の影響が大きいです。

## Issue Context
現状は comment 本文のコマンド判定や、`author_association` による実行者制限がありません。

## Fix Focus Areas
- .github/workflows/pr-agent.yml[3-16]
- .github/workflows/pr-agent.yml[9-12]

## Suggested fix
- `issue_comment` での実行を、特定コマンド(例: `/pr-agent`)を含む場合のみに限定してください。
- 併せて `github.event.comment.author_association` が `OWNER`/`MEMBER`/`COLLABORATOR` の場合のみ実行するガードを追加してください。
- さらに運用上不要なら `issue_comment` トリガー自体を削除し、`pull_request` の自動実行のみに寄せてください。

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

3. Pinecone secret not validated 🐞 Bug ☼ Reliability
Description
vectordb = "pinecone" を強制しつつ PINECONE_API_KEY を Secrets から注入していますが、Secret
未設定時の検証/分岐がありません。Secret が空の状態でジョブが起動すると PR Agent 側の Pinecone 連携処理がエラーになり、ワークフローが失敗する可能性があります。
Code

.pr_agent.toml[R10-15]

Evidence
Pinecone の利用が設定ファイルで固定され、workflow でも Secret を無条件に参照しています。未設定時の分岐が存在しないため、空値での実行経路が残ります。

.pr_agent.toml[10-15]
.github/workflows/pr-agent.yml[18-23]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Pinecone 連携が必須設定になっている一方で、`PINECONE_API_KEY` 未設定時の fail-fast/skip の制御がありません。環境によっては空値で実行され、ジョブ失敗や機能不全になります。

## Issue Context
- `.pr_agent.toml` で `vectordb = "pinecone"` を指定
- workflow で `PINECONE_API_KEY` を常に env 注入

## Fix Focus Areas
- .pr_agent.toml[10-15]
- .github/workflows/pr-agent.yml[18-23]

## Suggested fix
- ワークフローに「Secret 未設定ならスキップ/明示的に失敗させる」チェックを追加してください(例: `if: ${{ secrets.PINECONE_API_KEY != '' }}` を step/job に付与、または事前 `run` で検証してわかりやすいエラーメッセージで終了)。
- Pinecone を必須にしない運用なら、`.pr_agent.toml` 側で Pinecone なしの動作にフォールバックできる設定(vectordb 無効化等)に変更してください。

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Advisory comments

4. Comment edits retrigger runs 🐞 Bug ➹ Performance
Description
issue_commentedited を含むため、コメントの誤字修正などでも PR Agent ジョブが再実行されます。コマンド判定がない現状では不要な実行が発生し、LLM
呼び出しコストとノイズが増えます。
Code

↗ .github/workflows/pr-agent.yml

Evidence
ワークフロー定義上、issue_commenttypes: [created, edited] が設定されており、編集イベントがそのままトリガーになることが確認できます。

.github/workflows/pr-agent.yml[3-8]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`issue_comment` の `types` に `edited` が含まれており、コメント編集でもワークフローが走ります。現状はコメント本文でのコマンド判定がないため、意図しない再実行が起きます。

## Issue Context
コストと実行回数を抑える観点で、`created` のみにするか、`edited` を残すならコマンド検出を入れる必要があります。

## Fix Focus Areas
- .github/workflows/pr-agent.yml[6-8]

## Suggested fix
- `issue_comment.types` から `edited` を削除してください。
- もしくは `edited` を残す場合は `if:` で特定コマンドが含まれる時のみ実行する条件を追加してください。

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Qodo Logo

@coderabbitai

coderabbitai Bot commented May 23, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: fa54b206-b6a0-4d97-9815-1a9747904d6d

📥 Commits

Reviewing files that changed from the base of the PR and between 06a26b2 and 1dab7d2.

📒 Files selected for processing (3)
  • .cursorrules
  • .github/copilot-instructions.md
  • .github/workflows/pr-agent.yml

📝 Walkthrough

ウォークスルー

Cursor/Copilot 向けのコーディングガイドラインと機密除外ルールを追加し、PR Agent のワークフロー参照と実行条件を更新、PR エージェント設定を日本語応答で有効化します。

変更内容

開発環境・CI自動化設定

Layer / File(s) Summary
IDE・AI アシスタント開発ガイドライン
.cursorrules, .github/copilot-instructions.md
Cursor/Copilot 用の統一ガイドラインを日本語で追加。命名を「monopo」表記に固定、Bun/React/Vite/TypeScript/CSS Modules を推奨、JSDoc 要件、動的リストの空状態明示、Math.random() 禁止と src/game/random.ts の安全乱数利用、localStorage の深い検証、CI では oven-sh/setup-bun を使用する旨を定義します.
セキュリティと環境隔離
.gitignore
機密ファイル(.env, *.pem, *.tfstate, credentials 等)と AI エージェント関連ワークスペース(.cursor/, .claude/, .continue/, .aider*, .jules/ 等)を除外パターンに追加します。
PR Agent 自動審査と GitHub Actions 設定
.github/workflows/pr-agent.yml, .pr_agent.toml
PR Agent ワークフローの実行条件を pull_request コンテキストの issue_comment 投稿者権限(OWNER/MEMBER/COLLABORATOR)に限定、アクション参照を更新し PINECONE_API_KEY を env に追加。.pr_agent.toml で応答言語を ja-JP に固定し自動レビュー/説明/改善と類似イシュースキャン設定を有効化します.

推定レビュー所要時間

🎯 3 (Moderate) | ⏱️ ~20 minutes

関連する可能性のあるPR

  • genzouw/monopo#99: PR Agent の自動審査導入に関連し、同じ .github/workflows/pr-agent.yml.pr_agent.toml の設定を扱っています。
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR タイトルは AI ツール設定の最適化とサーチサービス連携という主要な変更を正確に要約しており、変更セットの主点を明確に反映しています。
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 chore/ai-tool-optimization-15915065158647014581

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

Comment thread .github/workflows/pr-agent.yml Outdated
Comment thread .github/workflows/pr-agent.yml Outdated

@gemini-code-assist gemini-code-assist 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.

Code Review

このプルリクエストは、AIコーディングガイドラインの導入と関連ツールの設定を目的としています。具体的には、.cursorrules.github/copilot-instructions.md への規約追加、.gitignore への機密ファイル除外、.pr_agent.toml の設定が行われました。フィードバックでは、ガイドライン内でのツール名の不整合(CodeRabbitとPR-Agent)の修正、AIツール関連PRの命名規則の文脈の明確化、および設定ファイル間での重複内容を外部ファイルへ共通化することによる保守性の向上が提案されています。

Comment thread .cursorrules Outdated
Comment thread .cursorrules Outdated
Comment thread .github/copilot-instructions.md

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

🤖 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 @.github/workflows/pr-agent.yml:
- Line 19: Replace the floating action reference "uses: qodo-ai/pr-agent@main"
with a pinned commit SHA to mitigate supply-chain risk: locate the workflow line
containing uses: qodo-ai/pr-agent@main and change it to uses:
qodo-ai/pr-agent@<commit-sha> using a specific commit SHA from the
qodo-ai/pr-agent repository (obtain the SHA from that repo's commits/tags), then
commit the updated workflow so the CI always runs that exact action version.
🪄 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: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: eab42db8-f6b8-496f-ba04-99ad657437b2

📥 Commits

Reviewing files that changed from the base of the PR and between c591f93 and 06a26b2.

📒 Files selected for processing (5)
  • .cursorrules
  • .github/copilot-instructions.md
  • .github/workflows/pr-agent.yml
  • .gitignore
  • .pr_agent.toml

Comment thread .github/workflows/pr-agent.yml Outdated
@genzouw
genzouw enabled auto-merge (squash) May 23, 2026 23:18
genzouw added 4 commits May 24, 2026 08:22
外部 GitHub Action `qodo-ai/pr-agent@main` は可変参照で、ブランチ更新により
告知なしに実行コードが差し替わるサプライチェーンリスクがあります。
特に当該ジョブは write 権限と OPENAI_KEY/PINECONE_API_KEY などの Secrets を
扱うため、影響が大きいため commit SHA で固定します。

レビューコメント: #101 (comment)
レビュアー: qodo-code-review, coderabbitai
優先度: high
issue_comment イベントで PR Agent が無条件に起動していたため、第三者の
任意コメントから OPENAI/Pinecone API を呼ぶ処理と PR/Issue への書き込みが
誘発され得る状態でした。author_association が OWNER/MEMBER/COLLABORATOR の
場合に限定し、また Issue 本体(PR でない issue)のコメントは除外します。

レビューコメント: #101 (comment)
レビュアー: qodo-code-review
優先度: high
PR で導入するのは PR-Agent (Qodo Merge) だが、リポジトリでは CodeRabbit も
並行して動作しているため、特定ツール名を直書きせず「AIコードレビュー」と
一般化した表現に修正します。.cursorrules と .github/copilot-instructions.md
の両方を同期して更新します。

レビューコメント: #101 (comment)
レビュアー: gemini-code-assist
優先度: low
`chore(ai): 🤖 AIツール設定の最適化` は AI ツール関連の例であり、
「セキュリティ関連のPR」の例として記載されているのは文脈不整合のため、
「AIツール関連のPR」に修正します。.cursorrules と
.github/copilot-instructions.md の両方を同期して更新します。

レビューコメント: #101 (comment)
レビュアー: gemini-code-assist
優先度: low
@genzouw
genzouw merged commit b83440b into main May 23, 2026
15 checks passed
@genzouw
genzouw deleted the chore/ai-tool-optimization-15915065158647014581 branch May 23, 2026 23:26
genzouw added a commit that referenced this pull request May 24, 2026
## Summary

- `.cursorrules` と `.github/copilot-instructions.md` の内容重複(PR #101
のレビュー指摘)を解消するため、マスタドキュメント `docs/ai-guidelines.md` から両ファイルを自動生成する Bun +
TypeScript ベースの同期スクリプトを導入しました
- 将来 `CLAUDE.md` 等を追加する際は `scripts/sync-ai-guidelines.ts` の `TARGETS`
配列にエントリを 1 行追加するだけで対応可能な拡張可能設計
- CI 上で同期ずれを検証する `ai-guidelines-sync` ジョブを追加(差分時は復旧手順を出力して非 0 終了)

## 変更ファイル

| ファイル | 種別 | 説明 |
|---|---|---|
| `docs/ai-guidelines.md` | 新規 | AI ツール共通のマスタガイドライン |
| `scripts/sync-ai-guidelines.ts` | 新規 | Bun + TypeScript
同期スクリプト(`--check` モード対応) |
| `.cursorrules` | 更新 | マスタから再生成(先頭に自動生成警告ヘッダー付与) |
| `.github/copilot-instructions.md` | 更新 | 同上 |
| `.github/workflows/ci.yml` | 更新 | `ai-guidelines-sync` ジョブを追加 |
| `package.json` | 更新 | `sync:ai-guidelines` /
`sync:ai-guidelines:check` スクリプト追加 |
| `README.md` | 更新 | 編集手順を追記 |

## 設計判断

- **Bun + TypeScript 採用理由**: プロジェクトの主要スタックと整合性が高く、型安全に `TARGETS`
配列の拡張ができるため
- **マスタを 1 ファイルに集約**: Issue 想定では `docs/ai-guidelines/`
ディレクトリ階層もあり得たが、現時点ではツール固有差分がないためシンプルな単一マスタとした(将来必要になった時点で `overrides/`
を追加すれば足りる)
- **pre-commit フックには組み込まない**: 既存 `lint-staged` との競合や CI との二重実行を避けるため、CI
検証+手動実行で運用

## Test plan

- [x] `bun run sync:ai-guidelines` を実行し `.cursorrules` /
`.github/copilot-instructions.md` が再生成されることを確認
- [x] `bun run sync:ai-guidelines:check` が同期状態で `exit 0` を返すことを確認
- [x] `bun run lint` / `bun run format:check` / `bun run typecheck`
がすべて通過
- [x] `actionlint .github/workflows/ci.yml` 通過
- [ ] CI で `AI Guidelines Sync Verification` ジョブが緑になることを確認

Closes #102

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Documentation**
  * AIコーディングアシスタント向けのガイドライン文書を追加し、設定・運用手順やベストプラクティスを明記。
  * READMEに同期および同期検証コマンドと手順を追記。

* **Chores**
  * マスター文書から対象ファイルを自動生成/同期する仕組みを導入。
  * 自動生成ヘッダーを追加して編集不可を明示。
  * 同期状態を検証するCIジョブを追加し自動チェックを実行。

<!-- review_stack_entry_start -->

[![Review Change
Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/genzouw/monopo/pull/103?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack)

<!-- review_stack_entry_end -->
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant