Overview
Thepm cd command helps you navigate to workspace packages in your monorepo. When combined with shell integration, it allows you to quickly jump between packages from anywhere in your project.
Syntax
Arguments
string
The name of the workspace package to navigate to. If omitted, returns to monorepo root.
Options
boolean
default:"false"
Print the absolute path without navigation
boolean
default:"false"
Output package names for shell completion (internal use)
Examples
Navigate to Package
Output
Return to Root
Output
Get Package Path
Output
Use in Scripts
Shell Integration
To enable actual directory changes, activate shell integration:- Calls
pm cdto get the directory path - Uses the shell’s
cdbuiltin to actually change directories - Provides tab completion for package names
src/commands/activate.ts:6-22:
Shell Completion
With shell integration, tab completion works automatically:Error Handling
If a package doesn’t exist, you’ll see an error with available packages:Output
How It Works
Fromsrc/commands/cd.ts:38-55:
- Lists all workspace packages
- Finds the package by name
- Resolves the absolute path
- Prints the path (shell wrapper handles the actual cd)
Related Commands
- pm pls - List all workspace packages
- pm activate - Set up shell integration