Documentation
¶
Overview ¶
Command manifestv2migrate converts, regenerates and checks plugin.json files for manifest v2 (P7-PLUG-01).
Purpose: the one codemod for the v1 to v2 migration. It reads a plugin.json through internal/plugin/manifestv2 (v1 through the one normalizer) and prints the canonical v2 file: keys sorted, 2-space indent, trailing newline.
Inputs: -in <plugin.json>. Modes: default (print canonical v2), -compat (rewrite only the generated compatibility keys of a v2 file), -check (exit 1 unless the file is canonical v2 with current compatibility keys), -targets (print "binary<TAB>command" for every binary the installer publishes, one line each), -wiki <page> (regenerate the field table of the Plugin-Manifest wiki page from the schema). -write stores the result back into -in (temp file + rename) instead of printing it.
A v1 file is never converted lossily. Every non-empty v1 key with no v2 home (config, hooks, actions, routes, notes, api_version, entry, ...) is listed on stderr by value path and the run exits 1 with nothing written and nothing on stdout, in default, -write and -check modes alike. Registry-owned keys (bundles, checksum, tier_pair, ...) are removed on purpose and reported as a note. The one way to drop data is -drop <file>: a reviewed list of dead keys (tools/manifestv2migrate/dead-keys.txt, keys no code reads), one per line with a comment naming the evidence. Only listed keys are dropped; default and -check runs say what would be dropped, -write says what was. Anything neither mapped nor listed still refuses. A routes, capabilities, env or env_vars value converts only when it does so losslessly (routes to rest_routes, capabilities to the v2 list, env to env {required, optional}); otherwise it stays refused.
Outputs: stdout, or the file with -write. Exit: 0 ok, 1 invalid or not canonical, 2 usage or I/O failure. Running it on its own output is a no-op.