Skip to content

Add ghost-site companion package for brand guideline sites - #331

Open
awinther1 wants to merge 1 commit into
mainfrom
feat/ghost-site
Open

awinther1 wants to merge 1 commit into
mainfrom
feat/ghost-site

Conversation

@awinther1

Copy link
Copy Markdown
Collaborator

Summary

Adds packages/ghost-site, a private, zero-dependency Node ESM companion CLI and editorial starter theme that compiles any .ghost/ package into a live brand guideline site.

Architecture

Three-layer sync separation so teams and agents can redesign a guideline site freely without losing automated updates when .ghost/ changes:

  • generated/ (compiler-owned): brand-data.json, brand-tokens.css, and copied assets/. Rebuilt deterministically on every ghost-site sync.
  • theme/ (human and AI owned): static HTML/CSS/JS editorial starter theme. Scaffolded once on ghost-site init, never overwritten by sync.
  • site.config.yml (human and AI owned): source package path, optional universal standards path, source_url override, and section intros.

Highlights

  • CLI verbs: init, sync, and serve in packages/ghost-site/ghost-site.mjs with zero external runtime dependencies.
  • Format support: reads both ghost.package/v1 paired cascades (with --universal) and legacy cover packages, while never publishing .ghost/checks/.
  • Adaptive Home overview: full-viewport split-grid poster with lockup, brand statement, reading modal, signature palette chips, and an adaptive visual quadrant (photography diptych, inline SVG icon matrix, direction-synced HTML specimen, or typographic poster depending on package contents).
  • Color, Typography, Iconography, and source links: full-bleed color tiles with click-to-copy specs and WCAG badges, package-faithful typography specimens and declared scale/weight tables (no fabricated scale rows), SVG and variable-font icon grids with live controls, and hover-revealed </> links beside headlines pointing to the underlying .ghost/ markdown files (with raw markdown modal fallback).
  • AI customization skill: includes packages/ghost-site/skill/SKILL.md for customizing theme/ while preserving the generated/ sync contract.

Verification

  • pnpm run build and pnpm run check (biome check ., tsc --build, check:package-bin, check:packed-package, check:file-sizes, check:terminology, check:release-tarball, check:release-workflows)
  • pnpm run check:ghost-packages
  • pnpm --filter @design-intelligence/ghost-site test (6/6 Vitest tests passing, including compiling apps/docs/.ghost)
  • pnpm install --lockfile-only --frozen-lockfile --ignore-scripts

No changeset is included because packages/ghost-site is a private workspace package and @design-intelligence/ghost is unchanged.

Adds `packages/ghost-site`, a zero-dependency Node ESM companion CLI and
editorial starter theme that compiles any `.ghost/` package into a live
brand guideline site.

- Three-layer sync contract: compiler-owned `generated/`, human and AI
  owned `theme/` and `site.config.yml`
- Supports both `ghost.package/v1` paired cascades (with `--universal`)
  and legacy `cover` packages
- Adaptive full-viewport split-grid Home overview, full-bleed color
  tiles with WCAG badges, package-faithful typography specimens and
  declared scale/weight tables, first-class SVG and variable-font
  iconography, and hover-revealed source code links
- Includes AI customization skill (`skill/SKILL.md`) and Vitest coverage
  against `apps/docs/.ghost` and synthetic fixtures

Co-authored-by: Neon <8d522b99e1737395ba95850a2c30342584d20f3f4d54af3bfdd9e519feda86ac@buzz.block.builderlab.xyz>
@awinther1
awinther1 marked this pull request as ready for review December 4, 2026 17:34
if (seenLogoRel.has(f.relPath) || seenIconRel.has(f.relPath)) continue;

if (HTML_EXTS.has(f.ext)) {
const copied = ensureCopied(f.absPath, f.relPath);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Chai read and approved this comment before it was posted.

[P2] The documented static-host setup publishes these raw HTML files on the guideline site’s origin. The iframe sandbox applies only to the embedded preview. Can we sanitize examples before copying them or serve them from an isolated origin?

Updated by Pushback 🤖

const copiedMap = new Map(); // package relPath -> assetPath (`assets/...`)

function ensureCopied(absPath, relPath) {
if (!isInsideDir(absPath, packageDir) || !fs.existsSync(absPath))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Chai read and approved this comment before it was posted.

[P2] This checks the path before resolving symlinks. Can we check the resolved path against the allowed source root before reading or copying the asset? The documented CI job commits the generated files to the repository.

Updated by Pushback 🤖

sourceBaseUrl = null,
) {
const nodes = [];
const entries = fs.readdirSync(packageDir, { withFileTypes: true });

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Chai read and approved this comment before it was posted.

[P2] This scans only top-level Markdown, and the separate parser handles YAML and fenced headings differently from ghost. Can we reuse ghost’s readers and paired-package validation? Please add a fixture with nested guidance, list-valued frontmatter, a fenced heading, and a prerequisite in the standards package. Assert that the prerequisite resolves to an actual page anchor.

Updated by Pushback 🤖

let controls = {};

// Step 1: CSS token files
const cssFiles = discoverMaterialFiles(packageDir, /\.css$/i).filter((f) =>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Chai read and approved this comment before it was posted.

[P2] The docs package declares repo-relative stylesheets, but this scans only package materials. Can we resolve declared stylesheets within the allowed repository root and assert that the docs smoke test renders the palette and monospace specimen?

Updated by Pushback 🤖

cssFontFaces.push(...parsed.fontFaces);
rawCssVars.push(...parsed.rawVars);
if (parsed.swatches.length > 0) {
rawDirections.push({

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Chai read and approved this comment before it was posted.

[P2] Every CSS file with swatches adds a direction with the ID default. A later file can replace the earlier colors. Can we merge the swatches into one default direction with explicit precedence for duplicate tokens?

Updated by Pushback 🤖


// Clean & recreate generated/ (NEVER touches theme/ or site.config.yml)
const generatedDir = path.join(resolvedOut, "generated");
cleanGeneratedDir(generatedDir);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Chai read and approved this comment before it was posted.

[P2] This deletes generated/ before token and asset reads finish. An asset read failure leaves the existing site without its generated files. Can we stage the new output and replace the old directory only after the build succeeds? Please test that a failed sync leaves the previous output intact.

Updated by Pushback 🤖


const brandData = {
schema: "ghost-site.brand-data/v1",
generatedAt: new Date().toISOString(),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Chai read and approved this comment before it was posted.

[P2] generatedAt changes on every run, so the documented CI job commits a diff even when the rendered content is identical. Can we remove this field and assert byte-identical output across two syncs with the same inputs?

Updated by Pushback 🤖

);
writeRootRedirect(resolvedOut);

const compiled = compilePackage({

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Chai read and approved this comment before it was posted.

[P2] Running init on an existing output with a different --package compiles the new package but keeps the old source in site.config.yml. The next sync switches back. Can we reject the mismatch before writing and point to the saved setting?

Updated by Pushback 🤖

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants