Initial commit: Clean DSS implementation
Migrated from design-system-swarm with fresh git history.
Old project history preserved in /home/overbits/apps/design-system-swarm
Core components:
- MCP Server (Python FastAPI with mcp 1.23.1)
- Claude Plugin (agents, commands, skills, strategies, hooks, core)
- DSS Backend (dss-mvp1 - token translation, Figma sync)
- Admin UI (Node.js/React)
- Server (Node.js/Express)
- Storybook integration (dss-mvp1/.storybook)
Self-contained configuration:
- All paths relative or use DSS_BASE_PATH=/home/overbits/dss
- PYTHONPATH configured for dss-mvp1 and dss-claude-plugin
- .env file with all configuration
- Claude plugin uses ${CLAUDE_PLUGIN_ROOT} for portability
Migration completed: $(date)
🤖 Clean migration with full functionality preserved
This commit is contained in:
93
examples/01_basic_ingestion.py
Executable file
93
examples/01_basic_ingestion.py
Executable file
@@ -0,0 +1,93 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Example 1: Basic Token Ingestion
|
||||
|
||||
Shows how to ingest design tokens from different sources.
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
# Add project root to path
|
||||
sys.path.insert(0, str(Path(__file__).parent.parent))
|
||||
|
||||
|
||||
async def main():
|
||||
print("=" * 60)
|
||||
print("EXAMPLE 1: Basic Token Ingestion")
|
||||
print("=" * 60)
|
||||
|
||||
# 1. CSS Token Ingestion
|
||||
print("\n1. CSS Custom Properties")
|
||||
print("-" * 40)
|
||||
from tools.ingest.css import CSSTokenSource
|
||||
|
||||
css_content = """
|
||||
:root {
|
||||
--color-primary: #3B82F6;
|
||||
--color-secondary: #10B981;
|
||||
--spacing-sm: 8px;
|
||||
--spacing-md: 16px;
|
||||
--spacing-lg: 24px;
|
||||
}
|
||||
"""
|
||||
|
||||
css_parser = CSSTokenSource()
|
||||
css_result = await css_parser.extract(css_content)
|
||||
|
||||
print(f"✅ Extracted {len(css_result.tokens)} CSS tokens:")
|
||||
for token in css_result.tokens[:3]:
|
||||
print(f" {token.name} = {token.value} ({token.type.value})")
|
||||
|
||||
# 2. SCSS Token Ingestion
|
||||
print("\n2. SCSS Variables")
|
||||
print("-" * 40)
|
||||
from tools.ingest.scss import SCSSTokenSource
|
||||
|
||||
scss_content = """
|
||||
$primary-color: #3B82F6;
|
||||
$secondary-color: #10B981;
|
||||
$font-family-sans: 'Inter', sans-serif;
|
||||
$font-size-base: 16px;
|
||||
"""
|
||||
|
||||
scss_parser = SCSSTokenSource()
|
||||
scss_result = await scss_parser.extract(scss_content)
|
||||
|
||||
print(f"✅ Extracted {len(scss_result.tokens)} SCSS tokens:")
|
||||
for token in scss_result.tokens[:3]:
|
||||
print(f" {token.name} = {token.value}")
|
||||
|
||||
# 3. JSON Tokens (W3C Format)
|
||||
print("\n3. JSON Design Tokens (W3C)")
|
||||
print("-" * 40)
|
||||
from tools.ingest.json_tokens import JSONTokenSource
|
||||
import json
|
||||
|
||||
json_content = {
|
||||
"color": {
|
||||
"primary": {
|
||||
"500": {"value": "#3B82F6", "type": "color"},
|
||||
"600": {"value": "#2563EB", "type": "color"}
|
||||
}
|
||||
},
|
||||
"spacing": {
|
||||
"md": {"value": "16px", "type": "dimension"}
|
||||
}
|
||||
}
|
||||
|
||||
json_parser = JSONTokenSource()
|
||||
json_result = await json_parser.extract(json.dumps(json_content))
|
||||
|
||||
print(f"✅ Extracted {len(json_result.tokens)} JSON tokens:")
|
||||
for token in json_result.tokens:
|
||||
print(f" {token.name} = {token.value} ({token.type.value})")
|
||||
|
||||
print("\n" + "=" * 60)
|
||||
print(f"Total tokens extracted: {len(css_result.tokens) + len(scss_result.tokens) + len(json_result.tokens)}")
|
||||
print("=" * 60)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(main())
|
||||
Reference in New Issue
Block a user