{"_id":"@de-otio/diagram-drc","_rev":"3-680eda7e4f463e337278056dee56976d","name":"@de-otio/diagram-drc","dist-tags":{"latest":"0.1.5"},"versions":{"0.1.1":{"name":"@de-otio/diagram-drc","version":"0.1.1","keywords":["diagram","drc","layout","drawio","mxgraph","dagre","graph","design-rule-check"],"author":{"name":"de-otio"},"license":"MIT","_id":"@de-otio/diagram-drc@0.1.1","maintainers":[{"name":"rkm1","email":"richard.myers@de-otio.org"}],"homepage":"https://github.com/de-otio/diagram-drc#readme","bugs":{"url":"https://github.com/de-otio/diagram-drc/issues"},"dist":{"shasum":"c0f97592dc19d6c5e3ca02e69cbf51cef63bfab5","tarball":"https://registry.npmjs.org/@de-otio/diagram-drc/-/diagram-drc-0.1.1.tgz","fileCount":51,"integrity":"sha512-mu7w7rTvCFf0uFTFxK/dZra2CAwvPjr4hgRyvVHajdCOWo1NasxA8zw8Xt2jRqRGF5Zxon6rdT6Ucn15+TEuXg==","signatures":[{"sig":"MEQCIFBt8sVELBPwbOMQ0/QuQ4K0dZqNWISIC0VFKNymLVpdAiB7j0IdLMKm7rWSG81BlmdsXRBu4ZdgU67ZjhnQjVDxRA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":88756},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=20"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./rules":{"types":"./dist/rules/index.d.ts","import":"./dist/rules/index.js"},"./layout":{"types":"./dist/layout/index.d.ts","import":"./dist/layout/index.js"},"./render":{"types":"./dist/render/index.d.ts","import":"./dist/render/index.js"}},"gitHead":"ffe0bd97636800d1aa67dc7abef6054e81c53d53","scripts":{"test":"node --experimental-vm-modules node_modules/.bin/jest","build":"tsc","typecheck":"tsc --noEmit","test:coverage":"node --experimental-vm-modules node_modules/.bin/jest --coverage","prepublishOnly":"npm run build"},"_npmUser":{"name":"rkm1","email":"richard.myers@de-otio.org"},"repository":{"url":"git+https://github.com/de-otio/diagram-drc.git","type":"git"},"_npmVersion":"11.9.0","description":"Design Rule Check engine for auto-generated diagrams","directories":{},"_nodeVersion":"25.6.1","dependencies":{"@dagrejs/dagre":"^1.1.4"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","ts-jest":"^29.2.0","ts-node":"^10.9.2","typescript":"^5.7.0","@types/jest":"^29.5.0","@types/node":"^22.0.0"},"_npmOperationalInternal":{"tmp":"tmp/diagram-drc_0.1.1_1775832419902_0.038012926827775795","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@de-otio/diagram-drc","version":"0.1.2","keywords":["diagram","drc","layout","drawio","mxgraph","dagre","graph","design-rule-check"],"author":{"name":"de-otio"},"license":"MIT","_id":"@de-otio/diagram-drc@0.1.2","maintainers":[{"name":"rkm1","email":"richard.myers@de-otio.org"}],"homepage":"https://github.com/de-otio/diagram-drc#readme","bugs":{"url":"https://github.com/de-otio/diagram-drc/issues"},"dist":{"shasum":"026178b23ac37d8ddf586fc28c5e0d3e30bfc904","tarball":"https://registry.npmjs.org/@de-otio/diagram-drc/-/diagram-drc-0.1.2.tgz","fileCount":55,"integrity":"sha512-62mxt/jTTdS8n1K7W2u4p6xSF5YfuEwWxaTKB261w9uw2u0fEIcA1kcnstUKfjpbu2heMM82mRWUYkTlS3b2Hw==","signatures":[{"sig":"MEYCIQD+Wv26jOkKcJOiL1nA4BibLpzN2Ea/iES232quXj6/4wIhAK48/I7KraVyrvRsi/gbyH8wV6Mfjey1SNwrl848a8mg","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@de-otio%2fdiagram-drc@0.1.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":96566},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=20"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./rules":{"types":"./dist/rules/index.d.ts","import":"./dist/rules/index.js"},"./layout":{"types":"./dist/layout/index.d.ts","import":"./dist/layout/index.js"},"./render":{"types":"./dist/render/index.d.ts","import":"./dist/render/index.js"}},"gitHead":"4655841cbedf72be389d54248ca348e595192f38","scripts":{"test":"node --experimental-vm-modules node_modules/.bin/jest","build":"tsc","typecheck":"tsc --noEmit","test:coverage":"node --experimental-vm-modules node_modules/.bin/jest --coverage","prepublishOnly":"npm run build"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:5b69f096-536b-43e2-b97c-951a361e8ff9"}},"repository":{"url":"git+https://github.com/de-otio/diagram-drc.git","type":"git"},"_npmVersion":"11.12.1","description":"Design Rule Check engine for auto-generated diagrams","directories":{},"_nodeVersion":"22.22.2","dependencies":{"@dagrejs/dagre":"^1.1.4"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","ts-jest":"^29.2.0","ts-node":"^10.9.2","typescript":"^5.7.0","@types/jest":"^29.5.0","@types/node":"^22.0.0"},"_npmOperationalInternal":{"tmp":"tmp/diagram-drc_0.1.2_1775833399881_0.3009521525905048","host":"s3://npm-registry-packages-npm-production"}},"0.1.5":{"name":"@de-otio/diagram-drc","version":"0.1.5","description":"Design Rule Check engine for auto-generated diagrams","type":"module","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./rules":{"types":"./dist/rules/index.d.ts","import":"./dist/rules/index.js"},"./layout":{"types":"./dist/layout/index.d.ts","import":"./dist/layout/index.js"},"./render":{"types":"./dist/render/index.d.ts","import":"./dist/render/index.js"}},"main":"./dist/index.js","types":"./dist/index.d.ts","scripts":{"build":"tsc","test":"node --experimental-vm-modules node_modules/.bin/jest","test:coverage":"node --experimental-vm-modules node_modules/.bin/jest --coverage","typecheck":"tsc --noEmit","prepublishOnly":"npm run build"},"engines":{"node":">=20"},"repository":{"type":"git","url":"git+https://github.com/de-otio/diagram-drc.git"},"keywords":["diagram","drc","layout","drawio","mxgraph","dagre","graph","design-rule-check"],"author":{"name":"de-otio"},"license":"MIT","bugs":{"url":"https://github.com/de-otio/diagram-drc/issues"},"homepage":"https://github.com/de-otio/diagram-drc#readme","dependencies":{"@dagrejs/dagre":"^1.1.4"},"devDependencies":{"@types/jest":"^29.5.0","@types/node":"^22.0.0","jest":"^29.7.0","ts-jest":"^29.2.0","ts-node":"^10.9.2","typescript":"^5.7.0"},"gitHead":"3086a80eb26bc7d734dd4bece746dde872dfa77e","_id":"@de-otio/diagram-drc@0.1.5","_nodeVersion":"22.22.2","_npmVersion":"11.12.1","dist":{"integrity":"sha512-jgeVG4CmC259OeAjfp7+aPY7q9UfCezJHOQcYrL+NZQEsIgE0/JAWRNuHKjUnsxgUQwKjEmNBlpl7YRzaDgC6Q==","shasum":"b488a63a22e68875df41b64ac3d6b487ff7941b6","tarball":"https://registry.npmjs.org/@de-otio/diagram-drc/-/diagram-drc-0.1.5.tgz","fileCount":83,"unpackedSize":218928,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@de-otio%2fdiagram-drc@0.1.5","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCpWWNRgAOOf+B2ZTaf9XlIH2B8LZ12YlnaTGMEJH6DEgIhAM7I2qKM2pRGnXfFm/Z/z0pP91VaRDrUSES1pv8kz0dT"}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:5b69f096-536b-43e2-b97c-951a361e8ff9"}},"directories":{},"maintainers":[{"name":"rkm1","email":"richard.myers@de-otio.org"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/diagram-drc_0.1.5_1776310262322_0.3198296030628265"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-10T14:46:59.726Z","modified":"2026-04-16T03:31:02.984Z","0.1.1":"2026-04-10T14:47:00.049Z","0.1.2":"2026-04-10T15:03:20.018Z","0.1.5":"2026-04-16T03:31:02.477Z"},"bugs":{"url":"https://github.com/de-otio/diagram-drc/issues"},"author":{"name":"de-otio"},"license":"MIT","homepage":"https://github.com/de-otio/diagram-drc#readme","keywords":["diagram","drc","layout","drawio","mxgraph","dagre","graph","design-rule-check"],"repository":{"type":"git","url":"git+https://github.com/de-otio/diagram-drc.git"},"description":"Design Rule Check engine for auto-generated diagrams","maintainers":[{"name":"rkm1","email":"richard.myers@de-otio.org"}],"readme":"# diagram-drc\n\nDesign Rule Check engine for auto-generated diagrams.\n\nJust as IC layout tools run DRC to catch spacing violations and routing issues in silicon, `diagram-drc` runs quality checks on graph layouts and can auto-fix violations.\n\n## Features\n\n- **Check mode** — detect layout quality issues without modifying the diagram\n- **Fix mode** — automatically resolve violations (crossing minimization, spacing, etc.)\n- **Pluggable rules** — built-in rules for common issues, easy to add your own\n- **Format-agnostic core** — works with any graph representation\n- **draw.io renderer** — render layouts to mxGraph XML (draw.io format)\n- **Dagre layout** — built-in wrapper for the Dagre directed graph layout engine\n\n## Quick start\n\n```bash\nnpm install diagram-drc\n```\n\n```typescript\nimport { createEngine, builtinRules, dagreLayout, renderMxGraph } from 'diagram-drc';\n\n// Define your graph\nconst spec = {\n  nodes: [\n    { id: 'a', label: 'Service A', width: 48, height: 48 },\n    { id: 'b', label: 'Service B', width: 48, height: 48 },\n    { id: 'c', label: 'Database',  width: 48, height: 48 },\n  ],\n  edges: [\n    { id: 'e1', source: 'a', target: 'c' },\n    { id: 'e2', source: 'b', target: 'c' },\n  ],\n  groups: [\n    { id: 'g1', label: 'Backend', children: ['a', 'b'] },\n    { id: 'g2', label: 'Data',    children: ['c'] },\n  ],\n};\n\n// Layout with Dagre\nconst layout = dagreLayout(spec);\n\n// Run DRC — check for issues\nconst engine = createEngine({ rules: builtinRules() });\nconst report = engine.check(layout, spec);\nconsole.log(report.passed ? 'All checks passed' : `${report.violations.length} violation(s)`);\n\n// Or fix issues automatically\nconst { layout: fixed, report: fixReport } = engine.fix(layout, spec);\n\n// Render to draw.io\nconst xml = renderMxGraph(fixed, spec, { title: 'Architecture' });\n```\n\n## Built-in rules\n\n| Rule | Description |\n|------|-------------|\n| `crossing-minimization` | Reorders sibling nodes within groups to minimize edge crossings |\n| `spacing` | Ensures minimum distance between node bounding boxes |\n\n## Writing custom rules\n\n```typescript\nimport type { LayoutRule, LayoutResult, GraphSpec, Violation } from 'diagram-drc';\n\nconst myRule: LayoutRule = {\n  id: 'my-custom-rule',\n  description: 'Check something specific to my diagrams',\n  severity: 'warning',\n  check(layout, spec) {\n    // Return violations found\n    return [];\n  },\n  fix(layout, spec) {\n    // Return corrected layout\n    return layout;\n  },\n};\n\nengine.addRule(myRule);\n```\n\n## API\n\n### Engine\n\n- `createEngine(options?)` — create a DRC engine\n- `engine.check(layout, spec)` — detect violations (read-only)\n- `engine.fix(layout, spec)` — fix violations and report remaining issues\n- `engine.addRule(rule)` — add a rule (chainable)\n\n### Layout\n\n- `dagreLayout(spec, options?)` — run Dagre layout on a graph\n\n### Render\n\n- `renderMxGraph(layout, spec, options?)` — render to draw.io mxGraph XML\n\n## License\n\nMIT\n","readmeFilename":"README.md"}