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
-
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. -
Get the absolute path: Run
pwdto 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 thepwdoutput from the previous Bash call and construct the path manually as a string literal. -
Check if base64-encoded: Run:
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.
-
Decode if needed: If base64-encoded, decode it in-place using Node (never use
base64 -d— it is blocked by ACL):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
fileagain to confirm it's now a valid zip. -
Snapshot package.json: Before extracting, read and store the current contents of
package.json(if it exists) so you can compare it after extraction. -
Extract it: Use the absolute path for both arguments:
npx extract-zip "/root/app/code/Scope Engine V6.zip" /root/app/codeAlways use absolute paths —
npx extract-ziprequires the destination to be absolute. -
Check if package.json changed: After extraction, read
package.jsonagain and compare it to the snapshot from step 5. If the contents differ (or it didn't exist before), install dependencies:pnpm install --no-frozen-lockfileIf
pnpm installfails due to blocked builds, updatepnpm-workspace.yamlto setallowBuildsentries totrueand retry. -
Restart the dev server: If dependencies were installed, use the
DevServerRestarttool to restart the dev server. -
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
taris blocked by ACL in this environment — always usenpx extract-zipinstead.base64 -dis blocked by ACL — always use the Node one-liner to decode base64-encoded zips.npx extract-zipdoes not require a separate install step; npx handles it.- Command substitution (
$(...)) is blocked by ACL — never use it. Always getpwdin 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-ziprequires an absolute path for the destination directory, not a relative..