MCPcopy Create free account
hub / github.com/Noumena-Network/code / keepWorktree

Function keepWorktree

src/utils/worktree.ts:792–823  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

790}
791
792export async function keepWorktree(): Promise<void> {
793 if (!currentWorktreeSession) {
794 return
795 }
796
797 try {
798 const { worktreePath, originalCwd, worktreeBranch } = currentWorktreeSession
799
800 // Change back to original directory first
801 process.chdir(originalCwd)
802
803 // Clear the session but keep the worktree intact
804 currentWorktreeSession = null
805
806 // Update config
807 saveCurrentProjectConfig(current => ({
808 ...current,
809 activeWorktreeSession: undefined,
810 }))
811
812 logForDebugging(
813 `Linked worktree preserved at: ${worktreePath}${worktreeBranch ? ` on branch: ${worktreeBranch}` : ''}`,
814 )
815 logForDebugging(
816 `You can continue working there by running: cd ${worktreePath}`,
817 )
818 } catch (error) {
819 logForDebugging(`Error keeping worktree: ${error}`, {
820 level: 'error',
821 })
822 }
823}
824
825export async function cleanupWorktree(): Promise<void> {
826 if (!currentWorktreeSession) {

Callers 2

callFunction · 0.85
handleSelectFunction · 0.85

Calls 2

saveCurrentProjectConfigFunction · 0.85
logForDebuggingFunction · 0.70

Tested by

no test coverage detected