Skip to content

feat(cli): add ability to list deleted branches and recover deleted branch - #269

Open
aluuu wants to merge 7 commits into
stack/adinu/LKB-7079/sdk-branch-recovery-specfrom
stack/adinu/LKB-7079/cli-branch-recovery
Open

feat(cli): add ability to list deleted branches and recover deleted branch#269
aluuu wants to merge 7 commits into
stack/adinu/LKB-7079/sdk-branch-recovery-specfrom
stack/adinu/LKB-7079/cli-branch-recovery

Conversation

@aluuu

@aluuu aluuu commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

why?

The Neon public API now supports branch recovery: a deleted branch can be recovered within a 7-day window instead of being lost. This change adds neonctl support for that feature so users can recover a deleted branch, list deleted branches, see the recovery deadline and permanently delete a branch.

what?

  • neonctl branches recover <id|name> — new subcommand
  • branches list --include-deleted — includes recoverable deleted branches; sends include_deleted=false explicitly when the flag is absent.
  • Deleted-branch rendering — in list table output a deleted branch shows Current State = deleted plus a Recoverable Until column (recoverable_until).
  • branches delete --hard-delete — permanently deletes immediately, skipping the 7-day recovery window (hard_delete=true).

@aluuu aluuu changed the title Stack/adinu/lkb 7079/cli branch recovery feat(cli): add ability to list deleted branches and recover deleted branch Jul 2, 2026
Add an optional renderHeaders map to the table writer so a column's header
can override the name auto-derived from its field key, and use it in
branches list to render the recovery column as 'Recoverable Until' instead
of 'Recovery'.

Co-authored-by: Isaac
@aluuu aluuu self-assigned this Jul 2, 2026
@aluuu
aluuu marked this pull request as ready for review July 2, 2026 11:18
@aluuu
aluuu requested review from ivanoglo, philip and rumyantseva July 2, 2026 11:18

@ivanoglo ivanoglo left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have one minor comment. I tried to test it locally, but seems like it does not work. Maybe because this feature is not enabled. How can I test this functionality (I don't have access to posthog)?

]);
});

test("delete by id with hard-delete", async ({ testCliCommand }) => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we only testing delete by id and recover by id and name? We can delete by name too, we should test that too.

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.

3 participants