Roadmap item 1.2.1 introduces shared command contracts and deterministic
registry APIs. Follow these rules for command-system changes:
- Define command contracts in
shared/src/types/commands.tsand import them via@shared/types/commandsfrom runtime modules. - Keep registry implementations deterministic by returning
list()output in a stable order (CommandIdlexical ordering). - When a command includes
argsSchema, validate arguments via registry helpers and return structuredCommandValidationErrorobjects withcode,commandId, and schemaissues. - Preserve compatibility surfaces used by current runtime/plugin paths
(
registerCommandHandlers,getCommandHandler, andgetRegisteredKeys) until dispatcher migration milestones replace those entry points. - Use
detectKeybindingConflicts(...)inapp/runtime/plugin-runtime.tswhen testing exact shortcut collisions after precedence merges; the helper reports deterministic conflicts for remaining duplicate shortcuts. - Add or update unit coverage in
test/unit/command-registry.test.tsandtest/unit/command-registry-validation.test.tsfor create, read, update, and delete (CRUD) semantics, deterministic ordering, compatibility aliases, invalid-schema handling, validator-cache invalidation, and validation error behaviour. - Add or update precedence/conflict coverage in
test/unit/runtime-plugin-settings.test.tswhen changing runtime keybinding merge or conflict-detection behaviour.