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
5 changes: 5 additions & 0 deletions .changeset/repo-owned-content.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"web": patch
---

Move website copy and chart references into the web repository so edits can be previewed and released with the site.
22 changes: 2 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,38 +25,20 @@ jobs:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
path: web
- uses: actions/setup-node@v4
with:
node-version: 24.10.0
- uses: oven-sh/setup-bun@v2
with:
bun-version: 1.3.14
- run: bun install --frozen-lockfile
working-directory: web
- name: Read pinned CMS revision
id: cms
working-directory: web
run: node scripts/cms-revision.mjs >> "$GITHUB_OUTPUT"
- uses: actions/checkout@v4
with:
repository: AstrologyEngine/cms
ref: ${{ steps.cms.outputs.revision }}
path: cms
persist-credentials: false
- run: bun install --frozen-lockfile && bun run contract:build
working-directory: cms
- run: bun run sync && bun test verification
working-directory: web
- run: bunx playwright install --with-deps chromium
working-directory: web
- run: bun run test:browser
working-directory: web
- uses: actions/upload-artifact@v4
if: failure()
with:
name: local-browser-results
path: |
web/playwright-report/
web/test-results/
playwright-report/
test-results/
27 changes: 2 additions & 25 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,9 @@ jobs:
checks:
if: github.event_name == 'release' && github.event.release.prerelease
uses: ./.github/workflows/ci.yml
gate:
if: github.event_name == 'push' || (github.event_name == 'release' && github.event.release.prerelease)
runs-on: ubuntu-24.04
env:
CMS_DEPLOY_ENABLED: ${{ vars.CMS_DEPLOY_ENABLED }}
steps:
- name: Report CMS provisioning gate
run: |
if [ "$CMS_DEPLOY_ENABLED" != true ]; then
echo "CMS deployment is disabled pending [hosted setup #39](https://github.com/AstrologyEngine/web-issues/issues/39)." >> "$GITHUB_STEP_SUMMARY"
if [ "$GITHUB_EVENT_NAME" = release ]; then
echo "::error::Alpha release blocked: complete CMS setup #39 and enable CMS_DEPLOY_ENABLED."
exit 1
fi
else
echo "CMS deployment is enabled." >> "$GITHUB_STEP_SUMMARY"
fi
deploy:
if: vars.CMS_DEPLOY_ENABLED == 'true' && always() && needs.gate.result == 'success' && (github.event_name == 'push' || needs.checks.result == 'success')
needs: [checks, gate]
if: always() && (github.event_name == 'push' || (github.event.release.prerelease && needs.checks.result == 'success'))
needs: checks
runs-on: ubuntu-24.04
environment: ${{ github.event_name == 'push' && 'staging' || 'alpha' }}
env:
Expand All @@ -54,13 +37,7 @@ jobs:
with:
bun-version: 1.3.14
- run: bun install --frozen-lockfile
- name: Verify the target CMS deployment
run: node scripts/verify-cms-deployment.mjs "$TARGET"
env:
GH_TOKEN: ${{ github.token }}
- run: bun run sync && bun run build
env:
CMS_SNAPSHOT_ORIGIN: https://cms-${{ env.TARGET }}.astrologyengine.dev
- run: bunx wrangler deploy --env "$TARGET" --dry-run
- name: Recheck current staging head
if: github.event_name == 'push'
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ concurrency:
cancel-in-progress: false
jobs:
preview:
if: github.event.pull_request.head.repo.full_name == github.repository && (github.event.action == 'closed' || vars.CMS_DEPLOY_ENABLED == 'true')
if: github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-24.04
timeout-minutes: 25
env:
Expand Down Expand Up @@ -54,9 +54,8 @@ jobs:
id=$(jq -n --arg ref "$HEAD_SHA" --arg environment "pr-$PR" '{ref:$ref,environment:$environment,auto_merge:false,required_contexts:[],transient_environment:true,production_environment:false}' | gh api -X POST "repos/$REPO/deployments" --input - --jq .id)
echo "id=$id" >> "$GITHUB_OUTPUT"
gh api -X POST "repos/$REPO/deployments/$id/statuses" -f state=in_progress
node scripts/verify-cms-deployment.mjs staging
bun run sync
CMS_SNAPSHOT_ORIGIN=https://cms-staging.astrologyengine.dev bun run build
bun run build
- name: Upload preview
id: upload
if: steps.deploy.outputs.id != ''
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ build/
.wrangler/
static/release.json
static/calculation-worker.js
static/content/

