Skip to content

Web Frontend

The frontend is an Astro 6 static site that generates a comprehensive, self-contained view of the autonomous rewrite journey. It leverages Tailwind CSS v4 via PostCSS for a responsive, theme-aware UI and uses Astro’s content collections to render pages from pre-generated Markdown files. The architecture prioritizes performance and offline capability, producing a static dist/ directory that is served by the journey server, with no runtime data fetching required.

The project is configured as a static site, ensuring all assets and pages are generated at build time. The build output is directed to ./dist by default, but this is configurable via the JOURNEY_OUTDIR environment variable to support isolated snapshots 1. Similarly, the URL base path can be adjusted via JOURNEY_BASE to allow the site to be served from sub-paths like /snapshots/<id>/ without breaking links.

Styling is handled by Tailwind CSS v4, which is integrated via PostCSS rather than the Vite plugin. This specific configuration avoids compatibility issues with Astro 6’s rolldown-based Vite implementation. The PostCSS configuration is defined in postcss.config.mjs and processes the global styles in src/styles/global.css 2.

diagram

Journey data is stored as Markdown files within src/content/iters/. Each file represents a single iteration of the autonomous loop, named in the format epoch-{E}-iter-{NNNN}.md 3. These files are pre-generated by the journey_synth Python script and contain redacted data with pre-formatted dates.

The content schema is defined in src/content.config.ts using Zod. It captures key metrics for each iteration, including:

  • Identity: iter, epoch, slug, module.
  • Status: outcome (e.g., ACCEPT, REVERT, WEDGED_NO_VERDICT).
  • Timing: startedAtIso, endedAtIso, and their display equivalents.
  • Resource Usage: qwenTokens, codexCalls, codexTokens, wedges, revisionCount, and files.

The build process automatically generates a page for every iteration found in the content directory, eliminating the need for hardcoded lists or runtime API calls.

The site uses a global layout defined in src/layouts/BaseLayout.astro. This shell includes the navigation, main content slot, and footer 4. It implements a “no-flash” theme toggle by injecting an inline script that sets the dark class on the <html> element before the first paint, based on localStorage or the OS preference.

Styling is managed through CSS variables defined in src/styles/global.css. The theme system defines light and dark palettes using custom properties (e.g., --color-bg, --color-text) 5. Components use these variables via Tailwind’s arbitrary value syntax (e.g., bg-(--color-bg)) to ensure they automatically adapt to the active theme.

The global styles also include custom typography rules for markdown content within the .prose-md class, handling headings, code blocks, tables, and blockquotes with theme-aware colors. A subtle grain texture is applied via a CSS pseudo-element to add visual warmth.

The UI is built from reusable Astro components:

  • Nav: A responsive navigation bar that includes links to all site sections (Start, How it works, Journey, etc.) 6. It features a mobile menu drawer and a theme toggle button that syncs the UI icon and persists the preference to localStorage.
  • OutcomeBadge: A small component that displays the status of an iteration (e.g., “accepted”, “reverted”, “wedged”) with color-coded styling based on the outcome 7.
  • StatCard: A card component for displaying key metrics. It supports a value, label, optional hint, and a tone (default, good, warn, danger, brand) to color the value 8.
  • Section: A wrapper component for content sections that can include a kicker, title, and optional narrow layout. It uses a .reveal class for potential future animation hooks 9.
  • Quote: A styled blockquote component with support for attribution and tone-based left border colors (neutral, warn, danger) 10.

End-to-end testing is handled by Playwright, configured in playwright.config.ts. Tests run in parallel and include both desktop (1440x900) and mobile (iPhone 17 Pro Max viewport) projects 11. The tests default to a local server but can be pointed at a remote instance via the BASE_URL environment variable.

The .gitignore file excludes build artifacts (dist/, .astro/), dependencies (node_modules/), and test reports (playwright-report/, test-results/) 12.