←back to thread

Claude Code now supports hooks

(docs.anthropic.com)
381 points ramoz | 5 comments | | HN request time: 0.509s | source
1. parhamn ◴[] No.44429511[source]
This needs a way to match directories for changes in monorepos. E.g. run this linter only if there were changes in this directory.
replies(4): >>44429545 #>>44429877 #>>44430548 #>>44434392 #
2. ramoz ◴[] No.44429545[source]
An abstraction via a script should work, right? They document that it pipes the JSON data to your command's stdin,

  ```lint-monorepo.sh

  # read that data
  json_input=$(cat)

  # do some parsing here with jq, get the file path (file_path)

  if [$file_path" == "$dir1"*]
    run lint_for_dir1
  ```
3. brynary ◴[] No.44429877[source]
This can be implemented at the line level if the linter is Git aware
4. dcre ◴[] No.44430548[source]
Whatever you run in the hook can check whatever conditions you want.
5. tinodb ◴[] No.44434392[source]
Set up pre-commit and call that from a hook? That's what we have