rtk-ai/rtk

feat(utils): add package_manager_filtered_exec() for pnpm workspace support

Open

#515 opened on 2026年3月11日

GitHub で見る
 (3 comments) (0 reactions) (0 assignees)Rust (48,085 stars) (2,914 forks)batch import
effort-smallenhancementgood first issue

説明

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.

コントリビューターガイド

feat(utils): add package_manager_filtered_exec() for pnpm workspace support · rtk-ai/rtk#515 | Good First Issue