Summary
A command's handler= attribute is checked as a syntactically legal Bash identifier when the command is declared, but whether that function actually exists is only checked with declare -F when base_cli_run dispatches to it (lib/bash/cli/lib_cli.sh:854-859).
Details
This means a typo'd handler name (e.g. handler=hanlde_status instead of handler=handle_status) passes declaration cleanly and only surfaces as a runtime failure the first time a user actually invokes that specific subcommand — far from where the mistake was made, and easy to miss in manual testing if a command is rarely exercised.
Impact
CLI authors get no early signal that a command is wired to a non-existent function; the failure mode is "command silently broken until someone runs it," discovered by an end user rather than at declare time or in CI.
Suggested fix
Add an optional eager validation pass (e.g. invoked from base_cli_model_init completion, or a dedicated base_cli_validate_model the author can call in tests/CI) that walks every declared command and confirms its handler resolves via declare -F before the CLI ever ships.
Summary
A command's
handler=attribute is checked as a syntactically legal Bash identifier when the command is declared, but whether that function actually exists is only checked withdeclare -Fwhenbase_cli_rundispatches to it (lib/bash/cli/lib_cli.sh:854-859).Details
This means a typo'd handler name (e.g.
handler=hanlde_statusinstead ofhandler=handle_status) passes declaration cleanly and only surfaces as a runtime failure the first time a user actually invokes that specific subcommand — far from where the mistake was made, and easy to miss in manual testing if a command is rarely exercised.Impact
CLI authors get no early signal that a command is wired to a non-existent function; the failure mode is "command silently broken until someone runs it," discovered by an end user rather than at declare time or in CI.
Suggested fix
Add an optional eager validation pass (e.g. invoked from
base_cli_model_initcompletion, or a dedicatedbase_cli_validate_modelthe author can call in tests/CI) that walks every declared command and confirms itshandlerresolves viadeclare -Fbefore the CLI ever ships.