MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / handleSelect

Function handleSelect

source code/components/WorktreeExitDialog.tsx:99–170  ·  view source on GitHub ↗
(value: string)

Source from the content-addressed store, hash-verified

97 return null;
98 }
99 async function handleSelect(value: string) {
100 if (!worktreeSession) return;
101 const hasTmux = Boolean(worktreeSession.tmuxSessionName);
102 if (value === 'keep' || value === 'keep-with-tmux') {
103 setStatus('keeping');
104 logEvent('tengu_worktree_kept', {
105 commits: commitCount,
106 changed_files: changes.length
107 });
108 await keepWorktree();
109 process.chdir(worktreeSession.originalCwd);
110 setCwd(worktreeSession.originalCwd);
111 recordWorktreeExit();
112 getPlansDirectory.cache.clear?.();
113 if (hasTmux) {
114 setResultMessage(`Worktree kept. Your work is saved at ${worktreeSession.worktreePath} on branch ${worktreeSession.worktreeBranch}. Reattach to tmux session with: tmux attach -t ${worktreeSession.tmuxSessionName}`);
115 } else {
116 setResultMessage(`Worktree kept. Your work is saved at ${worktreeSession.worktreePath} on branch ${worktreeSession.worktreeBranch}`);
117 }
118 setStatus('done');
119 } else if (value === 'keep-kill-tmux') {
120 setStatus('keeping');
121 logEvent('tengu_worktree_kept', {
122 commits: commitCount,
123 changed_files: changes.length
124 });
125 if (worktreeSession.tmuxSessionName) {
126 await killTmuxSession(worktreeSession.tmuxSessionName);
127 }
128 await keepWorktree();
129 process.chdir(worktreeSession.originalCwd);
130 setCwd(worktreeSession.originalCwd);
131 recordWorktreeExit();
132 getPlansDirectory.cache.clear?.();
133 setResultMessage(`Worktree kept at ${worktreeSession.worktreePath} on branch ${worktreeSession.worktreeBranch}. Tmux session terminated.`);
134 setStatus('done');
135 } else if (value === 'remove' || value === 'remove-with-tmux') {
136 setStatus('removing');
137 logEvent('tengu_worktree_removed', {
138 commits: commitCount,
139 changed_files: changes.length
140 });
141 if (worktreeSession.tmuxSessionName) {
142 await killTmuxSession(worktreeSession.tmuxSessionName);
143 }
144 try {
145 await cleanupWorktree();
146 process.chdir(worktreeSession.originalCwd);
147 setCwd(worktreeSession.originalCwd);
148 recordWorktreeExit();
149 getPlansDirectory.cache.clear?.();
150 } catch (error) {
151 logForDebugging(`Failed to clean up worktree: ${error}`, {
152 level: 'error'
153 });
154 setResultMessage('Worktree cleanup failed, exiting anyway');
155 setStatus('done');
156 return;

Callers 1

handleCancelFunction · 0.70

Calls 9

setStatusFunction · 0.85
logEventFunction · 0.85
keepWorktreeFunction · 0.85
setCwdFunction · 0.85
recordWorktreeExitFunction · 0.85
killTmuxSessionFunction · 0.85
cleanupWorktreeFunction · 0.85
logForDebuggingFunction · 0.85
clearMethod · 0.45

Tested by

no test coverage detected