Add code-hygiene checks: large-file, folder-size, em-dash, contrastive-parallelism#9
Merged
Merged
Conversation
…e-parallelism Port four code-hygiene checks wired across three layers (prek, GitHub Actions, and Claude Code cloud SessionStart) for this TypeScript repo: - scripts/check_large_files.sh line-count limit on source files - scripts/check_folder_sizes.sh file-count limit per source folder - scripts/check-ai-writing.ts fails on em dash (U+2014) and the "not just X, but Y" contrastive-parallelism AI-writing tells (run with bun) Layers kept in sync (SOURCE_EXTS == prek files= == CI paths:): - prek.toml local hooks + upstream check-added-large-files - .github/workflows/large-files.yaml, folder-size.yaml - ci.yaml ai-writing job (oven-sh/setup-bun@v2) - .claude/settings.json + hooks/session-start.sh installs bun + prek Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MU1QZGzFYtmHwQ1SohHryA
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
Satisfies the repo's prettier config (.prettierrc.yaml: singleQuote, semi:false) so format:check passes in the quality and Node 24 CI jobs. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MU1QZGzFYtmHwQ1SohHryA
The SessionStart hook runs `bun install` to provide the bun runtime for scripts/check-ai-writing.ts, which generates bun.lock. This repo's package manager is npm (package-lock.json is committed, CI uses npm ci), so the bun lockfile should not be tracked. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MU1QZGzFYtmHwQ1SohHryA
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Port four code-hygiene checks into this repo, each wired across three kept-in-sync layers: prek (local git hooks), GitHub Actions (PR-time CI), and Claude Code on the web/cloud (SessionStart hook).
Stack
Detected TypeScript (
package.json+tsconfig.json). Committed to the TS row everywhere —SOURCE_EXTS=(ts tsx js jsx mjs cjs), Bun toolchain — and created onlyscripts/check-ai-writing.ts(no.py/.shAI-writing variants).The invariant
SOURCE_EXTS(scripts) ≡files=regex (prek) ≡paths:(CI) holds:\.(ts|tsx|js|jsx|mjs|cjs)$.The four checks
scripts/check_large_files.sh) — fails when a source file exceeds the line-count error threshold (warn 500 / error 800).scripts/check_folder_sizes.sh) — fails when a folder has too many immediate source children (warn 20 / error 35).scripts/check-ai-writing.ts, run withbun) — fails on—(U+2014) and the "not just X, but Y" AI-writing tells. Excludes its own source so the patterns don't self-trip.Wiring
prek.toml(local hooks + upstreamcheck-added-large-files); AI entrybun scripts/check-ai-writing.ts.github/workflows/large-files.yaml,folder-size.yaml; newai-writingjob inci.yaml(oven-sh/setup-bun@v2).claude/settings.json(SessionStart) +.claude/hooks/session-start.sh(installs bun →bun install→ prek, scoped toCLAUDE_CODE_REMOTE)Verification
bun scripts/check-ai-writing.ts→ passes, excludes own sourceprek run --all-files(local hooks) → AI-writing Passed, folder-sizes PassedNote on pre-existing large files
6 existing animation files (862–1376 lines) exceed the 800-line threshold, so a full-tree
check-large-filesscan reports them. Thresholds were left at the standard 500/800 rather than inflated to hide debt. This is the intended ratchet: PR-time CI and the pre-commit hook only check changed files, so these trip only when one is edited — this PR's own changes pass cleanly.🤖 Generated with Claude Code
Generated by Claude Code
Summary by cubic
Add code-hygiene guardrails: line limits, folder file-count limits, and a writing style check for em dashes and contrastive patterns. Formatted the writing check to match repo Prettier rules and ignored
bun.locksince the repo usesnpm.New Features
*.ts|tsx|js|jsx|mjs|cjs(warn 500/20, error 800/35).scripts/check-ai-writing.tsand run withbun.prek(local), GitHub Actions (large-files.yaml,folder-size.yaml,ci.yamlwithoven-sh/setup-bun@v2), and.claudesession hook (installsbunandprek); ignorebun.lockto keepnpmas the source of truth.Migration
bunlocally and runbun install.prek installonce to enable local hooks.Written for commit bac6451. Summary will update on new commits.