

Also from Kynth Studios


Also from Kynth Studios


Also from Kynth Studios
1# CLAUDE.md - AI Assistant Guide for draw.io Desktop23## Project Overview45Draw.io Desktop is an Electron-based desktop application that wraps the core draw.io diagramming editor (included as a git submodule). It enables creating flowcharts, UML diagrams, and more, with a security-first design that isolates diagram data from the internet.67**Repository:** https://github.com/jgraph/drawio-desktop8**License:** Apache 2.09**Version:** see `drawio/VERSION` (stamped into `package.json` by `npm run sync`)1011## Quick Reference1213```bash14# Clone (MUST be recursive for submodule)15git clone --recursive https://github.com/jgraph/drawio-desktop.git1617# Install dependencies18npm install1920# Run application21npm start2223# Run with DevTools enabled24DRAWIO_ENV=dev npm start2526# Sync version before building (required)27npm run sync2829# Build for specific platforms30npm run release-win # Windows x6431npm run release-linux # Linux (AppImage, deb, rpm)32npm run release-appx # Windows Store33```3435## Project Structure3637```38drawio-desktop/39├── src/main/40│ ├── electron.js # Main Electron process (3,700+ lines)41│ ├── electron-preload.js # IPC bridge with contextBridge42│ ├── args.js # CLI argument definitions and parser43│ ├── progress-bar.js # Progress bar for long-running operations44│ └── disableUpdate.js # Generated by sync script45├── src/test/46│ ├── cli-args.test.js # CLI argument parsing tests (npm test)47│ └── msi-project-created.test.js # MSI shortcut icon hook tests (npm test)48├── drawio/ # Git submodule - core draw.io editor49│ └── src/main/webapp/ # Web application loaded in Electron50├── build/ # Build resources51│ ├── notarize.mjs # macOS Quick Look setup, signing + notarization52│ ├── sign-trusted.mjs # Windows signing hook (Azure Trusted Signing)53│ ├── fuses.mjs # Electron security fuses54│ ├── msi-project-created.mjs # msiProjectCreated hook: MSI shortcuts use exe icon, not the C:\Windows\Installer icon cache55│ ├── dmg-hidden-files.mjs # beforePack hook: parks hidden DMG support files outside the installer window56│ ├── quicklook-preview.html # Quick Look preview page (viewer-static.min.js)57│ ├── quicklook-entitlements.plist # Sandbox entitlements for .appex58│ └── entitlements.mac.plist59├── doc/60│ ├── RELEASE_PROCESS.md # Release workflow documentation61│ └── BUILDING_FOR_PERSONAL_USE.md # Guide for unsigned fork/personal builds62├── electron-builder-*.json # Platform-specific build configs63├── sync.cjs # Version sync script64└── package.json65```6667## Tech Stack6869- **Runtime:** Node.js 22.12+ (`engines` in `package.json`; CI builds on Node 24)70- **Framework:** Electron (version pinned in `package.json`)71- **Language:** JavaScript (ES6 modules)72- **Build Tool:** electron-builder73- **Package Manager:** npm7475## Key Files7677| File | Purpose |78|------|---------|79| `src/main/electron.js` | Main process: window management, IPC handlers, menus, auto-update |80| `src/main/electron-preload.js` | Secure IPC bridge between renderer and main process |81| `src/main/args.js` | CLI option definitions and argument parser (used by CLI export) |82| `sync.cjs` | Pre-build script that syncs version from `drawio/VERSION` |83| `electron-builder-*.json` | Platform-specific build configurations |84| `build/sign-trusted.mjs` | electron-builder Windows signing hook (Azure Trusted Signing) |8586## Code Style8788- **ES6 modules** with `import`/`export`89- **Tab indentation**90- **Allman brace style** (opening brace on new line)91- **camelCase** for variables, **PascalCase** for classes92- No ESLint/Prettier - manual style consistency93- Sparse comments; code clarity preferred9495## Git Conventions9697### Branches98- `dev` - Main development branch (PR target)99- `release` - Production releases100- `releases/v*.*.*` - Version-specific release branches101102### Commit Messages103- Lowercase sentence style without period104- Issue references: `[jgraph/drawio-desktop#XXXX]`105- Examples:106 - `Fixes paste error`107 - `Adds buffer as dependency [jgraph/drawio-desktop#2301]`108 - `Prepare release v29.3.0`109110### Version Tags111Format: `v{MAJOR}.{MINOR}.{PATCH}` (e.g., `v29.3.0`)112Tags trigger CI/CD build workflows.113114## Build Process1151161. **Sync version:** `npm run sync` reads `drawio/VERSION` and updates `package.json`1172. **Install:** `npm ci` for clean install1183. **Build:** `electron-builder` with platform-specific config1194. **Post-build:** Security fuses applied, Quick Look extension assembled (macOS), notarization (macOS)120121### Code Signing122- **Windows:** Azure Trusted Signing via the `signtoolOptions.sign` hook `build/sign-trusted.mjs` (configured in `electron-builder-win*.json`, not CSC_LINK certificates). CI (`electron-builder-win.yml`) downloads the signing dlib, locates `signtool.exe`, and authenticates with `AZURE_TENANT_ID`/`AZURE_CLIENT_ID`/`AZURE_CLIENT_SECRET` secrets123- **macOS:** Apple Developer certificate + notarization in `build/notarize.mjs`124- **Unsigned builds:** `DRAWIO_UNSIGNED=true` skips signing (Windows) and notarization (macOS) for personal/fork builds125126### Personal / Fork Builds127- `doc/BUILDING_FOR_PERSONAL_USE.md` documents building unsigned from a fork (the project is closed to contributions but Apache 2.0 licensed)128- Set `DRAWIO_UNSIGNED=true` and run `electron-builder` directly with `--publish never`; use `npm run sync -- disableUpdate` so auto-update doesn't replace the custom build129- `.github/workflows/personal-build.yml` is a manual (`workflow_dispatch`) workflow that builds unsigned installers on a fork with no secrets and attaches them as run artifacts130131> **CI override:** The release build workflows check out the private `jgraph/drawio-dev` repo at its `release` branch, copy the built `*.min.js` **and** `VERSION` into the public `drawio/` submodule tree, then run `npm run sync` as normal. This lets CI ship from an internal release that is ahead of the public `drawio` tag without any change to `sync.cjs`. Out-of-tree builders (who have no access to `drawio-dev`) fall through to the public submodule's `VERSION` as before.132133### Platform Build Commands134| Command | Target |135|---------|--------|136| `npm run release-win` | Windows x64 (NSIS + MSI) |137| `npm run release-win32` | Windows 32-bit |138| `npm run release-win-arm64` | Windows ARM64 |139| `npm run release-linux` | Linux (AppImage, deb, rpm) |140| `npm run release-appx` | Windows Store |141| `npm run release-snap` | Snap package |142143## Architecture Notes144145### Security Model146- **Content Security Policy** prevents remote script execution147- **contextBridge** exposes only specific APIs to renderer148- **validateSender()** ensures IPC calls originate from local draw.io149- No external transmission of diagram data150- **Built-in plugins only** - external/third-party plugins were removed (07/2026). The `isPluginsEnabled` IPC action is retained, hardcoded `false`, so an older bundled webapp degrades to the "plugins disabled" dialog rather than failing151152### IPC Pattern153The preload script uses a request/response pattern with unique IDs:154```javascript155// Renderer sends request156electron.request({action: 'save', data: ...}, callbackId);157158// Main process handles and responds via IPC159ipcMain.on('request', (e, data) => { ... });160```161162### macOS Quick Look Preview163- Pressing Space in Finder shows a rendered preview of `.drawio` files164- Uses `quicklookjs` to embed a Quick Look App Extension (`.appex`) in the app bundle165- The `.appex` loads `viewer-static.min.js` (with embedded shapes) in a WKWebView166- **Build flow:** `afterPack` (fuses.mjs) applies security fuses, then `afterSign` (notarize.mjs) assembles the `.appex`, signs it with sandbox entitlements, re-signs the outer `.app`, and notarizes167- The `.appex` is inserted in `afterSign` (not `afterPack`) so it is never present unsigned during electron-builder's signing verification168- Quick Look extensions require `app-sandbox`, but Electron helpers must not be sandboxed — so the `.appex` gets different entitlements than `entitlementsInherit`169- The UTI `com.jgraph.drawio` is declared via `extendInfo` in `electron-builder-linux-mac.json`170- `viewer-static.min.js` is saved to `build/` during CI before the cleanup step removes it from the drawio submodule; for local dev, it's read from the submodule directly171172### Auto-Update173- Checks GitHub releases on startup174- Disable via `DRAWIO_DISABLE_UPDATE=true` or `--disable-update` flag175- Flatpak detection disables updates automatically176177### Data Storage178- **macOS:** `~/Library/Application Support/draw.io`179- **Windows:** `%APPDATA%\draw.io\`180- Uses `electron-store` for persistent settings181182## Testing183184`npm test` runs the unit tests in `src/test/` (CLI argument parsing, MSI shortcut icon hook; Node's built-in test runner). Everything else is manual testing, documented in `doc/RELEASE_PROCESS.md`:185- Launch, create diagram, add shapes, save, open186- Export (PNG, PDF, SVG)187- Undo/redo functionality188- About dialog verification189190## CI/CD Workflows191192| Workflow | Trigger | Purpose |193|----------|---------|---------|194| `electron-builder.yml` | Version tag | macOS/Linux builds |195| `electron-builder-win.yml` | Version tag | Windows builds (Azure Trusted Signing) |196| `prepare-release.yml` | Manual | Automated release prep |197| `hash-gen.yml` | Manual | Generate checksums |198| `personal-build.yml` | Manual | Unsigned fork builds, artifacts only (no secrets, no publish) |199| `stale.yml` | Schedule | Mark stale issues/PRs |200201## Important Constraints2022031. **Recursive clone required** - drawio submodule must be initialized2042. **Run `npm run sync` before building** - Updates version from submodule2053. **Version source of truth** - `drawio/VERSION` for public builds; `drawio-dev/VERSION` is copied over `drawio/VERSION` at CI time so the internal release number wins for packaged builds2064. **Closed to contributions** - PRs not accepted; maintained by JGraph (forks for personal use are fine, see `doc/BUILDING_FOR_PERSONAL_USE.md`)2075. **Node 22.12+ required** - see `engines` in `package.json`208209## Development Tips210211- Set `DRAWIO_ENV=dev` to auto-open DevTools212- Use `npm start --enable-logging` for verbose output213- If using symlink instead of submodule, also symlink `node_modules`214- Main process logs to console; check terminal for errors215216## Key Dependencies217218| Package | Purpose |219|---------|---------|220| `electron` | Desktop app framework |221| `electron-builder` | Build/package tool |222| `electron-updater` | Auto-update mechanism |223| `electron-store` | Persistent storage |224| `electron-log` | Logging |225| `@cantoo/pdf-lib` | PDF export |226| `quicklookjs` | macOS Quick Look preview extension (dev) |227228CLI argument parsing is hand-rolled in `src/main/args.js` (no `commander`).229
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| bagisto/bagistoCLAUDE.md · 28k | CLAUDE.md | setupbuildteststyle+5 | 100/100 | 7 days ago | |
| Adit-Jain-srm/NightmareNetCLAUDE.md · 46 | CLAUDE.md | buildtestlint-formatstyle+6 | 100/100 | 14 days ago | |
| nimbalyst/nimbalystpackages/android/CLAUDE.md · 1.5k | CLAUDE.md | setupbuildstylearch+2 | 100/100 | 14 days ago | |
| microsoft/playwrightCLAUDE.md · 95k | CLAUDE.md | buildtestlint-formatstyle+7 | 100/100 | 7 days ago | |
| tphakala/birdnet-goCLAUDE.md · 1.6k | CLAUDE.md | buildtestlint-formatstyle+8 | 100/100 | today | |
| dotCMS/corecore-web/CLAUDE.md · 949 | CLAUDE.md | teststylearchtesting-strategy+3 | 100/100 | 14 days ago | |
| tyrchen/geektime-bootcamp-aiw7/genslides/backend/CLAUDE.md · 230 | CLAUDE.md | testlint-formatstylearch+6 | 100/100 | 9 days ago | |
| livewire/livewireCLAUDE.md · 24k | CLAUDE.md | setupbuildteststyle+4 | 100/100 | 14 days ago |
A badge carrying the measured quality of the strongest agent config file in this repository, out of 100. It reads from this index every time somebody loads your page, so it changes when the measurement changes and there is nothing to keep up to date. Free, no account, and the value is not something you or we can set by hand.
[](https://rulestack.kynth.studio/configs/jgraph-drawio-desktop-claude)Would rather not hotlink us? Every badge is also served in shields.io’s endpoint schema, so shields renders the image and your readers never talk to our domain:
Published by Toolproof, the masthead over this index and eight others. The method behind the number is at toolproof.kynth.studio/methodology, and the whole thing is readable as JSON with no key at /api.