Package any Bash game for itch.io as an HTML5 ZIP that plays in the browser, and hand it to the user. Picks the right format automatically. A standalone ZIP of the game's own files for self-contained games, or a live wrapper that embeds the Bash game in an iframe for games that need Bash's server (multiplayer, shared saves, accounts, API routes). Works out the embed size, places the Made on Bas...
Download skill (.zip) Files on GitHubExport a Bash game to itch.io
Result: one ZIP that itch.io plays in the browser, plus a .itch-settings.txt with the exact numbers to
enter on itch.io. Don’t send the user a questionnaire. Work out the format, size and badge from the game, then tell them what you picked.
B=<skill>/scripts/build_itch_zip.py
python3 $B detect <project-folder> # → mode, game folder, build command, size hint (JSON)
1. Pick the format
detect says |
Use | Why |
|---|---|---|
standalone (no server, rooms, accounts or /api calls) |
Standalone: the game’s own files | Loads fast, works if Bash is down, no Bash page around it |
wrapper (server folder, /api/…, WebSocket, useBash(), shared values or rooms) |
Live wrapper: an iframe of the Bash game | Those features only exist on Bash. A copy of the files would load but not work |
The user’s words override it: “offline”, “self-contained”, or “without Bash” → standalone (strip or replace server features first, and say what stops working). “Live”, “always up to date”, or “same as on Bash” → wrapper. Mention the choice in one line, for example “It’s a single-player game, so I packaged the game files themselves. It doesn’t need Bash to run.”
2a. Standalone
- Build if
detectreports abuild_command(for examplenpm run build), then package its output folder (dist/). - Check the game folder. If the bash-web-game-checkup skill is installed, run it with
--platform itchand fix errors first. The builder itself blocks absolute paths (/game.js), names that differ only by capital letters, more than 1,000 files and over 500 MB. It skips junk (.git,node_modules,.map,.env*,.DS_Store). - Size: the game’s own play area. Use
size_hintwhen it matches what you see. Otherwise look at the game. Responsive games: 960×540 (16:9) or the shape that suits them (for example 540×960 portrait). Fixed canvas: its native size. - Build:
python3 $B standalone dist --output /tmp/itch/my-game-itchio.zip --width 960 --height 540 --title "My Game"Use the printed path. It gets an
_WxHsuffix when the size isn’t 960×540. - Bash.js in the game is harmless on itch.io (it simply finds no Bash). Remove it only if the user asks.
2b. Live wrapper
Get a link that works signed out. Try these in order:
- A share link the user gave in this conversation, or one saved for this space
(
~/.bash-private/share-links/<space-id>.json, outside any repo). - The app’s public Bash page:
window.bash.space.publicUrl(for examplehttps://bash.tv/name/game), read in the preview. - The raw preview URL from
open_preview. Only if it loads the game signed out (not “This preview isn’t available”). Then pass the Bash page as--space-urlfor the badge.
Open the candidate signed out (sandbox browser, or check_gpu_render for WebGL) and make sure the game loads,
not an access page. A 200 response alone doesn’t prove it. If nothing works, ask once:
“Please paste this game’s link from Bash’s Share button. I’ll remember it for this space.” Save it to the per-space file.
Keep links exactly as given, including ?sc=… and #…. Never use a /chat/… URL as the game,
and never copy a __bash_token (it expires). Share codes can grant access, so don’t publish a private game’s link without a yes.
Size and fit. --width/--height is the game area. The default badge bar adds 64 px outside it, so a
960×540 game needs a 960×604 itch embed. The builder works that out. Don’t add the 64 yourself.
--fit responsive(default): the game fills the frame. Make sure the Bash game itself resizes properly.--fit contain: fixed-resolution games. A nativeW×Hframe is scaled evenly, with letterboxing and no stretching.
Badge. Six positions: top|bottom × left|middle|right (--badge-position, plus --mobile-badge-position for ≤480 px).
The default --badge-layout bar keeps it off the game. Use overlay only if that corner is empty on the title screen, during play,
on the pause and results screens, and on phone sizes. If no corner stays empty, keep the bar.
python3 $B wrapper 'https://bash.tv/name/game?sc=CODE#FRAG' --output /tmp/itch/my-game-itchio.zip \
--width 960 --height 540 --fit responsive --badge-position bottom-right --title "My Game"
The ZIP holds index.html and two badge SVGs. It needs internet and the Bash game to be reachable, so say so.
3. Test before handing it over
- Unzip into a temp folder, serve it (
python3 -m http.server), and load it inside an iframe at the embed size, like itch.io does. Also try 640×360, a phone in portrait (390×844), and resizing.- 2D / DOM games: sandbox Playwright. WebGL / 3D:
check_gpu_render(never load WebGL in the sandbox browser).
- 2D / DOM games: sandbox Playwright. WebGL / 3D:
- Check that the title or start flow works, controls respond (mouse, touch and keys after a click), nothing is clipped, the badge doesn’t cover anything, and there are no console 404s.
- Run the unit tests after changing the builder:
python3 -m unittest discover -s <skill>/scripts -p 'test_*.py'.
Say plainly what wasn’t tested, for example “not tried on itch.io itself yet”.
4. Deliver
- Always: share the ZIP with
share_media(it shows as a download in the chat), and give the embed size from the settings file. - If an itch.io key is set in Bash (
curl -s "$BASHTV_EGRESS_URL/"listsapi.itch.io) and butler is installed:BUTLER_API_KEY=placeholder butler push <zip> user/game:html5. Ask first if the itch.io page is already public. Check withbutler status user/game:html5. - If the repo deploys through GitHub Actions (bash-github-actions-itch skill): for standalone, export the game folder into
www/instead of zipping. The Action makes and pushes the build. - A “Download ZIP” button inside the app is optional. Only add one if the user asks, and keep it creator-only with server-side checks (see bash-js-sdk). Never ship it inside the game ZIP.
5. What the user does on itch.io (the API can’t)
From .itch-settings.txt, once per game: Edit game → Kind of project: HTML → upload the ZIP → tick
This file will be played in the browser → Embed options: Embed in page, the Embed width/height from the
settings file (not the game area when there’s a badge bar), ✅ fullscreen button → Mobile friendly only after a phone test → Save → View page and play.
Later uploads with the same channel keep these settings.
Checklist
- Mode chosen from
detect(or the user’s words) and explained in one line - Standalone: built, checked, no blocking problems · Wrapper: a link that loads the game signed out
- Size from the real game. Badge not covering any UI
- Tested inside an iframe at the embed size and on a phone size
- ZIP shared and the embed size stated. Butler push only with OK for public games