Provide a Rust-based CLI wrapper that reruns delegated shell utilities and arbitrary commands when inferred or explicit filesystem inputs change.
with-watch
crates/with-watch
docs/crates-with-watch-foundation.md
- Root passthrough mode must remain
with-watch [--no-hash] [--clear] <utility> [args...]. - Shell mode must remain
with-watch [--no-hash] [--clear] --shell '<expr>'and is the supported entrypoint for&&,||, and|. - Arbitrary command mode must remain
with-watch exec [--no-hash] [--clear] --input <glob>... -- <command> [args...]. with-watch --helpmust include a long-help appendix that documents command modes, the recognized delegated-command inventory, safe current-directory defaults, and recognized-but-not-auto-watchable commands.- The public CLI surface must keep exactly one delegated-command entrypoint per invocation: passthrough argv,
--shell, orexec --input. - After watch input inference, watcher setup, and baseline snapshot capture succeed,
with-watchmust execute the delegated command immediately once before waiting for the first filesystem change event. - Default change detection must prefer content hashing, while
--no-hashmust switch the rerun filter to metadata-only comparison. --clearmust remain a global flag that clears stdout before the initial run and each rerun only when stdout is a terminal.WW_LOGmust remain the only supported environment variable for configuringwith-watchdiagnostictracinglogs, and the default diagnostic filter must remainwith_watch=off.RUST_LOGmust not affectwith-watchdiagnostic logging.exec --inputreruns the delegated command unchanged and must not inject changed paths into argv or environment variables.- Commands without safe inferred filesystem inputs must fail clearly and direct operators to
with-watch exec --input .... - Passthrough and shell modes must use adapter-driven input inference that excludes known outputs, scripts, and pattern operands from the watch set.
- First-class search adapters must include
grep,rg,ag, andfd; search patterns, globs, and type filters must stay out of the watch set while explicit search roots and file-valued pattern/ignore inputs remain watchable. - First-class schema/codegen adapters must include
protoc,flatc,thrift, andcapnp compile; explicit source files, include/import roots, descriptor inputs, and conform-reference inputs must remain watchable while generated output paths stay filtered out of the watch set.protocresponse files (@argfile) are too opaque for v1 inference and must fall back toexec --inputguidance instead of being partially watched. Whenprotocomits--proto_path, the current working directory must be treated as an implicit import root and remain watchable. ls,dir, andvdirmust use metadata listing snapshots instead of recursive file-content hashing: the default watch scope is immediate children,-Rstays recursive, and-dwatches only the named path.- Shell redirects must treat
<and<>targets as watched inputs and>,>>,&>,&>>, and>|targets as filtered outputs. - Shell parsing support is limited to command-line expressions plus
&&,||, and|; broader shell control-flow stays out of scope until documented otherwise. - Safe pathless default watch roots are limited to the built-in allowlist (
ls,dir,vdir,du, andfind). - Commands that mutate watched inputs directly must refresh the baseline snapshot after each run and suppress self-triggered reruns caused by their own writes.
- Path-based watch inputs must anchor watcher subscriptions at the nearest existing directory so replace-style writers keep emitting later external changes.
- Public crate installation must continue to support
cargo install with-watch. - Direct installers must remain available at
scripts/install/with-watch.shandscripts/install/with-watch.ps1; direct installs must verifySHA256SUMSentries and Sigstore bundle sidecars and requirecosign. cargo-binstallmetadata must resolve only first-party GitHub Release assets and disable third-party quick-install and compile fallback strategies.- Publish tag eligibility must remain enabled through root
[workspace.metadata.cargo-mono.publish.tag].packages, and release tag naming must remainwith-watch@v<version>. - Release automation must publish signed GitHub Release assets for
linux/amd64,linux/arm64,darwin/amd64,darwin/arm64,windows/amd64, andwindows/arm64, including standalone binaries (with-watch-<os>-<arch>[.exe]) and archives (with-watch-<os>-<arch>.tar.gz|zip). - Homebrew installation must consume prebuilt
with-watchrelease archives fordarwin/amd64,darwin/arm64,linux/amd64, andlinux/arm64.
- Update this index and
docs/crates-with-watch-foundation.mdtogether when CLI shape, watch inference behavior, operator guidance, release automation, side-effect suppression, or storage/logging contracts change. - Update root
Cargo.toml,.github/workflows/release-with-watch.yml,scripts/release/update-homebrew.sh, andpackaging/homebrew/templates/with-watch.rb.tmplin the same change when with-watch release tags, artifact names, or package-manager distribution contracts change. - Keep
scripts/install/with-watch.sh,scripts/install/with-watch.ps1, andcrates/with-watch/Cargo.tomlsynchronized with release asset names and signing contracts. - Keep root
AGENTS.mdandcrates/AGENTS.mdaligned with ownership and project-ID changes.
docs/project-template.mddocs/domain-template.mddocs/README.md