Always package a Bash.tv game for itch.io as a live Bash iframe wrapper. When the space has an itch.io API key, push it straight to itch.io with butler; otherwise add a working direct-download button in the preview. Also use for any butler push from Bash to itch.io. Never ask the user to choose standalone versus wrapper; standalone exports are a separate explicitly requested workflow.
Download skill (.zip) Files on GitHubBash to itch.io package
Always build the live Bash wrapper
When this skill is used, build the HTML5 iframe wrapper with scripts/build_itchio_zip.py.
This applies to “package my game for itch.io”, “itch.io ZIP” and ordinary packaging requests.
Never ask “standalone or wrapper?” and never run tools/export_game.py as part of this skill.
Bash continues hosting the actual game and assets. Preserve the game’s existing title/start flow
in the link being embedded; don’t change its entry page just for packaging. Keep the handoff
short: say the itch.io ZIP is ready, point to the download button and mention that it loads the
live Bash game. Do not recite excluded template files or claim the wrapper works offline.
A user who explicitly requests an offline, standalone or independently hosted game is asking
for a different workflow: follow EXPORT_POLICY.md and the standalone exporter separately.
Do not offer that choice unprompted or turn an itch.io request into a format-selection question.
Delivery: push with butler when an itch.io key is attached
First check GET $BASHTV_EGRESS_URL/ for a secret whose hosts include api.itch.io. If there is
one, push the built ZIP straight to itch.io with butler (see Push to itch.io with butler
below) instead of building the preview download button. The creator still gets the ZIP path and
settings file in the sandbox, but no download panel is needed. If the push fails, or there’s no
itch.io key, fall back to the download button below.
Fallback delivery: direct download in the preview
When butler delivery isn’t available, every successful packaging request must create or update a creator-only “Download itch.io ZIP” button in the Bash preview. It downloads the wrapper ZIP built by this skill. The delivery panel must be hidden by default and revealed only after Bash bootstrap identifies the current viewer as the creator of that specific project. Spectators, anonymous visitors and non-creator collaborators must never see it. Do not finish with just a file path, chat link, chat-share action or third-party file host. Do not ask whether the creator wants the download button: it is part of packaging. Do not add it on ordinary game creation before packaging is requested.
- Build and test the latest ZIP. Use the actual output path printed by the builder,
including an automatically added
_WIDTHxHEIGHTsuffix when applicable. Store the game ZIP only outside the served tree and deliver through a creator-authenticated same-origin game-download endpoint. Aero Engine permits public game artifacts in/dist/and/downloads/, but private creator downloads must not have an unprotected static mirror. Game downloads must not use the owner-only engine export endpoint. Preserve the space’s existing visibility/access rules; fetch through the current preview context, not a newly invented public access route. - Put one touch-friendly button in a small bottom-right delivery panel, respecting safe-area
insets and keeping clear of gameplay touch controls. The panel must initially have the HTML
hiddenattribute and CSS[hidden]{display:none}. Inside the panel, show a concise notice such as “Only the creator can see this” above the download button so the verified creator understands the control is private. Reveal the panel only after trusted Bash bootstrap context confirms the viewer is this project’s creator. Determine creator identity dynamically from project/space owner metadata available to the app, build environment or trusted server context; never hardcode a username, user ID or template author’s identity into a reusable skill or game. If owner metadata is unavailable or cannot be verified, keep the panel hidden and report that owner verification is needed—never fall back to showing it to everyone. Treat client-side visibility as privacy UX, not strong authorization; when supported, protect the artifact endpoint server-side by comparing authenticated Bash user ID with project owner ID. Don’t replace the title screen or interrupt gameplay. Keep delivery controls out of the shipped game ZIP so it doesn’t depend on its own download server. If adding delivery markup/styles/scripts to game HTML, enclose the entire preview-only block between<!-- aero-delivery:start -->and<!-- aero-delivery:end -->; Aero Engine’s game exporter removes that block on subsequent builds. Do not place actual game controls inside those markers. - Fetch the ZIP from the same-origin relative artifact URL and save a Blob using an anchor
with
download. Check HTTP success and the ZIP signature first: a Bash access/error page must show an error, not be saved as a fake ZIP. Disable the button while preparing, restore it afterward, show a useful status and revoke object URLs after saving. Both the served URL and thelink.downloadfilename must match the freshly built filename, including any viewport suffix. Do not claim the browser saved the file merely becauseclick()returned. - Test the button in the preview/browser: observe the download event, check the filename,
downloaded ZIP bytes and archive contents. A bare proxy URL working with local
curldoes not prove users can download it from outside Bash. Refresh the preview when ready and say “Click Download itch.io ZIP in the preview.” A chat-share button may be an additional fallback (especially on mobile), never a replacement for direct download. - Repackaging must replace the artifact and update the control, not create duplicate buttons or serve an older cached ZIP. Never upload to an external file host without explicit permission.
At packaging time, resolve the owner from trusted project metadata or the already verified canonical Bash share page. Store immutable project-owner ID and space ID in private per-space server configuration, never a fixed identity in this reusable skill or copied game. Missing metadata must fail closed. Do not infer ownership from the person requesting a package or from the template author’s identity in a copied space.
Use the Bash.js SDK instead of implementing a raw bootstrap listener. Await bash.ready, call
bash.getUser(), then send its signed token to an access-check endpoint. Following bash-js-sdk,
the server verifies that token with Bash using a configured audience, matches the signed space
and configured project-owner ID, and only then returns permission to reveal the hidden panel.
Reverify a fresh token on every download. No username fallback, query/local-storage override,
client-supplied owner, or public mirror of a private archive. Without Bash context keep the game
usable and the delivery panel hidden. Test creator, spectator, anonymous, wrong-space and
failed-verification cases; simulated identity tests do not prove a real signed-in preview works.
Example visibility setup (server endpoint must perform all checks above):
const delivery = document.getElementById('itch-delivery'); // markup includes hidden
try {
if (window.bash) {
await window.bash.ready;
const viewer = await window.bash.getUser();
if (viewer?.token) {
const response = await fetch('./api/delivery-access', {
method: 'POST', cache: 'no-store',
headers: {'content-type': 'application/json'},
body: JSON.stringify({token: viewer.token})
});
if (response.ok) delivery.hidden = !(await response.json()).creator;
}
}
} catch { delivery.hidden = true; }
Example click handler (adapt IDs, filename and relative route to the actual preview page):
const button = document.getElementById('itch-download');
const status = document.getElementById('itch-status');
button.onclick = async () => {
button.disabled = true;
status.textContent = 'Preparing ZIP...';
try {
const viewer = await window.bash?.getUser();
if (!viewer?.token) throw new Error('Open this preview in Bash and sign in.');
// Verify the token, configured project-owner ID and signed space on the server.
const response = await fetch('./api/game-export', {
method: 'POST', cache: 'no-store',
headers: {'content-type': 'application/json'},
body: JSON.stringify({token: viewer.token})
});
if (!response.ok) throw new Error('Could not load the game ZIP. Try again.');
const bytes = new Uint8Array(await response.arrayBuffer());
if (bytes.length < 4 || bytes[0] !== 0x50 || bytes[1] !== 0x4b ||
bytes[2] !== 0x03 || bytes[3] !== 0x04) {
throw new Error('The preview returned an access/error page instead of the ZIP.');
}
const url = URL.createObjectURL(new Blob([bytes], {type: 'application/zip'}));
const link = document.createElement('a');
link.href = url;
link.download = 'my-game-itchio_960x604.zip';
document.body.append(link);
link.click();
link.remove();
setTimeout(() => URL.revokeObjectURL(url), 60000);
status.textContent = 'Download requested. Check your browser downloads.';
} catch (error) {
status.textContent = error.message;
} finally {
button.disabled = false;
}
};
Wrapper contents
This skill builds an HTML5 iframe wrapper, not an offline export or an itch.io publication. Anyone may create one. Include only the wrapper HTML and badge assets; the game, assets and backend continue running on Bash.
Copied spaces: one-time share-link setup
These instructions travel with the template; a particular space’s share link must not. On a new copy, use the current space ID, not the template creator’s ID or URL. Before asking for a link, check the conversation, current platform context and a previously saved verified link for this exact space. If Bash exposes a full share URL through a future tool/context field, use it and verify the destination. Do not invent an API or assume it exists.
Once a user supplies a working full Share-button link, verify it leads to the current space
and remember it in a local per-space record outside the served/exported project:
$HOME/.aero-engine-private/share-links/<space-id>.json with spaceId and shareUrl.
Preserve the URL exactly, including its query and fragment. Do not put this record into the
reusable skill, template ZIP, public source, logs or a copied game’s defaults. Treat the
record as a candidate link, not permission to publish a restricted game. Confirm it still
loads the same game before packaging; a newer supplied link supersedes the saved one.
If no usable link exists and the raw preview is gated, ask once, briefly: “Please paste this game’s link from Bash’s Share button. I’ll remember it for this space.” Do not repeat the long hosting/standalone explanation in the question. Ask again only if the saved link is revoked, fails validation or belongs to a different space. This setup is for itch packaging, not a reason to delay building a game or prompt every new copy immediately.
Pick the working game link
There are two different addresses. open_preview returns the raw .proxy.onbash.tv origin;
Bash’s Share button produces an external bash.tv/name/game?sc=CODE#FRAGMENT link. Every Bash
may have a share link, but the preview tool exposes only the raw origin. Bash.js in the
preview supplies the space ID/title, not the parent page’s URL or its share code/fragment. The
Python ZIP builder cannot call open_preview or invent the missing share-link parts. Do not
claim automatic discovery of the external link when only the raw origin was found.
- Find the playable preview yourself. For the game in this space, find its running HTTP
server and route (
/play.htmlif/is only a title). Start it if needed, callopen_previewto learn the exact origin and inspect the game. Do not ask the user for this raw URL. - Check the latest full share link in the conversation or saved current-space record. Open it signed
out and check that it loads the same game. Use it exactly in both the iframe and,
normally, the Made on Bash badge. Preserve path case,
sc, all query parameters and the fragment; do not replace it with a canonical URL that loses access. A supplied link to another space is not a substitute for this game’s link. - Without a supplied share link, test the raw preview signed out. If it actually loads the
playable game (not Bash’s “This preview isn’t available”), it can be the iframe URL. For the
badge, verify
https://bash.tv/chat/<current-space-id>resolves to the matching space and canonical page; pass that Bash page as--space-url. If the raw preview is gated, check any already available verified Bash game/share URL in current context. If none is available, ask for the link from the Share button. You cannot derivescor#FRAGMENTfrom the space ID,open_previewresult, canonical page or Bash.js SDK. Do not pretend a guessed URL works. - Verify actual playability. A
200Bash HTML shell alone is not proof that its inner game loaded. Never copy an embedded__bash_tokeninto the ZIP: it expires. Never put/chat/...in the game iframe. A Bash share page may show platform UI; explain that trade-off rather than packaging a gated raw preview. If visibility is unknown, don’t claim it is public. Share codes can grant access, so don’t post a new public download link for a restricted game without permission.
Check sizing before packaging (required)
Do not assume every game is 16:9 or that itch.io configures its dimensions from the ZIP. Inspect the actual linked game, including title/start screen, canvas, HUD and controls. Choose suitable game-area width and height, and the appropriate fit mode automatically. Do not ask the user to configure a viewport when the layout can be determined from the game.
The game-area size and itch.io embed size are different when using a badge bar.
scripts/build_itchio_zip.py --width W --height H specifies the desired playable game
area, not necessarily the final itch.io frame. The builder computes the correct recommended
desktop itch.io Embed in page viewport:
- Badge in a separate bar (safe default): itch embed =
W × (H + 64)in pixels. This provides a 64 px desktop bar outside the game and keeps the game at the intended size. For example, a 960×540 game requires a 960×604 itch embed, and a 640×480 game requires a 640×544 itch embed. Do not add those 64 pixels yourself to--height. - Verified safe badge overlay: itch embed =
W × H. Only use an overlay if it does not obstruct controls or HUD in all the inspected views. - The badge bar shrinks to 50 px on narrow mobile viewports and includes safe-area inset protection. itch.io launches mobile HTML5 games in fullscreen, so no static desktop height is guaranteed there. The wrapper must continue working when resized.
Pick the actual game layout and fit mode:
- Responsive game: use
--fit responsive(default). The wrapper fills the available game area exactly, without minimum viewport dimensions. The inner game must resize its renderer, camera, canvas, UI and input with its viewport. Fix broken responsiveness in the game itself, preserving Aero Engine’s renderer sizing guard; don’t just hide overflow. 960×540 is only a starting game-area size for a 16:9 landscape game. Use an actual 4:3, portrait or other game-area size when appropriate. - Truly fixed-resolution game: use
--fit contain --width W --height Hwith its native game layout dimensions. The wrapper allocates a nativeW × Hiframe and uniformly scales it to fit the game stage. No nonuniform stretching, even in fullscreen. Letterboxing may occur. Do not choose contain just to hide a broken responsive UI. Verify mouse and touch hit testing and HUD legibility after scaling. - Keep the recommended desktop iframe size sensible for itch.io’s page width (960px wide is a useful default); if a larger layout is essential, check whether the itch page can show it without clipping. Fullscreen-only itch mode requires no fixed embed size.
- A full Bash share page may include platform UI. Inspect the actual inner game area, not only the outer iframe rectangle. Do not crop/zoom away cross-origin UI, invent embed params or replace a verified share link with a gated raw preview. Explain unresolved platform-page limitations instead of claiming a wrapper fixes them.
Viewport-aware ZIP naming is automatic:
- When a specific iframe viewport is important (fixed-size contain, non-default game size,
or a bar requiring extra embed height), the script outputs
<game-name>_<ITCH_EMBED_WIDTH>x<ITCH_EMBED_HEIGHT>.zip. The numbers are what the developer enters in itch.io’s Viewport dimensions, not necessarily the game’s internal dimensions. Example:my-game-itchio_640x544.zipfor a 640×480 game plus the separate badge bar. - A standard 960×540 responsive overlay may keep the plain output name, e.g.
my-game-itchio.zip, because it doesn’t need a special frame. For the default safe badge bar, even 960×540 game content producesmy-game-itchio_960x604.zip. - If the requested filename already ends in
_WIDTHxHEIGHT, the builder updates rather than doubles that suffix when re-exporting. The script prints the real final ZIP path; use that path for the served artifact andlink.download, never assume--outputis final. - The matching
<zip-stem>.itch-settings.txtsits beside the ZIP, not inside. It records the precise desktop itch embed width/height, target playable game-area size, badge space, fit mode and fullscreen/mobile guidance. Read it and include the size in the handoff. itch.io never reads settings or filenames to apply its viewport automatically; creators enter the values in the itch.io Embed options (Embed in page). Mark Mobile friendly only after testing.
Test it: extract the wrapper and test it inside another iframe, like itch.io, at the recommended size as well as small landscape (e.g. 640×360 and 320×180), portrait (390×844), landscape mobile (844×390), live resize and fullscreen. Check clipping, scrolling, distortion, reachable controls, title/start navigation, mouse/touch input and badge placement. A simulated layout check does not prove remote game access or actual itch.io compatibility. Verify the uploaded itch.io page when available and explicitly state if it was not tested there.
Place the Made on Bash badge without covering UI (required)
The badge may use exactly six positions: top-left, top-middle, top-right, bottom-left,
bottom-middle, or bottom-right. Inspect the actual game at the tested embed sizes before
choosing --badge-position; use --mobile-badge-position for a different placement at wrapper
widths of 480px or less. Choose this yourself from the layout, not another user questionnaire.
Never cover HUD text, menus, dialogue, pause/fullscreen buttons, touch sticks or action buttons. Check title, gameplay, pause, results/dialogue screens and portrait/landscape/fullscreen layouts. The wrapper cannot inspect a cross-origin game’s UI automatically; don’t claim collision detection.
- The builder defaults to
--badge-layout bar: a separate top or bottom strip, selected by the position. This keeps the badge outside the game iframe and guarantees it doesn’t cover game UI. The strip is part of the overall embed dimensions, so retest the remaining game viewport and adjust recommended embed dimensions if needed. The game must still be fully playable. --badge-layout overlayis allowed only when that position is visibly empty in all checked states/sizes. If no single position stays free, keep the reserved strip instead of covering UI, hiding the badge, shrinking it to illegibility or guessing. Separate mobile placement can help, but it is not proof that an overlay is safe in every game state.- Check that the whole badge is visible, its link works and focus remains visible; middle alignment must stay centered when hovered. The settings file records desktop/mobile positions and layout.
Build and check
From this skill directory (or using the absolute script path):
python3 scripts/build_itchio_zip.py 'https://bash.tv/name/game?sc=CODE#FRAGMENT' --width 960 --height 540 --fit responsive --badge-position bottom-right --badge-layout bar --output /path/to/artifacts/game-itchio.zip
# Prints: /path/to/artifacts/game-itchio_960x604.zip
# Also writes: /path/to/artifacts/game-itchio_960x604.itch-settings.txt
python3 -m unittest discover -s scripts -p 'test_*.py'
For a verified ungated raw preview instead, pass a verified matching Bash page as
--space-url explicitly. The ZIP must have index.html, badge-dark.svg, and
badge-light.svg at the root. Inspect its iframe src and badge href to confirm they
match the intended links including any share-code fragment. The wrapper loads
<script src="https://bash.tv/bash/v1.js"></script> but does not require Bash context to
display the iframe.
Deliver this wrapper with the required in-preview direct-download button above. Make
sure the download button and served file share the builder’s final viewport-aware name, not
the original --output argument. Never paste a bare .proxy.onbash.tv/downloads/... link as the sole download
method: the proxy may return an unavailable page outside the embedded preview. Do not use
file:// links. Bash.js share() is an optional additional fallback: it prepares a draft after
the viewer clicks and does not post the file automatically.
The wrapper can still fail if iframe permissions, third-party cookies or hosting policy block it. Do not claim itch compatibility until it is tested there. To publish: create a project at https://itch.io/game/new, choose HTML, upload the ZIP, mark it playable in browser, apply the Embed width and Embed height from the generated settings file (not the game-area width/height), enable fullscreen, save and test before publishing. The ZIP alone neither publishes the game nor configures itch.io sizing.
Push to itch.io with butler
butler is itch.io’s command-line uploader. In Bash it signs in through the space’s attached itch.io key; the bot never sees the real key.
Key setup (done by the space owner, never in chat): itch.io → Settings → API keys →
Generate new API key. In Bash: space Settings → API keys → Any API, address api.itch.io,
Bearer token. Read the key’s owner note for the target user/game and push rules.
1. Install butler (once per sandbox):
mkdir -p ~/bin && curl -sL -o /tmp/butler.zip \
https://broth.itch.zone/butler/linux-amd64/LATEST/archive/default
python3 -c "import zipfile;zipfile.ZipFile('/tmp/butler.zip').extractall('$HOME/bin')"
chmod +x ~/bin/butler* && ~/bin/butler -V
2. Check the key and find the game. Bash doesn’t set BUTLER_API_KEY, so pass any
placeholder; the egress replaces the Authorization header for api.itch.io.
curl -s https://api.itch.io/profile # "authentication required" = key missing
curl -s https://api.itch.io/profile/games # title, url, published, type for each game
The target is <username>/<game-slug> from the page URL (https://yourname.itch.io/my-game →
yourname/my-game). If the user hasn’t named a game, ask which one; never guess between games.
If published is true, ask before pushing: the new build goes live immediately. The key
covers the whole itch.io account, so only push to the game the user named.
3. Push. Use the html5 channel for browser games. butler accepts a folder or a .zip
(the wrapper ZIP from this skill, or a standalone web build with index.html at its root).
BUTLER_API_KEY=placeholder ~/bin/butler push <zip-or-folder> <user>/<game>:html5 --userversion <version>
BUTLER_API_KEY=placeholder ~/bin/butler status <user>/<game>:html5 # wait for ✓ on BUILD
Run long pushes with tmux. Treat a push as finished only when butler status shows the build
with ✓.
4. One-time page settings (the itch.io API can’t change these). On the first push to a game, tell the creator to open Edit game and:
- Kind of project → HTML. The “played in the browser” checkbox only appears after this.
- Uploads → on the
html5file, check This file will be played in the browser. - Embed options → enter the Embed width/height from the
.itch-settings.txtfile and enable the fullscreen button. - Save.
Later pushes to the same channel update the page automatically; no more clicks are needed.
5. Verify on itch.io. Fetch the public page and find the html-classic.itch.zone/html/...
index.html URL in it. A Run game / load_iframe_btn means the browser player is set up.
Fetch that URL and check it serves the new build. Only Download buttons means the page
settings above haven’t been saved yet. A draft page returns 404 to the public.
Handoff: say the build is live (or ready on the draft), give the itch.io page URL, and list any one-time page settings still needed with the exact embed size.
Keep the vector badge assets as SVG. Do not hardcode any particular space, share code, hostname or example URL in the reusable script.