summaryrefslogtreecommitdiff
path: root/plugins/code-modernization/commands
diff options
context:
space:
mode:
authorClaude <noreply@anthropic.com>2026-11-19 01:38:59 +0000
committerClaude <noreply@anthropic.com>2026-11-19 01:38:59 +0000
commitfc515815fa14ab96bebc363a5f42e79a7f571158 (patch)
tree796871d943efb9f92635f2cb62a34498d82d300e /plugins/code-modernization/commands
parent4d9854e0873b9d068fb444c8b14d00278ce2402a (diff)
code-modernization: look up whether a target version is supported before proposing itcode-modernization/supported-target-versions
Commands proposed language and framework versions from the model's memory, which is older than today, so a plan could name a release that is already out of support. A shared rule (references/target-versions.md) now has each command look versions up, record them in a Target versions table with the support end date and source, keep a version the person chose with a warning, and mark a version that could not be checked as unverified instead of guessing. Version 1.1.0.
Diffstat (limited to 'plugins/code-modernization/commands')
-rw-r--r--plugins/code-modernization/commands/modernize-assess.md4
-rw-r--r--plugins/code-modernization/commands/modernize-brief.md6
-rw-r--r--plugins/code-modernization/commands/modernize-preflight.md6
-rw-r--r--plugins/code-modernization/commands/modernize-reimagine.md20
-rw-r--r--plugins/code-modernization/commands/modernize-transform.md6
-rw-r--r--plugins/code-modernization/commands/modernize-uplift.md27
-rw-r--r--plugins/code-modernization/commands/modernize.md24
7 files changed, 62 insertions, 31 deletions
diff --git a/plugins/code-modernization/commands/modernize-assess.md b/plugins/code-modernization/commands/modernize-assess.md
index c787f3b3..6ebae2d1 100644
--- a/plugins/code-modernization/commands/modernize-assess.md
+++ b/plugins/code-modernization/commands/modernize-assess.md
@@ -141,7 +141,9 @@ cost or date) · **Recommended Modernization Pattern**: one of Rehost, Replatfor
Refactor, Rearchitect, Rebuild, Replace, with a one-paragraph rationale and the
command it routes to: a move to a newer version of the same technology (or its
supporting platform) → `uplift`; a rewrite in another technology, piece by piece →
-`transform`; a rebuild on a new architecture → `reimagine`. Rehost (move as is) and
+`transform`; a rebuild on a new architecture → `reimagine`. If the assessment names a
+target version, look it up first (`${CLAUDE_PLUGIN_ROOT}/references/target-versions.md`),
+never from memory. Rehost (move as is) and
Replace (buy or adopt a product) change no code, so no build command applies: say so,
and say what the analysis is still good for. For Rehost, `map`, `harden` and the `preflight`
build check show what the move must carry along; for Replace, `extract-rules` turns
diff --git a/plugins/code-modernization/commands/modernize-brief.md b/plugins/code-modernization/commands/modernize-brief.md
index fb9a8f76..fdc71ba2 100644
--- a/plugins/code-modernization/commands/modernize-brief.md
+++ b/plugins/code-modernization/commands/modernize-brief.md
@@ -7,6 +7,8 @@ arguments: system target_stack
Synthesize everything in `analysis/$system/` into a **Modernization Brief**: the single
document a steering committee approves and engineering executes. Target stack:
`$target_stack` (if blank, the one in `analysis/$system/INTENT.md`, else recommend one from the assessment).
+**Its versions are looked up, never remembered:** read `${CLAUDE_PLUGIN_ROOT}/references/target-versions.md`
+first and follow it (nothing out of support unless the person chose it; `unverified` only when every lookup failed).
Read `ASSESSMENT.md`, `topology.json` (and the `.mmd` files beside it; never read
`TOPOLOGY.html`, it is a viewer with the data minified inside) in `analysis/$system/` first,
@@ -48,7 +50,9 @@ Write `analysis/$system/MODERNIZATION_BRIEF.md` with these sections.
**1. Objective.** One paragraph: from what, to what, why now.
**2. Target Architecture.** A Mermaid C4 Container diagram of the end state naming every service,
-data store and integration, then a table mapping each legacy component to its target component(s).
+data store and integration, then a table mapping each legacy component to its target component(s), then
+the **Target versions** table (component, version, support end, source and date checked, status). Any row
+that is not `supported` and holds no decision yet is an open question in section 7.
**3. Phased Sequence.** 3–6 phases, ordered by **strangler fig** for a cross-stack rewrite
(lowest risk and fewest dependencies first) or **build-graph leaf-first** for an uplift
diff --git a/plugins/code-modernization/commands/modernize-preflight.md b/plugins/code-modernization/commands/modernize-preflight.md
index aba9d739..509e5d40 100644
--- a/plugins/code-modernization/commands/modernize-preflight.md
+++ b/plugins/code-modernization/commands/modernize-preflight.md
@@ -116,7 +116,11 @@ If `$target_stack` was given, prove it with a throwaway project, not a version
string: in a scratch directory outside `legacy/$system` (`mktemp -d`), create the
smallest project the stack allows, restore, build, run one passing test with its
real package manager and test framework, then delete it. A target that cannot
-build here is a finding.
+build here is a finding. If it names a version, also report whether that version
+is still supported, looked up as
+`${CLAUDE_PLUGIN_ROOT}/references/target-versions.md` says (never from memory):
+out of support or ending soon is ⚠️ with the date and the supported alternative,
+unverified is ⚠️ with the page to check; neither is ever ❌ or changes a verdict.
## Check 4 — Source completeness
diff --git a/plugins/code-modernization/commands/modernize-reimagine.md b/plugins/code-modernization/commands/modernize-reimagine.md
index a6b527db..2eb828f2 100644
--- a/plugins/code-modernization/commands/modernize-reimagine.md
+++ b/plugins/code-modernization/commands/modernize-reimagine.md
@@ -47,15 +47,21 @@ reimagined system, and should any be deliberately dropped?" Wait, and record the
## Phase C — Architecture, then critique
Design the target architecture for <vision>: a Mermaid C4 Container diagram, service boundaries with
-rationale (which rules and entities live where), technology choices with a one-line justification each, and
-the data migration approach from the legacy stores. Then spawn **architecture-critic**: "Review this
+rationale (which rules and entities live where), technology choices with a one-line justification each, a
+**Target versions** table (component, version, support end, source and date checked, status), and the data
+migration approach from the legacy stores. **Versions are looked up, never remembered:** before choosing any,
+read `${CLAUDE_PLUGIN_ROOT}/references/target-versions.md` and follow it (check each with the web tools, on the
+vendor's support page or endoflife.date; newest supported release, or newest LTS where the vendor keeps an LTS line;
+`unverified` only when every lookup failed). Then spawn **architecture-critic**: "Review this
architecture for <vision> against `analysis/$system/AI_NATIVE_SPEC.md`: over-engineering, missed
-requirements, scaling risks, simpler alternatives." Incorporate the critique and write
-`analysis/$system/REIMAGINED_ARCHITECTURE.md`.
+requirements, scaling risks, simpler alternatives, and any technology that is out of support or has no version,
+support date and source." Incorporate the critique (look up any version that changes, here or at Phase D, and
+update the table) and write `analysis/$system/REIMAGINED_ARCHITECTURE.md`.
## Phase D — Checkpoint 2
-Present the architecture and **stop: scaffold nothing until the user explicitly approves** (plan mode if
+Present the architecture, naming every **Target versions** row that is not `supported` (the user pins an
+`unverified` one here), and **stop: scaffold nothing until the user explicitly approves** (plan mode if
available). The approval authorizes the build-out.
## Phase E — Parallel scaffolding (only after Phase D approval)
@@ -81,7 +87,9 @@ do not conflict). From the result report `scaffolded[]` (each service with its `
**Without it,** spawn a **scaffolder** agent per service in parallel (at most 3 at a time; say which you
deferred): "Scaffold the <service-name> service per `analysis/$system/REIMAGINED_ARCHITECTURE.md` and
-`AI_NATIVE_SPEC.md`: project skeleton, domain model, API stubs matching the interface contracts, and
+`AI_NATIVE_SPEC.md`: project skeleton on exactly the versions in the architecture's Target versions table (for a
+dependency not in it, the newest compatible stable release the package registry reports, never one from memory;
+report a version that cannot be resolved as a blocker), domain model, API stubs matching the interface contracts, and
**executable acceptance tests** for every behavior-contract rule assigned to this service (mark unimplemented
ones expected-failure with the rule ID). No credential from legacy code becomes a fixture or config default:
use fake same-shape values and env-var placeholders. Write to `modernized/$system-reimagined/<service-name>/`."
diff --git a/plugins/code-modernization/commands/modernize-transform.md b/plugins/code-modernization/commands/modernize-transform.md
index d3a1fb69..58ae5174 100644
--- a/plugins/code-modernization/commands/modernize-transform.md
+++ b/plugins/code-modernization/commands/modernize-transform.md
@@ -20,6 +20,12 @@ the earliest phase whose `Command:` is `transform` that has no
stop and say what to install: a plan gate now would only defer the failure an hour. Point to
`/code-modernization:modernize-preflight $system $target_stack`.
+**Target versions.** Build on the versions in the brief's **Target versions** table. If it has none for this
+module, or they are `unverified` or were checked over 30 days ago, look them up now as
+`${CLAUDE_PLUGIN_ROOT}/references/target-versions.md` says (never from memory), show the table in the plan and
+keep it in `TRANSFORMATION_NOTES.md`. Anything not `supported` and not yet decided is a question at the plan gate.
+A dependency with no row takes the newest compatible stable release the package registry reports.
+
**Legacy stack (advisory, never a blocker).** Try a syntax-only compile of the module. Legacy code
often cannot build locally by nature (CICS and IMS programs have no local translator; the real runtime
is a mainframe you do not have). If it cannot, dual execution is off the table: the tests assert
diff --git a/plugins/code-modernization/commands/modernize-uplift.md b/plugins/code-modernization/commands/modernize-uplift.md
index 5e0eda2e..55199199 100644
--- a/plugins/code-modernization/commands/modernize-uplift.md
+++ b/plugins/code-modernization/commands/modernize-uplift.md
@@ -1,5 +1,5 @@
---
-description: Same-stack version uplift (e.g. .NET Framework 4.8 to .NET 8, Java 8 to 17) — keep the code, fix the version deltas, prove nothing changed
+description: Same-stack version uplift (e.g. .NET Framework to modern .NET, Java 8 to the current LTS) — keep the code, fix the version deltas, prove nothing changed
argument-hint: <system> [source-version] [target-version] [project-pattern]
arguments: system source_version target_version project_pattern
---
@@ -15,7 +15,7 @@ work to matching projects.
**The strong case is a real dual run.** If both runtimes execute here, one test suite runs on both and
the equivalence proof is a differential test. It is not always available: .NET can multi-target one
-test project (`net48;net8.0`) but `net48` runs only on Windows or Mono; Java 8 to 17 is the whole build
+test project (`net48` and the target) but `net48` runs only on Windows or Mono; for Java it is the whole build
run under two JDK toolchains; Python 2 cannot import an un-rewritten module under Python 3. When both
cannot run here, equivalence falls back, as in `transform`, to characterization tests pinned to
recorded outputs on the target only. That is fine, but label it honestly (Step 0.3, Step 7).
@@ -23,10 +23,12 @@ recorded outputs on the target only. That is fine, but label it honestly (Step 0
## Step 0 — Toolchain and version pinning (fail fast)
1. **Pin the version pair exactly.** If the versions were not given, take them from `analysis/$system/INTENT.md` or the
- brief. If either version is missing or vague (".NET" with no number), stop and ask. When the move spans several
- major versions or two things at once (a JDK and a framework: Java 8 with Spring 4 to Java 21 with Spring Boot 3),
- split it into hops that each build and pass their tests before the next starts (for example Java 8, 11, 17, 21),
- name the order in the plan, and treat each hop as its own pilot.
+ brief. If either version is missing or vague (".NET" with no number), stop and ask. **Check that the target is
+ supported** as `${CLAUDE_PLUGIN_ROOT}/references/target-versions.md` says: looked up, never remembered, and the
+ versions you offer when you ask are looked up too. When the move spans several major versions or two things at once
+ (a JDK and a framework: Java 8 with Spring 4 to a newer JDK with Spring Boot), split it into hops that each build and
+ pass their tests before the next starts (for example Java 8, 11, 17, then the target), name the order in the plan,
+ and treat each hop as its own pilot.
2. **Target runtime, required.** Verify it builds and tests (`dotnet --version` and a `dotnet test`
smoke; `mvn` or `gradle`; `python3 -V` and `pytest`).
3. **Source runtime, the baseline oracle.** Verify the *old* version also runs here. If it does not
@@ -82,8 +84,8 @@ cut. Default order is **leaf-first**, with these overrides, called out in the pl
whole graph; stand them up or multi-target them before migrating anything.
- **A dependency delta every consumer shares forces a coordinated cut** (EF6 to EF Core, `javax` to
`jakarta`): its own cross-cutting step, not leaf-first.
-- **Multi-target shared libraries during the transition** (`<TargetFrameworks>net48;net8.0</TargetFrameworks>`
- on shared leaf libraries) so old and new consumers can both reference them.
+- **Multi-target shared libraries during the transition** (`net48` plus the target in
+ `<TargetFrameworks>` on shared leaf libraries) so old and new consumers can both reference them.
- **A shared node with consumers outside this scope needs a recorded decision before an in-place
edit.** `PREFLIGHT.md` Check 6 lists them; the brief's §3 owns the decision (keep it buildable for
both old and new consumers, widen the scope, or schedule the break). Without one, getting it from the
@@ -92,9 +94,10 @@ cut. Default order is **leaf-first**, with these overrides, called out in the pl
## Step 2 — Plan (human gate)
Present, and **change nothing until the user approves** (plan mode if available): the exact version
-pair; the working-copy plan; which ecosystem tool you will drive and whether it can run here; the
-project order with the overrides above; the harness plan and **whether a true dual run is possible or
-it is target-only** (.NET: one test project multi-targeted, the `net48` leg needs Windows; Java: a
+pair, with the **Target versions** table (kept at the top of `DELTA_CATALOG.md` unless the brief has it; anything
+not `supported` and not yet decided is a question here); the working-copy plan; which ecosystem tool you will drive
+and whether it can run here; the project order with the overrides above; the harness plan and **whether a true dual
+run is possible or it is target-only** (.NET: one test project multi-targeted, the `net48` leg needs Windows; Java: a
double JDK build; Python: separate interpreter environments); how equivalence is proven (**the baseline
on $source_version is the oracle and $target_version must reproduce it**, or characterization tests
against recorded outputs); anything ambiguous.
@@ -130,7 +133,7 @@ findings and the known breaking changes with what this code uses, cover all four
file:line, flag silent-behavioral deltas as test-before-touch, never under-report dependency deltas."
Either way rank by blast radius and mark each delta **Mechanical** (a codemod can do it) or **Judgment**
-(a human decides).
+(a human decides). Check any dependency version a fix names in the package registry before you write it down.
## Step 4 — Dual-target harness (before touching code)
diff --git a/plugins/code-modernization/commands/modernize.md b/plugins/code-modernization/commands/modernize.md
index 112f5b21..3021ac47 100644
--- a/plugins/code-modernization/commands/modernize.md
+++ b/plugins/code-modernization/commands/modernize.md
@@ -30,24 +30,28 @@ items. A pop-up allows at most four options per question, and the person can alw
**Pop-up 1, two questions:**
1. **What do you want to do with it?** *Move to a newer version of the same technology* (for example .NET Framework to
- .NET 8, Java 8 to 17, Python 2 to 3), *Rewrite it in a different technology, one piece at a time, while the old system
- keeps running*, *Rebuild it from scratch on a new architecture*, *Understand it first: map it and list what it does*
- (also the right choice when they are not sure: the assessment then recommends one of the other three).
+ modern .NET, Java 8 to the current LTS, Python 2 to 3), *Rewrite it in a different technology, one piece at a time,
+ while the old system keeps running*, *Rebuild it from scratch on a new architecture*, *Understand it first: map it and
+ list what it does* (also the right choice when they are not sure: the assessment then recommends one of the other
+ three).
2. **What must stay true?** Pick any: *The old system keeps running during the move*, *Behavior must match exactly,
including known quirks*, *Fix known bugs as we go*, *A security review comes first*. Choosing none means nothing
special.
**Pop-up 2, one question, only after the first answer and never for "understand it first":** *What should it become?*
-Tailor it to what you found in step 2: for a version move, the newest supported versions of the code's stack ("Java
-21", "Java 17"); for a rewrite, two or three common target technologies for this kind of code; for a rebuild, the
-architecture options that fit (a REST API with a separate front end, a few services, a modular monolith). The person
-can type any other target.
+Tailor it to what you found in step 2: for a version move, the newest supported versions of the code's stack, looked up
+now as `${CLAUDE_PLUGIN_ROOT}/references/target-versions.md` says (web tools first, never from memory; if every lookup
+fails, offer "the newest LTS", unverified, with no number); for a rewrite, two or three common target technologies for this kind of code, with no
+version numbers (a later command checks and picks those); for a rebuild, the architecture options that fit (a REST API
+with a separate front end, a few services, a modular monolith). The person can type any other target; check a version
+they name the same way.
## 4 — Write it down once
Write `analysis/$system/INTENT.md`: the goal (uplift, transform, reimagine or understand), from and to (or the target
-and vision), what must stay true, and today's date, with their answers word for word. Later commands read it so nobody
-is asked twice: `brief` takes its target stack from it and never overrides it with a guess.
+and vision), what must stay true, and today's date, with their answers word for word, plus the **Target versions** rows
+for any version you checked. Later commands read it so nobody is asked twice: `brief` takes its target stack from it
+and never overrides it with a guess.
## 5 — Show the road
@@ -59,6 +63,6 @@ first and let the assessment's recommended pattern pick the road. Name the place
## 6 — First step
Give the exact command with everything filled in, for example
-`/code-modernization:modernize-preflight billing "Java 17" --source /work/billing`, and ask "Shall I start it?". On yes, or in a
+`/code-modernization:modernize-preflight billing "<the target from INTENT.md>" --source /work/billing`, and ask "Shall I start it?". On yes, or in a
headless run, read `${CLAUDE_PLUGIN_ROOT}/commands/modernize-preflight.md` and carry it out with those arguments as if they had
typed it. After it finishes, name the next command.