@ikunin/sprintpilot 2.3.7 → 2.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -661,6 +661,19 @@ function findMermaidCliBinary() {
|
|
|
661
661
|
return null;
|
|
662
662
|
}
|
|
663
663
|
|
|
664
|
+
// PNG render dimensions. mmdc defaults are 800×600 which produces an
|
|
665
|
+
// unusably-small image once a DAG has more than a handful of nodes
|
|
666
|
+
// — story labels and edges get squashed and unreadable. We override
|
|
667
|
+
// with a wide-format high-DPI render that stays legible up to ~80
|
|
668
|
+
// nodes and prints / pastes cleanly into PRs and docs:
|
|
669
|
+
// width 2400 (wide; flowchart LR is wider than tall)
|
|
670
|
+
// height 1800
|
|
671
|
+
// scale 2 (final PNG = width*scale × height*scale = 4800×3600)
|
|
672
|
+
// Roughly 1–3 MB per render — well within reason for sprint artifacts.
|
|
673
|
+
const PNG_WIDTH = 2400;
|
|
674
|
+
const PNG_HEIGHT = 1800;
|
|
675
|
+
const PNG_SCALE = 2;
|
|
676
|
+
|
|
664
677
|
// Try to render `<mmd>` to a sibling `<mmd>.png` via mmdc. Returns
|
|
665
678
|
// { written: true, file: <png-path> } — success
|
|
666
679
|
// { written: false, reason: 'mmdc-missing' } — toolchain absent
|
|
@@ -672,11 +685,32 @@ function tryRenderMermaidPng(mmdPath) {
|
|
|
672
685
|
return { written: false, reason: 'mmdc-missing' };
|
|
673
686
|
}
|
|
674
687
|
const pngPath = mmdPath.endsWith('.mmd') ? mmdPath.slice(0, -4) + '.png' : mmdPath + '.png';
|
|
675
|
-
const r = spawnSync(
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
688
|
+
const r = spawnSync(
|
|
689
|
+
bin,
|
|
690
|
+
[
|
|
691
|
+
'-i',
|
|
692
|
+
mmdPath,
|
|
693
|
+
'-o',
|
|
694
|
+
pngPath,
|
|
695
|
+
// White background, not transparent — DAG node fills (greens,
|
|
696
|
+
// yellows, greys) need a known light surface for contrast. On a
|
|
697
|
+
// transparent PNG these wash out against dark IDE/browser themes.
|
|
698
|
+
'-b',
|
|
699
|
+
'white',
|
|
700
|
+
'--width',
|
|
701
|
+
String(PNG_WIDTH),
|
|
702
|
+
'--height',
|
|
703
|
+
String(PNG_HEIGHT),
|
|
704
|
+
'--scale',
|
|
705
|
+
String(PNG_SCALE),
|
|
706
|
+
'--quiet',
|
|
707
|
+
],
|
|
708
|
+
{
|
|
709
|
+
encoding: 'utf8',
|
|
710
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
711
|
+
windowsHide: true,
|
|
712
|
+
},
|
|
713
|
+
);
|
|
680
714
|
if (r.status !== 0) {
|
|
681
715
|
const message = (r.stderr || r.stdout || 'mmdc exited non-zero').trim();
|
|
682
716
|
return { written: false, reason: 'render-failed', message };
|
package/package.json
CHANGED