cloudpanel.command
Inspect, mutate, or cancel CloudPanel CLI commands before clpctl runs.
Use this hook for policy enforcement and defaults. The command name is read-only; only the JSON args can be changed.
Pipeline
Hooks run in plugin load order. Mutated args become input for the next CloudPanel hook.
Use cases
- Block destructive CloudPanel operations
- Inject default paths
- Rewrite domains for staging
Example
Registration and handler
Register
hook_cloudpanel!(host, on_cloudpanel_command);Handler
extern "C" fn on_cloudpanel_command(ctx: *const CloudPanelCommandContext) -> i32 {
let ctx = unsafe { &*ctx };
let command = unsafe { std::slice::from_raw_parts(ctx.command_ptr, ctx.command_len) };
if command == b"site:delete" {
return write_cloudpanel_cancel(ctx, b"site deletion blocked");
}
CLOUDPANEL_CONTINUE
}