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:
parent
c6360812b8
commit
3454a9aadb
28 changed files with 1048 additions and 42 deletions
|
|
@ -5,6 +5,7 @@
|
|||
// Then attach exactly that build: storebound apple listing --version x.y.z --build 42 (never "the latest").
|
||||
import type { Ctx } from '../lib/ctx';
|
||||
import { need } from '../lib/ctx';
|
||||
import { printJson } from '../lib/log';
|
||||
import { nextBuildNumber } from '../lib/release';
|
||||
import { ascClient } from './asc';
|
||||
|
||||
|
|
@ -14,6 +15,7 @@ export async function run(ctx: Ctx): Promise<void> {
|
|||
const appId = await c.app();
|
||||
const builds = await c.all(`/v1/builds?filter[app]=${appId}&limit=200&fields[builds]=version`);
|
||||
const next = nextBuildNumber(builds.map(b => String(b.attributes.version)));
|
||||
if (ctx.args.has('json')) { printJson({ next, builds: builds.length }); return; }
|
||||
console.error(`[apple] ${builds.length} builds on App Store Connect; next build number:`);
|
||||
console.log(next);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// App Store Product Page Optimization through the App Store Connect API, wired to the `shots` variants.
|
||||
// storebound apple ppo status
|
||||
// storebound apple ppo status [--json]
|
||||
// storebound apple ppo create --variant b[,c] [--name "..."] [--traffic 30] [--dry]
|
||||
// storebound apple ppo upload --variant b [--experiment "..."] [--only en-US,tr] [--src store/renders] [--dry]
|
||||
// storebound apple ppo start | stop [--experiment "..."] [--dry] [--yes]
|
||||
|
|
@ -13,7 +13,7 @@ import { existsSync } from 'node:fs';
|
|||
import { join } from 'node:path';
|
||||
import type { Ctx } from '../lib/ctx';
|
||||
import { byAppleLocale, confirm, need } from '../lib/ctx';
|
||||
import { done, log, warn } from '../lib/log';
|
||||
import { done, log, printJson, warn } from '../lib/log';
|
||||
import {
|
||||
checkCreate, createExperimentReq, defaultName, type Experiment, experimentFromApi, pickExperiment, planTreatmentLocales, planTreatments, startStopReq,
|
||||
} from '../lib/ppo';
|
||||
|
|
@ -44,6 +44,16 @@ export async function run(ctx: Ctx): Promise<void> {
|
|||
const list = await experiments(c, appId);
|
||||
const locales = config.languages.map(l => l.apple).filter((x): x is string => !!x);
|
||||
|
||||
if (sub === 'status' && a.has('json')) {
|
||||
const tests = [];
|
||||
for (const x of list) {
|
||||
const ts = [];
|
||||
if (!['COMPLETED', 'STOPPED'].includes(x.state)) for (const t of await treatments(c, x.id)) ts.push({ id: t.id, name: t.attributes.name, locales: (await treatmentLocs(c, t.id)).length });
|
||||
tests.push({ ...x, treatments: ts });
|
||||
}
|
||||
printJson({ tests });
|
||||
return;
|
||||
}
|
||||
if (sub === 'status') {
|
||||
if (!list.length) { done(TAG, 'no Product Page Optimization tests (storebound apple ppo create --variant b)'); return; }
|
||||
console.log(textTable(['test', 'state', 'traffic', 'start', 'end'], list.map(x => [x.name, x.state, x.trafficProportion !== undefined ? `${x.trafficProportion}%` : '', (x.startDate ?? '').slice(0, 10), (x.endDate ?? '').slice(0, 10)])));
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
// exit codes: 0 approved, 1 rejected, 7 timeout (2 = nothing in review)
|
||||
import type { Ctx } from '../lib/ctx';
|
||||
import { confirm, need } from '../lib/ctx';
|
||||
import { log } from '../lib/log';
|
||||
import { log, printJson } from '../lib/log';
|
||||
import { classifyReviewState, nextPollDelay, parseDuration, WAIT_EXIT } from '../lib/release';
|
||||
import { type Asc, ascClient, type J } from './asc';
|
||||
|
||||
|
|
@ -54,7 +54,7 @@ export async function run(ctx: Ctx): Promise<void> {
|
|||
const builds = (await c.asc('GET', `/v1/builds?filter[app]=${appId}&sort=-uploadedDate&limit=5&include=preReleaseVersion`));
|
||||
const iaps = await c.all(`/v1/apps/${appId}/inAppPurchasesV2?limit=200`);
|
||||
const subs = await c.all(`/v1/reviewSubmissions?filter[app]=${appId}&limit=20`);
|
||||
if (ctx.args.has('json')) { console.log(JSON.stringify({ app, versions, builds: builds.data, iaps, subs }, null, 2)); return; }
|
||||
if (ctx.args.has('json')) { printJson({ app, versions, builds: builds.data, iaps, subs }); return; }
|
||||
|
||||
console.log(`${app.attributes.name} · ${app.attributes.bundleId} · Apple ID ${appId}`);
|
||||
for (const v of versions) console.log(` version ${v.attributes.versionString.padEnd(8)} ${v.attributes.appVersionState ?? v.attributes.appStoreState}${v.relationships?.build?.data ? ' (build attached)' : ''}`);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// TestFlight through the App Store Connect API.
|
||||
// storebound apple testflight status groups, testers per group, recent builds + beta states
|
||||
// storebound apple testflight status [--json] groups, testers per group, recent builds + beta states
|
||||
// storebound apple testflight groups [--dry] create the groups of apple.testflight.groups that are missing
|
||||
// storebound apple testflight testers [--csv f] [--group a,b] [--remove] [--invite] [--dry] [--yes]
|
||||
// storebound apple testflight what-to-test --build N [--version x.y.z] [--locale en-US,tr] [--text "..."] [--dry]
|
||||
|
|
@ -14,7 +14,7 @@ import { existsSync, readFileSync } from 'node:fs';
|
|||
import type { Ctx } from '../lib/ctx';
|
||||
import { confirm, need } from '../lib/ctx';
|
||||
import { reviewContact } from '../lib/credentials';
|
||||
import { done, log, warn } from '../lib/log';
|
||||
import { done, log, printJson, warn } from '../lib/log';
|
||||
import { textTable } from '../lib/table';
|
||||
import {
|
||||
type ApiBuild, betaDescriptions, betaReadiness, betaReviewReq, buildsWithVersion, type Group, groupFromApi, inviteReq, maskEmail,
|
||||
|
|
@ -52,21 +52,30 @@ export async function run(ctx: Ctx): Promise<void> {
|
|||
if (sub === 'status') {
|
||||
const gs = await groups(c, appId);
|
||||
const rows: (string | number)[][] = [];
|
||||
const jsonGroups: Record<string, unknown>[] = [];
|
||||
for (const g of gs) {
|
||||
const testers = await c.all(`/v1/betaGroups/${g.id}/betaTesters?limit=200`);
|
||||
const builds = await c.all(`/v1/betaGroups/${g.id}/builds?limit=200`);
|
||||
jsonGroups.push({ id: g.id, name: g.name, internal: g.internal, testers: testers.length, builds: g.internal && g.hasAccessToAllBuilds ? 'all' : builds.length, publicLink: !!g.publicLinkEnabled });
|
||||
rows.push([g.name, g.internal ? 'internal' : 'external', testers.length, g.internal && g.hasAccessToAllBuilds ? 'all' : builds.length, g.publicLinkEnabled ? 'public link on' : '']);
|
||||
}
|
||||
console.log(textTable(['group', 'kind', 'testers', 'builds', ''], rows));
|
||||
const q = new URLSearchParams({ 'filter[app]': appId, include: 'preReleaseVersion,buildBetaDetail', sort: '-uploadedDate', limit: '8' });
|
||||
const resp = await c.asc('GET', `/v1/builds?${q}`);
|
||||
const details = new Map((resp.included ?? []).filter((x: J) => x.type === 'buildBetaDetails').map((x: J) => [x.id, x.attributes] as const));
|
||||
const missingGroups = (tf?.groups ?? []).filter(w => !gs.some(g => g.name === w.name)).map(w => w.name);
|
||||
if (a.has('json')) {
|
||||
printJson({ groups: jsonGroups, builds: buildsWithVersion(resp).map(b => {
|
||||
const d = details.get((b as J).relationships?.buildBetaDetail?.data?.id) as J;
|
||||
return { version: b.marketing ?? null, build: b.attributes.version ?? null, processing: b.attributes.processingState ?? null, internal: d?.internalBuildState ?? null, external: d?.externalBuildState ?? null, uploaded: b.attributes.uploadedDate ?? null };
|
||||
}), missingGroups });
|
||||
return;
|
||||
}
|
||||
console.log(textTable(['group', 'kind', 'testers', 'builds', ''], rows));
|
||||
console.log('\n' + textTable(['version', 'build', 'processing', 'internal', 'external', 'uploaded'], buildsWithVersion(resp).map(b => {
|
||||
const d = details.get((b as J).relationships?.buildBetaDetail?.data?.id) as J;
|
||||
return [b.marketing ?? '', b.attributes.version ?? '', b.attributes.processingState ?? '', d?.internalBuildState ?? '', d?.externalBuildState ?? '', (b.attributes.uploadedDate ?? '').slice(0, 10)];
|
||||
})));
|
||||
const missing = (tf?.groups ?? []).filter(w => !gs.some(g => g.name === w.name)).map(w => w.name);
|
||||
if (missing.length) warn(TAG, `configured but not on App Store Connect: ${missing.join(', ')} (storebound apple testflight groups)`);
|
||||
if (missingGroups.length) warn(TAG, `configured but not on App Store Connect: ${missingGroups.join(', ')} (storebound apple testflight groups)`);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue