@marktiderman/genesis-cli 1.5.0 → 1.7.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.
Files changed (139) hide show
  1. package/README.md +224 -3
  2. package/dist/cli.js +4602 -1549
  3. package/dist/cli.js.map +1 -1
  4. package/dist/{config-Ci-_Ue-1.d.ts → config-CrZbM3jD.d.ts} +73 -4
  5. package/dist/doctor.d.ts +31 -4
  6. package/dist/doctor.js +976 -30
  7. package/dist/doctor.js.map +1 -1
  8. package/dist/expo.d.ts +91 -8
  9. package/dist/expo.js +207 -14
  10. package/dist/expo.js.map +1 -1
  11. package/dist/genesis-catalog.json +502 -0
  12. package/dist/index.d.ts +1 -1
  13. package/dist/index.js +987 -38
  14. package/dist/index.js.map +1 -1
  15. package/dist/scaffolder.d.ts +1 -1
  16. package/dist/scaffolder.js +9 -6
  17. package/dist/scaffolder.js.map +1 -1
  18. package/dist/starter/.eas/scripts/rollout-health.mjs +85 -0
  19. package/dist/starter/.eas/workflows/deploy-production.yml +149 -0
  20. package/dist/starter/.eas/workflows/e2e.yml +77 -0
  21. package/dist/starter/.eas/workflows/pr-preview.yml +117 -0
  22. package/dist/starter/.eas/workflows/rollout.yml +120 -0
  23. package/dist/starter/.env.example +11 -0
  24. package/dist/starter/.fingerprintignore +7 -0
  25. package/dist/starter/.maestro/README.md +38 -0
  26. package/dist/starter/.maestro/config.yaml +5 -0
  27. package/dist/starter/.maestro/flows/deep-link.yaml +22 -0
  28. package/dist/starter/.maestro/flows/launch.yaml +17 -0
  29. package/dist/starter/.maestro/flows/settings-version.yaml +28 -0
  30. package/dist/starter/.maestro/flows/sign-in-screen.yaml +17 -0
  31. package/dist/starter/.maestro/subflows/sign-in.yaml +20 -0
  32. package/dist/starter/README.md +314 -0
  33. package/dist/starter/__tests__/app-config.test.ts +51 -0
  34. package/dist/starter/__tests__/check-in-photos.test.ts +57 -0
  35. package/dist/starter/__tests__/components/css-stub.js +2 -0
  36. package/dist/starter/__tests__/components/fake-supabase.ts +136 -0
  37. package/dist/starter/__tests__/components/links.test.ts +25 -0
  38. package/dist/starter/__tests__/components/render-app.ts +22 -0
  39. package/dist/starter/__tests__/components/reports.ts +10 -0
  40. package/dist/starter/__tests__/components/resolver.js +12 -0
  41. package/dist/starter/__tests__/components/root-layout.test.tsx +55 -0
  42. package/dist/starter/__tests__/components/session-storage.test.tsx +81 -0
  43. package/dist/starter/__tests__/components/settings.test.tsx +134 -0
  44. package/dist/starter/__tests__/components/setup.ts +69 -0
  45. package/dist/starter/__tests__/components/sign-in.test.tsx +90 -0
  46. package/dist/starter/__tests__/components/tabs-feature-off.test.tsx +19 -0
  47. package/dist/starter/__tests__/components/tabs.test.tsx +43 -0
  48. package/dist/starter/__tests__/components/tabs.ts +12 -0
  49. package/dist/starter/__tests__/entry.test.ts +28 -0
  50. package/dist/starter/__tests__/inline-copy.ts +59 -0
  51. package/dist/starter/__tests__/starter.test.ts +319 -0
  52. package/dist/starter/_gitignore +13 -0
  53. package/dist/starter/app.config.ts +44 -0
  54. package/dist/starter/babel.config.js +9 -0
  55. package/dist/starter/eas.json +47 -0
  56. package/dist/starter/eslint.config.js +5 -0
  57. package/dist/starter/genesis.config.json +12 -0
  58. package/dist/starter/global.css +3 -0
  59. package/dist/starter/index.ts +14 -0
  60. package/dist/starter/jest.config.js +36 -0
  61. package/dist/starter/metro.config.js +38 -0
  62. package/dist/starter/package.json +93 -0
  63. package/dist/starter/pnpm-workspace.yaml +73 -0
  64. package/dist/starter/src/app/(app)/(home)/_layout.tsx +6 -0
  65. package/dist/starter/src/app/(app)/(home)/check-in.tsx +41 -0
  66. package/dist/starter/src/app/(app)/(home)/index.tsx +34 -0
  67. package/dist/starter/src/app/(app)/_layout.tsx +27 -0
  68. package/dist/starter/src/app/(app)/notifications/_layout.tsx +6 -0
  69. package/dist/starter/src/app/(app)/notifications/index.tsx +36 -0
  70. package/dist/starter/src/app/(app)/settings/_layout.tsx +6 -0
  71. package/dist/starter/src/app/(app)/settings/index.tsx +96 -0
  72. package/dist/starter/src/app/(app)/settings/notifications.tsx +16 -0
  73. package/dist/starter/src/app/(app)/settings/support/[id].tsx +23 -0
  74. package/dist/starter/src/app/(app)/settings/support/ideas.tsx +20 -0
  75. package/dist/starter/src/app/(app)/settings/support/index.tsx +20 -0
  76. package/dist/starter/src/app/(app)/settings/support/new.tsx +35 -0
  77. package/dist/starter/src/app/(app)/settings/support/shipped.tsx +20 -0
  78. package/dist/starter/src/app/+native-intent.ts +11 -0
  79. package/dist/starter/src/app/_layout.tsx +20 -0
  80. package/dist/starter/src/app/sign-in.tsx +69 -0
  81. package/dist/starter/src/copy.ts +118 -0
  82. package/dist/starter/src/forms/check-in.json +121 -0
  83. package/dist/starter/src/lib/account.ts +42 -0
  84. package/dist/starter/src/lib/app.ts +52 -0
  85. package/dist/starter/src/lib/auth.ts +80 -0
  86. package/dist/starter/src/lib/check-in-photos.ts +66 -0
  87. package/dist/starter/src/lib/check-in.ts +85 -0
  88. package/dist/starter/src/lib/define-starter.ts +148 -0
  89. package/dist/starter/src/lib/devtools-overlay.ts +34 -0
  90. package/dist/starter/src/lib/devtools.ts +23 -0
  91. package/dist/starter/src/lib/env.ts +33 -0
  92. package/dist/starter/src/lib/google-signin.ts +23 -0
  93. package/dist/starter/src/lib/links.ts +40 -0
  94. package/dist/starter/src/lib/native-modules.ts +27 -0
  95. package/dist/starter/src/lib/notifications.ts +15 -0
  96. package/dist/starter/src/lib/observability.ts +45 -0
  97. package/dist/starter/src/lib/push.ts +49 -0
  98. package/dist/starter/src/lib/supabase.ts +65 -0
  99. package/dist/starter/src/lib/support.ts +44 -0
  100. package/dist/starter/src/lib/updates.ts +61 -0
  101. package/dist/starter/starter.config.ts +37 -0
  102. package/dist/starter/supabase/config.toml +26 -0
  103. package/dist/starter/supabase/functions/genesis-apple-revoke/apple.ts +237 -0
  104. package/dist/starter/supabase/functions/genesis-apple-revoke/handler.ts +227 -0
  105. package/dist/starter/supabase/functions/genesis-apple-revoke/index.ts +55 -0
  106. package/dist/starter/supabase/functions/genesis-push-send/expo.ts +117 -0
  107. package/dist/starter/supabase/functions/genesis-push-send/handler.ts +462 -0
  108. package/dist/starter/supabase/functions/genesis-push-send/index.ts +54 -0
  109. package/dist/starter/supabase/migrations/20261024000000_genesis_account_deletion.sql +133 -0
  110. package/dist/starter/supabase/migrations/20261024000100_genesis_app_release_policy.sql +82 -0
  111. package/dist/starter/supabase/migrations/20261024000200_genesis_apple_token_revocation.sql +205 -0
  112. package/dist/starter/supabase/migrations/20261024000400_genesis_push.sql +524 -0
  113. package/dist/starter/supabase/migrations/20261024000600_genesis_support.sql +846 -0
  114. package/dist/starter/supabase/tests/database/genesis_account_deletion.test.sql +138 -0
  115. package/dist/starter/supabase/tests/database/genesis_app_release_policy.test.sql +148 -0
  116. package/dist/starter/supabase/tests/database/genesis_apple_token_revocation.test.sql +230 -0
  117. package/dist/starter/supabase/tests/database/genesis_push.test.sql +407 -0
  118. package/dist/starter/supabase/tests/database/genesis_support.test.sql +552 -0
  119. package/dist/starter/tailwind.config.mjs +15 -0
  120. package/dist/starter/tsconfig.json +14 -0
  121. package/dist/starter/vitest.config.mts +7 -0
  122. package/dist/templates/ci/app-ci.yml +17 -0
  123. package/dist/templates/ci/genesis-upgrade.yml +21 -0
  124. package/dist/templates/ci/supabase-ci.yml +20 -0
  125. package/dist/templates/eas/eas.json +47 -0
  126. package/dist/templates/eas/scripts/rollout-health.mjs +85 -0
  127. package/dist/templates/eas/workflows/deploy-production.yml +149 -0
  128. package/dist/templates/eas/workflows/e2e.yml +77 -0
  129. package/dist/templates/eas/workflows/pr-preview.yml +117 -0
  130. package/dist/templates/eas/workflows/rollout.yml +120 -0
  131. package/dist/templates/maestro/config.yaml +5 -0
  132. package/dist/templates/maestro/flows/deep-link.yaml +22 -0
  133. package/dist/templates/maestro/flows/launch.yaml +17 -0
  134. package/dist/templates/maestro/flows/settings-version.yaml +28 -0
  135. package/dist/templates/maestro/flows/sign-in-screen.yaml +17 -0
  136. package/dist/templates/maestro/subflows/sign-in.yaml +20 -0
  137. package/dist/vite.js +975 -29
  138. package/dist/vite.js.map +1 -1
  139. package/package.json +4 -4
