AI-enhanced diagram and artifact editor
Go to file
rob 6ccdd84835 Initial scaffold for artifact-editor project 2025-12-18 22:06:34 -04:00
src/artifact_editor Initial scaffold for artifact-editor project 2025-12-18 22:06:34 -04:00
README.md Initial scaffold for artifact-editor project 2025-12-18 22:06:34 -04:00
pyproject.toml Initial scaffold for artifact-editor project 2025-12-18 22:06:34 -04:00

README.md

Artifact Editor

AI-enhanced editor for creating diagrams, sketches, 3D models, and other artifacts from code.

A standalone editor that can be launched from any application to create visual artifacts. Designed to integrate with discussion tools, documentation systems, and IDEs.

Vision

Enable users to create rich visual artifacts through multiple input methods:

  • Code editing - Write Mermaid, PlantUML, OpenSCAD, SVG directly
  • Graphical interface - Drag-and-drop, visual editing
  • Voice input - Describe what you want, AI generates the code
  • AI assistance - "Add a database to this diagram", "Make the cube hollow"

Supported Artifact Types

Type Description Output Formats
mermaid Flowcharts, sequence, ER, state diagrams SVG, PNG, PDF
plantuml UML diagrams (class, sequence, etc.) SVG, PNG
openscad 3D parametric CAD models STL, PNG, SVG
solidpython Python-based 3D CAD (via SolidPython) STL, PNG, SCAD
svg Raw SVG vector graphics SVG
asciiart ASCII/Unicode box drawing TXT, PNG
excalidraw Hand-drawn style diagrams SVG, PNG
code Syntax-highlighted code snippets SVG, PNG, HTML

Installation

pip install artifact-editor

# Optional renderers
npm install -g @mermaid-js/mermaid-cli  # For Mermaid
sudo apt install openscad               # For 3D CAD
pip install solidpython2                # For SolidPython

Usage

As a Standalone Editor

# Launch editor for a new Mermaid diagram
artifact-editor --type mermaid --output diagram.svg

# Edit an existing artifact
artifact-editor --type openscad --output model.stl --initial-file model.scad

# Headless AI generation
artifact-editor --type mermaid --output flow.svg --headless \
    --prompt "Create a flowchart for user authentication"

Integration with Other Applications

The editor follows a simple contract for integration:

# Launch
artifact-editor --type TYPE --output /path/to/output.svg [--project NAME]

# Exit behavior:
# - Exit code 0: Saved successfully
#   stdout: "ARTIFACT_SAVED:/path/to/output.svg"
#
# - Exit code 1: Cancelled by user
#   (no output)
#
# - Exit code 2: Error
#   stderr: error message

Example integration (Python):

import subprocess

result = subprocess.run([
    "artifact-editor",
    "--type", "mermaid",
    "--output", "/tmp/diagram.svg",
    "--project", "my-project"
], capture_output=True, text=True)

if result.returncode == 0:
    # Parse output to get file path
    for line in result.stdout.split('\n'):
        if line.startswith("ARTIFACT_SAVED:"):
            artifact_path = line.split(":", 1)[1]
            print(f"Created: {artifact_path}")

Architecture

artifact-editor/
├── src/artifact_editor/
│   ├── cli.py              # CLI entry point
│   ├── editor.py           # TUI editor (urwid-based)
│   ├── ai_assist.py        # AI generation/modification
│   ├── renderers/          # Convert source to visual output
│   │   ├── mermaid.py
│   │   ├── plantuml.py
│   │   ├── openscad.py
│   │   ├── svg.py
│   │   └── ...
│   └── ui/                 # UI components
│       ├── code_editor.py
│       ├── preview.py
│       └── ai_panel.py

Roadmap

  • Basic TUI with code editor and preview
  • Mermaid renderer
  • OpenSCAD/SolidPython renderer
  • AI assistance integration (via SmartTools)
  • Voice input (via SmartTools dictate)
  • PlantUML renderer
  • SVG direct editing
  • Excalidraw-style sketching
  • Plugin system for custom renderers

Integration Goals

This editor is designed to integrate with:

  • orchestrated-discussions - Add artifacts to discussion comments
  • Documentation systems - Embed diagrams in docs
  • IDEs - Quick diagram creation from code
  • Chat applications - Share visual explanations

License

MIT