serve --stdio: desktop JSON-RPC profile on the MCP core, confirm tokens, --json results, sidecar builds

- cli/serve.ts: session.hello with a per-session secret, typed methods per tool, project.inspect,
  portfolio.status over many project folders, progress notifications, cancellation
- cli/lib/confirm-token.ts: single-use HMAC tokens bound to method + canonical params + expiry;
  writes are dry runs without one; no submit / release / publish method exists
- cli/lib/runner.ts: shared child runner for mcp and serve, works from a compiled binary
- --json on check, testflight / ppo status, next-build, next-version-code, analytics compare,
  prices import; inspect command; confirm() always answers no under serve
- tools/build-sidecars.ts: bun build --compile for five targets, ad-hoc re-sign on macOS, path leak check
- tests/serve.test.ts: methods, token binding / expiry / replay, shared vector, stdio and compiled smoke
This commit is contained in:
CRTkafa 2026-10-10 17:11:56 +00:00
parent c6360812b8
commit 3454a9aadb
28 changed files with 1048 additions and 42 deletions

View file

@ -174,6 +174,8 @@ run in the background with a log (`storebound shots render > .storebound/render.
| `init [--profile app\|game\|subscription-app]` | local | copy the templates of a profile (default app), gitignore `.storebound/` |
| `install --agent <tool>` | local | skills + MCP entry for an AI tool |
| `mcp` | local | stdio MCP server wrapping the commands |
| `serve --stdio` | local | JSON-RPC session for the storebound desktop app (see [Desktop machine interface](#desktop-machine-interface)) |
| `inspect [--json]` | local | offline summary of the config: name, store ids, languages, products |
| `check` | local | config, copy limits, data safety, products, subscriptions, profile (delete-account URL, demo account, terms URL), files; warns on untranslated release notes |
| `catalog diff [--store] [--threshold 10]` | API, read-only | one catalog vs both stores: missing / extra / mismatched products and subscriptions, US and override prices, locales, offers, per-region price differences between the stores; exit 1 on mismatches |
| `check --aso` | local | keyword audit: App Store keyword field rules, Play stuffing / claims |
@ -376,6 +378,18 @@ per-request `_meta`, `resultType`, cacheable `tools/list`) and, on the same proc
Manual config for a tool that `install` does not know: command `bunx` with args `["storebound", "mcp"]` (or the
absolute path of `bin/storebound` plus `mcp`).
### Desktop machine interface
`storebound serve --stdio` is what the desktop app (`apps/desktop`, in progress) runs as its sidecar: newline-delimited
JSON-RPC on the same core as the MCP server (tool list, validation, forbidden flags, child-process runner), with typed
methods (`check`, `validate`, `apple.status`, `play.listing`, ... plus `project.inspect` and `portfolio.status` over
many project folders), structured results (the commands' `--json` output), progress notifications and cancellation.
The first request is `session.hello` with a per-session secret only the host knows. Write methods are dry runs unless
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`).
## Safety model
- **Credentials** live in env vars or the gitignored `.storebound/credentials.json`, never in the config or the repo.