Skip to content

refactor: src/ フォルダ命名を役割ベースに整理 (ADR-012) - #26

Merged
aloekun merged 1 commit into
masterfrom
refactor/rename-src-folders
Apr 6, 2026
Merged

refactor: src/ フォルダ命名を役割ベースに整理 (ADR-012)#26
aloekun merged 1 commit into
masterfrom
refactor/rename-src-folders

Conversation

@aloekun

@aloekun aloekun commented Apr 6, 2026

Copy link
Copy Markdown
Owner

Summary

  • hooks-push-pipelinecli-push-pipelinehooks-post-pr-monitorcli-pr-monitorhooks-report-formatterlib-report-formatter にリネーム
  • プレフィックス規約(hooks- / cli- / lib-)で、コーディング AI が src/ 一覧だけで各クレートの役割を判別可能に
  • build:hooksbuild:all にスクリプト名を変更(hooks 以外も含むため)
  • .gitignore を個別列挙から glob パターン(.claude/*.exe, src/*/target/)に簡素化
  • ADR-012 を新規追加、関連 ADR の旧名参照を一括更新

Test plan

  • pnpm push パイプライン通過(テスト + AI レビュー + push)
  • pnpm build:all で全 exe がビルドできること
  • pnpm deploy:hooks で派生プロジェクトに新名 exe が配布されること

🤖 Generated with Claude Code

Summary by CodeRabbit

リリースノート

  • Chores

    • ビルドコマンドを pnpm build:hooks から pnpm build:all に変更
    • 配布/ビルドスクリプトと npm スクリプトを hooks-* から cli-* バイナリ参照へ切替(コピー・実行コマンド更新)
    • .gitignore とデプロイスクリプトの生成・配布対象記述を更新
  • Documentation

    • ADR-012(src/命名規約)を追加し関連ADR/ドキュメント内のビルドコマンド・実行ファイル名表記を更新

@coderabbitai

coderabbitai Bot commented Apr 6, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

リポジトリ内でフック実行バイナリと共通ライブラリの命名規約を導入・適用し、hooks-*cli-* / lib-* へのリネームと、それに伴うビルドスクリプト(build:hooksbuild:all)、ドキュメント、設定、デプロイスクリプト、インポートの参照を一貫して更新しました。

Changes

