Skip to content

Commit afa48fc

Browse files
committed
feat(cli): interactive package picker for bare app commands at the workspace root
Replaces the interim TTY listing with the fuzzy vite_select picker (the vp run selector component): typing filters packages, Enter runs the selection as an implicit -C, Ctrl+C cancels with exit 130. Single-runnable auto-select and the non-interactive listing are unchanged. Every picker render emits a package-select:<query>:<index> milestone so PTY snapshot tests synchronize on real keystrokes (picker_select / picker_cancel / non-TTY listing cases, both flavors). Requires the configurable prompt from voidzero-dev/vite-task#510; the vite-task pin points at that PR's commit and needs a re-bump to vite-task main after it merges.
1 parent c27f054 commit afa48fc

13 files changed

Lines changed: 295 additions & 58 deletions

File tree

Cargo.lock

Lines changed: 31 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ dunce = "1.0.5"
194194
fast-glob = "1.0.0"
195195
flate2 = { version = "=1.1.9", features = ["zlib-rs"] }
196196
form_urlencoded = "1.2.1"
197-
fspy = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "6cfa6e47a1a5fdadd215e1556766cc753603a539" }
197+
fspy = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "a301aff2705ab7c663cc847dcc7c42f178f1fb68" }
198198
futures = "0.3.31"
199199
futures-util = "0.3.31"
200200
glob = "0.3.2"
@@ -251,8 +251,8 @@ pretty_assertions = "1.4.1"
251251
phf = "0.13.0"
252252
prettyplease = "0.2.32"
253253
proc-macro2 = "1"
254-
pty_terminal_test = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "6cfa6e47a1a5fdadd215e1556766cc753603a539" }
255-
pty_terminal_test_client = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "6cfa6e47a1a5fdadd215e1556766cc753603a539" }
254+
pty_terminal_test = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "a301aff2705ab7c663cc847dcc7c42f178f1fb68" }
255+
pty_terminal_test_client = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "a301aff2705ab7c663cc847dcc7c42f178f1fb68" }
256256
quote = "1"
257257
rayon = "1.10.0"
258258
regex = "1.11.1"
@@ -276,7 +276,7 @@ sha2 = "0.10.9"
276276
shell-escape = "0.1.5"
277277
simdutf8 = "0.1.5"
278278
smallvec = { version = "1.15.1", features = ["union"] }
279-
snapshot_test = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "6cfa6e47a1a5fdadd215e1556766cc753603a539" }
279+
snapshot_test = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "a301aff2705ab7c663cc847dcc7c42f178f1fb68" }
280280
string_cache = "0.9.0"
281281
sugar_path = { version = "2.0.1", features = ["cached_current_dir"] }
282282
supports-color = "3"
@@ -313,11 +313,12 @@ vite_pm_cli = { path = "crates/vite_pm_cli" }
313313
vite_setup = { path = "crates/vite_setup" }
314314
vite_shared = { path = "crates/vite_shared" }
315315
vite_static_config = { path = "crates/vite_static_config" }
316-
vite_path = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "6cfa6e47a1a5fdadd215e1556766cc753603a539" }
317-
vite_powershell = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "6cfa6e47a1a5fdadd215e1556766cc753603a539" }
318-
vite_str = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "6cfa6e47a1a5fdadd215e1556766cc753603a539" }
319-
vite_task = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "6cfa6e47a1a5fdadd215e1556766cc753603a539" }
320-
vite_workspace = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "6cfa6e47a1a5fdadd215e1556766cc753603a539" }
316+
vite_path = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "a301aff2705ab7c663cc847dcc7c42f178f1fb68" }
317+
vite_powershell = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "a301aff2705ab7c663cc847dcc7c42f178f1fb68" }
318+
vite_select = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "a301aff2705ab7c663cc847dcc7c42f178f1fb68" }
319+
vite_str = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "a301aff2705ab7c663cc847dcc7c42f178f1fb68" }
320+
vite_task = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "a301aff2705ab7c663cc847dcc7c42f178f1fb68" }
321+
vite_workspace = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "a301aff2705ab7c663cc847dcc7c42f178f1fb68" }
321322
walkdir = "2.5.0"
322323
wax = "0.6.0"
323324
which = "8.0.0"

crates/vite_cli_snapshots/tests/cli_snapshots/fixtures/app_root_listing/snapshots.toml

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,36 @@
22
name = "listing"
33
vp = ["local", "global"]
44
comment = """
5-
A bare app command at a workspace root with several candidate packages prints
5+
A bare app command at a workspace root without an interactive terminal prints
66
the ranked package listing with -C hints and exits 1 instead of building the
7-
root, even in an interactive terminal (rfcs/cwd-flag.md).
7+
root (rfcs/cwd-flag.md).
88
"""
9-
steps = [["vp", "build"]]
9+
steps = [{ argv = ["vp", "build"], tty = false }]
10+
11+
[[case]]
12+
name = "picker_select"
13+
vp = ["local", "global"]
14+
comment = """
15+
A bare app command at a workspace root with several candidates opens the
16+
fuzzy package picker (the vp run selector component); typing filters, Enter
17+
runs the selection as an implicit -C (rfcs/cwd-flag.md).
18+
"""
19+
steps = [
20+
{ argv = ["vp", "build"], interactions = [
21+
{ "expect-milestone" = "package-select::0" },
22+
{ "write" = "web" },
23+
{ "expect-milestone" = "package-select:web:0" },
24+
{ "write-key" = "enter" },
25+
] },
26+
]
27+
28+
[[case]]
29+
name = "picker_cancel"
30+
vp = ["local", "global"]
31+
comment = "Ctrl+C in the package picker cancels with exit 130 and runs nothing."
32+
steps = [
33+
{ argv = ["vp", "build"], interactions = [
34+
{ "expect-milestone" = "package-select::0" },
35+
{ "write-key" = "ctrl-c" },
36+
] },
37+
]

crates/vite_cli_snapshots/tests/cli_snapshots/fixtures/app_root_listing/snapshots/listing.global.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
# listing
22

3-
A bare app command at a workspace root with several candidate packages prints
3+
A bare app command at a workspace root without an interactive terminal prints
44
the ranked package listing with -C hints and exits 1 instead of building the
5-
root, even in an interactive terminal (rfcs/cwd-flag.md).
5+
root (rfcs/cwd-flag.md).
66

77
## `vp build`
88

99
**Exit code:** 1
1010

1111
```
12-
VITE+ - The Unified Toolchain for the Web
13-
14-
error: `vp build` at the workspace root needs a target package.
12+
error: `vp build` at the workspace root needs a target package.
1513
1614
Packages in this workspace:
1715
admin apps/admin

0 commit comments

Comments
 (0)