Skip to content

DiagramPilot v0.2.3

Choose a tag to compare

@github-actions github-actions released this 07 Jun 08:40
eecdd2d

DiagramPilot v0.2.3

Issue: Add PNG rendering
Issue Version: 0.2.3
Tag: v0.2.3
npm: https://www.npmjs.com/package/diagrampilot/v/0.2.3
Public Website: https://diagrampilot.com

Summary

Add PNG rendering through diagrampilot render <path> --format svg|png --out <path>. SVG remains the default render format. PNG should be produced by
rasterizing the current SVG render output so SVG and PNG stay visually aligned.

Keep renderer integration behind the existing adapter seams and avoid adding
D2-specific DiagramSpec semantics. This preserves the future direction toward a
Native Rendering Engine while still shipping a useful alpha PNG path.

Implementation Notes

  • Added --format svg|png parsing for diagrampilot render, with SVG as the
    default so existing render <source> --out <path> commands keep their
    behavior.
  • Added repairable render usage text for missing or unsupported render formats,
    listing default SVG, explicit SVG, and explicit PNG command shapes.
  • Added binary-safe command write intents so command execution can write PNG
    bytes while preserving UTF-8 text writes for SVG and exported text formats.
  • Added rasterizeSvgToPng to @diagrampilot/render-svg using pinned
    @resvg/resvg-js@2.6.2. PNG rendering first calls the existing SVG render
    path, then rasterizes that SVG output, keeping DiagramSpec renderer-neutral.
  • Covered the adapter boundary at the command-planning seam: PNG planning
    verifies the exact SVG render output is passed to the rasterizer, unsupported
    formats fail before source loading, and invalid sources fail before SVG or
    PNG adapter side effects.
  • Added an executable smoke test that renders a real PNG and checks the PNG
    signature and non-empty bytes.
  • Updated public docs, maintainer docs, the checkout demo README, llms.txt,
    and docs-contract drift tests so PNG is documented as a shipped render format.
  • Bumped shared DiagramPilot release metadata to Issue Version 0.2.3 and
    refreshed the checkout demo SVG provenance at 0.2.3.

Validation Results

  • node scripts/bump-release-version.mjs 0.2.3 passed.
  • npm run build passed.
  • cd demo-projects/checkout && node ../../packages/cli/dist/index.js render docs/architecture.dp.yaml --out docs/architecture.svg
    passed.
  • cd demo-projects/checkout && node ../../packages/cli/dist/index.js check
    passed: 1 DiagramPilot Source File fresh.
  • node --test --test-concurrency=1 test/cli-command-planning.test.mjs
    passed: 28 tests.
  • node --test --test-concurrency=1 test/cli-smoke.test.mjs
    passed: 14 tests.
  • node --test --test-concurrency=1 test/documentation-contract.test.mjs
    passed: 5 tests.
  • node --test --test-concurrency=1 test/maintainability-file-size-gate.test.mjs
    passed: 6 tests.
  • npm test passed: 178 tests.
  • node packages/cli/dist/index.js render demo-projects/checkout/docs/architecture.dp.yaml --format png --out /tmp/diagrampilot-architecture.png
    passed.
  • file /tmp/diagrampilot-architecture.png could not run because this
    workspace does not have the file utility installed.
  • node -e 'const fs=require("node:fs"); const b=fs.readFileSync("/tmp/diagrampilot-architecture.png"); const sig=[...b.subarray(0,8)].map((x)=>x.toString(16).padStart(2,"0")).join(" "); console.log(${b.length} bytes ${sig}); if (sig !== "89 50 4e 47 0d 0a 1a 0a") process.exit(1);'
    passed and reported 44887 bytes 89 50 4e 47 0d 0a 1a 0a.
  • wc -c /tmp/diagrampilot-architecture.png passed and reported 44887 bytes.
  • node scripts/check-release-version.mjs passed at 0.2.3.
  • npm run check:package-readiness passed for 7 public packages.
  • node scripts/generate-release-notes.mjs --version 0.2.3 --tag v0.2.3
    passed and generated the expected release-note draft from this completed
    issue.
  • git diff --check passed.