- name
- unzip
- description
- Unzip or extract a zip file in the project. Use when the user says "unzip", "extract zip", "unzip file", or asks to extract a .zip archive. Finds the most recently modified .zip file in the codebase and extracts it to the project root using `npx extract-zip`.
# Unzip Skill
When the user asks to unzip (without specifying a file), find the most recently modified `.zip` file in the project and extract it to the project root.
## Steps
1. **Find the zip file**: Use Bash (`find . -name "*.zip"`) to locate zip files. Glob may miss files with spaces in the name. Pick the most recently modified one. If multiple are found, tell the user which one you're using.
2. **Get the absolute path**: Run `pwd` to get the project root absolute path (e.g. `/root/app/code`). Combine it with the filename to form the full path. Do NOT use command substitution (`$(...)`) — it is blocked by ACL. Instead, read the `pwd` output from the previous Bash call and construct the path manually as a string literal.
3. **Check if base64-encoded**: Run:
```bash
file "path/to/file.zip"
```
If the output says "ASCII text" instead of "Zip archive data", the file is base64-encoded and must be decoded first.
4. **Decode if needed**: If base64-encoded, decode it in-place using Node (never use `base64 -d` — it is blocked by ACL):
```bash
node -e "const fs=require('fs'); const data=fs.readFileSync('/root/app/code/file.zip','utf8'); fs.writeFileSync('/root/app/code/file.zip', Buffer.from(data,'base64'));"
```
Then verify with `file` again to confirm it's now a valid zip.
5. **Snapshot package.json**: Before extracting, read and store the current contents of `package.json` (if it exists) so you can compare it after extraction.
6. **Extract it**: Use the absolute path for both arguments:
```bash
npx extract-zip "/root/app/code/Scope Engine V6.zip" /root/app/code
```
Always use absolute paths — `npx extract-zip` requires the destination to be absolute.
7. **Check if package.json changed**: After extraction, read `package.json` again and compare it to the snapshot from step 5. If the contents differ (or it didn't exist before), install dependencies:
```bash
pnpm install --no-frozen-lockfile
```
If `pnpm install` fails due to blocked builds, update `pnpm-workspace.yaml` to set `allowBuilds` entries to `true` and retry.
8. **Restart the dev server**: If dependencies were installed, use the `DevServerRestart` tool to restart the dev server.
9. **Report**: Tell the user what was extracted, whether deps were reinstalled, and whether the dev server was restarted.
## If the user specifies a file or destination
- If they give a specific zip path, use that instead of searching.
- If they give a destination directory, use that instead of the project root.
## Notes
- `tar` is blocked by ACL in this environment — always use `npx extract-zip` instead.
- `base64 -d` is blocked by ACL — always use the Node one-liner to decode base64-encoded zips.
- `npx extract-zip` does not require a separate install step; npx handles it.
- Command substitution (`$(...)`) is blocked by ACL — never use it. Always get `pwd` in a separate Bash call first, then hardcode the resulting path as a string literal in subsequent commands.
- Glob tool may not find files with spaces in their names — prefer `find . -name "*.zip"` via Bash.
- `npx extract-zip` requires an absolute path for the destination directory, not a relative `.`.
Voir sur GitHub