Nested drift.lock scoping, --silent, TTY prompt#20
Merged
laulauland merged 1 commit intolau/relink-gatefrom Apr 14, 2026
Merged
Nested drift.lock scoping, --silent, TTY prompt#20laulauland merged 1 commit intolau/relink-gatefrom
laulauland merged 1 commit intolau/relink-gatefrom
Conversation
laulauland
added a commit
that referenced
this pull request
Apr 14, 2026
…iewed (#19) * feat: print spec + code context when drift link refuses stale relink * docs: update drift skill to document relink gate and --doc-is-still-accurate * refactor: consolidate blanket refusal output + reduce line cap to 10 * docs: update CLI.md for relink gate, refresh stale lockfile sigs * examples: add relink-gate, symbol-anchor, and broken-links demos * refactor: remove doc: hash signatures, simplify relink gate The doc: hash was a whole-file hash of the markdown doc. It powered the relink gate by detecting whether the doc had changed since the last link. Problem: any unrelated doc change (typo, different section) opened the gate, giving false passes on bindings that weren't actually reviewed. Simplify the gate to: stale binding → always require --doc-is-still-accurate. No doc hash comparison needed. This is stricter but correct — the flag is an explicit human assertion that the doc was reviewed. - Remove computeDocHash and doc_hex plumbing from link.zig - Simplify isDocGateBlocked to only check staleness - Add Binding.removeField to strip leftover doc: from old lockfiles - Strip doc: from drift.lock - Update tests and docs * Nested drift.lock scoping, --silent, TTY prompt (#20)
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.
Stacked on #19.
Summary
Three additions to drift's CLI:
Nested drift.lock scoping — a
drift.lockfile acts as a scope boundary.drift checkfrom root skips.mdfiles under directories with their owndrift.lock.drift linkanddrift unlinkdiscover the lockfile from the doc's directory, not cwd, so runningdrift link nested/doc.md nested/code.tsfrom root writes tonested/drift.lock.--silentflag fordrift check/drift lint— suppresses stdout on success. Exit code still reflects staleness. Useful in CI or hooks where you only want output on failure.TTY prompt on relink gate — when
drift linkrefuses a stale relink and stdin is a TTY, it prompts "Doc is still accurate? [y/N]" instead of hard-failing. In non-TTY mode (agents, CI), it prints the refusal message and exits 1 as before.Changes
src/commands/link.zig—promptDocAccurate(TTY prompt / non-TTY refusal), lockfile discovery from doc dirsrc/commands/unlink.zig— lockfile discovery from doc dirsrc/commands/lint.zig—hasNestedLockfileto skip docs in nested scopessrc/main.zig—--silentflag,/dev/nullwriter for silent modeexamples/— each example dir has its owndrift.lockfor scopingdocs/CLI.md— documents scoping,--silentTest plan
zig build testpasses (63 tests)drift checkfrom root doesn't show example docsdrift link examples/x/doc.md examples/x/code.tswrites toexamples/x/drift.lockdrift check --silentproduces no output on success, exits 0drift link <doc>in TTY shows y/N prompt on stale anchordrift link <doc> < /dev/nullshows refusal message (non-TTY)