@@ -56,15 +56,41 @@ interface PatternRule {
56
56
  }
57
57
  /** A plugin entry in config: a module path, or `[path, options]`. */
58
58
  type PluginSpec = string | [string, unknown];
59
+ /** An opt-in rule pack. */
60
+ type DoctorPack = "native" | "supabase";
61
+ /** Settings for the `native` pack. */
62
+ interface NativePackConfig {
63
+ /** The Expo Router root, relative to the app. Default: `src/app`, else `app`. */
64
+ routerRoot?: string;
65
+ }
66
+ /** Settings for the `supabase` pack. */
67
+ interface SupabasePackConfig {
68
+ /** The migrations folder. Default `supabase/migrations`. */
69
+ migrations?: string;
70
+ /** The git ref applied migrations are compared against. Default `origin/main`. */
71
+ base?: string;
72
+ /** Schemas the API exposes: their tables need row level security, and only their functions may be granted to anon/public. Default `["public"]`. */
73
+ exposedSchemas?: string[];
74
+ /**
75
+ * A migration file name or timestamp prefix: files sorting before it are applied and
76
+ * trusted by `migration-grants`. Without it, grants are checked only when git can
77
+ * tell new migrations from applied ones.
78
+ */
79
+ since?: string;
80
+ }
59
81
  /** The `doctor` block of genesis.config.json (or package.json `genesis.doctor`). */
