|
1 | 1 | Analyze the diff between the current branch and origin/main and produce a categorized breakdown. |
2 | 2 |
|
3 | 3 | Steps: |
4 | | -1. Run `git fetch origin` to ensure remote tracking is up to date |
5 | | -2. Run `git diff origin/main...HEAD --numstat` to get per-file added/removed line counts |
6 | | -3. Categorize each changed file using these heuristics (applied in order, first match wins): |
7 | | - - **Tests**: files matching `*_test.go`, `*_test.rs`, `tests/`, `e2e/`, `*_test.py`, `*.test.ts`, `*.test.js` |
8 | | - - **Fixtures/snapshots**: paths containing `fixtures/`, `snapshots/`, or `.bin`/`.json` files within those directories |
9 | | - - **Config/build**: `Cargo.toml`, `go.mod`, `go.sum`, `Makefile`, `*.toml`, `*.yml`, `*.yaml`, `Dockerfile`, `*.lock` |
10 | | - - **Docs**: `*.md`, paths under `rfcs/` |
11 | | - - **Generated**: lock files (`Cargo.lock`, `go.sum`, `bun.lockb`, `package-lock.json`), protobuf generated output (`*.pb.go`, `*.pb.rs`) |
| 4 | +1. Run `scripts/diff-breakdown.sh` to get the automated categorization. The script outputs JSON with: |
| 5 | + - `categories`: tallies (files, added, removed) for tests, fixtures, config, docs, generated, and unclassified |
| 6 | + - `unclassified_files`: list of files not auto-categorized, with per-file added/removed counts |
| 7 | + - `table`: a pre-formatted markdown table (use as a starting point) |
| 8 | + - `total`: aggregate totals |
| 9 | +2. For each file in `unclassified_files`, read the diff (`git diff origin/main...HEAD -- <file>`) and classify as either: |
12 | 10 | - **Scaffolding**: code that wires things together but contains little logic of its own: |
13 | 11 | - Metrics/instrumentation definitions (`metrics.go`, prometheus boilerplate) |
14 | 12 | - Thin CLI wrappers — files that are mostly clap/cobra struct definitions + a single function call (e.g. `enable.rs`, `disable.rs` that just call one controller method) |
15 | 13 | - Subcommand/route registration (`mod.rs` adding a `pub mod`, `command.rs` adding a variant, `main.go` wiring a new dependency) |
16 | 14 | - Interface/trait definitions that are pure signatures with no logic |
17 | 15 | - **Core logic**: everything else — the files where the real business logic and algorithms live |
18 | | -4. Tally lines added and removed per category, and count distinct files per category |
19 | | -5. Omit categories with zero changes |
| 16 | +3. Rebuild the table replacing "Unclassified" with the Scaffolding and Core logic rows. Omit categories with zero changes. |
20 | 17 |
|
21 | 18 | Output the breakdown as plain text (NOT inside a code block) so it's readable in the terminal. Use this format: |
22 | 19 |
|
|
0 commit comments