Skip to content

feat(cli): add snapshots delete command - #256

Merged
designcode merged 1 commit into
mainfrom
feat/cli/delete-snapshot
Aug 17, 2026
Merged

feat(cli): add snapshots delete command#256
designcode merged 1 commit into
mainfrom
feat/cli/delete-snapshot

Conversation

@designcode

@designcode designcode commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds tigris snapshots delete <bucket> <version[,version...]> (alias d). Snapshots could be taken and listed, but never deleted from the CLI — the only way to drop one was to call the SDK's deleteBucketSnapshot directly.

tigris snapshots delete my-bucket 1765889000501544464 --yes
tigris snapshots delete my-bucket 1765889000501544464,1765889000501544465 --yes

Behavior

  • Takes one or more comma-separated snapshot versions and deletes each in turn, reporting per-version success or failure so one bad version does not hide the outcome of the others. Exits non-zero if any deletion failed.
  • Requires confirmation before deleting; --yes/--force skips it, and the command refuses to run in non-TTY mode without it — matching buckets delete and objects delete.
  • --format json emits { action, bucket, versions, errors }, the same shape buckets delete returns.
  • Deletion is permanent. Forks already created from a snapshot are unaffected.

Incidental fix

The 19-digit example version in specs.yaml is now quoted. Unquoted it parses as a YAML float and loses its trailing digits, so snapshots delete help printed 1765889000501544400 instead of 1765889000501544464. Existing specs only ever put versions in prose, so nothing else was affected.

Testing

  • tsc --noEmit, pnpm build, and biome check all clean.
  • CLI suite: 30 files, 929 passed. The 224 skips are the live-gateway integration tests, which need .env.test credentials — the three new integration tests below were not exercised locally and will run for the first time in CI.
  • New offline tests: non-TTY confirmation guard, and delete present in snapshots help.
  • New live-gateway tests (own bucket, so the fork lifecycle block is untouched): single delete, list reflects the deletion, comma-separated multi-delete.
  • Also drove the built binary directly to confirm help output, the missing-version error, version plumbing into the SDK call, JSON shape, and exit code 1 on failure.

Changeset included (minor for @tigrisdata/cli).

🤖 Generated with Claude Code


Note

Cursor Bugbot is generating a summary for commit a8e9b97. Configure here.

Snapshots could be taken and listed, but never deleted from the CLI. The only way to
drop one was to call the SDK's deleteBucketSnapshot directly, so `tigris snapshots
delete` closes that gap:

    tigris snapshots delete my-bucket 1765889000501544464 --yes

Takes one or more comma-separated snapshot versions and deletes each in turn,
reporting per-version success or failure so one bad version does not hide the outcome
of the others. Exits non-zero if any deletion failed. `--format json` emits
{ action, bucket, versions, errors }, the same shape `buckets delete` returns.

Confirmation is required before deleting; `--yes`/`--force` skips it, and the command
refuses to run in non-TTY mode without it, matching `buckets delete` and
`objects delete`.

Also quote the 19-digit example version in specs.yaml. Unquoted it parses as a YAML
float and loses its trailing digits, so `snapshots delete help` printed
1765889000501544400 instead of 1765889000501544464.

Assisted-by: Claude Opus 5 (1M context) via Claude Code
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Aug 17, 2026

Copy link
Copy Markdown

Greptile Summary

Adds a destructive snapshots delete CLI command with confirmation, multi-version deletion, structured output, documentation, and tests.

  • Declares the new command, alias, arguments, messages, and examples in the CLI specification.
  • Deletes requested snapshots independently and returns a non-zero exit status if any deletion fails.
  • Adds offline confirmation/help coverage and live-gateway deletion tests.
  • Quotes the example snapshot version to preserve its 19-digit value during YAML parsing.

Confidence Score: 5/5

The PR appears safe to merge, with no concrete blocking or non-blocking defects identified in the changed code.

The command is reachable through the existing spec-driven dispatch path, comma-separated versions are normalized by CLI argument extraction, destructive execution is confirmation-gated, and structured partial-failure reporting follows existing delete-command conventions.

Important Files Changed

Filename Overview
packages/cli/src/lib/snapshots/delete.ts Implements confirmed, sequential snapshot deletion with per-version results and aggregate JSON output; no actionable defect identified.
packages/cli/src/specs.yaml Registers the delete command and correctly preserves the large example version as a quoted string.
packages/cli/test/cli.test.ts Adds non-interactive confirmation coverage plus live single- and multi-snapshot deletion scenarios.
packages/cli/README.md Documents the new command, permanent-deletion behavior, force flag, and usage examples.

Reviews (1): Last reviewed commit: "feat(cli): add snapshots delete command" | Re-trigger Greptile

@designcode
designcode merged commit 91ee258 into main Aug 17, 2026
3 checks passed
@designcode
designcode deleted the feat/cli/delete-snapshot branch August 17, 2026 12:36
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