You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
stack prune: also remove unreadable stacks, stacks of deleted branches, and stop idle stacks #7897
supabase stack prune (#7624, for #7568) only finds stacks whose project directory no longer exists. Three other kinds of leftover stacks pile up in a git worktree workflow, and nothing lists or removes them in bulk.
1. Stacks the current CLI can no longer read
After a CLI upgrade, older stack entries can fail to parse. Discovery skips them with a warning and nothing else (apps/cli/src/commands/experimental/stack/prune/prune.handler.ts):
stack list and stack stop do the same, so the only way to remove these is to copy each id out of stderr and run stack destroy --stack-id <id> --yes, or to delete the folder under ~/.supabase/stacks by hand. Their data folders stay on disk until then.
2. Stacks of deleted branches
The stack identity includes the branch context. When a branch is merged and deleted but the worktree directory is reused for another branch, the old stack's directory still exists, so prune keeps it.
3. Idle stacks of other checkouts
On macOS each running Postgres holds a System V shared memory segment, and the machine allows 32 (#7269). Stacks of branches nobody is working on keep running until they are stopped one by one.
Proposal
stack prune --invalid: also destroy entries that fail to load, listing them in --dry-run with the parse error.
stack prune also treats a stack as orphaned when its recorded branch no longer resolves in its project root (git rev-parse --verify --quiet refs/heads/<branch>).
stack prune --stop-idle: stop (not destroy) running stacks other than the current one.
In --output-format json, a reason per stack (directory-missing, branch-deleted, invalid, idle).
We do this outside the CLI today, reading supabase stack list --output-format json and calling stack destroy or stack stop per stack: stacks.ts.
Activity