@rtrentjones/greenlight 0.4.1 → 0.5.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.
@@ -1,28 +1,29 @@
1
1
  ---
2
2
  name: provider-supabase
3
- description: How Supabase works in a Greenlight setup — the `data: supabase` store (Postgres + auth + storage + realtime), single-project-schema-per-env model, the pause trap solved by keepalive, Management API token, and the read-only Supabase MCP. Use when wiring a tool's database, debugging a paused project, or a Supabase apply.
3
+ description: Supabase in a Greenlight setup — the `data: supabase` store (Postgres + auth + storage + realtime), schema-per-env, the 7-day pause trap solved by keepalive. Use when wiring a tool's database, debugging a paused project, or a Supabase apply.
4
4
  ---
5
5
 
6
6
  # provider-supabase
7
7
 
8
8
  `data: supabase` is for tools that need bundled **auth + storage + realtime** together
9
- (HeistMind). One Supabase **project**, **schema-per-env** (beta/prod share the project —
10
- NOT project-per-env; branching is paid). The project is **imported** (not recreated):
11
- name/region are replace-forcing, so the module sets `ignore_changes` to protect the live DB.
9
+ (HeistMind). One Supabase **project**, **schema-per-env** (beta/prod share the project — NOT
10
+ project-per-env; branching is paid). The project is **imported**, not recreated: name/region are
11
+ replace-forcing, so the module sets `ignore_changes` to protect the live DB.
12
12
 
13
13
  ## Token — `SUPABASE_ACCESS_TOKEN`
14
14
 
15
- Dashboard Account Access Tokens (Management API). Push it straight to GitHub Actions with
16
- `greenlight secrets gather` (or `gh secret set`) — Greenlight keeps no local secret file.
17
- `greenlight add` verifies it against `/v1/projects` (HTTP 200). The DB password
18
- (`TF_VAR_supabase_database_password`) is only used if the project is recreated ignored on
19
- import, so `import-placeholder` is fine for an existing project.
15
+ Creation + verify live in
16
+ [tokens-reference.md](https://github.com/RTrentJones/greenlight/blob/main/docs/tokens-reference.md).
17
+ Management API PAT, **account-scoped** (it manages every project in the account — keep it tight).
18
+ Single store: GitHub Actions secrets. The DB password (`TF_VAR_supabase_database_password`) is only
19
+ used if the project is *recreated* — ignored on import, so `import-placeholder` is fine for an
20
+ existing project.
20
21
 
21
22
  ## Terraform module — `infra/modules/supabase`
22
23
 
23
- Single project, import-safe. Outputs `url`, `anon_key`, `service_role_key`, `project_ref` —
24
- feed these straight into the consumer (e.g. the Vercel env block). To re-apply from fresh
25
- state, import first: `terraform import module.<name>_supabase.supabase_project.this <ref>`.
24
+ Single project, import-safe. Outputs `url`, `anon_key`, `service_role_key`, `project_ref` — feed
25
+ these straight into the consumer (e.g. the Vercel env block). To re-apply from fresh state, import
26
+ first: `terraform import module.<name>_supabase.supabase_project.this <ref>`.
26
27
 
27
28
  ## Keepalive — non-negotiable
28
29
 
@@ -32,10 +33,14 @@ Supabase **pauses a free project after ~7 days idle** — this is what takes too
32
33
  The ping counts any HTTP response (even 401 on `/rest/v1/`) as alive.
33
34
 
34
35
  ## MCP
35
-
36
36
  `.mcp.json` wires `supabase` (hosted, **read-only**): needs `SUPABASE_ACCESS_TOKEN` +
37
37
  `SUPABASE_PROJECT_REF` in the env (Claude Code expands `${VAR}` in the url/header). Run `/mcp`.
38
38
 
39
- ## Rule
40
- The **blog must never use Supabase** for state (it must stay up unattended) — use D1/KV or
41
- external services. Supabase is per-tool, only when the bundled features are needed together.
39
+ ## Gotchas
40
+ - **The blog must never use Supabase** for state (it must stay up unattended) — use D1/KV or
41
+ external services. Supabase is per-tool, only when the bundled features are needed together.
42
+ - **Migrations gate.** A supabase tool that owns `supabase/migrations` must run `greenlight
43
+ migrations scan` in the CI that applies them (before `supabase db push`) — `doctor` flags a
44
+ migrations dir whose workflows don't.
45
+ - **Forgetting keepalive** is the #1 silent-death cause for a supabase tool — `doctor` does not yet
46
+ assert it, so wire `targets_json` when you add the tool.
@@ -1,63 +1,66 @@
1
1
  ---
2
2
  name: provider-vercel
3
- description: How Vercel works in a Greenlight setup — the default target for the `next` lane, configure-existing-project model (domains + env vars by project_id; deploys ride git integration), team-scoped token, and the Vercel MCP. Use when wiring a next/vercel tool, env vars, domains, or debugging a Vercel deploy.
3
+ description: Vercel in a Greenlight setup — the default target for the `next` lane (configure-existing-project: domains + env vars by project_id; deploys ride git integration). Use when wiring a next/vercel tool, env vars, domains, or debugging a Vercel deploy or verify.
4
4
  ---
5
5
 
6
6
  # provider-vercel
7
7
 
8
- Vercel is the default `target` for the `next` lane. Greenlight does **not** create or deploy
9
- the project — it **configures an existing** Vercel project (domains + environment variables)
10
- by `project_id`, and the app's own repo deploys via Vercel's **git integration** (push →
11
- build). The wrapper owns infra; the tool repo owns deploys.
8
+ Vercel is the default `target` for the `next` lane. Greenlight does **not** create or deploy the
9
+ project — it **configures an existing** Vercel project (domains + environment variables) by
10
+ `project_id`, and the app's own repo deploys via Vercel's **git integration** (push → build). The
11
+ wrapper owns infra; the tool repo owns deploys.
12
12
 
13
13
  ## Token — `VERCEL_API_TOKEN`
14
14
 
15
- Account Settings Tokens. **Scope it to the team** that owns the project. The Terraform
16
- `vercel` provider also takes `team` (the `team_…` id). Push it straight to GitHub Actions with
17
- `greenlight secrets gather` (or `gh secret set`) Greenlight keeps no local secret file.
18
- `greenlight add` verifies it against `/v2/user` (HTTP 200) before commit.
15
+ Creation + verify live in
16
+ [tokens-reference.md](https://github.com/RTrentJones/greenlight/blob/main/docs/tokens-reference.md).
17
+ **Scope it to the team** that owns the project (the Terraform `vercel` provider also takes the
18
+ `team_…` id). Single store: GitHub Actions secrets.
19
19
 
20
20
  ## Terraform module — `infra/modules/vercel`
21
21
 
22
22
  Manages the **existing** project (nothing to import — it configures by id):
23
23
  - `domain` → adds `<name>.<domain>` (production) + `beta.<name>.<domain>` (preview/`beta_branch`).
24
- - `environment` + `environment_values` → env vars per target (`production` / `preview`).
25
- Wire Supabase creds straight from the `supabase` module's outputs — no manual copy (that
26
- manual copy was the old fragility).
24
+ - `environment` + `environment_values` → env vars per target (`production` / `preview`). Wire
25
+ Supabase/Neon creds straight from those modules' outputs — no manual copy (that copy was the old
26
+ fragility).
27
27
 
28
28
  The DNS CNAME is the **cloudflare** `tool` module, unproxied (`proxied = false`) → `cname.vercel-dns.com`.
29
29
 
30
30
  ## The verify loop — tool-CI on `deployment_status`
31
31
 
32
- Because Vercel deploys (not the wrapper), the verify gate runs in the **tool repo's own CI**, not a
33
- wrapper deploy listener. `greenlight adopt … --target vercel` emits, into the tool repo:
32
+ Because Vercel deploys (not the wrapper), the verify gate runs in the **tool repo's own CI**.
33
+ `greenlight adopt … --target vercel` emits, into the tool repo:
34
34
  - **`.github/workflows/greenlight-verify.yml`** — triggers on GitHub's **`deployment_status`** event
35
35
  (Vercel posts a deployment + `target_url`); on `state == success` it runs
36
36
  `npx @rtrentjones/greenlight verify --url <target_url> --spec verify/<name>.config.ts`. The result
