5.5 KiB
Situation Handover to Claude
Context: The overarching goal is to enhance DSS (Design System Server) with greater intelligence for analyzing and managing React projects, initially by "dogfooding" DSS itself on its own admin-ui project.
Initial Goal from User:
- Implement a robust Python-based analysis engine (
project_analyzer.py) for React projects. - Integrate this into the DSS MCP and CLI.
- Ensure continuous integration (CI/CD) automates the analysis and commits results (
project_context.json) back to the repository. - Set up DSS to manage its own
admin-uiproject. - Link core DSS to its Figma UI Kit.
- Build a default Storybook skin with DSS atoms and shadcn styles.
Actions Taken & Current Status:
-
Analysis Engine & CLI:
- Implemented:
dss-mvp1/dss/analyze/project_analyzer.pywas created, capable of parsing React/JS/TS files (using a Node.js@babel/parsersubprocess) and generating anetworkxgraph. It also includes anexport_project_contextfunction. - Implemented:
dss-mvp1/dss-cli.pywas created as a command-line interface, includinganalyze,export-context,add-figma-file,setup-storybook, andsync-tokenscommands. - Implemented: The
dss-claude-plugin/servers/dss-mcp-server.pywas updated to exposedss_project_graph_analysisanddss_project_export_contextas MCP tools for AI agents. - Implemented: Unit tests for
project_analyzer.pywere added and are currently passing.
- Implemented:
-
CI/CD Setup:
- Implemented:
.gitea/workflows/dss-analysis.ymlwas created to automate thedss-cli.py analyzeandgit commitprocess forproject_context.jsonon every push. - Verified: Git hooks were fixed and confirmed to be running.
- Verified: SSH key authentication for Git push was correctly set up after troubleshooting.
- Implemented:
-
Dogfooding
admin-uiProject:- Goal: Initialize
admin-uias a DSS project, generate its analysis context, link it to Figma, and generate Storybook stories. - Status:
admin-ui/.dss/analysis_graph.jsonwas successfully created (bydss-mvp1/dss-cli.py analyze --project-path ./admin-ui).admin-ui/ds.config.jsonwas manually corrected and populated to resolve Pydantic validation errors during project loading.- Figma UI Kit
figd_ScdBk47HlYEItZbQv2CcF9aq-3TfWbBXN3yoRKWAwas successfully linked toadmin-ui(bydss-mvp1/dss-cli.py add-figma-file --project-path ./admin-ui --file-key ...). - Token Synchronization (Blocked):
dss-mvp1/dss-cli.py sync-tokens --project-path ./admin-uifails with403 Client Error: Forbiddenfrom Figma API due to a placeholder token. This is expected, as a validFIGMA_TOKENenvironment variable is required.
- Goal: Initialize
-
Storybook Generation (Current Blocker):
- Goal: Build a default Storybook skin with DSS atoms and shadcn styles applied.
- Expected Tool:
dss-mvp1/dss-cli.py setup-storybook --action generate --project-path ./admin-ui. - Problem: This command consistently reports
Generated 0 new stories. - Investigation:
- Initial assumption that
dss-mvp1itself contained components was incorrect. - Moved
admin-ui/js/components/ds-button.jstoadmin-ui/src/components/ds-button.jsto match component discovery paths. - Re-read
dss/storybook/generator.pyto confirm its logic. It expects components in standard directories likesrc/components. - Confirmed that
StoryGenerator.generatecallsgenerate_stories_for_directory, which in turn calls_parse_component. - Despite placing
ds-button.jsin a recognized path,0 new storiesare still being generated. - The
StoryGeneratorlogic indss/storybook/generator.pyinspects component files, but it relies on specific patterns (e.g.,interface ButtonProps,children) to extractPropInfoandComponentMeta. The output of@babel/parseris not currently being used byStoryGeneratorto populateComponentMeta.
- Initial assumption that
The core issue preventing Storybook generation is that the StoryGenerator is unable to correctly parse the provided JavaScript/TypeScript component files and extract the necessary metadata (props, component name, etc.) to create a story. The integration between the @babel/parser output (which is JSON AST) and the StoryGenerator's _parse_component method is either missing or misconfigured. The _parse_component method appears to be using regex on the raw file content, which might be insufficient or incorrect for the component's structure.
Recommendation for Claude:
- Investigate
dss/storybook/generator.py: Focus on the_parse_componentmethod. How does it extractComponentMetafrom the component file? It currently uses regex, which is fragile. - Integrate Babel AST: The
@babel/parsersubprocess call already produces a full AST. The_parse_componentmethod should be updated to consume and interpret this AST to reliably extract component metadata (name, props, children, description). This would be much more robust than regex. - Validate Component Structure: Ensure the
ds-button.js(or any target component) has a structure that the updated parser can understand and extract metadata from. - Re-run Storybook Generation: Once
_parse_componentcan correctly extract metadata, re-runsetup-storybook --action generateto confirm stories are created.
I have included the contents of dss/storybook/generator.py for direct reference.