fix: use cd + worktree inside parent dir instead of --dir flag (fixes #105) #106
Reference in New Issue
Block a user
Delete Branch "fix/worktree-isolation-via-cd"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Fixes issue #105 where
opencode run --fork/--continue --dir <path>fails to create sessions.Problem
Using
--dirflag with--forkor--continuebreaks session creation:Root Cause
The
--dirflag in opencode conflicts with session creation when using--forkor--continue.Solution
Instead of using
--dir, create worktrees inside the parent session's directory and usecdto change directory:Before:
After:
Worktrees are now created at
$PWD/.kugetsu-worktrees/{issue-ref}/:Changes
issue_ref_to_worktree_path()- now creates worktrees at$parent_dir/.kugetsu-worktrees/create_worktree()- acceptsparent_dirparametercmd_start()- usescd && opencode runinstead of--dircmd_continue()- usescd && opencode runinstead of--dirTesting
Both
cd && opencode runandenv -C ... opencode runwork correctly with backgrounding (&).lgtm