60
82
  interface DoctorConfig {
61
- /** Folders to scan, relative to the app root. Default `["src"]`. */
83
+ /** Opt-in rule packs: `native` (Expo apps) and `supabase` (migrations). Default none. */
84
+ packs?: DoctorPack[];
85
+ native?: NativePackConfig;
86
+ supabase?: SupabasePackConfig;
87
+ /** Folders to scan, relative to the app root. Default `["src"]` (`["app", "src", "components"]` with the native pack). */
62
88
  src?: string[];
63
89
  /** File extensions to scan. Default `.ts .tsx .js .jsx .mts .cts .css`. */
64
90
  extensions?: string[];
65
91
  /** Extra globs to skip, on top of the defaults (tests, fixtures, `.d.ts`, `*.gen.*`). */
66
92
  ignore?: string[];
67
- /** The component package. Default `@marktiderman/genesis-ui`. */
93
+ /** The component package. Default `@marktiderman/genesis-ui` (`@marktiderman/genesis-ui-native` with the native pack). */
68
94
  uiPackage?: string;
69
95
  /**
70
96
  * Theme stylesheet(s) whose custom properties are the defined tokens: one
@@ -172,11 +198,48 @@ interface GenesisLinks {
172
198
  /** Also add `webcredentials:` domains (password autofill). Default true. */
173
199
  webcredentials?: boolean;
174
200
  }
