#!/usr/bin/env bun // storebound: ship a mobile game to Google Play and the App Store from the terminal. // Run `storebound help` for the command list. Config: storebound.config.ts; credentials: env or .storebound/. import { parseArgs } from './lib/args'; import { loadConfig } from './lib/config'; import type { Ctx } from './lib/ctx'; type Mod = { run(ctx: Ctx): Promise }; type Plain = { run(args: ReturnType): Promise }; /** Commands that work without a storebound.config.ts. */ const PLAIN: Record Promise, string]> = { 'init': [() => import('./init'), 'copy the templates (config, listing, copy, privacy policy) into this project'], 'install': [() => import('./install'), 'skills + MCP server for --agent claude|codex|cursor|copilot|windsurf|gemini|opencode'], 'mcp': [async () => ({ run: async () => (await import('./mcp')).serve() }), 'stdio MCP server wrapping these commands (for any MCP-capable AI tool)'], 'privacy-manifest': [() => import('./privacy-manifest'), 'iOS PrivacyInfo.xcprivacy + required-reason API + SDK manifest scan (--ios )'], }; const COMMANDS: Record Promise, string]> = { 'check': [() => import('./check'), 'validate config, copy files, data safety answers and products (offline); --aso keyword audit'], 'validate': [() => import('./validate'), 'read-only store readiness report with ordered blockers (--apple / --play); exit 1 on blockers'], 'whats-new': [() => import('./whats-new'), 'draft player-facing release notes from git log into the listing files (--since )'], 'play products': [() => import('./play/products'), 'one-time products: create / update, regional prices, activate'], 'play listing': [() => import('./play/listing'), 'app details + title / short / full description per language'], 'play images': [() => import('./play/images'), 'icon, feature graphic, phone / 7" / 10" screenshots per language'], 'play data-safety': [() => import('./play/data-safety'), 'Data safety form (CSV import through the API)'], 'play release': [() => import('./play/release'), 'upload an AAB and put it on tracks with release notes'], 'play status': [() => import('./play/status'), 'tracks, listings, products (read-only)'], 'play rollout': [() => import('./play/rollout'), 'staged rollout: --fraction x | --halt | --resume | --complete (asks first)'], 'play next-version-code': [() => import('./play/next-version-code'), 'next free versionCode (prints the number)'], 'apple bundle': [() => import('./apple/bundle'), 'register the bundle id; finds the app record'], 'apple iap': [() => import('./apple/iap'), 'in-app purchases, localizations, price schedules, availability'], 'apple iap-review': [() => import('./apple/iap-review'), 'IAP review screenshots + product states'], 'apple listing': [() => import('./apple/listing'), 'version, build, name / subtitle / description / keywords per locale'], 'apple screenshots': [() => import('./apple/screenshots'), '6.9" + 6.5" screenshots per locale'], 'apple appinfo': [() => import('./apple/appinfo'), 'categories, age rating, content rights, Free price, territories'], 'apple review-details': [() => import('./apple/review-details'), 'App Review contact + notes'], 'apple status': [() => import('./apple/status'), 'versions, builds, IAPs, review submissions (--wait-review, --cancel-submission )'], 'apple release': [() => import('./apple/release'), 'phased release on|pause|resume|complete, --manual-release (asks first)'], 'apple next-build': [() => import('./apple/next-build'), 'next safe build number (prints the number)'], 'apple encryption': [() => import('./apple/encryption'), 'export compliance answer for builds, from the config'], 'icons': [() => import('./icons'), 'App Store / Play / web / adaptive / legacy launcher icons from one artwork'], 'shots capture': [() => import('./shots/capture'), 'raw frames from a running build of your game (playwright)'], 'shots fonts': [() => import('./shots/fonts'), 'download font subsets for the copy (CJK / Arabic / Cyrillic ...)'], 'shots render': [() => import('./shots/render'), 'store screenshots + feature graphic in every size and language'], 'shots jpeg': [() => import('./shots/jpeg'), 'JPEG q92 copies of the Play renders (4x faster uploads)'], }; function help(): void { console.log(`storebound ยท ship mobile games to Google Play and the App Store usage: storebound [options] ${Object.entries(PLAIN).map(([k, [, d]]) => ` ${k.padEnd(25)} ${d}`).join('\n')} ${Object.entries(COMMANDS).map(([k, [, d]]) => ` ${k.padEnd(25)} ${d}`).join('\n')} common options: --config --dry (no writes) --only --yes (skip confirmations) credentials: PLAY_SERVICE_ACCOUNT, ASC_KEY_ID, ASC_ISSUER_ID, ASC_P8 (env or .storebound/credentials.json) docs: README.md and the skills/ folder of the toolchain`); } async function main(): Promise { const argv = process.argv.slice(2); const [a, b] = argv; if (!a || a === 'help' || a === '--help' || a === '-h') return help(); if (a === 'version' || a === '--version') return console.log((await import('../package.json')).version); if (PLAIN[a]) return (await PLAIN[a]![0]()).run(parseArgs(argv.slice(1))); const key = COMMANDS[`${a} ${b}`] ? `${a} ${b}` : COMMANDS[a] ? a : ''; if (!key) { console.error(`unknown command: ${argv.slice(0, 2).join(' ')}\n`); help(); process.exit(2); } const args = parseArgs(argv.slice(key.split(' ').length)); const loaded = await loadConfig(args.get('config')); await (await COMMANDS[key]![0]()).run({ loaded, args }); } main().catch(e => { console.error(`\nerror: ${(e as Error).message}`); process.exit(1); });