shelfready 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -10,6 +10,8 @@ Try it in your app's repo, nothing to install:
10
10
  npx -y shelfready check
11
11
  ```
12
12
 
13
+ Already on the App Store? Paste your link at **[shelfready.dev/check](https://shelfready.dev/check/)**.
14
+
13
15
  Website, the full checklist and what common SDKs collect: **[shelfready.dev](https://shelfready.dev)**
14
16
 
15
17
  ## Quick start
@@ -37,6 +39,7 @@ shelf checklist --online # what's left before you submit
37
39
  | `shelf check` | Drift between `shelfready.yaml` and the repo, missing manifests, placeholder permission texts, unknown SDKs, trader details, in-app Impressum. `--ci` exits 1 on errors, `--online` checks the published pages, `--format github` annotates pull requests |
38
40
  | `shelf checklist` | The go-live checklist: automatic items from `check`, manual ones you tick with `--done <id>`; `--markdown` writes it as a file |
39
41
  | `shelf migrate` | Updates `shelfready.yaml` to the current schema, keeping your comments and style |
42
+ | `shelf listing` | Checks an app that's already live, from its App Store link alone: privacy policy and support page load, the policy has a contact and a date, EU trader details, an Impressum for German and Austrian traders, and whether the privacy label covers the SDKs the policy names. Also on the web at [shelfready.dev/check](https://shelfready.dev/check/) |
40
43
  | `shelf agents` | Adds a short note to `AGENTS.md` (or `CLAUDE.md`) so coding agents in the repo run the checks before a release; `shelf init` offers it |
41
44
  | `shelf mcp` | Runs the MCP server on stdio, so Claude and other agents can use all of the above |
42
45
 
@@ -69,7 +72,7 @@ codex mcp add shelfready -- npx -y shelfready mcp
69
72
  }
70
73
  ```
71
74
 
72
- Tools: `scan`, `init`, `check`, `checklist`, `tick`, `pages`, `app_privacy`, `sdk_info`, `migrate`. Each takes `path`, the app repo, and only ever writes inside it. The server is listed in the [MCP Registry](https://registry.modelcontextprotocol.io) as `io.github.halfbatch-studio/shelfready`.
75
+ Tools: `scan`, `init`, `check`, `checklist`, `tick`, `pages`, `app_privacy`, `listing`, `sdk_info`, `migrate`. Each takes `path`, the app repo, and only ever writes inside it. The server is listed in the [MCP Registry](https://registry.modelcontextprotocol.io) as `io.github.halfbatch-studio/shelfready`.
73
76
 
74
77
  The skill, [`plugin/skills/shelfready/SKILL.md`](plugin/skills/shelfready/SKILL.md), follows the open Agent Skills format: copy the folder into any agent that reads skills, or upload it to claude.ai.
75
78
 
package/dist/cli.js CHANGED
@@ -4,7 +4,7 @@ import { join, relative, resolve } from "node:path";
4
4
  import { createInterface } from "node:readline/promises";
5
5
  import { createRequire } from "node:module";
6
6
  import { Command, Option } from "commander";
7
- import { addAgentsNote, agentsNoteFile, appPrivacy, check, checklist, checklistMarkdown, checklistSummary, checkOnline, CURRENT_VERSION, setTicks, factsToYAML, initFacts, legalView, migrateFile, pageFiles, readFacts, scan } from "./index.js";
7
+ import { addAgentsNote, agentsNoteFile, appPrivacy, check, checklist, checklistMarkdown, checklistSummary, checkOnline, CURRENT_VERSION, checkListing, knowledgeBase, setTicks, factsToYAML, initFacts, legalView, migrateFile, pageFiles, readFacts, scan } from "./index.js";
8
8
  const program = new Command()
9
9
  .name("shelf")
10
10
  .description("Get an iOS app ready for the App Store shelf: legal pages, privacy truth, preflight.")
@@ -86,6 +86,31 @@ program
86
86
  console.log(n.replace("generate the pages", "run `shelf pages`"));
87
87
  await offerAgentsNote(path, o.agentsNote);
88
88
  });
