pm pls
List workspace packages as a tree
Overview
The pm pls command lists all workspace packages in your monorepo as a formatted tree structure, making it easy to see the organization of your project.
Syntax
pm pls
Examples
List All Packages
pm pls
├── packages/
│ ├── core "@myapp/core"
│ ├── utils "@myapp/utils"
│ └── shared "@myapp/shared"
└── apps/
├── web "@myapp/web"
└── api "@myapp/api"
View Package Structure
pm pls
├── libs/
│ ├── auth "@company/auth"
│ ├── database "@company/database"
│ └── ui "@company/ui"
├── services/
│ ├── api "@company/api"
│ └── worker "@company/worker"
└── apps/
└── dashboard "@company/dashboard"
How It Works
From src/commands/pls.ts:8-16:
export const plsCmd = cli.Command.make('pls', {}, () =>
Effect.gen(function* () {
const pm = yield* PackageManagerService;
const path = yield* Path.Path;
const packages = yield* pm.listWorkspacePackages(pm.lockDir);
for (const line of formatWorkspaceTree(packages, path.sep)) {
yield* Console.log(line);
}
}).pipe(Effect.provide(PackageManagerLayer)),
);
The command:
- Detects the package manager
- Lists all workspace packages from the lockfile directory
- Formats them into a tree structure using
formatWorkspaceTree - Displays the formatted output
Tree Format
The output shows:
- Directory structure - Nested folders with proper tree characters (
├──,└──,│) - Package names - Displayed in quotes after the directory name
- Relative paths - Shows where each package lives in your monorepo
Use Cases
Quick Overview
See all packages in your monorepo at a glance:
pm pls
Before Installation
Check package names before using pm i -F:
pm pls
pm i -F @myapp/core
Documentation
Generate a visual representation of your monorepo structure:
pm pls > docs/structure.txt
Onboarding
Help new team members understand the project layout:
pm pls
Monorepo Detection
The command works with:
- pnpm workspaces - Reads from
pnpm-workspace.yaml - Bun workspaces - Reads from
package.jsonworkspaces field - npm workspaces - Reads from
package.jsonworkspaces field
Related Commands
- pm cd - Navigate to a workspace package
- pm install - Install with workspace filtering
- pm ls - List installed dependencies