@@ -38,6 +38,7 @@ Commands:
3838 upgrade Upgrade Claude Code to latest version
3939 mount <host> <cont> Add a mount to the devcontainer (recreates container)
4040 sync [project] Sync Claude Code sessions from devcontainers to host
41+ cp <cont> <host> Copy files/directories from container to host
4142 help Show this help message
4243
4344Examples:
@@ -52,6 +53,7 @@ Examples:
5253 devc mount ~/data /data # Add mount to container
5354 devc sync # Sync sessions from all devcontainers
5455 devc sync crypto # Sync only matching devcontainer
56+ devc cp /some/file ./out # Copy a path from container to host
5557EOF
5658}
5759
@@ -532,6 +534,33 @@ sync_one_container() {
532534 echo " Total: ${total_copied} file(s) synced."
533535}
534536
537+ cmd_cp () {
538+ local container_path=" ${1:- } "
539+ local host_path=" ${2:- } "
540+
541+ if [[ -z " $container_path " ]] || [[ -z " $host_path " ]]; then
542+ log_error " Usage: devc cp <container_path> <host_path>"
543+ exit 1
544+ fi
545+
546+ local workspace_folder
547+ workspace_folder=" $( get_workspace_folder) "
548+
549+ # Find the running container
550+ local label=" devcontainer.local_folder=$workspace_folder "
551+ local container_id
552+ container_id=$( docker ps -q --filter " label=$label " 2> /dev/null || true)
553+
554+ if [[ -z " $container_id " ]]; then
555+ log_error " No running devcontainer found for $workspace_folder "
556+ exit 1
557+ fi
558+
559+ log_info " Copying $container_path → $host_path "
560+ docker cp " $container_id :$container_path " " $host_path "
561+ log_success " Copied $container_path → $host_path "
562+ }
563+
535564cmd_self_install () {
536565 local install_dir=" $HOME /.local/bin"
537566 local install_path=" $install_dir /devc"
@@ -622,6 +651,9 @@ main() {
622651 sync)
623652 cmd_sync " $@ "
624653 ;;
654+ cp)
655+ cmd_cp " $@ "
656+ ;;
625657 self-install)
626658 cmd_self_install
627659 ;;
0 commit comments