SuperDesign Documentation

repository·main·Indexed 27 days ago

https://github.com/superdesigndev/superdesign

An open-source AI design agent for IDEs including Cursor, Windsurf, Claude Code, and VS Code. SuperDesign enables the generation of UI mockups, components, and wireframes from natural language prompts, saving designs locally in the .superdesign/ directory. The documentation covers installation, configuration with local OpenAI-compatible servers, extension publishing workflows via vsce and ovsx, and developer guides for implementing standardized tool responses and webview UI components.

Tokens
2.9K
Snippets
7
Records
21
Agent score
92%

What's inside SuperDesign

  1. Publish deprecation updates to the iganbold publisher

    main

    The iganbold publisher is deprecated and should only be used for critical security fixes, breaking changes, or major migration announcements. This process uses GitHub Actions triggered by git tags.

    1. Update Files:
      • Set publisher to iganbold and name to superdesign in package.json.
      • Update displayName to include (DEPRECATED).
      • Update src/extension.ts to point the settings command to @ext:iganbold.superdesign.
      • Replace README.md with a deprecation notice.
    2. Commit and Tag: Commit the changes and create a version tag (e.g., v0.0.X).
    3. Push: Push both the main branch and the tag to GitHub to trigger the workflow.
    4. Revert: Once the GitHub Action completes, revert package.json, src/extension.ts, and README.md back to the SuperdesignDev configuration for ongoing development.
    # 1. Commit deprecation changes
    git add -A
    git commit -m "Update deprecation version 0.0.X for iganbold publisher"
    
    # 2. Create version tag (triggers GitHub Actions)
    git tag v0.0.X
    
    # 3. Push to GitHub
    git push origin main
    git push origin v0.0.X
  2. Use SuperDesign with Cursor or Claude Code subscriptions

    main

    After initializing the SuperDesign extension, specific rules for Cursor or Claude Code are added. You can prompt the agent to perform design tasks and preview them in the SuperDesign canvas using the command:

    cmd + shift + p -> superdesign: open canva

    Optimization for Cursor users: For better performance, copy the prompt found in design.mdc and create a custom mode in Cursor using that same system prompt.

  3. Install and use the SuperDesign IDE extension

    main

    SuperDesign is an AI design agent for IDEs like Cursor, Windsurf, Claude Code, and VS Code. It allows you to generate UI mockups, components, and wireframes from natural language prompts.

    To get started:

    1. Install the extension from the Cursor/VS Code Marketplace.
    2. Open the SuperDesign sidebar panel.
    3. Type a prompt (e.g., Design a modern login screen).
    4. View generated mockups, components, and wireframes.
    5. Fork, tweak, and paste designs into your project.
  4. Configure SuperDesign with local OpenAI compatible servers

    main

    You can use local LLM servers (like LM Studio) by configuring the AI Model Provider settings:

    1. Select openai in the Ai Model Provider setting.
    2. Enter any value in the Openai Api Key input.
    3. Enter your local server endpoint in the Openai Url input (e.g., http://127.0.0.1:1234/v1).
  5. Publish to the SuperdesignDev publisher

    main

    Use this workflow for all regular feature updates and releases. This is the primary publisher.

    1. Update Version: Increment the version field in package.json and ensure the publisher is set to SuperdesignDev and name is superdesign-official.
    2. Build and Publish: Run the package command and then use vsce for the VS Code Marketplace and ovsx for the Open VSX Registry.

    Note: You will need your Azure DevOps Personal Access Token (VSCE Token) and your Open VSX token.

    # Build the extension
    npm run package
    
    # Publish to VS Code Marketplace
    npx vsce publish --pat YOUR_VSCE_TOKEN
    
    # Publish to Open VSX Registry
    npx ovsx publish -p YOUR_OVSX_TOKEN
    
    # Or all in one command:
    npm run package && \
    npx vsce publish --pat YOUR_VSCE_TOKEN && \
    npx ovsx publish -p YOUR_OVSX_TOKEN
  6. Configure GitHub Actions for automated publishing

    main

    The extension uses a GitHub Actions workflow located at .github/workflows/publish.yml to automate publishing to the iganbold publisher when a version tag (e.g., v*) is pushed.

    Requirements:

    • Node.js 20+ is required for vsce compatibility.
    • The following secrets must be configured in GitHub Settings:
      • VSCE_TOKEN: For the iganbold publisher.
      • OPEN_VSX_TOKEN: For the iganbold publisher.
    name: Publish Extension
    
    on:
      push:
        tags:
          - 'v*'
    
    jobs:
      publish:
        runs-on: ubuntu-latest
        steps:
          - uses: actions/checkout@v4
          - uses: actions/setup-node@v4
            with:
              node-version: '20'
          - run: npm ci
          - run: npm install -g @vscode/vsce ovsx
          - run: vsce publish --pat ${{ secrets.VSCE_TOKEN }}
          - run: ovsx publish -p ${{ secrets.OPEN_VSX_TOKEN }}
  7. Handle tool errors with handleToolError()

    main

    Use handleToolError to convert exceptions or raw error messages into a standardized ToolErrorResponse. This helper automatically handles Error objects (including truncated stack traces), strings, or unknown types, and allows you to provide context and an error_type.

    Supported error_type values:

    • validation
    • security
    • file_not_found
    • permission
    • execution
    • unknown
  8. Validate workspace path boundaries with validateWorkspacePath()

    main

    To prevent directory traversal attacks and ensure security, use validateWorkspacePath to verify that a requested filePath resides within the allowed context.workingDirectory.

    It returns a ToolErrorResponse if the path is invalid (e.g., contains .. or is outside the workspace) or null if the path is valid.

  9. Standardize tool responses with ToolResponse types

    main

    When implementing tools, use the standardized response types to ensure consistent communication with the agent. A response must be either a ToolSuccessResponse or a ToolErrorResponse.

    • ToolSuccessResponse: Contains success: true and an object of arbitrary data.
    • ToolErrorResponse: Contains success: false, an error message, an optional error_type, and optional details.
  10. Validate file and directory existence

    main

    Use these helpers to verify filesystem entities before attempting operations:

    • validateFileExists(absolutePath, filePath): Checks if a file exists at the provided absolutePath. Returns a ToolErrorResponse with error_type: 'file_not_found' if missing.
    • validateDirectoryExists(absolutePath, dirPath): Checks if a directory exists at the provided absolutePath. Returns a ToolErrorResponse with error_type: 'file_not_found' if missing, or error_type: 'validation' if the path exists but is not a directory.