agentleFS
pingwurthpingwurth/code-to-uml/CLAUDE.md

code-to-uml

CLAUDE.md0 starsChanged 6 months agoMITView on GitHub

A vanilla JavaScript web application that renders PlantUML diagrams in the browser. No build tools, no package.json, no bundler — plain HTML/CSS/JS served by a lightweight Node.js dev server. Requires Java on PATH for the plantuml.jar fallback rendering endpoint (POST /api/plantuml-svg). Tests use Node's built-in assert/strict — no test framework. Each test/*.test.js file is self-contained. PlantUML diagrams are rendered via a two-tier strategy: The fallback logic lives in component/render-failure-common.js (renderWithFailureHandling). It detects SVG errors, runtime crashes, and timeout conditions, then…

The file

We split this CLAUDE.md into the rules it gives an agent

2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    All components expose their API on window via IIFE.

    line 48
  2. Very specific:

    Default language: Chinese (zh)

    line 87

≈ “Common” is an estimate: at least 1 in 5 of the 29,248 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
CLAUDE.md

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

Project Overview

A vanilla JavaScript web application that renders PlantUML diagrams in the browser. No build tools, no package.json, no bundler — plain HTML/CSS/JS served by a lightweight Node.js dev server.

Running the Server

# Start dev server (default port 5401)
./serve.sh
# or
node serve.js

# Custom port
node serve.js 8080

Requires Java on PATH for the plantuml.jar fallback rendering endpoint (POST /api/plantuml-svg).

Running Tests

# Run all tests
node test/run-all.js

# Run a single test
node test/cache-index-sort.test.js

Tests use Node's built-in assert/strict — no test framework. Each test/*.test.js file is self-contained.

Architecture

Rendering Pipeline

PlantUML diagrams are rendered via a two-tier strategy:

  1. Browser rendering (primary): js/plantuml.js renders PlantUML source to SVG client-side using WebAssembly
  2. Jar fallback (fallback): If browser rendering fails (runtime error, diagram too large), the app calls POST /api/plantuml-svg which spawns java -jar plantuml.jar --svg -pipe server-side

The fallback logic lives in component/render-failure-common.js (renderWithFailureHandling). It detects SVG errors, runtime crashes, and timeout conditions, then automatically retries via the jar endpoint.

Component Modules (IIFE pattern)

All components expose their API on window via IIFE. Load order matters — dependencies must load before dependents:

ModuleGlobalPurpose
js/plantuml.jswindow.plantumlRenderBrowser-side PlantUML renderer
js/viz-global.jsGraphvizGraphviz/Viz.js for certain diagram types
component/docs-page-core.jsPlantUmlDocsCoreCore utilities: source reading, error detection, SVG manipulation, jar fallback HTTP client
component/render-failure-common.jsPlantUmlRenderFailureCommonRender orchestration with automatic fallback
component/demo-example-component.jsPlantUmlDemoExampleCreates example DOM nodes (source editor + preview + actions)
component/toc-component.jsPlantUmlTocSide table-of-contents with scroll-based active tracking
i18n/zh.js, i18n/en.js__DOCS_I18N_ZH__, __DOCS_I18N_EN__Dictionary globals
i18n-config.jsDocsI18ni18n runtime (getMode/setMode/t/apply), dispatches docs:langchange events
demo.js—Main page controller: bootstraps demo, manages tabs, render queue, lightbox

Demo Example Data (.ctu files)

Examples are stored in data/demo/ as .ctu files with bilingual naming: {diagram-type}--{id}_{lang}.ctu

Each .ctu file uses a custom section format:

Title: Section Title
Describe: Section description
------------------------------------------------------------
[Example]
Example title
[Description]
Example description (supports markdown)
[Detail]
Detail text shown below preview
[UML]
@startuml
...PlantUML source...
@enduml

Multiple examples per file are separated by ----- lines. The server parses these in serve.js → parseCtuGroups() and serves them via GET /api/demo-examples?lang=zh|en.

i18n

  • Default language: Chinese (zh)
  • Persisted to localStorage key plantuml-docs-lang
  • Language switch dispatches docs:langchange custom event; components re-render on this event
  • Demo examples are bilingual — each .ctu file exists in both *_zh.ctu and *_en.ctu variants

Lightbox

Clicking a rendered diagram preview opens a full-screen lightbox (demo.js → initPreviewLightbox) with zoom (scroll/pinch), pan (drag), and keyboard (Escape to close) support.

Key Files

  • serve.js — Dev server with static file serving + /api/demo-examples + /api/plantuml-svg endpoints
  • demo.html — Single-page app shell
  • demo.js — Main page controller (tab switching, render queue, lightbox, i18n wiring)
  • main.css — All styles
  • component/docs-page-core.js — Shared rendering utilities and error detection
  • data/demo/*.ctu — Diagram example data files

Conventions

  • Pure vanilla JS — no frameworks, no npm dependencies
  • IIFE module pattern exposing globals on window
  • Strict mode ("use strict") in all files
  • CSS custom properties for theming in main.css
  • Chinese is the primary language; English is secondary

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.