From cafefb304bde4070c6c0877528ee49c1252eff85 Mon Sep 17 00:00:00 2001 From: Morgan Lunt Date: Thu, 24 Sep 2026 20:14:51 -0700 Subject: code-modernization: simpler commands, a source option, a report page and an equivalence check Commands hardcoded legacy/, so code too big to copy, or living at an absolute path, needed a hand-made symlink. Preflight now takes --source and makes the legacy/ link for you (a junction on Windows); nothing is copied, and every command says where the link points before it starts. The harden patch is applied with patch -p1 -d. Each command ends by naming the next command to run, and the commands are about a third shorter with no step removed: - map accepts an existing dependency graph (--graph) or the stack's own tooling, maps very large estates in resumable chunks, records reflection targets as unresolved instead of dead, asks before describing more than 40 nodes, and never gives two nodes the same location. - transform can take its module and target from the brief, counts the equivalence cases that executed (zero is a failure and a comparison never skips), shows the tests can fail with a deliberate one-line break, and hands "same or different" to a script when both systems can run. - brief writes each phase in one fixed shape: one command, module ids as in the map, and criteria written as conditions a build command may tick but not reword. - reimagine reuses the discovery artifacts instead of extracting them again. - status names the exact command to paste next. scripts/build_report.py turns whatever the commands wrote into one self-contained, offline REPORT.html (Mermaid is vendored, all text from the analysis is escaped, the quarantined secrets file is never read), and scripts/compare.py decides byte-for-byte whether two outputs match, records why, and checks it can fail. The shard builder ignores symbolic links and paths that leave the source, matches a plain name against what lies beneath it, and falls back to the directory tree when the map's modules share a location. The README drops from 275 to about 100 lines; the pane's reference moves to hooks/README.md. --- plugins/code-modernization/scripts/build_report.py | 529 +++++++++++++++++++++ 1 file changed, 529 insertions(+) create mode 100644 plugins/code-modernization/scripts/build_report.py (limited to 'plugins/code-modernization/scripts/build_report.py') diff --git a/plugins/code-modernization/scripts/build_report.py b/plugins/code-modernization/scripts/build_report.py new file mode 100644 index 00000000..c6c58c66 --- /dev/null +++ b/plugins/code-modernization/scripts/build_report.py @@ -0,0 +1,529 @@ +#!/usr/bin/env python3 +"""Build one self-contained HTML report from a system's modernization artifacts. + + python3 build_report.py [--workspace DIR] [--out FILE] + +Reads whatever exists under /analysis// and /modernized/ (every file is +optional; a missing or malformed one is reported in the page, never an error) and writes +/analysis//REPORT.html by default. Standard library only. Exit 0; 1 when nothing +at all was found; 2 for a system name that is not a folder name. + +The artifacts come from untrusted code, so every byte is treated as hostile: text travels only as +escaped JSON inside