Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
12 changes: 4 additions & 8 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
# Public build variable. Leave blank to omit the challenge widget in local development.
PUBLIC_TURNSTILE_SITE_KEY=

# Cloudflare Pages runtime secrets / variables for website forms.
RESEND_API_KEY=
TURNSTILE_SECRET_KEY=
FORM_FROM_EMAIL=Pilot Protocol Website <forms@newsletter.pilotprotocol.network>
FORM_TO_EMAIL=founders@pilotprotocol.network
# Random string for Payload: openssl rand -hex 32
PAYLOAD_SECRET=
# Public origin of the site, e.g. https://pilotprotocol.network
NEXT_PUBLIC_SERVER_URL=
111 changes: 24 additions & 87 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,15 @@
name: ci

on:
# Deploys run only from here: Actions > ci > Run workflow.
workflow_dispatch:
# Fired by TeoSlayer/pilot-skills (trigger-website-deploy.yml) whenever
# skills.json or setups.json change on its main, so the Skill Zoo, which
# fetches skills.json at build time, republishes without a website commit.
repository_dispatch:
types: [pilot-skills-updated]
# Daily safety net for the same reason: if the dispatch is missed or the
# token is missing, the catalog is at most a day stale.
schedule:
- cron: '41 5 * * *'
push:
branches: [main]
pull_request:
branches: [main]

permissions:
contents: read
# Required by wrangler-action for OIDC / deployments comment posting.
deployments: write
# Required so the post-deploy step can comment the preview URL on the PR.
pull-requests: write

jobs:
build:
Expand All @@ -31,85 +19,34 @@ jobs:

- uses: actions/setup-node@v4
with:
node-version: '22'
node-version-file: .nvmrc
cache: 'npm'

- run: npm ci

- name: Check plain (machine UI) coverage
run: npm run check:plain
# next typegen writes next-env.d.ts and the route types that tsc reads.
- name: Type check
run: |
npx next typegen
npx tsc --noEmit

- name: Check teaser scroll regressions
run: npm run check:teaser
- name: Lint
run: npm run lint

- name: Build site
# PostHog (heatmaps + session recordings) is initialised in
# src/scripts/analytics.ts, but it early-returns unless
# PUBLIC_POSTHOG_KEY is present *at build time* — Astro inlines
# import.meta.env.PUBLIC_* into the client bundle. Without these the
# site ships GA4 only and PostHog is silently dead in production.
# Both are public-by-design project values (safe in the bundle); they
# live in repo secrets only so they are easy to rotate.
# The production build (the sky variant), as deploy:app makes it. Payload-backed pages render per
# request, so the build only needs the local D1 that Wrangler's platform proxy creates.
- name: Build the Worker
env:
PUBLIC_POSTHOG_KEY: ${{ secrets.PUBLIC_POSTHOG_KEY }}
PUBLIC_POSTHOG_HOST: ${{ secrets.PUBLIC_POSTHOG_HOST || 'https://us.i.posthog.com' }}
run: npm run build

- name: Warn when PostHog is not configured
NEXT_PUBLIC_SITE_VARIANT: sky
NEXT_PUBLIC_SERVER_URL: https://pilotprotocol.network
run: npx opennextjs-cloudflare build

# npm run deploy: the migrations on the production D1, then the sky build to the
# pilot-protocol-website Worker at pilotprotocol.network. See "Deploy to Cloudflare" in README.md
# for the one-time setup (D1 database id, PAYLOAD_SECRET, the domain) this needs first.
- name: Deploy to Cloudflare
if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main'
env:
PUBLIC_POSTHOG_KEY: ${{ secrets.PUBLIC_POSTHOG_KEY }}
run: |
if [ -z "$PUBLIC_POSTHOG_KEY" ]; then
echo "::warning::PUBLIC_POSTHOG_KEY is not set — this build ships GA4 only; PostHog heatmaps/session recordings are disabled."
else
echo "PostHog configured for this build."
fi

- uses: actions/upload-artifact@v4
with:
name: site-build
path: dist/
retention-days: 7

# Deploy to Cloudflare Pages:
# - push to main → production (pilotprotocol.pages.dev)
# - repository_dispatch → production (runs on main; skills catalog changed)
# - schedule → production (daily catalog refresh)
# - PR from internal branch → preview (<branch>.pilotprotocol.pages.dev)
# - PR from a fork → skipped (no secret access on forks)
- name: Deploy to Cloudflare Pages
id: deploy
if: |
github.event_name == 'push' ||
github.event_name == 'repository_dispatch' ||
github.event_name == 'schedule' ||
(github.event_name == 'pull_request' &&
github.event.pull_request.head.repo.full_name == github.repository)
uses: cloudflare/wrangler-action@9acf94ace14e7dc412b076f2c5c20b8ce93c79cd # v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
# Cloudflare treats branch=main as production, anything else
# as a preview environment with a branch-keyed subdomain.
command: >-
pages deploy dist
--project-name=pilotprotocol
--branch=${{ github.event_name != 'pull_request' && 'main' || github.head_ref }}
--commit-dirty=true

