crt-ship 0.1.0: CLI, Claude Code skills and templates for shipping mobile games to Google Play and the App Store

This commit is contained in:
CRTkafa 2026-10-10 12:29:20 +00:00
commit ecb3dc3dc3
64 changed files with 4509 additions and 0 deletions

31
cli/lib/ctx.ts Normal file
View file

@ -0,0 +1,31 @@
import type { Args } from './args';
import type { Language, Loaded } from './config';
import { playCodes } from './config';
export interface Ctx { loaded: Loaded; args: Args }
export function need<T>(v: T | undefined, what: string): T {
if (v === undefined || v === null) throw new Error(`crt-ship.config.ts: ${what} is not set`);
return v;
}
/** Play language code -> language entry. */
export function byPlayCode(langs: Language[]): Map<string, Language> {
const m = new Map<string, Language>();
for (const l of langs) for (const c of playCodes(l)) m.set(c, l);
return m;
}
/** App Store locale -> language entry. */
export function byAppleLocale(langs: Language[]): Map<string, Language> {
return new Map(langs.filter(l => l.apple).map(l => [l.apple!, l] as const));
}
/** Asks on the terminal unless --yes. Store actions that are public or irreversible go through this. */
export async function confirm(ctx: Ctx, question: string): Promise<boolean> {
if (ctx.args.has('yes')) return true;
if (!process.stdin.isTTY) { console.log(`${question}\n not a terminal: re-run with --yes to confirm`); return false; }
process.stdout.write(`${question} [y/N] `);
for await (const line of console) return /^y(es)?$/i.test(line.trim());
return false;
}