Skip to content

feat(plan): plan delete (refused while workspaces are on it), plan archive, tenant set-plan (TBP-806) - #61

Closed
iman-nebulr wants to merge 4 commits into
mainfrom
feature/tbp-806-plan-delete
Closed

iman-nebulr wants to merge 4 commits into
mainfrom
feature/tbp-806-plan-delete

Conversation

@iman-nebulr

Copy link
Copy Markdown
Contributor

Commands

  • bridge plan delete --key <key> [--dry-run] deletes a plan no workspace is on. When workspaces are on it, the server refuses with 409 PLAN_IN_USE, and the CLI prints the server's fix: archive the plan, or move or delete those workspaces first. Needs bridge auth login --admin.
  • bridge plan archive --key <key> [--undo]: workspaces on the plan keep it, and nobody new can choose it.
  • bridge tenant set-plan --name|--id --plan <key> [--interval] [--currency] moves a workspace to another plan, the same change as the dashboard's plan picker. A paid Stripe subscription moves with it.

The README and the payments decision guide are updated. prompts/mcp-tools.json is regenerated from bridge-api to include delete_plan, archive_plan and set_tenant_plan.

Tests

  • Jest: 1,107/1,107 pass, including the new tbp806-plan-commands.test.ts (17 cases).

Depends on

The server side is in bridge-api feature/tbp-806-plan-delete. Against an older server, plan delete --dry-run fails safe (preview not supported) and plan archive returns 404.

Ticket: TBP-806

A plan could be created and reshaped from the CLI but never removed, so a
scripted reset (a demo app back to clean) always ended with "delete these
plans in the dashboard". `bridge plan delete --key <key>` removes it. The
server decides what that means: a plan no workspace is on is deleted, one
workspaces are on is archived (they keep it, nobody new can choose it), and
the answer's `action` says which. `--dry-run` shows that decision and the
workspaces on the plan, through the delete's read-only preview route, like
`tenant delete` and `flag delete`. Needs delete authority (`auth login --admin`).

Refs: TBP-806
Claude-Session: 9e06c000
…plan archive and tenant set-plan (TBP-806)

Owner decision: deleting a plan workspaces are on is refused, not turned
into an archive. The server answers 409 PLAN_IN_USE with how many
workspaces are on it and the choices, which the CLI prints as the fix:
archive the plan (`bridge plan archive`, `--undo` brings it back), or move
those workspaces (`bridge tenant set-plan`, the dashboard's plan picker on
the same route, Stripe subscription included) or delete them, then delete.

Refs: TBP-806
Claude-Session: 9e06c000
…TBP-806)

- --dry-run calls only the deletion-preview route and never sends a DELETE.
- The delete sends a DELETE to the encoded key path and prints the
  server's answer.
- A 409 PLAN_IN_USE answer comes out as that code, with the server's fix as
  the hint and exit code 1.
- plan archive sends { archived: true }; --undo sends false.
- tenant set-plan picks the plan's price and posts to planDetails. An
  unknown plan, price or tenant, or an ambiguous tenant name, sends nothing.
- The three commands are registered.

Not run yet: no running container mounts bridge-cli.

Refs: TBP-806
Claude-Session: 9e06c000
…_plan and set_tenant_plan (TBP-806)

Refs: TBP-806
Claude-Session: 9e06c000
@iman-nebulr

Copy link
Copy Markdown
Contributor Author

Shipped in #62 (release v0.6.5).

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.

1 participant