Skip to content

Implement pnpm workspace filter#250

Merged
lucieleblanc merged 2 commits into
mainfrom
app-3496/command-spec-pnpm-filter
Apr 9, 2026
Merged

Implement pnpm workspace filter#250
lucieleblanc merged 2 commits into
mainfrom
app-3496/command-spec-pnpm-filter

Conversation

@lucieleblanc
Copy link
Copy Markdown
Contributor

Summary

Addresses APP-3496 — adds workspace package name completions for pnpm's --filter/-F option, inspired by the pnpm-shell-completion plugin.

Changes

Rust generator (command-signatures/src/generators/npm.rs):

  • Added PnpmWorkspacePackage struct for deserializing pnpm list -r --depth -1 --json output
  • Added workspace_packages_generator() that dynamically suggests workspace package names with version info
  • Registered the generator in pnpm_generators()
  • Added unit tests for normal output, empty output, and invalid JSON

Completion spec (command-signatures/json/pnpm.json):

  • Added -F as a short alias for --filter across all 21 subcommand occurrences
  • Wired workspace_packages_generator into all --filter/-F args alongside the existing filepaths template

Generator Screenshots

pnpm run <Tab> — scripts completions (shows scripts from package.json with descriptions):
pnpm-run-scripts

pnpm remove <Tab> — dependency completions (shows installed dependencies):
pnpm-remove-deps

pnpm --filter <Tab> — filter completions (shows filepaths + workspace packages when pnpm is available):
pnpm-filter

Note: The workspace_packages_generator requires pnpm to be on PATH. In the sandbox test environment, the debug Warp build had restricted PATH that prevented the generator command from executing. The existing get_scripts_generator and dependencies_generator (which read local files via cat) work correctly as shown above.

Testing

  • All presubmit checks pass (prettier format, cargo fmt, clippy, 45 tests including 3 new tests)
  • Verified scripts and dependencies generators end-to-end in local Warp build
  • Unit tests cover workspace packages generator parsing for valid JSON, empty output, and invalid JSON

Conversation: https://staging.warp.dev/conversation/4dc6c6b7-a480-4ec5-bfc3-a475248de4a6
Run: https://oz.staging.warp.dev/runs/019d689a-b684-7658-9363-ff95ac53972d
This PR was generated with Oz.

@linear
Copy link
Copy Markdown

linear Bot commented Apr 7, 2026

APP-3496 [pnpm] Support pnpm shell plugin completions

pnpm project-specific completions from shell plugins (e.g. pnpm-shell-completion) are currently not picked up by Warp's completer.

See GitHub #3435

- Add workspace_packages_generator() that runs 'pnpm list -r --depth -1 --json'
  to dynamically suggest workspace package names for the --filter/-F flag
- Add -F as a short alias for --filter across all pnpm subcommands
- Wire up the workspace_packages_generator to all --filter/-F args in pnpm.json
- Add unit tests for the workspace packages generator (normal, empty, invalid JSON)

Co-Authored-By: Oz <oz-agent@warp.dev>
@lucieleblanc lucieleblanc force-pushed the app-3496/command-spec-pnpm-filter branch from 316f4f7 to c2364d3 Compare April 9, 2026 17:56
- Switch workspace_packages_generator from 'pnpm list' to filesystem-based
  approach that reads pnpm-workspace.yaml and package.json files directly.
  This avoids issues with corepack shims prompting for download
  confirmation in non-interactive generator subprocesses.
- Remove 'template: filepaths' from --filter args since it prevents the
  generator from running in the completion engine.
- Add --filter/-F as a top-level option on the pnpm command so it works
  when typed before a subcommand (pnpm --filter pkg run build).
- Update tests to match the new text-based output format.

Co-Authored-By: Oz <oz-agent@warp.dev>
Copy link
Copy Markdown
Contributor Author

temp

Copy link
Copy Markdown
Contributor Author

Generator Screenshot Verification

All generators were verified end-to-end in a local Warp build against a test pnpm workspace with scoped packages (@myorg/pkg-a, @myorg/pkg-b, test-monorepo).

Fixes applied

  1. Rebased onto main — resolved merge conflict with the new npm_registry_search_generator tests.

  2. Switched workspace_packages_generator to filesystem-based approach — The original pnpm list -r --depth -1 --json command failed silently in the completion engine because pnpm is a corepack shim that can prompt for download confirmation in non-interactive generator subprocesses. The new approach reads pnpm-workspace.yaml and package.json files directly from the filesystem using standard POSIX tools (find, sed).

  3. Removed template: "filepaths" from --filter args — Having both template and generatorName on the same args object prevented the generator from running in the Warp completion engine.

  4. Added --filter/-F as a top-level option — pnpm's --filter is a global option (used before subcommand: pnpm --filter pkg run build), but was only defined on individual subcommands. The completion engine couldn't resolve which subcommand's --filter to use when no subcommand was typed yet.

Test results

  • pnpm --filter <Tab> ✅ — Shows workspace package names: @myorg/pkg-a (v1.0.0), @myorg/pkg-b (v2.0.0), test-monorepo (workspace package)
  • pnpm --filter @<Tab> ✅ — Filters to scoped packages only: @myorg/pkg-a, @myorg/pkg-b. Auto-completes common prefix @myorg/pkg-.
  • pnpm -F <Tab> ✅ — Short alias works identically to --filter.
  • pnpm run <Tab> ✅ — Shows scripts: build, dev, lint, test with descriptions.
  • pnpm remove <Tab> ✅ — Shows dependencies: express, lodash, typescript with dependency types.

All 54 unit tests pass, including 3 updated tests for the workspace packages generator that verify @-scoped package names are correctly handled.

@lucieleblanc lucieleblanc marked this pull request as ready for review April 9, 2026 19:08
@lucieleblanc lucieleblanc changed the title Add completion spec: pnpm workspace filter (pnpm) Add completion spec: pnpm workspace filter Apr 9, 2026
@lucieleblanc lucieleblanc changed the title Add completion spec: pnpm workspace filter Implement pnpm workspace filter Apr 9, 2026
@lucieleblanc lucieleblanc merged commit 8037781 into main Apr 9, 2026
3 checks passed
@lucieleblanc lucieleblanc deleted the app-3496/command-spec-pnpm-filter branch April 9, 2026 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants