Releases: lerenn/code-manager
Release v0.31.2
fix(worktree): handle branch checkout when branch doesn't exist on remote (#124)
Problem
When creating a worktree for a branch that doesn't exist on the remote
repository, the checkout process would fail with an error like:
fatal: 'origin/deploy-v0-0-67' is not a commit and a branch 'deploy-v0-0-67' cannot be created from it
This occurred because the code attempted to create a branch from
origin/branch without first checking if that remote branch exists.
Solution
Modified CheckoutBranch in pkg/git/checkout_branch.go to:
- Check if the branch exists locally before fallback
- Check if
origin/branchexists on remote before attempting to create
from it - Fetch from origin if remote branch doesn't exist, then check again
- Create branch from HEAD as final fallback if remote branch still
doesn't exist
Testing
- ✅ Added integration tests for various checkout scenarios
- ✅ Added E2E tests to reproduce and verify fix for the original bug
scenario - ✅ All tests pass (integration and E2E)
Changes
pkg/git/checkout_branch.go: Enhanced checkout logic with proper
fallback handlingpkg/git/checkout_branch_test.go: Added integration teststest/worktree_create_test.go: Added E2E tests for repo and workspace
modes
Fixes the issue where worktree creation fails for branches that don't
exist on the remote but need to be created locally.
Release v0.31.1
fix: create worktrees for all workspace branches when adding repository (#123)
Problem
When adding a repository to an existing workspace using ws add,
worktrees were only created for branches that already existed in the new
repository. If a branch didn't exist locally or on remote, worktree
creation was skipped, even though the workspace file was updated.
Solution
This fix ensures that worktrees are created for ALL branches defined
in workspace.Worktrees, even if they don't exist in the new
repository. The worktree package's EnsureBranchExists will create
branches from the default branch if they don't exist on remote.
Changes
- Updated
shouldSkipWorktreeCreationto always attempt worktree
creation (never skip) - Refactored branch status logging into separate
logBranchStatus
function for better code organization - Updated E2E tests to expect worktrees for all branches, even when they
don't exist initially
Testing
- ✅ All unit tests passing
- ✅ All integration tests passing
- ✅ All E2E tests passing
- ✅ Linting passes
Example
Before: Adding a repository with only main branch to a workspace with
branches extract-lgtm and extract-homeassistant would only update
workspace files but not create worktrees.
After: Worktrees are created for both extract-lgtm and
extract-homeassistant, with branches created from the default branch
if they don't exist.
Release v0.31.0
feat: add/remove repository to existing workspace (#122)
This PR adds two new commands to the CM CLI:
Features
cm ws add [-w workspace_name] [repository_name]
- Adds a repository to an existing workspace
- Creates worktrees in the new repository for all branches that already
have worktrees in ALL existing repositories - Updates all existing .code-workspace files to include the new
repository - Supports interactive selection for both workspace and repository names
cm ws remove [-w workspace_name] [repository_name]
- Removes a repository from an existing workspace
- Updates all existing .code-workspace files to remove the repository
folder entries - Does NOT delete the associated worktrees in the repositories
- Supports interactive selection for both workspace and repository names
Implementation Details
- Added business logic in
pkg/code-manager/workspace_add.goand
pkg/code-manager/workspace_remove.go - Added CLI commands in
cmd/cm/workspace/add.goand
cmd/cm/workspace/remove.go - Added comprehensive unit tests and e2e tests
- Fixed worktree creation to skip if already exists
- All lint errors resolved
Release v0.30.0
feat: add support for ssh:// URL format in repository cloning (#121)
Summary
This PR adds support for ssh:// URL format in repository cloning,
allowing users to clone repositories using the explicit ssh://
protocol prefix.
Problem
The normalizeRepositoryURL function only supported:
git@host:pathformat (SSH without protocol)https://host/pathformat (HTTPS)
It did not support ssh://git@host/path format, causing errors when
trying to clone repositories like:
ssh://git@forge.lab.home.lerenn.net/homelab/lgtm.git
Solution
- Updated
normalizeRepositoryURLto parsessh://URLs using
url.Parse - Handle port numbers in
ssh://URLs (e.g.,ssh://git@host:22/path) - Normalize
ssh://URLs tohost/pathformat consistent with other
formats
Testing
- Added unit tests for
ssh://URL formats:- Basic format with .git suffix
- Without .git suffix
- With port numbers
- Added E2E test for
ssh://URL format
Changes
pkg/code-manager/clone.go- UpdatednormalizeRepositoryURL
functionpkg/code-manager/clone_test.go- Added unit teststest/repo_clone_test.go- Added E2E test
Release v0.29.1
fix: use remote URL for detached clone when branch doesn't exist locally (#119)
Summary
Fixed issue where cm wt load -r <repo> <branch> command failed when
loading branches from remote.
Problem
The worktree load command was failing with:
fatal: Remote branch <branch> not found in upstream origin
This happened because detached clones were trying to clone from local
path with --branch flag, which failed when the branch only existed on
the remote (not locally).
Solution
- Modified
createDetachedCloneto check if branch exists locally - If branch exists locally, use
CloneToPath(clones from local path) - If branch doesn't exist locally, clone from remote URL and checkout
branch - Updated
CheckoutBranchto handle remote tracking branches when
branch doesn't exist locally - Updated unit test to match new implementation
Testing
All tests pass:
- ✅ Lint
- ✅ Unit tests
- ✅ Integration tests
- ✅ E2E tests
Example
go run ./cmd/cm wt load -r github.com/flexaihq/experience fix/temporal-schedule-workflow-task-failed-stateThis now works correctly.
Co-authored-by: Louis FRADIN lerenn@users.noreply.github.com
Release v0.29.0
feat: implement interactive repository/workspace selection with Bubble Tea (#118)
- Add interactive TUI selection using github.com/charmbracelet/bubbletea
- Implement two-step selection for worktree operations (target +
worktree) - Add single-step selection for repository/workspace operations
- Support filtering by target type (repository/workspace only)
- Add branch name prompting when not provided
- Integrate interactive selection into all relevant commands:
- cm wt create, delete, open, load, list
- cm r delete
- cm ws delete
- Remove numbered lists from repository list command
- Refactor prompt selection logic for better maintainability
- Add comprehensive error handling and validation
- Support dynamic type prefix display based on context
The interactive selection provides a modern CLI experience similar to
GitHub CLI, allowing users to select repositories, workspaces, and
worktrees through an intuitive terminal interface with filtering
and navigation support.
Co-authored-by: Louis FRADIN louis@Louiss-MacBook-Air.local
Release v0.28.0
feat: add devcontainer worktree support with detached clones (#115)
This commit implements comprehensive devcontainer worktree support for
CM, allowing worktrees to function properly within devcontainer
environments by creating detached clones instead of regular Git
worktrees.
Key Features Added
Devcontainer Detection
- New interface for pre-worktree creation hooks
- Devcontainer detection logic that checks for files
- Automatic detection of devcontainer configurations in repository root
or parent directories
Detached Worktree Support
- Added field to struct in status.yaml
- New Git operation for creating standalone clones
- Modified worktree creation logic to support both regular and detached
worktrees - Updated worktree deletion logic to handle detached worktrees correctly
Hook System Improvements
- Renamed to for clarity
- Updated hook execution timing to run after worktree creation, before
checkout - Registered devcontainer hook in default hooks alongside git-crypt hook
Enhanced Worktree Management
- Modified logic to set flag based on hook detection
- Updated worktree deletion to check flag and use appropriate path
resolution - Added support for both regular and detached worktrees in all worktree
operations
Testing and Documentation
- Comprehensive E2E tests for devcontainer worktree creation and
deletion - Unit and integration tests for all new functionality
- Updated existing tests to handle renamed hook interfaces
- Added documentation for devcontainer worktree support feature
Technical Implementation
Files Modified
- : Added interface
- : Updated hook management for new hook type
- : Added field to
- : Refactored to support detached worktrees
- : New Git operation for detached clones
- : Enhanced deletion logic
- : New devcontainer detection and hook implementation
- : E2E tests for devcontainer worktrees
- : E2E tests for devcontainer worktree deletion
Hook Execution Flow
- run to detect devcontainer configuration
- If devcontainer detected, is set in worktree creation
- Worktree creation uses for detached worktrees
- run after worktree creation
- Worktree deletion checks flag for proper cleanup
This implementation ensures that worktrees created in repositories with
devcontainer configurations will be fully functional within devcontainer
environments, solving the original issue where worktrees failed due to
missing directory references.
Co-authored-by: Louis louis@Louiss-MacBook-Air.local
Release v0.27.2
fix(cmd): fix init command (#113)
Release v0.27.1
fix(cm): resolve --from-issue flag empty branch name error (#111)
Release v0.27.0
feat(ide): add VSCodium support (codium) and register in IDE manager (#110)