Skip to content

Generate FILE_TREE.md from the source tree and check it in CI - #79

Merged
tukamilano merged 1 commit into
mainfrom
chore/generate-file-tree
Oct 24, 2026
Merged

tukamilano merged 1 commit into
mainfrom
chore/generate-file-tree

Conversation

@tukamilano

Copy link
Copy Markdown
Collaborator

FILE_TREE.md was maintained by hand and kept drifting. On main it listed 144 modules where
146 exist (LinearAlgebra 6 vs 7, Probability 68 vs 69), and InterlacingPR.lean and
Grouping.lean were missing from the tree.

Changes

  • scripts/file_tree.py regenerates the whole file from StatsMLlib/: per-layer counts, the
    total, the number of layer-one directories and the tree (directories first, then files, each
    sorted). --check rewrites nothing; it prints a unified diff and exits 1 when the committed
    file is stale. The generated file carries a "do not edit by hand" comment.
  • FILE_TREE.md regenerated. Besides the fixes above, EmpiricalProcess/ now sorts before
    EmpiricalRiskMinimization/.
  • CI: a separate file-tree job runs python3 scripts/file_tree.py --check. It needs no Lean
    toolchain and takes seconds.
  • CONTRIBUTING.md: run python3 scripts/file_tree.py after adding, moving or deleting a
    module.

Testing

A throwaway harness ran the script on a temporary copy of the tree. All 10 scenarios passed:

  • a clean copy passes the check;
  • adding a module fails the check, and regenerating lists it and bumps the layer count;
  • deleting a module fails the check;
  • adding a new directory fails the check, and regenerating lists it;
  • an empty directory is ignored;
  • a hand-edited count fails the check.

🤖 Generated with Claude Code

FILE_TREE.md was maintained by hand and drifted: the module counts were
off (144 listed, 146 present) and InterlacingPR.lean and Grouping.lean
were missing from the tree.

- Add scripts/file_tree.py, which regenerates the whole file (counts,
  layer total and tree) from StatsMLlib/, and with --check exits 1 and
  prints a diff when the committed file is stale.
- Regenerate FILE_TREE.md.
- Add a file-tree CI job running the check.
- Document the regeneration step in CONTRIBUTING.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tukamilano
tukamilano merged commit 7ef8c85 into main Oct 24, 2026
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