89
+ program
90
+ .command("listing")
91
+ .description("Check a live App Store listing from the outside: privacy policy, support page, EU trader details, and whether the privacy label covers the SDKs the policy names.")
92
+ .argument("<app>", "App Store link or numeric app ID")
93
+ .option("--json", "print the report as JSON")
94
+ .action(async (app, o) => {
95
+ let report;
96
+ try {
97
+ report = await checkListing(app, { fetch, kb: knowledgeBase() });
98
+ }
99
+ catch (e) {
100
+ console.error(e instanceof Error ? e.message : String(e));
101
+ process.exit(1);
102
+ }
103
+ if (o.json)
104
+ return console.log(JSON.stringify(report, null, 2));
105
+ const mark = { ok: "✓", warn: "!", error: "✗", info: "i" };
106
+ console.log(`${report.app.title} by ${report.app.seller}\n${report.app.url}\n`);
107
+ for (const f of report.findings) {
108
+ console.log(` ${mark[f.level]} ${f.title}${f.detail ? `\n ${f.detail}` : ""}${f.level !== "ok" && f.fix ? `\n → ${f.fix}` : ""}`);
109
+ }
110
+ console.log(`\n${report.passed} of ${report.total} checks pass. This only sees the public listing; \`shelf check\` in the app's repo goes further.`);
111
+ if (report.findings.some((f) => f.level === "error"))
112
+ process.exitCode = 1;
113
+ });
89
114
  program
90
115
  .command("agents")
91
116
  .description("Add a short ShelfReady note to AGENTS.md (or CLAUDE.md), so coding agents in this repo run the checks before a release.")
