AIコーディングエージェント向けの共通規約基盤(AGENTS.md + Skills) - #6817
Conversation
AGENTS.md をベンダー中立な正典(single source of truth)とし、 Claude Code / Cursor / Codex CLI / Antigravity / Gemini CLI で共有できる コーディング規約・Skill の仕組みを導入する。 - AGENTS.md: 正典。旧 CLAUDE.md の内容を 4.4 正確版へ修正して移設 (XMLマッピング→PHP8属性, @route→#[Route], PHPStan level1→6) - CLAUDE.md / GEMINI.md: @AGENTS.md を参照する薄いポインタ(一方向・循環なし) - docs/rules/: レイヤ別規約の本文を1ソースで管理(初回は phpunit.md) - .claude/.codex/.agents/skills/: 各ツール用の発火スタブ(本文は docs/rules を参照) - tools/sync-ai-skills.php: スタブ同期スクリプト(symlink不使用・Windows安全・冪等) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
CIで既存コードを落とす方式は採らず、「書く時」と「実装直後」の 2点でFatコントローラ/責務分離の崩れを防ぐ第1段階(摩擦ゼロ)を導入する。 - docs/rules/controller.md: 薄いコントローラ/業務ロジックはServiceへ、の規約(4.4実コードで裏取り) - .claude/.codex/.agents/skills/eccube-controller: 実装時に規約を参照させる発火スタブ - .claude/.codex/.agents/skills/eccube-responsibility-review: 実装直後の責務分離レビュー - tools/check-fat-controller.php: 依存追加なしの助言用検査(メソッド長/コンストラクタ依存数/persist・flush直書き) - AGENTS.md / docs/rules/README.md: 索引と方針を更新 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Skill命名規則を導入: eccube-接頭辞を廃止。レイヤ規約系はトピック名 (controller/service/phpunit)、人が実行するアクション系は動詞前置 (review-responsibility)に統一 - docs/rules/service.md: Service責務規約(単一責任/HTTP非依存/Controller依存禁止)を追加 - skills/service: Service実装時に規約を参照させる発火スタブを追加 - review-responsibility: controller専用から全層(Controller+Service)レビューへ一般化 - tools/check-fat-controller.php → tools/check-architecture.php に一般化 (Serviceのメソッド長/依存数/Controller依存=レイヤ違反も検査) - AGENTS.md / docs/rules/README.md: 索引・命名規則・方針を更新 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
enterpriseの「マイグレーションを作らない」はOSS 4.4には当てはまらない。 OSSはEntity属性をスキーマの源泉としつつ、既存環境へ届けるため app/DoctrineMigrations/にマイグレーションを作成する(実例: Version20260316234241)。 - docs/rules/migration.md: スキーマ源泉=Entity属性、変更時は冪等な マイグレーションを同一PRで追加(up/down両実装、hasTable/hasColumnガード)、 初期データはimport_csv、を4.4実コードで裏取りして規約化 - skills/migration: スキーマ変更時に規約を参照させる発火スタブ - AGENTS.md / docs/rules/README.md: 索引を更新 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
4.4実コードで裏取りして規約化: - entity.md: AbstractEntity継承/PHP8属性マッピング/class_existsラッパ/ setter fluent/dtb_mtb_命名/スキーマ変更はmigration連携/Customizeはtrait - repository.md: AbstractRepository<T>継承/QueryBuilder+setParameterバインド/ getQueryBuilderBySearchData/save・delete/データアクセスに専念 - formtype.md: AbstractType/getBlockPrefix():string必須/FormEvents/ data_class/CSRF維持/既存拡張はFormTypeExtension - skills/entity・repository・formtype: 各規約への発火スタブ - AGENTS.md / docs/rules/README.md: 索引を更新 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
twig/css/js/yamlは責務分離・バックエンド品質の本筋から外れるため作らない。 未完成・約束に見える「順次追加予定」を排し、「必要になった観点を必要なときに 同じ構成で追加する」方針に変更。 Co-Authored-By: Claude Opus 4.8 (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:
📝 WalkthroughWalkthroughEC-CUBE 4.4 向けの統合的なコーディング規約体系を導入。AI エージェント用共通ハブ(AGENTS.md)、レイヤ別実装規約 8 種(Controller/Service/Entity/FormType/Repository/Migration/PHPUnit/review-responsibility)、スキル配布インフラ(symlink)を追加した。 ChangesEC-CUBE 4.4 開発規約とアーキテクチャガバナンス
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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 |
- AGENTS.md: ルーティング属性の FQCN を実コードに合わせて修正 (Symfony\Component\Routing\Annotation\Route → Attribute\Route。 src/Eccube では Attribute\Route が 68 件、Annotation は 0 件) - docs/rules/controller.md: Route 名前空間の二重記述を解消し FQCN は共通規約に一本化 (末端ドキュメントは上流を参照し返さない一方向ルールを維持)。 例の `final class` をコア慣習(0/71 が final)に合わせて除去。getUser() が Symfony 親クラス由来である旨を明記 - docs/rules/README.md: ディレクトリ図の `eccube-<layer>` を実ディレクトリ/命名ルールに合わせ `<layer>` へ修正 - tools/check-architecture.php: --changed が未追跡(add 前)の新規 Controller/Service も 拾うよう git ls-files --others を追加 - tools/sync-ai-skills.php: ファイル削除で空になったディレクトリを掃除 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
.codex/.agents 配下は .claude/skills を正本に同期生成される一方向の生成物だが、 ファイル単体では正本がどこか分からず、誤って生成先を編集すると次回 sync で 静かに上書き消失する動線だった。全コピー(正本含む)の冒頭(フロントマター直後)に 同一の自動生成マーカーを入れ、どのコピーを開いても「正本は .claude、生成先は 直接編集しない」と分かるようにする。マーカーは全コピー同一内容のため sync --check の整合比較は壊れない。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- CI: tools/sync-ai-skills.php --check を実行する再利用ワークフローを追加し、 main.yml の lint 段(rector/phpstan/php-cs-fixer と同列・unit/e2e の前段ゲート)に組み込む。 正本 .claude/skills と .codex/.agents の同期忘れを検知する(標準PHPのみ・composer不要)。 - docs/rules/controller.md: 認可・CSRF 観点を追記。 認可=admin ファイアウォール(^/%eccube_admin_route%/)配下に置く(コアは #[IsGranted] 不使用)、 CSRF=GET 以外の状態変更/削除/Ajax は $this->isTokenValid() を検証、という実慣習を明文化。 - docs/rules/entity.md: 例の use ブロックに Doctrine\DBAL\Types\Types の import を補完 (Types::INTEGER を使う例だが import が抜けていた)。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
レビュー: 規約本文(docs/rules)の方針についてこの規約基盤について、AIエージェントに「ツールでは補えない判断・ドメイン知識」を 1.【要修正】migration.md / entity.md が EC-CUBE のスキーマ運用と逆を教えている現状の EC-CUBE のアップデートは 2段構えです(doc4 アップデート手順):
つまり単純なカラム追加に ALTER マイグレーションは不要(schema:update が拾う)。
修正方針:
2.【方針】機械が扱える内容は規範化せず、ツール実行に委ねるツールが検出・整形・計測できるものを Skill の散文で重ねて持つと、コンテキストを食う上に 開発フローとして PR #6761( (a) 整形・変換系: 以下は rector / phpstan / php-cs-fixer が扱うので、個別の散文や
代わりに各規約へ「実装後にローカルで実行すること」を一貫した短い形で記す: (#6761 マージ後は pre-commit が同じチェックを自動実行) (b) 数値メトリクス(代理指標):
これにより Skill は「ツールが見られない判断・ドメイン知識」に集中でき、 3.【拡充】EC-CUBE 固有のドメイン知識を厚くするツールで補えない知識こそ Skill の本来価値ですが、現状は薄めです:
|
PR #6817 のレビュー(#issuecomment-4655303640)に対応。 1. スキーマ運用の誤りを修正(要修正) - 「カラム追加=マイグレーション」を撤回し、schema:update --force → migrations:migrate の2段構えを明記。単純なカラム追加にALTERは不要。 - マイグレーションの用途をマスタ/初期データのINSERTと、型変更・リネーム等 schema:updateで扱えない構造変更に限定。 - 生成コマンドを migrations:diff から migrations:generate(空雛形を手書き)へ。 - 手本コードをALTER ADDからmtb_sale_typeへの冪等なINSERT例に差し替え。 2. 機械が扱える内容はツールへ委譲 - 「約50行/約7依存」の数値メトリクスを散文から削除し質的シグナルへ転換。 計測は tools/check-architecture.php に一本化。 - rector/phpstan/php-cs-fixer のローカル実行節を新設(PR #6761 pre-commit を参照)。 3. EC-CUBE固有のドメイン知識を拡充 - service.md に PurchaseFlow パイプライン節を追加。 - entity.md に状態ロジック(Entity可)と処理(PurchaseFlow/Service)の線引き、 getId() が nullable な理由を追記。 - AGENTS.md に SaleType / OrderItem明細種別 / Shipping のドメイン用語集を追加。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
migration.md / migration スキルで、マスタ・初期データの追加手順が 「CSVを足すだけ」と誤解されないよう補強した。 - import_csv の CSV は eccube:fixtures:load(インストール時のみ実行・ composer auto-scripts に非搭載)で投入されるため、CSV 追記だけでは 既存環境の DB に届かない。既存環境へは INSERT マイグレーションで配布する。 - よって マスタ/初期データ追加は CSV 追記 + INSERT マイグレーションを 同一 PR で両方行う、と用途・反映タイミングを表で明示。 - 実例を 2021 年の PR #4912 から 2024-03 の Version20240312170000 (dtb_block + dtb_block.csv を同時追加)に更新。INSERT マイグレーション運用は 2022〜2024 年も継続中であることを補足。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
レビュー指摘の3語(SaleType/OrderItemType/Shipping)に加え、 コードで裏取りした上でAIエージェントが誤りやすい根幹概念を補強した。 - 受注ステータス(OrderStatus): PROCESSING/PENDING は確定前の仮受注で、 OrderHelper はカート確定入口で PROCESSING の受注を生成し購入完了で NEW へ遷移。 集計・一覧は OrderStatusFilter で除外。「Order=確定済み」の誤解を防ぐ。 - ProductClass と「規格なし商品」: 在庫・価格は ProductClass 単位。規格を持たない 商品も内部的に ProductClass を1つ持つ(hasProductClass で判定)。 - 単一テーブル継承(STI)と discriminator_type: mtb_*/dtb_block 等で必須。 INSERT マイグレーションでの指定漏れを防ぐ。 - Payment/Delivery: 受注の基本マスタ。利用可否は SaleType に依存。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
@nanasess
2. ツールへの委譲
3. ドメイン知識の拡充
引き続きドラフトですので、方向性も含めご意見ください。 |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (8)
tools/check-architecture.php (1)
198-204: ⚡ Quick win
persist/flushとuse ...Controller...の検出が文字列/コメントでも誤検知します。生テキスト正規表現だとコメント・文字列リテラルも拾うため、助言品質が下がります。
token_get_all()の結果でT_COMMENT/T_DOC_COMMENT/T_CONSTANT_ENCAPSED_STRINGを除外して判定する実装に寄せるのが安全です。🤖 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 `@tools/check-architecture.php` around lines 198 - 204, The current regex checks (the preg_match_all calls that search $code for '->\s*(persist|flush)\s*\(' when $isController and for '\buse ...Controller' when $isService) wrongly match inside comments and string literals; change the implementation to first run token_get_all($code), filter out tokens T_COMMENT, T_DOC_COMMENT and T_CONSTANT_ENCAPSED_STRING (and optionally T_ENCAPSED_AND_WHITESPACE), reconstruct the remaining source text, and then run the existing preg_match_all checks against that cleaned text so only real code is inspected.AGENTS.md (1)
34-68: 💤 Low valueMarkdown linting: Fenced code block に言語指定を追加してください。
34行目の
```(開始)に言語指定がありません。ディレクトリ構造を示すブロックなので、textまたは言語なしでも構いませんが、markdownlint の警告を解消するには以下のように修正できます。📝 修正案
## ディレクトリ構成 -``` +```text src/Eccube/ # コアアプリケーション Controller/ # HTTP コントローラ(管理画面・フロント)🤖 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 `@AGENTS.md` around lines 34 - 68, The fenced code block that starts with "```" (showing the directory tree) is missing a language specifier; update the opening fence to include a language (e.g., change "```" to "```text") in AGENTS.md so markdownlint warnings are resolved while keeping the directory-listing content unchanged.Source: Linters/SAST tools
docs/rules/README.md (1)
13-18: 💤 Low valueMarkdown linting: Fenced code block に言語指定を追加してください。
13行目の
```に言語指定がありません。ディレクトリ構造を示すブロックなので、textを指定できます。📝 修正案
-``` +```text docs/rules/<layer>.md ← 規約の本文(実体・1 ソース) .claude/skills/<layer>/SKILL.md ← Claude Code 用スタブ🤖 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 `@docs/rules/README.md` around lines 13 - 18, The fenced code block in the README lacks a language specifier; open the README's triple-backtick block that contains the directory listing and add the language identifier text immediately after the opening backticks (i.e., change ``` to ```text) so markdown linters recognize it; also scan for any other plain ``` blocks in the same file and apply the same fix for consistency.Source: Linters/SAST tools
docs/rules/formtype.md (2)
61-62: ⚡ Quick win管理画面検索フォームでのCSRF保護の根拠を明確化
管理画面の検索フォームでCSRF保護を維持する理由が明示されていません。一般的に、GETメソッドで状態を変更しない検索フォームではCSRF保護は不要とされることが多いですが、EC-CUBEで異なる方針を採る場合は、その根拠(例:POSTメソッド使用、状態変更を伴う検索、過去のセキュリティインシデント等)を記載すると、開発者が方針を理解しやすくなります。
🤖 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 `@docs/rules/formtype.md` around lines 61 - 62, Update the docs/rules/formtype.md paragraph about keeping CSRF enabled to explicitly state the rationale: explain whether admin search forms in this project may use POST or perform state-changing actions (or reference past security incidents) and why that requires keeping 'csrf_protection' => true in configureOptions(), or conversely cite that GET-only, side-effect-free searches are allowed to omit CSRF; mention configureOptions() and the 'csrf_protection' => true default so readers can locate the implementation point. Keep the explanation concise and factual so developers understand the policy and where to change it.
53-54: ⚡ Quick win
notInRangeMessage使用の根拠を明記
Range制約で min/max 両方指定時にnotInRangeMessageを使う理由が明記されていません。これがSymfonyのベストプラクティスなのか、EC-CUBE固有の要件なのか、またその背景(デフォルトメッセージとの違い、ユーザー体験の向上等)を補足すると、規約の理解が深まります。🤖 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 `@docs/rules/formtype.md` around lines 53 - 54, The doc line mentions using validation constraints like Assert\NotBlank and using Range with notInRangeMessage when both min and max are set but lacks rationale; update the docs to explicitly state that when using the Range constraint with both min and max specified you should set notInRangeMessage because Symfony uses that single combined message for out-of-range values (providing clearer, single-message UX compared to separate min/max messages), and clarify whether this guidance is Symfony-native behavior or an EC-CUBE convention (and note the difference from the default messages and the UX benefit).tools/sync-ai-skills.php (3)
72-72: 💤 Low valueエラー抑制演算子の使用を避け、明示的な存在チェックを推奨。
@unlink()はファイルが存在しない場合だけでなく、権限エラーなど他の問題も抑制します。冪等性のためならfile_exists()チェックの方が意図が明確です。♻️ 改善案
foreach (array_keys($dstFiles) as $rel) { - `@unlink`($target.'/'.$rel); + $path = $target.'/'.$rel; + if (file_exists($path)) { + unlink($path); + } }🤖 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 `@tools/sync-ai-skills.php` at line 72, Replace the error-suppressed unlink call (`@unlink`($target.'/'.$rel)) with an explicit existence and type check before calling unlink: first build the path variable (e.g., $path = $target . '/' . $rel), use file_exists() or is_file() to confirm the file is present, then call unlink($path) and handle/ log any failure (e.g., check the return value and emit an error or throw) instead of suppressing errors with @; this keeps behavior idempotent and surfaces permission or other unlink errors.
49-49: ⚡ Quick win
file_get_contents()の戻り値をチェックしていない。
file_get_contents()が失敗した場合はfalseを返すため、文字列キャストすると空文字列になります。読み込み失敗を検出できず、誤った同期結果になる可能性があります。🛡️ 改善案: 戻り値チェックの追加
if ($file->isFile()) { $rel = substr($file->getPathname(), strlen($base) + 1); - $files[$rel] = (string) file_get_contents($file->getPathname()); + $content = file_get_contents($file->getPathname()); + if ($content === false) { + fwrite(STDERR, "failed to read: {$file->getPathname()}\n"); + exit(1); + } + $files[$rel] = $content; }🤖 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 `@tools/sync-ai-skills.php` at line 49, file_get_contents() の戻り値を直接キャストしているため失敗時に false が空文字列に変換されて検出できません; まず file_get_contents($file->getPathname()) を変数(例: $contents)に代入して === false をチェックし、失敗時は適切にログ出力または例外を投げて処理を中止/スキップし、成功時のみ $files[$rel] に文字列を格納するように修正してください(参照箇所: file_get_contents, $files, $rel, $file->getPathname())。
79-79: ⚡ Quick win
file_put_contents()の戻り値チェックがない。書き込み失敗(ディスク容量不足、権限エラー等)を検出できず、不完全な同期のまま成功と報告される可能性があります。
🛡️ 改善案: 戻り値チェックの追加
$path = $target.'/'.$rel; if (!is_dir(dirname($path))) { mkdir(dirname($path), 0o775, true); } - file_put_contents($path, $content); + if (file_put_contents($path, $content) === false) { + fwrite(STDERR, "failed to write: {$path}\n"); + exit(1); + } }🤖 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 `@tools/sync-ai-skills.php` at line 79, file_put_contents($path, $content) の戻り値をチェックして書き込み失敗を検出するように修正してください: file_put_contents が false を返した場合にエラーログを出力し(例: processLogger や error_log を使う)、必要なら例外を投げて同期処理を中断するかリトライ/クリーンアップを行うようにし、成功時は返却値(書き込まれたバイト数)を利用して期待通り書き込めたか確認してください(参照箇所: file_put_contents, $path, $content)。
🤖 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/sync-ai-skills.yml:
- Around line 15-16: The Checkout step using
actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd currently does not set
persist-credentials; update the "Checkout" step (the actions/checkout
invocation) to include persist-credentials: false so the default GITHUB_TOKEN
credentials are not persisted to the repository git config for downstream steps
that may run PR code.
In `@tools/check-architecture.php`:
- Line 177: The code casts file_get_contents($file) to string which hides
failures; change the logic around the $code assignment to first call $contents =
file_get_contents($file) and check if $contents === false, then emit a
warning/error mentioning $file (e.g. using your existing logger or
fwrite(STDERR, ...)) and skip parsing this file instead of casting to an empty
string; only set $code = (string)$contents when the read succeeded so the
check-architecture flow doesn’t treat unreadable files as empty code.
---
Nitpick comments:
In `@AGENTS.md`:
- Around line 34-68: The fenced code block that starts with "```" (showing the
directory tree) is missing a language specifier; update the opening fence to
include a language (e.g., change "```" to "```text") in AGENTS.md so
markdownlint warnings are resolved while keeping the directory-listing content
unchanged.
In `@docs/rules/formtype.md`:
- Around line 61-62: Update the docs/rules/formtype.md paragraph about keeping
CSRF enabled to explicitly state the rationale: explain whether admin search
forms in this project may use POST or perform state-changing actions (or
reference past security incidents) and why that requires keeping
'csrf_protection' => true in configureOptions(), or conversely cite that
GET-only, side-effect-free searches are allowed to omit CSRF; mention
configureOptions() and the 'csrf_protection' => true default so readers can
locate the implementation point. Keep the explanation concise and factual so
developers understand the policy and where to change it.
- Around line 53-54: The doc line mentions using validation constraints like
Assert\NotBlank and using Range with notInRangeMessage when both min and max are
set but lacks rationale; update the docs to explicitly state that when using the
Range constraint with both min and max specified you should set
notInRangeMessage because Symfony uses that single combined message for
out-of-range values (providing clearer, single-message UX compared to separate
min/max messages), and clarify whether this guidance is Symfony-native behavior
or an EC-CUBE convention (and note the difference from the default messages and
the UX benefit).
In `@docs/rules/README.md`:
- Around line 13-18: The fenced code block in the README lacks a language
specifier; open the README's triple-backtick block that contains the directory
listing and add the language identifier text immediately after the opening
backticks (i.e., change ``` to ```text) so markdown linters recognize it; also
scan for any other plain ``` blocks in the same file and apply the same fix for
consistency.
In `@tools/check-architecture.php`:
- Around line 198-204: The current regex checks (the preg_match_all calls that
search $code for '->\s*(persist|flush)\s*\(' when $isController and for '\buse
...Controller' when $isService) wrongly match inside comments and string
literals; change the implementation to first run token_get_all($code), filter
out tokens T_COMMENT, T_DOC_COMMENT and T_CONSTANT_ENCAPSED_STRING (and
optionally T_ENCAPSED_AND_WHITESPACE), reconstruct the remaining source text,
and then run the existing preg_match_all checks against that cleaned text so
only real code is inspected.
In `@tools/sync-ai-skills.php`:
- Line 72: Replace the error-suppressed unlink call (`@unlink`($target.'/'.$rel))
with an explicit existence and type check before calling unlink: first build the
path variable (e.g., $path = $target . '/' . $rel), use file_exists() or
is_file() to confirm the file is present, then call unlink($path) and handle/
log any failure (e.g., check the return value and emit an error or throw)
instead of suppressing errors with @; this keeps behavior idempotent and
surfaces permission or other unlink errors.
- Line 49: file_get_contents() の戻り値を直接キャストしているため失敗時に false が空文字列に変換されて検出できません;
まず file_get_contents($file->getPathname()) を変数(例: $contents)に代入して === false
をチェックし、失敗時は適切にログ出力または例外を投げて処理を中止/スキップし、成功時のみ $files[$rel]
に文字列を格納するように修正してください(参照箇所: file_get_contents, $files, $rel,
$file->getPathname())。
- Line 79: file_put_contents($path, $content) の戻り値をチェックして書き込み失敗を検出するように修正してください:
file_put_contents が false を返した場合にエラーログを出力し(例: processLogger や error_log
を使う)、必要なら例外を投げて同期処理を中断するかリトライ/クリーンアップを行うようにし、成功時は返却値(書き込まれたバイト数)を利用して期待通り書き込めたか確認してください(参照箇所:
file_put_contents, $path, $content)。
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: e7821fe2-ddbf-4466-870b-291c006d9ee7
📒 Files selected for processing (39)
.agents/skills/controller/SKILL.md.agents/skills/entity/SKILL.md.agents/skills/formtype/SKILL.md.agents/skills/migration/SKILL.md.agents/skills/phpunit/SKILL.md.agents/skills/repository/SKILL.md.agents/skills/review-responsibility/SKILL.md.agents/skills/service/SKILL.md.claude/skills/controller/SKILL.md.claude/skills/entity/SKILL.md.claude/skills/formtype/SKILL.md.claude/skills/migration/SKILL.md.claude/skills/phpunit/SKILL.md.claude/skills/repository/SKILL.md.claude/skills/review-responsibility/SKILL.md.claude/skills/service/SKILL.md.codex/skills/controller/SKILL.md.codex/skills/entity/SKILL.md.codex/skills/formtype/SKILL.md.codex/skills/migration/SKILL.md.codex/skills/phpunit/SKILL.md.codex/skills/repository/SKILL.md.codex/skills/review-responsibility/SKILL.md.codex/skills/service/SKILL.md.github/workflows/main.yml.github/workflows/sync-ai-skills.ymlAGENTS.mdCLAUDE.mdGEMINI.mddocs/rules/README.mddocs/rules/controller.mddocs/rules/entity.mddocs/rules/formtype.mddocs/rules/migration.mddocs/rules/phpunit.mddocs/rules/repository.mddocs/rules/service.mdtools/check-architecture.phptools/sync-ai-skills.php
- sync-ai-skills.yml: checkout に persist-credentials: false を追加し GITHUB_TOKEN の永続化を防止 - check-architecture.php: file_get_contents の false を明示処理し、読込失敗ファイルを空コード扱いしない Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
シンボリックリンク利用でOK。 |
レビュー指摘(シンボリックリンク利用でOK)を受け、Skillスタブ同期の仕組みを見直す。 - 規約本文を docs/rules/*.md から各 .claude/skills/<name>/SKILL.md へ一本化 (発火時に詳細が必要なため、要点スタブと本文を分ける二層を廃止) - .codex/skills・.agents/skills を .claude/skills への symlink(../.claude/skills)に変更 - コピー同期スクリプト tools/sync-ai-skills.php と同期CI sync-ai-skills.yml を削除し main.yml の job/needs から除去 - docs/rules/ を廃止し、AGENTS.md / GEMINI.md / tools/check-architecture.php の参照を .claude/skills/*/SKILL.md へ張り替え Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
廃止した docs/rules/README.md にあった「規約の書き方」指針を、新規Skill追加者向けに AGENTS.md のレイヤ別規約セクションへ1行で取り込む。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
「メソッド50行/依存7個」の数値しきい値判定は、規約が掲げる「数値で線を引かない (質的シグナルで判断する)」方針と矛盾するため、tools/check-architecture.php を廃止する。 - tools/check-architecture.php を削除(tools/ 配下は空になり消滅) - controller / service SKILL から「計測はツールの仕事」「数値メトリクス」の記述と ツール実行例を除去(整形・型・変換は rector/phpstan/php-cs-fixer に委ねる旨は維持) - review-responsibility SKILL の手順1(ツールによる機械的可視化)を廃止し、 persist/flush 直書き・レイヤ違反の検査観点は目視レビューのチェックリストへ統合 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
概要
複数の AI コーディングエージェント(Claude Code / Cursor / Codex CLI / Google Antigravity / Gemini CLI)で共有できる、EC-CUBE 4.4 のコーディング規約基盤を追加します。
AGENTS.mdをベンダー中立な正典とし、レイヤ別規約をdocs/rules/に 1 ソースで管理、各ツールには「Skill」として薄い発火スタブを配置します。なぜ
CLAUDE.md等)は他 CLI から読めない。規約の本文は 1 ソースに集約し、各ツールは自分の作法でそこを参照する形にしたい。設計のポイント
AGENTS.md(最も横断対応が広い)。CLAUDE.md/GEMINI.mdは@AGENTS.mdを参照する薄いポインタに変更(参照は一方向・循環なし)。docs/rules/*.md(純 Markdown・GitHub でも読める)。常時ロードせずオンデマンド。SKILL.md形式は 4 ツール共通。フォルダだけ異なるため.claude/を正本に.codex/.agents/へ同期(symlink は Windows で壊れるため不使用)。追加した規約 / Skill
docs/rules/)Fat 化・責務分離の方針(重要)
CI で既存コードを落とす方式は採りません(既存の巨大コントローラを fail させるとコントリビュートの妨げになるため)。第1段階として、
に留めます。将来、合意が取れれば PHPMD / Deptrac + ベースラインで段階的に強化できる余地を残しています。
補足
🤖 Generated with Claude Code
Summary by CodeRabbit
リリースノート