This commit introduces a new project analysis engine to the DSS. Key features include: - A new analysis module in `dss-mvp1/dss/analyze` that can parse React projects and generate a dependency graph. - A command-line interface (`dss-mvp1/dss-cli.py`) to run the analysis, designed for use in CI/CD pipelines. - A new `dss_project_export_context` tool in the Claude MCP server to allow AI agents to access the analysis results. - A `.gitlab-ci.yml` file to automate the analysis on every push, ensuring the project context is always up-to-date. - Tests for the new analysis functionality. This new architecture enables DSS to have a deep, version-controlled understanding of a project's structure, which can be used to power more intelligent agents and provide better developer guidance. The analysis is no longer automatically triggered on `init`, but is designed to be run manually or by a CI/CD pipeline.
83 lines
1.6 KiB
Python
83 lines
1.6 KiB
Python
import pytest
|
|
from pathlib import Path
|
|
|
|
@pytest.fixture(scope="function")
|
|
def mock_react_project(tmp_path: Path) -> Path:
|
|
"""
|
|
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()
|
|
|
|
# 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';
|
|
|
|
const ComponentA = () => {
|
|
return <div className="component-a">Component A</div>;
|
|
};
|
|
|
|
export default ComponentA;
|
|
""")
|
|
|
|
(components_dir / "ComponentA.css").write_text("""
|
|
.component-a {
|
|
color: blue;
|
|
}
|
|
""")
|
|
|
|
# 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
|