Cohort / File(s) Summary
ドキュメント・ADR更新
CLAUDE.md, docs/adr/adr-001-hooks-implementation-language.md, docs/adr/adr-003-hooks-layout-and-build-strategy.md, docs/adr/adr-005-hooks-path-resolution-with-template.md, docs/adr/adr-006-config-driven-hooks.md, docs/adr/adr-008-push-pipeline-harness.md, docs/adr/adr-009-post-pr-monitor.md, docs/adr/adr-010-hooks-layout-and-build-strategy-v2.md, docs/adr/adr-012-src-naming-convention.md, docs/todo.md
ビルドコマンド参照をpnpm build:hookspnpm build:allに更新。バイナリ名の記述をhooks-...cli-...に置換。ADR-012を追加し命名規約を明文化。
設定・テンプレート・ignore
.claude/hooks-config.toml, .claude/settings.local.json.template, .gitignore
コメントと設定テンプレートの参照をhooks-*cli-*に変更、pnpmビルド参照をbuild:allに更新。.gitignore.claude/*.exesrc/*/target/等をグロブ化。
npmスクリプト・package設定
package.json
個別ビルドスクリプト名をbuild:hooks-*build:cli-*へ変更し、統合スクリプトをbuild:hooksbuild:allに差し替え。push/pr-create/mark-notified等の実行コマンド参照をcli-*.exeへ更新。
デプロイスクリプト
scripts/deploy-hooks.ts
配布対象の実行ファイル一覧をhooks-*.execli-*.exeに変更。ビルド未実行時の警告メッセージをpnpm build:allへ更新。
ライブラリクレート名変更
src/lib-report-formatter/Cargo.toml
クレート名をhooks-report-formatterlib-report-formatter、ライブラリ名hooks_report_formatterlib_report_formatterに変更。
CLIクレート名変更
src/cli-pr-monitor/Cargo.toml, src/cli-push-pipeline/Cargo.toml
クレート名をhooks-post-pr-monitorcli-pr-monitorhooks-push-pipelinecli-push-pipelineに変更(manifest 名称更新)。
ソース内インポート・実装調整
src/check-ci-coderabbit/Cargo.toml, src/check-ci-coderabbit/src/main.rs, src/cli-pr-monitor/src/main.rs, src/hooks-session-start/src/main.rs
依存先をhooks-report-formatterlib-report-formatterに差し替え。useパスをhooks_report_formatter::lib_report_formatter::へ変更。src/cli-pr-monitor/src/main.rsdrain_pipeの実装を行バッファリングからread_to_stringへ簡素化(行数上限削除)。セッション開始のドキュメントコメントをcli-pr-monitorへ更新。

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed プルリクエストのタイトルは「refactor: src/ フォルダ命名を役割ベースに整理 (ADR-012)」であり、変更セットの主要な内容(src/フォルダの命名規約をADR-012に基づいて役割ベースに整理し直すこと)を明確かつ簡潔に要約している。

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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.

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

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docs/adr/adr-003-hooks-layout-and-build-strategy.md`:
- Around line 59-63: The doc lists non-existent npm scripts
(`build:all-pre-tool-validate`, `build:all-post-tool-linter`,
`build:all-stop-quality`) which will fail; update the commands to match the
actual script names (`build:hooks-...` variants and `build:all`) used in
package.json and change the example command pattern line to the real invocation
format (`cd .claude/<dir> && cargo build --release && cp
target/release/<name>.exe ../<name>.exe`) so the section and the additional
steps (also around lines 90–94) consistently reference `build:hooks-*` and
`build:all` instead of the nonexistent `build:all-*` names.

In `@docs/adr/adr-005-hooks-path-resolution-with-template.md`:
- Line 40: The document still references the old npm script name `build:hooks`
on Line 58; update that mention to `build:all` so the text correctly matches the
package.json command names (e.g., change the sentence that currently reads
"`build:hooks` の末尾で自動実行されるため..." to use `build:all`), ensuring all occurrences
referring to the script that triggers the exe build and settings.local.json
generation are consistent with `build:all`.

In `@docs/adr/adr-010-hooks-layout-and-build-strategy-v2.md`:
- Around line 79-80: The ADR currently documents a non-existent script name
`pnpm build:all-<機能名>`; update the text to match the actual package.json scripts
by replacing references to `build:all-<機能名>` with the per-folder script format
`pnpm build:<フォルダ名>` and keep `pnpm build:all` for the aggregate build; ensure
every occurrence (including the repeated section around the later block that
currently lists `build:all-<機能名>`) is updated so examples, commands, and naming
conventions in the ADR align with the real scripts `build:<フォルダ名>` and
`build:all`.
🪄 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: cfab71ee-1d6f-4acd-a153-32f3f015fce8

📥 Commits

Reviewing files that changed from the base of the PR and between f1d2f1e and cc5bbe1.

⛔ Files ignored due to path filters (4)
  • src/check-ci-coderabbit/Cargo.lock is excluded by !**/*.lock
  • src/cli-pr-monitor/Cargo.lock is excluded by !**/*.lock
  • src/cli-push-pipeline/Cargo.lock is excluded by !**/*.lock
  • src/lib-report-formatter/Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (24)
  • .claude/hooks-config.toml
  • .claude/settings.local.json.template
  • .gitignore
  • CLAUDE.md
  • docs/adr/adr-001-hooks-implementation-language.md
  • docs/adr/adr-003-hooks-layout-and-build-strategy.md
  • docs/adr/adr-005-hooks-path-resolution-with-template.md
  • docs/adr/adr-006-config-driven-hooks.md
  • docs/adr/adr-008-push-pipeline-harness.md
  • docs/adr/adr-009-post-pr-monitor.md
  • docs/adr/adr-010-hooks-layout-and-build-strategy-v2.md
  • docs/adr/adr-012-src-naming-convention.md
  • docs/todo.md
  • package.json
  • scripts/deploy-hooks.ts
  • src/check-ci-coderabbit/Cargo.toml
  • src/check-ci-coderabbit/src/main.rs
  • src/cli-pr-monitor/Cargo.toml
  • src/cli-pr-monitor/src/main.rs
  • src/cli-push-pipeline/Cargo.toml
  • src/cli-push-pipeline/src/main.rs
  • src/hooks-session-start/src/main.rs
  • src/lib-report-formatter/Cargo.toml
  • src/lib-report-formatter/src/lib.rs

Comment thread docs/adr/adr-003-hooks-layout-and-build-strategy.md Outdated
Comment thread docs/adr/adr-005-hooks-path-resolution-with-template.md
Comment thread docs/adr/adr-010-hooks-layout-and-build-strategy-v2.md Outdated
- hooks-push-pipeline → cli-push-pipeline (CLIツール)
- hooks-post-pr-monitor → cli-pr-monitor (CLIツール)
- hooks-report-formatter → lib-report-formatter (共有ライブラリ)
- build:hooks → build:all (スクリプト名)
- .gitignore を個別列挙から glob パターン (.claude/*.exe, src/*/target/) に変更
- ADR-012: src/ ディレクトリの命名規約を追加

Fix: ADR-003/005/010 の build:all-* 誤変換を修正 (CodeRabbit review)
Fix: cli-pr-monitor の drain_pipe MAX_LINES=40 制限を撤廃 (JSON パースエラー対策)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@aloekun
aloekun force-pushed the refactor/rename-src-folders branch from cc5bbe1 to c27442c Compare April 6, 2026 11:41

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

🧹 Nitpick comments (1)
src/cli-pr-monitor/src/main.rs (1)

168-180: 無制限の出力読み取りに関する軽微なメモリリスク

read_to_string は出力全体をメモリに読み込むため、サブプロセスが大量の出力を生成した場合にメモリ問題を引き起こす可能性があります。

現状の使用コンテキスト(check-ci-coderabbit.exe の JSON 出力や gh コマンド)では出力サイズが制限されており、タイムアウト(60秒)も設定されているため実際のリスクは低いです。コメントで理由が説明されている点も良いです。

将来的に別のコマンドで再利用する場合は、出力サイズの上限チェックを検討してください。

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/cli-pr-monitor/src/main.rs` around lines 168 - 180, The drain_pipe
function reads the entire stream into memory via reader.read_to_string, which
can OOM if a subprocess emits huge output; modify drain_pipe (the spawned
closure) to enforce a maximum read size by wrapping the reader in
std::io::Read::take (or read into a buffer and stop after a configurable
MAX_BYTES), then return the truncated string (and optionally append a marker
like "...(truncated)"). Keep function signature and behavior otherwise the same,
and make MAX_BYTES a constant or configurable value so future callers (e.g.,
check-ci-coderabbit/gh) can adjust limits.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/cli-pr-monitor/src/main.rs`:
- Around line 168-180: The drain_pipe function reads the entire stream into
memory via reader.read_to_string, which can OOM if a subprocess emits huge
output; modify drain_pipe (the spawned closure) to enforce a maximum read size
by wrapping the reader in std::io::Read::take (or read into a buffer and stop
after a configurable MAX_BYTES), then return the truncated string (and
optionally append a marker like "...(truncated)"). Keep function signature and
behavior otherwise the same, and make MAX_BYTES a constant or configurable value
so future callers (e.g., check-ci-coderabbit/gh) can adjust limits.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f0e1234c-87dc-4653-a87d-8d15b994e81a

📥 Commits

Reviewing files that changed from the base of the PR and between cc5bbe1 and c27442c.

⛔ Files ignored due to path filters (4)
  • src/check-ci-coderabbit/Cargo.lock is excluded by !**/*.lock
  • src/cli-pr-monitor/Cargo.lock is excluded by !**/*.lock
  • src/cli-push-pipeline/Cargo.lock is excluded by !**/*.lock
  • src/lib-report-formatter/Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (24)
  • .claude/hooks-config.toml
  • .claude/settings.local.json.template
  • .gitignore
  • CLAUDE.md
  • docs/adr/adr-001-hooks-implementation-language.md
  • docs/adr/adr-003-hooks-layout-and-build-strategy.md
  • docs/adr/adr-005-hooks-path-resolution-with-template.md
  • docs/adr/adr-006-config-driven-hooks.md
  • docs/adr/adr-008-push-pipeline-harness.md
  • docs/adr/adr-009-post-pr-monitor.md
  • docs/adr/adr-010-hooks-layout-and-build-strategy-v2.md
  • docs/adr/adr-012-src-naming-convention.md
  • docs/todo.md
  • package.json
  • scripts/deploy-hooks.ts
  • src/check-ci-coderabbit/Cargo.toml
  • src/check-ci-coderabbit/src/main.rs
  • src/cli-pr-monitor/Cargo.toml
  • src/cli-pr-monitor/src/main.rs
  • src/cli-push-pipeline/Cargo.toml
  • src/cli-push-pipeline/src/main.rs
  • src/hooks-session-start/src/main.rs
  • src/lib-report-formatter/Cargo.toml
  • src/lib-report-formatter/src/lib.rs
✅ Files skipped from review due to trivial changes (13)
  • .claude/hooks-config.toml
  • docs/adr/adr-001-hooks-implementation-language.md
  • src/hooks-session-start/src/main.rs
  • src/check-ci-coderabbit/src/main.rs
  • CLAUDE.md
  • .claude/settings.local.json.template
  • docs/todo.md
  • docs/adr/adr-006-config-driven-hooks.md
  • src/lib-report-formatter/Cargo.toml
  • docs/adr/adr-012-src-naming-convention.md
  • docs/adr/adr-005-hooks-path-resolution-with-template.md
  • docs/adr/adr-003-hooks-layout-and-build-strategy.md
  • .gitignore
🚧 Files skipped from review as they are similar to previous changes (7)
  • src/cli-push-pipeline/Cargo.toml
  • src/cli-pr-monitor/Cargo.toml
  • src/check-ci-coderabbit/Cargo.toml
  • docs/adr/adr-008-push-pipeline-harness.md
  • docs/adr/adr-010-hooks-layout-and-build-strategy-v2.md
  • docs/adr/adr-009-post-pr-monitor.md
  • package.json

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