Skip to content

fix(create): improve UX when running vp create from monorepo subdirectories#662

Merged
fengmk2 merged 4 commits intomainfrom
improve-vp-create-ux
Mar 3, 2026
Merged

fix(create): improve UX when running vp create from monorepo subdirectories#662
fengmk2 merged 4 commits intomainfrom
improve-vp-create-ux

Conversation

@fengmk2
Copy link
Copy Markdown
Member

@fengmk2 fengmk2 commented Mar 1, 2026

Summary

  • Show "Detected monorepo root at " info message when running vp create from a monorepo subdirectory
  • In interactive mode, add a "current directory" option to the parent dir selector when the user's cwd is not under a standard workspace pattern dir, and default to it
  • In non-interactive mode, show a hint about using --directory
  • Fix rootDir reset to cwd for non-monorepo vp create (previously walked up to a parent with package.json)
  • Fix "Package name:" prompt to accept Enter without typing (treat undefined as "use the default")
  • Rename "other" to "other directory" in monorepo parent dir prompt for clarity

Test plan

  • Add snap test covering: workspace subdir, workspace parent dir, non-workspace dir, and --directory from a subdir

@fengmk2 fengmk2 self-assigned this Mar 1, 2026
Copy link
Copy Markdown
Member Author

fengmk2 commented Mar 1, 2026

@fengmk2 fengmk2 force-pushed the improve-vp-create-ux branch 2 times, most recently from c34d31b to c5270c2 Compare March 2, 2026 03:16
@fengmk2 fengmk2 changed the base branch from main to graphite-base/662 March 2, 2026 05:02
@fengmk2 fengmk2 force-pushed the improve-vp-create-ux branch from c5270c2 to a54d12e Compare March 2, 2026 05:02
@fengmk2 fengmk2 changed the base branch from graphite-base/662 to release-support-aarch64-pc-windows-msvc March 2, 2026 05:02
@fengmk2 fengmk2 force-pushed the release-support-aarch64-pc-windows-msvc branch from fbf4a29 to e3478c1 Compare March 2, 2026 05:07
@fengmk2 fengmk2 force-pushed the improve-vp-create-ux branch from a54d12e to 0c609cf Compare March 2, 2026 05:07
@fengmk2 fengmk2 marked this pull request as ready for review March 2, 2026 14:46
@fengmk2 fengmk2 changed the title feat(create): improve UX when running vp create from monorepo subdirectories fix(create): improve UX when running vp create from monorepo subdirectories Mar 2, 2026
@fengmk2 fengmk2 changed the base branch from release-support-aarch64-pc-windows-msvc to graphite-base/662 March 2, 2026 14:52
@fengmk2 fengmk2 force-pushed the graphite-base/662 branch from e3478c1 to d8fe16b Compare March 2, 2026 14:53
@fengmk2 fengmk2 force-pushed the improve-vp-create-ux branch from b6c0189 to 332eaf9 Compare March 2, 2026 14:53
@graphite-app graphite-app Bot changed the base branch from graphite-base/662 to main March 2, 2026 14:53
@fengmk2 fengmk2 force-pushed the improve-vp-create-ux branch from 332eaf9 to 1da744e Compare March 2, 2026 14:53
Copy link
Copy Markdown
Member Author

fengmk2 commented Mar 3, 2026

Merge activity

  • Mar 3, 2:34 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Mar 3, 2:35 AM UTC: Graphite rebased this pull request as part of a merge.
  • Mar 3, 2:49 AM UTC: @fengmk2 merged this pull request with Graphite.

fengmk2 added 4 commits March 3, 2026 02:34
…rectories

When a user runs `vp create` from a subdirectory of a monorepo, the
command auto-detects the workspace root and creates packages relative to
that root. This can be confusing since the user expects location-awareness.

Changes:
- Show "Detected monorepo root at <path>" info message when in a subdir
- In interactive mode, add a "current directory" option to the parent dir
  selector when the user's cwd is not under a standard workspace pattern
  dir, and default to it
- In non-interactive mode, show a hint about using --directory
- Add snap test covering all edge cases: workspace subdir, workspace
  parent dir, non-workspace dir, and --directory from a subdir
When running `vp create` from a subdirectory that has a plain
package.json (without workspaces) somewhere up the tree,
detectWorkspace would walk up and set rootDir to that parent directory.
This caused projects to be created at the parent root instead of the
user's current directory.

Reset rootDir to cwd when isMonorepo is false, since the parent root
is only meaningful for monorepo workspace resolution.
…typing

When the user presses Enter on the "Package name:" prompt without typing,
`@clack/core` passes `undefined` as the value to validate. The old condition
`value != null && value.length === 0` skipped `undefined`, causing validation
to fail with "Invalid package name". Changed to `value == null || value.length
=== 0` so both `undefined` and empty string are treated as "use the default".
@fengmk2 fengmk2 force-pushed the improve-vp-create-ux branch from 1da744e to a976847 Compare March 3, 2026 02:34
@fengmk2 fengmk2 merged commit 3901dfb into main Mar 3, 2026
18 checks passed
@fengmk2 fengmk2 deleted the improve-vp-create-ux branch March 3, 2026 02:49
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