@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.
- package/README.md +224 -3
- package/dist/cli.js +4602 -1549
- package/dist/cli.js.map +1 -1
- package/dist/{config-Ci-_Ue-1.d.ts → config-CrZbM3jD.d.ts} +73 -4
- package/dist/doctor.d.ts +31 -4
- package/dist/doctor.js +976 -30
- package/dist/doctor.js.map +1 -1
- package/dist/expo.d.ts +91 -8
- package/dist/expo.js +207 -14
- package/dist/expo.js.map +1 -1
- package/dist/genesis-catalog.json +502 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +987 -38
- package/dist/index.js.map +1 -1
- package/dist/scaffolder.d.ts +1 -1
- package/dist/scaffolder.js +9 -6
- package/dist/scaffolder.js.map +1 -1
- package/dist/starter/.eas/scripts/rollout-health.mjs +85 -0
- package/dist/starter/.eas/workflows/deploy-production.yml +149 -0
- package/dist/starter/.eas/workflows/e2e.yml +77 -0
- package/dist/starter/.eas/workflows/pr-preview.yml +117 -0
- package/dist/starter/.eas/workflows/rollout.yml +120 -0
- package/dist/starter/.env.example +11 -0
- package/dist/starter/.fingerprintignore +7 -0
- package/dist/starter/.maestro/README.md +38 -0
- package/dist/starter/.maestro/config.yaml +5 -0
- package/dist/starter/.maestro/flows/deep-link.yaml +22 -0
- package/dist/starter/.maestro/flows/launch.yaml +17 -0
- package/dist/starter/.maestro/flows/settings-version.yaml +28 -0
- package/dist/starter/.maestro/flows/sign-in-screen.yaml +17 -0
- package/dist/starter/.maestro/subflows/sign-in.yaml +20 -0
- package/dist/starter/README.md +314 -0
- package/dist/starter/__tests__/app-config.test.ts +51 -0
- package/dist/starter/__tests__/check-in-photos.test.ts +57 -0
- package/dist/starter/__tests__/components/css-stub.js +2 -0
- package/dist/starter/__tests__/components/fake-supabase.ts +136 -0
- package/dist/starter/__tests__/components/links.test.ts +25 -0
- package/dist/starter/__tests__/components/render-app.ts +22 -0
- package/dist/starter/__tests__/components/reports.ts +10 -0
- package/dist/starter/__tests__/components/resolver.js +12 -0
- package/dist/starter/__tests__/components/root-layout.test.tsx +55 -0
- package/dist/starter/__tests__/components/session-storage.test.tsx +81 -0
- package/dist/starter/__tests__/components/settings.test.tsx +134 -0
- package/dist/starter/__tests__/components/setup.ts +69 -0
- package/dist/starter/__tests__/components/sign-in.test.tsx +90 -0
- package/dist/starter/__tests__/components/tabs-feature-off.test.tsx +19 -0
- package/dist/starter/__tests__/components/tabs.test.tsx +43 -0
- package/dist/starter/__tests__/components/tabs.ts +12 -0
- package/dist/starter/__tests__/entry.test.ts +28 -0
- package/dist/starter/__tests__/inline-copy.ts +59 -0
- package/dist/starter/__tests__/starter.test.ts +319 -0
- package/dist/starter/_gitignore +13 -0
- package/dist/starter/app.config.ts +44 -0
- package/dist/starter/babel.config.js +9 -0
- package/dist/starter/eas.json +47 -0
- package/dist/starter/eslint.config.js +5 -0
- package/dist/starter/genesis.config.json +12 -0
- package/dist/starter/global.css +3 -0
- package/dist/starter/index.ts +14 -0
- package/dist/starter/jest.config.js +36 -0
- package/dist/starter/metro.config.js +38 -0
- package/dist/starter/package.json +93 -0
- package/dist/starter/pnpm-workspace.yaml +73 -0
- package/dist/starter/src/app/(app)/(home)/_layout.tsx +6 -0
- package/dist/starter/src/app/(app)/(home)/check-in.tsx +41 -0
- package/dist/starter/src/app/(app)/(home)/index.tsx +34 -0
- package/dist/starter/src/app/(app)/_layout.tsx +27 -0
- package/dist/starter/src/app/(app)/notifications/_layout.tsx +6 -0
- package/dist/starter/src/app/(app)/notifications/index.tsx +36 -0
- package/dist/starter/src/app/(app)/settings/_layout.tsx +6 -0
- package/dist/starter/src/app/(app)/settings/index.tsx +96 -0
- package/dist/starter/src/app/(app)/settings/notifications.tsx +16 -0
- package/dist/starter/src/app/(app)/settings/support/[id].tsx +23 -0
- package/dist/starter/src/app/(app)/settings/support/ideas.tsx +20 -0
- package/dist/starter/src/app/(app)/settings/support/index.tsx +20 -0
- package/dist/starter/src/app/(app)/settings/support/new.tsx +35 -0
- package/dist/starter/src/app/(app)/settings/support/shipped.tsx +20 -0
- package/dist/starter/src/app/+native-intent.ts +11 -0
- package/dist/starter/src/app/_layout.tsx +20 -0
- package/dist/starter/src/app/sign-in.tsx +69 -0
- package/dist/starter/src/copy.ts +118 -0
- package/dist/starter/src/forms/check-in.json +121 -0
- package/dist/starter/src/lib/account.ts +42 -0
- package/dist/starter/src/lib/app.ts +52 -0
- package/dist/starter/src/lib/auth.ts +80 -0
- package/dist/starter/src/lib/check-in-photos.ts +66 -0
- package/dist/starter/src/lib/check-in.ts +85 -0
- package/dist/starter/src/lib/define-starter.ts +148 -0
- package/dist/starter/src/lib/devtools-overlay.ts +34 -0
- package/dist/starter/src/lib/devtools.ts +23 -0
- package/dist/starter/src/lib/env.ts +33 -0
- package/dist/starter/src/lib/google-signin.ts +23 -0
- package/dist/starter/src/lib/links.ts +40 -0
- package/dist/starter/src/lib/native-modules.ts +27 -0
- package/dist/starter/src/lib/notifications.ts +15 -0
- package/dist/starter/src/lib/observability.ts +45 -0
- package/dist/starter/src/lib/push.ts +49 -0
- package/dist/starter/src/lib/supabase.ts +65 -0
- package/dist/starter/src/lib/support.ts +44 -0
- package/dist/starter/src/lib/updates.ts +61 -0
- package/dist/starter/starter.config.ts +37 -0
- package/dist/starter/supabase/config.toml +26 -0
- package/dist/starter/supabase/functions/genesis-apple-revoke/apple.ts +237 -0
- package/dist/starter/supabase/functions/genesis-apple-revoke/handler.ts +227 -0
- package/dist/starter/supabase/functions/genesis-apple-revoke/index.ts +55 -0
- package/dist/starter/supabase/functions/genesis-push-send/expo.ts +117 -0
- package/dist/starter/supabase/functions/genesis-push-send/handler.ts +462 -0
- package/dist/starter/supabase/functions/genesis-push-send/index.ts +54 -0
- package/dist/starter/supabase/migrations/20261024000000_genesis_account_deletion.sql +133 -0
- package/dist/starter/supabase/migrations/20261024000100_genesis_app_release_policy.sql +82 -0
- package/dist/starter/supabase/migrations/20261024000200_genesis_apple_token_revocation.sql +205 -0
- package/dist/starter/supabase/migrations/20261024000400_genesis_push.sql +524 -0
- package/dist/starter/supabase/migrations/20261024000600_genesis_support.sql +846 -0
- package/dist/starter/supabase/tests/database/genesis_account_deletion.test.sql +138 -0
- package/dist/starter/supabase/tests/database/genesis_app_release_policy.test.sql +148 -0
- package/dist/starter/supabase/tests/database/genesis_apple_token_revocation.test.sql +230 -0
- package/dist/starter/supabase/tests/database/genesis_push.test.sql +407 -0
- package/dist/starter/supabase/tests/database/genesis_support.test.sql +552 -0
- package/dist/starter/tailwind.config.mjs +15 -0
- package/dist/starter/tsconfig.json +14 -0
- package/dist/starter/vitest.config.mts +7 -0
- package/dist/templates/ci/app-ci.yml +17 -0
- package/dist/templates/ci/genesis-upgrade.yml +21 -0
- package/dist/templates/ci/supabase-ci.yml +20 -0
- package/dist/templates/eas/eas.json +47 -0
- package/dist/templates/eas/scripts/rollout-health.mjs +85 -0
- package/dist/templates/eas/workflows/deploy-production.yml +149 -0
- package/dist/templates/eas/workflows/e2e.yml +77 -0
- package/dist/templates/eas/workflows/pr-preview.yml +117 -0
- package/dist/templates/eas/workflows/rollout.yml +120 -0
- package/dist/templates/maestro/config.yaml +5 -0
- package/dist/templates/maestro/flows/deep-link.yaml +22 -0
- package/dist/templates/maestro/flows/launch.yaml +17 -0
- package/dist/templates/maestro/flows/settings-version.yaml +28 -0
- package/dist/templates/maestro/flows/sign-in-screen.yaml +17 -0
- package/dist/templates/maestro/subflows/sign-in.yaml +20 -0
- package/dist/vite.js +975 -29
- package/dist/vite.js.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -6,6 +6,22 @@ npx @marktiderman/genesis-cli init <consumer>
|
|
|
6
6
|
|
|
7
7
|
Scaffolds a Genesis consumer: a brand package, Tailwind and tokens.
|
|
8
8
|
|
|
9
|
+
```bash
|
|
10
|
+
npx @marktiderman/genesis-cli init <app> --template native [--bundle-id com.acme.app] [--scheme acme] [--display-name "Acme"]
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Makes a new Expo app from the Genesis RN starter, in `./<app>` (or `--target`), which must be new
|
|
14
|
+
or empty. See [A new native app](#a-new-native-app).
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npx @marktiderman/genesis-cli add <block> [--dry-run] [--yes] [--no-install]
|
|
18
|
+
npx @marktiderman/genesis-cli migrate [--dry-run] [--forward]
|
|
19
|
+
npx @marktiderman/genesis-cli upgrade [--version <v>] [--dry-run] [--keep-mine] [--pr]
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Add a block to an app, copy new package migrations in, and move every Genesis package to one
|
|
23
|
+
release. See [Blocks: add, migrate, upgrade](#blocks-add-migrate-upgrade).
|
|
24
|
+
|
|
9
25
|
```bash
|
|
10
26
|
npx @marktiderman/genesis-cli doctor [--strict] [--json] [--build] [--config <path>] [--dir <dir>]
|
|
11
27
|
```
|
|
@@ -59,6 +75,145 @@ Writes the marked feature block in `AGENTS.md` (and a JSON copy with `--json <fi
|
|
|
59
75
|
repo's `src/features.ts`; `check` exits 1 when that output is stale or a feature's `links.code`
|
|
60
76
|
path doesn't exist. See [genesis-features](../features/README.md) for the registry and the options.
|
|
61
77
|
|
|
78
|
+
## A new native app
|
|
79
|
+
|
|
80
|
+
`genesis init <app> --template native` copies the starter (`apps/genesis-rn-starter`) that ships
|
|
81
|
+
inside the CLI, at the version the CLI was released with:
|
|
82
|
+
|
|
83
|
+
- only the files an app owns: no `node_modules`, build output, or the starter's monorepo-only test
|
|
84
|
+
(`__tests__/release.test.ts`, which reads the monorepo's `templates/`);
|
|
85
|
+
- renamed: package name, display name, slug, URL scheme and bundle id, everywhere the starter's
|
|
86
|
+
values appear (Apple client ids in `supabase/config.toml`, the Maestro flows' `appId`);
|
|
87
|
+
- every `workspace:` dependency set to `^<version>` from the same release (the installed
|
|
88
|
+
umbrella's `versions.json` when there is one), the plain Metro config, and a
|
|
89
|
+
`pnpm-workspace.yaml` with the pnpm settings Metro and pnpm 11 need (hoisted layout, allowed
|
|
90
|
+
build scripts, one React);
|
|
91
|
+
- the templates: `templates/eas` to `eas.json` and `.eas/`, `templates/maestro` to `.maestro/`,
|
|
92
|
+
`templates/ci` to `.github/workflows/` (replace `GENESIS_SHA` in them);
|
|
93
|
+
- `genesis.lock.json`, recording the blocks the starter carries (`account`, `app-updates`,
|
|
94
|
+
`push`), every file Genesis owns in the app with its checksum, and the renames, so `upgrade`
|
|
95
|
+
can refresh them and `migrate` knows the blocks.
|
|
96
|
+
|
|
97
|
+
The starter's migrations are copied byte for byte (its own tests check that); `migrate` knows them
|
|
98
|
+
by name and text. `init --native` (the brand-package scaffold for an Expo app) is unchanged.
|
|
99
|
+
|
|
100
|
+
## Blocks: add, migrate, upgrade
|
|
101
|
+
|
|
102
|
+
A block is a feature an app adds whole (see `defineBlock` in `@marktiderman/genesis-features`).
|
|
103
|
+
The commands read blocks from the Genesis packages, never from a list in the CLI, so a package
|
|
104
|
+
that declares a block is found:
|
|
105
|
+
|
|
106
|
+
- `package.json` → `"genesis": { "blocks": { "<id>": { … } } }`, plain JSON the CLI reads without
|
|
107
|
+
running package code. The CLI carries a catalog of every Genesis package's manifests, so a block
|
|
108
|
+
is found before its package is installed.
|
|
109
|
+
- A `./blocks` export of `defineBlock` declarations that loads in Node (no React Native), such as
|
|
110
|
+
`@marktiderman/genesis-supabase/blocks`. What a declaration says (requires, platforms,
|
|
111
|
+
migrations, routes, skills, privacy) wins over package.json; package.json adds what a
|
|
112
|
+
declaration can't.
|
|
113
|
+
|
|
114
|
+
A manifest entry:
|
|
115
|
+
|
|
116
|
+
```json
|
|
117
|
+
{
|
|
118
|
+
"feature": { "name": "Push", "summary": "…", "keywords": ["notifications"], "audience": ["person"] },
|
|
119
|
+
"platforms": ["native"],
|
|
120
|
+
"requires": ["account"],
|
|
121
|
+
"packages": ["@marktiderman/genesis-native", "@marktiderman/genesis-supabase"],
|
|
122
|
+
"install": ["@supabase/supabase-js@^2.118.0"],
|
|
123
|
+
"migrations": [{ "package": "@marktiderman/genesis-supabase", "file": "migrations/0005_genesis_push.sql", "test": "migrations/tests/0005_genesis_push.test.sql" }],
|
|
124
|
+
"functions": [{ "package": "@marktiderman/genesis-supabase", "dir": "functions/genesis-push-send", "verifyJwt": false, "secrets": ["GENESIS_PUSH_SECRET"] }],
|
|
125
|
+
"routes": [{ "path": "/settings/notifications", "signedIn": true }],
|
|
126
|
+
"skills": ["skills/push/SKILL.md"],
|
|
127
|
+
"agents": "agents/push.md",
|
|
128
|
+
"steps": ["npx expo install expo-notifications, and add it to the plugins in app.config."]
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Every path is package-relative and checked before anything reads it: no absolute paths, no `..`,
|
|
133
|
+
no backslashes, and a file that resolves (through a symlink) outside its package is refused.
|
|
134
|
+
`package` must be a Genesis package. Migrations are named `NNNN_name.sql`. A package whose
|
|
135
|
+
runtime block is made by a function (`createPush`) keeps a test that its manifest says what the
|
|
136
|
+
block declares.
|
|
137
|
+
|
|
138
|
+
### genesis add
|
|
139
|
+
|
|
140
|
+
`genesis add <block>` plans, prints the plan, asks (or `--yes`), then:
|
|
141
|
+
|
|
142
|
+
1. installs the block's `packages` (at the installed umbrella's pinned version, else this CLI's
|
|
143
|
+
release) and `install` entries the app doesn't have, with the app's package manager
|
|
144
|
+
(`--no-install` prints the command instead);
|
|
145
|
+
2. copies each migration into `supabase/migrations/` as a **new** file,
|
|
146
|
+
`<timestamp>_<name>.sql`, timestamped after every migration already there, with a header naming
|
|
147
|
+
the package, the file and the checksum of the package's text; and its pgTAP test into
|
|
148
|
+
`supabase/tests/database/`;
|
|
149
|
+
3. copies its Edge Functions into `supabase/functions/<name>/` (and adds `verify_jwt = false` to
|
|
150
|
+
`supabase/config.toml` when the manifest says so), its skills into `.claude/skills/<name>/`,
|
|
151
|
+
and its AGENTS.md fragment between `<!-- genesis-block:<id>:start/end -->` markers;
|
|
152
|
+
4. writes a stub screen for each route an Expo Router app doesn't have yet (inside the app's one
|
|
153
|
+
group for a signed-in route); other routers get a step;
|
|
154
|
+
5. adds the block's entry to the feature registry (`features.ts`) when the edit is unambiguous and
|
|
155
|
+
still loads, or prints the snippet; then runs `features build`;
|
|
156
|
+
6. records the block and the files it owns in `genesis.lock.json`, and prints what is left by hand
|
|
157
|
+
(secrets, plugin config, the privacy label).
|
|
158
|
+
|
|
159
|
+
It never overwrites a file the app has: one with other text is reported and left alone. A second
|
|
160
|
+
run creates and changes nothing. `--dry-run` prints the plan and writes nothing. `genesis add
|
|
161
|
+
--list` lists the blocks the app can add. `genesis studio init` is unchanged.
|
|
162
|
+
|
|
163
|
+
### genesis migrate
|
|
164
|
+
|
|
165
|
+
Compares the migrations of the app's blocks (`genesis.lock.json`, plus `--block <id>`) in the
|
|
166
|
+
installed packages with the app's copies, and every copy that carries a header:
|
|
167
|
+
|
|
168
|
+
| State | Meaning | What happens |
|
|
169
|
+
| --- | --- | --- |
|
|
170
|
+
| `current` | the copy matches its package text | nothing |
|
|
171
|
+
| `new` | the package ships a migration the app hasn't copied | copied as a new file, after every existing one |
|
|
172
|
+
| `edited` | the copy no longer matches the text it was copied with | reported; never rewritten |
|
|
173
|
+
| `changed-upstream` | the package now ships different text than the copy was made from | reported; never rewritten |
|
|
174
|
+
| `differs` | a file with the migration's name, other text and no header | treated as the app's own; never rewritten |
|
|
175
|
+
|
|
176
|
+
Every file already in `supabase/migrations` counts as applied: none is ever written again, and a
|
|
177
|
+
new file is created only if its name is free (otherwise it fails). A package migration is copied
|
|
178
|
+
only when nothing in the folder holds it yet, by header, by name or by text, so one a package
|
|
179
|
+
renumbered or moved is never copied twice. Line endings (CRLF or LF) don't count as a change. A
|
|
180
|
+
symlink in the folder stops the command. A pgTAP test is copied only with its migration, so one you
|
|
181
|
+
deleted stays deleted. `--forward` writes one forward migration stub
|
|
182
|
+
(`<timestamp>_<name>_forward.sql`, with a `genesis-forward` header) for each edited or changed
|
|
183
|
+
copy, holding the package's current text commented out, for you to turn into the change; later
|
|
184
|
+
runs count that copy as handled. It exits 1 when something still needs you.
|
|
185
|
+
|
|
186
|
+
### genesis upgrade
|
|
187
|
+
|
|
188
|
+
1. Reads the release: `@marktiderman/genesis@<version>` (default `latest`) and its
|
|
189
|
+
`versions.json`, as the [genesis-upgrade workflow](../../docs/APP-CI.md#genesis-upgrade) does,
|
|
190
|
+
or `--manifest <file>`. The bump is the workflow's own code (`src/upgrade/bump-core.mjs`, which
|
|
191
|
+
the workflow embeds): every Genesis dependency in every tracked package.json moves together,
|
|
192
|
+
keeping its range prefix; `workspace:`, `file:` and other ranges are left alone, nothing is
|
|
193
|
+
downgraded.
|
|
194
|
+
2. Runs a codemod only when a release declares a breaking change it fixes: the registry in
|
|
195
|
+
`src/upgrade/codemods.ts` (empty today) names the package and the first version that breaks, and
|
|
196
|
+
a codemod runs when a package moves across it. A major move (or a 0.x minor) without one is
|
|
197
|
+
listed so you read its changelog.
|
|
198
|
+
3. Reinstalls, then refreshes every file in `genesis.lock.json` from the newly installed package:
|
|
199
|
+
unchanged in the app, it takes the new version; changed by both, it is merged with `git
|
|
200
|
+
merge-file` against the old version (the base); a conflict goes to `<file>.genesis-next` and
|
|
201
|
+
your file is kept. `--keep-mine` never merges: the new text goes to `.genesis-next`. A file you
|
|
202
|
+
deleted stays deleted. AGENTS.md fragments are replaced, skills a block gained are copied, and
|
|
203
|
+
new package migrations are listed (run `genesis migrate`).
|
|
204
|
+
4. Runs `genesis doctor` and prints a summary; `--pr` commits to `genesis-upgrade/<version>`,
|
|
205
|
+
pushes and opens a pull request with `gh`. It checks first, before writing anything, that the
|
|
206
|
+
tree is clean, a branch is checked out and the branch name is free; it commits the lockfile
|
|
207
|
+
(found up to the repository's root), never `.genesis-next` files. `--dry-run` changes nothing,
|
|
208
|
+
and shows the refresh against the packages installed now.
|
|
209
|
+
|
|
210
|
+
`genesis.lock.json` is checked like a manifest, since anyone with commit access can edit it: each
|
|
211
|
+
entry may only write where its kind of source goes (a template to `eas.json`, `.eas/`, `.maestro/`
|
|
212
|
+
or `.github/workflows/`, a function file to `supabase/functions/<name>/`, a pgTAP test to
|
|
213
|
+
`supabase/tests/database/`, a skill to `.claude/skills/`), never a migration and never `.git`;
|
|
214
|
+
substitutions may only replace the starter's own names. A pgTAP test waits while its block has
|
|
215
|
+
new migrations to copy.
|
|
216
|
+
|
|
62
217
|
## Expo config plugin
|
|
63
218
|
|
|
64
219
|
`withGenesis()` keeps an Expo app's `app.config.ts` to a name, ids and plugins:
|
|
@@ -83,7 +238,7 @@ or call it yourself: `import { withGenesis } from "@marktiderman/genesis-cli/exp
|
|
|
83
238
|
|
|
84
239
|
| Step | What it sets | Option to turn it off |
|
|
85
240
|
| --- | --- | --- |
|
|
86
|
-
| App variants | `APP_VARIANT` = `development` / `preview` / `production` (default) suffixes `ios.bundleIdentifier` and `android.package` with `.dev` / `.preview
|
|
241
|
+
| App variants | `APP_VARIANT` = `development` / `preview` / `production` (default) suffixes `ios.bundleIdentifier` and `android.package` with `.dev` / `.preview`, `name` with ` (Dev)` / ` (Preview)` and each `scheme` with `-dev` / `-preview`, so the three install side by side and a `scheme://` link opens the build it names (production keeps the base scheme). Any other value fails. A value that already ends in the suffix is left alone. Change the suffixes with `variants: { development: { id: ".debug", name: " (Debug)", scheme: "-debug" } }`. | pass `variant: "production"` |
|
|
87
242
|
| Links | `ios.associatedDomains` (`applinks:` and, unless `links.webcredentials` is `false`, `webcredentials:` per host) and one Android `intentFilters` entry with `autoVerify`, from the `links` block of `genesis.config.json`. | `links: false` |
|
|
88
243
|
| Privacy manifest | `ios.privacyManifests.NSPrivacyAccessedAPITypes` for the packages in `dependencies`: `@react-native-async-storage/async-storage` needs FileTimestamp, reason `C617.1` (what its own `PrivacyInfo.xcprivacy` declares). | `privacyManifest: false` |
|
|
89
244
|
| Export compliance | `ios.config.usesNonExemptEncryption = false`. | `exportCompliance: false` |
|
|
@@ -211,6 +366,69 @@ before building something.
|
|
|
211
366
|
Scanned by default: `src/**/*.{ts,tsx,js,jsx,mts,cts,css}`, skipping tests, `__fixtures__`,
|
|
212
367
|
`__mocks__`, `*.d.ts` and `*.gen.*`. Comments are ignored by every rule.
|
|
213
368
|
|
|
369
|
+
### Rule packs
|
|
370
|
+
|
|
371
|
+
Two packs are opt-in, so a web app is unaffected until it lists them. Turn them on explicitly
|
|
372
|
+
(they are not auto-detected, so adding `expo` or a `supabase/` folder never changes a build's
|
|
373
|
+
result on its own):
|
|
374
|
+
|
|
375
|
+
```json
|
|
376
|
+
{
|
|
377
|
+
"doctor": {
|
|
378
|
+
"packs": ["native", "supabase"],
|
|
379
|
+
"native": { "routerRoot": "app" },
|
|
380
|
+
"supabase": { "migrations": "supabase/migrations", "base": "origin/main", "exposedSchemas": ["public"], "since": "20260101000000" }
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
Pack rule ids are built-in ids, so `rules` and `allow` work on them as on any other rule.
|
|
386
|
+
Folder settings (`routerRoot`, `migrations`) are app-relative: `./app/` is read as `app`, and
|
|
387
|
+
an absolute path or one leaving the app is a config error. `exposedSchemas` compares lowercased.
|
|
388
|
+
|
|
389
|
+
**`native`**, for Expo apps on `@marktiderman/genesis-ui-native`. With the pack on, the core
|
|
390
|
+
rules read the native package (unless `uiPackage` says otherwise) and the default scan is
|
|
391
|
+
`app`, `src` and `components`. The screen layouts are every component the installed native
|
|
392
|
+
package exports whose name ends in `Page`, `Screen` or `ScreenContainer` (`ScreenContainer`,
|
|
393
|
+
`SettingsPage`, `SettingsSubPage`, `NotificationsPage`, `AuthScreen`, `NativeResourcePage`, …),
|
|
394
|
+
so a new layout is recognized when Genesis ships it.
|
|
395
|
+
|
|
396
|
+
With the native pack on, every hex or `rgb()` literal in a script file is reported as
|
|
397
|
+
`native-literal-color` instead of `raw-color`, web files in a mixed repo included. Existing
|
|
398
|
+
`rules` and `allow` entries for `raw-color` that cover script files need the new id (CSS files
|
|
399
|
+
keep `raw-color`).
|
|
400
|
+
|
|
401
|
+
| Rule | Level | What it flags |
|
|
402
|
+
| --- | --- | --- |
|
|
403
|
+
| `native-raw-primitive` | error | A React Native primitive Genesis wraps, used from `react-native` (`Modal`, `ActivityIndicator`; the list in the repo's `scripts/lib/native-primitives.mjs`, shared with `check:forbidden-imports`): named and aliased imports (multi-line too), `import * as RN` then `RN.Modal`, `require("react-native").Modal`, destructured `require`, and `export { Modal } from "react-native"`. Type-only imports are fine. The message names the replacements the installed package exports. |
|
|
404
|
+
| `native-literal-color` | error | Hex and `rgb()/hsl()` literals in native code (the same lexer as `raw-color`, which it replaces for script files). Use a theme role (`useThemeRoles()`), a token className or `PlatformColor(...)`. |
|
|
405
|
+
| `native-custom-header` | warn | A file that sets `headerShown: false` and draws its own header (a `<…Header>` of the app's own, or `style={styles.header}`); a screen that draws one when the `_layout` beside it hides the navigator's; a hand-built tab bar (`tabBar={…}` in a file with `<Tabs>`, or a `<…TabBar>` of the app's own). Section headers (`SectionHeader`, `ListHeader`, `CardHeader`, …) and Genesis components don't count. Only the `_layout` in the screen's own folder is followed, not ancestors. |
|
|
406
|
+
| `native-screen-layout` | warn | A route screen under the router root (`native.routerRoot`, default `src/app`, else `app`) that renders no Genesis screen layout, directly or through one local import (`./`, `../`, `@/`, `~/`). `_layout`, `+html`, `+native-intent`, `+middleware`, `+api` files, re-export-only routes and `<Redirect>` routes are skipped. Also a warning when the router root is missing, or when `src` leaves it unscanned. |
|
|
407
|
+
| `store-readiness` | warn | Static checks of `app.json`, `app.config.json` and (as text, best-effort) `app.config.{ts,js,mjs,cjs}`. **Usage strings**: Expo applies an installed module's config plugin even when it isn't listed, with a generic default string (`Allow $(PRODUCT_NAME) to access your camera`), and App Review rejects generic purpose strings; so a module without its own sentence (`ios.infoPlist.<Key>` or the plugin option) is flagged, and `false` (Expo's opt-out) counts as set. Covered: `expo-camera`, `expo-image-picker` (photos; camera only "if the app takes photos"), `expo-media-library`, `expo-location`, `expo-av` / `expo-audio` (microphone "if the app records audio"), `expo-contacts`, `expo-local-authentication` (Face ID). **Sign in with Apple**: third-party sign-in (`@react-native-google-signin/google-signin`, `react-native-fbsdk-next`, or a Supabase `signInWithOAuth` / `signInWithIdToken` with a non-Apple provider) without Apple sign-in (`expo-apple-authentication`, or Supabase's `apple` provider). Guideline 4.8 accepts any equivalent privacy-focused login, so this is a warning to `allow` with the reason when another option qualifies; `expo-auth-session` alone doesn't trigger it (it serves non-login OAuth too). Also the export-compliance flag (`ios.config.usesNonExemptEncryption` or `ITSAppUsesNonExemptEncryption`), `ios.privacyManifests`, and a missing Expo config. Those two count as set when the [Expo config plugin](#expo-config-plugin) (`@marktiderman/genesis-cli` in `plugins`) will set them: export compliance unless `exportCompliance: false`, the privacy manifest unless `privacyManifest: false` and only when a dependency needs one. |
|
|
408
|
+
|
|
409
|
+
**`supabase`**, for `supabase/migrations/*.sql` (`supabase.migrations`). The SQL is read
|
|
410
|
+
statement by statement with comments removed and string (`'…'`, `E'…'`) and dollar-quoted
|
|
411
|
+
bodies blanked, so text inside a function body never matches; the one exception is below.
|
|
412
|
+
|
|
413
|
+
| Rule | Level | What it flags |
|
|
414
|
+
| --- | --- | --- |
|
|
415
|
+
| `migration-grants` | error / warn | In new migrations: `grant … on all functions in schema …` and `alter default privileges … grant … on functions` to `anon` or `public` (error) or `authenticated` (warn: it re-grants functions revoked from signed-in users); other roles (`service_role`, `postgres`) are fine. A function outside `exposedSchemas` granted to `anon` or `public` by name, and `grant usage on schema <unexposed> to anon/public` (error). Revokes, `revoke grant option for`, argument types and `granted by` are read correctly. Grant by name so an earlier revoke survives. |
|
|
416
|
+
| `migration-rls` | error | A table in an exposed schema whose row level security is off once every migration has run: never enabled, or disabled later. Renames (`alter table … rename to`, `set schema`) and drops are followed. RLS enabled by dynamic SQL (a `do $$ … execute format('alter table %I enable row level security', t) … $$` loop) can't be traced, so such a block counts as enabling it for every table created before it. |
|
|
417
|
+
| `migration-definer-search-path` | error | A `security definer` function or procedure without `set search_path`. Functions are keyed by name and argument types, so overloads are separate; `alter function … security definer` makes one definer, `alter function … set search_path` fixes it, and renames, replaces and drops are followed. |
|
|
418
|
+
| `migration-edited` | error | A `.sql` migration that already exists at the merge base with `supabase.base` (default `origin/main`) was modified, deleted or renamed. Applied migrations are never edited; add a new one. Skipped outside a git repo; a **warn** when the base ref isn't available. |
|
|
419
|
+
|
|
420
|
+
**Which migrations are new.** In a git repo with the base ref, a migration is new when it was
|
|
421
|
+
added, modified or is untracked since the merge base. `since` (a file name or timestamp prefix)
|
|
422
|
+
also trusts every file that sorts before it. Without git or the base ref (a shallow CI clone, a
|
|
423
|
+
Vercel build), `migration-grants` is skipped with a warning unless `since` is set, so applied
|
|
424
|
+
migrations never fail a build. In CI, check out with full history and fetch the base:
|
|
425
|
+
|
|
426
|
+
```yaml
|
|
427
|
+
- uses: actions/checkout@v4
|
|
428
|
+
with: { fetch-depth: 0 }
|
|
429
|
+
- run: git fetch origin main
|
|
430
|
+
```
|
|
431
|
+
|
|
214
432
|
### Config
|
|
215
433
|
|
|
216
434
|
`genesis.config.json` (or `"genesis": { "doctor": { … } }` in package.json):
|
|
@@ -237,10 +455,13 @@ Scanned by default: `src/**/*.{ts,tsx,js,jsx,mts,cts,css}`, skipping tests, `__f
|
|
|
237
455
|
|
|
238
456
|
| Key | Default | |
|
|
239
457
|
| --- | --- | --- |
|
|
240
|
-
| `
|
|
458
|
+
| `packs` | | Opt-in rule packs: `"native"`, `"supabase"`. See [Rule packs](#rule-packs). |
|
|
459
|
+
| `native` | | `{ routerRoot }` for the native pack. |
|
|
460
|
+
| `supabase` | | `{ migrations, base, exposedSchemas, since }` for the supabase pack. |
|
|
461
|
+
| `src` | `["src"]` (`["app", "src", "components"]` with the native pack) | Folders (or files) to scan. |
|
|
241
462
|
| `extensions` | `.ts .tsx .js .jsx .mts .cts .css` | |
|
|
242
463
|
| `ignore` | | Globs to skip, added to the defaults. `*` stays in a folder, `**` crosses folders, a trailing `/` means the whole folder. |
|
|
243
|
-
| `uiPackage` | `@marktiderman/genesis-ui` | |
|
|
464
|
+
| `uiPackage` | `@marktiderman/genesis-ui` (`@marktiderman/genesis-ui-native` with the native pack) | |
|
|
244
465
|
| `themeCss` | the design system's `dist/themes/*.css` + genesis-ui's styles | One stylesheet or a list: package paths (`@marktiderman/genesis-design-system/dist/themes/genesis.css`) or app paths. |
|
|
245
466
|
| `tokenFiles` | every scanned `.css` | Globs of app files whose `--x:` declarations count as defined tokens. Files outside `src` work too. |
|
|
246
467
|
| `ignoreTokenPrefixes` | `["--tw-", "--radix-"]` | |
|