@ikunin/sprintpilot 2.3.6 → 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 };
|
|
@@ -136,18 +136,32 @@ silence communicates "not tracked" rather than spamming `[no issue]`.
|
|
|
136
136
|
|
|
137
137
|
**PNG sibling render.** As a side-effect of the mermaid render, the
|
|
138
138
|
script tries to produce a `<file>.png` next to the `.mmd` via the
|
|
139
|
-
official Mermaid CLI (`mmdc`).
|
|
139
|
+
official Mermaid CLI (`mmdc`). You **MUST** examine the envelope's
|
|
140
|
+
`png_*` fields and surface one of the three outcomes to the user —
|
|
141
|
+
silence is a bug, especially when mmdc is missing.
|
|
140
142
|
|
|
141
|
-
-
|
|
143
|
+
- **`png_file` set** → PNG produced. Report:
|
|
142
144
|
> Also wrote PNG: `<png_file>` (rendered via Mermaid CLI).
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
>
|
|
147
|
-
>
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
145
|
+
|
|
146
|
+
- **`png_reason: "mmdc-missing"`** → Mermaid CLI is not installed.
|
|
147
|
+
You **MUST** tell the user how to install it, verbatim:
|
|
148
|
+
> PNG render skipped — Mermaid CLI (`mmdc`) is not installed.
|
|
149
|
+
> To get a `.png` alongside the `.mmd` next time, install it:
|
|
150
|
+
>
|
|
151
|
+
> ```
|
|
152
|
+
> npm install -g @mermaid-js/mermaid-cli
|
|
153
|
+
> ```
|
|
154
|
+
>
|
|
155
|
+
> Works on Windows, Linux, and macOS. Requires Node 18+.
|
|
156
|
+
> After installing, re-run `/sprintpilot-dependency-graph mermaid`.
|
|
157
|
+
|
|
158
|
+
Do not silently drop this. The `.mmd` file is still useful but the
|
|
159
|
+
install hint is the primary value of this code path.
|
|
160
|
+
|
|
161
|
+
- **`png_reason: "render-failed"`** → mmdc was found but errored.
|
|
162
|
+
Report the `png_message` verbatim and suggest re-running with
|
|
163
|
+
`mmdc -i <mmd-path> -o <png-path>` outside the skill to see the
|
|
164
|
+
full toolchain error.
|
|
151
165
|
|
|
152
166
|
### Graphviz
|
|
153
167
|
|
|
@@ -239,4 +253,6 @@ have different leading hyphen segments — leverage the JSON output).</action>
|
|
|
239
253
|
| Plan file corrupt | Surface the parse error from `sprint-plan.js read`; suggest re-running the planning skill. |
|
|
240
254
|
| Cycle detected (`resolve-dag.js` exits 1 with "cycle detected") | Report the cycling node list verbatim. Suggest reviewing `plan.dependencies.stories` for the named keys, or re-running `/sprintpilot-plan-sprint` to re-infer. |
|
|
241
255
|
| Graphviz binary missing | Note the fallback; tell the user how to install `dot`; do NOT silently retry with a different format. |
|
|
256
|
+
| Mermaid CLI (`mmdc`) missing (mermaid format, `png_reason: "mmdc-missing"`) | You **MUST** report the install command: `npm install -g @mermaid-js/mermaid-cli` (cross-platform, requires Node 18+). The `.mmd` file is still written, but never skip the install hint — that's the user-actionable signal. |
|
|
257
|
+
| Mermaid CLI present but errored (`png_reason: "render-failed"`) | Surface `png_message` verbatim; suggest re-running `mmdc -i <mmd> -o <png>` outside the skill to see the full toolchain error. |
|
|
242
258
|
| Output file write fails (permission, disk full) | Surface the error from the resolve-dag stderr; chat-render the JSON output as a fallback so the user still gets something usable. |
|
package/package.json
CHANGED