Skip to content

Add directory support to the CLI via SQAR archive streams - #1

Merged
paigejulianne merged 1 commit into
mainfrom
feat/directory-archive
Jul 10, 2026
Merged

Add directory support to the CLI via SQAR archive streams#1
paigejulianne merged 1 commit into
mainfrom
feat/directory-archive

Conversation

@paigejulianne

Copy link
Copy Markdown
Collaborator

Extend squish c/d/s to accept a directory as well as a single file. A directory is serialized into a single SQAR archive stream (files, subdirectories, empty directories, and unix permission bits) and compressed as one unit; decompression detects the archive and recreates the tree under the output path.

The compression engine and libsquish ABI are untouched — the archive format is a CLI-level wrapper compressed as an ordinary SQ02/SQ01 stream. Single-file compression is unchanged and byte-for-byte compatible with earlier releases; auto-detection on decompress keys off the SQAR magic. Extraction rejects absolute paths and .. traversal, and entries are stored sorted so archives depend only on the tree, not on filesystem iteration order.

Documented as docs/FORMAT.md §12; CI gains directory round-trip steps (including empty-dir and SFX-directory checks) on the Linux and Windows-MSVC jobs.

Summary

Format impact

  • This change does not affect the compressed format
  • This change affects the compressed format, and the magic number was
    bumped (see docs/FORMAT.md)

Testing

  • make test passes
  • Benchmarks run (bench/run_squish.py) with before/after numbers, if
    this touches compression ratio or speed:
<paste before/after numbers here, if applicable>

Checklist

  • Code follows the existing style in the files touched
  • Builds clean with -Wall -Wextra (default Makefile flags)
  • Public API changes are documented in squish.h and
    docs/API.md
  • New source files carry the GPLv3 header used elsewhere in the repo

Extend `squish c`/`d`/`s` to accept a directory as well as a single
file. A directory is serialized into a single SQAR archive stream
(files, subdirectories, empty directories, and unix permission bits)
and compressed as one unit; decompression detects the archive and
recreates the tree under the output path.

The compression engine and libsquish ABI are untouched — the archive
format is a CLI-level wrapper compressed as an ordinary SQ02/SQ01
stream. Single-file compression is unchanged and byte-for-byte
compatible with earlier releases; auto-detection on decompress keys
off the SQAR magic. Extraction rejects absolute paths and `..`
traversal, and entries are stored sorted so archives depend only on
the tree, not on filesystem iteration order.

Documented as docs/FORMAT.md §12; CI gains directory round-trip
steps (including empty-dir and SFX-directory checks) on the Linux
and Windows-MSVC jobs.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@paigejulianne
paigejulianne merged commit 6dcd9f3 into main Jul 10, 2026
5 checks passed
@paigejulianne
paigejulianne deleted the feat/directory-archive branch July 10, 2026 15:13
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