Clatter LabsHelp Center

How do I use hooks in Line CLI?

How-toUpdated

Add hooks to ~/.line/settings.json (yours) or .line/settings.json (project):

{
  "hooks": {
    "PreToolUse": [{ "matcher": "bash", "command": "./scripts/guard.sh" }],
    "PostToolUse": [{ "matcher": "edit_file|multi_edit|write_file", "command": "cargo fmt" }],
    "Stop": [{ "command": "./scripts/check.sh" }]
  }
}

Events#

PreToolUse, PostToolUse, UserPromptSubmit, Stop, SessionStart. matcher picks which tools a hook applies to.

Blocking#

A hook that exits with code 2 blocks the action; its stderr is given as the reason.

Trust#

Project hooks don't run until you review them and type /hooks trust. If .line/settings.json changes, Line asks again. /hooks lists active hooks.

Related articles

Still need help?

Tried the steps above and still stuck? Email us. We usually reply within the first hour, and always within 24 hours. A full support team is with you.

Infrastructure questions, or permanent deletion of your data
infrastructure@clatterlabs.xyz
For deleting your whole account or the data of one service.