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 — 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/config/site.ts; `domain` and `subdomain` are placeholders, because this baseline has never deployed under a name of its own; `githubOwner` is the owner in SOURCE_URL.",
"slug": "shadcn-admin",
"pascal": "ShadcnAdmin",
"productName": "Studio Admin",
"domain": "shadcn-admin.example.com",
"subdomain": "your-workers-subdomain",
"githubOwner": "sourceplane"
}
78 changes: 78 additions & 0 deletions .baseline/product/AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# shadcn-admin — for coding agents

Start here before you change this site. This page is short on purpose: the
pages it points at hold the detail, and they are kept true.

## What this is

An admin dashboard: Next.js 16 and shadcn/ui (Studio Admin's dashboards,
auth screens, chat, mail, kanban, calendar, tables and charts over mock
data, with theme presets and layout controls) built by
`@opennextjs/cloudflare` into one Cloudflare Worker with Static Assets.
Orun deploys it to `stage` and `prod` on every merge to `main`; `dev` only
verifies. One deployable component (`apps/web`) and its tests
(`tests/web`); no database and no runtime secret.

## Read first, in this order

1. [README.md](README.md) — what is where, how to run it, the live URLs.
2. [ai/context/operations.md](ai/context/operations.md) — the operating
contract: how a merge deploys, the secrets model, common operations.
3. [ai/context/deployment.md](ai/context/deployment.md) — what is live, as
last probed.
4. [apps/web/docs/overview.md](apps/web/docs/overview.md) — the component,
with `architecture.md` and `runbook.md` beside it.
5. [apps/web/src/config/site.ts](apps/web/src/config/site.ts) — the site's
name and the repository its landing page links to.

## Working on it

```bash
pnpm install && pnpm typecheck && pnpm lint && pnpm test && pnpm build
pnpm --filter @app/web dev # http://localhost:3000
```

The screens are `apps/web/src/app/(main)` (each with its own `_components`
and mock data); the landing page is `apps/web/src/app/(external)`; the
name and source link are `apps/web/src/config/site.ts`. `apps/web/AGENTS.md`
is the template's own guide to its code (components, theming, preferences).
`pnpm lint` in `apps/web` is the template's Biome. The build is
`next build --webpack` — keep it: with Turbopack the Worker passes Workers
Free's 3 MiB. The fonts are self-hosted (`src/lib/fonts/registry.ts`); add a
font from its `@fontsource-variable` package, not `next/font/google`, which
fails on GitHub's runners. The auth screens sign nobody in.

## How a change lands

- The repository is desired state. `intent.yaml` declares the environments
and the workspace; `apps/web/component.yaml` declares how the site is
built, deployed and smoke-tested.
- `orun plan --changed` shows which components and environments a change
touches. CI runs the same plan on every pull request.
- One task, one pull request to `main`. On the pull request `ci.yml`'s
verify lanes run (the site built and dry-deployed per environment); they
do not lint or run the tests, so run `pnpm typecheck && pnpm lint && pnpm
test` before you push. The merge's `ci.yml` run deploys stage and prod and
smoke-tests each. That run is the deployment: retry a red lane with
`gh run rerun --failed`.
- With Orun's work plane: `orun task create --brief "…"` issues a task key,
`orun pr open --task <KEY>` opens its pull request on `orun/<KEY>-<slug>`,
and `orun pr land` merges it once its checks pass. Leave the `BASE` prefix
to the bootstrap: CI checks `orun/BASE-…` branches with `plan` alone.
- A change to `intent.yaml` alone (a `SITE_URL`, say) deploys nothing;
carry it with a change under `apps/web`.

## Do not touch

- `execution.state.workspace` in `intent.yaml`: every remote operation, and
CI's OIDC exchange, claims that workspace.
- `ai/context/deployment.md`, and the README between `<!-- 03-docs:begin -->`
and `<!-- 03-docs:end -->`: rendered from probed URLs, never by hand.
- `.rebrand/values.json`: the identity the site was created with, which the
deployment record is rendered from.
- Secrets. `CLOUDFLARE_API_TOKEN` and `CLOUDFLARE_ACCOUNT_ID` are brokered
per run from the workspace's Cloudflare connection; never put a value in
the repository or in GitHub. List them by name (operations.md).
- `ci.yml` stays the only workflow that runs on a push to `main`.
- `pnpm-lock.yaml` changes through `pnpm install`, never by hand: CI
installs with `--frozen-lockfile`.
126 changes: 126 additions & 0 deletions .baseline/product/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
# shadcn-admin

An admin dashboard — Studio Admin's dashboards (default, CRM, finance,
analytics, e-commerce, logistics and more), auth screens, chat, mail, a
kanban board, a calendar, data tables and charts over mock data, with theme
presets and layout controls, built with Next.js 16 and shadcn/ui — on
**Cloudflare Workers + Static Assets** through [`@opennextjs/cloudflare`](https://opennext.js.org/cloudflare).

Working on it with a coding agent? [AGENTS.md](AGENTS.md) says what to read
first, how a change lands and what not to touch.

## Live deployment

<!-- 03-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).
<!-- 03-docs:end -->

