Skip to content

context site

The site command generates a browsable static documentation site from your context metadata. It provides a human-friendly way to explore your data models, schemas, business rules, and governance — and in studio mode, edit them directly in the browser.

Terminal window
context site # build static site using EJS templates
context site --astro # build using Astro (component-based, recommended)
OptionDescriptionDefault
--context-dir <path>Path to context files./context
--output-dir <path>Path to site output directory./site
--astroUse Astro-based site builderOff (uses EJS legacy)

Each model gets its own page showing:

  • Description and AI context — human and machine-readable summaries
  • Governance grid — owner, trust level, security classification, version, tags
  • Tier scorecard — Bronze/Silver/Gold checks with pass/fail status
  • Schema browser — all datasets and fields with types, descriptions, semantic roles, grain, refresh cadence
  • Rules & queries — golden queries (SQL examples), guardrail filters, business rules
  • Metrics — defined KPIs with expressions
  • Relationships — foreign key relationships between datasets
  • Lineage — upstream sources and downstream consumers
  • Home — overview with model count, dataset count, field count, term count, and owner count; clickable cards for every model and owner
  • Glossary — all business terms with definitions, synonyms, and linked fields
  • Owner pages — team contact info and the models they govern
  • Search — full-text search across models, fields, terms, and owners
  • Sidebar — browse all models with tier badges at a glance
  • Top bar — site title, current page, search link, docs link
  • Breadcrumbs — on model, schema, rules, and owner pages

Open directly in a browser:

Terminal window
open site/index.html

Or serve with any static file server:

Terminal window
npx serve site -l 8080

The most powerful way to use the site is through Studio mode, which turns the documentation site into an interactive editor:

Terminal window
context dev --studio

This launches the site at http://localhost:4040 with editing capabilities:

  • Model description and AI context — click to edit inline
  • Field descriptions, semantic roles, and aggregation rules — click any field value
  • Governance metadata — trust level, security, owner, tags
  • Golden queries and guardrail filters — edit SQL directly
  • Glossary terms — definitions, synonyms, field mappings
  • Model name — click the ✎ Rename button on any model page to rename the model across all context files (OSI, governance, rules, lineage)
  1. Browse — navigate the site like normal documentation
  2. Click to edit — any dashed-underlined value is editable; dropdowns appear for enumerated fields (like semantic role or trust level)
  3. Stage changes — edits are staged automatically as you work; a bottom bar shows the count
  4. Preview diff — click “Preview & Save” to review a unified diff of every pending change
  5. Save — writes changes back to the underlying YAML files, triggers a recompile, and the tier scorecard updates live

When your database introspection creates a model named default, you can rename it to something meaningful:

  1. Open the model page in Studio
  2. Click the ✎ Rename button next to the model name
  3. Enter the new name (e.g., saber-alert)
  4. The rename updates all context files — OSI model, governance, rules, and lineage — and redirects you to the new URL

The generated site is fully static HTML with minimal JavaScript. Deploy anywhere:

Terminal window
# Build and deploy
context site --output-dir public/data-docs
# Works with any host
cp -r public/data-docs /var/www/html/ # nginx
netlify deploy --dir public/data-docs # Netlify
vercel --cwd public/data-docs # Vercel
Terminal window
# Full pipeline from database to documentation
context introspect --db postgres://localhost/myapp
context enrich --target silver --apply
context site --output-dir public/data-docs
# Or use Studio for interactive curation
context dev --studio
# Edit metadata in the browser, save changes, then build
context site --astro --output-dir public/data-docs
  • The site command compiles context internally — you do not need to run context build first
  • The site uses a dark theme with gold accents optimized for long reading sessions
  • The --astro flag uses file-based routing and component architecture for cleaner output
  • Studio mode requires context dev --studio, not context site