A smart command-line archiver that filters files by extension, size, and file type before compressing them. It features an interactive, modern TUI to preview selected files before archiving, making it ideal for creating clean project backups or source distributions without binary bloat or build artifacts.
- Smart Filtering: Automatically identifies and archives source files, configurations, and documentation while skipping build artifacts, dependency directories, and giant files.
- Multiple Archivers Supported: Leverages native command-line archivers (
7z,tar,zip) automatically resolved from your system path or common locations. - Modern Interactive TUI: Built with Bubble Tea and Lip Gloss, presenting real-time progress during scanning and a scrollable/collapsible file tree view.
- Configurable Rules: Custom flags allow you to append extensions, override defaults, ignore specific directories, and include exact filenames.
- Gitignore Integration: Automatically reads and respects rules inside local
.gitignorefiles to match your project configuration. - Metadata Logging: Optionally embeds a
.smartarc-meta.jsoninside the archive, detailing exact settings, inputs, and build time. - Performance Focused: Concurrent directory scanning utilizing a pool of worker goroutines for maximum throughput.
You can download pre-compiled binaries for Windows from the Releases page.
Ensure you have the Go toolchain installed (Go 1.22+ recommended).
# Clone the repository
git clone https://github.com/dhr412/smartarc.git
cd smartarc
# Build the binary
go build -o smartarc.exe ./src/main.goThe compiled binary smartarc.exe will be located in the root folder.
Run the executable with --archiver (or -a) and any optional flags:
# Example: Create a zip archive using 7z, respecting .gitignore, and adding custom extensions
./smartarc.exe -a 7z -f zip --gitignore --ext .sol,.move .
# Example: Run a dry-run to preview files from multiple project directories
./smartarc.exe -a zip --dry-run /path/to/project1 /path/to/project2| Flag | Description | Default | Values |
|---|---|---|---|
-a, --archiver |
Required. The system compression utility to invoke | - | 7z, tar, zip |
-f, --format |
Output archive format (auto-inferred if omitted) | - | 7z, zip, tar.gz, tar.xz, tar.bz2, tar |
-o, --output |
Custom output file name or absolute path | smartarc-<datetime>.<ext> |
Any file path |
-l, --level |
Compression level (0 = store, 9 = maximum compression) | 5 |
0 to 9 |
--embed-meta |
Embed .smartarc-meta.json in the root of the archive |
false |
flag |
--dry-run |
Scan, filter, and preview file structure without writing the archive | false |
flag |
| Flag | Description | Default | Values |
|---|---|---|---|
-s, --max-size |
Maximum file size in bytes to include in the scan | 8388608 (8MB) |
Any integer >= 0 |
-w, --workers |
Number of concurrent goroutines for scanning | 8 |
Any integer >= 1 |
-e, --ext |
Comma-separated list of additional extensions to include | - | e.g. .sol,.move |
-i, --ignore |
Comma-separated list of additional directories to ignore | - | e.g. temp,logs |
--include-dirs |
Override ignored directories or allowlist folders | - | e.g. build,vendor |
--include-names |
Comma-separated list of additional exact filenames to include | - | e.g. config.toml |
--gitignore |
Read and respect local .gitignore rules |
false |
flag |
To exit the application during dry-run or archive phase, press q or Ctrl+C in the terminal.
smartarc scans the target folders recursively and builds a list of matching files in real-time.
- Scanning: It runs concurrent workers (configured via
--workers) to traverse directories. - Filtering:
- Extensions & Names: Matches files against a comprehensive built-in list of source extensions (Go, Python, JS, C++, Rust, etc.) and file names (Dockerfile, Makefile, etc.), plus any custom values provided.
- Binary Detection: Automatically skips binary files by checking their magic bytes (ELF, PE, PNG, JPEG, PDF, etc.) and checking for NUL bytes.
- Size Limit: Skips files larger than the
--max-sizethreshold. - Directory Ignores: Skips standard dependency and output directories (like
node_modules,.git,dist,target,bin) unless explicitly allowed via--include-dirs. - Gitignore Rules: Optionally filters out files matching patterns defined in local
.gitignorefiles.
- TUI Preview: If
--dry-runis active, it starts a Bubble Tea interactive session showing a tree visualization of all matched files. Folders that were ignored but overridden will be shown as collapsed with a notice. - Archiving: It writes the relative paths of all target files to a temporary file list and invokes the selected system archiver (
7z,tar, orzip) to produce the archive in the common parent directory. If--embed-metais set, a.smartarc-meta.jsonis generated and packed alongside the files.
This project is licensed under the MIT License.