@@ -0,0 +1,64 @@
1
+ import type { KnowledgeEntry } from "./knowledge.js";
2
+ export interface ListingFacts {
3
+ id: string;
4
+ url: string;
5
+ title: string;
6
+ seller: string;
7
+ /** EU trader status as the listing shows it; null when the page has no EU provider section. */
8
+ trader: boolean | null;
9
+ traderDetails: {
10
+ address?: string;
11
+ phone?: string;
12
+ email?: string;
13
+ duns?: string;
14
+ };
15
+ price: number | null;
16
+ currency: string | null;
17
+ inAppPurchases: boolean;
18
+ /** Privacy label: DATA_USED_TO_TRACK_YOU, DATA_LINKED_TO_YOU, DATA_NOT_LINKED_TO_YOU or DATA_NOT_COLLECTED, with categories. */
19
+ privacy: {
20
+ type: string;
21
+ categories: string[];
22
+ }[];
23
+ privacyPolicyURL?: string;
24
+ supportURL?: string;
25
+ websiteURL?: string;
26
+ }
27
+ export type ListingLevel = "ok" | "warn" | "error" | "info";
28
+ export interface ListingFinding {
29
+ level: ListingLevel;
30
+ rule: string;
31
+ title: string;
32
+ detail?: string;
33
+ fix?: string;
34
+ }
35
+ export interface ListingReport {
36
+ app: ListingFacts;
37
+ findings: ListingFinding[];
38
+ passed: number;
39
+ total: number;
40
+ checkedAt: string;
41
+ }
42
+ export type Fetch = (url: string, init?: RequestInit) => Promise<Response>;
43
+ export declare const CATEGORY_TITLE: Record<string, string>;
44
+ export declare const categoryOfType: (t: string) => string | undefined;
45
+ /** An App Store link or a bare numeric ID → the app's ID. */
46
+ export declare function appIdFrom(input: string): string | null;
47
+ /** The German storefront shows the EU trader section; English text keeps parsing language-independent enough. */
48
+ export declare const listingURL: (id: string, storefront?: string) => string;
49
+ /** Facts from an App Store product page's HTML. Throws when the page has no listing data. */
50
+ export declare function parseListing(html: string, id: string): ListingFacts;
51
+ /** Only public http(s) URLs: no credentials, no local or private addresses. */
52
+ export declare function isPublicURL(raw: string): boolean;
53
+ export declare function htmlText(html: string): string;
54
+ /** SDKs from the knowledge base that the text names, with the label categories their manifests imply. */
55
+ export declare function sdksMentioned(text: string, kb: KnowledgeEntry[]): {
56
+ entry: KnowledgeEntry;
57
+ categories: string[];
58
+ }[];
59
+ /** Run every check on a live listing. `fetch` is injected so tests (and the Worker) control the network. */
60
+ export declare function checkListing(input: string, opts: {
61
+ fetch: Fetch;
62
+ kb?: KnowledgeEntry[];
63
+ storefront?: string;
64
+ }): Promise<ListingReport>;
@@ -0,0 +1,318 @@
1
+ export const CATEGORY_TITLE = {
2
+ CONTACT_INFO: "Contact Info", HEALTH_AND_FITNESS: "Health & Fitness", FINANCIAL_INFO: "Financial Info", LOCATION: "Location",
3
+ SENSITIVE_INFO: "Sensitive Info", CONTACTS: "Contacts", USER_CONTENT: "User Content", BROWSING_HISTORY: "Browsing History",
4
+ SEARCH_HISTORY: "Search History", IDENTIFIERS: "Identifiers", PURCHASES: "Purchases", USAGE_DATA: "Usage Data",
5
+ DIAGNOSTICS: "Diagnostics", OTHER: "Other Data",
6
+ };
7
+ /** Privacy manifest data types → the App Privacy label category they fall under. */
8
+ const TYPE_CATEGORY = {
9
+ Name: "CONTACT_INFO", EmailAddress: "CONTACT_INFO", PhoneNumber: "CONTACT_INFO", PhysicalAddress: "CONTACT_INFO", OtherUserContactInfo: "CONTACT_INFO",
10
+ Health: "HEALTH_AND_FITNESS", Fitness: "HEALTH_AND_FITNESS",
11
+ PaymentInfo: "FINANCIAL_INFO", CreditInfo: "FINANCIAL_INFO", OtherFinancialInfo: "FINANCIAL_INFO",
12
+ PreciseLocation: "LOCATION", CoarseLocation: "LOCATION", SensitiveInfo: "SENSITIVE_INFO", Contacts: "CONTACTS",
13
+ EmailsOrTextMessages: "USER_CONTENT", PhotosorVideos: "USER_CONTENT", AudioData: "USER_CONTENT", GameplayContent: "USER_CONTENT",
14
+ CustomerSupport: "USER_CONTENT", OtherUserContent: "USER_CONTENT", BrowsingHistory: "BROWSING_HISTORY", SearchHistory: "SEARCH_HISTORY",
15
+ UserID: "IDENTIFIERS", DeviceID: "IDENTIFIERS", PurchaseHistory: "PURCHASES",
16
+ ProductInteraction: "USAGE_DATA", AdvertisingData: "USAGE_DATA", OtherUsageData: "USAGE_DATA",
17
+ CrashData: "DIAGNOSTICS", PerformanceData: "DIAGNOSTICS", OtherDiagnosticData: "DIAGNOSTICS", OtherDataTypes: "OTHER",
18
+ };
19
+ export const categoryOfType = (t) => TYPE_CATEGORY[t.replace(/^NSPrivacyCollectedDataType/, "")];
20
+ /** Names that are ordinary words; only match them with their vendor in front. */
21
+ const SDK_MATCH_OVERRIDES = {
22
+ "analytics-swift": /\b(Twilio Segment|Segment\.io|segment\.com)\b/,
23
+ "realm-swift": /\bRealm (Swift|Database|Sync)\b|\bMongoDB Realm\b/,
24
+ "lottie-ios": /\bLottie\b/,
25
+ swiftsdk: /\bTelemetryDeck\b/,
26
+ };
27
+ /** An App Store link or a bare numeric ID → the app's ID. */
28
+ export function appIdFrom(input) {
29
+ const s = input.trim();
30
+ if (/^\d{5,12}$/.test(s))
31
+ return s;
32
+ const m = s.match(/(?:^|[/=])id(\d{5,12})(?:\b|$)/);
33
+ if (m && /apple\.com|^id\d/i.test(s))
34
+ return m[1];
35
+ return null;
36
+ }
37
+ /** The German storefront shows the EU trader section; English text keeps parsing language-independent enough. */
38
+ export const listingURL = (id, storefront = "de") => `https://apps.apple.com/${storefront}/app/id${id}?l=en-GB`;
39
+ function serverData(html) {
40
+ const m = html.match(/<script[^>]*id="serialized-server-data"[^>]*>([\s\S]*?)<\/script>/);
41
+ if (!m)
42
+ throw new Error("This page has no App Store listing data.");
43
+ const parsed = JSON.parse(m[1]);
44
+ const d = parsed?.data?.[0]?.data;
45
+ if (!d?.shelfMapping)
46
+ throw new Error("The App Store listing data has an unexpected shape.");
47
+ return d;
48
+ }
49
+ function jsonLd(html) {
50
+ return [...html.matchAll(/<script[^>]*type="application\/ld\+json"[^>]*>([\s\S]*?)<\/script>/g)].flatMap((m) => {
51
+ try {
52
+ return [JSON.parse(m[1])];
53
+ }
54
+ catch {
55
+ return [];
56
+ }
57
+ });
58
+ }
59
+ /** Facts from an App Store product page's HTML. Throws when the page has no listing data. */
60
+ export function parseListing(html, id) {
61
+ const d = serverData(html);
62
+ const sm = d.shelfMapping;
63
+ const product = jsonLd(html).find((x) => x.offers || x["@type"] === "SoftwareApplication") ?? {};
64
+ const info = sm.information?.items ?? [];
65
+ const texts = (i) => (i.items ?? []).filter((x) => x.linkableText).map((x) => String(x.linkableText.styledText?.rawText ?? ""));
66
+ const provider = info.find((i) => texts(i).some((t) => /identified itself as a trader|als Händler/i.test(t)));
67
+ let trader = null;
68
+ const traderDetails = {};
69
+ if (provider) {
70
+ const all = texts(provider);
71
+ trader = !all.some((t) => /has not identified itself as a trader|nicht als Händler/i.test(t));
72
+ for (const t of all) {
73
+ const m = t.match(/^\*\*([^*]+)\*\*\n([\s\S]+)$/);
74
+ if (!m)
75
+ continue;
76
+ const label = m[1].toLowerCase();
77
+ const value = m[2].trim();
78
+ if (/address|adresse/.test(label))
79
+ traderDetails.address = value;
80
+ else if (/phone|telefon/.test(label))
81
+ traderDetails.phone = value;
82
+ else if (/mail/.test(label))
83
+ traderDetails.email = value;
84
+ else if (/duns/.test(label))
85
+ traderDetails.duns = value;
86
+ }
87
+ }
88
+ // Links carry an icon and a label; which ones appear depends on what the developer filled in, so never go by position.
89
+ const links = [...(sm.description?.items?.[0]?.developerLinks ?? []), ...(sm.notPurchasedLinks?.items ?? [])]
90
+ .map((l) => ({ icon: String(l?.systemImageName ?? ""), text: String(l?.text ?? l?.title ?? ""), url: String(l?.clickAction?.url ?? "") }))
91
+ .filter((l) => l.url);
92
+ const link = (icon, text) => links.find((l) => l.icon === icon)?.url ?? links.find((l) => text.test(l.text))?.url;
93
+ const policy = Object.values((sm.privacyHeader?.items?.[0]?.bodyText?.linkedSubstrings ?? {})).map((a) => a?.url).find(Boolean) ?? link("hand.raised.fill", /privacy|datenschutz/i);
94
+ const support = link("questionmark.circle", /support|hilfe/i);
95
+ const website = link("safari", /website/i);
96
+ const offer = product.offers ?? {};
97
+ const price = typeof offer.price === "number" ? offer.price : offer.price != null ? Number(offer.price) : null;
98
+ return {
99
+ id,
100
+ url: String(d.canonicalURL ?? listingURL(id)).replace(/\?l=en-GB$/, ""),
101
+ title: String(d.title ?? product.name ?? ""),
102
+ seller: String(provider?.summary ?? product.author?.name ?? ""),
103
+ trader,
104
+ traderDetails,
105
+ price: Number.isFinite(price) ? price : null,
106
+ currency: offer.priceCurrency ?? null,
107
+ inAppPurchases: info.some((i) => /In-App Purchases|In-App-Käufe/i.test(String(i.title ?? ""))),
108
+ privacy: (sm.privacyTypes?.items ?? []).map((t) => ({ type: String(t.identifier), categories: (t.categories ?? []).map((c) => String(c.identifier)) })),
109
+ ...(policy ? { privacyPolicyURL: String(policy) } : {}),
110
+ ...(website ? { websiteURL: website } : {}),
111
+ ...(support ? { supportURL: support } : {}),
112
+ };
113
+ }
114
+ const UA = "ShelfReady listing check (+https://shelfready.dev/check/)";
115
+ /** Only public http(s) URLs: no credentials, no local or private addresses. */
116
+ export function isPublicURL(raw) {
117
+ let u;
118
+ try {
119
+ u = new URL(raw);
120
+ }
121
+ catch {
122
+ return false;
123
+ }
124
+ if (!/^https?:$/.test(u.protocol) || u.username || u.password)
125
+ return false;
126
+ const h = u.hostname.toLowerCase().replace(/^\[|\]$/g, "");
127
+ if (h === "localhost" || h.endsWith(".localhost") || h.endsWith(".local") || h.endsWith(".internal") || !h.includes("."))
128
+ return false;
129
+ if (/^(10|127|0)\.|^169\.254\.|^192\.168\.|^172\.(1[6-9]|2\d|3[01])\.|^100\.(6[4-9]|[7-9]\d|1[01]\d|12[0-7])\./.test(h))
130
+ return false;
131
+ if (h.includes(":"))
132
+ return false; // IPv6 literals
133
+ return true;
134
+ }
135
+ async function getPage(fetch, url) {
136
+ if (!isPublicURL(url))
137
+ return { url, ok: false, error: "not a public web address" };
138
+ try {
139
+ const res = await fetch(url, { headers: { "user-agent": UA, accept: "text/html,*/*;q=0.5" }, redirect: "follow", signal: AbortSignal.timeout(8000) });
140
+ const type = res.headers.get("content-type") ?? "";
141
+ let html;
142
+ if (res.ok && /html|text\/plain/.test(type)) {
143
+ const body = await res.text();
144
+ html = body.slice(0, 1_500_000);
145
+ }
146
+ return { url, ok: res.ok, status: res.status, ...(html ? { html, text: htmlText(html) } : {}) };
147
+ }
148
+ catch (e) {
149
+ const msg = e instanceof Error ? (e.name === "TimeoutError" || e.name === "AbortError" ? "timed out after 8 seconds" : e.message) : String(e);
150
+ return { url, ok: false, error: msg };
151
+ }
152
+ }
153
+ export function htmlText(html) {
154
+ return html
155
+ .replace(/<(script|style|noscript|svg)[\s\S]*?<\/\1>/gi, " ")
156
+ .replace(/<br\s*\/?>|<\/(p|div|li|h\d|tr)>/gi, "\n")
157
+ .replace(/<[^>]+>/g, " ")
158
+ .replace(/&nbsp;/g, " ")
159
+ .replace(/&amp;/g, "&")
160
+ .replace(/&#(\d+);/g, (_, n) => String.fromCharCode(Number(n)))
161
+ .replace(/[ \t]+/g, " ")
162
+ .replace(/\n\s+/g, "\n")
163
+ .trim();
164
+ }
165
+ /** What an Impressum contains (§ 5 DDG, § 25 MedienG), beyond the word itself. */
166
+ const IMPRESSUM_CONTENT = /Impressum|Imprint|Legal notice|Handelsregister|Registergericht|Amtsgericht|Firmenbuch|\bHR[AB]\s?\d|USt-?Id|VAT[- ]ID|UID-?Nr|Geschäftsführ|Managing director|Vertretungsberechtigt|Inhaber|Verantwortlich i\.?\s?S\.?\s?d/i;
167
+ const IMPRESSUM_LINK = /impressum|imprint|legal|kontakt|contact|about|ueber-uns|uber-uns|company/i;
168
+ /** The landing page itself, or one of up to four same-site pages it links as Impressum/Legal/Contact/About, that holds Impressum content. */
169
+ async function findImpressum(fetch, home) {
170
+ if (home.text && IMPRESSUM_CONTENT.test(home.text))
171
+ return home.url;
172
+ const base = new URL(home.url);
173
+ const site = base.hostname.replace(/^www\./, "");
174
+ const links = [...(home.html ?? "").matchAll(/<a\b[^>]*href=["']([^"'#]+)["'][^>]*>([\s\S]*?)<\/a>/gi)]
175
+ .filter(([, href, text]) => IMPRESSUM_LINK.test(`${href} ${htmlText(text ?? "")}`))
176
+ .map(([, href]) => {
177
+ try {
178
+ return new URL(href, base).toString();
179
+ }
180
+ catch {
181
+ return "";
182
+ }
183
+ })
184
+ .filter((u) => u && new URL(u).hostname.replace(/^www\./, "") === site);
185
+ // Impressum and Legal links first, then Contact and About.
186
+ const ranked = [...new Set(links)].sort((a, b) => Number(!/impressum|imprint|legal/i.test(a)) - Number(!/impressum|imprint|legal/i.test(b))).slice(0, 4);
187
+ for (const url of ranked) {
188
+ const page = await getPage(fetch, url);
189
+ if (page.text && IMPRESSUM_CONTENT.test(page.text))
190
+ return url;
191
+ }
192
+ return undefined;
193
+ }
194
+ const EU_DE_AT = /\b(Germany|Deutschland|Austria|Österreich)\s*$/i;
195
+ const DATE = /(\b\d{1,2}[./]\s?\d{1,2}[./]\s?\d{2,4}\b|\b\d{4}-\d{2}-\d{2}\b|\b\d{1,2}\.?\s+(January|February|March|April|May|June|July|August|September|October|November|December|Januar|Februar|März|Mai|Juni|Juli|Oktober|Dezember)\s+\d{4}\b|\b(January|February|March|April|May|June|July|August|September|October|November|December)\s+\d{1,2},?\s+\d{4}\b)/i;
196
+ /** SDKs from the knowledge base that the text names, with the label categories their manifests imply. */
197
+ export function sdksMentioned(text, kb) {
198
+ const out = [];
199
+ for (const e of kb) {
200
+ const re = SDK_MATCH_OVERRIDES[e.identity] ?? new RegExp(`\\b${e.name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}\\b`);
201
+ if (!re.test(text))
202
+ continue;
203
+ const categories = [...new Set(e.products.flatMap((p) => p.collects.map((c) => categoryOfType(c.type))).filter((c) => !!c))];
204
+ out.push({ entry: e, categories });
205
+ }
206
+ return out;
207
+ }
208
+ /** Run every check on a live listing. `fetch` is injected so tests (and the Worker) control the network. */
209
+ export async function checkListing(input, opts) {
210
+ const id = appIdFrom(input);
211
+ if (!id)
212
+ throw new Error("Paste an App Store link (apps.apple.com/…/id123456789) or the app's numeric ID.");
213
+ let res;
214
+ try {
215
+ res = await opts.fetch(listingURL(id, opts.storefront), { headers: { "user-agent": UA, "accept-language": "en-GB,en;q=0.8" }, signal: AbortSignal.timeout(10000) });
216
+ }
217
+ catch {
218
+ throw new Error("Couldn't reach the App Store. Try again in a minute.");
219
+ }
220
+ if (res.status === 404)
221
+ throw new Error(`No app with ID ${id} on the ${(opts.storefront ?? "de").toUpperCase()} App Store. It may not be released there yet.`);
222
+ if (!res.ok)
223
+ throw new Error(`The App Store answered ${res.status}. Try again in a minute.`);
224
+ const app = parseListing(await res.text(), id);
225
+ const findings = [];
226
+ const add = (f) => findings.push(f);
227
+ // Privacy policy
228
+ const [policy, support, website] = await Promise.all([
229
+ app.privacyPolicyURL ? getPage(opts.fetch, app.privacyPolicyURL) : Promise.resolve(undefined),
230
+ app.supportURL ? getPage(opts.fetch, app.supportURL) : Promise.resolve(undefined),
231
+ app.websiteURL && app.trader && EU_DE_AT.test(app.traderDetails.address ?? "") ? getPage(opts.fetch, app.websiteURL) : Promise.resolve(undefined),
232
+ ]);
233
+ if (!app.privacyPolicyURL) {
234
+ add({ level: "error", rule: "policy.missing", title: "No privacy policy link on the listing", fix: "Add a privacy policy URL in App Store Connect › App Privacy. Apple requires one for every app." });
235
+ }
236
+ else if (!policy?.ok) {
237
+ add({ level: "error", rule: "policy.unreachable", title: "Privacy policy doesn't load", detail: `${app.privacyPolicyURL}: ${policy?.error ?? `HTTP ${policy?.status}`}`, fix: "Fix the page or the URL in App Store Connect. A broken link is a common rejection reason." });
238
+ }
239
+ else {
240
+ add({ level: "ok", rule: "policy.live", title: "Privacy policy loads", detail: app.privacyPolicyURL });
241
+ if (!app.privacyPolicyURL.startsWith("https://"))
242
+ add({ level: "warn", rule: "policy.http", title: "Privacy policy isn't served over HTTPS", fix: "Serve the page over HTTPS." });
243
+ const text = policy.text ?? "";
244
+ if (text.length < 400)
245
+ add({ level: "warn", rule: "policy.thin", title: "Privacy policy page has very little text", detail: "It may be rendered by JavaScript, or be a placeholder.", fix: "Make sure the policy is readable without JavaScript." });
246
+ if (/[\w.+-]+@[\w-]+\.[\w.-]+/.test(text) || /contact|kontakt/i.test(text))
247
+ add({ level: "ok", rule: "policy.contact", title: "Privacy policy says how to reach you" });
248
+ else
249
+ add({ level: "warn", rule: "policy.contact", title: "Privacy policy gives no contact", fix: "The GDPR asks for the controller's contact details. Add an email address." });
250
+ if (/(last updated|updated on|effective|stand|zuletzt|aktualisiert|version)/i.test(text) && DATE.test(text))
251
+ add({ level: "ok", rule: "policy.date", title: "Privacy policy is dated" });
252
+ else
253
+ add({ level: "warn", rule: "policy.date", title: "Privacy policy has no date", fix: "Add a \"Last updated\" date so readers know which version they agreed to." });
254
+ }
255
+ // Support page
256
+ if (!app.supportURL)
257
+ add({ level: "error", rule: "support.missing", title: "No support link on the listing", fix: "Add a support URL in App Store Connect › App Information." });
258
+ else if (!support?.ok)
259
+ add({ level: "error", rule: "support.unreachable", title: "Support page doesn't load", detail: `${app.supportURL}: ${support?.error ?? `HTTP ${support?.status}`}`, fix: "Fix the page or the URL in App Store Connect." });
260
+ else
261
+ add({ level: "ok", rule: "support.live", title: "Support page loads", detail: app.supportURL });
262
+ // EU trader status
263
+ const charges = (app.price ?? 0) > 0 || app.inAppPurchases;
264
+ if (app.trader === null) {
265
+ add({ level: "info", rule: "trader.unknown", title: "No EU trader information on the listing", detail: "The app may not be offered in the EU." });
266
+ }
267
+ else if (app.trader) {
268
+ const missing = ["address", "phone", "email"].filter((k) => !app.traderDetails[k]);
269
+ if (missing.length)
270
+ add({ level: "warn", rule: "trader.incomplete", title: "Trader details are incomplete", detail: `Missing: ${missing.join(", ")}.`, fix: "App Store Connect › Business › Compliance: add the missing details." });
271
+ else
272
+ add({ level: "ok", rule: "trader.declared", title: "Declared as an EU trader, with address, phone and email" });
273
+ }
274
+ else if (charges) {
275
+ add({ level: "warn", rule: "trader.charging", title: `Not declared as a trader, but the app ${app.inAppPurchases ? "has in-app purchases" : "costs money"}`, detail: "Selling to EU consumers usually makes you a trader under the Digital Services Act.", fix: "Check your status and update it in App Store Connect › Business. Not legal advice." });
276
+ }
277
+ else {
278
+ add({ level: "ok", rule: "trader.non-trader", title: "Declared as a non-trader, which fits a free app" });
279
+ }
280
+ // Impressum for German and Austrian traders: on the landing page, or one click away (Impressum, Legal, Contact, About).
281
+ if (website) {
282
+ const found = await findImpressum(opts.fetch, website);
283
+ if (found)
284
+ add({ level: "ok", rule: "impressum.web", title: "Impressum found on the developer website", detail: found });
285
+ else
286
+ add({ level: "warn", rule: "impressum.web", title: "Couldn't find an Impressum on the developer website", detail: `Looked at ${app.websiteURL} and the pages it links as Impressum, Legal, Contact or About.`, fix: "German and Austrian traders need an Impressum one click from every page, on the web and inside the app. `shelf pages` writes one." });
287
+ }
288
+ // Privacy label vs what the policy names
289
+ const label = new Set(app.privacy.flatMap((p) => p.categories));
290
+ const notCollected = app.privacy.some((p) => p.type === "DATA_NOT_COLLECTED");
291
+ if (!app.privacy.length)
292
+ add({ level: "warn", rule: "label.missing", title: "No App Privacy label shown", fix: "Answer the App Privacy questions in App Store Connect." });
293
+ else
294
+ add({ level: "ok", rule: "label.present", title: notCollected ? "App Privacy label: Data Not Collected" : `App Privacy label lists ${label.size} categor${label.size === 1 ? "y" : "ies"}`, detail: [...label].map((c) => CATEGORY_TITLE[c] ?? c).join(", ") || undefined });
295
+ if (app.privacy.some((p) => p.type === "DATA_USED_TO_TRACK_YOU"))
296
+ add({ level: "info", rule: "label.tracking", title: "The label declares tracking", detail: "The app must ask for permission with App Tracking Transparency before tracking." });
297
+ if (policy?.text && opts.kb?.length) {
298
+ for (const { entry, categories } of sdksMentioned(policy.text, opts.kb)) {
299
+ const missing = categories.filter((c) => !label.has(c));
300
+ if (!categories.length)
301
+ continue;
302
+ if (missing.length) {
303
+ add({
304
+ level: "warn",
305
+ rule: "label.sdk",
306
+ title: `The policy names ${entry.name}, but the label doesn't list ${missing.map((c) => CATEGORY_TITLE[c] ?? c).join(", ")}`,
307
+ detail: `${entry.name}'s own privacy manifest declares data in ${categories.map((c) => CATEGORY_TITLE[c] ?? c).join(", ")}. See shelfready.dev/sdks/${entry.identity}/`,
308
+ fix: "If the app ships this SDK, update App Privacy in App Store Connect. `shelf store` derives the answers from your manifests.",
309
+ });
310
+ }
311
+ else {
312
+ add({ level: "ok", rule: "label.sdk", title: `The label covers what ${entry.name} declares` });
313
+ }
314
+ }
315
+ }
316
+ const scored = findings.filter((f) => f.level !== "info");
317
+ return { app, findings, passed: scored.filter((f) => f.level === "ok").length, total: scored.length, checkedAt: new Date().toISOString() };
318
+ }
package/dist/index.d.ts CHANGED
@@ -9,3 +9,4 @@ export * from "./core/online.js";
9
9
  export * from "./core/checklist.js";
10
10
  export * from "./core/knowledge.js";
11
11
  export * from "./core/agents.js";
12
+ export * from "./core/listing.js";
package/dist/index.js CHANGED
@@ -10,3 +10,4 @@ export * from "./core/online.js";
10
10
  export * from "./core/checklist.js";
11
11
  export * from "./core/knowledge.js";
12
12
  export * from "./core/agents.js";
13
+ export * from "./core/listing.js";
package/dist/mcp.js CHANGED
@@ -5,7 +5,7 @@ import { existsSync, mkdirSync, writeFileSync } from "node:fs";
5
5
  import { createRequire } from "node:module";
6
6
  import { dirname, isAbsolute, join, relative, resolve } from "node:path";
7
7
  import { createInterface } from "node:readline";
8
- import { addAgentsNote, appPrivacy, check, checklist, checklistSummary, checkOnline, CURRENT_VERSION, factsToYAML, initFacts, knowledgeBase, legalView, lookup, migrateFile, pageFiles, readFacts, scan, sdkCollects, sdkTracks, setTicks, } from "./index.js";
8
+ import { addAgentsNote, appPrivacy, check, checkListing, checklist, checklistSummary, checkOnline, CURRENT_VERSION, factsToYAML, initFacts, knowledgeBase, legalView, lookup, migrateFile, pageFiles, readFacts, scan, sdkCollects, sdkTracks, setTicks, } from "./index.js";
9
9
  const VERSION = createRequire(import.meta.url)("../package.json").version;
10
10
  const PROTOCOL_VERSIONS = ["2025-11-25", "2025-06-18", "2025-03-26", "2024-11-05"];
11
11
  const INSTRUCTIONS = `ShelfReady gets an iOS app ready for the App Store: privacy policy, support page, Impressum (DE/AT), App Privacy answers and a go-live checklist, all generated from one file, shelfready.yaml, in the app's repo.
@@ -267,6 +267,25 @@ export const TOOLS = [
267
267
  return { text, data: { found: true, entry: e, collects, tracking: sdkTracks(e) } };
268
268
  },
269
269
  },
270
+ {
271
+ name: "listing",
272
+ title: "Check a live App Store listing",
273
+ description: "Check an app that is already on the App Store, without its repo: privacy policy and support page load, the policy has a contact and a date, EU trader details are complete, German/Austrian traders link an Impressum, and the App Privacy label covers the SDKs the policy names. Takes an App Store link or numeric ID. Read-only; fetches public pages.",
274
+ inputSchema: { type: "object", properties: { app: str("App Store link (apps.apple.com/…/id123456789) or numeric app ID.") }, required: ["app"] },
275
+ annotations: { readOnlyHint: true, openWorldHint: true },
276
+ run: async (a) => {
277
+ let report;
278
+ try {
279
+ report = await checkListing(String(a.app ?? ""), { fetch, kb: knowledgeBase() });
280
+ }
281
+ catch (e) {
282
+ throw new ToolError(e instanceof Error ? e.message : String(e));
283
+ }
284
+ const mark = { ok: "✓", warn: "!", error: "✗", info: "i" };
285
+ const lines = report.findings.map((f) => `${mark[f.level]} ${f.title}${f.detail ? ` (${f.detail})` : ""}${f.level !== "ok" && f.fix ? `\n ${f.fix}` : ""}`);
286
+ return { text: `${report.app.title} by ${report.app.seller}\n${lines.join("\n")}\n\n${report.passed} of ${report.total} checks pass.`, data: report };
287
+ },
288
+ },
270
289
  {
271
290
  name: "migrate",
272
291
  title: "Migrate shelfready.yaml",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shelfready",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "description": "Get an iOS app ready for the App Store: legal pages, App Privacy answers, privacy manifests and a go-live checklist. CLI and MCP server for coding agents.",
5
5
  "type": "module",
6
6
  "bin": {