201
+ /**
202
+ * Apple's collected data types (`NSPrivacyCollectedDataType`), every one in
203
+ * Apple's reference, keyed by the stores' own words, lower case, as Genesis
204
+ * blocks name them in `privacy.collects`. Look one up with
205
+ * {@link privacyDataType}, which ignores case (blocks write `"device ID"`,
206
+ * `"user ID"`). The values are Apple's exact strings, `PhotosorVideos`
207
+ * included.
208
+ */
209
+ declare const PRIVACY_DATA_TYPES: Readonly<Record<string, string>>;
210
+ /** Apple's string for a data type in the stores' words, whatever its case, or undefined. */
211
+ declare function privacyDataType(type: string): string | undefined;
212
+ /** Apple's collection purposes (`NSPrivacyCollectedDataTypePurposes`), by the stores' words. */
213
+ declare const PRIVACY_PURPOSES: Readonly<Record<string, string>>;
214
+ /** One kind of data the app collects, as a Genesis block's `privacy.collects` entry says it. */
215
+ interface GenesisDataUse {
216
+ /** A key of {@link PRIVACY_DATA_TYPES}: `"email address"`, `"user id"`, `"crash data"`… */
217
+ type: string;
218
+ /** Keys of {@link PRIVACY_PURPOSES}: `"app functionality"`, `"analytics"`… */
219
+ purposes: string[];
220
+ /** Tied to the person's identity. */
221
+ linked: boolean;
222
+ /** Used to track the person across other companies' apps and websites. */
223
+ tracking: boolean;
224
+ }
225
+ /**
226
+ * The `privacy` block: what goes in the iOS privacy manifest's collected data
227
+ * types. Left out, the Genesis blocks the app's packages carry decide.
228
+ */
229
+ interface GenesisPrivacy {
230
+ /** The Genesis blocks whose data the app sends anywhere (`account`, `observability`, `push`). Default: found from package.json. */
231
+ blocks?: string[];
232
+ /** Every kind of data the app collects. Replaces what the blocks give, so list everything. */
233
+ collects?: GenesisDataUse[];
234
+ /** `NSPrivacyTracking`. Default false; true needs `NSPrivacyTrackingDomains` in app.config. */
235
+ tracking?: boolean;
236
+ }
175
237
  /** genesis.config.json, parsed, with its shared blocks validated. */
176
238
  interface GenesisConfigFile {
177
239
  /** The whole parsed file, for blocks other readers own (`doctor`, `features`). */
178
240
  raw: Record<string, unknown>;
179
241
  links?: GenesisLinks;
242
+ privacy?: GenesisPrivacy;
180
243
  }
