shelfready 0.0.0-stage → 0.1.1

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.
Files changed (49) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +5 -0
  3. package/README.md +77 -2
  4. package/dist/cli.d.ts +2 -0
  5. package/dist/cli.js +272 -0
  6. package/dist/core/appPrivacy.d.ts +20 -0
  7. package/dist/core/appPrivacy.js +73 -0
  8. package/dist/core/check.d.ts +15 -0
  9. package/dist/core/check.js +151 -0
  10. package/dist/core/checklist.d.ts +44 -0
  11. package/dist/core/checklist.js +176 -0
  12. package/dist/core/facts.d.ts +103 -0
  13. package/dist/core/facts.js +97 -0
  14. package/dist/core/knowledge.d.ts +29 -0
  15. package/dist/core/knowledge.js +35 -0
  16. package/dist/core/legalView.d.ts +6 -0
  17. package/dist/core/legalView.js +39 -0
  18. package/dist/core/migrate.d.ts +24 -0
  19. package/dist/core/migrate.js +66 -0
  20. package/dist/core/online.d.ts +20 -0
  21. package/dist/core/online.js +76 -0
  22. package/dist/core/pages.d.ts +17 -0
  23. package/dist/core/pages.js +124 -0
  24. package/dist/core/scan.d.ts +55 -0
  25. package/dist/core/scan.js +215 -0
  26. package/dist/index.d.ts +10 -0
  27. package/dist/index.js +11 -0
  28. package/knowledge/sdks/adaptysdk-ios.yaml +29 -0
  29. package/knowledge/sdks/alamofire.yaml +15 -0
  30. package/knowledge/sdks/amplitude-swift.yaml +32 -0
  31. package/knowledge/sdks/analytics-swift.yaml +39 -0
  32. package/knowledge/sdks/bugsnag-cocoa.yaml +42 -0
  33. package/knowledge/sdks/dd-sdk-ios.yaml +60 -0
  34. package/knowledge/sdks/facebook-ios-sdk.yaml +120 -0
  35. package/knowledge/sdks/firebase-ios-sdk.yaml +115 -0
  36. package/knowledge/sdks/googlesignin-ios.yaml +65 -0
  37. package/knowledge/sdks/kingfisher.yaml +15 -0
  38. package/knowledge/sdks/lottie-ios.yaml +18 -0
  39. package/knowledge/sdks/mixpanel-swift.yaml +19 -0
  40. package/knowledge/sdks/onesignal-ios-sdk.yaml +122 -0
  41. package/knowledge/sdks/posthog-ios.yaml +43 -0
  42. package/knowledge/sdks/purchases-ios.yaml +24 -0
  43. package/knowledge/sdks/realm-swift.yaml +24 -0
  44. package/knowledge/sdks/sdwebimage.yaml +15 -0
  45. package/knowledge/sdks/sentry-cocoa.yaml +32 -0
  46. package/knowledge/sdks/supabase-swift.yaml +19 -0
  47. package/knowledge/sdks/superwall-ios.yaml +22 -0
  48. package/knowledge/sdks/swiftsdk.yaml +29 -0
  49. package/package.json +60 -4
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,5 @@
1
+ ShelfReady
2
+ Copyright 2026 Half Batch
3
+
4
+ This product is licensed under the Apache License, Version 2.0 (see LICENSE).
5
+ "ShelfReady" and "Half Batch" are names of Half Batch; the license does not grant permission to use them (section 6).
package/README.md CHANGED
@@ -1,3 +1,78 @@
1
- # Temporary Holding Version
1
+ # ShelfReady
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Get an iOS app ready for the App Store shelf. ShelfReady reads your repo and keeps the non-code parts of a release honest: the privacy policy, support page and Impressum, your App Privacy answers, and a go-live checklist. In CI it fails the build when a new SDK or data type isn't covered by your policy.
4
+
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
+
7
+ Website and the full checklist: **[shelfready.dev](https://shelfready.dev)**
8
+
9
+ ## Quick start
10
+
11
+ ```sh
12
+ brew install halfbatch-studio/tap/shelfready # or: npm install -g shelfready (Node 20+)
13
+
14
+ cd ~/path/to/your-app
15
+ shelf init --country DE --email support@example.com --brand "Your Studio" --voice I --base-url https://example.com/app/
16
+ # review shelfready.yaml: add privacy notes and FAQ
17
+ shelf pages --swiftui MyApp/LegalView.swift # privacy, support, Impressum + in-app view
18
+ shelf store # fastlane/app_privacy_details.json
19
+ shelf check --ci # fails on drift
20
+ shelf checklist --online # what's left before you submit
21
+ ```
22
+
23
+ ## Commands
24
+
25
+ | Command | What it does |
26
+ |---|---|
27
+ | `shelf scan` | Reads bundle IDs, display names, permission texts (Info.plist and `INFOPLIST_KEY_*`), privacy manifests (XML or binary), export compliance, and packages from Package.resolved, Podfile.lock and Cartfile.resolved |
28
+ | `shelf init` | Writes `shelfready.yaml` from the scan plus your publisher details; known SDKs add what they collect |
29
+ | `shelf pages` | Privacy policy, support page and Impressum (Germany and Austria) as Markdown with Jekyll front matter; `--swiftui` writes a `LegalView` for the in-app Impressum |
30
+ | `shelf store` | App Privacy answers in fastlane's `app_privacy_details.json` format; data types without an App Store Connect category are reported, never guessed |
31
+ | `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
+ | `shelf checklist` | The go-live checklist: automatic items from `check`, manual ones you tick with `--done <id>`; `--markdown` writes it as a file |
33
+ | `shelf migrate` | Updates `shelfready.yaml` to the current schema, keeping your comments and style |
34
+
35
+ ## GitHub Action
36
+
37
+ ```yaml
38
+ # .github/workflows/shelfready.yml
39
+ name: ShelfReady
40
+ on: [push, pull_request]
41
+ jobs:
42
+ check:
43
+ runs-on: ubuntu-latest
44
+ steps:
45
+ - uses: actions/checkout@v4
46
+ - uses: halfbatch-studio/shelfready@v0
47
+ with:
48
+ online: "false" # "true" also checks the live pages
49
+ ```
50
+
51
+ Inputs: `path` (folder with `shelfready.yaml`, default `.`), `online` (default `false`), `fail-on-error` (default `true`). Findings appear as annotations and in the job summary.
52
+
53
+ ## What ShelfReady knows about SDKs
54
+
55
+ `cli/knowledge/` describes 21 common SDKs (Firebase, RevenueCat, Sentry, Mixpanel, Amplitude, PostHog, Facebook, OneSignal, Bugsnag, Datadog, Segment, TelemetryDeck, Adapty, Superwall, Google Sign-In, Supabase, Alamofire, Kingfisher, SDWebImage, Lottie, Realm). Every entry is generated from the SDK's own privacy manifest and records the commit it came from; `npm run kb:import` refreshes them. Additions are welcome: add the SDK to `cli/knowledge/sources.yaml` and run the import.
56
+
57
+ ## Config: `shelfready.yaml`
58
+
59
+ One file in your app repo holds the facts behind your pages: app, publisher (`voice: I` or `we`, trader status, Impressum details), collected data, privacy notes, FAQ, page URLs and checklist ticks. It's versioned: when ShelfReady changes the format, `shelf migrate` updates the file and lists what to review. See [`examples/kipple`](examples/kipple) for a real one and its generated output.
60
+
61
+ ## Status and limits
62
+
63
+ - Version 0.1. Used to ship [kipple](https://halfbatch.studio/kipple/); expect rough edges.
64
+ - **Not legal advice.** Page templates are drafts based on § 5 DDG, the GDPR and Apple's rules, not yet reviewed by a lawyer. You're responsible for what your pages say.
65
+ - iOS only for now.
66
+
67
+ ## Repository
68
+
69
+ ```
70
+ cli/ the `shelf` CLI and its core library (TypeScript), tests, SDK knowledge base
71
+ site/ shelfready.dev, generated from the same checklist items as the CLI
72
+ examples/ real configs and output
73
+ action.yml the GitHub Action
74
+ ```
75
+
76
+ ## License
77
+
78
+ [Apache-2.0](LICENSE) © Half Batch. The license covers the code, not the names: "ShelfReady" and "Half Batch" aren't licensed for use by forks (see [NOTICE](NOTICE)).
package/dist/cli.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/dist/cli.js ADDED
@@ -0,0 +1,272 @@
1
+ #!/usr/bin/env node
2
+ import { appendFileSync, existsSync, mkdirSync, writeFileSync } from "node:fs";
3
+ import { join, resolve } from "node:path";
4
+ import { createRequire } from "node:module";
5
+ import { Command, Option } from "commander";
6
+ import { appPrivacy, check, checklist, checklistMarkdown, checkOnline, CURRENT_VERSION, setTicks, factsFromScan, factsToYAML, legalView, migrateFile, needsImpressum, readFacts, renderPages, scan } from "./index.js";
7
+ const program = new Command()
8
+ .name("shelf")
9
+ .description("Get an iOS app ready for the App Store shelf: legal pages, privacy truth, preflight.")
10
+ .version(createRequire(import.meta.url)("../package.json").version);
11
+ const list = (items) => (items.length ? items.join(", ") : "—");
12
+ const factsPath = (repo) => join(resolve(repo), "shelfready.yaml");
13
+ function requireLoaded(repo) {
14
+ const path = factsPath(repo);
15
+ if (!existsSync(path)) {
16
+ console.error(`No shelfready.yaml in ${resolve(repo)}. Run \`shelf init\` first.`);
17
+ process.exit(1);
18
+ }
19
+ try {
20
+ const loaded = readFacts(path);
21
+ if (loaded.fileVersion < CURRENT_VERSION) {
22
+ console.warn(`! shelfready.yaml is schema v${loaded.fileVersion}; using it as v${CURRENT_VERSION} in memory. Run \`shelf migrate\` to update the file.`);
23
+ }
24
+ return loaded;
25
+ }
26
+ catch (e) {
27
+ console.error(String(e instanceof Error ? e.message : e));
28
+ process.exit(1);
29
+ }
30
+ }
31
+ const requireFacts = (repo) => requireLoaded(repo).facts;
32
+ program
33
+ .command("scan")
34
+ .description("Read the repo: bundle IDs, purpose strings, privacy manifests, packages.")
35
+ .argument("[path]", "app repository", ".")
36
+ .option("--json", "print JSON")
37
+ .action((path, opts) => {
38
+ const r = scan(path);
39
+ if (opts.json)
40
+ return console.log(JSON.stringify(r, null, 2));
41
+ console.log(`Projects: ${list(r.xcodeProjects)}`);
42
+ console.log(`Bundle IDs: ${list(r.bundleIdentifiers)}`);
43
+ console.log(`Display names: ${list(r.displayNames)}`);
44
+ console.log(`Purpose strings: ${list(Object.keys(r.purposeStrings).sort())}`);
45
+ console.log(`Packages: ${list(r.packages.map((p) => `${p.identity} ${p.version ?? ""}`.trim()))}`);
46
+ console.log(`Privacy manifests: ${r.privacyManifests.length}`);
47
+ for (const m of r.privacyManifests) {
48
+ console.log(` ${m.path}`);
49
+ console.log(` tracking: ${m.tracking} collected: ${list(m.collectedDataTypes.map((c) => c.type))}`);
50
+ console.log(` required-reason APIs: ${list(m.accessedAPIs.map((a) => `${a.category} ${a.reasons.join(",")}`))}`);
51
+ }
52
+ });
53
+ program
54
+ .command("init")
55
+ .description("Scan the repo and write shelfready.yaml for you to confirm.")
56
+ .argument("[path]", "app repository", ".")
57
+ .requiredOption("--country <code>", "publisher country, ISO code (e.g. DE)")
58
+ .requiredOption("--email <email>", "public contact email")
59
+ .option("--brand <name>", "brand or studio shown on pages")
60
+ .option("--publisher <name>", "legal name (required for traders)")
61
+ .option("--trader", "declare EU trader status (charging for the app or in-app purchases)")
62
+ .option("--phone <number>", "second contact channel for traders")
63
+ .addOption(new Option("--voice <voice>", "how pages speak: I (solo) or we (team)").choices(["I", "we"]).default("we"))
64
+ .option("--base-url <url>", "where the pages will live, e.g. https://example.com/myapp/")
65
+ .option("--force", "overwrite an existing shelfready.yaml")
66
+ .action((path, o) => {
67
+ const out = factsPath(path);
68
+ if (existsSync(out) && !o.force) {
69
+ console.error(`${out} exists. Use --force to overwrite.`);
70
+ process.exit(1);
71
+ }
72
+ if (o.trader && !o.publisher) {
73
+ console.error("Traders must give a legal name with --publisher.");
74
+ process.exit(1);
75
+ }
76
+ const facts = factsFromScan(scan(path), {
77
+ country: o.country,
78
+ email: o.email,
79
+ ...(o.brand ? { brand: o.brand } : {}),
80
+ ...(o.publisher ? { name: o.publisher } : {}),
81
+ trader: !!o.trader,
82
+ voice: o.voice,
83
+ });
84
+ if (o.baseUrl)
85
+ facts.pages.baseURL = o.baseUrl;
86
+ if (facts.publisher.trader && needsImpressum(facts)) {
87
+ Object.assign(facts.publisher, { phone: o.phone ?? "", contactURL: "", vatId: "", legalForm: "", representative: "", register: { court: "", number: "" } });
88
+ }
89
+ writeFileSync(out, factsToYAML(facts));
90
+ console.log(`Wrote ${out}`);
91
+ if (needsImpressum(facts))
92
+ console.log(`Country ${facts.publisher.country} needs an Impressum on the web and inside the app.`);
93
+ if (facts.publisher.trader)
94
+ console.log("Traders: add a business address under publisher.address (never a home address).");
95
+ if (facts.publisher.trader && needsImpressum(facts))
96
+ console.log("DE/AT traders: fill phone or contactURL, vatId, and for companies legalForm, representative and register. Then show LegalView in the app.");
97
+ console.log("Next: add privacyNotes and support.faq, then run `shelf pages`.");
98
+ });
99
+ program
100
+ .command("pages")
101
+ .description("Generate privacy policy, support page and Impressum (DE/AT) as Markdown; --swiftui adds LegalView.swift.")
102
+ .argument("[path]", "app repository", ".")
103
+ .option("--out <dir>", "output folder", "shelfready/pages")
104
+ .option("--swiftui <file>", "also write a SwiftUI LegalView to this file")
105
+ .addOption(new Option("--front-matter <kind>", "front matter for static site generators").choices(["none", "jekyll"]).default("jekyll"))
106
+ .action((path, o) => {
107
+ const facts = requireFacts(path);
108
+ const dir = resolve(path, o.out);
109
+ mkdirSync(dir, { recursive: true });
110
+ for (const page of renderPages(facts)) {
111
+ const permalink = facts.pages.baseURL ? new URL(page.path, facts.pages.baseURL.replace(/\/?$/, "/")).pathname : "";
112
+ const front = o.frontMatter === "jekyll"
113
+ ? `---\nlayout: default\ntitle: ${JSON.stringify(page.title)}\n${permalink ? `permalink: ${permalink}\n` : ""}---\n\n`
114
+ : "";
115
+ const banner = "<!-- Generated by ShelfReady (`shelf pages`) from shelfready.yaml. Edit that file, not this page. -->\n\n";
116
+ writeFileSync(join(dir, page.file), front + banner + page.markdown);
117
+ console.log(`Wrote ${join(o.out, page.file)}`);
118
+ }
119
+ if (o.swiftui) {
120
+ if (!facts.pages.baseURL)
121
+ console.warn("pages.baseURL is empty; the LegalView links will be relative and won't open.");
122
+ writeFileSync(resolve(path, o.swiftui), legalView(facts));
123
+ console.log(`Wrote ${o.swiftui}`);
124
+ }
125
+ });
126
+ program
127
+ .command("store")
128
+ .description("App Store Connect helpers. --privacy-json writes fastlane's app_privacy_details.json.")
129
+ .argument("[path]", "app repository", ".")
130
+ .option("--privacy-json [file]", "write App Privacy answers for fastlane", "fastlane/app_privacy_details.json")
131
+ .action((path, o) => {
132
+ const facts = requireFacts(path);
133
+ const file = resolve(path, typeof o.privacyJson === "string" ? o.privacyJson : "fastlane/app_privacy_details.json");
134
+ const { entries, unmapped } = appPrivacy(facts);
135
+ mkdirSync(resolve(file, ".."), { recursive: true });
136
+ writeFileSync(file, JSON.stringify(entries, null, 2) + "\n");
137
+ console.log(`Wrote ${file}`);
138
+ if (unmapped.length)
139
+ console.warn(`Answer by hand in App Store Connect: ${unmapped.join(", ")}`);
140
+ console.log("Upload with: fastlane run upload_app_privacy_details_to_app_store json_path:" + file);
141
+ console.log("URLs, age rating and submission: use `asc` (not wrapped yet).");
142
+ });
143
+ program
144
+ .command("check")
145
+ .description("Preflight: shelfready.yaml vs the repo, manifests, purpose strings, Impressum. --online also checks the live pages. --ci exits 1 on errors.")
146
+ .argument("[path]", "app repository", ".")
147
+ .option("--online", "check that the pages are live and show what shelfready.yaml says")
148
+ .option("--ci", "exit with code 1 when there are errors")
149
+ .option("--json", "print JSON")
150
+ .addOption(new Option("--format <format>", "output format").choices(["text", "json", "github"]).default("text"))
151
+ .action(async (path, o) => {
152
+ const { facts, fileVersion } = requireLoaded(path);
153
+ let findings = check(facts, scan(path), { fileVersion });
154
+ if (o.online) {
155
+ const online = await checkOnline(facts);
156
+ findings = [...findings.filter((f) => f.level !== "ok"), ...online];
157
+ if (!findings.some((f) => f.level !== "ok"))
158
+ findings.unshift({ level: "ok", rule: "all", message: "shelfready.yaml matches the repo." });
159
+ }
160
+ const format = o.json ? "json" : o.format;
161
+ if (format === "json")
162
+ console.log(JSON.stringify(findings, null, 2));
163
+ else if (format === "github") {
164
+ // GitHub Actions workflow commands: annotations on the run and the pull request.
165
+ const esc = (s) => s.replace(/%/g, "%25").replace(/\r/g, "%0D").replace(/\n/g, "%0A");
166
+ for (const f of findings) {
167
+ if (f.level === "ok")
168
+ console.log(`✓ ${f.rule}: ${f.message}`);
169
+ else
170
+ console.log(`::${f.level === "error" ? "error" : "warning"} file=shelfready.yaml,title=${esc(`ShelfReady ${f.rule}`).replace(/[,:]/g, " ")}::${esc(f.message)}`);
171
+ }
172
+ const summary = process.env.GITHUB_STEP_SUMMARY;
173
+ if (summary) {
174
+ const rows = findings.map((f) => `| ${f.level === "error" ? "✗" : f.level === "warn" ? "!" : "✓"} | \`${f.rule}\` | ${f.message.replace(/\|/g, "\\|")} |`);
175
+ appendFileSync(summary, ["### ShelfReady", "", "| | Rule | Finding |", "|---|---|---|", ...rows, ""].join("\n"));
176
+ }
177
+ }
178
+ else
179
+ for (const f of findings)
180
+ console.log(`${f.level === "error" ? "✗" : f.level === "warn" ? "!" : "✓"} ${f.rule}: ${f.message}`);
181
+ if (o.ci && findings.some((f) => f.level === "error"))
182
+ process.exit(1);
183
+ });
184
+ program
185
+ .command("checklist")
186
+ .description("Go-live checklist: automatic items from check, manual items you tick with --done.")
187
+ .argument("[path]", "app repository", ".")
188
+ .option("--online", "also verify that the pages are live")
189
+ .option("--done <ids>", "tick manual items, comma-separated (e.g. trademark,asc-urls)")
190
+ .option("--undo <ids>", "untick manual items")
191
+ .option("--markdown [file]", "print or write the checklist as Markdown")
192
+ .action(async (path, o) => {
193
+ const file = factsPath(path);
194
+ for (const [ids, done] of [[o.done, true], [o.undo, false]]) {
195
+ if (!ids)
196
+ continue;
197
+ try {
198
+ writeFileSync(file, setTicks(file, ids.split(",").map((s) => s.trim()).filter(Boolean), done));
199
+ }
200
+ catch (e) {
201
+ console.error(String(e instanceof Error ? e.message : e));
202
+ process.exit(1);
203
+ }
204
+ }
205
+ const { facts, fileVersion } = requireLoaded(path);
206
+ const s = scan(path);
207
+ const rows = checklist({ facts, scan: s, findings: check(facts, s, { fileVersion }), ...(o.online ? { online: await checkOnline(facts) } : {}) });
208
+ if (o.markdown) {
209
+ const md = checklistMarkdown(rows, facts.app.name);
210
+ if (typeof o.markdown === "string") {
211
+ writeFileSync(resolve(path, o.markdown), md);
212
+ console.log(`Wrote ${o.markdown}`);
213
+ }
214
+ else
215
+ console.log(md);
216
+ return;
217
+ }
218
+ const icon = { done: "✓", todo: "○", fail: "✗" };
219
+ for (const group of [...new Set(rows.map((r) => r.group))]) {
220
+ console.log(`\n${group}`);
221
+ for (const r of rows.filter((x) => x.group === group)) {
222
+ const id = r.automatic ? "" : ` [${r.id}]`;
223
+ console.log(` ${icon[r.status]} ${r.title}${r.detail ? ` (${r.detail})` : ""}${id}`);
224
+ if (r.how)
225
+ console.log(` ${r.how}`);
226
+ }
227
+ }
228
+ const done = rows.filter((r) => r.status === "done").length;
229
+ console.log(`\n${done} of ${rows.length} done.${rows.some((r) => !r.automatic && r.status !== "done") ? " Tick manual items with: shelf checklist --done <id>" : ""}`);
230
+ });
231
+ program
232
+ .command("migrate")
233
+ .description("Update shelfready.yaml to the current schema, keeping your comments and wording.")
234
+ .argument("[path]", "app repository", ".")
235
+ .option("--dry-run", "show what would change without writing")
236
+ .action((path, o) => {
237
+ const file = factsPath(path);
238
+ if (!existsSync(file)) {
239
+ console.error(`No shelfready.yaml in ${resolve(path)}.`);
240
+ process.exit(1);
241
+ }
242
+ let result;
243
+ try {
244
+ result = migrateFile(file);
245
+ }
246
+ catch (e) {
247
+ console.error(String(e instanceof Error ? e.message : e));
248
+ process.exit(1);
249
+ }
250
+ if (result.from === result.to)
251
+ return console.log(`shelfready.yaml is already schema v${result.to}.`);
252
+ console.log(`shelfready.yaml: v${result.from} → v${result.to}`);
253
+ for (const n of result.notes)
254
+ console.log(n);
255
+ if (o.dryRun)
256
+ return console.log("(dry run, nothing written)");
257
+ writeFileSync(file, result.text);
258
+ console.log(`Wrote ${file}. Review the new fields, then run \`shelf check\`.`);
259
+ });
260
+ for (const [name, what] of [
261
+ ["publish", "Publish pages to GitHub Pages or shelfready.dev."],
262
+ ["login", "Sign in to shelfready.dev (device flow)."],
263
+ ]) {
264
+ program
265
+ .command(name)
266
+ .description(`${what} (not built yet)`)
267
+ .action(() => {
268
+ console.log(`\`shelf ${name}\` isn't built yet. See docs/roadmap.md.`);
269
+ process.exit(2);
270
+ });
271
+ }
272
+ await program.parseAsync();
@@ -0,0 +1,20 @@
1
+ import type { Facts } from "./facts.js";
2
+ /**
3
+ * App Store Connect "App Privacy" answers in fastlane's `app_privacy_details.json` format,
4
+ * for `fastlane upload_app_privacy_details_to_app_store` (Apple ID login; no API key path exists).
5
+ * Category, purpose and protection IDs follow fastlane's Spaceship constants.
6
+ */
7
+ export interface AppPrivacyEntry {
8
+ category?: string;
9
+ purposes?: string[];
10
+ data_protections: string[];
11
+ }
12
+ /** Privacy manifest data types → App Store Connect categories. Unmapped types are reported, never guessed. */
13
+ export declare const CATEGORY: Record<string, string>;
14
+ export declare const PURPOSE: Record<string, string>;
15
+ export interface AppPrivacyResult {
16
+ entries: AppPrivacyEntry[];
17
+ /** Data types or purposes with no App Store Connect equivalent; answer these by hand. */
18
+ unmapped: string[];
19
+ }
20
+ export declare function appPrivacy(facts: Facts): AppPrivacyResult;
@@ -0,0 +1,73 @@
1
+ /** Privacy manifest data types → App Store Connect categories. Unmapped types are reported, never guessed. */
2
+ export const CATEGORY = {
3
+ NSPrivacyCollectedDataTypeName: "NAME",
4
+ NSPrivacyCollectedDataTypeEmailAddress: "EMAIL_ADDRESS",
5
+ NSPrivacyCollectedDataTypePhoneNumber: "PHONE_NUMBER",
6
+ NSPrivacyCollectedDataTypePhysicalAddress: "PHYSICAL_ADDRESS",
7
+ NSPrivacyCollectedDataTypeOtherUserContactInfo: "OTHER_CONTACT_INFO",
8
+ NSPrivacyCollectedDataTypeHealth: "HEALTH",
9
+ NSPrivacyCollectedDataTypeFitness: "FITNESS",
10
+ NSPrivacyCollectedDataTypePaymentInfo: "PAYMENT_INFORMATION",
11
+ NSPrivacyCollectedDataTypeCreditInfo: "CREDIT_AND_FRAUD",
12
+ NSPrivacyCollectedDataTypeOtherFinancialInfo: "OTHER_FINANCIAL_INFO",
13
+ NSPrivacyCollectedDataTypePreciseLocation: "PRECISE_LOCATION",
14
+ NSPrivacyCollectedDataTypeCoarseLocation: "COARSE_LOCATION",
15
+ NSPrivacyCollectedDataTypeSensitiveInfo: "SENSITIVE_INFO",
16
+ NSPrivacyCollectedDataTypeContacts: "CONTACTS",
17
+ NSPrivacyCollectedDataTypeEmailsOrTextMessages: "EMAILS_OR_TEXT_MESSAGES",
18
+ NSPrivacyCollectedDataTypePhotosorVideos: "PHOTOS_OR_VIDEOS",
19
+ NSPrivacyCollectedDataTypeAudioData: "AUDIO",
20
+ NSPrivacyCollectedDataTypeGameplayContent: "GAMEPLAY_CONTENT",
21
+ NSPrivacyCollectedDataTypeCustomerSupport: "CUSTOMER_SUPPORT",
22
+ NSPrivacyCollectedDataTypeOtherUserContent: "OTHER_USER_CONTENT",
23
+ NSPrivacyCollectedDataTypeBrowsingHistory: "BROWSING_HISTORY",
24
+ NSPrivacyCollectedDataTypeSearchHistory: "SEARCH_HISTORY",
25
+ NSPrivacyCollectedDataTypeUserID: "USER_ID",
26
+ NSPrivacyCollectedDataTypeDeviceID: "DEVICE_ID",
27
+ NSPrivacyCollectedDataTypePurchaseHistory: "PURCHASE_HISTORY",
28
+ NSPrivacyCollectedDataTypeProductInteraction: "PRODUCT_INTERACTION",
29
+ NSPrivacyCollectedDataTypeAdvertisingData: "ADVERTISING_DATA",
30
+ NSPrivacyCollectedDataTypeOtherUsageData: "OTHER_USAGE_DATA",
31
+ NSPrivacyCollectedDataTypeCrashData: "CRASH_DATA",
32
+ NSPrivacyCollectedDataTypePerformanceData: "PERFORMANCE_DATA",
33
+ NSPrivacyCollectedDataTypeOtherDiagnosticData: "OTHER_DIAGNOSTIC_DATA",
34
+ NSPrivacyCollectedDataTypeOtherDataTypes: "OTHER_DATA",
35
+ };
36
+ export const PURPOSE = {
37
+ NSPrivacyCollectedDataTypePurposeThirdPartyAdvertising: "THIRD_PARTY_ADVERTISING",
38
+ NSPrivacyCollectedDataTypePurposeDeveloperAdvertising: "DEVELOPERS_ADVERTISING",
39
+ NSPrivacyCollectedDataTypePurposeAnalytics: "ANALYTICS",
40
+ NSPrivacyCollectedDataTypePurposeProductPersonalization: "PRODUCT_PERSONALIZATION",
41
+ NSPrivacyCollectedDataTypePurposeAppFunctionality: "APP_FUNCTIONALITY",
42
+ NSPrivacyCollectedDataTypePurposeOther: "OTHER_PURPOSES",
43
+ };
44
+ export function appPrivacy(facts) {
45
+ if (facts.data.collected.length === 0) {
46
+ return { entries: [{ data_protections: ["DATA_NOT_COLLECTED"] }], unmapped: [] };
47
+ }
48
+ const unmapped = new Set();
49
+ const byCategory = new Map();
50
+ for (const item of facts.data.collected) {
51
+ const category = CATEGORY[item.type];
52
+ if (!category) {
53
+ unmapped.add(item.type);
54
+ continue;
55
+ }
56
+ const entry = byCategory.get(category) ?? { purposes: new Set(), protections: new Set() };
57
+ for (const p of item.purposes) {
58
+ const purpose = PURPOSE[p];
59
+ if (purpose)
60
+ entry.purposes.add(purpose);
61
+ else
62
+ unmapped.add(p);
63
+ }
64
+ entry.protections.add(item.linked ? "DATA_LINKED_TO_YOU" : "DATA_NOT_LINKED_TO_YOU");
65
+ if (item.tracking)
66
+ entry.protections.add("DATA_USED_TO_TRACK_YOU");
67
+ byCategory.set(category, entry);
68
+ }
69
+ const entries = [...byCategory.entries()]
70
+ .sort(([a], [b]) => a.localeCompare(b))
71
+ .map(([category, e]) => ({ category, purposes: [...e.purposes].sort(), data_protections: [...e.protections].sort() }));
72
+ return { entries, unmapped: [...unmapped].sort() };
73
+ }