# Caches and generated test output
.cache/
Expand Down
5 changes: 5 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,8 @@ See `docs/agents/triage-labels.md`.

Single-context layout: root `GLOSSARY.md` and `docs/adr/`.
See `docs/agents/domain.md`.

### Website copy

For UI text, translations, accessibility labels, or chart reference copy,
see [the copy editing guide](docs/agents/content.md).
47 changes: 8 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,45 +12,14 @@ bun run sync
bun run dev
```

Web can install, check and build independently. Without a running CMS, local
requests use baseline copy bundled from the pinned contract package.
Run `bun run dev` to start the website.

For both services, clone [AstrologyEngine/cms](https://github.com/AstrologyEngine/cms)
as sibling `../cms` and run:
Checks include `bun run check`, `bun run check:ts`, `bun run lint`,
`bun run format:check`, `bun test verification`, `bun run build`,
both Worker dry runs, and `bun run test:browser` (install Chromium with
`bunx playwright install chromium`).

```sh
bun run dev:stack
# Other checkout/ports:
CMS_REPO_PATH=/path/to/cms WEB_PORT=5174 CMS_PORT=8789 bun run dev:stack
```

The launcher installs frozen dependencies, migrates/seeds persistent local D1,
watches and temporarily links the local contract, and starts CMS then web.
Ctrl+C stops its processes and restores the pinned package. Each service can
also run separately: start CMS there, then set `CMS_ORIGIN` when starting web
(default `http://127.0.0.1:8787`).

Before committing: `bun run sync`, `bun run check`, `bun run check:ts`,
`bun run lint`, `bun run format:check`, `node --test scripts/*.test.mjs`,
`bun test verification`, `bun run build`, both environment dry runs and
`bun run test:browser` (install Chromium with `bunx playwright install chromium`).

## CMS copy