181
244
  interface LoadedConfig {
182
245
  config: DoctorConfig;
@@ -188,13 +251,19 @@ interface LoadedConfig {
188
251
  declare function loadConfig(root: string, configPath?: string): LoadedConfig;
189
252
  /**
190
253
  * Reads `<root>/genesis.config.json` and validates its shared blocks (today:
191
- * `links`). Returns null when the file doesn't exist; throws a
254
+ * `links` and `privacy`). Returns null when the file doesn't exist; throws a
192
255
  * GenesisConfigError naming the file when it isn't valid.
193
256
  */
194
257
  declare function readGenesisConfig(root: string): GenesisConfigFile | null;
258
+ /**
259
+ * Check a `privacy` block (genesis.config.json's, or the plugin's `privacy`
260
+ * option): a misspelt data type or purpose fails the build, since Xcode's
261
+ * privacy report ignores values it doesn't know.
262
+ */
263
+ declare function validatePrivacy(raw: unknown, source?: string): GenesisPrivacy;
195
264
  /** Check the `links` block, so a typo'd host fails the build instead of shipping links that never open. */
196
265
  declare function validateLinks(raw: unknown, source?: string): GenesisLinks;
197
266
  /** Check the shape, so a typo fails loudly instead of silently disabling a check. */
198
267
  declare function validateConfig(raw: unknown, source?: string): DoctorConfig;
199
268
 
200
- export { type AllowEntry as A, type DoctorConfig as D, type Finding as F, type GenesisLinks as G, type Level as L, type PatternRule as P, type RuleSetting as R, type SourceFile as S, GenesisConfigError as a, DoctorConfigError as b, type DoctorContext as c, type DoctorPlugin as d, type DoctorResult as e, type GenesisConfigFile as f, type GenesisFacts as g, type FindingInput as h, type PluginSpec as i, validateConfig as j, loadConfig as l, readGenesisConfig as r, validateLinks as v };
269
+ export { type AllowEntry as A, type DoctorConfig as D, type Finding as F, type GenesisDataUse as G, type Level as L, type NativePackConfig as N, PRIVACY_DATA_TYPES as P, type RuleSetting as R, type SourceFile as S, type GenesisPrivacy as a, type GenesisLinks as b, GenesisConfigError as c, PRIVACY_PURPOSES as d, validatePrivacy as e, DoctorConfigError as f, type DoctorContext as g, type DoctorPlugin as h, type DoctorResult as i, type GenesisConfigFile as j, type GenesisFacts as k, type PatternRule as l, type DoctorPack as m, type FindingInput as n, type PluginSpec as o, privacyDataType as p, type SupabasePackConfig as q, readGenesisConfig as r, loadConfig as s, validateConfig as t, validateLinks as v };
package/dist/doctor.d.ts CHANGED
@@ -1,9 +1,22 @@
1
- import { D as DoctorConfig, g as GenesisFacts, P as PatternRule, d as DoctorPlugin, e as DoctorResult, F as Finding } from './config-Ci-_Ue-1.js';
2
- export { A as AllowEntry, b as DoctorConfigError, c as DoctorContext, h as FindingInput, a as GenesisConfigError, f as GenesisConfigFile, G as GenesisLinks, L as Level, i as PluginSpec, R as RuleSetting, S as SourceFile, l as loadConfig, r as readGenesisConfig, j as validateConfig, v as validateLinks } from './config-Ci-_Ue-1.js';
1
+ import { D as DoctorConfig, k as GenesisFacts, l as PatternRule, h as DoctorPlugin, i as DoctorResult, F as Finding } from './config-CrZbM3jD.js';
2
+ export { A as AllowEntry, f as DoctorConfigError, g as DoctorContext, m as DoctorPack, n as FindingInput, c as GenesisConfigError, j as GenesisConfigFile, b as GenesisLinks, L as Level, N as NativePackConfig, o as PluginSpec, R as RuleSetting, S as SourceFile, q as SupabasePackConfig, s as loadConfig, r as readGenesisConfig, t as validateConfig, v as validateLinks } from './config-CrZbM3jD.js';
3
3
 
4
4
  /** The installed folder of `name`, looking in node_modules from `from` upward (works with hoisting and pnpm). */
5
5
  declare function findPackageDir(from: string, name: string): string | null;
6
+ /** What one installed component package exports, read from its type declarations. */
7
+ interface PackageExports {
8
+ dir: string;
9
+ version: string;
10
+ /** Every exported name (all subpaths). */
11
+ exports: Set<string>;
12
+ /** Exported values (not types). */
13
+ values: Set<string>;
14
+ /** Exported components, sorted. */
15
+ components: string[];
16
+ }
6
17
  declare function loadGenesis(root: string, config: DoctorConfig): GenesisFacts;
18
+ /** An installed package's exports, from its declarations (every subpath), or null when it isn't installed. */
19
+ declare function readPackageExports(root: string, uiPackage: string): PackageExports | null;
7
20
  /** Names exported by a declaration file: `export { a, b as c }` blocks and `export declare …` statements. */
8
21
  declare function parseExportNames(dts: string): string[];
9
22
 
@@ -13,7 +26,7 @@ declare function parseRulesMarkdown(markdown: string): PatternRule[];
13
26
  declare function defineDoctorPlugin(plugin: DoctorPlugin): DoctorPlugin;
14
27
 
15
28
  /** Ids of the built-in rules, for `rules` overrides and `allow` entries. */
16
- declare const BUILTIN_RULES: readonly ["local-primitives", "starter-leftover", "forbidden-import", "raw-tag", "palette-color", "arbitrary-color", "raw-color", "undefined-token", "shadowed-export", "version-skew"];
29
+ declare const BUILTIN_RULES: readonly ["local-primitives", "starter-leftover", "forbidden-import", "raw-tag", "palette-color", "arbitrary-color", "raw-color", "undefined-token", "shadowed-export", "version-skew", "native-raw-primitive", "native-literal-color", "native-custom-header", "native-screen-layout", "store-readiness", "migration-grants", "migration-rls", "migration-definer-search-path", "migration-edited"];
17
30
 
18
31
  /**
19
32
  * Minimal globs for config: `*` matches within a folder, `**` across folders,
@@ -21,6 +34,20 @@ declare const BUILTIN_RULES: readonly ["local-primitives", "starter-leftover", "
21
34
  */
22
35
  declare function globToRegExp(glob: string): RegExp;
23
36
 
37
+ /** Genesis screen layouts the installed native package exports, sorted. */
38
+ declare function nativeLayouts(pkg: Pick<PackageExports, "components">): string[];
39
+
40
+ interface SqlStatement {
41
+ /** The statement, lowercased, comments removed, literals blanked, whitespace collapsed. */
42
+ sql: string;
43
+ /** 1-based line where it starts. */
44
+ line: number;
45
+ /** The lowercased text of each dollar-quoted body in the statement (`do $$ … $$`, function bodies). */
46
+ bodies: string[];
47
+ }
48
+ /** Split SQL into statements, dropping comments and blanking quoted literals and dollar-quoted bodies. */
49
+ declare function sqlStatements(text: string): SqlStatement[];
50
+
24
51
  /** The shape of the umbrella's `dist/versions.json`. */
25
52
  interface ReleaseManifest {
26
53
  version: string;
@@ -68,4 +95,4 @@ declare function genesisSummary(g: GenesisFacts): {
68
95
  palette: readonly string[];
69
96
  };
70
97
 
71
- export { BUILTIN_RULES, DoctorConfig, DoctorPlugin, DoctorResult, Finding, GenesisFacts, PatternRule, type ReleaseManifest, type RunDoctorOptions, defineDoctorPlugin, findPackageDir, formatReport, genesisSummary, globToRegExp, loadGenesis, parseExportNames, parseRulesMarkdown, readReleaseManifest, runDoctor, toJson };
98
+ export { BUILTIN_RULES, DoctorConfig, DoctorPlugin, DoctorResult, Finding, GenesisFacts, PatternRule, type ReleaseManifest, type RunDoctorOptions, defineDoctorPlugin, findPackageDir, formatReport, genesisSummary, globToRegExp, loadGenesis, nativeLayouts, parseExportNames, parseRulesMarkdown, readPackageExports, readReleaseManifest, runDoctor, sqlStatements, toJson };