Commands are associated using CommandRegistry’s add
method. Context for a command can be specified using CSS selectors, you may for example want to limit the context only to a given panel or editor. The findCommands
method searches matching commands, this is what the command palette uses. Finally there is a dispatch
method that allows for a command to be executed programmatically.
Once a plugin registers a command, it can bind it to a keyboard shortcut using KeymapManager. When a single shortcut is bound to multiple commands, dispatcher selects a command based on CSS rule precedence of its selector. The Key Binding Resolver can be used to explore how the commands are dispatched.
Extensions to Atom a distributed through the package system. You have to first install a package to be able to search the commands it contains. I think it might be useful to search through all the metadata and then install the packages on-demand when the command is triggered.