Skip to main content

export_rules

Export all design system enforcement rules as a portable, versioned artifact.

Reference

Parameters

  • Name
    format
    Type
    enum · required
    Description

    Export format (json · markdown · sarif)

  • Name
    design_system_id
    Type
    string · optional
    Description

    Design system UUID (uuid)

  • Name
    layer_id
    Type
    string · optional
    Description

    Layer UUID for resolved rules (uuid)

  • Name
    include_defaults
    Type
    boolean · optional
    Description

    Merge core defaults when DB is empty (default: false)

  • Name
    ttl_hours
    Type
    number · optional
    Description

    Advisory freshness budget in hours embedded in the artifact (default 336 = 14 days) (default: 336)

Returns

{
  content          The formatted export content
  contentHash      SHA-256 hash for cache invalidation (detects content change)
  exportedAt       ISO-8601 timestamp this artifact was generated (artifact age basis)
  sourceUpdatedAt  ISO-8601 max updated_at across exported rules (drift basis; null if no rules)
  ttlHours         advisory freshness budget — consumer treats artifact as stale past exportedAt + ttlHours
  stats            Rule counts by type and severity
  filename         Suggested filename for the export
}

Description

Export all design system enforcement rules as a portable, versioned artifact.

Exports forbidden primitives, context rules, and intent routes in multiple formats for use in CI/CD, IDE extensions, AI context files, or cross-MCP sharing.

Formats:

  • json: Full DesignSystemRuleset object (machine-readable, versioned, with SHA-256 content hash)
  • markdown: Human-readable sections grouped by type and severity
  • sarif: SARIF v2.1.0 with rules in tool.driver.rules[] (for CI/CD integration)

Parameters:

  • format (required): Export format (json, markdown, sarif)
  • design_system_id (optional): Design system UUID (falls back to configured DS)
  • layer_id (optional): Layer UUID for layer-specific resolved rules
  • include_defaults (optional): Merge @preset/core defaults when DB is empty (default: false)
  • ttl_hours (optional): Advisory freshness budget in hours embedded in the artifact (default: 336 = 14 days)

Freshness: compare (now - exportedAt) vs ttlHours for age; compare sourceUpdatedAt (or contentHash) against a stored copy for drift. Age and drift are independent.

Use this to export rules once and enforce everywhere.

Source

Defined in packages/mcp/src/tools.ts. The request handler lives alongside its registration in packages/mcp/src/tools/.

Was this page helpful?

Last reviewed by @jschuyler