rtk-ai/rtk
View on GitHubfeat(utils): add package_manager_filtered_exec() for pnpm workspace support
Open
#515 opened on Mar 11, 2026
effort-smallenhancementgood first issue
Description
Part of #512 — pnpm workspace filter support.
Phase 3: src/utils.rs
Add package_manager_filtered_exec()
/// Build a Command using pnpm --filter <workspace> exec, or fallback to package_manager_exec.
/// When filter is present, always uses pnpm (workspace scoping only works through pnpm).
pub fn package_manager_filtered_exec(tool: &str, pnpm_filter: Option<&str>) -> Command {
match pnpm_filter {
Some(workspace) => {
let mut c = Command::new("pnpm");
c.arg("--filter").arg(workspace).arg("exec").arg("--").arg(tool);
c
}
None => package_manager_exec(tool),
}
}
Note on exec vs run: pnpm --filter web exec -- prettier runs the binary from node_modules/.bin. Correct for binaries (prettier, tsc, vitest, playwright, eslint, biome). For script-based commands, lint_cmd already resolves the binary name internally via detect_linter() before calling this function.
When pnpm_filter is None, falls back to existing package_manager_exec() — zero behavior change for non-workspace users.