summaryrefslogtreecommitdiff
path: root/plugins/code-modernization/scripts/make_shards.py
AgeCommit message (Collapse)Author
2026-09-24code-modernization: simpler commands, a source option, a report page and an ↵Morgan Lunt
equivalence check Commands hardcoded legacy/<system>, so code too big to copy, or living at an absolute path, needed a hand-made symlink. Preflight now takes --source <path> and makes the legacy/<system> 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.
2026-09-24code-modernization: extract-rules uses a shard builder and a rules renderer ↵Morgan Lunt
that ship with the plugin The command used to carry a 35-line shard-building script inline and asked the model to write a rules renderer on every run, so the shard list and the BUSINESS_RULES.md layout varied from run to run and could not be tested. scripts/make_shards.py builds the shard list from topology.json when the map has run, and from the directory tree when it has not (skipping vendored, generated and test-fixture directories, one shard per directory, split at 25 files or about 5,000 lines). scripts/render_rules.py turns the workflow's result into BUSINESS_RULES.md and DATA_OBJECTS.md with RULE-NNN headings, the SME section and the coverage gaps, and writes every value from the analysis as plain text. The workflow takes an optional sourceDir, so the code can live outside the workspace, and shard files are kept relative to it. The command drops from 305 to about 150 lines.