Skip to content

Add source-size guardrails for folder count and file line count#132

Merged
Miyamura80 merged 3 commits into
masterfrom
add/source-size-guardrails
Apr 23, 2026
Merged

Add source-size guardrails for folder count and file line count#132
Miyamura80 merged 3 commits into
masterfrom
add/source-size-guardrails

Conversation

@Miyamura80

@Miyamura80 Miyamura80 commented Apr 23, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Folder-size CI workflow (.github/workflows/folder-size.yaml): runs on PRs touching .rs files, checks that no single directory has too many flat Rust siblings (warn at 20, error at 35).
  • Large-file CI workflow (.github/workflows/large-files.yaml): runs on PRs touching .rs files, checks that no source file exceeds the line-count threshold (warn at 500, error at 800).
  • Shared bash scripts (scripts/check_folder_sizes.sh, scripts/check_large_files.sh): reusable scripts consumed by both GitHub Actions and local prek hooks. Support --all mode and per-file mode, produce GitHub step summaries, and respect grandfathered paths.
  • Prek hooks (prek.toml): added check-large-files and check-folder-sizes hooks so the same checks run locally on every commit.
  • Folder-refactor-advisor subagent (.claude/agents/folder-refactor-advisor.md, .codex/agents/folder-refactor-advisor.toml): advisory-only agent that diagnoses oversized folders and proposes three concrete subfolder restructurings when the CI check fails.
  • CLAUDE.md updates: added prek install instructions at the top and a pointer to the folder-refactor-advisor subagent.

Test plan

  • Push a PR with a folder containing >35 .rs files and verify the folder-size workflow fails
  • Push a PR with a .rs file >800 lines and verify the large-files workflow fails
  • Run scripts/check_folder_sizes.sh --all and scripts/check_large_files.sh --all locally and confirm clean exit (0)
  • Verify prek hooks fire on git commit for staged .rs files

🤖 Generated with Claude Code


Open in Devin Review

CI workflows and shared bash scripts that warn at 20 files/500 lines
and error at 35 files/800 lines for .rs sources. Existing violations
are grandfathered. Prek hooks mirror CI locally. Includes a
folder-refactor-advisor subagent for when the check fires.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

@devin-ai-integration devin-ai-integration 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.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 4 additional findings.

Open in Devin Review

Miyamura80 and others added 2 commits April 23, 2026 22:50
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Miyamura80 Miyamura80 merged commit 15099f8 into master Apr 23, 2026
3 of 4 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.

1 participant