Skip to content

Add code-hygiene checks (large-file, folder-size, AI-writing) across prek + CI + cloud#7

Merged
Miyamura80 merged 3 commits into
mainfrom
claude/intelligent-keller-y3fkgy
Jun 29, 2026
Merged

Add code-hygiene checks (large-file, folder-size, AI-writing) across prek + CI + cloud#7
Miyamura80 merged 3 commits into
mainfrom
claude/intelligent-keller-y3fkgy

Conversation

@Miyamura80

@Miyamura80 Miyamura80 commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Ports four code-hygiene checks into this repo, each wired at three layers kept in sync (prek, GitHub Actions, Claude Code cloud).

Checks

  1. Large-file check — fail when a source file exceeds a line-count threshold (warn 500 / error 800).
  2. Folder-size check — fail when a folder has too many immediate source children (warn 20 / error 35).
  3. Em-dash checker — fail on (U+2014) anywhere in the repo.
  4. Contrastive-parallelism checker — fail on the "not just X, but Y" AI-writing tell.

This repo is Rust, so the rs stack was used throughout: SOURCE_EXTS=(rs), prek files = \.(rs)$, CI paths: '**.rs' — all the same extension set.

Files

scripts/
  check_large_files.sh      line-count guard (SOURCE_EXTS=rs)
  check_folder_sizes.sh     folder-fanout guard (SOURCE_EXTS=rs)
  check_ai_writing.sh       em-dash + contrastive parallelism (ripgrep, git-grep fallback; no build)
prek.toml                   upstream check-added-large-files + 3 local hooks
.github/workflows/
  large-files.yaml          Large File Check
  folder-size.yaml          Folder Size Check
  ci.yml                    + AI writing check step
.claude/
  settings.json             SessionStart -> hooks/session-start.sh
  hooks/session-start.sh    cargo fetch + prek install (remote-session guarded)

Only the Rust AI-writing impl exists (no .py/.ts variants).

Notes

  • Replaced 27 pre-existing em dashes in ARCHITECTURE.md, CONTRIBUTING.md, README.md, SECURITY.md with hyphens so the em-dash check passes on a clean tree.
  • No contrastive-parallelism hits in the existing tree, so the full high-confidence pattern set is kept (including goes beyond / so much as).

Verification (all exit 0)

  • check_large_files.sh --all — clean; daemon.rs (645) and env_store.rs (555) warn but stay under the 800 error threshold.
  • check_folder_sizes.sh --all — clean.
  • check_ai_writing.sh — passes on both the rg and git grep paths.
  • prek run --all-files — the three local hooks pass.

🤖 Generated with Claude Code


Generated by Claude Code


Summary by cubic

Add repo-wide hygiene checks for large Rust sources (file length, folder fan-out, and writing-style patterns) running in local prek, GitHub Actions, and cloud editor sessions. Warn/error thresholds: 500/800 lines per file and 20/35 files per folder.

  • New Features

    • Shell checks for large files, folder size, and writing style scoped to *.rs.
    • GitHub Actions: new Large File and Folder Size workflows; AI-writing step in ci.yml.
    • Local and cloud: prek.toml hooks; .claude SessionStart installs Rust, sets PATH, installs prek, runs cargo fetch.
  • Bug Fixes

    • Docs merge with main: adopted the rewritten Components section and README badges; re-applied the hyphen sweep across docs and docs/architecture.svg to pass the writing check.
    • Cloud: ensure ~/.cargo/bin is on PATH and source ~/.cargo/env after a fresh install so cargo fetch and checks run reliably.

Written for commit 638b7a0. Summary will update on new commits.

Review in cubic

…prek + CI + cloud

Port four hygiene checks wired at three layers kept in sync:
- check_large_files.sh / check_folder_sizes.sh: line-count and folder-fanout
  guards (SOURCE_EXTS=rs), shared by prek and GitHub Actions.
- check_ai_writing.sh: fail on em dashes (U+2014) and contrastive-parallelism
  constructions; pure ripgrep with a git-grep fallback, no build needed.
- prek.toml: local hooks plus upstream check-added-large-files.
- large-files.yaml / folder-size.yaml workflows and an AI-writing step in ci.yml.
- .claude SessionStart hook installs prek so cloud commits run the same checks.

Replace existing em dashes in the docs with hyphens so the AI-writing check
passes on a clean tree.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017wmfUGTZR6HFL78eSjYxBU
@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 →

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

1 issue found across 13 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread .claude/hooks/session-start.sh Outdated
claude added 2 commits June 25, 2026 23:19
rustup installs cargo to ~/.cargo/bin, which the hook never added to PATH,
so `cargo fetch` would fail on a clean machine. Add ~/.cargo/bin to PATH
(persisted to CLAUDE_ENV_FILE), source ~/.cargo/env after a fresh install,
and split the install/fetch off the `||` one-liner so fetch only runs once
cargo is resolvable.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017wmfUGTZR6HFL78eSjYxBU
Resolve doc conflicts by taking main's rewritten Components section
(role diagram replacing the on-disk file tree) and README badges block.
Re-apply the em-dash sweep to the merged docs and the new
docs/architecture.svg so the AI-writing check stays green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017wmfUGTZR6HFL78eSjYxBU
@Miyamura80 Miyamura80 merged commit fcc9d7a into main Jun 29, 2026
2 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