## What is here

| Surface | Where |
|---|---|
| The site's name and source link | `apps/web/src/config/site.ts` (read by `apps/web/src/config/app-config.ts`) |
| The landing page | `apps/web/src/app/(external)` |
| The dashboards (default, CRM, finance, analytics, e-commerce, logistics, …), auth screens, chat, mail | `apps/web/src/app/(main)` |
| Mock data | each screen's `_components/*data*`, `apps/web/src/data` |
| Theme presets, fonts, layout preferences | `apps/web/src/styles/presets`, `apps/web/src/lib/fonts/registry.ts`, `apps/web/src/lib/preferences` |
| Sitemap, robots, health | `apps/web/src/app/sitemap.ts`, `apps/web/src/app/robots.txt/route.ts`, `apps/web/src/app/api/health/route.ts` |
| Workers build and deploy contract | `apps/web/next.config.mjs`, `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
```

```bash
pnpm --filter @app/web dev # http://localhost:3000
pnpm --filter @app/web preview # wrangler dev over the built Worker
```

The data is the template's mock data: each screen's `_components` holds its
own, so wiring one to your source is that folder's change. The sign-in and
sign-up screens are the template's design screens — they sign nobody in;
add your auth provider before you put anything private behind them. Make
the site yours in `apps/web/src/config/site.ts` (its name and the repository
the landing page links to); the landing page itself is
`apps/web/src/app/(external)`, and it still credits the template and its
author.

One optional build-time variable (`apps/web/.env.example`):

| Variable | What it does |
|---|---|
| `NEXT_PUBLIC_SITE_URL` | The site's public origin for the sitemap, robots, Open Graph and JSON-LD links. The deploy sets it per environment (see below). Defaults to `http://localhost:3000`. |

## 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 deploys to `stage`, then to
`prod` once stage has converged on the same commit; `dev` only verifies. The
Worker is `shadcn-admin-web-<env>` on your account's workers.dev
subdomain, and every deploy is smoke-tested over HTTP. 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 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, 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 →
`shadcn-admin-web-prod` → Settings → Domains & Routes → Add →
Custom domain). Do the same for stage with a subdomain if you want one.
2. Set the environment's public origin in `intent.yaml`, so the sitemap,
robots, Open Graph and JSON-LD links use it (until then they use the
workers.dev URL):

```yaml
environments:
prod:
env:
SITE_URL: https://shadcn-admin.example.com
```

The site was born with the reserved placeholder
`shadcn-admin.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.

3. Merge. The next deploy of `apps/web` builds with the new origin. (A change
to `intent.yaml` alone deploys nothing — touch `apps/web` in the same pull
request, or let the next change to the site carry it.)

## Credits

The site is [Studio Admin](https://github.com/arhamkhnz/next-shadcn-admin-dashboard)
by Arham Khan (MIT — `apps/web/LICENSE.md`), the template Vercel lists as
the Next.js & shadcn/ui Admin Dashboard. Its fonts are the families' own
variable fonts from Fontsource (OFL-1.1; Roboto Slab Apache-2.0) and Vercel's
Geist (OFL-1.1).
24 changes: 24 additions & 0 deletions .baseline/tasks/01-product.TaskContract.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Task contract template for the 01-product landing.
# 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.
#
# The whole site in one landing. `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 builds it with OpenNext and deploys it to stage and prod
affects:
- web
- web-tests
doneWhen:
- repo pushed, main pinned as default, workspace linked (orun cloud link)
- main convergence green (build, deploy and smoke on stage and prod)
- the home page answers on both workers.dev URLs
gates: []
13 changes: 13 additions & 0 deletions .baseline/tasks/03-docs.TaskContract.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Task contract template for the 03-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: []
136 changes: 136 additions & 0 deletions .github/workflows/baseline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
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 exactly one phase, that a
# placed tree comes up branded and carrying nothing of the factory, and that
# the site it produces installs, builds, deploys (dry) and serves.
#
# ─── 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 site would carry) and the placement
# tier (the offline bootstrap: every phase placed and finished by the
# blueprint's own hooks, then the site's own `orun plan` for the 01-product
# merge).
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-notes \
--set "productname=Acme Notes" \
--set githuborg=acme-inc
- name: the leak gate — what a site carries
run: bash testing/leak.test.sh
- name: placement — the offline bootstrap, and the site'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: the finished site installed, its
# fixtures rendered, type-checked, linted, tested and built, the stage
# lane's own build, output check and dry deploy, and the built Worker served
# and smoke-tested with the component's own smoke command. Pinned at the
# bootstrap floor (v2.88.0): the offline bootstrap reads the blueprint (its
# one `secrets` reconcile, its background task set-up, its landings checked
# in the box), and the floor is newer than the site'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