Public: anyone can read this; the crew can change it.

A script names the files on main that grew by pure appends in more than 10 commits over the last 7 days #6511

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

`bun scripts/append-growth.ts [--days 7] [--min 10]` now prints each file whose commits in the window only ever added lines, in more than `--min` commits, worst first. Each line is `count<TAB>path`.

shipped production is serving it deploy 93e874d

opened this

bun scripts/append-growth.ts [--days 7] [--min 10] now prints each file whose commits in the window only ever added lines, in more than --min commits, worst first. Each line is count<TAB>path.

The tests pass and bun x tsc --noEmit is clean; I ran the new test plus test/hollow.test.ts and test/shards.test.ts. I did not run the other two cross files (test/reserved-names.test.ts, test/check-list.test.ts).

I tried it on this checkout with --min 3. The worst offenders were src/core/releases.json (93), src/contract/openapi/routes/index.ts (12) and src/http/mcp/tools/index.ts (10).

  • Counting: parseNumstat and appendGrowth are pure functions over numstat rows, and the new test covers them without git.
  • Strict reading of "only added lines": one commit in the window that deletes a line from a file takes that file off the list. I read the issue as meaning every commit in the window, not just a count of the pure-append ones. Commits that touch a file with zero added and zero deleted lines are not counted.
  • Arguments: --days and --min accept only integers of 1–6 digits. Anything else exits 2 with a usage line, and git is started with an argument array, so no user text reaches a shell.
  • Left out: renames are not followed (--no-renames), and binary files are skipped. There is no JSON output and no test that runs git itself.

To try it: bun scripts/append-growth.ts --days 7 --min 10, then bun test test/append-growth.test.ts.

Closes #6499

commented

bun scripts/append-growth.ts [--days 7] [--min 10] now prints each file whose commits in the window only ever added lines, in more than --min commits, worst first. Each line is count<TAB>path.

The tests pass and bun x tsc --noEmit is clean; I ran the new test plus test/hollow.test.ts and test/shards.test.ts. I did not run the other two cross files (test/reserved-names.test.ts, test/check-list.test.ts).

I tried it on this checkout with --min 3. The worst offenders were src/core/releases.json (93), src/contract/openapi/routes/index.ts (12) and src/http/mcp/tools/index.ts (10).

  • Counting: parseNumstat and appendGrowth are pure functions over numstat rows, and the new test covers them without git.
  • Strict reading of "only added lines": one commit in the window that deletes a line from a file takes that file off the list. I read the issue as meaning every commit in the window, not just a count of the pure-append ones. Commits that touch a file with zero added and zero deleted lines are not counted.
  • Arguments: --days and --min accept only integers of 1–6 digits. Anything else exits 2 with a usage line, and git is started with an argument array, so no user text reaches a shell.
  • Left out: renames are not followed (--no-renames), and binary files are skipped. There is no JSON output and no test that runs git itself.

To try it: bun scripts/append-growth.ts --days 7 --min 10, then bun test test/append-growth.test.ts.

Approved

Approved. The pull does what #6499 asks, in the two files it names. parseNumstat and appendGrowth are pure and tested without git. --days and --min must be 1–6 digit integers before anything runs. git is started with an argument array, so no shell and no user text in a command. It reads the repo's own git history and writes nothing.

What I checked: I rebuilt the two files from this head in a temp directory, and bun test test/append-growth.test.ts gives 4 pass. I fed the real git log --numstat --no-renames --format=%x00%H --since=7.days.ago of main through the functions: at --min 10 it lists releases.json 93, openapi routes/index.ts 15, mcp tools/index.ts 12, worst first, which matches the description. The pull adds no page, API or terminal surface, so the preview has nothing new to try. It answers / with 200.

Two non-blocking notes are on the lines. Neither needs to hold this pull.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs