Add snapshot files to list a snapshot's files without restoring it (closes #435)
check / check (push) In progress

`vaultik snapshot files <snapshot-id> [path] [--json]` downloads and
decrypts the snapshot database, as restore does, and prints mode, size,
modification time and path for every file at or under the path. A path
that matches nothing is an error. It needs the private key. The mode is
in Go's file-mode notation, which the README spells out. The table
quotes a path that holds a non-printable character.

Named `files` because `ls` is already the alias of `snapshot list`.
The missing-key error no longer says "for restore", since this command
and deep verify return it too. The README opening now states the
private-key rule first.

Model: opus-5-5
This commit is contained in:
sneak committed 2026-11-13 21:21:42 +00:00
1 parent 5ca0d46932
commit 88f2ea6f06
14 files changed
+552 -82

No files matched your search

+5 -4
View File
@@ -238,10 +238,11 @@ func (r *SnapshotRepository) GetByID(
// GetOnlySnapshot returns the sole snapshot in an exported per-snapshot
// metadata database. The backup path writes each snapshot's database with
// exactly one snapshot row (see cleanSnapshotDB), so restore and deep
// verify expect exactly one. Zero rows return ErrNoSnapshotInDatabase and
// more than one returns ErrMultipleSnapshotsInDatabase; callers treat
// either as a failed identity check on the downloaded database.
// exactly one snapshot row (see cleanSnapshotDB), so restore, deep verify
// and `snapshot files` expect exactly one. Zero rows return
// ErrNoSnapshotInDatabase and more than one returns
// ErrMultipleSnapshotsInDatabase; callers treat either as a failed
// identity check on the downloaded database.
func (r *SnapshotRepository) GetOnlySnapshot(ctx context.Context) (*Snapshot, error) {
query := `
SELECT id, hostname, vaultik_version, vaultik_git_revision,