From 9a472c1e5119ef562d11f698fc78b5693a9786d6 Mon Sep 17 00:00:00 2001 From: Andre Sutherland Date: Sun, 22 Nov 2026 17:30:29 +0000 Subject: [PATCH 1/4] serve the lo1 config schema at the url its $id names The lo1 SDK's JSON Schema $id, and the URL its README tells users to point their editors at, is https://lo1.dev/schemas/lo1.v1.schema.json, which 404'd. A copy of lo1's packages/sdk/schemas/lo1.v1.schema.json now lives in public/schemas, and schema-sync.yml checks it against lo1's main weekly and on changes, as celerity-docs does for the handler manifest schema. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/schema-sync.yml | 43 ++++ public/schemas/lo1.v1.schema.json | 317 ++++++++++++++++++++++++++++++ 2 files changed, 360 insertions(+) create mode 100644 .github/workflows/schema-sync.yml create mode 100644 public/schemas/lo1.v1.schema.json diff --git a/.github/workflows/schema-sync.yml b/.github/workflows/schema-sync.yml new file mode 100644 index 0000000..36fbccb --- /dev/null +++ b/.github/workflows/schema-sync.yml @@ -0,0 +1,43 @@ +name: Schema Sync Check + +on: + push: + branches: + - main + paths: + - "public/schemas/**" + pull_request: + paths: + - "public/schemas/**" + # Weekly check to catch upstream schema changes + schedule: + - cron: "0 9 * * 1" # Monday 9:00 UTC + +jobs: + check-schema-sync: + name: Check schema files are in sync with upstream + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Compare the lo1 config schema with upstream + run: | + upstream_url="https://raw.githubusercontent.com/newstack-cloud/lo1/main/packages/sdk/schemas/lo1.v1.schema.json" + local_path="public/schemas/lo1.v1.schema.json" + + echo "Fetching upstream schema from the lo1 repo..." + curl -sSf "$upstream_url" -o /tmp/upstream-schema.json + + echo "Comparing with local copy..." + if diff -q "$local_path" /tmp/upstream-schema.json > /dev/null 2>&1; then + echo "Schemas are in sync." + else + echo "::error::Schema drift detected! Local schema differs from upstream." + echo "" + echo "Diff (local vs upstream):" + diff --unified "$local_path" /tmp/upstream-schema.json || true + echo "" + echo "To fix: copy the latest schema from the lo1 repo:" + echo " cp /packages/sdk/schemas/lo1.v1.schema.json public/schemas/" + exit 1 + fi diff --git a/public/schemas/lo1.v1.schema.json b/public/schemas/lo1.v1.schema.json new file mode 100644 index 0000000..c767d90 --- /dev/null +++ b/public/schemas/lo1.v1.schema.json @@ -0,0 +1,317 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "version": { + "type": "string", + "const": "1" + }, + "name": { + "type": "string" + }, + "plugins": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "string" + } + }, + "repositories": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "properties": { + "url": { + "type": "string" + }, + "path": { + "type": "string" + }, + "branch": { + "type": "string" + } + }, + "required": [ + "url", + "path" + ], + "additionalProperties": false + } + }, + "proxy": { + "type": "object", + "properties": { + "enabled": { + "default": true, + "type": "boolean" + }, + "port": { + "default": 80, + "type": "number" + }, + "tld": { + "default": "local", + "type": "string" + }, + "tls": { + "type": "object", + "properties": { + "enabled": { + "default": false, + "type": "boolean" + }, + "port": { + "default": 443, + "type": "number" + }, + "mode": { + "default": "internal", + "type": "string", + "enum": [ + "internal", + "acme" + ] + }, + "acme": { + "type": "object", + "properties": { + "provider": { + "type": "string" + }, + "module": { + "type": "string" + }, + "email": { + "type": "string" + }, + "ca": { + "default": "letsencrypt", + "type": "string" + }, + "tokenEnv": { + "type": "string" + }, + "arg": { + "type": "string" + }, + "env": { + "default": [], + "type": "array", + "items": { + "type": "string" + } + }, + "options": { + "default": {}, + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "string" + } + }, + "resolvers": { + "default": [], + "type": "array", + "items": { + "type": "string" + } + }, + "propagationTimeout": { + "type": "string" + }, + "domains": { + "default": [], + "type": "array", + "items": { + "type": "string" + } + }, + "caddyVersion": { + "default": "2", + "type": "string" + }, + "image": { + "type": "string" + } + }, + "required": [ + "provider" + ], + "additionalProperties": false + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + "services": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "object", + "properties": { + "type": { + "type": "string" + }, + "path": { + "type": "string" + }, + "port": { + "type": "number" + }, + "hostPort": { + "type": "number" + }, + "mode": { + "default": "dev", + "type": "string", + "enum": [ + "dev", + "container", + "skip" + ] + }, + "command": { + "type": "string" + }, + "containerImage": { + "type": "string" + }, + "plugin": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} + }, + "compose": { + "type": "string" + }, + "env": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "string" + } + }, + "proxy": { + "type": "object", + "properties": { + "domain": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + }, + "pathPrefix": { + "type": "string" + } + }, + "additionalProperties": false + }, + "hooks": { + "type": "object", + "properties": { + "preStart": { + "type": "string" + }, + "postStart": { + "type": "string" + }, + "preStop": { + "type": "string" + } + }, + "additionalProperties": false + }, + "dependsOn": { + "default": [], + "type": "array", + "items": { + "type": "string" + } + }, + "initTask": { + "default": false, + "type": "boolean" + }, + "readinessProbe": { + "type": "string", + "format": "uri" + } + }, + "required": [ + "type", + "path" + ], + "additionalProperties": false + } + }, + "extraCompose": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "object", + "properties": { + "file": { + "type": "string" + }, + "initTaskServices": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "file" + ], + "additionalProperties": false + } + ] + }, + "hooks": { + "type": "object", + "properties": { + "postInfrastructure": { + "type": "string" + }, + "postSetup": { + "type": "string" + }, + "preStop": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "required": [ + "version", + "name", + "services" + ], + "additionalProperties": false, + "$id": "https://lo1.dev/schemas/lo1.v1.schema.json" +} From e5e7464560df2bff3ea2e10bd97b3a4b924db367 Mon Sep 17 00:00:00 2001 From: Andre Sutherland Date: Sun, 22 Nov 2026 17:30:29 +0000 Subject: [PATCH 2/4] fix the lo1 restart anchor on the configuration page The heading renders as lo1-restart-services, so the link landed at the top of the cli page. Co-Authored-By: Claude Opus 5.5 --- content/docs/configuration.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/docs/configuration.mdx b/content/docs/configuration.mdx index a442e52..f5929e8 100644 --- a/content/docs/configuration.mdx +++ b/content/docs/configuration.mdx @@ -115,7 +115,7 @@ services: ``` Init tasks run in dev or container mode, the same as other services. Run one again in a running -workspace with [`lo1 restart`](/docs/cli#lo1-restart), for example `lo1 restart seed` to put the seed +workspace with [`lo1 restart`](/docs/cli#lo1-restart-services), for example `lo1 restart seed` to put the seed data back. ## Environment files From 73ef3388e873bc1be4054aa7110cc662830819a6 Mon Sep 17 00:00:00 2001 From: Andre Sutherland Date: Sun, 22 Nov 2026 17:30:29 +0000 Subject: [PATCH 3/4] add AGENTS.md for coding agents Adds AGENTS.md, and a CLAUDE.md that imports it. Co-Authored-By: Claude Opus 5.5 --- AGENTS.md | 88 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ CLAUDE.md | 1 + 2 files changed, 89 insertions(+) create mode 100644 AGENTS.md create mode 100644 CLAUDE.md diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..3185312 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,88 @@ +# lo1 Docs + +The lo1 documentation site at lo1.dev: a Next.js and Fumadocs site, exported statically and +deployed to GitHub Pages. It documents installing, configuring and running lo1, its CLI and its +plugins, and has a blog and the NewStack newsletter signup. + +## Workspace + +This repo is one of NewStack's. NewStack's maintainers develop it alongside the others in a +shared workspace, using the NewStack Claude Code plugin for how work is planned, reviewed, +committed and coordinated across repos. The plugin isn't public, and nothing here depends on it: +this file and the repo's own docs cover what a contribution needs. + +## Layout + +| Path | Holds | +|---|---| +| `content/docs/` | The docs, in MDX, ordered by `meta.json`: getting started, guides, and the CLI and plugin reference | +| `content/blog/` | Blog posts (the `blogPosts` collection in `source.config.ts`; the directory doesn't exist until the first post). `author` must be a key in `src/lib/authors.ts` or the build fails; `draft: true` posts show only in `yarn dev` | +| `src/app/` | The site: home page, privacy page, blog, docs, plus the `static.json` search export, `llms` routes and sitemap | +| `src/components/`, `src/lib/` | Components (search, newsletter signup, copy command), metadata, analytics events | +| `public/schemas/lo1.v1.schema.json` | A copy of the lo1 SDK's `lo1.yaml` JSON Schema, served at the URL its `$id` names | +| `scripts/` | Build steps: link checks, search index sync | + +## Checks + +- **Tools:** Node 22 (the deploy workflow's) with Yarn 4 through corepack (`packageManager`). + `yarn install --immutable` first, which also runs `fumadocs-mdx`. +- **Checks,** before a change reaches `main`: `yarn lint`, `yarn check-links`, then + `yarn next build`, which type-checks, lints and fails on MDX errors. `yarn check-links` catches + broken links to non-docs routes only: every `/docs/...` link passes, so after moving or + renaming a page, grep `content/` for the old path. It never checks links in `src/` (landing, + footer, privacy page). +- **`yarn build`** runs `check-links`, `next build` and `post-build`, then `sync-content`, which + replaces the production Algolia search index when Algolia credentials are available from the + environment or `.env`, and skips itself when they aren't. +- **Gates:** no git hooks, no commitlint, and no build on pull requests. `deploy.yml` runs on + pushes to `main`. `schema-sync.yml` fails when the schema copy differs, byte for byte, from + lo1's `main`: on pushes to `main` and pull requests that change `public/schemas/`, and every + Monday. + +## Running locally + +`yarn dev` serves the site on port 3000. Search is switched off unless all three +`NEXT_PUBLIC_ALGOLIA_*` variables are set (`src/provider.tsx`), and they're read when `next dev` +starts. Don't copy `.env.example` to `.env` for local work: its placeholders switch search on +and make `sync-content` try to run. Dev and build fetch the Inter font from Google Fonts, and +Plausible's script loads on every page. The newsletter form posts to Buttondown, so a local +signup sends a real confirmation email. Page dates and the sitemap come from git history, so a +shallow clone drops them. + +## Compatibility + +- **lo1:** the CLI, configuration and plugin pages document lo1's `@lo1/cli`, the `lo1.yaml` + schema and its plugins (no plugin-authoring guide yet). The landing showcase and quick start + mirror lo1's `examples/shop` and its CLI output ([README.md](README.md)). A change in lo1 + updates the pages here once it's on lo1's `main`. The Celerity plugin page describes a plugin + that isn't usable yet, and says so. +- **`lo1.yaml` schema:** copied unchanged from lo1's `packages/sdk/schemas/`, never edited + here; `schema-sync.yml` checks it. Its `$id`, `https://lo1.dev/schemas/lo1.v1.schema.json`, is + the URL the SDK's README tells users to point their editors at, so that path never moves. +- **URLs:** `lo1 doctor` prints `https://lo1.dev/docs/troubleshooting`, and lo1's README links the + site. Nothing can redirect (static export on GitHub Pages), so moving a page breaks its inbound + links unless a stub page stays at the old path. +- **Analytics and newsletter:** Plausible custom events need a matching goal in the Plausible + dashboard (`src/lib/analytics.ts`). The signup form posts to the NewStack Buttondown list, and + its `source` names the event. The privacy page describes both, so a change to what's + collected updates it and its `UPDATED` date. +- **Persisted state:** none. + +## Conventions + +- Commits: plain lowercase imperative subjects without a conventional-commit type (`add + troubleshooting guide`); nothing checks them, and there are no releases. + +## Safety + +- **A push to `main` deploys.** `deploy.yml` builds the site, syncs the Algolia index if + configured and publishes to GitHub Pages at lo1.dev, and nothing checks a pull request first, + so run the checks above before a change reaches `main`. +- While Algolia credentials are available, from `.env`, the shell environment or CI, don't run + `yarn build` or `yarn sync-content` unless asked: they overwrite the production search + index. +- Don't submit the newsletter form or trigger analytics events from automated runs. + +## Known mistakes + + diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..43c994c --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1 @@ +@AGENTS.md From 4fff1291621198ee9cc781351aaed3d86329db27 Mon Sep 17 00:00:00 2001 From: Andre Sutherland Date: Sun, 22 Nov 2026 17:33:02 +0000 Subject: [PATCH 4/4] fix the markdown links on parent pages, per-page social metadata and sitemap urls Pages with child pages are exported at llms.mdx//index, so their copy markdown and open in links 404'd. Docs pages took the home page's open graph title and url, and every page's og:url was the home page. Sitemap urls lacked the trailing slash the static export redirects to. Co-Authored-By: Claude Opus 5.5 --- src/app/(home)/blog/[slug]/page.tsx | 2 +- src/app/(home)/blog/page.tsx | 1 + src/app/(home)/privacy/page.tsx | 1 + src/app/docs/[[...slug]]/page.tsx | 6 ++++-- src/app/layout.tsx | 1 + src/app/sitemap.ts | 3 ++- src/lib/get-llm-text.ts | 9 ++++++++- src/lib/metadata.ts | 1 - 8 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/app/(home)/blog/[slug]/page.tsx b/src/app/(home)/blog/[slug]/page.tsx index 679e006..93a1131 100644 --- a/src/app/(home)/blog/[slug]/page.tsx +++ b/src/app/(home)/blog/[slug]/page.tsx @@ -67,7 +67,7 @@ export async function generateMetadata(props: PageProps<'/blog/[slug]'>): Promis alternates: { types: { 'application/rss+xml': '/blog/rss.xml' } }, openGraph: { type: 'article', - url: post.url, + url: `${post.url}/`, publishedTime: post.data.date, authors: [author.linkedin], }, diff --git a/src/app/(home)/blog/page.tsx b/src/app/(home)/blog/page.tsx index 39309b9..c10fd47 100644 --- a/src/app/(home)/blog/page.tsx +++ b/src/app/(home)/blog/page.tsx @@ -8,6 +8,7 @@ export const metadata = createMetadata({ title: 'Blog', description: 'Writing about running multi-service systems locally, from the people building lo1.', alternates: { types: { 'application/rss+xml': '/blog/rss.xml' } }, + openGraph: { url: '/blog/' }, }); export default function BlogIndex() { diff --git a/src/app/(home)/privacy/page.tsx b/src/app/(home)/privacy/page.tsx index fdb065a..c161009 100644 --- a/src/app/(home)/privacy/page.tsx +++ b/src/app/(home)/privacy/page.tsx @@ -4,6 +4,7 @@ import { createMetadata } from '@/lib/metadata'; export const metadata = createMetadata({ title: 'Privacy', description: 'What lo1.dev and the NewStack mailing list collect, and why.', + openGraph: { url: '/privacy/' }, }); /** Keep in step with the site: update it when analytics or another service is added. */ diff --git a/src/app/docs/[[...slug]]/page.tsx b/src/app/docs/[[...slug]]/page.tsx index 0e033b6..216b539 100644 --- a/src/app/docs/[[...slug]]/page.tsx +++ b/src/app/docs/[[...slug]]/page.tsx @@ -11,6 +11,7 @@ import { createRelativeLink } from 'fumadocs-ui/mdx'; import { getMDXComponents } from '@/mdx-components'; import { LLMCopyButton, ViewOptions } from '@/components/page-actions'; import { toMarkdownUrl } from '@/lib/get-llm-text'; +import { createMetadata } from '@/lib/metadata'; export default async function Page(props: PageProps<'/docs/[[...slug]]'>) { const params = await props.params; @@ -57,8 +58,9 @@ export async function generateMetadata( const page = source.getPage(params.slug); if (!page) notFound(); - return { + return createMetadata({ title: page.data.title, description: page.data.description, - }; + openGraph: { url: `${page.url}/` }, + }); } diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 6e98e59..f732480 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -13,6 +13,7 @@ export const metadata = createMetadata({ }, description: 'One command to run every frontend, backend and piece of infrastructure your team builds, wired together and served over HTTPS on real local domains.', metadataBase: baseUrl, + openGraph: { url: '/' }, }); const inter = Inter({ diff --git a/src/app/sitemap.ts b/src/app/sitemap.ts index 5f69d57..348197b 100644 --- a/src/app/sitemap.ts +++ b/src/app/sitemap.ts @@ -66,8 +66,9 @@ async function lastModifiedByFile(): Promise> { } export default async function sitemap(): Promise { + // trailingSlash is on, so the slashed URL is the canonical one. const url = (pathname: string): string => - new URL(pathname, baseUrl).toString(); + new URL(pathname.endsWith('/') ? pathname : `${pathname}/`, baseUrl).toString(); const modified = await lastModifiedByFile(); return [ diff --git a/src/lib/get-llm-text.ts b/src/lib/get-llm-text.ts index b5a8ac1..be1a272 100644 --- a/src/lib/get-llm-text.ts +++ b/src/lib/get-llm-text.ts @@ -25,6 +25,13 @@ URL: ${page.url} ${processed.value}`; } +/** + * The static export writes a page that has child pages to `/index`, since + * `` is also their directory (see `generateStaticParams` in + * `app/llms.mdx/[[...slug]]/route.ts`), so its markdown URL ends in `/index`. + */ export function toMarkdownUrl(url: string): string { - return url.replace('docs', 'llms.mdx'); + const markdownUrl = url.replace('docs', 'llms.mdx'); + const hasChildren = source.getPages().some((page) => page.url.startsWith(`${url}/`)); + return hasChildren ? `${markdownUrl}/index` : markdownUrl; } diff --git a/src/lib/metadata.ts b/src/lib/metadata.ts index a08f550..72fb5e7 100644 --- a/src/lib/metadata.ts +++ b/src/lib/metadata.ts @@ -8,7 +8,6 @@ export function createMetadata(override: Metadata): Metadata { openGraph: { title: override.title ?? undefined, description: override.description ?? undefined, - url: siteUrl, images: '/banner.png', siteName: 'lo1', ...override.openGraph,