docs
evals
scenario-1
scenario-10
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
Build a CLI tool that manages packages in a monorepo using pnpm workspaces.
The tool should:
The tool accepts command-line arguments:
init <dir> - Initialize a new pnpm workspace in the specified directorylist <dir> [--filter <pattern>] - List workspace packages, optionally filtered by patternexec <dir> <command> [--filter <pattern>] - Execute a command in matching packagesFor init: Creates pnpm-workspace.yaml with package glob patterns
For list: Prints package names, one per line
For exec: Prints the command output with package name prefix for each execution
# Initialize workspace in current directory
node index.js init ./my-workspace
# List all packages in workspace
node index.js list ./my-workspace
# List packages matching a pattern
node index.js list ./my-workspace --filter "packages/*"
# Execute command in all packages
node index.js exec ./my-workspace "pwd"pnpm-workspace.yaml file with package patterns @test/**
* Initialize a pnpm workspace
* @param {string} workspaceDir - Directory to create the workspace in
* @returns {Promise<void>}
*/
async function initWorkspace(workspaceDir) {}
/**
* List packages in a workspace
* @param {string} workspaceDir - Workspace root directory
* @param {Object} [options] - Options
* @param {string} [options.filter] - Glob pattern to filter packages
* @returns {Promise<string[]>} Array of package names
*/
async function listPackages(workspaceDir, options) {}
/**
* Execute a command in workspace packages
* @param {string} workspaceDir - Workspace root directory
* @param {string} command - Command to execute
* @param {Object} [options] - Options
* @param {string} [options.filter] - Glob pattern to filter packages
* @returns {Promise<void>}
*/
async function execInPackages(workspaceDir, command, options) {}
module.exports = {
initWorkspace,
listPackages,
execInPackages
};Provides workspace and monorepo management capabilities including workspace configuration, package filtering, and command execution across packages.