{"id":18250,"library":"cp-cli","title":"cp-cli","description":"cp-cli is a Node.js CLI tool that replicates the UNIX cp command for cross-platform file and directory copying. Current stable version is 2.0.0, which exits with code 1 on error instead of 0 as in prior versions. It is a lightweight alternative to shell commands or more complex build tools, with no runtime dependencies after installation (only dev deps). Release cadence is irregular; the last release was v2.0.0 with a breaking change in exit code behavior.","status":"active","version":"2.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/screendriver/cp-cli","tags":["javascript","cp","cp -R -L","copy"],"install":[{"cmd":"npm install cp-cli","lang":"bash","label":"npm"},{"cmd":"yarn add cp-cli","lang":"bash","label":"yarn"},{"cmd":"pnpm add cp-cli","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"The package is an ESM module since v2.0.0. Use import instead of require.","wrong":"const cp = require('cp-cli');","symbol":"default","correct":"#!/usr/bin/env node\nimport cp from 'cp-cli';"},{"note":"The package exports a default function, not a named export.","wrong":"import { cp } from 'cp-cli';","symbol":"cp","correct":"import cp from 'cp-cli';"},{"note":"For CLI usage, install globally or use npx. Not a node require() use case.","wrong":"npm run cp-cli -- source target","symbol":"cli","correct":"npx cp-cli source target"},{"note":"The -d flag enables dereferencing symlinks, but both forms work. Only listing -d as common shorthand.","wrong":"cp-cli --dereference source target","symbol":"dereference option","correct":"cp-cli -d source target"}],"quickstart":{"code":"# Install globally\nnpm install -g cp-cli\n\n# Copy a file\ncp-cli foo.txt bar.txt\n\n# Copy file into directory\ncp-cli foo.txt dest/\n\n# Using npx (no install)\nnpx cp-cli source.txt target.txt","lang":"javascript","description":"Demonstrates global installation and common copy operations using cp-cli CLI."},"warnings":[{"fix":"Update scripts that check exit codes: errors now return 1 instead of 0.","message":"Exit code changed from 0 to 1 on error in v2.0.0","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Use other tools like fs-extra or ncp for recursive directory copying.","message":"Does not support recursive copying by default; no -R option","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use bash cp or other tools like copyfiles for glob patterns.","message":"Only copies a single file or into an existing directory; no glob or multiple sources","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run 'npm install -g cp-cli' or use 'npx cp-cli'.","cause":"Package not installed locally or globally.","error":"Error: Cannot find module 'cp-cli'"},{"fix":"Provide both source and target file paths (e.g., 'cp-cli foo.txt bar.txt').","cause":"Missing source or target arguments.","error":"Usage: cp-cli [-d] source target"},{"fix":"Check that the source path is correct and the file exists.","cause":"Source file does not exist.","error":"Error: ENOENT: no such file or directory"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}