Hooks Module API Reference¶
This section documents the internals of the hooks
module in Bijux CLI.
bijux_cli.services.plugins.hooks ¶
Defines the hook specifications for the Bijux CLI plugin system.
This module uses pluggy
's hook specification markers to define the formal set of hooks that plugins can implement. The CoreSpec
class groups all standard lifecycle and execution hooks that the core application will invoke on registered plugins. This provides a clear and versioned interface for plugin developers.
CoreSpec ¶
CoreSpec(dependency_injector: DIContainer)
Defines the core hook specifications for CLI plugins.
Plugins can implement methods matching these specifications to integrate with the CLI's lifecycle and command execution flow.
Attributes:
-
_log
(ObservabilityProtocol
) –The logging service.
Initializes the CoreSpec
.
Parameters:
-
dependency_injector
(DIContainer
) –The DI container for resolving services like the logger.
Source code in src/bijux_cli/services/plugins/hooks.py
health ¶
A hook to check the health of a plugin.
This hook is called by the bijux plugins check
command. A plugin can return a boolean or a string to indicate its status.
Returns:
-
bool | str
–bool | str:
True
for healthy,False
for unhealthy, or a string with a descriptive status message.
Source code in src/bijux_cli/services/plugins/hooks.py
post_execute async
¶
A hook that is called immediately after a command has executed.
Parameters:
-
name
(str
) –The name of the command that was executed.
-
result
(Any
) –The result object returned from the command.
Source code in src/bijux_cli/services/plugins/hooks.py
pre_execute async
¶
A hook that is called immediately before a command is executed.
Parameters:
-
name
(str
) –The name of the command to be executed.
-
args
(tuple[Any, ...]
) –The positional arguments passed to the command.
-
kwargs
(dict[str, Any]
) –The keyword arguments passed to the command.
Source code in src/bijux_cli/services/plugins/hooks.py
shutdown async
¶
A hook that is called once when the CLI engine shuts down.
Plugins can use this hook to perform cleanup tasks, such as releasing resources or flushing buffers.
Source code in src/bijux_cli/services/plugins/hooks.py
startup async
¶
A hook that is called once when the CLI engine starts up.
Plugins can use this hook to perform initialization tasks, such as setting up resources or starting background tasks.