Some checks failed
DSS Project Analysis / dss-context-update (push) Has been cancelled
Complete implementation of enterprise design system validation: Phase 1 - @dss/rules npm package: - CLI with validate and init commands - 16 rules across 5 categories (colors, spacing, typography, components, a11y) - dss-ignore support (inline and next-line) - Break-glass [dss-skip] for emergency merges - CI workflow templates (Gitea, GitHub, GitLab) Phase 2 - Metrics dashboard: - FastAPI metrics API with SQLite storage - Portfolio-wide metrics aggregation - Project drill-down with file:line:column violations - Trend charts and history tracking Phase 3 - Local analysis cache: - LocalAnalysisCache for offline-capable validation - Mode detection (LOCAL/REMOTE/CI) - Stale cache warnings with recommendations Phase 4 - Project onboarding: - dss-init command for project setup - Creates ds.config.json, .dss/ folder structure - Updates .gitignore and package.json scripts - Optional CI workflow setup Architecture decisions: - No commit-back: CI uploads to dashboard, not git - Three-tier: Dashboard (read-only) → CI (authoritative) → Local (advisory) - Pull-based rules via npm for version control 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
@dss/rules
Versioned design system rules for enterprise DSS enforcement.
Installation
npm install @dss/rules
Usage
In Your Project
const rules = require('@dss/rules');
// Load all rules
const allRules = rules.loadRules();
// Get specific category
const colorRules = rules.getRulesByCategory('colors');
// Validate a value
const result = rules.validateValue('colors/no-hardcoded-colors', '#ff0000');
// { valid: false, violations: [...] }
// Get required tokens
const required = rules.getRequiredTokens();
// { colors: ['colors.primary', ...], spacing: [...] }
In CI/CD Pipeline
- name: Validate DSS Rules
run: |
npx @dss/rules validate src/**/*.tsx --json > dss-report.json
Pre-commit Hook
#!/bin/bash
npx @dss/rules validate $(git diff --cached --name-only --diff-filter=ACM | grep -E '\.(tsx?|jsx?|css|scss)$')
Rule Categories
| Category | Description |
|---|---|
colors |
Color token usage, semantic naming, contrast |
spacing |
Spacing scale compliance, consistent values |
typography |
Font size scale, semantic elements |
components |
Component usage, prop requirements |
accessibility |
WCAG 2.1 AA compliance |
Rule Severities
- error: Blocks CI pipeline, must fix
- warning: Advisory, should fix
- info: Suggestion, optional
Version Policy
Rules follow semantic versioning:
- MAJOR: Breaking changes (new errors that may fail existing code)
- MINOR: New rules added as warnings
- PATCH: Bug fixes, documentation
Projects should pin to minor version: @dss/rules@^1.0.0
API Reference
loadRules()
Returns all rule sets organized by category.
getRulesByCategory(category)
Returns rules for a specific category.
getAllRuleIds()
Returns array of all rule IDs in format category/rule-id.
getRule(ruleId)
Returns a specific rule definition.
validateValue(ruleId, value)
Validates a value against rule patterns.
getRequiredTokens()
Returns required tokens organized by category.
getCIConfig()
Returns configuration object for CI pipelines.
License
MIT