module

Noir::CLI::Catalog

The noir command surface: which top-level verbs exist, what each one does, and the fixed vocabulary that follows it.

Every consumer reads it from here — the router's dispatch, each command's -h page, noir help, and the zsh/bash/fish/elvish completion generators. Before this module the same six lists were written out in as many places (the router's verb list, noir help's target list, each command's ACTIONS, and once per shell in completions.cr), with nothing linking them: a renamed action stayed "valid" in three completion scripts, and a new subcommand had to be remembered in six files or it silently went uncompleted.

Constants

CACHE_ACTIONS = ["info", "clear", "purge"] of ::String
COMMANDS = [Command.new("scan", "Discover endpoints in one or more codebases", args: "[PATHS...]"), Command.new("trace", "Map a request to its route, guards, params and sinks", args: "\"<METHOD> <URL>\" [PATHS...]"), Command.new("reach", "List the endpoints that touch a source file", args: "<FILE[:LINE]> [PATHS...]"), Command.new("query", "Search the attack surface with AND-ed filters", args: "[FILTERS] [PATHS...]"), Command.new("list", "Enumerate built-in catalogs", LIST_SUBJECTS), Command.new("cache", "Manage the on-disk LLM response cache", CACHE_ACTIONS), Command.new("config", "Manage the user-level YAML configuration", CONFIG_ACTIONS), Command.new("rules", "Manage the passive-scan rules repository", RULES_ACTIONS), Command.new("completion", "Generate a shell completion script", SHELLS), Command.new("version", "Print version (or full build details)", args: "[--verbose]"), Command.new("help", "Show this overview or a command's help", args: "[command]")]
CONFIG_ACTIONS = ["show", "edit", "init", "path"] of ::String
LIST_SUBJECTS = ["techs", "taggers", "formats"] of ::String

Sub-action vocabularies. Each command module re-exports the one it owns, so CacheCommand::ACTIONS still reads naturally at its use site while the list itself lives in one place.

NAMES = COMMANDS.map(&.name)
RULES_ACTIONS = ["list", "update", "path"] of ::String
SCAN_LIKE = ["scan", "trace", "reach", "query"] of ::String

Verbs whose next word is a path or a scan flag rather than a fixed vocabulary: scan and the query verbs that ride its parser.

SHELLS = ["zsh", "bash", "fish", "elvish"] of ::String

Class methods

completable

The verb → next-word vocabulary pairs a completion script needs, in the order its case should test them. SCAN_LIKE verbs are excluded: scan is the fallback branch every shell falls through to, and the query verbs take its flags and paths too.

help completes the verb list itself, which is why this can't simply be Command#actions.

Source

Nested types