|
145 | 145 | const selectedPermissionMode = $derived(
|
146 | 146 | selectedBranch ? uiState.lane(selectedBranch.stackId).permissionMode.current : 'default'
|
147 | 147 | );
|
| 148 | + const laneState = $derived( |
| 149 | + selectedBranch?.stackId ? uiState.lane(selectedBranch.stackId) : undefined |
| 150 | + ); |
148 | 151 |
|
149 | 152 | const prompt = $derived(
|
150 | 153 | selectedBranch ? uiState.lane(selectedBranch.stackId).prompt.current : ''
|
|
202 | 205 | if (!selectedBranch) return;
|
203 | 206 | if (!prompt) return;
|
204 | 207 |
|
| 208 | + // Handle /add-dir command |
| 209 | + if (prompt.startsWith('/add-dir ')) { |
| 210 | + const path = prompt.slice('/add-dir '.length).trim(); |
| 211 | + if (path) { |
| 212 | + const isValid = await claudeCodeService.verifyPath({ projectId, path }); |
| 213 | + if (isValid) { |
| 214 | + laneState?.addedDirs.add(path); |
| 215 | + chipToasts.success(`Added directory: ${path}`); |
| 216 | + } else { |
| 217 | + chipToasts.error(`Invalid directory path: ${path}`); |
| 218 | + } |
| 219 | + } |
| 220 | + setPrompt(''); |
| 221 | + return; |
| 222 | + } |
| 223 | +
|
205 | 224 | if (prompt.startsWith('/')) {
|
206 | 225 | chipToasts.warning('Slash commands are not yet supported');
|
207 | 226 | setPrompt('');
|
|
225 | 244 | thinkingLevel: selectedThinkingLevel,
|
226 | 245 | model: selectedModel,
|
227 | 246 | permissionMode: selectedPermissionMode,
|
228 |
| - disabledMcpServers: uiState.lane(selectedBranch.stackId).disabledMcpServers.current |
| 247 | + disabledMcpServers: uiState.lane(selectedBranch.stackId).disabledMcpServers.current, |
| 248 | + addDirs: laneState?.addedDirs.current || [] |
229 | 249 | },
|
230 | 250 | { properties: analyticsProperties }
|
231 | 251 | );
|
|
693 | 713 | {/snippet}
|
694 | 714 |
|
695 | 715 | {#snippet rightSidebar(events: ClaudeMessage[])}
|
| 716 | + {@const addedDirs = laneState?.addedDirs.current || []} |
696 | 717 | <div class="right-sidebar" bind:this={rightSidebarRef}>
|
697 |
| - {#if !branchChanges || !selectedBranch || (branchChanges.response && branchChanges.response.changes.length === 0 && getTodos(events).length === 0)} |
| 718 | + {#if !branchChanges || !selectedBranch || (branchChanges.response && branchChanges.response.changes.length === 0 && getTodos(events).length === 0 && addedDirs.length === 0)} |
698 | 719 | <div class="right-sidebar__placeholder">
|
699 | 720 | <EmptyStatePlaceholder
|
700 | 721 | image={filesAndChecksSvg}
|
|
713 | 734 | <ReduxResult result={branchChanges.result} {projectId}>
|
714 | 735 | {#snippet children({ changes }, { projectId })}
|
715 | 736 | <Drawer
|
716 |
| - bottomBorder={todos.length > 0} |
| 737 | + bottomBorder={todos.length > 0 || addedDirs.length > 0} |
717 | 738 | grow
|
718 | 739 | defaultCollapsed={todos.length > 0}
|
719 | 740 | notFoldable
|
|
763 | 784 | </div>
|
764 | 785 | </Drawer>
|
765 | 786 | {/if}
|
| 787 | + |
| 788 | + {#if addedDirs.length > 0} |
| 789 | + <Drawer defaultCollapsed={false} noshrink> |
| 790 | + {#snippet header()} |
| 791 | + <h4 class="text-14 text-semibold truncate">Added Directories</h4> |
| 792 | + <Badge>{addedDirs.length}</Badge> |
| 793 | + {/snippet} |
| 794 | + |
| 795 | + <div class="right-sidebar-list right-sidebar-list--small-gap"> |
| 796 | + {#each addedDirs as dir} |
| 797 | + <div class="added-dir-item"> |
| 798 | + <span class="text-13 grow-1">{dir}</span> |
| 799 | + <Button |
| 800 | + kind="ghost" |
| 801 | + icon="bin" |
| 802 | + shrinkable |
| 803 | + onclick={() => { |
| 804 | + if (selectedBranch) { |
| 805 | + uiState.lane(selectedBranch.stackId).addedDirs.remove(dir); |
| 806 | + chipToasts.success(`Removed directory: ${dir}`); |
| 807 | + } |
| 808 | + }} |
| 809 | + tooltip="Remove directory" |
| 810 | + /> |
| 811 | + </div> |
| 812 | + {/each} |
| 813 | + </div> |
| 814 | + </Drawer> |
| 815 | + {/if} |
766 | 816 | {/if}
|
767 | 817 |
|
768 | 818 | <Resizer
|
|
1188 | 1238 | width: 9px;
|
1189 | 1239 | height: 9px;
|
1190 | 1240 | }
|
| 1241 | +
|
| 1242 | + .added-dir-item { |
| 1243 | + display: flex; |
| 1244 | + align-items: center; |
| 1245 | + justify-content: space-between; |
| 1246 | + } |
| 1247 | +
|
| 1248 | + .right-sidebar-list--small-gap { |
| 1249 | + gap: 4px; |
| 1250 | + } |
1191 | 1251 | </style>
|
0 commit comments