Skip to content

feat: add delete repository functionality#42

Open
Selene29 wants to merge 5 commits intorepowise-dev:mainfrom
Selene29:feat/delete-repo
Open

feat: add delete repository functionality#42
Selene29 wants to merge 5 commits intorepowise-dev:mainfrom
Selene29:feat/delete-repo

Conversation

@Selene29
Copy link
Copy Markdown

@Selene29 Selene29 commented Apr 5, 2026

Summary

  • Add delete_repository and list_page_ids CRUD helpers, plus delete_many for FTS cleanup
  • Add DELETE /api/repos/{repo_id} endpoint that cascades through DB rows and FTS index
  • Add repowise delete CLI command with interactive repo selection and --force flag
  • Add delete button to the dashboard UI (hover icon) with confirmation dialog
  • Add delete button to repo settings page under a Danger Zone card — fixes single-repo setups where the dashboard auto-redirects past the list

Test plan

  • Unit tests for CRUD delete_repository and list_page_ids
  • API endpoint tests for DELETE /api/repos/{repo_id} (success + 404)
  • Manual: run repowise delete CLI and verify repo is removed
  • Manual: click delete button in dashboard, confirm dialog, verify repo disappears
  • Manual: navigate to /repos/{id}/settings, verify Danger Zone section with Delete Repository button

@RaghavChamadiya
Copy link
Copy Markdown
Collaborator

Full-stack delete is well done. CRUD, API, CLI, and both UI surfaces (dashboard and Danger Zone) are all covered. The FTS cleanup before CASCADE delete is the right order.

Two issues I found in the code:

  1. CLI argument parsing bug (delete_cmd.py): There are two positional optional arguments, repo_id and path. Click assigns positional args left-to-right, so repowise delete /path/to/repo would assign the path string to repo_id, then fail when trying to look it up as a UUID. The path argument is effectively unreachable. Suggest making path an option (--path) instead of a positional argument.

  2. FTS skip when None (repos.py): In delete_repo, FTS cleanup is skipped when fts is None. If FTS was not initialized on a cold start, old FTS rows would linger. Is this a real scenario? If FTS is always initialized before any delete could happen, a comment explaining that would help future readers.

Logic and tests otherwise look solid. Fix the CLI argument issue and this is ready to merge.

Selene29 added 4 commits April 6, 2026 12:56
Persistence layer for repository deletion. CASCADE on FK constraints
handles child tables; FTS5 needs explicit cleanup via delete_many.
Cleans up FTS index before CASCADE-deleting the repository and all
child rows (pages, graph, symbols, git metadata, decisions, etc.).
Lists repos in a numbered table, lets user pick one, confirms,
then cleans FTS and CASCADE-deletes the repo. Supports --force.
Trash icon appears on hover in the repo list. Clicking shows a
confirmation dialog, then calls DELETE /api/repos/{id} and refreshes.
Reviewer feedback:
- path as a second positional arg was unreachable (Click assigns
  left-to-right, so a path string would land in repo_id). Now --path/-p.
- Added comment explaining fts is always initialized in lifespan, so
  the None guard is purely defensive.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants