1use crate::names::BIN;
22use std::path::{Path, PathBuf};
23use std::sync::atomic::{AtomicBool, Ordering};
24use std::sync::Arc;
25use std::thread::JoinHandle;
26use std::time::{Duration, Instant};
27
28use crate::hooks::common::{hl, ok, say};
29use crate::manifest::{TreeGate, CACHE_PLACEHOLDER};
30use crate::tree_run::TreeRun;
31
32pub const TOGGLE: &str = "greengate.treeLint";
33pub const SLACK: &str = "greengate.treeLintSlack";
34pub const OUTPUTS: &str = "greengate.snapshotPrepareOutputs";
35
36const DEFAULT_SLACK: i64 = 2;
38
39const CEILING: Duration = Duration::from_secs(600);
43
44pub const DEFAULT_OUTPUTS: &[&str] = &[
47 "node_modules/",
48 ".venv/",
49 "venv/",
50 "__pycache__/",
51 ".ruff_cache/",
52 ".pytest_cache/",
53 ".mypy_cache/",
54 ".hypothesis/",
55 ".eslintcache",
56 ".prettiercache",
57 ".DS_Store",
58];
59
60pub fn enabled(settings: &crate::config::Settings) -> bool {
63 crate::config::boolean_or(settings, TOGGLE, crate::attest::enabled(settings))
64}
65
66fn slack_ms(settings: &crate::config::Settings) -> u64 {
67 u64::try_from(slack(settings).as_millis()).unwrap_or(u64::MAX)
68}
69
70fn slack(settings: &crate::config::Settings) -> Duration {
71 let secs = crate::config::integer_or(settings, SLACK, DEFAULT_SLACK, 0..=600);
72 crate::clock::scaled(Duration::from_secs(u64::try_from(secs).unwrap_or(0)))
73}
74
75pub fn outputs(settings: &crate::config::Settings) -> Vec<String> {
77 let mut out: Vec<String> = DEFAULT_OUTPUTS.iter().map(|s| s.to_string()).collect();
78 if let Some(v) = crate::config::string_value(settings, OUTPUTS) {
79 out.extend(v.split_whitespace().map(str::to_string));
80 }
81 out
82}
83
84pub fn allowed(entry: &str, patterns: &[String]) -> bool {
91 patterns.iter().any(|p| {
92 if let Some(dir) = p.strip_suffix('/') {
93 let dir = dir.trim_start_matches("./");
94 entry == format!("{dir}/")
95 || entry.starts_with(&format!("{dir}/"))
96 || entry.contains(&format!("/{dir}/"))
97 } else {
98 let base = entry
99 .trim_end_matches('/')
100 .rsplit('/')
101 .next()
102 .unwrap_or(entry);
103 glob_basename(p, base)
104 }
105 })
106}
107
108fn glob_basename(pattern: &str, name: &str) -> bool {
110 let parts: Vec<&str> = pattern.split('*').collect();
111 if parts.len() == 1 {
112 return pattern == name;
113 }
114 let mut rest = name;
115 for (i, part) in parts.iter().enumerate() {
116 if i == 0 {
117 let Some(r) = rest.strip_prefix(part) else {
118 return false;
119 };
120 rest = r;
121 } else if i == parts.len() - 1 {
122 return rest.ends_with(part);
123 } else {
124 let Some(at) = rest.find(part) else {
125 return false;
126 };
127 rest = &rest[at + part.len()..];
128 }
129 }
130 true
131}
132
133pub fn guard(settings: &crate::config::Settings) -> Option<String> {
136 if !crate::git_states_in_progress().is_empty() {
137 return Some("a merge, rebase, cherry-pick or revert is in progress".into());
138 }
139 if !crate::git::succeeds(&["diff", "--quiet"]) {
140 return Some("tracked files have unstaged edits (the tree is not the commit's)".into());
141 }
142 content_guard(Path::new(&crate::hooks::common::repo_root()), settings)
143}
144
145fn content_guard(dir: &Path, settings: &crate::config::Settings) -> Option<String> {
147 let Some(untracked) = crate::git::stdout_in(
149 dir,
150 &["ls-files", "--others", "--exclude-standard", "--directory"],
151 ) else {
152 return Some("git could not list untracked files".into());
153 };
154 if let Some(first) = untracked.lines().find(|l| !l.trim().is_empty()) {
155 return Some(format!("an untracked file is present ({first})"));
156 }
157 let Some(ignored) = crate::git::stdout_in(
158 dir,
159 &[
160 "ls-files",
161 "--others",
162 "--ignored",
163 "--exclude-standard",
164 "--directory",
165 ],
166 ) else {
167 return Some("git could not list ignored files".into());
168 };
169 let allow = outputs(settings);
170 if let Some(first) = ignored
171 .lines()
172 .map(str::trim)
173 .find(|l| !l.is_empty() && !allowed(l, &allow))
174 {
175 return Some(format!(
176 "an ignored file outside {} is present ({first})",
177 hl("snapshotPrepareOutputs")
178 ));
179 }
180 None
181}
182
183pub fn argv(gate: &TreeGate, cache_flags: &str) -> Vec<String> {
186 if cache_flags.trim().is_empty() {
187 return vec!["sh".into(), "-c".into(), gate.normalized()];
189 }
190 let command: Vec<&str> = gate
191 .command
192 .split_whitespace()
193 .flat_map(|w| {
194 if w == CACHE_PLACEHOLDER {
195 cache_flags.split_whitespace().collect::<Vec<_>>()
196 } else {
197 vec![w]
198 }
199 })
200 .collect();
201 vec!["sh".into(), "-c".into(), command.join(" ")]
202}
203
204enum Decision {
206 Ran(TreeRun, u64),
208 Skew(String),
210 NoVersion,
212 Cold,
214 Busy,
216 Slow(u64),
218}
219
220type InFlight = (String, JoinHandle<Decision>);
221
222pub struct SideCar {
224 cancel: Arc<AtomicBool>,
225 running: Vec<InFlight>,
226}
227
228static EVIDENCE: std::sync::Mutex<Vec<crate::gate_stamp::Run>> = std::sync::Mutex::new(Vec::new());
231
232fn note(name: &str, outcome: crate::gate_stamp::RunOutcome, ms: u64) {
233 let at = std::time::SystemTime::now()
234 .duration_since(std::time::UNIX_EPOCH)
235 .map(|d| d.as_secs())
236 .unwrap_or(0);
237 if let Ok(mut e) = EVIDENCE.lock() {
238 e.push(crate::gate_stamp::Run {
239 at,
240 gate: format!("tree-{name}"),
241 outcome,
242 ms,
243 });
244 }
245}
246
247pub fn note_withheld(gates: &[TreeGate]) {
249 for g in gates {
250 note(&g.name, crate::gate_stamp::RunOutcome::Withheld, 0);
251 }
252}
253
254pub fn flush_evidence(tree: &str) {
257 let runs = EVIDENCE
258 .lock()
259 .map(|mut e| std::mem::take(&mut *e))
260 .unwrap_or_default();
261 if !runs.is_empty() {
262 crate::gate_stamp::record_runs(tree, &runs);
263 }
264}
265
266fn cwd_of(root: &Path, gate: &TreeGate) -> PathBuf {
267 match &gate.cwd {
268 Some(dir) => root.join(dir),
269 None => root.to_path_buf(),
270 }
271}
272
273pub fn start(
281 settings: &crate::config::Settings,
282 root: &Path,
283 gates: &[TreeGate],
284 pins: &[crate::manifest::ToolPin],
285 cover_ms: u64,
286) -> Option<SideCar> {
287 if gates.is_empty() {
288 return None;
289 }
290 if cfg!(not(unix)) {
291 say(" tree gates need a Unix shell and do not run here — CI will lint");
292 return None;
293 }
294 let cancel = Arc::new(AtomicBool::new(false));
295 let deadline = Instant::now() + CEILING;
296 let budget_ms = cover_ms.saturating_add(slack_ms(settings));
297 let running = gates
298 .iter()
299 .map(|g| {
300 let gate = g.clone();
301 let pins = pins.to_vec();
302 let cwd = cwd_of(root, g);
303 let flag = Arc::clone(&cancel);
304 let handle = std::thread::spawn(move || {
305 decide_and_run(&gate, &cwd, &pins, budget_ms, deadline, &flag)
306 });
307 (g.name.clone(), handle)
308 })
309 .collect();
310 Some(SideCar { cancel, running })
311}
312
313fn decide_and_run(
314 g: &TreeGate,
315 cwd: &Path,
316 pins: &[crate::manifest::ToolPin],
317 budget_ms: u64,
318 deadline: Instant,
319 cancel: &AtomicBool,
320) -> Decision {
321 if let Some(ms) = crate::tree_cache::gate_last_ms(g).filter(|ms| *ms > budget_ms) {
325 return Decision::Slow(ms);
326 }
327 let Some(version) = crate::tree_cache::tool_version(cwd, g, deadline, cancel) else {
328 return Decision::NoVersion;
329 };
330 if let Some(why) = crate::tree_skew::skew(cwd, g, pins, &version) {
331 return Decision::Skew(why);
332 }
333 let Some(ns) =
334 crate::tree_cache::namespace(g, &version).filter(|ns| crate::tree_cache::is_warm(g, ns))
335 else {
336 return Decision::Cold;
337 };
338 let Some(ns_dir) = crate::tree_cache::gate_dir(g).map(|d| d.join(&ns)) else {
339 return Decision::Cold;
340 };
341 let Some(lock) = crate::tree_cache::try_lock(g) else {
342 return Decision::Busy;
343 };
344 let argv = argv(
345 g,
346 &crate::tree_cache::cache_flags(cwd, g, &ns_dir, deadline, cancel),
347 );
348 let began = Instant::now();
349 let run = crate::tree_run::run(&argv, cwd, deadline, cancel);
350 let ms = u64::try_from(began.elapsed().as_millis()).unwrap_or(u64::MAX);
351 drop(lock);
354 Decision::Ran(run, ms)
355}
356
357pub fn tree_verdict(gates: &[TreeGate], tips: &[String]) -> (Vec<String>, Vec<String>) {
361 let trees: Vec<Option<String>> = tips
362 .iter()
363 .map(|t| crate::git::stdout(&["rev-parse", &format!("{t}^{{tree}}")]))
364 .collect();
365 let tokens: Vec<Vec<String>> = trees
366 .iter()
367 .map(|t| {
368 t.as_deref()
369 .map(crate::gate_stamp::tree_tokens)
370 .unwrap_or_default()
371 })
372 .collect();
373 let mut proven = Vec::new();
374 let mut unproven = Vec::new();
375 for g in gates {
376 let key = g.stamp_key();
377 if !tips.is_empty() && tokens.iter().all(|toks| toks.iter().any(|t| t == &key)) {
378 proven.push(g.id());
379 } else {
380 unproven.push(g.name.clone());
381 }
382 }
383 (proven, unproven)
384}
385
386pub const REHEARSAL_TIMEOUT: &str = "greengate.treeLintRehearsalTimeout";
387pub const WAIT: &str = "greengate.treeLintWait";
388
389pub fn prepare_guard(snapshot: &Path, settings: &crate::config::Settings) -> Option<String> {
394 if !crate::git::succeeds_in(snapshot, &["diff", "--quiet", "HEAD"]) {
395 return Some("snapshotPrepare changed tracked content".into());
396 }
397 content_guard(snapshot, settings)
398}
399
400pub fn rehearse(
405 settings: &crate::config::Settings,
406 snapshot: &Path,
407 tree: &str,
408 gates: &[TreeGate],
409) -> Vec<String> {
410 if gates.is_empty() || cfg!(not(unix)) {
411 return Vec::new();
412 }
413 if let Some(why) = prepare_guard(snapshot, settings) {
414 println!("tree lint not proven in the snapshot: {why}");
415 note_withheld(gates);
416 flush_evidence(tree);
417 return Vec::new();
418 }
419 let budget = crate::config::integer_or(settings, REHEARSAL_TIMEOUT, 120, 1..=3600);
420 let budget = Duration::from_secs(u64::try_from(budget).unwrap_or(120));
421 let mut tokens = Vec::new();
422 let pins = crate::manifest::load(snapshot).pins;
424 for g in gates {
425 let cwd = cwd_of(snapshot, g);
426 let Some(version) = crate::tree_cache::tool_version(
427 &cwd,
428 g,
429 Instant::now() + budget,
430 &AtomicBool::new(false),
431 ) else {
432 note(&g.name, crate::gate_stamp::RunOutcome::Skew, 0);
433 println!(
434 "tree lint not proven: {} — its tool's version could not be read",
435 g.name
436 );
437 continue;
438 };
439 if let Some(why) = crate::tree_skew::skew(&cwd, g, &pins, &version) {
440 note(&g.name, crate::gate_stamp::RunOutcome::Skew, 0);
441 println!("tree lint not proven: {} — {why}", g.name);
442 continue;
443 }
444 let started = Instant::now();
445 let run = crate::tree_run::run(
446 &argv(g, ""),
447 &cwd,
448 started + budget,
449 &AtomicBool::new(false),
450 );
451 let ms = u64::try_from(started.elapsed().as_millis()).unwrap_or(u64::MAX);
452 match run {
453 TreeRun::Passed => {
454 note(&g.name, crate::gate_stamp::RunOutcome::Passed, ms);
455 println!(
456 "tree lint proven: {} ({:.1}s)",
457 g.name,
458 started.elapsed().as_secs_f32()
459 );
460 tokens.push(g.stamp_key());
461 }
462 other => {
463 let outcome = match other {
464 TreeRun::Failed(_) => crate::gate_stamp::RunOutcome::Failed,
465 TreeRun::TimedOut | TreeRun::Cancelled => {
466 crate::gate_stamp::RunOutcome::Cancelled
467 }
468 TreeRun::Spawn(_) => crate::gate_stamp::RunOutcome::Unavailable,
469 TreeRun::Passed => unreachable!("matched above"),
470 };
471 note(&g.name, outcome, ms);
472 println!("tree lint not proven: {} — {other:?}", g.name);
473 }
474 }
475 }
476 flush_evidence(tree);
477 if !tokens.is_empty() && !crate::gate_stamp::stamp_tree(tree, &tokens) {
478 println!("git refused the tree note — nothing stamped");
479 return Vec::new();
480 }
481 tokens
482}
483
484pub fn await_verdict(
489 settings: &crate::config::Settings,
490 gates: &[TreeGate],
491 tips: &[String],
492 started: Instant,
493) -> (Vec<String>, Vec<String>) {
494 let secs = crate::config::integer_or(settings, WAIT, 30, 0..=3600);
495 let until =
496 started + crate::clock::scaled(Duration::from_secs(u64::try_from(secs).unwrap_or(30)));
497 let trees: Vec<String> = tips
498 .iter()
499 .filter_map(|t| crate::git::stdout(&["rev-parse", &format!("{t}^{{tree}}")]))
500 .collect();
501 loop {
502 let verdict = tree_verdict(gates, tips);
503 let rehearsing =
504 crate::rehearsal::read().is_some_and(|s| s.alive() && trees.contains(&s.tree));
505 if verdict.1.is_empty() || !rehearsing || Instant::now() >= until {
506 return verdict;
507 }
508 std::thread::sleep(Duration::from_millis(250));
509 }
510}
511
512pub fn fit_line(prefix: &str, body: &str, suffix: &str) -> String {
516 const COLUMNS: usize = 80;
517 let room = COLUMNS.saturating_sub(prefix.chars().count() + suffix.chars().count());
518 let body = if body.chars().count() > room && room > 1 {
519 let cut: String = body.chars().take(room - 1).collect();
520 format!("{cut}…")
521 } else {
522 body.to_string()
523 };
524 format!("{prefix}{body}{suffix}")
525}
526
527#[cfg(unix)]
529fn warm_log() -> Option<PathBuf> {
530 crate::git::stdout(&["rev-parse", "--absolute-git-dir"])
531 .map(|d| PathBuf::from(d).join(crate::names::WARM_LOG))
532}
533
534fn warm_later(cold: &[String]) {
538 #[cfg(unix)]
539 {
540 let Some(log) = warm_log() else { return };
541 match crate::rehearsal::spawn_amont(&["warm", "--worker"], &log) {
542 Ok(_) => say(&fit_line(
543 " tree lint cold: ",
544 &cold.join(" "),
545 " — warming ($GIT_DIR/greengate-warm.log)",
546 )),
547 Err(e) => say(&format!(
548 " tree lint cold: {} — could not start the warm-up ({e}); run {}",
549 cold.join(" "),
550 hl(&format!("{BIN} warm"))
551 )),
552 }
553 }
554 #[cfg(not(unix))]
555 {
556 let _ = cold;
557 }
558}
559
560pub fn warm(root: &Path) -> i32 {
566 let manifest = crate::manifest::load(root);
568 if manifest.tree.is_empty() {
569 eprintln!("{BIN} warm: no trusted tree gate here");
570 return 0;
571 }
572 for g in &manifest.tree {
573 let cwd = cwd_of(root, g);
574 let Some(version) = crate::tree_cache::tool_version(
575 &cwd,
576 g,
577 Instant::now() + Duration::from_secs(60),
578 &AtomicBool::new(false),
579 ) else {
580 println!("{}: its tool's version could not be read — skipped", g.name);
581 continue;
582 };
583 let Some(ns) = crate::tree_cache::namespace(g, &version) else {
584 println!("{}: git could not name the namespace — skipped", g.name);
585 continue;
586 };
587 if crate::tree_cache::is_warm(g, &ns) {
588 println!("{}: already warm", g.name);
589 continue;
590 }
591 let Some(_lock) = crate::tree_cache::try_lock(g) else {
592 println!("{}: another run holds the cache — skipped", g.name);
593 continue;
594 };
595 let Some(ns_dir) = crate::tree_cache::enter_namespace(g, &ns) else {
596 println!("{}: cannot create the cache directory — skipped", g.name);
597 continue;
598 };
599 let argv = argv(
600 g,
601 &crate::tree_cache::cache_flags(
602 &cwd,
603 g,
604 &ns_dir,
605 Instant::now() + CEILING,
606 &AtomicBool::new(false),
607 ),
608 );
609 let started = Instant::now();
610 let run = crate::tree_run::run(&argv, &cwd, started + CEILING, &AtomicBool::new(false));
611 let secs = started.elapsed().as_secs_f32();
612 match run {
613 TreeRun::Passed | TreeRun::Failed(_) => {
614 crate::tree_cache::mark_complete(&ns_dir);
615 println!("{}: warm ({secs:.1}s)", g.name);
616 }
617 other => println!("{}: not warmed — {other:?}", g.name),
618 }
619 }
620 0
621}
622
623pub fn finish(settings: &crate::config::Settings, car: SideCar, stampable: bool) -> Vec<String> {
629 use crate::gate_stamp::RunOutcome;
630 let until = Instant::now()
631 + if stampable {
632 slack(settings)
633 } else {
634 Duration::ZERO
635 };
636 while Instant::now() < until && car.running.iter().any(|(_, h)| !h.is_finished()) {
637 std::thread::sleep(Duration::from_millis(20));
638 }
639 car.cancel.store(true, Ordering::SeqCst);
640 let mut proven = Vec::new();
641 let mut unproven: Vec<(String, String, bool)> = Vec::new();
643 let mut cold = Vec::new();
644 for (name, handle) in car.running {
645 let decision = handle
646 .join()
647 .unwrap_or(Decision::Ran(TreeRun::Spawn("thread died".into()), 0));
648 match decision {
649 Decision::Ran(run, ms) => {
650 if !matches!(run, TreeRun::Spawn(_)) {
653 crate::tree_cache::record_gate_last_ms(&name, ms);
654 }
655 match run {
656 TreeRun::Passed if stampable => {
657 note(&name, RunOutcome::Passed, ms);
658 proven.push(name);
659 }
660 TreeRun::Passed => note(&name, RunOutcome::Withheld, ms),
661 TreeRun::Failed(summary) => {
662 note(&name, RunOutcome::Failed, ms);
663 unproven.push((name, summary, false));
664 }
665 TreeRun::TimedOut | TreeRun::Cancelled => {
666 note(&name, RunOutcome::Cancelled, ms);
667 unproven.push((
668 name,
669 "still running when the commit was ready".into(),
670 false,
671 ));
672 }
673 TreeRun::Spawn(e) => {
674 note(&name, RunOutcome::Unavailable, ms);
675 unproven.push((name, format!("could not start ({e})"), false));
676 }
677 }
678 }
679 Decision::Skew(why) => {
680 note(&name, RunOutcome::Skew, 0);
681 unproven.push((name, why, false));
682 }
683 Decision::NoVersion => {
684 note(&name, RunOutcome::Skew, 0);
685 unproven.push((
686 name,
687 "its tool's version could not be read in time".into(),
688 false,
689 ));
690 }
691 Decision::Cold => {
692 note(&name, RunOutcome::Cold, 0);
693 cold.push(name);
694 }
695 Decision::Busy => {
696 note(&name, RunOutcome::Busy, 0);
697 unproven.push((name, "a warm-up holds its cache".into(), false));
698 }
699 Decision::Slow(ms) => {
700 note(&name, RunOutcome::Slow, 0);
701 unproven.push((
702 name,
703 format!(
704 "skipped: needs ~{:.1}s, more than this commit leaves",
705 ms as f64 / 1000.0
706 ),
707 true,
708 ));
709 }
710 }
711 }
712 if stampable && !proven.is_empty() {
716 let moved = if crate::git::succeeds(&["diff", "--quiet"]) {
717 content_guard(Path::new(&crate::hooks::common::repo_root()), settings)
718 } else {
719 Some("tracked files changed while it ran".into())
720 };
721 if let Some(why) = moved {
722 for name in proven.drain(..) {
723 note(&name, RunOutcome::Withheld, 0);
724 unproven.push((name, format!("the tree moved while it ran ({why})"), false));
725 }
726 }
727 }
728 if !proven.is_empty() {
729 ok(settings, &format!("tree lint proven: {}", proven.join(" ")));
730 }
731 let quiet = crate::live::quiet(settings);
734 let unproven: Vec<(String, String, bool)> = unproven
735 .into_iter()
736 .filter(|(_, _, skipped)| !(quiet && *skipped))
737 .collect();
738 if stampable && !unproven.is_empty() {
739 say(" tree lint not proven — CI will lint:");
740 for (name, why, _) in &unproven {
741 say(&fit_line(
742 &format!(" {} — ", crate::ui::sanitize(name)),
743 &crate::ui::sanitize(why),
744 "",
745 ));
746 }
747 }
748 if !cold.is_empty() {
749 warm_later(&cold);
750 }
751 proven.iter().map(|n| format!("tree:{n}")).collect()
752}
753
754#[cfg(test)]
755mod tests {
756 use super::*;
757
758 fn pats(extra: &[&str]) -> Vec<String> {
759 DEFAULT_OUTPUTS
760 .iter()
761 .chain(extra)
762 .map(|s| s.to_string())
763 .collect()
764 }
765
766 #[test]
767 fn tree_lint_allows_tool_caches_anywhere() {
768 let p = pats(&[]);
769 assert!(allowed("node_modules/", &p));
770 assert!(allowed("packages/api/__pycache__/", &p));
771 assert!(allowed(".venv/", &p));
772 assert!(allowed("web/.DS_Store", &p));
773 }
774
775 #[test]
776 fn tree_lint_refuses_an_ignored_module() {
777 let p = pats(&[]);
778 assert!(!allowed("src/generated/types.ts", &p));
779 assert!(!allowed(".react-router/", &p));
780 assert!(!allowed("build/", &p));
781 }
782
783 #[test]
784 fn tree_lint_repo_patterns_extend_the_list() {
785 let p = pats(&["build/", ".react-router/", "*.db", "*.db-wal"]);
786 assert!(allowed("build/", &p));
787 assert!(allowed(".react-router/", &p));
788 assert!(allowed("landscape.db", &p));
789 assert!(allowed("landscape.db-wal", &p));
790 assert!(!allowed("landscape.sqlite", &p));
791 }
792
793 #[test]
794 fn tree_lint_fit_line_cuts_the_body_to_eighty_columns() {
795 let l = fit_line(
796 " tree lint not proven: ",
797 "eslint — 12 problems (12 errors, 0 warnings) and some more words",
798 " — CI will lint",
799 );
800 assert_eq!(l.chars().count(), 80, "{l}");
801 assert!(l.ends_with("… — CI will lint"), "{l}");
802 let body = fit_line(" eslint — ", &"x".repeat(200), "");
803 assert_eq!(body.chars().count(), 80);
804 let short = fit_line("a", "b", "c");
805 assert_eq!(short, "abc");
806 }
807
808 #[test]
809 fn tree_lint_argv_runs_through_sh_with_cache_expanded() {
810 let g = crate::manifest::tree_gates("tree eslint eslint * attest npm run lint -- {cache}")
811 .remove(0);
812 assert_eq!(
813 argv(&g, "--cache --cache-location /x"),
814 vec!["sh", "-c", "npm run lint -- --cache --cache-location /x"]
815 );
816 assert_eq!(argv(&g, ""), vec!["sh", "-c", "npm run lint"]);
817 }
818}