dev_prune/constants.rs
1// Copyright 2026 VKrishna04
2// SPDX-License-Identifier: Apache-2.0
3
4// Centralized application constants and default configurations.
5//
6// Serves as the single source of truth for app metadata, versioning,
7// default thresholds, and file paths.
8
9/// Application crate version derived dynamically from `Cargo.toml`.
10pub const VERSION: &str = env!("CARGO_PKG_VERSION");
11
12/// Minimum supported Rust version, derived dynamically from `rust-version` in
13/// `Cargo.toml` — which is the single source of truth for the MSRV. Only `cargo
14/// install` users ever meet it; every other channel ships a prebuilt binary.
15pub const MSRV: &str = env!("CARGO_PKG_RUST_VERSION");
16
17/// Application name.
18pub const APP_NAME: &str = "dev-prune";
19
20/// Author of dev-prune.
21pub const AUTHOR: &str = "VKrishna04";
22
23/// Canonical source repository.
24///
25/// The one in `Cargo.toml` is only visible to people who already found the crate. This
26/// one is compiled into the binary, so a copy of the executable still says where it came
27/// from.
28pub const REPO_URL: &str = "https://github.com/Life-Experimentalist/dev-prune";
29
30/// Project homepage.
31pub const HOMEPAGE_URL: &str = "https://devprune.vkrishna04.me";
32
33/// The one-line credit printed under interactive output.
34///
35/// Deliberately plain text in plain sight: it is not obfuscated, not assembled at
36/// runtime, and not checked anywhere. Anyone may fork this project and change this line
37/// — the Apache-2.0 licence says so, and nothing in the code argues. It exists so that
38/// the common case, someone running the published binary, shows where it came from.
39pub const ATTRIBUTION_LINE: &str =
40 "dev-prune · made with ♥ by VKrishna04 · github.com/Life-Experimentalist/dev-prune";
41
42/// The licence sentence under the declaration, in both wizard paths.
43///
44/// Apache-2.0 needs no click-through and this is not one: the licence governs use
45/// whether or not anybody reads this line. It is here because the screen it sits on is
46/// the first thing a new user meets, and a tool that deletes directories should say what
47/// it does and does not promise at that moment rather than in a file called LICENSE.md.
48/// Sections 7 and 8 are named so the disclaimer can be checked rather than taken on
49/// trust.
50pub const LICENCE_NOTICE: &str =
51 "Apache-2.0 sections 7-8: no warranty, no liability. Using it accepts that.";
52
53/// The body of `devp --version`.
54///
55/// Built at runtime rather than with `concat!`, which only takes literals and would mean
56/// spelling the author and the URL a second time. Two copies of a string are two things
57/// that can disagree, and this one exists precisely so that a stray copy of the binary
58/// can still be traced back.
59pub static LONG_VERSION: std::sync::LazyLock<String> = std::sync::LazyLock::new(|| {
60 format!(
61 "{VERSION}\n\
62 author: {AUTHOR}\n\
63 repository: {REPO_URL}\n\
64 homepage: {HOMEPAGE_URL}\n\
65 license: Apache-2.0"
66 )
67});
68
69/// How many prune passes `devp stats` keeps a summary of.
70///
71/// The registry is rewritten in full on every save, so this list is a file-size decision
72/// as much as a display one. Fifty passes is roughly a year of a fortnightly schedule.
73pub const PRUNE_HISTORY_LIMIT: usize = 50;
74
75/// How many restore measurements one adapter's throughput average is worth.
76///
77/// Past this, the running totals are halved before the new sample is added, so the
78/// average follows the machine rather than remembering a disk it no longer has. A plain
79/// lifetime mean would quote a spinning-rust number years after the SSD went in.
80pub const RESTORE_RATE_SAMPLE_CAP: u32 = 20;
81
82/// The shortest restore worth learning a throughput from, in milliseconds.
83///
84/// A restore that returned in under this is a manager deciding it had nothing to do —
85/// the packages were still in its cache, or already on disk. Averaging those in would
86/// claim a rate no cold restore can reach.
87pub const RESTORE_RATE_MIN_MILLIS: u64 = 250;
88
89/// The release that started recording per-repository totals and the pass history.
90///
91/// A machine that pruned for months on 1.0.0 has a large lifetime total and no history at
92/// all, and reading that as "nothing was ever pruned here" would be wrong. Both `devp
93/// stats` and its `--json` document quote this version so the gap is explained rather than
94/// looking like data loss. It is deliberately not [`VERSION`]: it names the release the
95/// format changed in, and does not move again.
96pub const HISTORY_STARTS_AT: &str = "1.1.0";
97
98/// Default idle threshold in days before a repository is eligible for pruning.
99pub const DEFAULT_IDLE_DAYS: u64 = 15;
100
101/// Default idle threshold for *build-tree* directories, in days.
102///
103/// Applies to every adapter that answers [`crate::adapters::PackageManager::opt_in`].
104/// Deliberately longer than [`DEFAULT_IDLE_DAYS`],
105/// because those directories come back by recompiling the whole project rather than by
106/// re-downloading a dependency tree, so the bar for "nobody will miss this" sits
107/// higher. The engine applies `max(build_idle_days, idle_days)`.
108///
109/// Three times the dependency window and no more: 60 days was long enough that a
110/// project touched once a quarter never became a candidate at all, which is not
111/// caution, it is the feature never firing.
112pub const DEFAULT_BUILD_IDLE_DAYS: u64 = 45;
113
114/// The per-manager cache size cap `devp config wizard` offers, in gibibytes.
115///
116/// Not a default: `cache_max_gb` is empty until someone puts a number in it, and an
117/// empty map means no cache is ever called too big. This is only the figure the wizard
118/// pre-fills and the docs recommend, and 10 GiB is where it sits because that is the
119/// size at which a download cache stops being a time-saver and starts being the largest
120/// directory on the disk — a `uv` cache measured on the author's machine had passed it
121/// while every project it served fit in a tenth of that.
122pub const RECOMMENDED_CACHE_MAX_GB: u64 = 10;
123
124/// One gibibyte, for turning `cache_max_gb` into the byte count a cache is measured in.
125pub const BYTES_PER_GIB: u64 = 1024 * 1024 * 1024;
126
127/// Shown while `devp trust` and the configurator ask the OS about the scheduler and
128/// Git hooks, then overwritten in place. Kept here because its width is what the
129/// erase writes over, so the two must not be able to drift apart.
130pub const READING_MACHINE: &str = "Reading this machine (scheduler, Git hooks)...";
131
132/// Default interval in days between background daemon prune runs.
133pub const DEFAULT_CHECK_INTERVAL_DAYS: u64 = 2;
134
135/// Whether the setup pass installs the OS scheduler.
136///
137/// On. A pruner that has to be remembered is a pruner that never runs; the scheduled
138/// pass is the product, not an extra. It is still bounded by everything an interactive
139/// run is bounded by — idle threshold, lockfile verification, per-repo opt-outs — and
140/// `devp daemon uninstall` (or `devp config set auto_daemon false`) removes it.
141pub const DEFAULT_AUTO_DAEMON: bool = true;
142
143/// Whether the setup pass installs the global Git auto-registration hooks.
144///
145/// On, but conditionally: installation is skipped, not forced, when `core.hooksPath`
146/// already belongs to husky, pre-commit or lefthook.
147pub const DEFAULT_AUTO_HOOKS: bool = true;
148
149/// Whether dev-prune installs its missing integrations by itself.
150///
151/// On. The pass runs once per installed version — on first run, and again after an
152/// upgrade — and only creates what is absent. Set to `false`, or export
153/// `DEV_PRUNE_NO_AUTO_SETUP`, to manage the integrations entirely by hand.
154///
155/// The environment variable is symmetric: with it set, `devp uninstall` leaves those
156/// same hand-managed integrations — the scheduler, the agent skills, the install
157/// directories guessed from the home folder — alone too, and says so. "Entirely by
158/// hand" has to include the removal, or the variable's promise only holds until the
159/// day you uninstall.
160pub const DEFAULT_AUTO_SETUP: bool = true;
161
162/// Default for whether `link` and `init` write a `.devprune.json` into repositories
163/// they register.
164///
165/// Off: most repositories are fine on the defaults, and a config file dropped into
166/// every repo is litter. The setting exists for people who tune repositories
167/// individually often enough that creating the file by hand every time is the chore.
168pub const DEFAULT_AUTO_CONFIG: bool = false;
169
170/// Default setting for requiring interactive confirmation before pruning.
171pub const DEFAULT_REQUIRE_CONFIRMATION: bool = true;
172
173/// Language for dev-prune's own headings and summary lines.
174///
175/// English, and English is also the fallback for every key a translation has not
176/// reached yet -- see [`crate::i18n`]. Deliberately not derived from the operating
177/// system locale: a machine configured in one language has said nothing about what
178/// language its owner wants their build tools in.
179pub const DEFAULT_LANGUAGE: &str = "en";
180
181/// Default size floor, in MiB, below which a bloat directory is left alone.
182///
183/// Zero — every recognised directory is a candidate. Raising it trades a little disk
184/// space for fewer reinstalls: deleting a 3 MiB `node_modules` costs a full `npm ci`
185/// and reclaims almost nothing.
186pub const DEFAULT_MIN_SIZE_MB: u64 = 0;
187
188/// How far below a repository root project discovery descends, by default.
189///
190/// Six covers `packages/scope/name/…` monorepo layouts with room to spare while keeping
191/// the walk bounded on repositories with deep source trees. Configurable with
192/// `devp config set scan_depth`, and per repository with `"scan_depth"` in
193/// `.devprune.json`, because "deep enough" is a property of the layout, not of the tool.
194pub const DEFAULT_SCAN_DEPTH: usize = 6;
195
196/// Upper bound accepted for `scan_depth`.
197///
198/// Not a matter of taste. The walk is breadth-first over every directory that is not
199/// excluded, so cost grows with the tree, and a repository with a deep generated tree
200/// (a Bazel `bazel-out`, a `.terraform` provider cache) can turn an unbounded walk into
201/// a multi-minute stall on a background pass nobody is watching.
202pub const MAX_SCAN_DEPTH_LIMIT: usize = 32;
203
204/// Ceiling on the threads `devp status` uses to size repositories.
205///
206/// The scan is one independent file-system walk per repository, so it is bound by the
207/// disk rather than the CPU and oversubscribing the cores is what makes it fast. The
208/// ceiling exists anyway: past this point a spinning disk spends its time seeking
209/// between trees instead of reading them, and a laptop under a background pass should
210/// still be usable.
211pub const STATUS_SCAN_MAX_THREADS: usize = 32;
212
213/// Threads per reported core for the status scan. Above one because the scan waits on
214/// the disk far more than on the CPU; well below what the disk will queue, because past
215/// that point the extra threads only take turns.
216pub const STATUS_SCAN_THREADS_PER_CORE: usize = 2;
217
218/// Overrides the computed status-scan thread count. Clamped to
219/// [`STATUS_SCAN_MAX_THREADS`]; `1` forces a sequential scan.
220pub const STATUS_SCAN_THREADS_ENV: &str = "DEV_PRUNE_SCAN_THREADS";
221
222/// How many lines of a failed command's output are relayed into a report.
223///
224/// A failing `npm ci` prints its whole usage screen. Six lines is enough for the error
225/// and its cause, and short enough that the prune report around it is still readable;
226/// the rest is reachable through the log file the condensed output still names.
227pub const TOOL_OUTPUT_MAX_LINES: usize = 6;
228
229/// Directory names that mean "the contents of this are disposable".
230///
231/// Matched against a repository's *ancestors*, never against the repository directory
232/// itself: a project may legitimately be called `cache`, but a checkout sitting inside
233/// one is something a tool put there. Editor and agent plugin managers clone into
234/// directories like `~/.claude/plugins/cache/temp_git_<id>`, which is nowhere near the OS
235/// temp directory and is deleted just as fast; twenty-eight of those reached one
236/// registry before this list existed.
237pub const EPHEMERAL_ANCESTORS: &[&str] = &["cache", ".cache", "Cache", "Caches", "tmp", ".tmp"];
238
239/// Repository directory *names* that mean the same thing, wherever they are.
240///
241/// The ancestor list above only catches a throwaway clone that a tool was polite enough
242/// to put under a directory called `cache`. These prefixes catch the clone itself:
243/// `temp_git_1787245534782` is a checkout some plugin manager made, named after the
244/// millisecond it made it, and it will be gone before the next prune pass. Registering
245/// one strands a dead entry in the registry the moment the tool cleans up after itself.
246///
247/// A prefix rather than a substring, and deliberately narrow: `temporary-fixes` and
248/// `my-temp-git-notes` are real repositories somebody named badly, and refusing to track
249/// a real workspace is the worse of the two errors.
250pub const EPHEMERAL_REPO_PREFIXES: &[&str] = &["temp_git_", "tmp_git_"];
251
252/// Whether an adapter whose sync command edits tracked manifests may run it.
253///
254/// Off. `cargo generate-lockfile` re-resolves every dependency and rewrites
255/// `Cargo.lock`; `go mod tidy` edits `go.mod` and `go.sum` and can drop requirements.
256/// A cleanup tool that silently changes files Git tracks has done something the user
257/// did not ask for, so these run read-only and this switch is the informed opt-in.
258pub const DEFAULT_ALLOW_MANIFEST_REWRITE: bool = false;
259
260/// Whether the setup pass installs the Git hooks in front of another tool's.
261///
262/// Off. Chaining is behaviour-preserving — every hook is forwarded on and
263/// `devp hook uninstall` restores the original `core.hooksPath` — but it still rewires
264/// somebody else's Git configuration, which is not a thing to do unasked. Turn it on
265/// with `devp config set auto_hooks_chain true`, or do it once with
266/// `devp hook install --chain`.
267pub const DEFAULT_AUTO_HOOKS_CHAIN: bool = false;
268
269/// GitHub releases page, shown whenever an upgrade is relevant.
270pub const RELEASES_URL: &str = "https://github.com/Life-Experimentalist/dev-prune/releases";
271
272/// The shell installer, printed as an upgrade command and re-run by `devp update
273/// --install` when the running binary came from it.
274pub const INSTALL_SH_URL: &str = "https://devprune.vkrishna04.me/install.sh";
275
276/// The PowerShell installer — same two callers as [`INSTALL_SH_URL`].
277pub const INSTALL_PS1_URL: &str = "https://devprune.vkrishna04.me/install.ps1";
278
279/// GitHub API endpoint for the latest published release.
280///
281/// Contacted by `devp update` and by the interval-gated check behind
282/// `run`/`status`/`init` (off via `update_check false` or `DEV_PRUNE_OFFLINE`). See the
283/// network policy in `docs/PRIVACY.md`.
284///
285/// This answers with the newest release GitHub has marked *latest*, which is the newest
286/// binary release and nothing else: the extension's releases are published with
287/// `make_latest: false` precisely so they never surface here. They must not. This URL's
288/// answer is fed to [`compare_versions`](crate::commands::update::compare_versions)
289/// after a leading `v` is stripped, and a `vscode-v0.4.0` tag arriving here would leave
290/// every installed copy unable to compare its own version for as long as that release
291/// stayed newest.
292pub const LATEST_RELEASE_API_URL: &str =
293 "https://api.github.com/repos/Life-Experimentalist/dev-prune/releases/latest";
294
295/// GitHub API endpoint listing releases newest-first, for the extension `.vsix`.
296///
297/// The extension ships on its own tags (`vscode-v*`) and its own release page, because
298/// its version is its own and it changes on its own schedule — see
299/// `.github/workflows/release-extension.yml`. That is also why this is a listing rather
300/// than [`LATEST_RELEASE_API_URL`]: there is no "latest release whose tag starts with"
301/// endpoint, so the caller walks the page and takes the first match.
302///
303/// One page is enough by a wide margin. The extension would have to go a hundred binary
304/// releases without a single release of its own before its newest fell off the end, and
305/// the fallback degrades to "install it by hand" rather than to anything wrong.
306pub const RELEASES_LIST_API_URL: &str =
307 "https://api.github.com/repos/Life-Experimentalist/dev-prune/releases?per_page=100";
308
309/// Tag prefix identifying a release of the VS Code extension rather than of the binary.
310pub const VSCODE_RELEASE_TAG_PREFIX: &str = "vscode-v";
311
312/// Where a release's assets live, with `{tag}` standing in for `v1.4.0`.
313///
314/// Used by `devp update --install` to fetch the uncompressed binary and its `.sha256`
315/// sidecar. Deliberately the plain `releases/download` path rather than an API endpoint:
316/// it needs no token, is not rate-limited per-IP the way `api.github.com` is, and is the
317/// same URL a person would click on the release page.
318pub const RELEASE_DOWNLOAD_BASE: &str =
319 "https://github.com/Life-Experimentalist/dev-prune/releases/download";
320
321/// The release-asset name for one platform, without the `.sha256` suffix.
322///
323/// This is a contract with the packaging steps in `.github/workflows/release.yml`, which
324/// build these exact names. A mismatch is not a compile error and not a test failure —
325/// it is a self-update that 404s on the day of a release — so the two are commented as
326/// referring to each other.
327///
328/// `None` on a platform the release does not build for, which is how a source build on,
329/// say, FreeBSD declines the direct route instead of downloading a Linux binary.
330pub fn release_asset_name(version: &str) -> Option<String> {
331 let os = match std::env::consts::OS {
332 "windows" => "windows",
333 "macos" => "darwin",
334 "linux" => "linux",
335 _ => return None,
336 };
337 // The release publishes `x64`/`arm64`/`x86`, not Rust's target-arch spellings.
338 let arch = match std::env::consts::ARCH {
339 "x86_64" => "x64",
340 "aarch64" => "arm64",
341 "x86" => "x86",
342 _ => return None,
343 };
344 // Only Windows ships a 32-bit build; on any other OS `x86` has no asset.
345 if arch == "x86" && os != "windows" {
346 return None;
347 }
348 let ext = if os == "windows" { ".exe" } else { "" };
349 Some(format!("dev-prune-v{version}-{os}-{arch}{ext}"))
350}
351
352/// Whether the periodic release check runs. On by default — see `Settings::update_check`.
353pub const DEFAULT_UPDATE_CHECK: bool = true;
354
355/// Whether a known-newer release installs itself at the end of a prune pass. On by
356/// default — see `Settings::auto_update`.
357pub const DEFAULT_AUTO_UPDATE: bool = true;
358
359/// Whether the installed version is pinned where it is. Off by default, and the only
360/// setting that outranks every other update path -- see `Settings::version_lock`.
361pub const DEFAULT_VERSION_LOCK: bool = false;
362
363/// Default interval, in days, between automatic release checks.
364///
365/// A week. Frequent enough that a security fix is not missed for long, rare enough that
366/// it is invisible in day-to-day use. Override with
367/// `devp config set update_check_interval_days`.
368pub const UPDATE_CHECK_INTERVAL_DAYS: i64 = 7;
369
370/// Default timeout for the release check. Short on purpose — this is a convenience,
371/// and a user waiting on a hung socket is worse than not knowing. Override with
372/// `devp config set update_check_timeout_secs` when a proxy needs longer.
373pub const UPDATE_CHECK_TIMEOUT_SECS: u64 = 5;
374
375/// Timeout for downloading a release binary in `devp update --install`.
376///
377/// Far longer than [`UPDATE_CHECK_TIMEOUT_SECS`], which only reads a few hundred bytes
378/// of JSON: this pulls several megabytes, and a slow connection is not an error.
379pub const UPDATE_DOWNLOAD_TIMEOUT_SECS: u64 = 300;
380
381/// Name of the registry JSON file.
382pub const REGISTRY_FILENAME: &str = "registry.json";
383
384/// Config directory name under user config root.
385pub const CONFIG_DIR_NAME: &str = "dev-prune";
386
387/// Global environment variable name to override config directory location.
388pub const ENV_CONFIG_DIR_OVERRIDE: &str = "DEV_PRUNE_CONFIG_DIR";
389
390/// Environment variable that suppresses the automatic setup pass entirely.
391///
392/// For images, CI and anyone who wants the binary and nothing else. `devp setup` still
393/// works when it is set — this only governs the unattended pass.
394pub const ENV_NO_AUTO_SETUP: &str = "DEV_PRUNE_NO_AUTO_SETUP";
395
396/// Environment variable that keeps the process off the network entirely — the release
397/// check and the extension-download fallback alike. Set by the test suites, useful on
398/// air-gapped machines; the durable per-user switch is
399/// `devp config set update_check false`.
400pub const ENV_OFFLINE: &str = "DEV_PRUNE_OFFLINE";
401
402/// Environment variable that stops both install scripts from asking anything.
403///
404/// The scripts offer to migrate a copy another package manager owns, and `devp install
405/// --channel installer` re-runs the script that made the offer. Without this the offer
406/// would be made again by that inner run, to a user who has already answered it — the
407/// same copy is still on PATH until the uninstall at the end. It is also the switch for
408/// a provisioning script that wants the install and none of the conversation.
409///
410/// Read by `scripts/install.sh`, `scripts/install.ps1`, and set by
411/// `src/commands/install.rs` on the child it spawns.
412pub const ENV_NO_MIGRATE_PROMPT: &str = "DEV_PRUNE_NO_MIGRATE_PROMPT";
413
414/// The install receipt, written beside the managed binary by whichever installer put it
415/// there. See [`crate::receipt`].
416///
417/// Also written by `scripts/install.sh` and `scripts/install.ps1`, by hand, in their own
418/// languages — which is why the field names have a test of their own.
419pub const INSTALL_RECEIPT_FILE: &str = "install.json";
420
421/// Set to any value to keep every full-screen view from opening, so the line-by-line
422/// fallback runs instead.
423///
424/// For agents and wrappers that hold a real terminal — the terminal test alone cannot
425/// tell them apart from a person, and a full-screen view waiting on a keypress from
426/// something that will never send one is a hang.
427pub const ENV_NO_TUI: &str = "DEV_PRUNE_NO_TUI";
428
429/// Environment variable that overrides the `language` setting for one invocation.
430///
431/// What a script or a CI job sets when it wants output in a known language whatever the
432/// machine is configured for. An unrecognised code falls back to [`DEFAULT_LANGUAGE`]
433/// rather than failing, because this is read before the command runs and a typo in a
434/// cosmetic setting should not stop a prune.
435pub const ENV_LANGUAGE: &str = "DEV_PRUNE_LANG";
436
437/// Windows environment variable that carries the *machine's* architecture when the
438/// running process is emulated.
439///
440/// `std::env::consts::ARCH` is baked in at compile time and only ever describes the
441/// binary. Windows sets this one under WOW64 and under ARM64 emulation, which is the
442/// only way a 32-bit build can tell that it is running on a 64-bit machine.
443/// `scripts/install.ps1` reads the same variable to choose which asset to download.
444pub const ENV_NATIVE_ARCH: &str = "PROCESSOR_ARCHITEW6432";
445
446/// Filename that, when present in a repo root, causes dev-prune to skip that repo entirely.
447///
448/// Create this file with: `touch ignore.devprune.json`
449pub const DEVPRUNE_IGNORE_FILE: &str = "ignore.devprune.json";
450
451/// Home-relative directory names that conventionally hold a developer's repositories.
452///
453/// Probed by name — existence is one `stat` each — when discovery has no registered
454/// repository to work outwards from. Deliberately a list of conventions rather than a
455/// walk of the home directory: `~` also contains `Library`, `AppData` and whatever a
456/// cloud-sync client has decided to materialise, and none of that is anybody's code.
457///
458/// `Documents/GitHub` is GitHub Desktop's default, `source/repos` is Visual Studio's,
459/// and `go/src` is the layout every pre-modules Go install still has.
460pub const CODE_ROOT_NAMES: &[&str] = &[
461 "Code",
462 "code",
463 "Projects",
464 "projects",
465 "Developer",
466 "Development",
467 "dev",
468 "src",
469 "repos",
470 "git",
471 "work",
472 "workspace",
473 "Documents/GitHub",
474 "source/repos",
475 "go/src",
476];
477
478/// Fewest path components a directory must have before discovery will scan it.
479///
480/// A repository cloned directly into the home directory has `~` as its parent, and
481/// "scan the parent of every registered repository" would then mean walking the whole
482/// home directory — every cache, every application-support tree, every cloud mount. The
483/// depth floor is what stops one repository in the wrong place from turning a cheap
484/// neighbourhood scan into a full-disk crawl.
485pub const MIN_DISCOVERY_ROOT_DEPTH: usize = 2;
486
487/// Default for whether the scheduled pass looks for unregistered repositories by itself.
488///
489/// On. The Git hook registers a repository the first time you commit in it, which leaves
490/// out every repository you cloned and have not committed to — exactly the idle ones
491/// worth pruning. Discovery is also the only way an assistant driving the tool learns
492/// about repositories nobody has mentioned to it.
493///
494/// Safe to have on by default because discovery only *registers*. A newly registered
495/// repository is still pruned only once it is idle past `idle_days`, only where a
496/// lockfile proves every directory recoverable, and only after the safety invariants
497/// pass — so the worst outcome of a wrong guess is a row in `devp status`.
498pub const DEFAULT_AUTO_DISCOVER: bool = true;
499
500/// Default timeout in seconds for lockfile enforcement / CLI commands (10 minutes).
501pub const DEFAULT_COMMAND_TIMEOUT_SECS: u64 = 600;
502
503/// Directory name pnpm gives a store it has to put on a volume of its own.
504///
505/// pnpm hardlinks its store into every `node_modules` it fills, and a hardlink cannot
506/// cross a filesystem. A project on a filesystem that is not the home directory's
507/// therefore gets a store at the root of *its* filesystem instead — `V:\\.pnpm-store` on
508/// a second Windows drive, `/mnt/data/.pnpm-store` on Linux, `/Volumes/Work/.pnpm-store`
509/// on macOS. `devp caches` looks for one on every volume that holds a registered
510/// repository, because `pnpm store path` only ever answers for the volume it is run on.
511pub const PNPM_VOLUME_STORE_DIR: &str = ".pnpm-store";
512
513/// Timeout for the "where does your cache live?" queries `devp caches` makes.
514///
515/// Deliberately not `command_timeout_secs`. That ceiling is sized for `npm ci` and
516/// `cargo metadata`; `npm config get cache` prints one line and returns. A query that
517/// has not answered in five seconds is a broken installation, and the report is better
518/// off falling back to the conventional path than waiting ten minutes for it.
519pub const CACHE_QUERY_TIMEOUT_SECS: u64 = 5;
520
521/// Timeout for asking a container engine how much disk it is using.
522///
523/// Longer than [`CACHE_QUERY_TIMEOUT_SECS`], because `docker system df` is not a config
524/// lookup: the daemon walks every image layer, container and build-cache record to
525/// answer it, and on a store with hundreds of images that is genuinely a few seconds. A
526/// daemon that is not running refuses in milliseconds either way, which is the case this
527/// ceiling is not for.
528pub const CONTAINER_QUERY_TIMEOUT_SECS: u64 = 20;
529
530/// Ceiling for one `devp caches clear` step.
531///
532/// Ten minutes, not the five seconds a query gets: `go clean -modcache` and deleting a
533/// multi-gigabyte `~/.gradle/caches` are genuinely slow, and on Windows every file in a
534/// module cache is read-only, so the delete is a chmod-and-unlink per file. A clear that
535/// has not finished in ten minutes is wedged, and killing it leaves a partially emptied
536/// cache the manager refills on its own.
537pub const CACHE_CLEAR_TIMEOUT_SECS: u64 = 600;
538
539/// Documentation URL for troubleshooting lockfile and pruning failures.
540pub const TROUBLESHOOTING_URL: &str = "https://devprune.vkrishna04.me/docs/troubleshooting";
541/// Name of the structured per-repository configuration file stored inside repo roots.
542pub const PER_REPO_CONFIG_FILE: &str = ".devprune.json";
543
544/// Name of the committed, team-wide half of a repository's configuration.
545///
546/// Same shape and same schema as [`PER_REPO_CONFIG_FILE`], and the opposite intent.
547/// `.devprune.json` is written into `.git/info/exclude` so one person's answer stays one
548/// person's; this one is meant to be `git add`-ed, so that "nobody prunes this
549/// repository" is a fact a fresh clone already knows rather than something every
550/// teammate has to be told. The `project.` prefix rather than a new extension is what
551/// keeps one JSON schema covering both files.
552pub const PROJECT_REPO_CONFIG_FILE: &str = "project.devprune.json";
553
554/// The adapter name the declared-directory pass answers to.
555///
556/// Not a package manager and not in `get_all_adapters()`, but it appears in the same
557/// column of the same report, so it needs the same kind of name — and `--only`,
558/// `--skip` and `disabled_adapters` all match on that column. Naming it here is what
559/// keeps the filter, the engine and the report agreeing on the spelling.
560pub const DECLARED_ADAPTER_NAME: &str = "declared";
561
562/// Public URL for the JSON Schema used by IDEs for .devprune.json IntelliSense.
563pub const JSON_SCHEMA_URL: &str = "https://devprune.vkrishna04.me/schemas/v1/devprune.schema.json";
564
565/// Directory under the user's home that marks a Claude Code installation.
566///
567/// Its presence is how the setup pass decides the machine has an agent to install the
568/// skill for; the directory itself is only ever created by Claude Code.
569pub const CLAUDE_HOME_DIR: &str = ".claude";
570
571/// Subdirectory of an agent's home where Agent Skills live, one directory per skill.
572pub const AGENT_SKILLS_SUBDIR: &str = "skills";
573
574/// Marketplace identifier (`publisher.name`) of the VS Code extension, as understood
575/// by `code --install-extension`.
576pub const VSCODE_EXTENSION_ID: &str = "VKrishna04.dev-prune";
577
578/// The WinGet package identifier, as published in `packaging/winget/` and in the
579/// manifests submitted to microsoft/winget-pkgs. `devp update` and `devp uninstall` name
580/// it back to the user, so a typo here sends someone to a command that does not resolve.
581pub const WINGET_PACKAGE_ID: &str = "VKrishna04.dev-prune";
582
583/// The Homebrew tap that carries the formula, as `brew tap` takes it. Not homebrew-core:
584/// plain `brew install dev-prune` resolves there, and that has a notability bar this
585/// project has not cleared. See `docs/DISTRIBUTION.md`.
586pub const HOMEBREW_TAP: &str = "Life-Experimentalist/tap";
587
588/// The Scoop bucket name and the repository behind it. `scoop bucket add` takes both,
589/// and the name is what `scoop install` then resolves `dev-prune` against.
590pub const SCOOP_BUCKET_NAME: &str = "life-experimentalist";
591/// Repository URL for [`SCOOP_BUCKET_NAME`].
592pub const SCOOP_BUCKET_URL: &str = "https://github.com/Life-Experimentalist/scoop-bucket";
593
594/// Where a person can read about the extension before installing it.
595///
596/// The offer prints all three. The two registries carry the same build — the release
597/// `.vsix` — but a machine that trusts one may not have the other, and someone who
598/// wants to read the source before letting anything into their editor needs neither.
599pub const VSCODE_MARKETPLACE_URL: &str =
600 "https://marketplace.visualstudio.com/items?itemName=VKrishna04.dev-prune";
601/// The Open VSX listing, which is what VSCodium, Cursor and Windsurf resolve against.
602pub const OPENVSX_URL: &str = "https://open-vsx.org/extension/VKrishna04/dev-prune";
603
604/// Name of the Windows Task Scheduler task the daemon registers.
605pub const WINDOWS_TASK_NAME: &str = "DevPrune";
606/// File name of the windowless scheduler binary — the same CLI built for the GUI
607/// subsystem, the relationship `pythonw.exe` has to `python.exe`. A `[[bin]]` target, so
608/// it ships in the Windows archives and `cargo install` places it; nothing generates it
609/// on a user's machine.
610pub const WINDOWS_WINDOWLESS_BIN: &str = "devpw.exe";
611/// Marker file (in the config directory) recording that this machine's Task Scheduler
612/// refused the sessionless (S4U) task registration, so setup keeps the console task
613/// instead of retrying the upgrade on every pass.
614///
615/// Named for what the task *is* and not for what it is not: this value lands in the
616/// binary's string table a few bytes from `devpw.exe`, and "devpw" next to "hidden" is
617/// what a reviewer running `strings` reads first. Nothing here is concealed from
618/// anyone — the task is listed in Task Scheduler under its own name and the marker is
619/// an empty file in the config directory — so the vocabulary must not imply otherwise.
620pub const SCHEDULER_WINDOWLESS_REFUSED_MARKER: &str = "scheduler-windowless-refused";
621
622/// Label of the macOS LaunchAgent the daemon registers (also names its plist file).
623pub const MACOS_LAUNCHD_LABEL: &str = "com.devprune.daemon";
624
625/// Where `devp skill --agent cursor` writes the per-repository rules.
626pub const CURSOR_RULES_FILE: &str = ".cursor/rules/dev-prune.mdc";
627
628/// Where `devp skill --agent windsurf` writes the per-repository rules.
629pub const WINDSURF_RULES_FILE: &str = ".windsurf/rules/dev-prune.md";
630
631/// Where `devp skill --agent antigravity` writes the per-repository rules —
632/// Antigravity (Google) reads workspace rules from `.agent/rules/`.
633pub const ANTIGRAVITY_RULES_FILE: &str = ".agent/rules/dev-prune.md";
634
635/// Where `devp skill --agent cline` writes its rules (Cline reads every file in the
636/// `.clinerules/` directory).
637pub const CLINE_RULES_FILE: &str = ".clinerules/dev-prune.md";
638
639/// Where `devp skill --agent agents-md` writes its marked block — the cross-tool
640/// convention read by Codex, Jules, Amp, Antigravity and others.
641pub const AGENTS_MD_FILE: &str = "AGENTS.md";
642
643/// Where `devp skill --agent roo` writes its rules (Roo Code reads every file in
644/// `.roo/rules/`).
645pub const ROO_RULES_FILE: &str = ".roo/rules/dev-prune.md";
646
647/// Where `devp skill --agent kilocode` writes its rules (Kilo Code reads every file in
648/// `.kilocode/rules/`).
649pub const KILOCODE_RULES_FILE: &str = ".kilocode/rules/dev-prune.md";
650
651/// Where `devp skill --agent continue` writes its rules (Continue reads every file in
652/// `.continue/rules/`).
653pub const CONTINUE_RULES_FILE: &str = ".continue/rules/dev-prune.md";
654
655/// Where `devp skill --agent amazon-q` writes its rules (Amazon Q Developer reads every
656/// file in `.amazonq/rules/`).
657pub const AMAZON_Q_RULES_FILE: &str = ".amazonq/rules/dev-prune.md";
658
659/// Where `devp skill --agent kiro` writes its rules (Kiro reads every file in
660/// `.kiro/steering/`).
661pub const KIRO_STEERING_FILE: &str = ".kiro/steering/dev-prune.md";
662
663/// Where `devp skill --agent trae` writes its rules (Trae reads every file in
664/// `.trae/rules/`).
665pub const TRAE_RULES_FILE: &str = ".trae/rules/dev-prune.md";
666
667/// The shared file `devp skill --agent junie` owns a marked block inside — JetBrains
668/// Junie reads one guidelines file, not a directory.
669pub const JUNIE_GUIDELINES_FILE: &str = ".junie/guidelines.md";
670
671/// The shared file `devp skill --agent gemini` owns a marked block inside — the Gemini
672/// CLI reads one context file per repository.
673pub const GEMINI_MD_FILE: &str = "GEMINI.md";
674
675/// The shared file `devp skill --agent zed` owns a marked block inside. Zed reads
676/// `.rules` ahead of every other convention, so a repository that also has an
677/// `AGENTS.md` still needs this one.
678pub const ZED_RULES_FILE: &str = ".rules";
679
680/// The shared file `devp skill --agent aider` owns a marked block inside. Aider is the
681/// one target that does not read its file on its own: `CONVENTIONS.md` is loaded only
682/// by `aider --read CONVENTIONS.md` or a `read: CONVENTIONS.md` line in
683/// `.aider.conf.yml`, which is why writing it prints that instruction.
684pub const AIDER_CONVENTIONS_FILE: &str = "CONVENTIONS.md";
685
686/// The shared file `devp skill --agent copilot` owns a marked block inside.
687pub const COPILOT_INSTRUCTIONS_FILE: &str = ".github/copilot-instructions.md";
688
689/// Markers around the block in [`COPILOT_INSTRUCTIONS_FILE`] that dev-prune manages.
690/// Everything outside them belongs to the user and is never touched.
691pub const RULES_BLOCK_START: &str = "<!-- dev-prune:rules:start -->";
692pub const RULES_BLOCK_END: &str = "<!-- dev-prune:rules:end -->";
693
694/// The phrase Git uses when it refuses a working tree owned by another account.
695///
696/// Matched against Git's own stderr rather than parsed: the message is twelve lines
697/// long, ten of which are identical for every repository refused, and `devp run`
698/// groups every repository sharing this cause under one explanation and one fix
699/// instead of reprinting those ten lines per repository.
700pub const GIT_DUBIOUS_OWNERSHIP: &str = "detected dubious ownership";
701
702/// The phrase Git uses when the path it was pointed at is not a working tree at all.
703///
704/// Same reasoning as [`GIT_DUBIOUS_OWNERSHIP`]: one cause, one fix, one paragraph.
705pub const GIT_NOT_A_REPOSITORY: &str = "not a git repository";