Skip to main content

Overview

The pm activate command generates shell integration code that enables advanced features like actual directory changes with pm cd and intelligent tab completions for workspace packages.

Syntax

Arguments

string
required
Your shell type: zsh or bash

Installation

Add to your shell configuration file:
Then reload your shell:
After activation, restart your terminal or source your config file to enable the features.

What It Enables

1. Actual Directory Changes

Without activation, pm cd only prints the path:
With activation, it actually changes directories:

2. Tab Completions

Complete package names with Tab:

3. Command Completions

Complete all pm commands and flags:

How It Works

Shell Wrapper Function

The activation creates a wrapper function that intercepts pm cd commands: From src/commands/activate.ts:6-22:
This wrapper:
  1. Intercepts pm cd calls
  2. Handles flags by passing through to the command
  3. Gets the directory path from pm cd
  4. Uses shell’s builtin cd to actually change directory
  5. Passes all other commands through normally

Completion Functions

For zsh, from src/commands/activate.ts:24-34:
This:
  1. Loads base completions from pm --completions zsh
  2. Wraps the completion function
  3. For pm cd <TAB>, gets package names from pm cd --completions
  4. For other commands, uses base completions

Testing Activation

Verify Installation

Check if the function exists:
Output (activated)
Output (not activated)

Test Directory Change

Test Completions

Manual Setup

If you prefer not to use eval, save the output:
Then source it in ~/.zshrc:

Troubleshooting

Completions Not Working

  1. Reload shell:
  2. Check function is loaded:
  3. Verify activation line:

Directory Changes Not Working

  1. Verify shell integration:
  2. Test without cd:
  3. Check package exists:

Conflicts with Existing Function

If you have another pm function:

Shell Support

For fish and other shells, basic command completions may work but cd integration is not supported.

What Gets Activated

1

Shell Wrapper

Function that intercepts pm cd and uses builtin cd
2

Base Completions

Tab completion for all pm commands and flags
3

Package Completions

Tab completion for workspace package names in pm cd
4

Smart Filtering

Completions filter based on what you’ve typed

Advanced Usage

Lazy Loading

For faster shell startup, lazy load activation:
~/.zshrc

Custom Wrapper

Extend the wrapper with your own logic:
~/.zshrc
  • pm cd - Navigate to workspace packages
  • pm pls - List workspace packages for completion