# Sticky comment so subsequent pushes update the same comment
# instead of stacking — keeps the PR thread clean. Header value
# must be unique per comment kind on this repo.
- name: Comment preview URL on PR
if: |
github.event_name == 'pull_request' &&
steps.deploy.outputs.deployment-url
uses: marocchino/sticky-pull-request-comment@773744901bac0e8cbb5a0dc842800d45e9b2b405 # v2
with:
header: cloudflare-pages-preview
message: |
🚀 **Preview deployed to Cloudflare Pages**

- Commit deploy URL: ${{ steps.deploy.outputs.deployment-url }}
- Branch alias: `https://${{ github.head_ref }}.pilotprotocol.pages.dev` (may take ~30s to propagate)
- Commit: `${{ github.event.pull_request.head.sha }}`
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
run: npm run deploy
85 changes: 0 additions & 85 deletions .github/workflows/plain-sync.yml

This file was deleted.

72 changes: 50 additions & 22 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,29 +1,57 @@
node_modules/
dist/
.astro/
.env
.env.local
.dev.vars
.dev.vars.*
*.log
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# Local artifact renders (published copies live under public/)
output/
tmp/
# dependencies
/node_modules
/.pnp
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/versions

# Cloudflare Pages local dev cache
.wrangler/
# testing
/coverage

# Auto-generated by scripts/build-cf-error-pages.mjs (regenerated every build)
functions/_500-body.ts
# next.js
/.next/
/out/

# Cloudflare Worker (worker/) build/cache
worker/node_modules/
worker/.wrangler/
worker/coverage/
# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# env files (can opt-in for committing if needed)
.env*

.env
# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
.gstack/

# macOS
.DS_Store
# cloudflare
.wrangler
.context/

# OpenNext / Payload
.open-next
.dev.vars
src/payload-types.ts.bak
!.env.example
.source

# The pilot-publish Worker (worker/)
worker/node_modules/
worker/coverage/
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
26
15 changes: 13 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,16 @@ Label them with what they count: registered addresses (all time); daemons seen i

## Before you open a pull request

`npm run build`, `npm run check:plain` and `npm run check:site` must pass. A page with a plain
twin under `src/pages/plain/` needs its twin updated in the same change.
`npm run lint` and `npm run build` (which runs the type check) must pass. Docs pages live in
`content/docs` (MDX) and need an entry in `content/docs/meta.json`; posts are written in the
Payload admin, not committed.

<!-- BEGIN:nextjs-agent-rules -->

## This is NOT the Next.js you know

This version has breaking changes — APIs, conventions, and file structure may all differ from your training data. Read the relevant guide in `node_modules/next/dist/docs/` (resolved from this file's directory; in monorepos the `next` package may not be visible from the repo root) before writing any code. Heed deprecation notices.

This block is written and re-added by `next dev` — verify at `node_modules/next/dist/server/lib/generate-agent-files.js`. Removing it from a diff only re-creates the uncommitted change; committing it with your work keeps the tree clean.

<!-- END:nextjs-agent-rules -->
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ All notable changes to this project are documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Changed

- Rebuilt the site on Next.js 16, deployed to Cloudflare Workers with OpenNext in place of
Astro on Cloudflare Pages. Docs are MDX in `content/docs`, rendered with Fumadocs, and also
served as Markdown at `/docs/<page>.mdx`, which replaces the `/plain` twins. Blog, learning
center and newsroom posts move to Payload CMS (D1 and R2, admin at `/admin`). Production
builds the sky design; the green design stays available with `npm run deploy:green`.

## [v0.1.0]

Initial release.
18 changes: 10 additions & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Contributing

Thanks for your interest in contributing to `website` — Pilot Protocol website + docs — Astro static site at pilotprotocol.network.
Thanks for your interest in contributing to `website` — Pilot Protocol website + docs — Next.js site at pilotprotocol.network.

## Quick start

Expand All @@ -10,6 +10,8 @@ cd website
npm ci && npm run build
```

`README.md` covers local development with Payload's local database, the two site variants and deploys.

## Pull requests

1. Open an issue first for non-trivial changes so design can be discussed.
Expand All @@ -18,14 +20,14 @@ npm ci && npm run build
4. Coverage should not regress (Codecov reports per-PR delta).
5. Conventional commit style is preferred (`feat:`, `fix:`, `docs:`, `chore:`, …) but not enforced.

## Machine UI parity
## Docs pages and posts

Every page also ships a plain-text "machine UI" twin under `src/pages/plain/`
for AI agents and screen readers. CI runs `npm run check:plain`, which fails if
a human page is missing its `/plain/` twin or a plain page is left orphaned. If
you add or remove a `docs/*` page (or one of the curated marketing pages), add
or remove its plain twin in the same PR. Run `npm run check:plain` locally to
verify before pushing.
A docs page is an MDX file in `content/docs` plus its entry in
`content/docs/meta.json`; agents get the same page as Markdown at
`/docs/<page>.mdx`, so there is no separate plain-text copy to keep in step.
Blog, learning center and newsroom posts are written in the Payload admin at
`/admin`, not committed to this repo. Before pushing, run `npm run lint` and
`npm run build` (the build runs the type check).

## Code of conduct

Expand Down
Loading
Loading