fix(spawn): handle empty or missing projects directory

- Add empty-state message in SpawnModal when no projects found
- Spawn button stays disabled when projects list is empty
- Server already handled OSError/missing dir gracefully (returns [])
- Add tests: missing directory, only-hidden-dirs, empty API responses

Closes: bd-3c7
This commit is contained in:
teernisse
2026-02-26 17:07:35 -05:00
parent 2d65d8f95b
commit 8070c4132a
2 changed files with 611 additions and 1 deletions

View File

@@ -86,7 +86,7 @@ export function SpawnModal({ isOpen, onClose, onSpawn, currentProject }) {
const data = await response.json();
if (data.ok) {
onSpawn({ success: true, project, agentType });
onSpawn({ success: true, project, agentType, spawnId: data.spawn_id });
handleClose();
} else {
setError(data.error || 'Spawn failed');
@@ -139,6 +139,10 @@ export function SpawnModal({ isOpen, onClose, onSpawn, currentProject }) {
<span class="working-dots"><span>.</span><span>.</span><span>.</span></span>
Loading projects
</div>
` : projects.length === 0 ? html`
<div class="rounded-xl border border-selection/75 bg-bg/70 px-3 py-2 text-sm text-dim">
No projects found in ~/projects/
</div>
` : html`
<select
value=${selectedProject}