bar-fmt 1/3: bar-lua-codemod — tooling and tests - #2
Closed
keithharvey wants to merge 4 commits into
Closed
Conversation
keithharvey
marked this pull request as ready for review
July 22, 2026 19:36
This was referenced Jul 22, 2026
bar-lua-codemod parses BAR Lua with emmylua_parser (the same front-end family as emmylua_check/emmylua_ls) at Lua51, doc-comment analysis off. Transforms collect byte-range edits over the rowan CST and splice them into the original source, so untouched bytes are untouched by construction. cst.rs carries the shared helpers: parse gate on SyntaxError-kind diagnostics only, bracketed-string-key extraction that tolerates trivia, and the function-declaration-name exclusion. codemod-cargo.sh runs cargo inside bar-dev, where the toolchain lives. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
x["y"] -> x.y and ["y"] = -> y = for string keys that are valid, non-reserved identifiers. Raw quoted content only — escapes and long strings never convert. Injects a space when ] abutted a word character so .identifier doesn't merge with what follows. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Spring.GetMyTeamID / GetMyAllyTeamID / GetMyPlayerID -> the canonical GetLocal* names, wherever the prefix is the bare Spring global. Bracket access and non-Spring prefixes are left alone. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Spring.I18N / Utilities / Debug / Lava / GetModOptionsCopy — BAR's own helpers riding the Spring table — move to the BAR namespace. Handles the _G.Spring.Module spelling too; function-declaration names stay put. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
keithharvey
force-pushed
the
bar-fmt-01-tooling
branch
from
July 23, 2026 01:38
7319515 to
93a9270
Compare
Owner
Author
|
Consolidating: bar-fmt reviews as one PR for now — the tip rollup at beyond-all-reason#57. |
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.
Layer 1 of the bar-fmt stack (tooling + tests → workspace integration → LLM layer).
The codemod crate, one atomic commit per piece: the span-edit framework over emmylua_parser, then bracket-to-dot, rename-aliases, and detach-bar-modules. Every commit builds and its tests pass in isolation (17 → 24 → 37 tests along the stack).
This is the emmylua_parser port of the full_moon codemod (one Lua front-end across the repo — same parser family as emmylua_check/emmylua_ls). Verified byte-identical to the full_moon binary over the BAR
fmttree (2,171 files): per-transform trees, composed pipeline trees, count reports, and the parse-failure set all match exactly — and the full generation pipeline has since been re-run end-to-end with this binary, rebuilding all migration branches cleanly. The pre-restack branch isbar-fmt-emmylua; the original full_moon history stays onbar-fmt.🤖 Generated with Claude Code