docs: document lowercase-only identifier rule in SPEC and SKILL#271
Merged
Conversation
PR #262 documented the post-dot dot-access relaxations (camelCase, leading-uppercase, snake_case, kebab-case) for field names, but the binding/call-site rule itself was only implicit. Anyone reading SPEC.md would see the dot-access relaxations and reasonably wonder what the baseline is. Adds an Identifier syntax subsection under Naming with the formal grammar (`[a-z][a-z0-9]*(-[a-z0-9]+)*`), a worked OK/ERROR table, the ILO-L003 surface in the CLI, and an explicit cross-reference to the Field names at dot-access section. Makes the binding/call-site rule findable on its own anchor.
SKILL.md is what agents see first when ilo loads as a Claude plugin, so the lowercase-only rule needs to land there too, with the same OK/ERROR examples (compressed) and the post-dot exception called out. ai.txt is the build.rs regeneration from the updated SPEC.md.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
Summary
PR #262 documented the post-dot field-access relaxations (camelCase, leading-uppercase, snake_case, kebab-case) so JSON keys from real APIs just work after
.and.?. What it didn't document, because it was implicit, is the baseline rule the relaxations are an exception to: identifiers at binding and call sites are lowercase ASCII only, optionally with hyphenated segments.Anyone reading the dot-access section in SPEC.md would reasonably wonder what the baseline naming rule is. This PR makes it findable on its own anchor.
Repro before/after
Before this PR, the only mention of the lowercase-only rule was an indirect note at the bottom of the dot-access section: "top-level identifiers still follow the standard naming rules". The "standard naming rules" themselves were only the 1-3 char shorten-everything heuristic, with nothing about ASCII-lowercase, hyphens, or the post-dot exception.
After this PR, a new Identifier syntax subsection under Naming gives the formal grammar (
[a-z][a-z0-9]*(-[a-z0-9]+)*), a worked OK/ERROR table covering capital letters, leading capitals, underscores, and leading hyphens, the ILO-L003 surface in the CLI with the exact suggestion shape, and an explicit cross-reference to the Field names at dot-access section.Verified against the lexer:
The SPEC claim matches the implementation exactly.
What's in the diff
Commit 1: SPEC.md - new Identifier syntax subsection under Naming with formal grammar, OK/ERROR table, ILO-L003 mention, and link to Field names at dot-access.
Commit 2: SKILL.md + ai.txt - mirrors the rule into SKILL.md (compressed: agents see this first when ilo loads as a Claude plugin), plus the build.rs regeneration of ai.txt.
Test plan
cargo build --release --features cranelift- build.rs regenerates ai.txt cleanlyrunDproduces ILO-L003 with the exact suggestion the SPEC documentsFollow-ups
None.