Skip to content

Add code-hygiene checks: large-file, folder-size, em-dash, contrastive-parallelism#9

Merged
Miyamura80 merged 3 commits into
mainfrom
claude/keen-mendel-0zx19p
Jun 25, 2026
Merged

Add code-hygiene checks: large-file, folder-size, em-dash, contrastive-parallelism#9
Miyamura80 merged 3 commits into
mainfrom
claude/keen-mendel-0zx19p

Conversation

@Miyamura80

@Miyamura80 Miyamura80 commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

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 only scripts/check-ai-writing.ts (no .py/.sh AI-writing variants).

The invariant SOURCE_EXTS (scripts) ≡ files= regex (prek) ≡ paths: (CI) holds: \.(ts|tsx|js|jsx|mjs|cjs)$.

The four checks

  1. Large-file (scripts/check_large_files.sh) — fails when a source file exceeds the line-count error threshold (warn 500 / error 800).
  2. Folder-size (scripts/check_folder_sizes.sh) — fails when a folder has too many immediate source children (warn 20 / error 35).
  3. Em-dash + 4. Contrastive-parallelism (scripts/check-ai-writing.ts, run with bun) — 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

Layer Files
prek prek.toml (local hooks + upstream check-added-large-files); AI entry bun scripts/check-ai-writing.ts
CI .github/workflows/large-files.yaml, folder-size.yaml; new ai-writing job in ci.yaml (oven-sh/setup-bun@v2)
Cloud .claude/settings.json (SessionStart) + .claude/hooks/session-start.sh (installs bun → bun install → prek, scoped to CLAUDE_CODE_REMOTE)

Verification

  • bun scripts/check-ai-writing.ts → passes, excludes own source
  • prek run --all-files (local hooks) → AI-writing Passed, folder-sizes Passed
  • size scripts run correctly on the full tree

Note on pre-existing large files

6 existing animation files (862–1376 lines) exceed the 800-line threshold, so a full-tree check-large-files scan 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.lock since the repo uses npm.

  • New Features

    • Large-file and folder-size checks for *.ts|tsx|js|jsx|mjs|cjs (warn 500/20, error 800/35).
    • Writing style check flags em dash (U+2014) and “not just X, but Y” patterns; implemented in scripts/check-ai-writing.ts and run with bun.
    • Wired in prek (local), GitHub Actions (large-files.yaml, folder-size.yaml, ci.yaml with oven-sh/setup-bun@v2), and .claude session hook (installs bun and prek); ignore bun.lock to keep npm as the source of truth.
    • Note: 6 pre-existing animation files exceed 800 lines; checks only block when those files change.
  • Migration

    • Install bun locally and run bun install.
    • Run prek install once to enable local hooks.

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

Review in cubic

…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-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

claude added 2 commits June 25, 2026 19:06
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
@Miyamura80 Miyamura80 merged commit a036230 into main Jun 25, 2026
6 checks passed
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.

2 participants