shelfready 0.2.0 → 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 +29 -8
- package/dist/cli.js +69 -7
- package/dist/core/agents.d.ts +10 -0
- package/dist/core/agents.js +32 -0
- package/dist/core/checklist.d.ts +4 -1
- package/dist/core/checklist.js +10 -4
- package/dist/core/listing.d.ts +64 -0
- package/dist/core/listing.js +318 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/mcp.js +31 -4
- package/package.json +16 -4
package/README.md
CHANGED
|
@@ -4,7 +4,15 @@ Get an iOS app ready for the App Store shelf. ShelfReady reads your repo and kee
|
|
|
4
4
|
|
|
5
5
|
It does not upload builds or fill in App Store Connect; use [`asc`](https://github.com/rudrankriyam/App-Store-Connect-CLI) or fastlane for that. ShelfReady covers the legal, privacy and web layer around them, with the EU steps most tools skip.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Try it in your app's repo, nothing to install:
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npx -y shelfready check
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Already on the App Store? Paste your link at **[shelfready.dev/check](https://shelfready.dev/check/)**.
|
|
14
|
+
|
|
15
|
+
Website, the full checklist and what common SDKs collect: **[shelfready.dev](https://shelfready.dev)**
|
|
8
16
|
|
|
9
17
|
## Quick start
|
|
10
18
|
|
|
@@ -31,19 +39,30 @@ shelf checklist --online # what's left before you submit
|
|
|
31
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 |
|
|
32
40
|
| `shelf checklist` | The go-live checklist: automatic items from `check`, manual ones you tick with `--done <id>`; `--markdown` writes it as a file |
|
|
33
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/) |
|
|
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 |
|
|
34
44
|
| `shelf mcp` | Runs the MCP server on stdio, so Claude and other agents can use all of the above |
|
|
35
45
|
|
|
36
|
-
## Use with
|
|
46
|
+
## Use with your coding agent
|
|
37
47
|
|
|
38
|
-
|
|
48
|
+
ShelfReady includes an MCP server (`shelf mcp`) and a skill, so the agent you build your app with can run the whole go-live flow: scan the repo, ask you for the publisher details it can't know, write the pages and App Privacy answers, and work through the checklist.
|
|
39
49
|
|
|
50
|
+
**Claude Code** (terminal, VS Code, JetBrains, desktop): install the plugin, which adds the skill and starts the server.
|
|
51
|
+
|
|
52
|
+
```sh
|
|
53
|
+
claude plugin marketplace add halfbatch-studio/shelfready
|
|
54
|
+
claude plugin install shelfready@shelfready
|
|
40
55
|
```
|
|
41
|
-
/plugin install shelfready --marketplace halfbatch-studio/shelfready
|
|
42
|
-
```
|
|
43
56
|
|
|
44
|
-
|
|
57
|
+
Then ask: "get this app ready for the App Store".
|
|
58
|
+
|
|
59
|
+
**Codex CLI:**
|
|
60
|
+
|
|
61
|
+
```sh
|
|
62
|
+
codex mcp add shelfready -- npx -y shelfready mcp
|
|
63
|
+
```
|
|
45
64
|
|
|
46
|
-
**
|
|
65
|
+
**Cursor, Claude Desktop, Windsurf and other MCP clients:** add this to the client's MCP config (for Cursor, `.cursor/mcp.json` in your app repo).
|
|
47
66
|
|
|
48
67
|
```json
|
|
49
68
|
{
|
|
@@ -53,7 +72,9 @@ shelf checklist --online # what's left before you submit
|
|
|
53
72
|
}
|
|
54
73
|
```
|
|
55
74
|
|
|
56
|
-
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
|
|
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`.
|
|
76
|
+
|
|
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.
|
|
57
78
|
|
|
58
79
|
## GitHub Action
|
|
59
80
|
|
package/dist/cli.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { appendFileSync, existsSync, mkdirSync, writeFileSync } from "node:fs";
|
|
3
|
-
import { join, resolve } from "node:path";
|
|
2
|
+
import { appendFileSync, existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { join, relative, resolve } from "node:path";
|
|
4
|
+
import { createInterface } from "node:readline/promises";
|
|
4
5
|
import { createRequire } from "node:module";
|
|
5
6
|
import { Command, Option } from "commander";
|
|
6
|
-
import { appPrivacy, check, checklist, checklistMarkdown, 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";
|
|
7
8
|
const program = new Command()
|
|
8
9
|
.name("shelf")
|
|
9
10
|
.description("Get an iOS app ready for the App Store shelf: legal pages, privacy truth, preflight.")
|
|
@@ -63,7 +64,9 @@ program
|
|
|
63
64
|
.addOption(new Option("--voice <voice>", "how pages speak: I (solo) or we (team)").choices(["I", "we"]).default("we"))
|
|
64
65
|
.option("--base-url <url>", "where the pages will live, e.g. https://example.com/myapp/")
|
|
65
66
|
.option("--force", "overwrite an existing shelfready.yaml")
|
|
66
|
-
.
|
|
67
|
+
.option("--agents-note", "add a ShelfReady note to AGENTS.md (or CLAUDE.md) without asking")
|
|
68
|
+
.option("--no-agents-note", "don't add the note and don't ask")
|
|
69
|
+
.action(async (path, o) => {
|
|
67
70
|
const out = factsPath(path);
|
|
68
71
|
if (existsSync(out) && !o.force) {
|
|
69
72
|
console.error(`${out} exists. Use --force to overwrite.`);
|
|
@@ -81,7 +84,67 @@ program
|
|
|
81
84
|
console.log(`Wrote ${out}`);
|
|
82
85
|
for (const n of result.notes)
|
|
83
86
|
console.log(n.replace("generate the pages", "run `shelf pages`"));
|
|
87
|
+
await offerAgentsNote(path, o.agentsNote);
|
|
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;
|
|
84
113
|
});
|
|
114
|
+
program
|
|
115
|
+
.command("agents")
|
|
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.")
|
|
117
|
+
.argument("[path]", "app repository", ".")
|
|
118
|
+
.action((path) => reportAgentsNote(addAgentsNote(path)));
|
|
119
|
+
/** A path to show: relative to where you are, unless that climbs out of it. */
|
|
120
|
+
const shown = (file) => {
|
|
121
|
+
const rel = relative(process.cwd(), file);
|
|
122
|
+
return rel && !rel.startsWith("..") ? rel : file;
|
|
123
|
+
};
|
|
124
|
+
function reportAgentsNote(r) {
|
|
125
|
+
const name = shown(r.file);
|
|
126
|
+
console.log(r.action === "present" ? `${name} already has the ShelfReady note.` : `${r.action === "created" ? "Created" : "Added the ShelfReady note to"} ${name}.`);
|
|
127
|
+
}
|
|
128
|
+
async function offerAgentsNote(path, choice) {
|
|
129
|
+
if (choice === false)
|
|
130
|
+
return;
|
|
131
|
+
const target = agentsNoteFile(path);
|
|
132
|
+
if (existsSync(target) && readFileSync(target, "utf8").includes("<!-- shelfready -->"))
|
|
133
|
+
return;
|
|
134
|
+
const file = shown(target);
|
|
135
|
+
if (choice === undefined) {
|
|
136
|
+
if (!process.stdin.isTTY || !process.stdout.isTTY) {
|
|
137
|
+
console.log(`Tip: \`shelf agents\` adds a note to ${file} so coding agents in this repo run \`shelf check\` before a release.`);
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
141
|
+
const answer = await rl.question(`Add a ShelfReady note to ${file}, so coding agents (Claude Code, Codex, Cursor, Xcode) run the checks before a release? [Y/n] `);
|
|
142
|
+
rl.close();
|
|
143
|
+
if (/^n/i.test(answer.trim()))
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
reportAgentsNote(addAgentsNote(path));
|
|
147
|
+
}
|
|
85
148
|
program
|
|
86
149
|
.command("pages")
|
|
87
150
|
.description("Generate privacy policy, support page and Impressum (DE/AT) as Markdown; --swiftui adds LegalView.swift.")
|
|
@@ -196,7 +259,7 @@ program
|
|
|
196
259
|
console.log(md);
|
|
197
260
|
return;
|
|
198
261
|
}
|
|
199
|
-
const icon = { done: "✓", todo: "○", fail: "✗" };
|
|
262
|
+
const icon = { done: "✓", todo: "○", fail: "✗", unchecked: "?" };
|
|
200
263
|
for (const group of [...new Set(rows.map((r) => r.group))]) {
|
|
201
264
|
console.log(`\n${group}`);
|
|
202
265
|
for (const r of rows.filter((x) => x.group === group)) {
|
|
@@ -206,8 +269,7 @@ program
|
|
|
206
269
|
console.log(` ${r.how}`);
|
|
207
270
|
}
|
|
208
271
|
}
|
|
209
|
-
|
|
210
|
-
console.log(`\n${done} of ${rows.length} done.${rows.some((r) => !r.automatic && r.status !== "done") ? " Tick manual items with: shelf checklist --done <id>" : ""}`);
|
|
272
|
+
console.log(`\n${checklistSummary(rows)}${rows.some((r) => !r.automatic && r.status !== "done") ? " Tick manual items with: shelf checklist --done <id>" : ""}`);
|
|
211
273
|
});
|
|
212
274
|
program
|
|
213
275
|
.command("migrate")
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** The note every coding agent in the repo reads (AGENTS.md, or CLAUDE.md when that's what the repo uses). */
|
|
2
|
+
export declare const AGENTS_NOTE = "<!-- shelfready -->\n## App Store release (ShelfReady)\n\nThe privacy policy, support page, Impressum and App Privacy answers are generated by [ShelfReady](https://shelfready.dev) from `shelfready.yaml`.\n\n- Before a release, or after adding an SDK, a permission or a privacy manifest: run `npx -y shelfready check` and fix what it reports.\n- Edit `shelfready.yaml`, never the generated pages; regenerate them with `npx -y shelfready pages`.\n- What's left before submitting: `npx -y shelfready checklist --online`.\n";
|
|
3
|
+
export interface AgentsNoteResult {
|
|
4
|
+
file: string;
|
|
5
|
+
action: "created" | "appended" | "present";
|
|
6
|
+
}
|
|
7
|
+
/** Which file gets the note: AGENTS.md if present, else CLAUDE.md if present, else a new AGENTS.md. */
|
|
8
|
+
export declare function agentsNoteFile(root: string): string;
|
|
9
|
+
/** Add the ShelfReady note once. Idempotent: does nothing if the note is already there. */
|
|
10
|
+
export declare function addAgentsNote(root: string): AgentsNoteResult;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
const MARKER = "<!-- shelfready -->";
|
|
4
|
+
/** The note every coding agent in the repo reads (AGENTS.md, or CLAUDE.md when that's what the repo uses). */
|
|
5
|
+
export const AGENTS_NOTE = `${MARKER}
|
|
6
|
+
## App Store release (ShelfReady)
|
|
7
|
+
|
|
8
|
+
The privacy policy, support page, Impressum and App Privacy answers are generated by [ShelfReady](https://shelfready.dev) from \`shelfready.yaml\`.
|
|
9
|
+
|
|
10
|
+
- Before a release, or after adding an SDK, a permission or a privacy manifest: run \`npx -y shelfready check\` and fix what it reports.
|
|
11
|
+
- Edit \`shelfready.yaml\`, never the generated pages; regenerate them with \`npx -y shelfready pages\`.
|
|
12
|
+
- What's left before submitting: \`npx -y shelfready checklist --online\`.
|
|
13
|
+
`;
|
|
14
|
+
/** Which file gets the note: AGENTS.md if present, else CLAUDE.md if present, else a new AGENTS.md. */
|
|
15
|
+
export function agentsNoteFile(root) {
|
|
16
|
+
const agents = join(root, "AGENTS.md");
|
|
17
|
+
const claude = join(root, "CLAUDE.md");
|
|
18
|
+
return existsSync(agents) || !existsSync(claude) ? agents : claude;
|
|
19
|
+
}
|
|
20
|
+
/** Add the ShelfReady note once. Idempotent: does nothing if the note is already there. */
|
|
21
|
+
export function addAgentsNote(root) {
|
|
22
|
+
const file = agentsNoteFile(root);
|
|
23
|
+
if (!existsSync(file)) {
|
|
24
|
+
writeFileSync(file, `# Agent notes\n\n${AGENTS_NOTE}`);
|
|
25
|
+
return { file, action: "created" };
|
|
26
|
+
}
|
|
27
|
+
const text = readFileSync(file, "utf8");
|
|
28
|
+
if (text.includes(MARKER) || text.includes("npx -y shelfready check"))
|
|
29
|
+
return { file, action: "present" };
|
|
30
|
+
writeFileSync(file, `${text.replace(/\s*$/, "")}\n\n${AGENTS_NOTE}`);
|
|
31
|
+
return { file, action: "appended" };
|
|
32
|
+
}
|
package/dist/core/checklist.d.ts
CHANGED
|
@@ -6,7 +6,8 @@ import type { ScanResult } from "./scan.js";
|
|
|
6
6
|
* from `check` (and `check --online`); the rest are manual and ticked with `shelf checklist --done <id>`,
|
|
7
7
|
* which stores the date in shelfready.yaml.
|
|
8
8
|
*/
|
|
9
|
-
|
|
9
|
+
/** `unchecked`: an automatic item that needs `--online` and wasn't verified this run. */
|
|
10
|
+
export type Status = "done" | "todo" | "fail" | "unchecked";
|
|
10
11
|
export interface Context {
|
|
11
12
|
facts: Facts;
|
|
12
13
|
scan: ScanResult;
|
|
@@ -41,4 +42,6 @@ export declare function checklist(c: Context): ChecklistRow[];
|
|
|
41
42
|
export declare function checklistMarkdown(rows: ChecklistRow[], appName: string): string;
|
|
42
43
|
/** Tick or untick manual items in shelfready.yaml, keeping comments and style. Returns the new file text. */
|
|
43
44
|
export declare function setTicks(path: string, ids: string[], done: boolean, date?: string): string;
|
|
45
|
+
/** "15 of 18 done." plus how many live-page items weren't checked. */
|
|
46
|
+
export declare function checklistSummary(rows: ChecklistRow[]): string;
|
|
44
47
|
export {};
|
package/dist/core/checklist.js
CHANGED
|
@@ -8,7 +8,7 @@ const de = (f) => needsImpressum(f);
|
|
|
8
8
|
function onlineItem(page) {
|
|
9
9
|
return (c) => {
|
|
10
10
|
if (!c.online)
|
|
11
|
-
return { status: "
|
|
11
|
+
return { status: "unchecked", detail: "not checked; run with --online" };
|
|
12
12
|
const f = c.online.filter((x) => x.rule.startsWith(`online.${page}`));
|
|
13
13
|
if (f.some((x) => x.level === "error"))
|
|
14
14
|
return { status: "fail", detail: f.find((x) => x.level === "error").message };
|
|
@@ -134,7 +134,7 @@ export function checklist(c) {
|
|
|
134
134
|
return ITEMS.filter((i) => !i.applies || i.applies(c.facts)).map((i) => {
|
|
135
135
|
if (i.auto) {
|
|
136
136
|
const r = i.auto(c);
|
|
137
|
-
return { id: i.id, group: i.group, title: i.title, status: r.status, automatic: true, ...(r.detail ? { detail: r.detail } : {}), ...(r.status !== "done" ? { how: i.how(c) } : {}) };
|
|
137
|
+
return { id: i.id, group: i.group, title: i.title, status: r.status, automatic: true, ...(r.detail ? { detail: r.detail } : {}), ...(r.status !== "done" && r.status !== "unchecked" ? { how: i.how(c) } : {}) };
|
|
138
138
|
}
|
|
139
139
|
const date = ticks[i.id];
|
|
140
140
|
return date
|
|
@@ -143,11 +143,11 @@ export function checklist(c) {
|
|
|
143
143
|
});
|
|
144
144
|
}
|
|
145
145
|
export function checklistMarkdown(rows, appName) {
|
|
146
|
-
const out = [`# ${appName} go-live checklist`, "", `_${rows
|
|
146
|
+
const out = [`# ${appName} go-live checklist`, "", `_${checklistSummary(rows)} Generated by \`shelf checklist --markdown\`._`, ""];
|
|
147
147
|
for (const group of [...new Set(rows.map((r) => r.group))]) {
|
|
148
148
|
out.push(`## ${group}`, "");
|
|
149
149
|
for (const r of rows.filter((x) => x.group === group)) {
|
|
150
|
-
const note = r.status === "done" ? (r.detail ? ` (${r.detail})` : "") : r.how ? `: ${r.how}` : "";
|
|
150
|
+
const note = r.status === "done" || r.status === "unchecked" ? (r.detail ? ` (${r.detail})` : "") : r.how ? `: ${r.how}` : "";
|
|
151
151
|
out.push(`- [${r.status === "done" ? "x" : " "}] **${r.title}**${note}${r.automatic ? "" : ` \`${r.id}\``}`);
|
|
152
152
|
}
|
|
153
153
|
out.push("");
|
|
@@ -174,3 +174,9 @@ export function setTicks(path, ids, done, date = new Date().toISOString().slice(
|
|
|
174
174
|
}
|
|
175
175
|
return doc.toString({ lineWidth: 100, indentSeq: usesIndentedLists(text) });
|
|
176
176
|
}
|
|
177
|
+
/** "15 of 18 done." plus how many live-page items weren't checked. */
|
|
178
|
+
export function checklistSummary(rows) {
|
|
179
|
+
const done = rows.filter((r) => r.status === "done").length;
|
|
180
|
+
const unchecked = rows.filter((r) => r.status === "unchecked").length;
|
|
181
|
+
return `${done} of ${rows.length} done.${unchecked ? ` ${unchecked} not checked: live pages are only verified with --online.` : ""}`;
|
|
182
|
+
}
|
|
@@ -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(/ /g, " ")
|
|
159
|
+
.replace(/&/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
package/dist/index.js
CHANGED
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 { appPrivacy, check, checklist, 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.
|
|
@@ -96,6 +96,7 @@ export const TOOLS = [
|
|
|
96
96
|
voice: { type: "string", enum: ["I", "we"], description: "How pages speak: I (solo developer) or we (team)." },
|
|
97
97
|
baseUrl: str("Where the pages will live, e.g. https://example.com/myapp/"),
|
|
98
98
|
force: bool("Overwrite an existing shelfready.yaml."),
|
|
99
|
+
agentsNote: bool("Also add a short ShelfReady note to AGENTS.md (or CLAUDE.md, if the repo uses that) so coding agents run the checks before a release. Ask the developer first."),
|
|
99
100
|
},
|
|
100
101
|
required: ["country", "email"],
|
|
101
102
|
},
|
|
@@ -114,7 +115,13 @@ export const TOOLS = [
|
|
|
114
115
|
}
|
|
115
116
|
const yaml = factsToYAML(result.facts);
|
|
116
117
|
writeFileSync(out, yaml);
|
|
117
|
-
|
|
118
|
+
const lines = [`Wrote ${out}`, ...result.notes];
|
|
119
|
+
let agents;
|
|
120
|
+
if (a.agentsNote === true) {
|
|
121
|
+
agents = addAgentsNote(root);
|
|
122
|
+
lines.push(agents.action === "present" ? `${relative(root, agents.file)} already has the ShelfReady note.` : `${agents.action === "created" ? "Created" : "Added the ShelfReady note to"} ${relative(root, agents.file)}.`);
|
|
123
|
+
}
|
|
124
|
+
return { text: lines.join("\n"), data: { file: out, notes: result.notes, yaml, ...(agents ? { agentsNote: agents } : {}) } };
|
|
118
125
|
},
|
|
119
126
|
},
|
|
120
127
|
{
|
|
@@ -138,10 +145,11 @@ export const TOOLS = [
|
|
|
138
145
|
run: async (a) => {
|
|
139
146
|
const r = await findingsFor(repo(a), a.online === true);
|
|
140
147
|
const rows = checklist({ facts: r.facts, scan: r.scan, findings: check(r.facts, r.scan, { fileVersion: r.fileVersion }), ...(r.onlineFindings ? { online: r.onlineFindings } : {}) });
|
|
141
|
-
const mark = { done: "✓", todo: "○", fail: "✗" };
|
|
148
|
+
const mark = { done: "✓", todo: "○", fail: "✗", unchecked: "?" };
|
|
142
149
|
const lines = rows.map((x) => `${mark[x.status]} ${x.title}${x.detail ? ` (${x.detail})` : ""}${x.automatic ? "" : ` [${x.id}]`}${x.status !== "done" && x.how ? `\n ${x.how}` : ""}`);
|
|
143
150
|
const done = rows.filter((x) => x.status === "done").length;
|
|
144
|
-
|
|
151
|
+
const unchecked = rows.filter((x) => x.status === "unchecked").length;
|
|
152
|
+
return { text: `${lines.join("\n")}\n\n${checklistSummary(rows).replace("--online", "online: true")}`, data: { done, unchecked, total: rows.length, items: rows } };
|
|
145
153
|
},
|
|
146
154
|
},
|
|
147
155
|
{
|
|
@@ -259,6 +267,25 @@ export const TOOLS = [
|
|
|
259
267
|
return { text, data: { found: true, entry: e, collects, tracking: sdkTracks(e) } };
|
|
260
268
|
},
|
|
261
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
|
+
},
|
|
262
289
|
{
|
|
263
290
|
name: "migrate",
|
|
264
291
|
title: "Migrate shelfready.yaml",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shelfready",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Get an iOS app ready for the App Store
|
|
3
|
+
"version": "0.3.0",
|
|
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": {
|
|
7
7
|
"shelf": "dist/cli.js",
|
|
@@ -58,6 +58,18 @@
|
|
|
58
58
|
"gdpr",
|
|
59
59
|
"app-privacy",
|
|
60
60
|
"cli",
|
|
61
|
-
"fastlane"
|
|
62
|
-
|
|
61
|
+
"fastlane",
|
|
62
|
+
"mcp",
|
|
63
|
+
"mcp-server",
|
|
64
|
+
"model-context-protocol",
|
|
65
|
+
"claude",
|
|
66
|
+
"claude-code",
|
|
67
|
+
"codex",
|
|
68
|
+
"cursor",
|
|
69
|
+
"ai-agents",
|
|
70
|
+
"swift",
|
|
71
|
+
"xcode",
|
|
72
|
+
"app-store-connect"
|
|
73
|
+
],
|
|
74
|
+
"mcpName": "io.github.halfbatch-studio/shelfready"
|
|
63
75
|
}
|