Skip to content

Add workspace cloning functionality#46

Merged
gricha merged 4 commits intomainfrom
feature/workspace-cloning
Jan 8, 2026
Merged

Add workspace cloning functionality#46
gricha merged 4 commits intomainfrom
feature/workspace-cloning

Conversation

@gricha
Copy link
Copy Markdown
Owner

@gricha gricha commented Jan 8, 2026

Summary

  • Adds perry clone <source> <clone-name> CLI command
  • Adds workspaces.clone API endpoint
  • Clones both home and docker volumes using alpine container for data copy
  • Allocates new SSH port for cloned workspace
  • Source workspace is temporarily stopped during clone for data consistency
  • Includes proper error handling and cleanup on failure

Test plan

  • E2E tests for clone functionality (6 tests)
  • All 114 existing tests pass
  • Manual testing of clone command
  • Manual testing of UI clone button (if added)

🤖 Generated with Claude Code

Adds ability to clone existing workspaces with all their data:
- CLI command: perry clone <source> <clone-name>
- API endpoint: workspaces.clone
- Clones both home and docker volumes using alpine container
- Allocates new SSH port for clone
- Preserves source workspace data and state
- Includes E2E tests for clone functionality

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Comment thread src/docker/index.ts
Comment on lines +487 to +496
export async function cloneVolume(sourceVolume: string, destVolume: string): Promise<void> {
if (await volumeExists(destVolume)) {
throw new Error(`Volume '${destVolume}' already exists`);
}

await createVolume(destVolume);

try {
await docker([
'run',

This comment was marked as outdated.

gricha and others added 3 commits January 8, 2026 05:24
Prevents silent data loss by checking that the source volume exists
before attempting to clone. Docker auto-creates empty volumes when
mounting non-existent ones, which would result in an empty clone.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Instead of generating a fresh .claude.json that overwrites the container's
existing config, now reads the existing config and merges host MCP servers
into it. This preserves Claude Code's state while adding global MCP servers.

- Add readContainerFile to SyncContext for reading files from container
- Update claude-code sync to merge mcpServers into existing config

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Web UI: Clone button in navbar and settings tab with dialog
- Mobile: Clone section in workspace settings with modal
- Docs: Add perry clone to CLI reference
- Docs: New Common Workflows page with cloning, port forwarding, etc.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@gricha gricha merged commit b71c161 into main Jan 8, 2026
7 checks passed
@gricha gricha deleted the feature/workspace-cloning branch January 8, 2026 06:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant