Skip to content

vp run ignores cd before a nested vpr in a script and runs the parent package's task #3129

Open
voidzero-dev/vite-task
#867

Description

@Goobles

Describe the bug

If a package.json script does cd <dir> && vpr <task>, vp run ignores the cd. It looks up <task> in the package it started from instead of the one in <dir>. Putting the same command in a subshell, (cd <dir> && vpr <task>), gives the right result.

The log shows vp run running the nested vpr itself rather than handing the whole line to the shell. For plain it prints $ echo ROOT, which is the root's hello.

This happens without any pnpm workspace. The repro has no pnpm-workspace.yaml and no lockfile, so it's a different bug from #3013, though the symptom is the same: vpr in a subfolder runs the root's task.

Reproduction

mkdir repro && cd repro && mkdir ui
echo '{"name":"root","private":true,"scripts":{"hello":"echo ROOT","plain":"cd ui && vpr hello","sub":"(cd ui && vpr hello)"}}' > package.json
echo '{"name":"ui","private":true,"scripts":{"hello":"echo UI"}}' > ui/package.json

vpr plain   # prints ROOT, expected UI
vpr sub     # prints UI
(cd ui && vpr hello)   # from the shell: prints UI

Output:

$ vpr plain
$ echo ROOT ⊘ cache disabled
ROOT

$ vpr sub
$ (cd ui && vpr hello) ⊘ cache disabled
$ echo UI ⊘ cache disabled
UI

Expected

cd ui && vpr hello should run ui's hello, the same as it does in a shell or under npm run. If vp run handles a nested vpr itself, it should apply any earlier cd in the same command before it resolves the task.

Environment

  • vp v1.1.0 (global, no local vite-plus)
  • Node v24.19.0
  • Linux

Written by claude-opus-5-5 via Claude Code in T3 Code on goobles-agentbox.

Activity

  1. added theissue type on Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Fields

    Priority

    None yet

    Effort

    None yet

    Target date

    None yet

    Start date

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions