Allow deleting projects from the project picker with x/X.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Skruecken
2026-10-19 13:59:20 +02:00
co-authored by Cursor
parent f3a592f3ea
commit c5920ffd54
9 changed files with 288 additions and 29 deletions
+23
View File
@@ -11,6 +11,7 @@ import (
type Store interface {
List() ([]Project, error)
Ensure(id string) error
Delete(id string) error
}
// DirStore discovers projects as subdirectories of dataDir/projects.
@@ -63,3 +64,25 @@ func (s *DirStore) Ensure(id string) error {
}
return nil
}
// Delete removes the project directory and all of its files.
func (s *DirStore) Delete(id string) error {
if id == "" {
return fmt.Errorf("project id is required")
}
dir := filepath.Join(s.projectsRoot(), id)
st, err := os.Stat(dir)
if err != nil {
if os.IsNotExist(err) {
return fmt.Errorf("project %s: not found", id)
}
return fmt.Errorf("stat project %s: %w", id, err)
}
if !st.IsDir() {
return fmt.Errorf("project %s: not a directory", id)
}
if err := os.RemoveAll(dir); err != nil {
return fmt.Errorf("delete project %s: %w", id, err)
}
return nil
}