samai-openbox 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- samai_openbox-0.1.0/LICENSE +21 -0
- samai_openbox-0.1.0/PKG-INFO +237 -0
- samai_openbox-0.1.0/README.md +202 -0
- samai_openbox-0.1.0/pyproject.toml +68 -0
- samai_openbox-0.1.0/setup.cfg +4 -0
- samai_openbox-0.1.0/src/samai_openbox/__init__.py +23 -0
- samai_openbox-0.1.0/src/samai_openbox/__main__.py +6 -0
- samai_openbox-0.1.0/src/samai_openbox/cli.py +178 -0
- samai_openbox-0.1.0/src/samai_openbox/core.py +598 -0
- samai_openbox-0.1.0/src/samai_openbox/py.typed +0 -0
- samai_openbox-0.1.0/src/samai_openbox.egg-info/PKG-INFO +237 -0
- samai_openbox-0.1.0/src/samai_openbox.egg-info/SOURCES.txt +13 -0
- samai_openbox-0.1.0/src/samai_openbox.egg-info/dependency_links.txt +1 -0
- samai_openbox-0.1.0/src/samai_openbox.egg-info/entry_points.txt +2 -0
- samai_openbox-0.1.0/src/samai_openbox.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024-2026 SamAI Group
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: samai-openbox
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: CLI archive skill for AI agents — compress and extract zip, tar, tar.gz, 7z, rar, iso from one stable command. Part of the OpenBox project.
|
|
5
|
+
Author-email: SamAI Group <dev@samai.cc>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://openbox.samai.cc
|
|
8
|
+
Project-URL: Documentation, https://openbox.samai.cc/ai-agent.html
|
|
9
|
+
Project-URL: Source, https://github.com/samaidev/openbox
|
|
10
|
+
Project-URL: Issues, https://github.com/samaidev/openbox/issues
|
|
11
|
+
Project-URL: OpenBox desktop app, https://openbox.samai.cc/download.html
|
|
12
|
+
Keywords: openbox,archiver,compression,extraction,ai-agent,cli,llm,agent,skill,zip,tar,tar.gz,7z,rar,iso,samai
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Environment :: Console
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
17
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
18
|
+
Classifier: Operating System :: MacOS
|
|
19
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
20
|
+
Classifier: Programming Language :: Python :: 3
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
26
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
27
|
+
Classifier: Topic :: System :: Archiving
|
|
28
|
+
Classifier: Topic :: System :: Archiving :: Compression
|
|
29
|
+
Classifier: Topic :: Utilities
|
|
30
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
31
|
+
Requires-Python: >=3.8
|
|
32
|
+
Description-Content-Type: text/markdown
|
|
33
|
+
License-File: LICENSE
|
|
34
|
+
Dynamic: license-file
|
|
35
|
+
|
|
36
|
+
# samai-openbox
|
|
37
|
+
|
|
38
|
+
> CLI archive skill for AI agents — one stable command to compress and extract every common archive format.
|
|
39
|
+
|
|
40
|
+
[](https://pypi.org/project/samai-openbox/)
|
|
41
|
+
[](https://pypi.org/project/samai-openbox/)
|
|
42
|
+
[](https://github.com/samaidev/openbox/blob/main/LICENSE)
|
|
43
|
+
|
|
44
|
+
**samai-openbox** is a tiny, dependency-light Python package that exposes the
|
|
45
|
+
[OpenBox](https://openbox.samai.cc) archiver engine as a single CLI command —
|
|
46
|
+
`samai-openbox` — so any LLM agent with shell access can compress and extract
|
|
47
|
+
archives without remembering six different flag syntaxes.
|
|
48
|
+
|
|
49
|
+
## Why does this exist?
|
|
50
|
+
|
|
51
|
+
LLM agents are great at writing shell commands, but they consistently get
|
|
52
|
+
archive syntax wrong. One stable CLI fixes that:
|
|
53
|
+
|
|
54
|
+
- `tar -czvf` vs `tar -xzvf` vs `7z a` vs `7z x` vs `zip -r` vs `unzip` — agents hallucinate.
|
|
55
|
+
- Path-traversal protection varies by tool. OpenBox blocks `../../etc/passwd`-style entries at extraction time.
|
|
56
|
+
- JSON output mode lets agents parse archive contents in their reasoning loop.
|
|
57
|
+
|
|
58
|
+
## Install
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
# Standard
|
|
62
|
+
pip install samai-openbox
|
|
63
|
+
|
|
64
|
+
# Or with pipx (recommended for isolated CLI tools)
|
|
65
|
+
pipx install samai-openbox
|
|
66
|
+
|
|
67
|
+
# Verify
|
|
68
|
+
samai-openbox --version
|
|
69
|
+
samai-openbox --help
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Works on Python 3.8+. Pure-Python implementation using stdlib `zipfile` and
|
|
73
|
+
`tarfile`; shells out to the system `7z` / `7zz` / `7za` for 7z, and `unrar`
|
|
74
|
+
for rar (only if those formats are actually used).
|
|
75
|
+
|
|
76
|
+
## The CLI in 60 seconds
|
|
77
|
+
|
|
78
|
+
Five verbs cover everything an agent needs to do with archives.
|
|
79
|
+
|
|
80
|
+
### Compress files into an archive
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
# Auto-detects format from output extension: .zip .tar .tar.gz .7z
|
|
84
|
+
samai-openbox compress report.pdf photos/ -o backup.zip
|
|
85
|
+
|
|
86
|
+
# Force compression level (0-9, default 6)
|
|
87
|
+
samai-openbox compress src/ -o release.tar.gz --level 9
|
|
88
|
+
|
|
89
|
+
# 7z compression (requires 7z/7zz/7za on PATH)
|
|
90
|
+
samai-openbox compress bigfile.bin -o archive.7z
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Extract an archive
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
# Auto-creates destination if missing
|
|
97
|
+
samai-openbox extract backup.zip -d ./restored
|
|
98
|
+
|
|
99
|
+
# Works for every supported format
|
|
100
|
+
samai-openbox extract legacy.rar -d ./legacy
|
|
101
|
+
samai-openbox extract cd-image.iso -d ./cd-contents
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### List archive contents
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
# Human-readable
|
|
108
|
+
samai-openbox list backup.zip
|
|
109
|
+
|
|
110
|
+
# Machine-readable JSON — perfect for agent reasoning
|
|
111
|
+
samai-openbox list backup.zip --json
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Example JSON output:
|
|
115
|
+
|
|
116
|
+
```json
|
|
117
|
+
{
|
|
118
|
+
"archive": "backup.zip",
|
|
119
|
+
"format": "zip",
|
|
120
|
+
"entries": [
|
|
121
|
+
{"name": "report.pdf", "size": 2516582, "modified": "2024-08-15T10:23:00Z"},
|
|
122
|
+
{"name": "photos/", "size": 0, "modified": "2024-08-15T10:24:00Z", "is_dir": true},
|
|
123
|
+
{"name": "photos/01.jpg", "size": 4409111, "modified": "2024-08-14T18:11:00Z"}
|
|
124
|
+
]
|
|
125
|
+
}
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Test archive integrity
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
# Verifies CRCs without extracting — exits non-zero on corruption
|
|
132
|
+
samai-openbox test backup.zip
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Show version & supported formats
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
samai-openbox --version
|
|
139
|
+
samai-openbox formats
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Format support matrix
|
|
143
|
+
|
|
144
|
+
| Format | Compress | Extract | Notes |
|
|
145
|
+
|---------|:---------:|:--------:|-----------------------------------------|
|
|
146
|
+
| zip | ✓ | ✓ | stdlib `zipfile`, deflate or store |
|
|
147
|
+
| tar | ✓ | ✓ | stdlib `tarfile` |
|
|
148
|
+
| tar.gz | ✓ | ✓ | `tarfile` + gzip, 5 levels |
|
|
149
|
+
| 7z | ✓* | ✓* | requires `7z` / `7zz` / `7za` on PATH |
|
|
150
|
+
| rar | — | ✓* | requires `unrar` on PATH |
|
|
151
|
+
| iso | — | ✓* | requires `7z` (handles ISO 9660) |
|
|
152
|
+
|
|
153
|
+
`*` = via external CLI. Install with:
|
|
154
|
+
- 7-Zip: <https://www.7-zip.org/download.html> (Windows) · `brew install 7zip` (macOS) · `sudo apt install p7zip-full` (Linux)
|
|
155
|
+
- unrar: <https://www.rarlab.com/rar_add.htm> (Windows) · `brew install unrar` (macOS) · `sudo apt install unrar` (Linux)
|
|
156
|
+
|
|
157
|
+
## Path-traversal safety
|
|
158
|
+
|
|
159
|
+
`extract` blocks any archive entry whose absolute path would escape the
|
|
160
|
+
target directory. So an archive containing `../../etc/passwd` extracts the
|
|
161
|
+
file into `<target>/etc/passwd` instead of `/etc/passwd`. Safe to point at
|
|
162
|
+
untrusted downloads.
|
|
163
|
+
|
|
164
|
+
## ClawHub skill spec
|
|
165
|
+
|
|
166
|
+
Drop this into your agent's skill catalog so it knows when and how to call OpenBox:
|
|
167
|
+
|
|
168
|
+
```yaml
|
|
169
|
+
# skill.yaml
|
|
170
|
+
name: openbox-archive
|
|
171
|
+
version: 0.1.0
|
|
172
|
+
description: Compress and extract archives (zip, tar, tar.gz, 7z, rar, iso)
|
|
173
|
+
command: samai-openbox
|
|
174
|
+
install: pip install samai-openbox
|
|
175
|
+
verbs:
|
|
176
|
+
- name: compress
|
|
177
|
+
usage: samai-openbox compress <files...> -o <archive> [--level 0-9]
|
|
178
|
+
formats_out: [zip, tar, tar.gz, 7z]
|
|
179
|
+
- name: extract
|
|
180
|
+
usage: samai-openbox extract <archive> -d <dir>
|
|
181
|
+
formats_in: [zip, tar, tar.gz, 7z, rar, iso]
|
|
182
|
+
- name: list
|
|
183
|
+
usage: samai-openbox list <archive> [--json]
|
|
184
|
+
- name: test
|
|
185
|
+
usage: samai-openbox test <archive>
|
|
186
|
+
safety:
|
|
187
|
+
- Extraction blocks path-traversal entries (../../etc/passwd)
|
|
188
|
+
- No network calls · no telemetry · no auto-update
|
|
189
|
+
- Exits non-zero on any error — safe to chain with &&
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
## Use as a Python module
|
|
193
|
+
|
|
194
|
+
```python
|
|
195
|
+
from samai_openbox import compress, extract, list_archive, test_archive
|
|
196
|
+
|
|
197
|
+
# Compress
|
|
198
|
+
compress(["report.pdf", "photos/"], "backup.zip", level=6)
|
|
199
|
+
|
|
200
|
+
# Extract (path-traversal safe)
|
|
201
|
+
extract("backup.zip", "./restored")
|
|
202
|
+
|
|
203
|
+
# List (returns a list of dicts)
|
|
204
|
+
entries = list_archive("backup.zip")
|
|
205
|
+
for e in entries:
|
|
206
|
+
print(e["name"], e["size"], e.get("modified"))
|
|
207
|
+
|
|
208
|
+
# Verify integrity
|
|
209
|
+
ok = test_archive("backup.zip")
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
## Agent conversation example
|
|
213
|
+
|
|
214
|
+
> **User:** Pack the `reports/` folder into a `.zip` for email, but skip anything larger than 10 MB. Then list what's in the archive so I can sanity-check.
|
|
215
|
+
>
|
|
216
|
+
> **Agent (using samai-openbox):**
|
|
217
|
+
> ```bash
|
|
218
|
+
> # 1. Find files under 10 MB in reports/
|
|
219
|
+
> find reports/ -type f -size -10M -print0 | \
|
|
220
|
+
> xargs -0 samai-openbox compress -o reports-email.zip
|
|
221
|
+
>
|
|
222
|
+
> # 2. List the result as JSON for verification
|
|
223
|
+
> samai-openbox list reports-email.zip --json
|
|
224
|
+
> ```
|
|
225
|
+
> Done. `reports-email.zip` contains 23 files totalling 47.2 MB (after compression from 89.4 MB). Three files over 10 MB were excluded: `reports/q3-raw-data.csv`, `reports/audit-full.pdf`, and `reports/appendix-exhibits.pptx`. Want me to send them separately as a `.tar.gz`?
|
|
226
|
+
|
|
227
|
+
## License
|
|
228
|
+
|
|
229
|
+
MIT — same as the OpenBox desktop app. See [LICENSE](https://github.com/samaidev/openbox/blob/main/LICENSE).
|
|
230
|
+
|
|
231
|
+
## See also
|
|
232
|
+
|
|
233
|
+
- **OpenBox desktop app** — graphical archiver for Windows / macOS / Linux: <https://openbox.samai.cc>
|
|
234
|
+
- **Source code** — <https://github.com/samaidev/openbox>
|
|
235
|
+
- **SamAI Group public-welfare projects** — <https://samai.cc#public-welfare>
|
|
236
|
+
|
|
237
|
+
OpenBox is a SamAI Group public-welfare open-source project. Free, forever.
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
# samai-openbox
|
|
2
|
+
|
|
3
|
+
> CLI archive skill for AI agents — one stable command to compress and extract every common archive format.
|
|
4
|
+
|
|
5
|
+
[](https://pypi.org/project/samai-openbox/)
|
|
6
|
+
[](https://pypi.org/project/samai-openbox/)
|
|
7
|
+
[](https://github.com/samaidev/openbox/blob/main/LICENSE)
|
|
8
|
+
|
|
9
|
+
**samai-openbox** is a tiny, dependency-light Python package that exposes the
|
|
10
|
+
[OpenBox](https://openbox.samai.cc) archiver engine as a single CLI command —
|
|
11
|
+
`samai-openbox` — so any LLM agent with shell access can compress and extract
|
|
12
|
+
archives without remembering six different flag syntaxes.
|
|
13
|
+
|
|
14
|
+
## Why does this exist?
|
|
15
|
+
|
|
16
|
+
LLM agents are great at writing shell commands, but they consistently get
|
|
17
|
+
archive syntax wrong. One stable CLI fixes that:
|
|
18
|
+
|
|
19
|
+
- `tar -czvf` vs `tar -xzvf` vs `7z a` vs `7z x` vs `zip -r` vs `unzip` — agents hallucinate.
|
|
20
|
+
- Path-traversal protection varies by tool. OpenBox blocks `../../etc/passwd`-style entries at extraction time.
|
|
21
|
+
- JSON output mode lets agents parse archive contents in their reasoning loop.
|
|
22
|
+
|
|
23
|
+
## Install
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
# Standard
|
|
27
|
+
pip install samai-openbox
|
|
28
|
+
|
|
29
|
+
# Or with pipx (recommended for isolated CLI tools)
|
|
30
|
+
pipx install samai-openbox
|
|
31
|
+
|
|
32
|
+
# Verify
|
|
33
|
+
samai-openbox --version
|
|
34
|
+
samai-openbox --help
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Works on Python 3.8+. Pure-Python implementation using stdlib `zipfile` and
|
|
38
|
+
`tarfile`; shells out to the system `7z` / `7zz` / `7za` for 7z, and `unrar`
|
|
39
|
+
for rar (only if those formats are actually used).
|
|
40
|
+
|
|
41
|
+
## The CLI in 60 seconds
|
|
42
|
+
|
|
43
|
+
Five verbs cover everything an agent needs to do with archives.
|
|
44
|
+
|
|
45
|
+
### Compress files into an archive
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
# Auto-detects format from output extension: .zip .tar .tar.gz .7z
|
|
49
|
+
samai-openbox compress report.pdf photos/ -o backup.zip
|
|
50
|
+
|
|
51
|
+
# Force compression level (0-9, default 6)
|
|
52
|
+
samai-openbox compress src/ -o release.tar.gz --level 9
|
|
53
|
+
|
|
54
|
+
# 7z compression (requires 7z/7zz/7za on PATH)
|
|
55
|
+
samai-openbox compress bigfile.bin -o archive.7z
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Extract an archive
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
# Auto-creates destination if missing
|
|
62
|
+
samai-openbox extract backup.zip -d ./restored
|
|
63
|
+
|
|
64
|
+
# Works for every supported format
|
|
65
|
+
samai-openbox extract legacy.rar -d ./legacy
|
|
66
|
+
samai-openbox extract cd-image.iso -d ./cd-contents
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### List archive contents
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
# Human-readable
|
|
73
|
+
samai-openbox list backup.zip
|
|
74
|
+
|
|
75
|
+
# Machine-readable JSON — perfect for agent reasoning
|
|
76
|
+
samai-openbox list backup.zip --json
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Example JSON output:
|
|
80
|
+
|
|
81
|
+
```json
|
|
82
|
+
{
|
|
83
|
+
"archive": "backup.zip",
|
|
84
|
+
"format": "zip",
|
|
85
|
+
"entries": [
|
|
86
|
+
{"name": "report.pdf", "size": 2516582, "modified": "2024-08-15T10:23:00Z"},
|
|
87
|
+
{"name": "photos/", "size": 0, "modified": "2024-08-15T10:24:00Z", "is_dir": true},
|
|
88
|
+
{"name": "photos/01.jpg", "size": 4409111, "modified": "2024-08-14T18:11:00Z"}
|
|
89
|
+
]
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Test archive integrity
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
# Verifies CRCs without extracting — exits non-zero on corruption
|
|
97
|
+
samai-openbox test backup.zip
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Show version & supported formats
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
samai-openbox --version
|
|
104
|
+
samai-openbox formats
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Format support matrix
|
|
108
|
+
|
|
109
|
+
| Format | Compress | Extract | Notes |
|
|
110
|
+
|---------|:---------:|:--------:|-----------------------------------------|
|
|
111
|
+
| zip | ✓ | ✓ | stdlib `zipfile`, deflate or store |
|
|
112
|
+
| tar | ✓ | ✓ | stdlib `tarfile` |
|
|
113
|
+
| tar.gz | ✓ | ✓ | `tarfile` + gzip, 5 levels |
|
|
114
|
+
| 7z | ✓* | ✓* | requires `7z` / `7zz` / `7za` on PATH |
|
|
115
|
+
| rar | — | ✓* | requires `unrar` on PATH |
|
|
116
|
+
| iso | — | ✓* | requires `7z` (handles ISO 9660) |
|
|
117
|
+
|
|
118
|
+
`*` = via external CLI. Install with:
|
|
119
|
+
- 7-Zip: <https://www.7-zip.org/download.html> (Windows) · `brew install 7zip` (macOS) · `sudo apt install p7zip-full` (Linux)
|
|
120
|
+
- unrar: <https://www.rarlab.com/rar_add.htm> (Windows) · `brew install unrar` (macOS) · `sudo apt install unrar` (Linux)
|
|
121
|
+
|
|
122
|
+
## Path-traversal safety
|
|
123
|
+
|
|
124
|
+
`extract` blocks any archive entry whose absolute path would escape the
|
|
125
|
+
target directory. So an archive containing `../../etc/passwd` extracts the
|
|
126
|
+
file into `<target>/etc/passwd` instead of `/etc/passwd`. Safe to point at
|
|
127
|
+
untrusted downloads.
|
|
128
|
+
|
|
129
|
+
## ClawHub skill spec
|
|
130
|
+
|
|
131
|
+
Drop this into your agent's skill catalog so it knows when and how to call OpenBox:
|
|
132
|
+
|
|
133
|
+
```yaml
|
|
134
|
+
# skill.yaml
|
|
135
|
+
name: openbox-archive
|
|
136
|
+
version: 0.1.0
|
|
137
|
+
description: Compress and extract archives (zip, tar, tar.gz, 7z, rar, iso)
|
|
138
|
+
command: samai-openbox
|
|
139
|
+
install: pip install samai-openbox
|
|
140
|
+
verbs:
|
|
141
|
+
- name: compress
|
|
142
|
+
usage: samai-openbox compress <files...> -o <archive> [--level 0-9]
|
|
143
|
+
formats_out: [zip, tar, tar.gz, 7z]
|
|
144
|
+
- name: extract
|
|
145
|
+
usage: samai-openbox extract <archive> -d <dir>
|
|
146
|
+
formats_in: [zip, tar, tar.gz, 7z, rar, iso]
|
|
147
|
+
- name: list
|
|
148
|
+
usage: samai-openbox list <archive> [--json]
|
|
149
|
+
- name: test
|
|
150
|
+
usage: samai-openbox test <archive>
|
|
151
|
+
safety:
|
|
152
|
+
- Extraction blocks path-traversal entries (../../etc/passwd)
|
|
153
|
+
- No network calls · no telemetry · no auto-update
|
|
154
|
+
- Exits non-zero on any error — safe to chain with &&
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## Use as a Python module
|
|
158
|
+
|
|
159
|
+
```python
|
|
160
|
+
from samai_openbox import compress, extract, list_archive, test_archive
|
|
161
|
+
|
|
162
|
+
# Compress
|
|
163
|
+
compress(["report.pdf", "photos/"], "backup.zip", level=6)
|
|
164
|
+
|
|
165
|
+
# Extract (path-traversal safe)
|
|
166
|
+
extract("backup.zip", "./restored")
|
|
167
|
+
|
|
168
|
+
# List (returns a list of dicts)
|
|
169
|
+
entries = list_archive("backup.zip")
|
|
170
|
+
for e in entries:
|
|
171
|
+
print(e["name"], e["size"], e.get("modified"))
|
|
172
|
+
|
|
173
|
+
# Verify integrity
|
|
174
|
+
ok = test_archive("backup.zip")
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
## Agent conversation example
|
|
178
|
+
|
|
179
|
+
> **User:** Pack the `reports/` folder into a `.zip` for email, but skip anything larger than 10 MB. Then list what's in the archive so I can sanity-check.
|
|
180
|
+
>
|
|
181
|
+
> **Agent (using samai-openbox):**
|
|
182
|
+
> ```bash
|
|
183
|
+
> # 1. Find files under 10 MB in reports/
|
|
184
|
+
> find reports/ -type f -size -10M -print0 | \
|
|
185
|
+
> xargs -0 samai-openbox compress -o reports-email.zip
|
|
186
|
+
>
|
|
187
|
+
> # 2. List the result as JSON for verification
|
|
188
|
+
> samai-openbox list reports-email.zip --json
|
|
189
|
+
> ```
|
|
190
|
+
> Done. `reports-email.zip` contains 23 files totalling 47.2 MB (after compression from 89.4 MB). Three files over 10 MB were excluded: `reports/q3-raw-data.csv`, `reports/audit-full.pdf`, and `reports/appendix-exhibits.pptx`. Want me to send them separately as a `.tar.gz`?
|
|
191
|
+
|
|
192
|
+
## License
|
|
193
|
+
|
|
194
|
+
MIT — same as the OpenBox desktop app. See [LICENSE](https://github.com/samaidev/openbox/blob/main/LICENSE).
|
|
195
|
+
|
|
196
|
+
## See also
|
|
197
|
+
|
|
198
|
+
- **OpenBox desktop app** — graphical archiver for Windows / macOS / Linux: <https://openbox.samai.cc>
|
|
199
|
+
- **Source code** — <https://github.com/samaidev/openbox>
|
|
200
|
+
- **SamAI Group public-welfare projects** — <https://samai.cc#public-welfare>
|
|
201
|
+
|
|
202
|
+
OpenBox is a SamAI Group public-welfare open-source project. Free, forever.
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "samai-openbox"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "CLI archive skill for AI agents — compress and extract zip, tar, tar.gz, 7z, rar, iso from one stable command. Part of the OpenBox project."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = {text = "MIT"}
|
|
11
|
+
authors = [
|
|
12
|
+
{name = "SamAI Group", email = "dev@samai.cc"}
|
|
13
|
+
]
|
|
14
|
+
requires-python = ">=3.8"
|
|
15
|
+
keywords = [
|
|
16
|
+
"openbox",
|
|
17
|
+
"archiver",
|
|
18
|
+
"compression",
|
|
19
|
+
"extraction",
|
|
20
|
+
"ai-agent",
|
|
21
|
+
"cli",
|
|
22
|
+
"llm",
|
|
23
|
+
"agent",
|
|
24
|
+
"skill",
|
|
25
|
+
"zip",
|
|
26
|
+
"tar",
|
|
27
|
+
"tar.gz",
|
|
28
|
+
"7z",
|
|
29
|
+
"rar",
|
|
30
|
+
"iso",
|
|
31
|
+
"samai"
|
|
32
|
+
]
|
|
33
|
+
classifiers = [
|
|
34
|
+
"Development Status :: 4 - Beta",
|
|
35
|
+
"Environment :: Console",
|
|
36
|
+
"Intended Audience :: Developers",
|
|
37
|
+
"License :: OSI Approved :: MIT License",
|
|
38
|
+
"Operating System :: Microsoft :: Windows",
|
|
39
|
+
"Operating System :: MacOS",
|
|
40
|
+
"Operating System :: POSIX :: Linux",
|
|
41
|
+
"Programming Language :: Python :: 3",
|
|
42
|
+
"Programming Language :: Python :: 3.8",
|
|
43
|
+
"Programming Language :: Python :: 3.9",
|
|
44
|
+
"Programming Language :: Python :: 3.10",
|
|
45
|
+
"Programming Language :: Python :: 3.11",
|
|
46
|
+
"Programming Language :: Python :: 3.12",
|
|
47
|
+
"Programming Language :: Python :: 3.13",
|
|
48
|
+
"Topic :: System :: Archiving",
|
|
49
|
+
"Topic :: System :: Archiving :: Compression",
|
|
50
|
+
"Topic :: Utilities",
|
|
51
|
+
"Topic :: Software Development :: Libraries :: Python Modules"
|
|
52
|
+
]
|
|
53
|
+
|
|
54
|
+
[project.urls]
|
|
55
|
+
Homepage = "https://openbox.samai.cc"
|
|
56
|
+
Documentation = "https://openbox.samai.cc/ai-agent.html"
|
|
57
|
+
Source = "https://github.com/samaidev/openbox"
|
|
58
|
+
Issues = "https://github.com/samaidev/openbox/issues"
|
|
59
|
+
"OpenBox desktop app" = "https://openbox.samai.cc/download.html"
|
|
60
|
+
|
|
61
|
+
[project.scripts]
|
|
62
|
+
samai-openbox = "samai_openbox.cli:main"
|
|
63
|
+
|
|
64
|
+
[tool.setuptools.packages.find]
|
|
65
|
+
where = ["src"]
|
|
66
|
+
|
|
67
|
+
[tool.setuptools.package-data]
|
|
68
|
+
samai_openbox = ["py.typed"]
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"""samai-openbox — CLI archive skill for AI agents.
|
|
2
|
+
|
|
3
|
+
One stable command to compress and extract every common archive format.
|
|
4
|
+
Pure-Python implementation using stdlib zipfile/tarfile; shells out to the
|
|
5
|
+
system 7z/7zz/7za for 7z and ISO, and unrar for rar.
|
|
6
|
+
|
|
7
|
+
See https://openbox.samai.cc/ai-agent.html for the full agent guide.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
__version__ = "0.1.0"
|
|
11
|
+
__all__ = ["compress", "extract", "list_archive", "test_archive", "formats"]
|
|
12
|
+
|
|
13
|
+
from .core import (
|
|
14
|
+
compress,
|
|
15
|
+
extract,
|
|
16
|
+
list_archive,
|
|
17
|
+
test_archive,
|
|
18
|
+
formats,
|
|
19
|
+
OpenBoxError,
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
# CLI version string mirrors the desktop app versioning scheme.
|
|
23
|
+
CLI_VERSION = f"samai-openbox {__version__} (pure-python)"
|