Repository navigation
feat: add deslag instructions lints - #56
Merged
Merged
Conversation
lints.asbuilt.md had a section per lint, 3359 bytes of its 7500, and most of it repeated the lint modules' doc comments. Each new lint added a section to a doc that was full. The sections are gone. The facts only they held move into the module docs: the byte order mark that banned_chars skips, the order of allow, ban and the groups, the defaults of repo_layout and density (named by their constants), the empty max_emphasis table, that list_growth skips a file the change did not edit, and that a file with no budget still counts in the tally. The emphasis doc said a run of capitals is split by spaces; the code splits on any whitespace. A lint's doc comment is now its as-built description, so tests/asbuilt.rs holds each one to 2000 bytes. The largest is 1703.
deslag.asbuilt.md was 8163 of its 8192 bytes, and its Tests section grew with every change. The Tests section and the tests/ tree move to a new tests.asbuilt.md, 2925 of 4096, which deslag.asbuilt.md indexes. Build stays: it describes the repo as a whole and does not grow per lint. The proofs of one lint on the corpus move to the lint they prove: the ratio of llm to human fixtures the default groups flag to banned_chars.rs, the layouts read under real headings to repo_layout.rs, and fix over the corpus to the Fixing section of lints.asbuilt.md. tests.asbuilt.md keeps the harnesses.
The guide was 4996 of its 5000 bytes, and tests/instructions.rs made it name every lint in a bullet and turn every lint on in its example. Each new lint needed about 200 bytes the guide did not have. `deslag instructions lints` prints a short intro, then a section per lint in the order they run: what the lint fails, and one TOML table that turns it on. Each section is its own file under src/instructions/lints/, which an exhaustive match on Lint includes, so a new lint does not compile until it has one. The heading is the lint's id, from Lint::id. The guide's per-lint bullets move to those files word for word, and the tables of its example move with them. Step 3 of the guide now opens with "Run `deslag instructions lints`" and keeps a short example. tests/instructions.rs now checks that the topic has a section for every lint, in order; that each section's one table fits the schema and turns on its lint alone; that the tables together turn on every lint and run clean; that the guide's example runs clean and names the topic; and that the topic has no placeholder left. .agents/deslag.toml lints the new files and holds each to 800 bytes.
#54 cut two things from step 6 of the guide to fit list_growth in its budget: that --diff misses some failures, such as a path deleted from under an untouched layout, and the pull_request job that runs --diff HEAD^1 with fetch-depth: 2. README.md still says the guide explains what --diff misses. The guide has room again, so both come back, near their old words. The guide is 4063 of its 5000 bytes.
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
Every Markdown file deslag lints in its own repository has a byte budget, and the files that hold text per lint were full: the setup guide at 4996 of 5000 bytes,
lints.asbuilt.mdat 7496 of 7500,deslag.asbuilt.mdat 8163 of 8192 (measured on main, e12b6d5). A new lint needed about 200 bytes of guide text, becausetests/instructions.rsmade the guide name every lint and turn every lint on in its example, and a section inlints.asbuilt.md. #54 paid forlist_growthby cutting guidance from the guide. Raising a budget is not the fix, so this moves the per-lint text to homes that grow by a file per lint instead of by bytes in a full file.No budget is raised. A new lint now needs no bytes in the guide,
lints.asbuilt.md(beyond its line in the module tree) ordeslag.asbuilt.md.deslag instructions lintsA new instructions topic. It prints a short intro, then a section per lint, headed by its id, in the order the lints run: what the lint fails, and one TOML table that turns it on.
src/instructions/lints/<id>.md.instructions::lintsincludes them through an exhaustivematchonLint, so a new lint does not compile until it has one. The heading comes fromLint::id, so it cannot drift from the config's table name..agents/deslag.tomlnow lintssrc/instructions/**/*.mdand holds the intro and each lint's file to 800 bytes. The largest is 279.deslag instructions lints" and keeps a short example ([md], one lint, one override) and themessageandconfig-schematext. The guide stays the one entry point: step 3 cannot be done without the topic, as values already cannot be set withoutconfig-schema.What an agent reads:
deslag instructionswas 5057 bytes (120 lines) and is now 4124 (97 lines);deslag instructions lintsis 1817 bytes (75 lines).Two homes were considered and not taken:
deslag explain <lint>.explainexits 2 when there is no config, which is the state of a repository being onboarded, and itsPATHargument would clash with a lint id.deslag instructions, to keep one command. That is raising the guide's budget by another name.What moved where
Text was moved, not rewritten, except where noted.
guide.md:64-77on main) moved word for word, one to eachsrc/instructions/lints/<id>.md.max_emphasis,banned_chars,banned_phrasesanddensityunder[md.lints], andrepo_layoutandlist_growthin anAGENTS.mdoverride.max_size_byteskeeps its table in the guide and gets the same one in its file.--diffguidance feat: add list_growth and --base #54 cut from step 6 is back, near its old words:--diffmisses some failures, such as a path deleted from under an untouched layout, and apull_requestjob may run--diff HEAD^1withfetch-depth: 2. This makesREADME.md's "deslag instructionssays how to run it in CI and what it misses" true again. "In its place" became "in place of--base origin/main", since a sentence now comes between them.lints.asbuilt.md's seven per-lint sections (3359 bytes) are gone. Most of it repeated the module doc comments. What only they held moved into the module docs:banned_chars.rs: the byte order mark thatscanskips, thatallowbeatsbanandbanthe groups, and that onlyemojiis off by default.repo_layout.rs: the root is one word; a blank line ends a description; the width ignores trailing whitespace;Malformed; and the defaults, named byRepoLayout'sDEFAULT_constants rather than by value.density.rs: a block of only whitespace is dropped, and the defaults, byDensity's constants.max_emphasis.rs: an unset field counts as 0, and a table setting neither checks nothing. The doc said a run of capitals is split by spaces; the code splits on any whitespace, and the doc now says so.list_growth.rs: a file the change did not edit is not judged.max_size_bytes.rs: a file with no budget still counts in the tally.lints.asbuilt.md's Checking section says a lint's module doc is its as-built description, and a new test intests/asbuilt.rsholds each lint's//!to 2000 bytes. The largest is 1788 (repo_layout.rs).deslag.asbuilt.md's Tests section andtests/tree moved to a newtests.asbuilt.md(subsystems: [tests]), indexed fromdeslag.asbuilt.md. Build stays indeslag.asbuilt.md: it covers the repo as a whole and does not grow per lint.llm/fixtures ashuman/ones tobanned_chars.rs; the layouts read under real headings, andcore/rt-agents.mdwith no malformed line, torepo_layout.rs; fix over the corpus to the Fixing section oflints.asbuilt.md.deslag.asbuilt.mdnames the new topic and its files in the module tree and the command line section, and saysinstructionsreadsLint.Budgets
src/instructions/guide.mdsrc/instructions/lints.mdsrc/instructions/lints/*.mddocs/design/lints.asbuilt.mddocs/design/deslag.asbuilt.mddocs/design/tests.asbuilt.md//!commentsAGENTS.mdand the skills are unchanged, solist_growthhas nothing to judge there.Where a new lint's text goes: a new
src/instructions/lints/<id>.md, its module's doc comment, and one line inlints.asbuilt.md's module tree. None of them is a full file.Onboarding trial
An agent with no other context was given the release binary built from this branch and an empty repository: a git repository with one commit, holding a
README.md, anAGENTS.mdand adocs/design.md, with no remote. It was told only to rundeslag instructionsand do what it says.deslag instructions, thendeslag instructions lints, thendeslag instructions config-schema, thencheck.deslag.tomlcoveringAGENTS.mdanddocs/:max_size_bytesfor both,banned_chars, and, in anAGENTS.mdoverride, a smaller budget andrepo_layoutwithmin_entries = 3andmax_entries = 10. It leftREADME.mdout, as the guide says to ask the human before linting a human-written file.banned_phrases, since the phrases are the human's to choose, andmax_emphasis,densityandlist_growth, as not needed yet.checkfailed onAGENTS.mdhaving noRepository layoutsection. It added one, and the lastcheckexited 0.check --base origin/mainexited 2, because the repository has no remote. It skipped step 6 (CI), as the repository had no CI to add it to.Testing
make ci: exit 0, 156 s (157 s on main e12b6d5; both warm, on the same machine).tests/instructions.rs:deslag instructions lintsexits 0 with empty stderr and printsinstructions::lints(); it has a section for every lint, inLint::ALLorder, and those are the schema's lints; each section has exactly one TOML table, which fits the schema and turns on its lint alone; the tables joined turn on every lint, fit the schema and run clean; the guide's example fits the schema, runs clean and namesdeslag instructions lints; neither text has a placeholder left.tests/asbuilt.rs: each lint's module doc is at most 2000 bytes; everysrc/module is still named in exactly one as-built doc.make check-deslag: every touched Markdown file under its budget and the other lints.References
deslag instructions lintslists every lint in a form an agent can act on, which new-lint discovery could build on.--diffguidance restored here.