Skip to content

Conversation

@paul-bouzian
Copy link
Contributor

@paul-bouzian paul-bouzian commented Jan 27, 2026

Summary

Add the ability to configure commands that run when a workspace is archived, mirroring the existing setup script functionality.

  • Add archive-worktree, archive-worktree-unix, archive-worktree-windows config keys
  • Add getArchiveCommands() and executeWorktreeArchive() functions
  • Integrate archive script execution in chats.archive mutation
  • Add "Archive Commands" section to project worktree settings UI

How it works

The archive script runs whenever a workspace with a worktree is archived, before the worktree is deleted (if deletion is requested). This allows users to run cleanup tasks like:

  • git fetch --prune - clean up remote tracking branches
  • git branch -d feature-branch - delete local branches
  • Custom cleanup scripts

Configuration

Commands are stored in .1code/worktree.json alongside setup commands:

{
  "setup-worktree": ["bun install"],
  "archive-worktree": ["git fetch --prune"]
}

Test plan

  • Configure archive commands in Settings → Project → Worktree Scripts
  • Archive a workspace and verify commands run (check console logs)
  • Verify worktree deletion still works after archive script runs
  • Test platform-specific overrides (unix/windows)

🤖 Generated with Claude Code

Add the ability to configure commands that run when a workspace is archived,
mirroring the existing setup script functionality.

Changes:
- Add archive-worktree, archive-worktree-unix, archive-worktree-windows config keys
- Add getArchiveCommands() and executeWorktreeArchive() functions
- Integrate archive script execution in chats.archive mutation
- Add Archive Commands section to project worktree settings UI
- Update header to "Worktree Scripts" to reflect both setup and archive

The archive script runs whenever a workspace with a worktree is archived,
before the worktree is deleted (if deletion is requested). This allows
users to run cleanup tasks like git fetch --prune, branch deletion, etc.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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