CommandRegistry class
Full-featured command registry.
Manages command registration/unregistration, lookup by name or alias, execution dispatching, tab-completions, help generation, and stats.
Constructors
Properties
-
getAll
→ List<
CommandRegistration> -
All registrations.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
-
onCommandExecuted
→ Stream<
CommandExecutionEvent> -
Stream of command execution events.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
visible
→ List<
CommandRegistration> -
All enabled, non-hidden commands (for help/typeahead).
no setter
Methods
-
clear(
) → void - Clear all commands.
-
dispose(
) → void - Dispose of internal resources.
-
execute(
String name, String args, ToolUseContext context) → Future< CommandResult?> - Execute a command by name with the given args and context.
-
get(
String name) → CommandRegistration? -
Find a command by name or alias. Strips leading
/. -
getAliases(
String name) → List< String> - Get aliases for a command.
-
getAllHelp(
) → String - Get help for all visible commands, grouped by category.
-
getByCategory(
CommandCategory category) → List< CommandRegistration> - Get all commands in a specific category.
-
getCommand(
String name) → Command? - Get the underlying Command by name or alias.
-
getCompletions(
String prefix) → List< String> - Get tab-completion candidates for a prefix.
-
getHelp(
String name) → String? - Get help text for a single command.
-
isValid(
String name) → bool - Check if a command exists.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
register(
Command command, {CommandCategory category = CommandCategory.system, List< String> extraAliases = const [], bool requiresAuth = false, bool requiresGit = false}) → void - Register a command with metadata.
-
registerAll(
Iterable< Command> commands, {CommandCategory category = CommandCategory.system}) → void - Register multiple commands with the same category.
-
registerBuiltinCommands(
{List< Command> sessionCommands = const [], List<Command> configCommands = const [], List<Command> toolCommands = const [], List<Command> gitCommands = const [], List<Command> debugCommands = const [], List<Command> systemCommands = const [], List<Command> helpCommands = const []}) → void - Register all built-in commands.
-
registerExtendedCommands(
List< Command> commands, {CommandCategory category = CommandCategory.system, }) → void - Register extended / plugin commands discovered at runtime.
-
search(
String prefix) → List< CommandRegistration> - Search for commands matching a prefix (for typeahead).
-
toString(
) → String -
A string representation of this object.
inherited
-
unregister(
String name) → void - Unregister a command by name.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited