Skip to content

Nested drift.lock scoping, --silent, TTY prompt#20

Merged
laulauland merged 1 commit intolau/relink-gatefrom
lau/drift-scoping
Apr 14, 2026
Merged

Nested drift.lock scoping, --silent, TTY prompt#20
laulauland merged 1 commit intolau/relink-gatefrom
lau/drift-scoping

Conversation

@laulauland
Copy link
Copy Markdown
Member

Stacked on #19.

Summary

Three additions to drift's CLI:

Nested drift.lock scoping — a drift.lock file acts as a scope boundary. drift check from root skips .md files under directories with their own drift.lock. drift link and drift unlink discover the lockfile from the doc's directory, not cwd, so running drift link nested/doc.md nested/code.ts from root writes to nested/drift.lock.

--silent flag for drift 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 link refuses 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.zigpromptDocAccurate (TTY prompt / non-TTY refusal), lockfile discovery from doc dir
  • src/commands/unlink.zig — lockfile discovery from doc dir
  • src/commands/lint.zighasNestedLockfile to skip docs in nested scopes
  • src/main.zig--silent flag, /dev/null writer for silent mode
  • examples/ — each example dir has its own drift.lock for scoping
  • docs/CLI.md — documents scoping, --silent
  • Integration tests for nested scoping (link, unlink, check)

Test plan

  • zig build test passes (63 tests)
  • drift check from root doesn't show example docs
  • drift link examples/x/doc.md examples/x/code.ts writes to examples/x/drift.lock
  • drift check --silent produces no output on success, exits 0
  • drift link <doc> in TTY shows y/N prompt on stale anchor
  • drift link <doc> < /dev/null shows refusal message (non-TTY)

@laulauland laulauland marked this pull request as ready for review April 14, 2026 07:59
@laulauland laulauland merged commit a419fac into lau/relink-gate Apr 14, 2026
5 checks passed
@laulauland laulauland deleted the lau/drift-scoping branch April 14, 2026 08:50
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant