@rtrentjones/greenlight 0.4.1 → 0.5.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.
@@ -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.