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
48 changes: 48 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,51 @@
## 2026-11-15 14:22

| Check | Status | Details |
|-------|--------|---------|
| Lint | ✓ PASS | 0 errors |
| Build | ✓ PASS | 27 pages built, 5 pages indexed (Pagefind) |
| Unit Tests | ✓ PASS | 75 tests passed |
| E2E Tests | ✓ PASS | 96 tests passed |
| Lighthouse | ✓ PASS | 99.1% performance (avg) |

### Lighthouse Performance (local build)

| Page | Scores (3 runs) |
|------|-----------------|
| / (index) | 100%, 100%, 100% |
| /about | 89%, 99%, 99% |
| /posts | 100%, 100%, 100% |
| /archives (soft 404, not linked) | 100%, 100%, 100% |
| /404 | 100%, 100%, 100% |

**Diagnostics:** None for the blog (one /about run at 89%, others 99%). Live site not measured (Turnstile gate). CMS checks: format clean, 173 unit, 2 integration, 2 e2e passed. `blog-cms` preview build log: "Found Functions directory at /functions. Uploading.", `uses_functions: true`.

Changes: CMS proxy review fixes: also reject `%2E` and `%5C` in proxied paths, drop the `Link` header (GitHub page links use `/repositories/<id>/` and would 404), redirect Sveltia's "View on GitHub" links (`/gh/comdotlinux/blog/...`) to github.com; tests for query-string forwarding, `User-Agent` and API version on every upstream call, `update-branch`, `blog-other` and ref rules; README notes on Publish, the 24 h Access session and the live check order.

## 2026-11-15 14:12

| Check | Status | Details |
|-------|--------|---------|
| Lint | ✓ PASS | 0 errors |
| Build | ✓ PASS | 27 pages built, 5 pages indexed (Pagefind) |
| Unit Tests | ✓ PASS | 75 tests passed |
| E2E Tests | ✓ PASS | 96 tests passed |
| Lighthouse | ✓ PASS | 99.6% performance (avg) |

### Lighthouse Performance (local build)

| Page | Scores (3 runs) |
|------|-----------------|
| / (index) | 97%, 100%, 100% |
| /about | 99%, 99%, 99% |
| /posts | 100%, 100%, 100% |
| /archives (soft 404, not linked) | 100%, 100%, 100% |
| /404 | 100%, 100%, 100% |

**Diagnostics:** None for the blog. Live site not measured (Turnstile gate). CMS checks: format clean, 159 unit, 2 integration, 2 e2e passed; local `wrangler pages dev` compiles `cms/functions` (503 without settings, 401 without or with a forged Access JWT, 403 cross-site).

Changes: CMS sign-in through Cloudflare Access only. New Pages Function `cms/functions/gh/[[path]].ts` verifies the Access JWT and proxies Sveltia's GitHub calls with a GitHub App installation token held server side (path, write and GraphQL mutation allow-lists, no DELETE or merges, commits only on `cms/` branches); static popup `cms/public/auth.html` completes Sveltia's handshake with a placeholder token; `config.yml` gets `base_url`, `auth_endpoint`, `api_root`, `auth_methods`. Needs the GitHub App and Production settings from `cms/README.md` before it works.

## 2026-11-15 11:55

| Check | Status | Details |
Expand Down
4 changes: 4 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,10 @@ The production site is gated at the edge, as in the bio repo: no page is served
- Trade-off the user accepted: search engines and link-preview bots cannot read post pages.
- Local dev, `astro preview`, e2e and Lighthouse run without the gate (Functions only run on Cloudflare). Unit tests: `tests/functions/turnstile.test.ts`.

### CMS (`cms/`, Pages project `blog-cms`)

Sveltia CMS at `cms.blog.kulkarni.cloud/admin/`, behind Cloudflare Access. Access is the only login: `cms/functions/gh/[[path]].ts` verifies the Access JWT and proxies Sveltia's GitHub calls with a GitHub App installation token held server side. Production settings `GITHUB_APP_ID`, `GITHUB_APP_INSTALLATION_ID`, `GITHUB_APP_PRIVATE_KEY` (secret), `OWNER_EMAIL` (secret) are typed by the owner; details in `cms/README.md` and `cms/AGENTS.md`.

## Static Assets

Images for blog posts are stored in `public/assets/` organized by date:
Expand Down
26 changes: 15 additions & 11 deletions cms/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,26 @@ Owner-only post editor: Sveltia CMS as a static admin page, deployed by the Clou

## Key Files

