Major refactor: Consolidate DSS into unified package structure
- Create new dss/ Python package at project root - Move MCP core from tools/dss_mcp/ to dss/mcp/ - Move storage layer from tools/storage/ to dss/storage/ - Move domain logic from dss-mvp1/dss/ to dss/ - Move services from tools/api/services/ to dss/services/ - Move API server to apps/api/ - Move CLI to apps/cli/ - Move Storybook assets to storybook/ - Create unified dss/__init__.py with comprehensive exports - Merge configuration into dss/settings.py (Pydantic-based) - Create pyproject.toml for proper package management - Update startup scripts for new paths - Remove old tools/ and dss-mvp1/ directories Architecture changes: - DSS is now MCP-first with 40+ tools for Claude Code - Clean imports: from dss import Projects, Components, FigmaToolSuite - No more sys.path.insert() hacking - apps/ contains thin application wrappers (API, CLI) - Single unified Python package for all DSS logic 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,98 +1,82 @@
|
||||
"""
|
||||
Pytest configuration and shared fixtures.
|
||||
"""
|
||||
|
||||
import pytest
|
||||
import tempfile
|
||||
import shutil
|
||||
from pathlib import Path
|
||||
from tools.ingest.base import DesignToken, TokenCollection, TokenType
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def temp_dir():
|
||||
"""Create a temporary directory for tests."""
|
||||
temp_path = tempfile.mkdtemp()
|
||||
yield Path(temp_path)
|
||||
shutil.rmtree(temp_path, ignore_errors=True)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def sample_css():
|
||||
"""Sample CSS custom properties."""
|
||||
return """
|
||||
:root {
|
||||
--color-primary: #3B82F6;
|
||||
--color-secondary: #10B981;
|
||||
--spacing-sm: 8px;
|
||||
--spacing-md: 16px;
|
||||
--spacing-lg: 24px;
|
||||
--font-size-base: 16px;
|
||||
}
|
||||
@pytest.fixture(scope="function")
|
||||
def mock_react_project(tmp_path: Path) -> Path:
|
||||
"""
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def sample_scss():
|
||||
"""Sample SCSS variables."""
|
||||
return """
|
||||
$primary-color: #3B82F6;
|
||||
$secondary-color: #10B981;
|
||||
$font-family-sans: 'Inter', sans-serif;
|
||||
$font-size-base: 16px;
|
||||
$spacing-md: 16px;
|
||||
Creates a temporary mock React project structure for testing.
|
||||
"""
|
||||
project_dir = tmp_path / "test-project"
|
||||
project_dir.mkdir()
|
||||
|
||||
# Create src directory
|
||||
src_dir = project_dir / "src"
|
||||
src_dir.mkdir()
|
||||
|
||||
@pytest.fixture
|
||||
def sample_json_tokens():
|
||||
"""Sample JSON design tokens (W3C format)."""
|
||||
return {
|
||||
"color": {
|
||||
"primary": {
|
||||
"500": {"value": "#3B82F6", "type": "color"},
|
||||
"600": {"value": "#2563EB", "type": "color"}
|
||||
},
|
||||
"secondary": {
|
||||
"500": {"value": "#10B981", "type": "color"}
|
||||
}
|
||||
},
|
||||
"spacing": {
|
||||
"sm": {"value": "8px", "type": "dimension"},
|
||||
"md": {"value": "16px", "type": "dimension"},
|
||||
"lg": {"value": "24px", "type": "dimension"}
|
||||
}
|
||||
}
|
||||
# Create components directory
|
||||
components_dir = src_dir / "components"
|
||||
components_dir.mkdir()
|
||||
|
||||
# Component A
|
||||
(components_dir / "ComponentA.jsx").write_text("""
|
||||
import React from 'react';
|
||||
import './ComponentA.css';
|
||||
|
||||
@pytest.fixture
|
||||
def sample_token_collection():
|
||||
"""Create a sample token collection."""
|
||||
tokens = [
|
||||
DesignToken(name="color.primary", value="#3B82F6", type=TokenType.COLOR),
|
||||
DesignToken(name="color.secondary", value="#10B981", type=TokenType.COLOR),
|
||||
DesignToken(name="spacing.md", value="16px", type=TokenType.SPACING),
|
||||
]
|
||||
return TokenCollection(tokens=tokens, name="Sample Collection")
|
||||
const ComponentA = () => {
|
||||
return <div className="component-a">Component A</div>;
|
||||
};
|
||||
|
||||
export default ComponentA;
|
||||
""")
|
||||
|
||||
@pytest.fixture
|
||||
def tailwind_config_path(temp_dir):
|
||||
"""Create a temporary Tailwind config file."""
|
||||
config_content = """
|
||||
module.exports = {
|
||||
theme: {
|
||||
colors: {
|
||||
blue: '#0000FF',
|
||||
red: '#FF0000'
|
||||
},
|
||||
spacing: {
|
||||
'1': '4px',
|
||||
'2': '8px'
|
||||
}
|
||||
}
|
||||
(components_dir / "ComponentA.css").write_text("""
|
||||
.component-a {
|
||||
color: blue;
|
||||
}
|
||||
"""
|
||||
config_file = temp_dir / "tailwind.config.js"
|
||||
config_file.write_text(config_content)
|
||||
return config_file
|
||||
""")
|
||||
|
||||
# Component B
|
||||
(components_dir / "ComponentB.tsx").write_text("""
|
||||
import React from 'react';
|
||||
import ComponentA from './ComponentA';
|
||||
|
||||
const ComponentB = () => {
|
||||
return (
|
||||
<div>
|
||||
<ComponentA />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default ComponentB;
|
||||
""")
|
||||
|
||||
# App.js
|
||||
(src_dir / "App.js").write_text("""
|
||||
import React from 'react';
|
||||
import ComponentB from './components/ComponentB';
|
||||
|
||||
function App() {
|
||||
return (
|
||||
<div className="App">
|
||||
<ComponentB />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default App;
|
||||
""")
|
||||
|
||||
# package.json
|
||||
(project_dir / "package.json").write_text("""
|
||||
{
|
||||
"name": "test-project",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"react": "^18.0.0"
|
||||
}
|
||||
}
|
||||
""")
|
||||
|
||||
return project_dir
|
||||
|
||||
Reference in New Issue
Block a user