CLI: store readiness, release management, export compliance, ASO audit, release notes, privacy manifest scan
- validate: read-only App Store Connect + Play report with ordered blockers (exit 1) - apple release --phased on|pause|resume|complete and --manual-release (asks first) - apple status --wait-review (exit 0 approved, 1 rejected, 7 timeout), apple next-build, apple encryption - play rollout --fraction|--halt|--resume|--complete, play next-version-code - check --aso, whats-new --since <tag>, privacy-manifest --ios <path>, version - Apple IAP description limit is 45 characters (App Store Connect Help), not 55 - config: apple.usesNonExemptEncryption, apple.screenshotTypes, ads.appAdsTxt
This commit is contained in:
parent
0ca1d464e4
commit
f846fdc765
24 changed files with 1153 additions and 16 deletions
119
cli/validate.ts
Normal file
119
cli/validate.ts
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
// Store readiness report (read-only on both stores): what still blocks a submission, in the order to fix it.
|
||||
// storebound validate [--apple] [--play] [--json]
|
||||
// Without --apple / --play: every store the config has. Exit code 1 when there is at least one blocker.
|
||||
// Reads only: GETs on App Store Connect, a Play edit that is opened, read and deleted (never committed), and plain GETs
|
||||
// of the public privacy policy and app-ads.txt URLs.
|
||||
import { ascClient, type J } from './apple/asc';
|
||||
import { playCodes } from './lib/config';
|
||||
import type { Ctx } from './lib/ctx';
|
||||
import { checkUrl } from './lib/http';
|
||||
import { log, warn } from './lib/log';
|
||||
import { type AppleSnapshot, appleRules, type Finding, formatFindings, PLAY_REQUIRED_IMAGES, type PlaySnapshot, playRules } from './lib/validate-rules';
|
||||
import { playClient } from './play/client';
|
||||
import { listOneTimeProducts } from './play/products';
|
||||
|
||||
export async function collectApple(ctx: Ctx): Promise<AppleSnapshot> {
|
||||
const { config, root } = ctx.loaded;
|
||||
const c = await ascClient(root, config.apple!.bundleId, config.apple?.appId);
|
||||
const appId = await c.app();
|
||||
log('validate', 'apple: reading version, build, localizations');
|
||||
const versions = await c.all(`/v1/apps/${appId}/appStoreVersions?filter[platform]=IOS&limit=10`);
|
||||
const v: J = (await c.editableVersion()) ?? versions[0] ?? null;
|
||||
let build: AppleSnapshot['build'] = null;
|
||||
const locales: AppleSnapshot['locales'] = [];
|
||||
let reviewDetail: AppleSnapshot['reviewDetail'] = null;
|
||||
if (v) {
|
||||
const b = (await c.maybe(`/v1/appStoreVersions/${v.id}/build`))?.data;
|
||||
if (b) {
|
||||
const decl = (await c.maybe(`/v1/builds/${b.id}/appEncryptionDeclaration`))?.data;
|
||||
build = { number: b.attributes.version, processingState: b.attributes.processingState, usesNonExemptEncryption: b.attributes.usesNonExemptEncryption ?? null,
|
||||
declarationState: decl?.attributes?.appEncryptionDeclarationState ?? null };
|
||||
}
|
||||
const info = await c.editableAppInfo();
|
||||
const infoLocs = new Map((await c.all(`/v1/appInfos/${info.id}/appInfoLocalizations?limit=50`)).map((l: J) => [l.attributes.locale, l.attributes] as const));
|
||||
for (const l of await c.all(`/v1/appStoreVersions/${v.id}/appStoreVersionLocalizations?limit=50`)) {
|
||||
const sets = await c.all(`/v1/appStoreVersionLocalizations/${l.id}/appScreenshotSets?limit=50`);
|
||||
const screenshots: Record<string, number> = {};
|
||||
for (const s of sets) screenshots[s.attributes.screenshotDisplayType] = (await c.all(`/v1/appScreenshotSets/${s.id}/appScreenshots?limit=50`)).length;
|
||||
const ia = infoLocs.get(l.attributes.locale) ?? {};
|
||||
locales.push({ locale: l.attributes.locale, name: ia.name, subtitle: ia.subtitle, description: l.attributes.description, keywords: l.attributes.keywords, screenshots });
|
||||
}
|
||||
reviewDetail = (await c.maybe(`/v1/appStoreVersions/${v.id}/appStoreReviewDetail`))?.data?.attributes ?? null;
|
||||
}
|
||||
log('validate', 'apple: age rating, price, availability, in-app purchases');
|
||||
const info = await c.editableAppInfo();
|
||||
const ageRating = (await c.maybe(`/v1/appInfos/${info.id}/ageRatingDeclaration`))?.data?.attributes ?? null;
|
||||
const sched = await c.maybe(`/v1/apps/${appId}/appPriceSchedule?include=manualPrices`);
|
||||
const avail = await c.maybe(`/v1/apps/${appId}/appAvailabilityV2`);
|
||||
const iaps: AppleSnapshot['iaps'] = [];
|
||||
for (const p of await c.all(`/v1/apps/${appId}/inAppPurchasesV2?limit=200`)) {
|
||||
const shot = (await c.maybe(`/v2/inAppPurchases/${p.id}/appStoreReviewScreenshot`))?.data;
|
||||
iaps.push({ productId: p.attributes.productId, state: p.attributes.state, reviewScreenshot: !!shot });
|
||||
}
|
||||
return {
|
||||
version: v ? { versionString: v.attributes.versionString, state: v.attributes.appVersionState ?? v.attributes.appStoreState } : null,
|
||||
build, locales, reviewDetail, ageRating,
|
||||
expectedLocales: config.languages.map(l => l.apple).filter((x): x is string => !!x),
|
||||
requiredDisplayTypes: config.apple?.screenshotTypes ?? ['APP_IPHONE_67'],
|
||||
priceSchedule: !!sched?.included?.some((x: J) => x.type === 'appPrices'),
|
||||
availability: !!avail?.data,
|
||||
iaps, expectedProducts: (config.products ?? []).map(p => p.id),
|
||||
privacyUrl: await checkUrl(config.app.privacyPolicyUrl),
|
||||
};
|
||||
}
|
||||
|
||||
export async function collectPlay(ctx: Ctx): Promise<PlaySnapshot> {
|
||||
const { config, root } = ctx.loaded;
|
||||
const play = await playClient(root, config.play!.packageName);
|
||||
const e = await play.call<{ id: string }>('POST', `${play.API}/edits`, {});
|
||||
log('validate', `play: read-only edit ${e.id} (deleted afterwards)`);
|
||||
try {
|
||||
const details = await play.call<{ defaultLanguage?: string; contactWebsite?: string }>('GET', `${play.API}/edits/${e.id}/details`);
|
||||
const raw = (await play.call<{ listings?: { language: string; title?: string; shortDescription?: string; fullDescription?: string }[] }>('GET', `${play.API}/edits/${e.id}/listings`)).listings ?? [];
|
||||
const listings: PlaySnapshot['listings'] = [];
|
||||
for (const l of raw) {
|
||||
const images: Record<string, number> = {};
|
||||
for (const type of Object.keys(PLAY_REQUIRED_IMAGES))
|
||||
images[type] = ((await play.call<{ images?: unknown[] }>('GET', `${play.API}/edits/${e.id}/listings/${l.language}/${type}`)).images ?? []).length;
|
||||
listings.push({ ...l, images });
|
||||
}
|
||||
const tracks = ((await play.call<{ tracks?: { track: string; releases?: { status: string; versionCodes?: string[]; userFraction?: number }[] }[] }>('GET', `${play.API}/edits/${e.id}/tracks`)).tracks ?? [])
|
||||
.map(t => ({ track: t.track, releases: (t.releases ?? []).map(r => ({ status: r.status, versionCodes: r.versionCodes ?? [], userFraction: r.userFraction })) }));
|
||||
const products = (await listOneTimeProducts(play)).map(p => ({ productId: p.productId, states: (p.purchaseOptions ?? []).map(o => o.state ?? '') }));
|
||||
const website = details.contactWebsite ?? null;
|
||||
const appAdsLines = config.ads?.appAdsTxt ?? [];
|
||||
const adsLikely = !!config.ads || Object.values(config.dataSafety?.data ?? {}).some(u => u.collect.includes('advertising'));
|
||||
let appAds = null;
|
||||
if (website && (appAdsLines.length || adsLikely)) {
|
||||
try { appAds = await checkUrl(new URL('/app-ads.txt', website).href, { body: true }); } catch { appAds = { url: website, status: null, error: 'bad website URL' }; }
|
||||
}
|
||||
return {
|
||||
defaultLanguage: details.defaultLanguage ?? config.play?.defaultLanguage ?? 'en-US',
|
||||
expectedLanguages: config.languages.flatMap(playCodes), listings, tracks, products,
|
||||
expectedProducts: (config.products ?? []).map(p => p.id),
|
||||
privacyUrl: await checkUrl(config.app.privacyPolicyUrl), website, appAds, appAdsLines, adsLikely,
|
||||
};
|
||||
} finally {
|
||||
await play.call('DELETE', `${play.API}/edits/${e.id}`).catch(() => {});
|
||||
}
|
||||
}
|
||||
|
||||
export async function run(ctx: Ctx): Promise<void> {
|
||||
const { config } = ctx.loaded;
|
||||
const a = ctx.args;
|
||||
const both = !a.has('apple') && !a.has('play');
|
||||
const findings: Finding[] = [];
|
||||
if ((both || a.has('apple')) && config.apple) {
|
||||
try { findings.push(...appleRules(await collectApple(ctx))); } catch (e) { findings.push({ store: 'apple', level: 'blocker', code: 'api', msg: (e as Error).message.slice(0, 400) }); }
|
||||
} else if (a.has('apple')) warn('validate', 'no apple section in the config');
|
||||
if ((both || a.has('play')) && config.play) {
|
||||
try { findings.push(...playRules(await collectPlay(ctx))); } catch (e) { findings.push({ store: 'play', level: 'blocker', code: 'api', msg: (e as Error).message.slice(0, 400) }); }
|
||||
} else if (a.has('play')) warn('validate', 'no play section in the config');
|
||||
const blockers = findings.filter(f => f.level === 'blocker').length;
|
||||
if (a.has('json')) console.log(JSON.stringify({ blockers, findings }, null, 2));
|
||||
else {
|
||||
console.log(formatFindings(findings));
|
||||
log('validate', blockers ? `${blockers} blocker(s)` : 'no blockers (UI-only steps are not visible to the API: App Privacy, Play App content)');
|
||||
}
|
||||
if (blockers) process.exitCode = 1;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue