CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

tessl/npm-cpr

Cross-platform recursive file copying library that replicates Unix 'cp -R' command functionality

Agent Success

Agent success rate when using this tile

66%

Improvement

Agent success rate improvement when using this tile compared to baseline

1x

Baseline

Agent success rate without this tile

66%

Overview
Eval results
Files

task.mdevals/scenario-8/

Selective Copy With Filters

Build a utility that recursively copies files from a source directory to a destination directory while allowing callers to filter which paths are copied by pattern or by predicate. When no filters are provided, everything under the source should be copied. The utility should finish with a deterministic list of what was copied.

Capabilities

Copies only paths matching a pattern

  • When provided with an includePattern, only files whose absolute paths match that pattern are copied; non-matching files and directories are left untouched at the destination. @test

Skips paths rejected by a predicate

  • When provided with filterPredicate, it receives each absolute path that would be copied; any path for which the predicate returns false must not be copied. The predicate should be applied to both files and directories. @test

Applies both filters together

  • When both includePattern and filterPredicate are provided, a path is copied only if it matches the pattern and the predicate returns true. The final list of copied paths should reflect this combined filtering. @test

Implementation

@generates

API

/**
 * Recursively copies selected paths from source to destination.
 *
 * @param {Object} options
 * @param {string} options.source - Source directory path.
 * @param {string} options.destination - Destination directory path.
 * @param {RegExp|string} [options.includePattern] - Only copy paths whose absolute path matches this pattern.
 * @param {(path: string) => boolean} [options.filterPredicate] - Return true to keep the path; false to skip it.
 * @param {boolean} [options.cleanDestination] - When true, clear the destination before copying.
 * @returns {Promise<string[]>} Resolves with a sorted list of absolute destination paths that were copied.
 */
export async function selectiveCopy(options);

Dependencies { .dependencies }

cpr { .dependency }

Provides recursive file copying with optional filtering support.

tessl i tessl/npm-cpr@3.0.0

tile.json