Repository navigation
docs: tighten the setup guide - #247
Merged
Merged
Conversation
Cut 117 bytes of wording from the setup guide so it has 3% of its byte budget free. Every rule, command and number stays.
Say "should" again where the old text said it, say "Without globs, every file of the kind is read", and keep "that" in "notes that an older deslag". Cut a few other words so the guide stays at 4,700 bytes.
webern
marked this pull request as ready for review
November 2, 2026 14:28
Owner
Author
|
Ready for review. CI is green on 9f55b6d. This frees 3% of the setup guide's byte budget so later edits to it fit; the budget itself is unchanged. The one choice made on the maintainer's behalf is the new opening fragment ("For an agent setting up deslag ..."), the edit furthest from the old wording; a fresh agent reading only the new text answered the eight trial questions the same as one reading the old text, and both answer sets are in the body. |
3 tasks done
webern
added a commit
that referenced
this pull request
Nov 2, 2026
This builds on #247 and shows only its own diff until #247 merges. ## AI Summary deslag used to take the directory it ran in as the root of the repository. Run from a subdirectory, `check --config-path ../deslag.toml` scanned that subdirectory alone, `init` wrote a config there, and `init --config-path lint/my.toml` wrote a file that `check` never looked at. A `.agents/deslag.toml` beside a `.deslag/config.toml` of another schema left `check` exiting 0 with every lint off. What changed: - The config is found by searching from the current directory up to the nearest directory that holds a `.git`, a file or a directory, and no further. Outside a work tree only the current directory is searched. The first directory with a config at a canonical location is the root. - The root is the directory the config path is relative to: `.agents/deslag.toml` gives the parent of `.agents/`. A config below the top of the work tree roots a run at or below it. - Findings and paths are relative to the root from any directory: globs, `allow` paths, `--diff` and `--base`, the text report, JSON, SARIF and GitHub annotations, and the paths `fix` and `explain` take. A path copied from a report works anywhere. When the root is not the current directory, `check`, `fix` and `explain` print one stderr line naming the root and the config. The config is shown from the root where it is under the root, and absolute otherwise. - No config exits 2 and names the directories searched, the paths tried and `deslag init`. - Two configs in one directory, at any canonical locations and in any language, exit 2 naming each. - `init` refuses where the search finds a config. With no `--config-path` it writes `deslag.toml` at the top of the work tree. A `--config-path` must end in a canonical TOML location whose root is the current directory or an ancestor within the work tree, else exit 2 listing them. `init` creates the one parent directory a stem needs. So `check` from the same directory reads what `init` wrote, with no flag. - `update` and `instructions update` use the same search, so they edit the config `check` reads. Without it, `instructions update` from a subdirectory said no config was found in a work tree that has one. - The guide, the README, the help text and the code docs say this. The JSON `path` doc comment, which reaches `deslag instructions output-schema`, now says the path is relative to the config's directory. Out of scope: a global config (#63), a smarter `init`, ignore files above a root below the top of the work tree, and `GIT_CEILING_DIRECTORIES`. ### Decided on the maintainer's behalf - Stop at the nearest `.git` and never search to `/`. `.config/deslag` is a canonical stem, so a search to `/` would take `~/.config/deslag.toml` and walk the home directory. The probe is a file test, not git, so `check` needs no git without `--base`. - The nearer config wins over a farther one, silently. Nothing above the first directory with a config is read and nothing is merged, as #34 asks. The alternative, refusing or merging, would read two files. - A submodule or nested repository hides the parent's config. Its `.git` ends the search, so a run inside it does not find the config of the repository around it. This follows from the first decision. - `--config-path` is rooted at the top of the work tree, or at the current directory outside one, so the same flag gives the same report from any directory. - Two configs in one directory are refused, not ordered. A silent pick between a `.agents/` config and a `.deslag/` one is how `check` came to exit 0 with every lint off. - `init` accepts only a path `check` would look at. Other commands still take any `--config-path`. - `update` and `instructions update` follow the search, as above. ### Tests New, in the fast tier: unit tests for the search in `src/config/search.rs` (config at the current directory, two levels up, above `.git`, `.git` as a file, nearer and farther configs, two stems, no work tree, an explicit path) and `tests/root.rs` (check, `--config-path`, an `allow` entry, `explain` and `fix`, a config below the top, nothing read above the top, `.git` as a file, no work tree, two stems, `update` from a subdirectory, `init` from a subdirectory, `init --config-path` and its refusals, and the note line for a config outside the work tree). `tests/slow/diff.rs` runs `--diff` and `--base` from a subdirectory. Changed, each read: `an_earlier_location_in_any_language_wins` in `tests/formats.rs` is now a refusal naming both files; the `init --config-path` test in `tests/slow/init.rs` now refuses `lint.toml` and accepts `.agents/deslag.toml`; the subdirectory test in `tests/instructions.rs` now finds the config from a subdirectory; the missing-config test in `tests/unit.rs` expects `deslag init` in place of "are you in the root". Two assertions moved from "at one location" to "in one directory" with the new message. Deleted: the corpus case `the-earlier-canonical-location-wins` and the test `the_earlier_canonical_location_wins`. Both asserted the opposite of the new rule, that the first of two configs wins. The case was a test config over fixtures; no fixture or golden changed. No golden, case or corpus output moved, because every one of them runs at its root. Mutations, each failing at least one test with the change in place: - search to `/`: three search unit tests and three integration tests - `.git` a directory only: the search unit test for a `.git` file and `a_git_file_ends_the_search_as_a_directory_does` - farthest config wins: the nearest-wins unit test and `a_config_below_the_top_roots_a_run_at_or_below_it` - first stem wins: one search unit test and four integration tests - `--config-path` rooted at the current directory: the explicit-path unit test and `config_path_from_a_subdirectory_scans_the_repo_from_its_top` - `init` makes no parent directory: `init_config_path_makes_its_parent_and_check_finds_the_file` and the slow `init` test - `update` reading the current directory: `update_from_a_subdirectory_edits_the_config_at_the_root` `src/instructions/guide.md` is 4,730 bytes of its 4,847. ## Testing - [x] `make ci-fast`: exit 0 - [x] `make test`: exit 0 - [x] `make test-tools`: exit 0 ## References - Builds on #247 - Related: #63 (a global config, out of scope), #34
6 tasks done
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.
AI Summary
The setup guide,
src/instructions/guide.md, sat 29 bytes under its 4,847-byte budget (0.6% free), so any later edit to it had no room. This PR says the same rules in fewer bytes: the guide goes from 4,818 to 4,700 bytes, which leaves 147 free (3.0%). The budget in.agents/deslag.tomlis unchanged. Every command, path, number and "never" in the guide is still there. Paragraphs are reflowed to 100 columns.Edits
globs, every file of the kind is read.globs, every file of the kind is read..ignorefile lists, are never read..ignorelists, are never read./matches/matches--dry-run does not write a fileis kept as it was. The shorter "writes nothing" failsverbs_nothingon the repo's owndeslag check, and "writes no file" failsverbs_no_nouns.Three of these were corrected after a review of the diff, because the first draft changed meaning or read badly: "should" had become "must" (a stronger rule, not a tighter one), "No
globsreads every file of the kind" read like a command, and "that" had been dropped from "notes that an older deslag", which made "an older deslag" look like the object of "notes". It is restored.Decided on the maintainer's behalf
The opening sentence is now a fragment ("For an agent setting up deslag ..."). It is the edit furthest from the old wording. It is kept because the fresh agent in the trial below read it as intended.
No-context trial
A fresh agent was given only the old guide (
39b804f) and another only the new guide (02f1805), no tools, with version 0.7.0 and schema 2 filled in. Each answered the same eight questions. The three corrections above came after the trial and touch no sentence that a question exercises.initwrite?[md]read, and how do you keep generated code out?allowentry?Old guide:
.deslag/config,deslag,config/deslag,.config/deslag,.agents/deslagand.claude/deslag. Each takes one of the extensions.toml,.yaml,.ymlor.json, and deslag runs from the repo root.deslag initwritesdeslag.tomlat the root, or the file--config-pathnames, with every lint on.[md]reads every*.mdfile unless itsglobssay otherwise, plus the comments of Rust, C, C++ and TOML code fences. To keep generated code out, useexclude, which takes the same patterns asglobs. Files that git ignores or a.ignorefile lists are never read.deslag check --base origin/mainwhere the repo runs its checks, withfetch-depth: 0in GitHub Actions.--format githuband--format sarifare optional. Do not upload the--difflog.New guide:
.deslag/config,deslag,config/deslag,.config/deslag,.agents/deslag,.claude/deslag, each with extension.toml,.yaml,.ymlor.json, read from the repository root.deslag initwritesdeslag.tomlat the root (or the file--config-pathnames) with every lint on.[md]reads every*.mdfile unless itsglobssay otherwise, plus comments in Rust, C, C++ and TOML code fences. Keep generated code out withexclude, which takes the same patterns asglobsand works in an override too.deslag check --base origin/mainwhere the repository's checks run, withfetch-depth: 0in GitHub Actions.--format githuband--format sarifare optional outputs.Comparison: the answers match in substance. The old agent mentioned three extras the new one did not (
.ignorefiles, that the human owns the limits, not uploading the--difflog). Those sentences are in both guides, so the difference is variance in what each agent chose to mention, not an edit.Testing
make ci-fast: exit 0make check: exit 0, including deslag's own check of the guideguide.mdsize: 4,818 bytes before, 4,700 after (budget 4,847)References
No open issue is closed by this change.