From 9320d64f46a89e14eb730be2ad4f10e2daf640d6 Mon Sep 17 00:00:00 2001 From: CRT Date: Sat, 10 Oct 2026 18:15:48 +0000 Subject: [PATCH] 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 --- CHANGELOG.md | 9 ++++++++- README.md | 3 ++- apps/desktop/src/screens/AppFolders.tsx | 2 +- apps/desktop/src/screens/Portfolio.tsx | 14 ++++++++++---- apps/desktop/src/styles.css | 6 +++++- cli/catalog.ts | 4 ++-- cli/inspect.ts | 14 +++++++++++--- cli/lib/desktop-protocol.ts | 9 +++++++-- cli/lib/portfolio.ts | 11 ++++++----- cli/serve.ts | 2 +- tests/portfolio.test.ts | 8 ++++++-- tests/serve.test.ts | 2 +- 12 files changed, 60 insertions(+), 24 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 528072f8..73ddfd8e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,12 +4,19 @@ - **Desktop machine interface** (`serve --stdio`): JSON-RPC session for the coming desktop app, built on the MCP core. Typed methods with argument schemas, structured results, progress notifications, cancellation, `project.inspect` - and `portfolio.status` (many projects; `live` adds App Store and Play status). Writes are dry runs unless the host + and `portfolio.status`: apps across iOS and Android with identity, config check, release trains (current and next + version on both stores) and catalog parity (`live` reads App Store and Play status). `system.tools` reports ffmpeg, + Chrome, Xcode tools, simctl, adb and git with versions; `STOREBOUND_TOOL_PATH` / `STOREBOUND_CHROME` point the CLI + at app-managed copies. Writes are dry runs unless the host sends a single-use confirm token bound to the method, arguments and a short expiry (HMAC with a per-session secret handed over on stdin). No submit / release / publish method exists. Under `serve`, terminal confirmations always answer no. - `--json` on `check` (and `check --aso`), `apple testflight status`, `apple ppo status`, `apple next-build`, `play next-version-code`, `analytics compare` and `prices import` (read-only diff); new `inspect` command. +- **Desktop app shell** (`apps/desktop`, not released yet): Tauri 2 + React 19, app-centric (Portfolio, App with + Releases / Catalog / Listings / Health / Reviews / TestFlight, App folders, Accounts, Dependencies, Settings), store + keys in the OS keychain, native confirm dialogs with the dry run before any write. See `docs/desktop.md`. +- `--json` on `catalog diff` goes through the same machine-readable result line. - `tools/build-sidecars.ts`: single-file executables for macOS (arm64, x64), Linux (x64, arm64) and Windows (x64), re-signed ad hoc on macOS and checked for build-machine paths. The MCP server now also runs from such a binary. diff --git a/README.md b/README.md index 6022cea3..cf6c3156 100644 --- a/README.md +++ b/README.md @@ -388,7 +388,8 @@ The first request is `session.hello` with a per-session secret only the host kno the call carries a single-use confirm token (HMAC over method, arguments and expiry) that the host mints after the owner confirmed a native dialog showing that dry run. There is no method that submits, releases or publishes; Play testing releases and phased release changes stay out of the desktop profile too. Types: `cli/lib/desktop-protocol.ts`. -`bun tools/build-sidecars.ts` compiles the CLI for macOS, Linux and Windows (`bun build --compile`). +`bun tools/build-sidecars.ts` compiles the CLI for macOS, Linux and Windows (`bun build --compile`). Design, safety +model and the Dependencies screen (tool sources and licenses): [docs/desktop.md](docs/desktop.md). ## Safety model diff --git a/apps/desktop/src/screens/AppFolders.tsx b/apps/desktop/src/screens/AppFolders.tsx index 5b44722a..3bb37ee3 100644 --- a/apps/desktop/src/screens/AppFolders.tsx +++ b/apps/desktop/src/screens/AppFolders.tsx @@ -83,7 +83,7 @@ export function AppFolders({ data }: { data: Data }) { -
+
diff --git a/apps/desktop/src/screens/Portfolio.tsx b/apps/desktop/src/screens/Portfolio.tsx index 1f8987a4..c43153b7 100644 --- a/apps/desktop/src/screens/Portfolio.tsx +++ b/apps/desktop/src/screens/Portfolio.tsx @@ -50,7 +50,7 @@ export function Portfolio({ data, open, go }: { data: Data; open: (p: Project) = ) : (
- + {data.projects.map(p => { const e = data.statusOf(p); @@ -60,11 +60,17 @@ export function Portfolio({ data, open, go }: { data: Data; open: (p: Project) = return ( - - + - + ); diff --git a/apps/desktop/src/styles.css b/apps/desktop/src/styles.css index 5e9d49d3..52d5d177 100644 --- a/apps/desktop/src/styles.css +++ b/apps/desktop/src/styles.css @@ -117,10 +117,14 @@ th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: th:first-child { border-top-left-radius: var(--radius); } th:last-child { border-top-right-radius: var(--radius); } tr:last-child td { border-bottom: 0; } -td .path { color: var(--muted); font-family: var(--mono); font-size: 12px; overflow-wrap: anywhere; } +td .path { color: var(--muted); font-family: var(--mono); font-size: 12px; max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } +td:first-child { min-width: 180px; } +.card:has(> table) { overflow-x: auto; } .name { font-weight: 650; } .nowrap { white-space: nowrap; } +.plat { display: grid; gap: 6px; font-size: 13px; } +.plat .tag { min-width: 64px; text-align: center; margin-right: 6px; } .tag { white-space: nowrap; display: inline-block; font: 700 10.5px/1 var(--mono); letter-spacing: .05em; padding: 5px 8px; border-radius: 999px; text-transform: uppercase; } .tag-ok { background: var(--ok-bg); color: var(--ok-ink); } .tag-local { background: var(--local-bg); color: var(--local-ink); } diff --git a/cli/catalog.ts b/cli/catalog.ts index 3de5fff5..84f6904e 100644 --- a/cli/catalog.ts +++ b/cli/catalog.ts @@ -9,7 +9,7 @@ import { appleCurrent, pages, playProduct } from './prices'; import { ascClient, type J } from './apple/asc'; import { type CatalogRow, catalogDiff, fromApplePeriod, fromAppleType, regionOf, type StoreItem, wantedCatalog } from './lib/catalog'; import type { Ctx } from './lib/ctx'; -import { done, log } from './lib/log'; +import { done, log, printJson } from './lib/log'; import { fromMoney } from './lib/money'; import { listOneTimeProducts } from './play/products'; import { playClient } from './play/client'; @@ -94,7 +94,7 @@ export async function run(ctx: Ctx): Promise { const play = (!store || store === 'play') && config.play ? await playItems(ctx) : null; const { rows, parity } = catalogDiff(want, { apple, play }, { threshold: a.num('threshold', 10) / 100 }); const errors = rows.filter(r => r.level === 'error').length; - if (a.has('json')) console.log(JSON.stringify({ errors, rows, parity }, null, 2)); + if (a.has('json')) printJson({ errors, rows, parity }); else { console.log(formatRows(rows)); if (parity.length) console.log(`\nprice differences between the stores (same currency, over ${a.num('threshold', 10)} %):\n` + diff --git a/cli/inspect.ts b/cli/inspect.ts index 56ae93d0..ec36d6bd 100644 --- a/cli/inspect.ts +++ b/cli/inspect.ts @@ -1,11 +1,13 @@ // 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, @@ -13,10 +15,16 @@ export function summarize(ctx: Ctx): ProjectSummary { 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 arrive in the config schema separately; counted when present - subscriptions: ((config as { subscriptions?: unknown[] }).subscriptions ?? []).length, + 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, }; @@ -25,7 +33,7 @@ export function summarize(ctx: Ctx): ProjectSummary { export async function run(ctx: Ctx): Promise { const s = summarize(ctx); if (ctx.args.has('json')) { printJson(s); return; } - log('inspect', `${s.name} · ${s.languages.length} languages · ${s.products} products`); + 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}`); } diff --git a/cli/lib/desktop-protocol.ts b/cli/lib/desktop-protocol.ts index abddce30..40a182b6 100644 --- a/cli/lib/desktop-protocol.ts +++ b/cli/lib/desktop-protocol.ts @@ -78,11 +78,16 @@ export interface ProjectSummary { languages: string[]; play: { packageName: string } | null; apple: { bundleId: string; appId: string | null } | null; - /** One-time in-app products in the config (shared by both stores). */ + /** app.platforms (default: from the apple / play sections). */ + platforms: ('ios' | 'android')[]; + /** One-time in-app products in the config (one shared catalog). */ products: number; productIds: string[]; - /** Subscriptions in the config (0 until the config defines them). */ + /** Auto-renewable subscriptions in the config (all groups). */ subscriptions: number; + subscriptionIds: string[]; + /** Product and subscription ids each store should sell (items may be limited to one platform). */ + catalog: { ios: string[]; android: string[] }; shots: boolean; testflightGroups: number; } diff --git a/cli/lib/portfolio.ts b/cli/lib/portfolio.ts index 4153ac7d..76d2e640 100644 --- a/cli/lib/portfolio.ts +++ b/cli/lib/portfolio.ts @@ -10,8 +10,8 @@ export function appIdentity(s: ProjectSummary): AppIdentity { id: s.dir, name: s.name, platforms: { - ios: s.apple ? { bundleId: s.apple.bundleId, ascAppId: s.apple.appId } : null, - android: s.play ? { packageName: s.play.packageName } : null, + ios: s.apple && s.platforms.includes('ios') ? { bundleId: s.apple.bundleId, ascAppId: s.apple.appId } : null, + android: s.play && s.platforms.includes('android') ? { packageName: s.play.packageName } : null, }, }; } @@ -86,12 +86,13 @@ export const playProductIds = (data: unknown): string[] => (((data as J)?.produc * and config ids missing from a store the app is on. */ export function catalogParity(s: ProjectSummary, apple?: string[], play?: string[]): CatalogParity { - const ids = s.productIds; const live = apple !== undefined || play !== undefined; const onlyIos = apple && play ? apple.filter(x => !play.includes(x)) : []; const onlyAndroid = apple && play ? play.filter(x => !apple.includes(x)) : []; - const missingIos = s.apple && apple ? ids.filter(x => !apple.includes(x)) : []; - const missingAndroid = s.play && play ? ids.filter(x => !play.includes(x)) : []; + // the status reads list one-time products; subscriptions are compared by `catalog diff` (catalog.diff method) + const sold = (ids: string[]) => ids.filter(x => s.productIds.includes(x)); + const missingIos = apple ? sold(s.catalog.ios).filter(x => !apple.includes(x)) : []; + const missingAndroid = play ? sold(s.catalog.android).filter(x => !play.includes(x)) : []; return { checked: live ? 'live' : 'config', products: s.products, subscriptions: s.subscriptions, onlyIos, onlyAndroid, missingIos, missingAndroid, diff --git a/cli/serve.ts b/cli/serve.ts index 8db2777f..46dced0e 100644 --- a/cli/serve.ts +++ b/cli/serve.ts @@ -37,7 +37,7 @@ export const FORBIDDEN_METHOD_WORDS = /submit|release|publish|rollout|resume|com /** Read tools whose command prints a structured result with --json. */ export const JSON_TOOLS = new Set(['check', 'check_aso', 'validate', 'health', 'reviews_list', 'prices_diff', 'analytics_compare', 'apple_status', - 'apple_next_build', 'play_status', 'play_next_version_code', 'shots_check', 'apple_testflight_status', 'apple_ppo_status']); + 'apple_next_build', 'play_status', 'play_next_version_code', 'shots_check', 'apple_testflight_status', 'apple_ppo_status', 'catalog_diff']); /** `apple_testflight_status` -> `apple.testflight_status`: first underscore becomes the namespace dot. */ export const methodName = (tool: string): string => tool.replace('_', '.'); diff --git a/tests/portfolio.test.ts b/tests/portfolio.test.ts index cbd08376..d7e6ec79 100644 --- a/tests/portfolio.test.ts +++ b/tests/portfolio.test.ts @@ -5,7 +5,8 @@ import { appIdentity, applePhase, appleProductIds, appleReleases, catalogParity, const summary: ProjectSummary = { dir: '/games/demo', config: '/games/demo/storebound.config.ts', name: 'Demo', languages: ['en'], play: { packageName: 'com.example.demo' }, apple: { bundleId: 'com.example.demo', appId: null }, - products: 2, productIds: ['coins', 'no_ads'], subscriptions: 0, shots: false, testflightGroups: 0, + platforms: ['ios', 'android'], products: 2, productIds: ['coins', 'no_ads'], subscriptions: 1, subscriptionIds: ['pro_monthly'], + catalog: { ios: ['coins', 'no_ads', 'pro_monthly'], android: ['coins', 'no_ads', 'pro_monthly'] }, shots: false, testflightGroups: 0, }; const apple = { @@ -29,6 +30,7 @@ describe('portfolio (apps, release trains, catalog parity)', () => { test('identity: one app, both platforms', () => { expect(appIdentity(summary)).toEqual({ id: '/games/demo', name: 'Demo', platforms: { ios: { bundleId: 'com.example.demo', ascAppId: null }, android: { packageName: 'com.example.demo' } } }); expect(appIdentity({ ...summary, apple: null }).platforms.ios).toBeNull(); + expect(appIdentity({ ...summary, platforms: ['android'] }).platforms.ios).toBeNull(); }); test('versions and phases', () => { expect(cmpVersion('2.10.0', '2.9.1')).toBeGreaterThan(0); @@ -59,9 +61,11 @@ describe('portfolio (apps, release trains, catalog parity)', () => { expect(onlyNext.next?.version).toBe('2.3.0'); }); test('catalog parity: config only offline, both stores live', () => { - expect(catalogParity(summary)).toEqual({ checked: 'config', products: 2, subscriptions: 0, onlyIos: [], onlyAndroid: [], missingIos: [], missingAndroid: [], ok: true }); + expect(catalogParity(summary)).toEqual({ checked: 'config', products: 2, subscriptions: 1, onlyIos: [], onlyAndroid: [], missingIos: [], missingAndroid: [], ok: true }); const live = catalogParity(summary, appleProductIds(apple), playProductIds(play)); expect(live).toMatchObject({ checked: 'live', onlyIos: ['ios_only'], onlyAndroid: ['no_ads', 'android_only'], missingIos: ['no_ads'], missingAndroid: [], ok: false }); + // an item sold on Android only is not missing on iOS + expect(catalogParity({ ...summary, catalog: { ios: ['coins'], android: ['coins', 'no_ads'] } }, appleProductIds(apple), playProductIds(play)).missingIos).toEqual([]); // one store unreadable: no cross-store claims expect(catalogParity(summary, undefined, playProductIds(play))).toMatchObject({ onlyIos: [], onlyAndroid: [], missingIos: [], missingAndroid: [] }); }); diff --git a/tests/serve.test.ts b/tests/serve.test.ts index f0cea414..93b7601d 100644 --- a/tests/serve.test.ts +++ b/tests/serve.test.ts @@ -163,7 +163,7 @@ describe('serve --stdio: session', () => { expect(errOf(await pending).code).toBe(ERR.cancelled); }); test('portfolio.status: apps across platforms, release trains, catalog parity, per-app errors, progress n/total', async () => { - const summary = { dir: DEMO, name: 'Demo', apple: { bundleId: 'com.example.demo', appId: null }, play: { packageName: 'com.example.demo' }, products: 2, productIds: ['coins', 'no_ads'], subscriptions: 0 }; + const summary = { dir: DEMO, name: 'Demo', apple: { bundleId: 'com.example.demo', appId: null }, play: { packageName: 'com.example.demo' }, platforms: ['ios', 'android'], products: 2, productIds: ['coins', 'no_ads'], subscriptions: 0, subscriptionIds: [], catalog: { ios: ['coins', 'no_ads'], android: ['coins', 'no_ads'] } }; const { call, sent } = await session(argv => argv[0] === 'inspect' ? { data: summary } : argv[0] === 'check' ? { data: { ok: true, problems: [], warnings: ['w'] } } : argv[0] === 'apple' ? { code: 1, out: 'error: ASC_KEY_ID and ASC_ISSUER_ID are not set' }
AppiOSAndroidLiveNextCatalogConfig
AppPlatformsLiveNextCatalogConfig
{shortPath(p.path, data.home)}
{ios ? ios.bundleId : none}{e?.storeErrors.ios &&
unreadable
}
{android ? android.packageName : none}{e?.storeErrors.android &&
unreadable
}
+ {e && ( +
+
iOS {ios?.bundleId ?? 'not set up'}{e.storeErrors.ios && unreadable}
+
Android {android?.packageName ?? 'not set up'}{e.storeErrors.android && unreadable}
+
+ )} +
{e ? trainText(e.release.current, e.release.source) : ''} {e ? trainText(e.release.next, e.release.source) : ''}{cat ? {cat.products} products · {cat.subscriptions} subs : ''}{cat ? {cat.products} · {cat.subscriptions} : ''} {st.text}