CLI Simplification Migration (Conservative Full-Surface Pass)
This note documents behavioral and output-shape changes introduced in the conservative CLI simplification pass.
What Changed
1) Command invocation normalization before Commander parse
pm now normalizes invocation tokens before Commander parses them:
- long-flag shape normalization (
--foo_bar/ camel variants -> canonical kebab flags) - high-confidence typo normalization for long flags
key=value/key:valuepromotion into canonical--flag valuetokens when unambiguous- legacy
pm extension <action>shorthand normalization to explicit action flags
Normalization runs across command families and preserves a normalization trace for diagnostics and recovery.
2) Setup-agnostic PM root discovery
resolvePmRoot() precedence is now:
- explicit
--path PM_PATH- upward discovery of initialized
.agents/pmroots (must containsettings.json) - local default (
<cwd>/.agents/pm)
If you need the old local-only behavior from nested directories, pass an explicit path (--path .agents/pm).
3) Structured recovery bundles in CLI error output
Error payloads now include optional recovery metadata in text and JSON guidance surfaces:
attempted_commandnormalized_argsprovided_fieldsmissingsuggested_retry
Automation should read this bundle for deterministic retries instead of rebuilding retries from free-form error text.
4) Legacy none/null compatibility in create/update
For deterministic compatibility:
- scalar
none/nullvalues on unset-capable fields are reinterpreted as--unset <field> - repeatable
none/nullvalues are reinterpreted as their matching--clear-*action - mixed legacy clear token + concrete repeatable payloads remain rejected (ambiguous input)
Migration Guidance for Automation
- Prefer contracts first: keep using
pm contracts --jsonand command-scoped flag contracts. - Consume
recoverydirectly: treatrecovery.suggested_retryas first-choice replay command. - Do not hardcode old error envelopes: parsers should tolerate additional fields (
recovery) and richer guidance text. - Avoid relying on local cwd-only root resolution: pass
--pathexplicitly when wrappers need fixed data roots. - Update none/null assumptions: if your tests expected hard failures for pure
none/nullclear intents, update them to expect deterministic clear/unset behavior.
Verification Checklist
tests/unit/bootstrap-args.spec.tstests/unit/store-paths.spec.tstests/integration/help-runtime.spec.tstests/unit/create-command.spec.tstests/unit/update-command.spec.ts
CLI Simplification Migration
remote
Report an issue