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.
context site # build static site using EJS templatescontext site --astro # build using Astro (component-based, recommended)Options
Section titled “Options”| Option | Description | Default |
|---|---|---|
--context-dir <path> | Path to context files | ./context |
--output-dir <path> | Path to site output directory | ./site |
--astro | Use Astro-based site builder | Off (uses EJS legacy) |
What the site gives you
Section titled “What the site gives you”Model pages
Section titled “Model pages”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
Other pages
Section titled “Other pages”- 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
Navigation
Section titled “Navigation”- 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
Serving locally
Section titled “Serving locally”Open directly in a browser:
open site/index.htmlOr serve with any static file server:
npx serve site -l 8080Live editing with Studio
Section titled “Live editing with Studio”The most powerful way to use the site is through Studio mode, which turns the documentation site into an interactive editor:
context dev --studioThis launches the site at http://localhost:4040 with editing capabilities:
What you can edit in Studio
Section titled “What you can edit in Studio”- 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)
Editing workflow
Section titled “Editing workflow”- Browse — navigate the site like normal documentation
- Click to edit — any dashed-underlined value is editable; dropdowns appear for enumerated fields (like semantic role or trust level)
- Stage changes — edits are staged automatically as you work; a bottom bar shows the count
- Preview diff — click “Preview & Save” to review a unified diff of every pending change
- Save — writes changes back to the underlying YAML files, triggers a recompile, and the tier scorecard updates live
Renaming a model
Section titled “Renaming a model”When your database introspection creates a model named default, you can rename it to something meaningful:
- Open the model page in Studio
- Click the ✎ Rename button next to the model name
- Enter the new name (e.g.,
saber-alert) - The rename updates all context files — OSI model, governance, rules, and lineage — and redirects you to the new URL
Deploying the static site
Section titled “Deploying the static site”The generated site is fully static HTML with minimal JavaScript. Deploy anywhere:
# Build and deploycontext site --output-dir public/data-docs
# Works with any hostcp -r public/data-docs /var/www/html/ # nginxnetlify deploy --dir public/data-docs # Netlifyvercel --cwd public/data-docs # VercelExample workflow
Section titled “Example workflow”# Full pipeline from database to documentationcontext introspect --db postgres://localhost/myappcontext enrich --target silver --applycontext site --output-dir public/data-docs
# Or use Studio for interactive curationcontext dev --studio# Edit metadata in the browser, save changes, then buildcontext site --astro --output-dir public/data-docs- The
sitecommand compiles context internally — you do not need to runcontext buildfirst - The site uses a dark theme with gold accents optimized for long reading sessions
- The
--astroflag uses file-based routing and component architecture for cleaner output - Studio mode requires
context dev --studio, notcontext site
Next steps
Section titled “Next steps”- Serve context to AI tools with
context serve - Check your tier status with
context build - Learn about the tier system to understand Bronze → Silver → Gold progression