storebound/cli/inspect.ts
CRT 9320d64f46 Desktop: adapt to 0.5.0 (app.platforms, subscriptions, catalog diff), Dependencies polish, ~ for the home folder
- inspect reports platforms, subscription ids and the catalog each store should sell; app identity
  and parity follow app.platforms and per-item platforms; catalog.diff joins the JSON methods
- Portfolio: one Platforms column, compact catalog, paths truncated and shown with ~; the confirm
  dialog and run logs show ~ instead of the home folder
2026-10-10 18:15:48 +00:00

39 lines
1.9 KiB
TypeScript

// Offline summary of the project config: app name, store ids, languages, products, shots. No network, no credentials.
// storebound inspect [--json]
import { platformsOf, sellsOn } from './lib/config';
import type { Ctx } from './lib/ctx';
import type { ProjectSummary } from './lib/desktop-protocol';
import { log, printJson } from './lib/log';
export function summarize(ctx: Ctx): ProjectSummary {
const { config, root, path } = ctx.loaded;
const subs = (config.subscriptions ?? []).flatMap(g => g.subscriptions);
return {
dir: root,
config: path,
name: config.app.name,
languages: config.languages.map(l => l.id),
play: config.play ? { packageName: config.play.packageName } : null,
apple: config.apple ? { bundleId: config.apple.bundleId, appId: config.apple.appId ?? null } : null,
platforms: platformsOf(config),
products: config.products?.length ?? 0,
productIds: (config.products ?? []).map(p => p.id),
subscriptions: subs.length,
subscriptionIds: subs.map(s => s.id),
// the catalog each store should sell (items can be limited to one platform)
catalog: {
ios: config.apple ? [...(config.products ?? []), ...subs].filter(x => sellsOn(config, x, 'apple')).map(x => x.id) : [],
android: config.play ? [...(config.products ?? []), ...subs].filter(x => sellsOn(config, x, 'play')).map(x => x.id) : [],
},
shots: !!config.shots,
testflightGroups: config.apple?.testflight?.groups?.length ?? 0,
};
}
export async function run(ctx: Ctx): Promise<void> {
const s = summarize(ctx);
if (ctx.args.has('json')) { printJson(s); return; }
log('inspect', `${s.name} · ${s.platforms.join(' + ')} · ${s.languages.length} languages · ${s.products} products · ${s.subscriptions} subscriptions`);
log('inspect', `play ${s.play?.packageName ?? '-'} · apple ${s.apple?.bundleId ?? '-'}${s.apple?.appId ? ` (${s.apple.appId})` : ''}`);
log('inspect', `config ${s.config}`);
}