Skip to content

chore: lefthook で pre-push に CI 相当チェックを仕込む(#9)#71

Merged
yk-lab merged 1 commit into
mainfrom
chore/lefthook
Jul 7, 2026
Merged

chore: lefthook で pre-push に CI 相当チェックを仕込む(#9)#71
yk-lab merged 1 commit into
mainfrom
chore/lefthook

Conversation

@yk-lab

@yk-lab yk-lab commented Jul 6, 2026

Copy link
Copy Markdown
Owner

概要

push 前に typecheck / lint / test / build をローカル実行し、失敗を CI より先に(= CI minutes を使う前に)検出する(#9)。lefthook で 4 チェックを 並列実行(逐次より速く、どれが落ちたか一目)。

変更内容

  • lefthook.yml(新規): pre-push で typecheck / lint / test / build を parallel: true 実行
  • package.json: lefthook を devDependencies に
  • pnpm-workspace.yaml: allowBuilds で lefthook の postinstall を許可 → pnpm install で pre-push hook が自動インストール(postinstall が hook を sync)
  • CLAUDE.md: pre-push hook の説明を追記
  • TODO.md: [chore] lefthook で pre-push に npm run all を仕込む #9 を解決済みへ

補足(元 issue の前提更新)

元 issue の動機「dist 再ビルド忘れ → CI の dist 鮮度チェックで気づく」は #36 で dist/ がリリース時ビルド・未コミット化され前提消滅(鮮度チェックは存在しない)。本 PR は残る価値「CI と同じ判定をローカル再現」を実装。

検証

  • pnpm exec lefthook run pre-push --all-files で 4 ジョブ green
  • 本 PR の push 自体が pre-push hook を発火し typecheck/lint/test/build を通過(self-validating)
  • pnpm rebuild lefthook で hook 自動再作成を確認(fresh clone でも pnpm install で入る)
  • codex セカンドオピニオン:correctness 問題なし

参照

🤖 Generated with Claude Code


Summary by cubic

Add a lefthook pre-push hook that runs typecheck, lint, test, and build in parallel so CI failures are caught locally before pushing. This mirrors our CI checks and speeds feedback.

  • New Features

    • Pre-push hook runs pnpm run typecheck, lint, test, and build in parallel.
    • Auto-installed on pnpm install via allowBuilds in pnpm-workspace.yaml; run pnpm exec lefthook install if missing.
    • Added brief docs in CLAUDE.md; updated TODO.md to mark [chore] lefthook で pre-push に npm run all を仕込む #9 resolved.
  • Dependencies

    • Added lefthook to devDependencies.

Written for commit cf4f06a. Summary will update on new commits.

Review in cubic

@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

CLAUDE.md に lefthook の pre-push フックの動作説明(typecheck/lint/test/build の並列実行、pnpm exec lefthook install による復旧手順)を追記。TODO.md では Issue #9 を未対応セクションから解決済みセクションへ移動。

Changes

ドキュメント更新

Layer / File(s) Summary
pre-push フック説明の追加
CLAUDE.md
pnpm install により自動セットアップされる lefthook の pre-push フックが typecheck/lint/test/build を並列実行すること、フックが無い場合は pnpm exec lefthook install を実行する旨を追記。
Issue #9 のステータス更新
TODO.md
「未対応・進行中」表から Issue #9 の行を削除し、「備考: 既に解決した Issue」表へ解決 PR #71 として追加。

Estimated code review effort: 1 (Trivial) | ~2 minutes

Possibly related PRs

  • yk-lab/setup-task#48: 同様に TODO.md 上で「未対応・進行中」の Issue エントリを「備考: 既に解決した Issue」セクションへ移動する変更を行っている。

Poem

ぴょんと跳ねて pre-push フック
typecheck も lint も test もお任せあれ
CLAUDE.md に書き記し
TODO.md の #9 は卒業だ 🐇
うさぎも安心、コミット前夜

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed pre-pushでtypecheck/lint/test/buildを並列実行し、セットアップ文書も更新しており、#9の要件を満たしています。
Out of Scope Changes check ✅ Passed 要件に沿ったhook追加と文書/TODO更新のみで、明確な余計な変更は見当たりません。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed 主要変更である lefthook の pre-push チェック追加を簡潔に表しており、内容も一致しています。
Description check ✅ Passed 概要、関連 issue、検証内容が揃っており、テンプレートの必須情報をほぼ満たしています。
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/lefthook

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.

@cubic-dev-ai cubic-dev-ai 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.

No issues found across 6 files

Re-trigger cubic

push 前に typecheck / lint / test / build をローカル実行し、失敗を CI より先に
検出する。lefthook で 4 チェックを並列実行(逐次より速く、どれが落ちたか一目)。

- lefthook.yml(新規): pre-push で typecheck/lint/test/build を parallel 実行
- package.json: lefthook を devDependencies に
- pnpm-workspace.yaml: allowBuilds で lefthook の postinstall を許可
  (`pnpm install` で pre-push hook が自動インストールされる)
- CLAUDE.md: pre-push hook の説明を追記
- TODO.md: #9 を解決済み(#71)へ

補足: 元 issue の「dist 差分で fail」は #36 で dist 未コミット化され前提消滅。
本 PR は残る価値(CI 判定のローカル再現)を実装。lefthook run --all-files で
4 ジョブ green を確認済み。

Closes #9

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AECzAv2vcdATecuvLjBSa6
@yk-lab yk-lab merged commit 09bc073 into main Jul 7, 2026
19 of 20 checks passed
@yk-lab yk-lab deleted the chore/lefthook branch July 7, 2026 16:06
yk-lab added a commit that referenced this pull request Jul 7, 2026
## 概要

`TODO.md` は closed / open issue を手動でミラーしており、**GitHub Issues
と二重管理**になっていた。編集のたびにマージ衝突を生み(直近 #71 のリベースでも衝突)、維持コストが価値を上回っていた。

## 変更内容

- `TODO.md`(88 行 → 6 行): 状況は **GitHub Issues**、要件は `要求仕様書.md`、設計は
`企画書.md` を真実の源とするポインタに置換
- 手動ミラーしていた「Done / backlog / 解決済み」テーブルを撤去(GitHub が追跡しているため冗長)

## 補足

- 他ファイルからの `TODO.md` 参照は無し(`grep` 確認済み)
- この cleanup 自体は bookkeeping を減らす趣旨のため、あえて issue は起票していない

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Replaced the long `TODO.md` with a short pointer that moves task
tracking to GitHub Issues, with requirements in `要求仕様書.md` and design
decisions in `企画書.md`. This removes the manual issue mirror to prevent
duplicate sources and merge conflicts.

<sup>Written for commit 44884a2.
Summary will update on new commits.</sup>

<a
href="https://cubic.dev/pr/yk-lab/setup-task/pull/74?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="Review in cubic"
src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a>

<!-- End of auto-generated description by cubic. -->

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
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.

[chore] lefthook で pre-push に npm run all を仕込む

1 participant