summaryrefslogtreecommitdiff
path: root/plugins/code-modernization/commands/modernize-transform.md
diff options
context:
space:
mode:
authorBryan Thompson <bthompson@anthropic.com>2026-06-22 20:03:36 -0500
committerBryan Thompson <bthompson@anthropic.com>2026-06-22 20:03:36 -0500
commit7bc909dc203c249bfed698dc5095c956483cc80e (patch)
tree9683cb5c05e4a9494e9c8054cd09036940389cd0 /plugins/code-modernization/commands/modernize-transform.md
parent286eb1e2178e64571fe339576b06ea03b7754ece (diff)
parentb8c05307dbdfcc8bc4ba48e44dbae5a87e30512d (diff)
Merge main into add-hana-cli (refresh 991-commit-stale branch)add-hana-cli
Diffstat (limited to 'plugins/code-modernization/commands/modernize-transform.md')
-rw-r--r--plugins/code-modernization/commands/modernize-transform.md39
1 files changed, 36 insertions, 3 deletions
diff --git a/plugins/code-modernization/commands/modernize-transform.md b/plugins/code-modernization/commands/modernize-transform.md
index 86ba4ef1..8183fd46 100644
--- a/plugins/code-modernization/commands/modernize-transform.md
+++ b/plugins/code-modernization/commands/modernize-transform.md
@@ -9,10 +9,37 @@ equivalence.
This is a surgical, single-module transformation — one vertical slice of the
strangler fig. Output goes to `modernized/$1/$2/`.
-## Step 0 — Plan (HITL gate)
+## Step 0a — Toolchain check (fail fast on target, adapt on legacy)
+
+Verify the build environment **before** planning, not when the tests
+first run:
+
+- **Target stack ($3) — required.** Runtime, package manager, and test
+ framework all respond (`java -version` + `mvn -v`, `node -v` + `npm -v`,
+ `python3 -V` + `pytest --version`, …). If any are missing, stop and
+ report what to install — the new code and its tests cannot run without
+ them, so a plan gate now would just defer the failure an hour. Suggest
+ `/modernize-preflight $1 $3` for the full readiness report.
+- **Legacy stack — advisory, never a blocker.** Try a syntax-only compile
+ of the module being transformed (e.g. `cobc -fsyntax-only`). Legacy
+ code often *cannot* build locally by nature, not by misconfiguration —
+ CICS/IMS programs have no local translator, and the real runtime may be
+ a mainframe you don't have. A failed or impossible legacy compile does
+ **not** stop the transform; it changes the equivalence strategy:
+ - dual-execution proof is off the table — characterization tests
+ assert against **recorded traces / golden-master fixtures** (real
+ production outputs, captured reports/screens, SME-confirmed
+ examples) instead of live legacy runs
+ - say so explicitly in the Step 0b plan and later in
+ TRANSFORMATION_NOTES.md ("equivalence is trace-based; legacy was not
+ executable in this environment"), so reviewers know the strength of
+ the proof they're approving
+
+## Step 0b — Plan (HITL gate)
Read the source module and any business rules in `analysis/$1/BUSINESS_RULES.md`
-that reference it. Then **enter plan mode** and present:
+that reference it. Then present the plan and **stop — write no code until
+the user explicitly approves** (use plan mode if the session supports it):
- Which source files are in scope
- The target module structure (packages/classes/files you'll create)
- Which business rules / behaviors this module implements
@@ -30,7 +57,9 @@ identify every observable behavior, and encode each as a test case with
concrete input → expected output pairs derived from the legacy logic.
Target framework: <appropriate for $3>. Write to
`modernized/$1/$2/src/test/`. These tests define 'done' — the new code
-must pass all of them."
+must pass all of them. Follow your secret-handling rules: no credential
+literal from legacy code becomes a fixture; substitute fake same-shape
+values and read anything genuinely live from environment variables."
Show the user the test file. Get a 👍 before proceeding.
@@ -68,6 +97,10 @@ Then show a visual diff of one representative behavior, legacy vs modern:
```bash
delta --side-by-side <(sed -n '<lines>p' legacy/$1/<file>) modernized/$1/$2/src/main/<file>
```
+(Fall back to `diff -y --width=160` if `delta` isn't installed.) Never
+pick a credential-bearing line range for this diff, and mask any
+credential-like literal quoted in TRANSFORMATION_NOTES.md — the notes
+live in `modernized/` and get committed.
## Step 5 — Architecture review