| File | Description |
| -------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `public/admin/index.html` | Loads `@sveltia/cms` at an exact version from unpkg with `integrity` (sha384) and `crossorigin`; `noindex` |
| `public/admin/config.yml` | GitHub backend `comdotlinux/blog`, branch `main`, `publish_mode: editorial_workflow` (branch `cms/posts/<slug>` plus a PR per post); `output.omit_empty_optional_fields: true`; collection `posts` in `src/content/posts`, date-only `pubDatetime`/`modDatetime`, `draft` default false, raw Markdown body first |
| `package.json` | Scripts `serve`, `format:check`, `test:unit`, `test:integration`, `test:e2e`, `test:compat`; exact pins |
| `vitest.config.ts` | Unit tests in `test/unit/` |
| `playwright.config.ts` | Projects `integration` (HTTP only) and `e2e` (Chromium, 1 retry for the CDN); web server `python3 -m http.server` on `CMS_PORT` (default 8787) |
| `scripts/compat-check.sh` | Copies `test/fixtures/compat-post.md` and the golden new entry into `../src/content/posts/zz-cms-compat-*.md`, builds the blog, greps the HTML (table, `hello.ts` label, callout div, image, no `{%`), then moves the two files to `../.trash/` |
| `scripts/content-guard.sh` | Run by the `content-guard` CI job on post changes: no `{%` in posts, removed `file=` fence lines must be re-added, changed posts need `title`, `description`, `pubDatetime` and no empty-string values |
| `test/fixtures/` | Spike 1 fixture and the files Sveltia wrote in Spike 1 (`golden/`) |
| File | Description |
| -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `public/admin/index.html` | Loads `@sveltia/cms` at an exact version from unpkg with `integrity` (sha384) and `crossorigin`; `noindex` |
| `public/admin/config.yml` | GitHub backend `comdotlinux/blog`, branch `main`, `base_url`/`auth_endpoint: auth` (sign-in popup `public/auth.html`), `api_root` `/gh/api/v3` (the proxy), `auth_methods: [oauth]` (hides the token field), `publish_mode: editorial_workflow` (branch `cms/posts/<slug>` plus a PR per post); `output.omit_empty_optional_fields: true`; collection `posts` in `src/content/posts`, date-only `pubDatetime`/`modDatetime`, `draft` default false, raw Markdown body first |
| `public/auth.html` | Static sign-in popup: answers Sveltia's `authorizing:github` handshake with the placeholder token `cf-access`, `postMessage` only to `location.origin`, `data-cfasync="false"`, `noindex` |
| `functions/gh/[[path]].ts` | Pages Function on `/gh/*`: verifies the Access JWT (RS256, `kid`, `aud`, `iss`, `exp`, `nbf`, `OWNER_EMAIL`), same-origin check, mints a GitHub App installation token, forwards an allow-list of paths, writes and GraphQL mutations to `api.github.com`; `/user` and repo `permissions` shims |
| `package.json` | Scripts `serve`, `format:check`, `test:unit`, `test:integration`, `test:e2e`, `test:compat`; exact pins |
| `vitest.config.ts` | Unit tests in `test/unit/` |
| `playwright.config.ts` | Projects `integration` (HTTP only) and `e2e` (Chromium, 1 retry for the CDN); web server `python3 -m http.server` on `CMS_PORT` (default 8787) |
| `scripts/compat-check.sh` | Copies `test/fixtures/compat-post.md` and the golden new entry into `../src/content/posts/zz-cms-compat-*.md`, builds the blog, greps the HTML (table, `hello.ts` label, callout div, image, no `{%`), then moves the two files to `../.trash/` |
| `scripts/content-guard.sh` | Run by the `content-guard` CI job on post changes: no `{%` in posts, removed `file=` fence lines must be re-added, changed posts need `title`, `description`, `pubDatetime` and no empty-string values |
| `test/fixtures/` | Spike 1 fixture and the files Sveltia wrote in Spike 1 (`golden/`) |

## For AI Agents

- Keep `config.yml` field names a subset of the blog's `posts` schema keys (`src/content.config.ts`); `test/unit/config.test.ts` enforces it.
- Never remove `omit_empty_optional_fields`: without it Sveltia writes `modDatetime: ''`, which fails the blog build.
- Upgrading Sveltia means a new version and a new sha384 in `index.html` (see `README.md`), then all tests.
- Do not add a build step or runtime secrets. Pages runs with `SKIP_DEPENDENCY_INSTALL=1`.
- Do not add a build step. Pages runs with `SKIP_DEPENDENCY_INSTALL=1`, so `functions/` must not import npm packages (WebCrypto only).
- Runtime settings, Production only, typed by the owner (`README.md` "One-time setup"): secrets `GITHUB_APP_PRIVATE_KEY` (PKCS#8 PEM) and `OWNER_EMAIL`, text variables `GITHUB_APP_ID` and `GITHUB_APP_INSTALLATION_ID`. Never write their values anywhere; missing ones make the proxy answer 503.
- The `/gh/` proxy is the only path from the browser to GitHub. Never put a GitHub token in the browser, never log tokens, keys or JWTs (`console.error` takes fixed text and a status code only), keep `Cache-Control: no-store` on every response, errors included. The proxy sends no CORS headers: it serves the same origin only. New Sveltia calls go into the allow-lists in the proxy with a test.
- Branch prefix is Sveltia's `cms/posts/`. Post PRs are merged or closed on GitHub, never with Sveltia's Publish or Discard (both delete branches).
- `wrangler` installed anywhere under a checkout that has a stale `.wrangler/deploy/config.json` refuses `pages dev`; the tests here use `python3 -m http.server` instead.
Loading
Loading