37
- is a check on the commit — no wrapper round-trip, no dispatch/status PATs (Vercel owns deploy + URL
38
- + its own statuses).
39
- - **`verify/<name>.config.ts`** a verifyAll array: `api` (deployed URL 200) + `test` (the tool's
40
- suite) + `agent-web` (LLM drives the live UI), where agent-web is **config-gated on
41
- `ANTHROPIC_API_KEY`** (omitted when unset → the gate stays green on api + test alone).
37
+ is a check on the commit — no wrapper round-trip, no dispatch/status PATs.
38
+ - **`verify/<name>.config.ts`** — a verifyAll array: `api` + `test` (the tool's suite) + `agent-web`
39
+ (LLM drives the live UI), where agent-web is **config-gated on `ANTHROPIC_API_KEY`** (omitted when
40
+ unset the gate stays green on api + test alone).
42
41
 
43
42
  `greenlight verify --url <url> --spec <path>` is the **manifest-free** mode that makes this work
44
43
  without carrying the wrapper's `greenlight.config.ts` into the tool repo.
45
44
 
46
- **Deployment Protection gotcha:** `deployment_status.target_url` is the `*.vercel.app` *deployment*
47
- URL, which Vercel **Deployment Protection** gates (→ **401**) even though the public custom domain
48
- is 200. To verify the real app, create a **Protection Bypass for Automation** secret (Vercel →
49
- project → Settings → Deployment Protection) and set it as `VERCEL_AUTOMATION_BYPASS_SECRET_<TOOL>` (per-tool — the bypass value is per Vercel project, so a second vercel tool never collides) on the
50
- tool repo — the api check sends it as `x-vercel-protection-bypass` and asserts 200. Without it the
51
- generated spec asserts **401** (the deployment is served + protected), so the gate stays green.
52
-
53
45
  ## MCP
54
-
55
- `.mcp.json` wires `vercel` (hosted, OAuth, read-only). Run `/mcp` and authenticate in the
56
- browser. Use it to read deployments, build logs, runtime logs, projects.
46
+ `.mcp.json` wires `vercel` (hosted, OAuth, read-only). Run `/mcp` and authenticate in the browser —
47
+ read deployments, build logs, runtime logs, projects.
57
48
 
58
49
  ## Gotchas
59
- - **ENV_CONFLICT** on apply = a var with that key/target already exists on the project. Delete
60
- the pre-existing ones (Vercel dashboard or API) then re-apply, or import them.
61
- - The Greenlight `beta_branch` must match the repo's actual pre-prod branch (HeistMind uses
62
- `development`; new tools use `develop`).
50
+ - **`ENV_CONFLICT` on apply** = a var with that key/target already exists on the project. **Terraform
51
+ owns env vars and does not upsert** — delete the pre-existing ones (dashboard or API) and re-apply,
52
+ or `terraform import` them first. Adopting an existing project means importing its env vars.
53
+ - **pnpm workspace membership** (a local `next`/`vercel` monorepo tool) — add `tools/<name>` to
54
+ `pnpm-workspace.yaml`, else Vercel's root install skips its deps (`Cannot find package 'pg'`).
55
+ `doctor` flags this.
56
+ - **`vercel.json` framework preset** — without `{ "framework": "nextjs" }` Vercel treats the Next
57
+ build as a static site (`No Output Directory named "public"`). `doctor` flags a missing one.
58
+ - **Deployment Protection (401 on the `*.vercel.app` URL).** `deployment_status.target_url` is the
59
+ *deployment* URL, which Deployment Protection gates to **401** even when the public custom domain is
60
+ 200. Create a **Protection Bypass for Automation** secret and set it as
61
+ `VERCEL_AUTOMATION_BYPASS_SECRET_<TOOL>` (per-tool — the value is per Vercel project) on the tool
62
+ repo; the api check sends it as `x-vercel-protection-bypass` and asserts 200. Without it the spec
63
+ asserts **401** so the gate still stays green.
64
+ - **`beta_branch` must match the repo's real pre-prod branch** (HeistMind uses `development`; new
65
+ tools use `develop`).
63
66
  - `next` can also target `workers` (V0/V2) — default is vercel.