Skip to content

feat(snapshot): add inspect command for local snapshots#354

Closed
gtsiolis wants to merge 1 commit into
mainfrom
pro-322-add-inspect-command-for-local-snapshots-c414
Closed

feat(snapshot): add inspect command for local snapshots#354
gtsiolis wants to merge 1 commit into
mainfrom
pro-322-add-inspect-command-for-local-snapshots-c414

Conversation

@gtsiolis

@gtsiolis gtsiolis commented Jul 1, 2026

Copy link
Copy Markdown
Member

What

Adds lstk snapshot inspect <file> — an offline, per-service size breakdown of a local .snapshot archive.

No running emulator, no platform call, no auth.

$ lstk snapshot inspect ./checkpoint.snapshot

  ~ Snapshot analysis for checkpoint.snapshot
    4.5 MB
  s3                 3.9 MB   87%
  dynamodb         172.4 KB    4%
  iam              107.4 KB    2%
  cloudfront        78.4 KB    2%
  ...
  ───────────────────────────────
  TOTAL              4.5 MB  100%

Why

snapshot show is cloud-only and reports resource counts plus one aggregate size — it can't answer "what's eating the space in my local snapshot?". inspect reads the archive directly and attributes bytes per service, combining each service's control-plane state (api_states/) and data payloads (assets/), aggregated across accounts and regions.

Details

  • Opens the .snapshot ZIP with stdlib archive/zip and tallies sizes per entry — no emulator, platform, or auth.
  • One row per service, sorted largest-first, with % of total and a grand total.
  • --json emits the same data (raw bytes) for scripts and agents.
  • Cloud (pod:) refs are rejected and pointed at snapshot show.
  • New typed SnapshotInspectedEvent with plain + TUI rendering parity. Unit + integration tests; no Docker required.

Note

This branch rebases the work from #331 onto the latest main (picking up the PullSkippableEvent/ESC-to-skip changes from #341). The cherry-pick applied cleanly with no textual conflicts; both new events coexist in the sink/format switch lists.

@gtsiolis gtsiolis added semver: patch docs: needed Pull request requires documentation updates labels Jul 1, 2026
Add `lstk snapshot inspect <file>`, an offline size breakdown of a local
.snapshot archive — no running emulator, no platform call, no auth.

It opens the ZIP and tallies bytes per service, combining each service's
control-plane state (api_states/) and data-asset payloads (assets/) and
aggregating across accounts and regions. Output is one row per service,
sorted largest-first, with percentages and a grand total; --json emits the
same data for scripts and agents. Cloud (pod:) refs are rejected and pointed
at `snapshot show`.

Complements `snapshot show`, which reports cloud metadata and resource counts.

Co-authored-by: linear-code[bot] <222613912+linear-code[bot]@users.noreply.github.com>
@gtsiolis gtsiolis force-pushed the pro-322-add-inspect-command-for-local-snapshots-c414 branch from 6bb1c32 to d30594a Compare July 2, 2026 07:09
@gtsiolis

gtsiolis commented Jul 2, 2026

Copy link
Copy Markdown
Member Author

Closing as duplicate of #354.

@gtsiolis gtsiolis closed this Jul 2, 2026
@gtsiolis gtsiolis self-assigned this Jul 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs: needed Pull request requires documentation updates semver: patch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant