feat: Make turbo watch Cargo-aware
Watch mode now works with Cargo packages, verified live on this
repository: editing a crate source file re-runs exactly that crate's
tasks, editing an unrelated JS package does nothing, writes under the
root target/ directory are ignored, and editing any Cargo.toml or the
root Cargo.lock triggers full rediscovery.
- PackageChangesWatcher builds its private package graph with crates
included, plumbed from the same cargo_enabled decision the run builder
uses (config flag or env var).
- Cargo manifests and the lockfile define the crate set and its edges, so
any change to them makes the watcher's graph stale: they join
turbo.json as rediscovery triggers (manifests under target/ — cargo's
own build byproducts — are excluded).
- Events under the root target/ directory are dropped when Cargo support
is enabled. Usually target/ is gitignored and already filtered, but a
feedback loop where cargo's build writes re-trigger the tasks that
produced them must not depend on a .gitignore entry.
Known gap, documented: the hash watcher's discovery is JS-glob-based, so
content-hash dedup doesn't cover Cargo packages — a no-op save inside a
crate re-runs its tasks as a fast cache hit.