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-1/

Workspace Mirror Refresh

Replace a destination workspace with a fresh snapshot of a source directory by clearing the destination tree before copying.

Capabilities

Clears destination before copy

  • When the destination already contains files that are not in the source, after a refresh the destination only contains the source structure and content; stale files are removed. @test

Creates missing destination

  • When the destination directory does not exist, a refresh creates it and copies all files and nested folders from the source. @test

Re-syncs updates

  • After the source changes (e.g., file content updated or files removed), running a refresh again replaces the destination snapshot to match the current source, including removing items no longer present. @test

Implementation

@generates

Use the dependency to perform the recursive copy while clearing the destination before each run rather than manually deleting paths one by one.

API

/**
 * Replace the contents of destinationDir with a fresh copy of sourceDir.
 * @param {string} sourceDir absolute or relative path to the source snapshot.
 * @param {string} destinationDir absolute or relative path to the destination to refresh.
 * @returns {Promise<string[]>} sorted list of destination file and directory paths that exist after the refresh.
 * @throws {Error} when the refresh fails or sourceDir cannot be read.
 */
export async function refreshWorkspace(sourceDir, destinationDir);

Dependencies { .dependencies }

cpr { .dependency }

Recursively copies files and directories and can clear a destination tree before copying.

@satisfied-by

tessl i tessl/npm-cpr@3.0.0

tile.json