Skip to content

Commit f1bbfb3

Browse files
authored
Merge branch 'main' into agent-consolidation
2 parents 5b4423c + 9e35163 commit f1bbfb3

File tree

16 files changed

+141
-10
lines changed

16 files changed

+141
-10
lines changed

packages/cli/binding/src/cli.rs

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,21 @@ fn build_pack_cache_inputs() -> Vec<UserInputEntry> {
517517
]
518518
}
519519

520+
/// Cache input entries for the check command.
521+
/// The vp check subprocess is a full vp CLI process (not resolved to a binary like
522+
/// build/lint/fmt), so it accesses additional directories that must be excluded:
523+
/// - `.vite-temp`: config compilation cache, read+written during vp CLI startup
524+
/// - `.vite/task-cache`: task runner state files that change after each run
525+
fn check_cache_inputs() -> Vec<UserInputEntry> {
526+
vec![
527+
UserInputEntry::Auto(AutoInput { auto: true }),
528+
exclude_glob("!node_modules/.vite-temp/**", InputBase::Workspace),
529+
exclude_glob("!node_modules/.vite-temp/**", InputBase::Package),
530+
exclude_glob("!node_modules/.vite/task-cache/**", InputBase::Workspace),
531+
exclude_glob("!node_modules/.vite/task-cache/**", InputBase::Package),
532+
]
533+
}
534+
520535
fn merge_resolved_envs(
521536
envs: &Arc<FxHashMap<Arc<OsStr>, Arc<OsStr>>>,
522537
resolved_envs: Vec<(String, String)>,
@@ -587,10 +602,14 @@ impl CommandHandler for VitePlusCommandHandler {
587602
};
588603
match cli_args {
589604
CLIArgs::Synthesizable(SynthesizableSubcommand::Check { .. }) => {
590-
// Check is a composite command — run as a subprocess in task scripts
591-
Ok(HandledCommand::Synthesized(
592-
command.to_synthetic_plan_request(UserCacheConfig::disabled()),
593-
))
605+
// Check is a composite command (fmt + lint) — run as a subprocess in task scripts
606+
Ok(HandledCommand::Synthesized(command.to_synthetic_plan_request(
607+
UserCacheConfig::with_config(EnabledCacheConfig {
608+
env: Some(Box::new([Str::from("OXLINT_TSGOLINT_PATH")])),
609+
untracked_env: None,
610+
input: Some(check_cache_inputs()),
611+
}),
612+
)))
594613
}
595614
CLIArgs::Synthesizable(subcmd) => {
596615
let resolved =

packages/cli/snap-tests-global/new-vite-monorepo-bun/snap.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ vite.config.ts
2020
],
2121
"type": "module",
2222
"scripts": {
23-
"ready": "vp fmt && vp lint && vp run -r test && vp run -r build",
23+
"ready": "vp check && vp run -r test && vp run -r build",
2424
"dev": "vp run website#dev",
2525
"prepare": "vp config"
2626
},

packages/cli/snap-tests-global/new-vite-monorepo/snap.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ vite.config.ts
1616
"private": true,
1717
"type": "module",
1818
"scripts": {
19-
"ready": "vp fmt && vp lint && vp run -r test && vp run -r build",
19+
"ready": "vp check && vp run -r test && vp run -r build",
2020
"dev": "vp run website#dev",
2121
"prepare": "vp config"
2222
},
@@ -140,7 +140,7 @@ vite.config.ts
140140
"private": true,
141141
"type": "module",
142142
"scripts": {
143-
"ready": "vp fmt && vp lint && vp run -r test && vp run -r build",
143+
"ready": "vp check && vp run -r test && vp run -r build",
144144
"dev": "vp run website#dev",
145145
"prepare": "vp config"
146146
},
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"name": "check-cache-disabled-test",
3+
"type": "module",
4+
"scripts": {
5+
"check": "vp check"
6+
}
7+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
> vp run check # vp check should have cache disabled without run.cache
2+
$ vp check ⊘ cache disabled
3+
pass: All 3 files are correctly formatted (<variable>ms, <variable> threads)
4+
pass: Found no warnings or lint errors in 1 file (<variable>ms, <variable> threads)
5+
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
function hello() {
2+
return "hello";
3+
}
4+
5+
export { hello };
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"commands": ["vp run check # vp check should have cache disabled without run.cache"]
3+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"name": "check-cache-enabled-test",
3+
"type": "module",
4+
"scripts": {
5+
"check": "vp check"
6+
}
7+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
> vp run check # first run should be cache miss
2+
$ vp check
3+
pass: All 4 files are correctly formatted (<variable>ms, <variable> threads)
4+
pass: Found no warnings or lint errors in 2 files (<variable>ms, <variable> threads)
5+
6+
7+
> vp run check # second run should be cache hit
8+
$ vp check ◉ cache hit, replaying
9+
pass: All 4 files are correctly formatted (<variable>ms, <variable> threads)
10+
pass: Found no warnings or lint errors in 2 files (<variable>ms, <variable> threads)
11+
12+
---
13+
vp run: cache hit, <variable>ms saved.
14+
15+
> echo 'export const foo = 1;' > src/foo.js
16+
> vp run check # third run should be cache miss after new file added
17+
$ vp check ○ cache miss: 'foo.js' added in 'src', executing
18+
pass: All 5 files are correctly formatted (<variable>ms, <variable> threads)
19+
pass: Found no warnings or lint errors in 3 files (<variable>ms, <variable> threads)
20+
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
function hello() {
2+
return "hello";
3+
}
4+
5+
export { hello };

0 commit comments

Comments
 (0)