Returns a data frame of all hooks configured in a coding agent's
settings.json file.
Usage
list_hooks(
path = NULL,
settings = NULL,
agent = NULL,
scope = c("project", "local", "global")
)Arguments
- path
The hooks directory. When supplied, the
filecolumn in the returned data frame will contain the path to the installed script file for hooks that were installed withadd_hook(). Can be one of:A known coding agent name to use that agent's conventional hooks path.
A character string giving the directory path directly.
NULL(the default), in which casefilewill beNAfor all rows.
- settings
Path to the
settings.jsonfile to read. WhenNULL(the default), resolved fromagent,scope, and theWF_AGENTenvironment variable.- agent, scope
Passed to
settings_path()to locate the settings file whensettingsisNULL. Defaults resolve to the project-scope settings of the detected coding agent.
Value
A data frame with columns:
event: the lifecycle event name (e.g."PreToolUse").matcher: the tool-name pattern, orNAif none.command: the shell command to execute.file: path to the installed script file, orNAif not tracked.
Examples
tmp <- tempfile(fileext = '.json')
register_hook('PreToolUse', 'echo hello', path = tmp)
#> Registered PreToolUse hook in /tmp/Rtmp1p0v0x/file1be57e5281b4.json.
list_hooks(settings = tmp)
#> event matcher command file
#> 1 PreToolUse <NA> echo hello <NA>