[CMS](https://github.com/AstrologyEngine/cms) owns website copy, the typed
catalog, locale helpers and baseline English seed. Web pins
`@astrologyengine/cms-contract` to an exact public GitHub release asset.

New keys: update and release CMS, deploy/seed it, then update web's dependency
URL and lockfile before using those keys. Ordinary content edits use the CMS
admin API and need no web release. See the
[CMS runbook](https://github.com/AstrologyEngine/cms/blob/main/docs/runbooks/cms.md).

Builds bundle outage snapshots from the package's baseline seed by default.
`CMS_SNAPSHOT_ORIGIN` fetches all enabled locales from a live CMS; fetch errors
fail the build. Deployed builds always use their target CMS origin.
## Website copy

Browser tests require a CMS checkout and use isolated databases for English,
a partial pseudo-locale and CMS outages. `CMS_REPO_PATH` overrides the sibling
path; `PLAYWRIGHT_PORT` changes test ports. `E2E_BASE_URL` tests an existing site
without a local CMS checkout. See [extraction details](docs/cms-extraction.md).
Edit the tracked content files and preview your changes with the web app.
See the [copy editing guide](docs/agents/content.md).
3 changes: 0 additions & 3 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 2 additions & 5 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ without starting Vite. New tests in `tests/` are included automatically. Staging
and alpha run the suite after deployment. Preview E2E failures fail the preview
check; reports and failure traces are uploaded as workflow artifacts.

## CMS extraction gate
## Website copy

CMS is maintained in AstrologyEngine/cms. Deployment and preview creation are
disabled unless repository variable `CMS_DEPLOY_ENABLED=true`; enable only
after hosted provisioning/acceptance in web-issues#39. CMS must deploy and seed
before web. Contract release assets are independent of hosted deployment.
See the [copy editing guide](agents/content.md).
17 changes: 17 additions & 0 deletions docs/agents/content.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Edit website copy

1. Search the visible text or its key with `rg -n -F 'text' src/lib/copy/content/en`.
UI files under `ui/` follow the first part of the key, such as `landing` or
`settings`. Chart descriptions, names, and keywords are in `reference/`.
2. Edit the value in JSON. Keep its existing key, placeholders such as `{date}`,
and intentional line breaks (`\n`). For new UI text, add a key to the
relevant feature file and use `t()` where it appears. Add placeholder
names to the signature in `src/lib/copy/content/placeholders.ts` when a
new key takes values.
3. Run `bun run check:content`. Run `bun run dev` and open the affected view.
For a homepage edit use `/`. For chart reference copy open `/app`,
enter birth details, and select the chart item. Include the affected view
in the PR so reviewers can verify the copy on the deployed preview.

English provides the default copy. A translation supplies complete entries
for the keys it translates. Missing entries display in English.
8 changes: 3 additions & 5 deletions docs/runbooks/cms.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# CMS runbooks
# Superseded CMS runbook

The CMS is now maintained in [AstrologyEngine/cms](https://github.com/AstrologyEngine/cms).
See the [CMS runbooks document](https://github.com/AstrologyEngine/cms/blob/main/docs/runbooks/cms.md).
The web project owns site copy. See the [copy editing guide](../agents/content.md).

Original history remains in this repository. The extraction and web integration
are described in [the extraction record](../cms-extraction.md).
The [CMS extraction record](../cms-extraction.md) documents the former service.
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,23 @@
"license": "MIT",
"type": "module",
"scripts": {
"dev": "bun run worker:build && node scripts/cms-snapshot.mjs && vite dev",
"dev": "bun run worker:build && vite dev",
"sync": "svelte-kit sync",
"check": "svelte-check --tsconfig ./tsconfig.json",
"check:ts": "node node_modules/@typescript/native/bin/tsc --noEmit",
"lint": "oxlint --disable-nested-config . && node scripts/check-copy.mjs",
"format": "oxfmt --disable-nested-config . && prettier --plugin prettier-plugin-svelte --write \"**/*.svelte\"",
"format:check": "oxfmt --disable-nested-config --check . && prettier --plugin prettier-plugin-svelte --check \"**/*.svelte\"",
"build": "bun run worker:build && node scripts/build-info.mjs && node scripts/cms-snapshot.mjs && vite build",
"build": "bun run worker:build && node scripts/build-info.mjs && vite build",
"dry-run": "wrangler deploy --dry-run",
"test:browser": "playwright test",
"changeset": "changeset",
"version:release": "changeset version && bun install --lockfile-only && bun run format",
"release:publish": "node scripts/publish-release.mjs",
"worker:build": "bun build src/lib/calculation/worker.ts --target browser --outfile static/calculation-worker.js",
"dev:stack": "node scripts/dev-stack.mjs"
"check:content": "bun test verification/content.test.ts"
},
"dependencies": {
"@astrologyengine/cms-contract": "https://github.com/AstrologyEngine/cms/releases/download/v0.1.0/cms-contract-0.1.0.tgz",
"@js-temporal/polyfill": "0.5.1",
"chrono-node": "2.10.3",
"zod": "4.6.7"
Expand Down
58 changes: 7 additions & 51 deletions playwright.config.ts
Original file line number Diff line number Diff line change
@@ -1,37 +1,13 @@
import { resolve } from "node:path";
import { fileURLToPath } from "node:url";
import { cmsRepoPath } from "./scripts/cms-repo.mjs";
import { defineConfig } from "@playwright/test";

// Projects (docs/plans/cms.md, Phase 7):
// default – the site against a seeded local CMS
// i18n – a second CMS seeded with a partially translated pseudo-locale
// cms-down – the site with an unreachable CMS (bundled snapshot copy)
const remote = process.env.E2E_BASE_URL;
const port = Number(process.env.PLAYWRIGHT_PORT ?? "4173");
const ports = {
web: port,
webDown: port + 1,
webI18n: port + 2,
cms: port + 4614, // 8787 by default
cmsI18n: port + 4615,
};
const url = (p: number) => `http://127.0.0.1:${p}`;
// Optional: use a locally installed Chromium when Playwright's download is unavailable.
const chromium = process.env.PLAYWRIGHT_CHROMIUM_EXECUTABLE;

const cms = (p: number, fixture?: string) => ({
command: `bun run dev:e2e --port ${p}`,
...(fixture ? { env: { CMS_E2E_FIXTURE: fixture } } : {}),
cwd: cmsRepoPath(),
url: `${url(p)}/health`,
reuseExistingServer: false,
timeout: 120_000,
});
const web = (p: number, cmsOrigin: string) => ({
command: `bun run dev --host 127.0.0.1 --port ${p} --strictPort`,
const web = (p: number, mode = "") => ({
command: `bun run dev --host 127.0.0.1 --port ${p} --strictPort ${mode}`,
url: url(p),
env: { CMS_ORIGIN: cmsOrigin },
reuseExistingServer: false,
timeout: 120_000,
});
Expand All @@ -56,40 +32,20 @@ export default defineConfig({
{
name: "remote",
use: { baseURL: remote },
testIgnore: /i18n|cms-down/,
testIgnore: /i18n/,
},
]
: [
{
name: "default",
use: { baseURL: url(ports.web) },
testIgnore: /i18n|cms-down/,
use: { baseURL: url(port) },
testIgnore: /i18n/,
},
{
name: "i18n",
use: { baseURL: url(ports.webI18n) },
use: { baseURL: url(port + 1) },
testMatch: /i18n\.spec\.ts/,
},
{
name: "cms-down",
use: { baseURL: url(ports.webDown) },
testMatch: /cms-down\.spec\.ts/,
},
],
webServer: remote
? undefined
: [
cms(ports.cms),
cms(
ports.cmsI18n,
resolve(
fileURLToPath(new URL(".", import.meta.url)),
"tests/fixtures/cms-pseudo-locale.json",
),
),
web(ports.web, url(ports.cms)),
web(ports.webI18n, url(ports.cmsI18n)),
// Port 9 (discard) refuses connections: the CMS is down.
web(ports.webDown, url(9)),
],
webServer: remote ? undefined : [web(port), web(port + 1, "--mode e2e-i18n")],
});
4 changes: 2 additions & 2 deletions scripts/check-copy.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Fails when Svelte markup contains hardcoded copy: text nodes with letters or
// literal aria-label/placeholder/title/alt/label attributes. All user-facing
// copy comes from the CMS (docs/designs/cms.md). Symbols and numbers are fine.
// copy comes from the web content files. Symbols and numbers are fine.
import { readdir, readFile } from "node:fs/promises";
import { join, relative } from "node:path";
import { fileURLToPath } from "node:url";
Expand Down Expand Up @@ -79,7 +79,7 @@ if (process.argv[1] === fileURLToPath(import.meta.url)) {
console.error(`${relative(".", file)}:${line}: hardcoded copy: ${text}`);
if (findings.length) {
console.error(
`${findings.length} hardcoded string(s). Add them to the CMS catalog and use t().`,
`${findings.length} hardcoded string(s). Add them to the web content files and use t().`,
);
process.exit(1);
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/check-copy.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ test("flags literal accessible and hint attributes", () => {
);
});

test("allows CMS expressions, symbols, numbers and non-copy attributes", () => {
test("allows copy expressions, symbols, numbers and non-copy attributes", () => {
assert.deepEqual(
find(`<script lang="ts">const x = "Not markup";</script>
<p class="primary" role="status">{t("brand.name")} ✳ × ° ↗ · 12</p>
Expand Down
13 changes: 0 additions & 13 deletions scripts/cms-repo.mjs

This file was deleted.

Loading
Loading