Skip to content

fix(core): handle "." and absolute paths as workspace name in CNW#35083

Merged
jaysoo merged 1 commit intomasterfrom
NXC-4172
Mar 30, 2026
Merged

fix(core): handle "." and absolute paths as workspace name in CNW#35083
jaysoo merged 1 commit intomasterfrom
NXC-4172

Conversation

@jaysoo
Copy link
Copy Markdown
Member

@jaysoo jaysoo commented Mar 30, 2026

Current Behavior

CNW rejects "." and absolute paths (e.g. /tmp/acme) as workspace names, causing over 1,300 INVALID_WORKSPACE_NAME and DIRECTORY_EXISTS errors per month. This is the #1 input validation error for both AI agents and humans.

Expected Behavior

  • "." and "./" in a non-empty directory suggests using nx init instead
  • "." and "./" in an empty directory resolves to the directory's basename and creates the workspace in-place
  • Absolute paths like /tmp/acme extract the basename as the workspace name and create the workspace at the specified location

The workingDir override is threaded through CreateWorkspaceOptions to downstream functions (createWorkspace, createEmptyWorkspace, createPreset, cloneTemplate) without mutating process.cwd().

Related Issue(s)

Closes NXC-4172

## Current Behavior

CNW rejects "." and absolute paths (e.g. `/tmp/acme`) as workspace names,
causing over 1,300 INVALID_WORKSPACE_NAME and DIRECTORY_EXISTS errors per
month. This is the #1 input validation error for both AI agents and humans.

## Expected Behavior

- "." and "./" in a non-empty directory suggests using `nx init` instead
- "." and "./" in an empty directory resolves to the directory's basename
  and creates the workspace in-place
- Absolute paths like `/tmp/acme` extract the basename as the workspace
  name and create the workspace at the specified location

The `workingDir` override is threaded through `CreateWorkspaceOptions` to
downstream functions (`createWorkspace`, `createEmptyWorkspace`,
`createPreset`, `cloneTemplate`) without mutating `process.cwd()`.

## Related Issue(s)

Fixes NXC-4172
@jaysoo jaysoo requested a review from a team as a code owner March 30, 2026 15:13
@jaysoo jaysoo requested a review from FrozenPandaz March 30, 2026 15:13
@nx-cloud
Copy link
Copy Markdown
Contributor

nx-cloud bot commented Mar 30, 2026

View your CI Pipeline Execution ↗ for commit 6b460d8

Command Status Duration Result
nx affected --targets=lint,test,build,e2e,e2e-c... ✅ Succeeded 11m 48s View ↗
nx run-many -t check-imports check-lock-files c... ✅ Succeeded 3s View ↗
nx-cloud record -- pnpm nx conformance:check ✅ Succeeded 7s View ↗
nx build workspace-plugin ✅ Succeeded <1s View ↗
nx-cloud record -- nx format:check ✅ Succeeded 2s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded <1s View ↗

☁️ Nx Cloud last updated this comment at 2026-03-30 15:30:21 UTC

@netlify
Copy link
Copy Markdown

netlify bot commented Mar 30, 2026

Deploy Preview for nx-docs ready!

Name Link
🔨 Latest commit 6b460d8
🔍 Latest deploy log https://app.netlify.com/projects/nx-docs/deploys/69ca93212d44b300087cf224
😎 Deploy Preview https://deploy-preview-35083--nx-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link
Copy Markdown

netlify bot commented Mar 30, 2026

Deploy Preview for nx-dev ready!

Name Link
🔨 Latest commit 6b460d8
🔍 Latest deploy log https://app.netlify.com/projects/nx-dev/deploys/69ca93213c2c55000876c8d1
😎 Deploy Preview https://deploy-preview-35083--nx-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@jaysoo jaysoo merged commit d61123b into master Mar 30, 2026
24 checks passed
@jaysoo jaysoo deleted the NXC-4172 branch March 30, 2026 16:12
FrozenPandaz pushed a commit that referenced this pull request Mar 30, 2026
…5083)

## Current Behavior

CNW rejects "." and absolute paths (e.g. `/tmp/acme`) as workspace
names, causing over 1,300 INVALID_WORKSPACE_NAME and DIRECTORY_EXISTS
errors per month. This is the #1 input validation error for both AI
agents and humans.

## Expected Behavior

- "." and "./" in a non-empty directory suggests using `nx init` instead
- "." and "./" in an empty directory resolves to the directory's
basename and creates the workspace in-place
- Absolute paths like `/tmp/acme` extract the basename as the workspace
name and create the workspace at the specified location

The `workingDir` override is threaded through `CreateWorkspaceOptions`
to downstream functions (`createWorkspace`, `createEmptyWorkspace`,
`createPreset`, `cloneTemplate`) without mutating `process.cwd()`.

## Related Issue(s)

Closes NXC-4172
FrozenPandaz pushed a commit that referenced this pull request Mar 31, 2026
…5083)

## Current Behavior

CNW rejects "." and absolute paths (e.g. `/tmp/acme`) as workspace
names, causing over 1,300 INVALID_WORKSPACE_NAME and DIRECTORY_EXISTS
errors per month. This is the #1 input validation error for both AI
agents and humans.

## Expected Behavior

- "." and "./" in a non-empty directory suggests using `nx init` instead
- "." and "./" in an empty directory resolves to the directory's
basename and creates the workspace in-place
- Absolute paths like `/tmp/acme` extract the basename as the workspace
name and create the workspace at the specified location

The `workingDir` override is threaded through `CreateWorkspaceOptions`
to downstream functions (`createWorkspace`, `createEmptyWorkspace`,
`createPreset`, `cloneTemplate`) without mutating `process.cwd()`.

## Related Issue(s)

Closes NXC-4172

(cherry picked from commit d61123b)
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 5, 2026

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 5, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants