Skip to main content

Overview

The pm 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.
Shell integration via pm activate is required for the actual directory change functionality. Without it, pm cd only prints the path.

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

Output

Return to Root

Output

Get Package Path

Output

Use in Scripts

Shell Integration

To enable actual directory changes, activate shell integration:
This installs a wrapper function that:
  1. Calls pm cd to get the directory path
  2. Uses the shell’s cd builtin to actually change directories
  3. Provides tab completion for package names
From 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

From src/commands/cd.ts:38-55:
The command:
  1. Lists all workspace packages
  2. Finds the package by name
  3. Resolves the absolute path
  4. Prints the path (shell wrapper handles the actual cd)