Preservation-first scraper for codewiki.google pages.
- Preserve Code Wiki content with minimal loss.
- Render diagrams correctly in Markdown viewers.
- Keep diagram semantics available as text for AI agents.
- Provide a small CLI that is easy to extend.
Code Wiki diagrams are rendered as Graphviz SVG wrapped inside a data URI. Converting them to Mermaid loses structure and labels in many cases, so this project uses a two-track output:
- Exact SVG assets are extracted to an assets directory and linked from the Markdown, so human readers see the real diagram.
- Textual diagram semantics are extracted from the SVG graph structure and embedded into the Markdown for LLM context.
This preserves visual fidelity and gives agents node / edge information without forcing them to parse raw XML.
uv sync
uv run codewiki-scraper scrape https://codewiki.google/github.com/google/filament -o filament_codewiki.mdDefault export flow:
uv run codewiki-scraper scrape https://codewiki.google/github.com/google/filamentThis writes into output/google-filament/.
Compatibility entry point:
python codewiki_scraper.py scrape https://codewiki.google/github.com/google/filament -o filament_codewiki.mdThe scraper writes:
output/<slug>/<slug>.mdoutput/<slug>/<slug>.agent.mdoutput/<slug>/assets/*.svgoutput/<slug>/<slug>.htmloutput/<slug>/metadata.jsonoutput/manifest.jsonfor batch runs
The Markdown includes:
- fenced code blocks for source snippets
- rendered image links for diagrams
- fenced
textblocks with diagram semantics - cleaned HTML snapshot for auditing extraction quality
- metadata for downstream tooling
The companion agent markdown includes:
- the same textual documentation
- code blocks
- diagram semantics
- no rendered image links, which keeps it cleaner for LLM ingestion
codewiki-scraper scrape URL -o OUTPUT.md
codewiki-scraper batch URL1 URL2
codewiki-scraper batch --input-file urls.txtOptions:
--output-dir output- base directory for generated export bundles
--diagram-format svg|mermaidsvgis the default and recommended mode.mermaidis best-effort and may lose detail.
--no-diagram-summary- keep rendered diagrams only
uv sync --group dev
uv run pytestQuality tooling:
uv run ruff check .
uv run ruff format .
uv run ty check --config-file ty.tomlMake targets:
make help
make sync
make check
make fmt
make scrape-samples