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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .baseline/identity.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"_comment": "THIS TREE'S OWN IDENTITY \u2014 the FROM side of every rebrand. tooling/rebrand/rebrand.mjs reads it to know what to rename AWAY from; a product's identity is the --values file, which is the TO side. Change a value here only together with the tree: these strings must be what the tree actually contains, or the rename silently misses and the product ships carrying this baseline's name. `productName` is the SITE_NAME seam in apps/web/src/lib/site.ts (the name the sample content and the titles use until BaseHub is connected); `domain` and `subdomain` are placeholders, because this baseline has never deployed under a name of its own; `githubOwner` is the owner in the source links (SOURCE_URL, the docs).",
"slug": "basehub-marketing",
"pascal": "BasehubMarketing",
"productName": "Marketing Website",
"domain": "basehub-marketing.example.com",
"subdomain": "your-workers-subdomain",
"githubOwner": "sourceplane"
}
171 changes: 171 additions & 0 deletions .baseline/product/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
# basehub-marketing

A marketing website whose pages — heroes, feature grids, pricing, testimonials,
FAQs, callouts and forms — its blog, its changelog, its navigation and its
theme are edited in [BaseHub](https://basehub.com) and read over BaseHub's
GraphQL API, running on **Cloudflare Workers + Static Assets** through
[`@opennextjs/cloudflare`](https://opennext.js.org/cloudflare). It is
BaseHub's [marketing website template](https://github.com/basehub-ai/marketing-website-template),
ported to Workers.

## Live deployment

<!-- 02-docs:begin -->
Not recorded yet. The bootstrap's last phase writes the live URLs, the
workspace and the secrets the site uses into
[ai/context/deployment.md](ai/context/deployment.md); how the site deploys
and how to operate it is in
[ai/context/operations.md](ai/context/operations.md).
<!-- 02-docs:end -->

## Connecting BaseHub

The site deploys and serves before it has a BaseHub repository: until its
build is given a BaseHub read token it shows **sample content** bundled with
it — five pages, three blog posts and three changelog releases — under a bar
that says so. The newsletter and contact forms accept a submission and drop
it, and the blog has no search box. To make it read your content:

1. **Create the repository.** BaseHub's [Use template](https://basehub.com/basehub/marketing-website)
copies the template's content model and its demo content into a new
BaseHub repository of yours. Edit it there, and **commit** what you want
live — the site reads the committed content.
2. **Give the build its token**, once per deployed environment: the
repository's **read token** (the repository's Connect panel, or Settings →
Tokens). `next build` reads every page from BaseHub and bakes the token
into the server bundle (never into the browser's), so it is this
repository's Orun secret, and stage and prod can each name their own
repository or branch:

```bash
orun secrets set BASEHUB_TOKEN --env stage # prompts for the value
orun secrets set BASEHUB_TOKEN --env prod
```

Then **redeploy the site**: a secret is read when the site builds, and
setting one builds nothing. Use **Deploy by hand** below, or change the
stamp on the last line of `apps/web/component.yaml`
(`# orun: redeploy …`) and merge; the sample content and the bar are gone
from that deploy on, the forms send their submissions to BaseHub's events,
the blog has BaseHub's search, and BaseHub's toolbar is on the page.

Every page is rendered by the build, as upstream's are, so **a commit in
BaseHub shows on the next deploy** — redeploy after publishing. A connected
build also carries BaseHub's toolbar, as upstream does; its draft-mode
switch is not exercised by the site's tests on Workers, so check it before
your editors rely on it.

## What is here

| Surface | Where |
|---|---|
| Pages (`[[...slug]]`), the blog, the changelog, feeds, sitemap, robots, `/api/health` | `apps/web/src/app` |
| The page sections | `apps/web/src/app/_sections` |
| BaseHub's client, `<Pump>`, events and images — or the sample content when unconnected | `apps/web/src/lib/basehub` |
| The sample content and its images | `apps/web/src/lib/basehub/sample`, `apps/web/public/sample` |
| BaseHub's schema types (committed) | `apps/web/basehub-types.d.ts` |
| The site's name | `apps/web/src/lib/site.ts` |
| The fonts (Geist, self-hosted) | `apps/web/src/app/fonts` |
| Workers build and deploy contract | `apps/web/next.config.ts`, `open-next.config.ts`, `wrangler.jsonc`, `component.yaml` |
| Tests | `tests/web` (vitest) |

## Getting started

```bash
pnpm install
pnpm typecheck
pnpm lint
pnpm test
pnpm build # next build + opennextjs-cloudflare build → apps/web/.open-next
pnpm --filter @app/web preview # wrangler dev over the built Worker
```

That needs no BaseHub repository, and is what to run before you push: a pull
request builds the site but does not lint or run its tests. With one:

```bash
cd apps/web
cp .env.example .env.local # BASEHUB_TOKEN=<the repository's read token>
cd ../..
pnpm --filter @app/web dev # http://localhost:3000
```

When you change the content model in BaseHub, regenerate the types the code
is checked against and commit them:

```bash
BASEHUB_TOKEN=<token> pnpm --filter @app/web basehub:types
```

| Variable | Read | What it does |
|---|---|---|
| `BASEHUB_TOKEN` | build time | The BaseHub repository's read token. Deployed builds take it from the `BASEHUB_TOKEN` secret of their environment. Unset, the site is unconnected: sample content under a notice. |
| `NEXT_PUBLIC_SITE_URL` | build time | The site's origin, for the sitemap, robots, feeds and Open Graph links. Deployed builds set it per environment. |

## How it deploys

Merges to `main` converge through [Orun](https://github.com/sourceplane/orun):
`.github/workflows/ci.yml` plans the changed components and runs each lane
against the workspace in `intent.yaml`. The site builds once per
environment, with that environment's BaseHub token and origin, and deploys
— to `stage`, then to `prod` once stage has converged on the same commit;
`dev` only verifies. The Worker is `basehub-marketing-web-<env>` on your
account's workers.dev subdomain, and every deploy is smoke-tested over HTTP:
the home page must render with its link to the blog and `/api/health` must
answer. A pull request runs the same pipeline's verify lanes: the site built
and dry-deployed for each environment, with nothing deployed. They do not
lint or run the tests, so run `pnpm typecheck`, `pnpm lint` and `pnpm test`
before you push. (A push to `main` builds, deploys and smoke-tests.)

The Worker is a little over 3 MiB gzipped — BaseHub's code-block renderer
carries every language grammar — so the Cloudflare account needs the
**Workers Paid** plan (Free allows 3 MiB).

The pipeline holds one credential, GitHub's own `GITHUB_TOKEN`. The
Cloudflare token and account id are brokered per run from the workspace's
Cloudflare connection; nothing provider-shaped is stored in the repository
or in GitHub.

**Deploy by hand.** Orunbase's **Deploy** button on a component, or **Run
workflow** on the CI workflow in GitHub's Actions tab (on `main`), runs
`ci.yml` for the environment and components you pick, and each one deploys
exactly as a merge would deploy it. Leave the component blank to redeploy
every component in that environment, with nothing changed: after rotating a
secret, or publishing in BaseHub, say. A component with nothing to run in
that environment (a test suite in `prod`) is left out with a notice.

## Custom domain

The site answers on workers.dev from its first deploy. To serve it on your
own domain:

1. Add the domain to the Cloudflare account the site deploys into, and attach
it to the Worker (dashboard → Workers & Pages →
`basehub-marketing-web-prod` → Settings → Domains & Routes → Add →
Custom domain). Do the same for stage with a subdomain if you want one.
2. Record the environment's public origin in `intent.yaml`: the deploy
builds the sitemap, robots, feeds and Open Graph links for it (until then
they name the workers.dev URL), and the deployment record probes it
beside the workers.dev URL:

```yaml
environments:
prod:
env:
SITE_URL: https://basehub-marketing.example.com
```

The site was born with the reserved placeholder
`basehub-marketing.example.com` where its domain goes: that example and
`BASE_DOMAIN` under each environment (dev, stage and prod) in
`intent.yaml`. Replace it with your domain in the same change, and land it
with a change under `apps/web` so the merge rebuilds the site.

## Credits

The site is BaseHub's [marketing website template](https://github.com/basehub-ai/marketing-website-template).
That repository carries no licence: it has no LICENSE file, its
`package.json` declares none and GitHub records none. The sample content and
its images were written for this site's first deploy; replace them by
connecting BaseHub. Geist is © Vercel, under the SIL Open Font License 1.1
(`apps/web/src/app/fonts/Geist-OFL.txt`).
23 changes: 23 additions & 0 deletions .baseline/tasks/01-product.TaskContract.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Task contract template for the 01-product landing — the whole site in one
# pull request. Unbound to a key on purpose: `orun.task/ensure@v1` seals and
# attaches it to the key the allocator issues. It lives under `.baseline/`,
# not `tasks/`, because `tasks/` is this repository's own work tree
# (`intent.yaml` `work:`), where an unkeyed contract is an error. gates: [] is
# a DECLARATION — merge alone finishes this task; the main convergence is the
# gate the bootstrap watches, not one the plane observes as a PR check.
#
# `affects` names COMPONENTS, by metadata.name: the phase's retouch hook reads
# this list to decide which component.yaml files get the redeploy marker, so
# the deploy set and the task plane's statement of the work are one list.
apiVersion: orun.io/v1
kind: TaskContract
spec:
goal: The site's repository is born and linked, the whole site lands in one pull request, and one convergence deploys it to stage and prod — serving its sample content until a BaseHub repository is connected
affects:
- web
- web-tests
doneWhen:
- repo pushed, main pinned as default, workspace linked
- main convergence green (build, deploy and smoke on stage and prod)
- the site answers on both workers.dev URLs
gates: []
13 changes: 13 additions & 0 deletions .baseline/tasks/02-docs.TaskContract.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Task contract template for the 02-docs landing. See 01-product's header.
apiVersion: orun.io/v1
kind: TaskContract
spec:
goal: The live deployment is recorded from verified facts as agent-readable state in the site's repo
affects:
- ai/context/deployment.md
- ai/context/operations.md
- README.md
doneWhen:
- committed deployment manifest matches probed reality
- prod waits on stage again, and dev verifies every merge to main again
gates: []
153 changes: 153 additions & 0 deletions .github/workflows/baseline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
name: Baseline CI

# THE FACTORY'S OWN LANES — this repository tested as a BASELINE: that its
# build document parses with the orun a bootstrap actually runs, that its card
# agrees with it, that every component is placed by the one product phase,
# that a placed tree comes up branded and carrying nothing of the factory —
# and plans the site onto stage and prod on a merge — and that the site it
# produces installs, builds, deploys (dry) and serves with no BaseHub repository
# behind it.
#
# ─── WHY THIS IS NOT IN ci.yml ────────────────────────────────────────────
#
# `repo-blueprint.yaml`'s `github-workflows` module copies the WHOLE `.github`
# directory into every site built from this repository. These jobs run
# `testing/*.sh`, and `testing/` is deliberately not placed — so in a site they
# would be steps that cannot pass, red on its very first pull request. This
# file is in the blueprint's `ignore` list, and `testing/coverage.test.sh`
# fails on any workflow that reads `testing/` and is not.

on:
push:
branches: [main]
pull_request:

concurrency:
group: baseline-ci-${{ github.event_name == 'pull_request' && github.ref || github.run_id }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

permissions:
contents: read

jobs:
# Tier 0. bash, python3 and git; node for the tools. No workspace install,
# no network, no credential — the job that most certainly fails a PR.
baseline-contract:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v5
with:
node-version: 22
# setup-node v5 turns on the pnpm cache by itself when package.json
# names a packageManager, and then fails on a runner with no pnpm.
# This job installs nothing.
package-manager-cache: false
- name: Contract tests (manifest, phases, coverage, rebrand, retouch, bootstrap-defer)
run: |
set -euo pipefail
python3 -c 'import yaml' 2>/dev/null || pip install --quiet pyyaml
for t in manifest phases coverage rebrand retouch bootstrap-defer; do
echo "── $t"
bash "testing/$t.test.sh"
done
# Every component's docs/{overview,architecture,runbook}.md is generated
# from what the component declares (its manifest, Worker config,
# Terraform, migrations, package scripts). A pull request that changes
# one of those facts without regenerating the pages fails here.
- name: Component docs match their manifests
run: python3 tooling/catalog/gen-component-docs.py --check

# Tier 1. THE BLUEPRINT, READ AND PLACED BY THE BINARY A BOOTSTRAP RUNS.
#
# Pinned at the bootstrap floor (BOOTSTRAP.md), not the site's lane pin:
# every test here reads YAML with PyYAML, which parses anything well-formed;
# only the pinned orun can say whether the document is one a bootstrap can
# run. `--status` parses it, validates every hook against the action
# registry, compiles every `when` and narration template, and writes
# nothing. Then the leak gate (what a product would carry, derived by the
# floor too), and the placement tier (the offline bootstrap: both phases
# placed and finished by the blueprint's own hooks, then the product's own
# `orun plan` for the 01-product merge, below).
blueprint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: sourceplane/orun-action@v1.2.0
with:
version: v2.88.0
- uses: pnpm/action-setup@v4
with:
version: 10.12.1
- uses: actions/setup-node@v5
with:
node-version: 22
# This job installs nothing either: with no lockfile hook the offline
# bootstrap never runs pnpm, so there is no store, and the pnpm cache
# setup-node v5 turns on by itself (package.json names a packageManager)
# fails the job saving a path that does not exist whenever no earlier
# cache exists for the lockfile.
package-manager-cache: false
- name: repo-blueprint.yaml, read by the pinned CLI
run: |
set -euo pipefail
orun --version
python3 -c 'import yaml' 2>/dev/null || pip install --quiet pyyaml
# Required inputs must be supplied for the document to resolve; the
# values are arbitrary and nothing is written.
orun new --blueprint repo-blueprint.yaml --status \
--out "$(mktemp -d)" \
--set reponame=acme-site \
--set "productname=Acme Site" \
--set githuborg=acme-inc
- name: the leak gate — what a product carries
run: bash testing/leak.test.sh
# The placement tier ENDS with the product's own `orun plan` — what the
# product's ci.yml runs — so it needs an orun at the product's lane pin
# (v2.78.4) or newer: the plan a convergence waits on is the lane pin's
# (its optional secret refs included), and the test refuses an orun
# older than the pin rather than assert the wrong CLI's plan. The
# offline bootstrap before it reads the blueprint, which takes the
# bootstrap floor (v2.88.0: the one `secrets` reconcile, the task set-up
# in the background, the landings checked in the box), so this tier
# runs the floor, which is newer than the lane pin.
- uses: sourceplane/orun-action@v1.2.0
with:
version: v2.88.0
- name: placement — the offline bootstrap, and the product's own plan
run: |
git config --global user.email ci@example.invalid
git config --global user.name "baseline ci"
bash testing/placement.test.sh

# Tier 2. THE SITE IT PRODUCES WORKS, WITH NO BASEHUB REPOSITORY: each
# landing installed, its fixture rendered, type-checked, linted, tested and
# built, the stage lane's own structure check, build, output check and dry
# deploy in the tree orun stages, and the built Worker served and
# smoke-tested with the component's own smoke command — the sample content
# under the "connect BaseHub" bar on every route the site promises. Then
# the lane's build again with a token, against a stand-in BaseHub on
# localhost (never the real service), served and read back as the stand-in
# repository's site. Pinned at the bootstrap floor (v2.88.0): the offline bootstrap
# reads the blueprint, and the floor is newer than the product's lane pin
# (v2.78.4), which is all the lane steps need.
site:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: sourceplane/orun-action@v1.2.0
with:
version: v2.88.0
- uses: pnpm/action-setup@v4
with:
version: 10.12.1
- uses: actions/setup-node@v5
with:
node-version: 22
cache: pnpm
- name: e2e — the bootstrapped site builds, deploys (dry) and serves
run: |
python3 -c 'import yaml' 2>/dev/null || pip install --quiet pyyaml
git config --global user.email ci@example.invalid
git config --global user.name "baseline ci"
bash testing/e2e.test.sh
Loading
Loading