Skip to content

Add ./loc wrapper for scoped cloc line counts - #208

Open
kyleve wants to merge 1 commit into
mainfrom
cursor/add-loc-script
Open

Add ./loc wrapper for scoped cloc line counts#208
kyleve wants to merge 1 commit into
mainfrom
cursor/add-loc-script

Conversation

@kyleve

@kyleve kyleve commented Aug 9, 2026

Copy link
Copy Markdown
Owner

Summary

Adds ./loc, a small repo-root wrapper around cloc for 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/**, manifests

Area filters (--where, --shared, --ledger, --repo) and content toggles (--swift-only, --include-docs, --include-data, --include-strings) narrow the set further. Extra cloc options pass through after --.

Also lists loc among the repo-root dev scripts in AGENTS.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 --help

Requires cloc (brew install cloc).

Open in Web Open in Cursor 

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