Skip to content

feat(cli): unify resource deletion - #62

Merged
justusschock merged 10 commits into
mainfrom
justus/unified-delete-cli
Jul 31, 2026
Merged

feat(cli): unify resource deletion#62
justusschock merged 10 commits into
mainfrom
justus/unified-delete-cli

Conversation

@justusschock

@justusschock justusschock commented Jul 30, 2026

Copy link
Copy Markdown
Member

What

  • adds one shared delete-command registration utility with positional resource identifiers
  • standardizes Studio, Job, MMT, Deployment, Container, API key, Sandbox, and Snapshot deletion
  • prompts with the Click default-no [y/N] confirmation, supports -y/--yes, and prints <Resource> deleted
  • registers each command directly with its CLI group, using small resolver callbacks only for nonuniform APIs
  • keeps deletion output human-readable only; delete commands do not expose --json

Commands and output

Enter accepts the safe default and aborts deletion; enter y to confirm.

Studio

$ lightning studio delete my-studio
Are you sure you want to delete? [y/N]: y
Studio deleted

$ lightning studio delete my-studio -y
Studio deleted

Job

$ lightning job delete my-job
Are you sure you want to delete? [y/N]: y
Job deleted

$ lightning job delete my-job -y
Job deleted

Multi-machine job

$ lightning mmt delete my-mmt
Are you sure you want to delete? [y/N]: y
Multi-machine job deleted

$ lightning mmt delete my-mmt -y
Multi-machine job deleted

Deployment

$ lightning deployment delete my-deployment
Are you sure you want to delete? [y/N]: y
Deployment deleted

$ lightning deployment delete my-deployment -y
Deployment deleted

Container

$ lightning container delete my-container
Are you sure you want to delete? [y/N]: y
Container deleted

$ lightning container delete my-container -y
Container deleted

API key

$ lightning api-key delete key-123
Are you sure you want to delete? [y/N]: y
API key deleted

$ lightning api-key delete key-123 -y
API key deleted

Sandbox

$ lightning sandbox delete sbx-42
Are you sure you want to delete? [y/N]: y
Sandbox deleted

$ lightning sandbox delete sbx-42 -y
Sandbox deleted

Sandbox snapshot

$ lightning sandbox snapshot delete snap-9
Are you sure you want to delete? [y/N]: y
Snapshot deleted

$ lightning sandbox snapshot delete snap-9 -y
Snapshot deleted

Context overrides remain available where applicable: --teamspace for Studio, Job, MMT, Deployment, and Container; --org for API keys; and --api-key for Sandboxes and Snapshots.

Why

Deletion commands had separate implementations and inconsistent arguments, confirmation behavior, flags, and success output. This gives every registered resource deletion command the same user-facing contract.

@justusschock
justusschock force-pushed the justus/unified-delete-cli branch from e791a06 to 6dd10be Compare July 30, 2026 11:59
@justusschock
justusschock marked this pull request as ready for review July 30, 2026 15:57
@justusschock
justusschock force-pushed the justus/unified-delete-cli branch from 9d4126e to d468de0 Compare July 30, 2026 15:59
@justusschock
justusschock enabled auto-merge (squash) July 30, 2026 17:20

@tejapulagam tejapulagam left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Job / MMT / container / API key : currently delete automatically with no prompt; now this will prompt unless -y is included in the command so this might cause hangs in existing user scripts?

Comment thread python/lightning_sdk/cli/utils/delete.py Outdated
@justusschock

Copy link
Copy Markdown
Member Author

Job / MMT / container / API key : currently delete automatically with no prompt; now this will prompt unless -y is included

that's true, but at some point we need to make a breaking change if we want to unify this.
We don't auto-upgrade the SDK and usually users should have it pinned as well.

@ethanwharris ethanwharris left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Code looks good, slight preference for y/N but nbd

@justusschock
justusschock merged commit 07d9af6 into main Jul 31, 2026
24 checks passed
@justusschock
justusschock deleted the justus/unified-delete-cli branch July 31, 2026 09:21
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.

4 participants