Add ./loc wrapper for scoped cloc line counts - #208
Open
kyleve wants to merge 1 commit into
Open
Conversation
Introduce a repo-root script that counts tracked source via cloc, with scope flags for production, tests, snapshot tests, and tooling, plus area and content filters. Document it in AGENTS.md. Validation: ./loc, ./loc --prod-only --swift-only, ./loc --test-only, ./loc --tooling-only (manual smoke only; no test tier applies). Co-authored-by: Cursor <cursoragent@cursor.com>
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.
Summary
Adds
./loc, a small repo-root wrapper aroundclocfor counting lines of code in tracked sources while excluding dependency trees (.build/,Derived/, fetched skills, and other gitignored paths).Scope flags:
--all(default) — production, tests, snapshot tests, and tooling--prod-only—*/Sources/**--test-only—*/Tests/**and*/SnapshotTests/**(never__Snapshots__/PNG references)--snapshots-only— snapshot test Swift only--tooling-only— dev scripts,.bumper/,*/Tools/**, manifestsArea filters (
--where,--shared,--ledger,--repo) and content toggles (--swift-only,--include-docs,--include-data,--include-strings) narrow the set further. Extraclocoptions pass through after--.Also lists
locamong the repo-root dev scripts inAGENTS.md.Motivation
Quick, repeatable LOC reporting scoped to owned code — without hand-maintaining exclude lists or accidentally counting SPM checkouts / generated artifacts.
Validation
Manual smoke only (no applicable test tier):
./loc./loc --prod-only --swift-only./loc --test-only./loc --tooling-only./loc --helpRequires
cloc(brew install cloc).