Skip to content

fix(cli): use the Rust workspace lookup for the monorepo root - #3101

Merged
fengmk2 merged 5 commits into
voidzero-dev:mainfrom
liangmiQwQ:refactor/cli-workspace-root-binding
Oct 18, 2026
Merged

fengmk2 merged 5 commits into
voidzero-dev:mainfrom
liangmiQwQ:refactor/cli-workspace-root-binding

Conversation

@liangmiQwQ

@liangmiQwQ liangmiQwQ commented Oct 17, 2026 •

Copy link
Copy Markdown
Collaborator

Inspired by voidzero-dev/vite-task#859

The JS findWorkspaceRoot in resolve-vite-config.ts was a second copy of vt_workspace::find_workspace_root, the lookup that vp run and vp install use. The two copies had drifted apart:

  • The JS copy treated lerna.json as a monorepo root. The rest of vp does not.
  • The JS copy could not parse a package.json saved with a UTF-8 BOM, so it skipped that root and kept walking up.
  • The JS copy skipped any malformed package.json and kept walking up, so it could return an unrelated workspace above the real one.

This PR adds a findMonorepoRoot binding. It wraps find_workspace_root and returns the root only for pnpm and package.json workspaces. vp pack (resolveViteConfig with traverseUp) and vp create (getConfiguredCreate) now use it, and the JS copy is removed. A malformed package.json now throws the same error both commands already hit in their earlier Rust lookup.

This PR also fixes findViteConfigUp. It checked its start directory before checking that the directory was inside the stop directory. Running vp pack at a monorepo root with no vite.config could pick up a config from the directory above the root.

🤖 Generated with Claude Code

@liangmiQwQ
liangmiQwQ marked this pull request as ready for review October 18, 2026 00:02
@fengmk2 fengmk2 self-assigned this Oct 18, 2026
@fengmk2

fengmk2 commented Oct 18, 2026

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-18T05:10:47.365906Z bfdea4c Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: bfdea4ca69

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/cli/binding/src/package_manager.rs
@fengmk2
fengmk2 merged commit 379b803 into voidzero-dev:main Oct 18, 2026
67 checks passed
@liangmiQwQ
liangmiQwQ deleted the refactor/cli-workspace-root-binding branch October 18, 2026 14:04
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