Skip to content

Releases: lerenn/code-manager

Release v0.31.2

12 Jan 16:29
7901b6a

Choose a tag to compare

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:

  1. Check if the branch exists locally before fallback
  2. Check if origin/branch exists on remote before attempting to create
    from it
  3. Fetch from origin if remote branch doesn't exist, then check again
  4. 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 handling
  • pkg/git/checkout_branch_test.go: Added integration tests
  • test/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

30 Dec 17:18
95476c1

Choose a tag to compare

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 shouldSkipWorktreeCreation to 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

27 Dec 19:13
d235078

Choose a tag to compare

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.go and
    pkg/code-manager/workspace_remove.go
  • Added CLI commands in cmd/cm/workspace/add.go and
    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

24 Dec 13:22
92de807

Choose a tag to compare

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:path format (SSH without protocol)
  • https://host/path format (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 normalizeRepositoryURL to parse ssh:// URLs using
    url.Parse
  • Handle port numbers in ssh:// URLs (e.g., ssh://git@host:22/path)
  • Normalize ssh:// URLs to host/path format 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 - Updated normalizeRepositoryURL
    function
  • pkg/code-manager/clone_test.go - Added unit tests
  • test/repo_clone_test.go - Added E2E test

Release v0.29.1

24 Dec 13:22
594b01f

Choose a tag to compare

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 createDetachedClone to 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 CheckoutBranch to 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-state

This now works correctly.


Co-authored-by: Louis FRADIN lerenn@users.noreply.github.com

Release v0.29.0

14 Oct 15:34
bf20002

Choose a tag to compare

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

09 Oct 07:56
de2b303

Choose a tag to compare

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

  1. run to detect devcontainer configuration
  2. If devcontainer detected, is set in worktree creation
  3. Worktree creation uses for detached worktrees
  4. run after worktree creation
  5. 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

01 Oct 19:20
94be68e

Choose a tag to compare

fix(cmd): fix init command (#113)

Release v0.27.1

16 Sep 15:30
086d111

Choose a tag to compare

fix(cm): resolve --from-issue flag empty branch name error (#111)

Release v0.27.0

16 Sep 11:32
02588fb

Choose a tag to compare

feat(ide): add VSCodium support (codium) and register in IDE manager (#110)