diff options
| author | Morgan Lunt <morganl@anthropic.com> | 2026-09-15 15:15:41 -0700 |
|---|---|---|
| committer | Morgan Lunt <morganl@anthropic.com> | 2026-09-15 15:15:41 -0700 |
| commit | 27ccae218634dbe03a234f8902982d12bf6ba52a (patch) | |
| tree | 1e9f627ce0798341868726447fbef7d46da8f20b /plugins/code-modernization/commands/modernize-map.md | |
| parent | b5439c41ae9864833eb73d5efd088af8e3be13fe (diff) | |
code-modernization: named arguments and namespaced command namesmorganl/code-modernization-named-args
Positional placeholders are zero-based ($0 is the first argument), but
every command used $1 for the first one, so arguments arrived shifted:
modernize-preflight carddemo java-spring analyzed legacy/java-spring.
Each command now declares its arguments in frontmatter (for example
`arguments: system module target_stack`) and uses the names. A missing
optional argument now expands to an empty string instead of a literal
placeholder.
Plugin commands resolve only by their namespaced name, so the README,
command cross-references, agents, workflow descriptions and the
topology viewer now say /code-modernization:modernize-*.
The extract-rules workflow is renamed modernize-extract-rules-mine. It
shared the command's name, so invoking the command could start the
workflow directly and skip the command's instructions. Commands launch
workflows by script path, so nothing else changes.
Diffstat (limited to 'plugins/code-modernization/commands/modernize-map.md')
| -rw-r--r-- | plugins/code-modernization/commands/modernize-map.md | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/plugins/code-modernization/commands/modernize-map.md b/plugins/code-modernization/commands/modernize-map.md index afe248ad..676ffec6 100644 --- a/plugins/code-modernization/commands/modernize-map.md +++ b/plugins/code-modernization/commands/modernize-map.md @@ -1,9 +1,10 @@ --- description: Dependency & topology mapping — call graphs, data lineage, batch flows, rendered as navigable diagrams argument-hint: <system-dir> +arguments: system --- -Build a **dependency and topology map** of `legacy/$1` and render it visually. +Build a **dependency and topology map** of `legacy/$system` and render it visually. The assessment gave us domains. Now go one level deeper: how do the *pieces* connect? This is the map an engineer needs before touching anything. @@ -11,7 +12,7 @@ connect? This is the map an engineer needs before touching anything. ## What to produce Write a one-off analysis script (Python or shell — your choice) that parses -the source under `legacy/$1` and extracts the four datasets below. Three +the source under `legacy/$system` and extracts the four datasets below. Three principles apply across stacks; getting them wrong produces a misleading map: 1. **Edges live in two places** — direct calls in source, *and* dispatcher/ @@ -50,9 +51,9 @@ If the source is fixed-column (COBOL columns 8–72, RPG, etc.), slice the code area and strip comment lines before regex matching, or you'll match sequence numbers and commented-out code. -Save the script as `analysis/$1/extract_topology.py` (or `.sh`) so it can be +Save the script as `analysis/$system/extract_topology.py` (or `.sh`) so it can be re-run and audited. Have it write a machine-readable -`analysis/$1/topology.json` and print a human summary. Run it; show the +`analysis/$system/topology.json` and print a human summary. Run it; show the summary (cap at ~200 lines for very large estates). `topology.json` must follow this schema — it feeds the interactive viewer: @@ -91,7 +92,7 @@ summary (cap at ~200 lines for very large estates). ``` - Group leaf modules under `domain` containers (use the domains from - `/modernize-assess` if available). Leaf kinds: `module`, `datastore`, + `/code-modernization:modernize-assess` if available). Leaf kinds: `module`, `datastore`, `job`, `screen`. `loc` drives circle size — include it for modules. - Edge kinds: `call` (direct), `dispatch` (dynamic/router), `read`, `write`. Every edge endpoint must be a leaf id that exists in the tree. @@ -131,7 +132,7 @@ engineers and "what happens when someone files a claim" for everyone else. ## Render -`analysis/$1/TOPOLOGY.html` is an **interactive map**: a zoomable +`analysis/$system/TOPOLOGY.html` is an **interactive map**: a zoomable circle-pack of the whole system (domains as containers, modules sized by LOC) with dependency edges, search, per-node detail sidebar, edge-kind toggles, and a flow-walkthrough mode that plays each persona flow as a @@ -139,7 +140,7 @@ numbered path. Build it from the template that ships with this plugin — do not hand-write the viewer: ```bash -python3 - "${CLAUDE_PLUGIN_ROOT}/assets/topology-viewer.html" analysis/$1 <<'EOF' +python3 - "${CLAUDE_PLUGIN_ROOT}/assets/topology-viewer.html" analysis/$system <<'EOF' import json, sys tpl_path, out_dir = sys.argv[1], sys.argv[2] tpl = open(tpl_path).read() @@ -169,16 +170,16 @@ Mermaid stays for **small, exportable** diagrams. Generate standalone collapse to domain level if the full graph is bigger (dense Mermaid becomes unreadable, which is exactly what the interactive map is for): -- `analysis/$1/call-graph.mmd` — domain-level `graph TD`, entry points +- `analysis/$system/call-graph.mmd` — domain-level `graph TD`, entry points highlighted -- `analysis/$1/data-lineage.mmd` — `graph LR`, programs → data stores, +- `analysis/$system/data-lineage.mmd` — `graph LR`, programs → data stores, read vs write marked -- `analysis/$1/critical-path.mmd` — `flowchart TD` of the primary flow +- `analysis/$system/critical-path.mmd` — `flowchart TD` of the primary flow from `flows`, annotated with p50/p99 wall-clock if telemetry is - available (see `/modernize-assess` Step 4) + available (see `/code-modernization:modernize-assess` Step 4) ## Present -Tell the user to open `analysis/$1/TOPOLOGY.html` in a browser, and to +Tell the user to open `analysis/$system/TOPOLOGY.html` in a browser, and to try: search for a module, click it to see its connections, and pick a persona flow from the walkthrough dropdown. |
