https://github.com/escherize/go-silo
A tool to reap and sow directory trees and files
https://github.com/escherize/go-silo
Last synced: 9 months ago
JSON representation
A tool to reap and sow directory trees and files
- Host: GitHub
- URL: https://github.com/escherize/go-silo
- Owner: escherize
- Created: 2025-08-21T03:29:46.000Z (11 months ago)
- Default Branch: master
- Last Pushed: 2025-08-21T03:42:56.000Z (11 months ago)
- Last Synced: 2025-08-21T05:47:47.389Z (11 months ago)
- Language: Go
- Size: 7.29 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# silo 🌾
Pack and unpack directory trees and files into a single text format. Store your code harvest in a silo for later planting! Perfect for sharing project structures and understanding how file paths relate to each other.

## Example
Let's say you have a Python project with these files:
**main.py**
```python
from src.helpers.utils import add
print(add(2, 3))
```
**src/helpers/utils.py**
```python
def add(a, b):
return a + b
```
Pack these files into your silo:
```bash
silo pack -o project.silo main.py src/helpers/utils.py
```
This creates a **project.silo** file:
```
> main.py
from src.helpers.utils import add
print(add(2, 3))
> src/helpers/utils.py
def add(a, b):
return a + b
```
Unpack anywhere:
```bash
silo unpack project.silo
```
The delimiter (`>` in this example) is automatically chosen to avoid conflicts with your file content. Or you can choose one with `-d` using any Unicode character including emojis like `🌾` (see [Silo File Format Spec](https://github.com/escherize/silo_spec)).
# Install
```bash
go install github.com/escherize/go-silo/cmd/silo@latest
```
# Pack (Harvest files into silo)
```bash
silo pack -o harvest.silo src/
```
Multiple patterns:
```bash
silo pack "*.go" "*.md" "docs/*.txt"
```
Enhanced recursive harvest:
```bash
silo pack -enhanced -o deep_harvest.silo "src/**/*.go"
```
To stdout:
``` bash
silo pack file1.go file2.go
```
## Custom delimiter (including emojis!)
```bash
silo pack -d "🌾" -o wheat_harvest.silo src/
```
# Unpack (Plant files from silo)
To current directory:
```bash
silo unpack project.silo
```
To the `field` directory:
```bash
silo unpack project.silo -o field/
```
## Format
A silo file contains multiple files separated by delimiters:
```
🌾 path/to/file1.txt
file1 content here
🌾 path/to/file2.txt
file2 content here
```
When packing, the delimiter (`🌾` in this example) is auto-detected to avoid conflicts with file content. When unpacking, the first delimiter found should be used for every file path.
## Security Features 🔒
Silo protects against path traversal attacks:
- ❌ `../` parent directory references
- ❌ `/etc/passwd` absolute paths
- ❌ `C:\Windows\System32` drive letters
- ❌ URL-encoded attacks like `%2e%2e%2f`
Only relative paths within your project are allowed!
## Spec
Full specification: https://github.com/escherize/silo-spec