diagram-scribe 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- diagram_scribe-0.1.0/.claude/settings.local.json +112 -0
- diagram_scribe-0.1.0/.env.example +12 -0
- diagram_scribe-0.1.0/.gitattributes +2 -0
- diagram_scribe-0.1.0/.github/workflows/docs.yml +94 -0
- diagram_scribe-0.1.0/.gitignore +22 -0
- diagram_scribe-0.1.0/.specify/specs/001-mermaid-dual-path/plan.md +1328 -0
- diagram_scribe-0.1.0/.specify/specs/001-mermaid-dual-path/spec.md +199 -0
- diagram_scribe-0.1.0/LICENSE +21 -0
- diagram_scribe-0.1.0/PKG-INFO +151 -0
- diagram_scribe-0.1.0/README.md +121 -0
- diagram_scribe-0.1.0/docs/guide.md +401 -0
- diagram_scribe-0.1.0/js/build.js +21 -0
- diagram_scribe-0.1.0/js/index.js +354 -0
- diagram_scribe-0.1.0/js/package-lock.json +2548 -0
- diagram_scribe-0.1.0/js/package.json +14 -0
- diagram_scribe-0.1.0/pyproject.toml +53 -0
- diagram_scribe-0.1.0/src/diagram_scribe/__init__.py +34 -0
- diagram_scribe-0.1.0/src/diagram_scribe/adapters/__init__.py +0 -0
- diagram_scribe-0.1.0/src/diagram_scribe/adapters/backend/__init__.py +0 -0
- diagram_scribe-0.1.0/src/diagram_scribe/adapters/backend/excalidraw.py +288 -0
- diagram_scribe-0.1.0/src/diagram_scribe/adapters/backend/mermaid.py +60 -0
- diagram_scribe-0.1.0/src/diagram_scribe/adapters/llm/__init__.py +0 -0
- diagram_scribe-0.1.0/src/diagram_scribe/adapters/llm/claude.py +53 -0
- diagram_scribe-0.1.0/src/diagram_scribe/adapters/llm/ollama.py +54 -0
- diagram_scribe-0.1.0/src/diagram_scribe/adapters/llm/openrouter.py +57 -0
- diagram_scribe-0.1.0/src/diagram_scribe/cli.py +240 -0
- diagram_scribe-0.1.0/src/diagram_scribe/core.py +113 -0
- diagram_scribe-0.1.0/src/diagram_scribe/js/__init__.py +0 -0
- diagram_scribe-0.1.0/src/diagram_scribe/js/mermaid_to_excalidraw.bundle.js +356115 -0
- diagram_scribe-0.1.0/src/diagram_scribe/js/xhr-sync-worker.js +59 -0
- diagram_scribe-0.1.0/src/diagram_scribe/models.py +59 -0
- diagram_scribe-0.1.0/src/diagram_scribe/prompts.py +217 -0
- diagram_scribe-0.1.0/src/diagram_scribe/protocols.py +61 -0
- diagram_scribe-0.1.0/tests/__init__.py +0 -0
- diagram_scribe-0.1.0/tests/test_claude_adapter.py +64 -0
- diagram_scribe-0.1.0/tests/test_cli.py +349 -0
- diagram_scribe-0.1.0/tests/test_core.py +139 -0
- diagram_scribe-0.1.0/tests/test_env_loading.py +40 -0
- diagram_scribe-0.1.0/tests/test_excalidraw_adapter.py +334 -0
- diagram_scribe-0.1.0/tests/test_integration.py +250 -0
- diagram_scribe-0.1.0/tests/test_mermaid_adapter.py +76 -0
- diagram_scribe-0.1.0/tests/test_models.py +45 -0
- diagram_scribe-0.1.0/tests/test_ollama_adapter.py +69 -0
- diagram_scribe-0.1.0/tests/test_openrouter_adapter.py +85 -0
- diagram_scribe-0.1.0/tests/test_prompts.py +157 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
{
|
|
2
|
+
"permissions": {
|
|
3
|
+
"allow": [
|
|
4
|
+
"Bash(pip3 install *)",
|
|
5
|
+
"Read(//opt/homebrew/bin/**)",
|
|
6
|
+
"Read(//Users/amod/.pyenv/**)",
|
|
7
|
+
"Bash(brew list *)",
|
|
8
|
+
"Read(//Users/amod/miniconda3/**)",
|
|
9
|
+
"Bash(conda info *)",
|
|
10
|
+
"Bash(brew --version)",
|
|
11
|
+
"Bash(brew install *)",
|
|
12
|
+
"Bash(/opt/homebrew/bin/python3.12 --version)",
|
|
13
|
+
"Bash(/opt/homebrew/bin/python3.12 -m venv /tmp/diagram-scribe-test)",
|
|
14
|
+
"Bash(/tmp/diagram-scribe-test/bin/pip install *)",
|
|
15
|
+
"Bash(gh issue *)",
|
|
16
|
+
"Bash(git add *)",
|
|
17
|
+
"Bash(git commit -m ' *)",
|
|
18
|
+
"Bash(/tmp/diagram-scribe-test/bin/pytest tests/ -v --ignore=tests/test_integration.py)",
|
|
19
|
+
"Bash(/tmp/diagram-scribe-test/bin/python3.12 -m pip install -e \".[dev]\" --quiet)",
|
|
20
|
+
"Bash(/opt/homebrew/bin/python3.12 -m venv /tmp/ds-dev)",
|
|
21
|
+
"Bash(/tmp/ds-dev/bin/pip install *)",
|
|
22
|
+
"Bash(grep -qE \"^done$|error\" /private/tmp/claude-501/-Users-amod-personalRepos-diagram-scribe/efd57a6f-a455-4a90-8c7d-f8256b7e8570/tasks/bqz9ffhxg.output)",
|
|
23
|
+
"Bash(/tmp/ds-dev/bin/pytest *)",
|
|
24
|
+
"Bash(OPENROUTER_API_KEY=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 OPENROUTER_MODEL=nvidia/nemotron-3-super-120b-a12b:free /tmp/ds-dev/bin/pytest *)",
|
|
25
|
+
"Bash(git checkout *)",
|
|
26
|
+
"Bash(git commit *)",
|
|
27
|
+
"Bash(git push *)",
|
|
28
|
+
"Bash(gh pr create --title 'fix: OpenRouter end-to-end reliability and test coverage' --body ' *)",
|
|
29
|
+
"Bash(gh pr *)",
|
|
30
|
+
"Bash(git pull *)",
|
|
31
|
+
"Bash(diagram-scribe --version)",
|
|
32
|
+
"Bash(/opt/homebrew/bin/python3.12 -m venv /tmp/ds-test)",
|
|
33
|
+
"Bash(/tmp/ds-test/bin/pip install *)",
|
|
34
|
+
"Bash(ln -sf /tmp/ds-test/bin/diagram-scribe /opt/homebrew/bin/diagram-scribe)",
|
|
35
|
+
"Bash(diagram-scribe --help)",
|
|
36
|
+
"Bash(OPENROUTER_API_KEY=test diagram-scribe)",
|
|
37
|
+
"Bash(ollama list *)",
|
|
38
|
+
"Bash(/tmp/ds-dev/bin/python3.12 *)",
|
|
39
|
+
"Bash(PYTHONPATH=/Users/amod/personalRepos/diagram-scribe/src /tmp/ds-dev/bin/python3.12 *)",
|
|
40
|
+
"Bash(/opt/homebrew/bin/python3.12 -m venv /tmp/ds-dev2)",
|
|
41
|
+
"Bash(/tmp/ds-dev2/bin/pip install *)",
|
|
42
|
+
"Bash(/tmp/ds-dev2/bin/python3.12 *)",
|
|
43
|
+
"Bash(/tmp/ds-dev2/bin/pytest tests/ -v --ignore=tests/test_integration.py)",
|
|
44
|
+
"Bash(git -C /Users/amod/personalRepos/diagram-scribe config user.email \"amod0017@gmail.com\")",
|
|
45
|
+
"Bash(git -C /Users/amod/personalRepos/diagram-scribe config user.name \"Amod\")",
|
|
46
|
+
"Bash(/tmp/ds-dev2/bin/diagram-scribe --type flowchart)",
|
|
47
|
+
"Bash(wait)",
|
|
48
|
+
"Bash(python3 -c ' *)",
|
|
49
|
+
"Bash(git -C /Users/amod/personalRepos/diagram-scribe log --oneline -8)",
|
|
50
|
+
"mcp__claude_ai_Excalidraw__read_me",
|
|
51
|
+
"mcp__claude_ai_Excalidraw__create_view",
|
|
52
|
+
"WebSearch",
|
|
53
|
+
"Bash(gh repo *)",
|
|
54
|
+
"Bash(gh milestone *)",
|
|
55
|
+
"Bash(gh api *)",
|
|
56
|
+
"Bash(python *)",
|
|
57
|
+
"Bash(python3 -m pytest tests/test_models.py::test_mermaid_ir_creation tests/test_models.py::test_mermaid_ir_default_diagram_type -v)",
|
|
58
|
+
"Bash(python3 -c \"import sys; print\\(sys.prefix\\)\")",
|
|
59
|
+
"Bash(python3 -m pytest tests/test_models.py -v)",
|
|
60
|
+
"Bash(pip3 show *)",
|
|
61
|
+
"Bash(pip install *)",
|
|
62
|
+
"Read(//private/tmp/**)",
|
|
63
|
+
"Bash(/tmp/ds-dev2/bin/pytest tests/test_models.py -v)",
|
|
64
|
+
"Bash(/tmp/ds-dev2/bin/pytest *)",
|
|
65
|
+
"Bash(python3 -m pytest tests/test_prompts.py -v)",
|
|
66
|
+
"Bash(python3 -m pip install -e . -q)",
|
|
67
|
+
"Bash(python3 -m pip install --upgrade pip -q)",
|
|
68
|
+
"Bash(python3.11 -m pip install -e /Users/amod/personalRepos/diagram-scribe -q)",
|
|
69
|
+
"Bash(python3.11 -m pytest /Users/amod/personalRepos/diagram-scribe/tests/test_prompts.py -v)",
|
|
70
|
+
"Bash(npm --version)",
|
|
71
|
+
"Bash(npm install *)",
|
|
72
|
+
"Bash(npm run *)",
|
|
73
|
+
"Bash(node /Users/amod/personalRepos/diagram-scribe/src/diagram_scribe/js/mermaid_to_excalidraw.bundle.js)",
|
|
74
|
+
"Bash(python3 -c \"import sys,json; d=json.load\\(sys.stdin\\); print\\('type:', d['type'], '| elements:', len\\(d['elements']\\)\\)\")",
|
|
75
|
+
"Bash(node index.js)",
|
|
76
|
+
"Bash(python3 -c \"import sys,json; d=json.load\\(sys.stdin\\); print\\('OK: type=%s elements=%d' % \\(d['type'], len\\(d['elements']\\)\\)\\)\")",
|
|
77
|
+
"Bash(python3 -c \"import sys,json; d=json.load\\(sys.stdin\\); print\\('OK type=%s elements=%d' % \\(d['type'], len\\(d['elements']\\)\\)\\)\")",
|
|
78
|
+
"Bash(python3 *)",
|
|
79
|
+
"Bash(python3.11 *)",
|
|
80
|
+
"Bash(/opt/homebrew/bin/diagram-scribe)",
|
|
81
|
+
"Bash(node build.js)",
|
|
82
|
+
"Bash(node *)",
|
|
83
|
+
"Bash(awk '{print $5, $6, $7, $8}')",
|
|
84
|
+
"Bash(/opt/homebrew/bin/diagram-scribe --output /tmp/test_overlap.excalidraw)",
|
|
85
|
+
"Bash(/opt/homebrew/bin/diagram-scribe --output /tmp/test_ecom.excalidraw)",
|
|
86
|
+
"Bash(pip3.11 show *)",
|
|
87
|
+
"Bash(pip show *)",
|
|
88
|
+
"Bash(pip3.11 install *)",
|
|
89
|
+
"Bash(/opt/homebrew/opt/python@3.11/bin/python3.11 -m pytest /Users/amod/personalRepos/diagram-scribe/tests/test_integration.py -m integration -k \"mermaid\" -v)",
|
|
90
|
+
"Bash(/opt/homebrew/bin/diagram-scribe --output /tmp/manual_test.excalidraw)",
|
|
91
|
+
"Bash(python3.9 *)",
|
|
92
|
+
"Bash(/opt/homebrew/bin/diagram-scribe --output ~/Downloads/login_sequence.excalidraw)",
|
|
93
|
+
"Bash(grep -v \"Use \\\\`node\")",
|
|
94
|
+
"Bash(/opt/homebrew/opt/python@3.11/bin/python3.11 *)",
|
|
95
|
+
"Bash(/opt/homebrew/bin/diagram-scribe --output ~/Downloads/bpmn_invoice.excalidraw)",
|
|
96
|
+
"Bash(/opt/homebrew/bin/diagram-scribe --output ~/Downloads/social_network.excalidraw)",
|
|
97
|
+
"Bash(gh run *)",
|
|
98
|
+
"Bash(pytest *)",
|
|
99
|
+
"Bash(curl -s \"http://127.0.0.1:64300/\")",
|
|
100
|
+
"Bash(curl -sI \"https://unpkg.com/@excalidraw/excalidraw/dist/excalidraw.production.min.js\")",
|
|
101
|
+
"Bash(curl -sI \"https://unpkg.com/@excalidraw/excalidraw@0.18.1/dist/excalidraw.production.min.js\")",
|
|
102
|
+
"Bash(curl -s \"https://unpkg.com/@excalidraw/excalidraw@0.18.1/dist/excalidraw.production.min.js\")",
|
|
103
|
+
"Bash(curl -s \"https://unpkg.com/@excalidraw/excalidraw@0.18.1/?meta\")",
|
|
104
|
+
"Bash(curl -s \"https://unpkg.com/@excalidraw/excalidraw@0.18.1/dist/prod/index.js\")",
|
|
105
|
+
"Bash(curl -sI \"https://esm.sh/@excalidraw/excalidraw\")",
|
|
106
|
+
"Bash(curl -s \"https://esm.sh/@excalidraw/excalidraw@0.18.1/es2022/excalidraw.mjs\")",
|
|
107
|
+
"Bash(curl -sI \"https://esm.sh/@excalidraw/excalidraw@0.18.1/excalidraw.css\")",
|
|
108
|
+
"Bash(curl -sI \"https://esm.sh/@excalidraw/excalidraw@0.18.1?css\")",
|
|
109
|
+
"Bash(PYTHONPATH=src python3.11 -m diagram_scribe.cli)"
|
|
110
|
+
]
|
|
111
|
+
}
|
|
112
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Copy this file to .env and fill in your keys.
|
|
2
|
+
# diagram-scribe reads this file automatically on startup.
|
|
3
|
+
|
|
4
|
+
# Option 1: Claude (paid, best quality)
|
|
5
|
+
ANTHROPIC_API_KEY=your-anthropic-api-key-here
|
|
6
|
+
|
|
7
|
+
# Option 2: OpenRouter (free tier available)
|
|
8
|
+
# OPENROUTER_API_KEY=your-openrouter-api-key-here
|
|
9
|
+
# OPENROUTER_MODEL=meta-llama/llama-3.1-8b-instruct:free
|
|
10
|
+
|
|
11
|
+
# Option 3: Ollama (fully local, no account needed)
|
|
12
|
+
# OLLAMA_MODEL=qwen2.5
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
name: Deploy API docs to GitHub Pages
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
pages: write
|
|
11
|
+
id-token: write
|
|
12
|
+
|
|
13
|
+
concurrency:
|
|
14
|
+
group: pages
|
|
15
|
+
cancel-in-progress: true
|
|
16
|
+
|
|
17
|
+
jobs:
|
|
18
|
+
deploy:
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
environment:
|
|
21
|
+
name: github-pages
|
|
22
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
|
23
|
+
steps:
|
|
24
|
+
- uses: actions/checkout@v4
|
|
25
|
+
|
|
26
|
+
- uses: actions/setup-python@v5
|
|
27
|
+
with:
|
|
28
|
+
python-version: "3.11"
|
|
29
|
+
|
|
30
|
+
- name: Install package and pdoc
|
|
31
|
+
run: pip install -e ".[dev]"
|
|
32
|
+
|
|
33
|
+
- name: Generate API docs
|
|
34
|
+
run: pdoc src/diagram_scribe -o _site
|
|
35
|
+
|
|
36
|
+
- name: Add User Guide to site
|
|
37
|
+
run: |
|
|
38
|
+
python - <<'EOF'
|
|
39
|
+
import markdown, re
|
|
40
|
+
from pathlib import Path
|
|
41
|
+
|
|
42
|
+
md_text = Path("docs/guide.md").read_text(encoding="utf-8")
|
|
43
|
+
body = markdown.markdown(md_text, extensions=["fenced_code", "tables", "toc"])
|
|
44
|
+
|
|
45
|
+
ref_files = sorted(Path("_site").rglob("*.html"))
|
|
46
|
+
styles = ""
|
|
47
|
+
if ref_files:
|
|
48
|
+
ref_html = ref_files[0].read_text(encoding="utf-8")
|
|
49
|
+
styles = "".join(re.findall(r"<style[^>]*>.*?</style>", ref_html, re.DOTALL))
|
|
50
|
+
|
|
51
|
+
guide_page = """<!doctype html>
|
|
52
|
+
<html lang="en">
|
|
53
|
+
<head>
|
|
54
|
+
<meta charset="utf-8">
|
|
55
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
56
|
+
<title>User Guide - DiagramScribe</title>
|
|
57
|
+
""" + styles + """
|
|
58
|
+
</head>
|
|
59
|
+
<body>
|
|
60
|
+
<nav class="pdoc">
|
|
61
|
+
<div>
|
|
62
|
+
<h2>DiagramScribe</h2>
|
|
63
|
+
<p><a href="diagram_scribe.html">API Reference</a></p>
|
|
64
|
+
</div>
|
|
65
|
+
</nav>
|
|
66
|
+
<main class="pdoc">
|
|
67
|
+
""" + body + """
|
|
68
|
+
</main>
|
|
69
|
+
</body>
|
|
70
|
+
</html>"""
|
|
71
|
+
Path("_site/guide.html").write_text(guide_page, encoding="utf-8")
|
|
72
|
+
|
|
73
|
+
nav_link = '\n<p><a href="guide.html">User Guide</a></p>\n'
|
|
74
|
+
for f in sorted(Path("_site").rglob("*.html")):
|
|
75
|
+
if f.name == "guide.html":
|
|
76
|
+
continue
|
|
77
|
+
text = f.read_text(encoding="utf-8")
|
|
78
|
+
new_text, n = re.subn(
|
|
79
|
+
r'(<nav class="pdoc">.*?<div>)',
|
|
80
|
+
r'\1' + nav_link,
|
|
81
|
+
text, count=1, flags=re.DOTALL
|
|
82
|
+
)
|
|
83
|
+
if n:
|
|
84
|
+
f.write_text(new_text, encoding="utf-8")
|
|
85
|
+
EOF
|
|
86
|
+
|
|
87
|
+
- uses: actions/configure-pages@v4
|
|
88
|
+
|
|
89
|
+
- uses: actions/upload-pages-artifact@v3
|
|
90
|
+
with:
|
|
91
|
+
path: _site
|
|
92
|
+
|
|
93
|
+
- uses: actions/deploy-pages@v4
|
|
94
|
+
id: deployment
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Internal planning docs — not for public repo
|
|
2
|
+
docs/specs/
|
|
3
|
+
docs/superpowers/
|
|
4
|
+
|
|
5
|
+
# Python
|
|
6
|
+
__pycache__/
|
|
7
|
+
*.py[cod]
|
|
8
|
+
*.egg-info/
|
|
9
|
+
dist/
|
|
10
|
+
build/
|
|
11
|
+
.venv/
|
|
12
|
+
venv/
|
|
13
|
+
.env
|
|
14
|
+
.pytest_cache/
|
|
15
|
+
|
|
16
|
+
# Generated docs
|
|
17
|
+
_site/
|
|
18
|
+
|
|
19
|
+
# IDE
|
|
20
|
+
.vscode/
|
|
21
|
+
.idea/
|
|
22
|
+
js/node_modules/
|