{# QUAESTOR:version:1.0 #}
{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Write|Edit|MultiEdit",
        "hooks": [
          {
            "type": "command",
            "command": "{{ python_path }} {{ project_root }}/.quaestor/hooks/pre-implementation-declaration.py"
          }
        ]
      }
    ],
    "PostToolUse": [
      {
        "matcher": "Read|Grep",
        "hooks": [
          {
            "type": "command",
            "command": "{{ python_path }} {{ project_root }}/.quaestor/hooks/track-research.py {{ project_root }} \"${file_path}\""
          }
        ]
      },
      {
        "matcher": "Write|Edit|MultiEdit",
        "hooks": [
          {
            "type": "command",
            "command": "{{ python_path }} {{ project_root }}/.quaestor/hooks/track-implementation.py {{ project_root }}"
          }
        ]
      },
      {
        "matcher": "TodoWrite",
        "hooks": [
          {
            "type": "command",
            "command": "{{ python_path }} {{ project_root }}/.quaestor/hooks/update-memory.py {{ project_root }} --from-todos"
          }
        ]
      },
      {
        "matcher": "TodoWrite",
        "hooks": [
          {
            "type": "command",
            "command": "{{ python_path }} {{ project_root }}/.quaestor/hooks/todo-milestone-connector.py {{ project_root }}"
          }
        ]
      },
{% if project_type == "python" %}
      {
        "matcher": "Write|Edit|MultiEdit",
        "hooks": [
          {
            "type": "command",
            "command": "if [[ \"${file_path}\" == *.py ]]; then cd {{ project_root }} && ruff format \"${file_path}\" 2>/dev/null || true; fi"
          }
        ]
      },
{% elif project_type == "rust" %}
      {
        "matcher": "Write|Edit|MultiEdit",
        "hooks": [
          {
            "type": "command",
            "command": "if [[ \"${file_path}\" == *.rs ]]; then cd {{ project_root }} && rustfmt \"${file_path}\" 2>/dev/null || true; fi"
          }
        ]
      },
{% elif project_type == "javascript" %}
      {
        "matcher": "Write|Edit|MultiEdit",
        "hooks": [
          {
            "type": "command",
            "command": "if [[ \"${file_path}\" =~ \\.(js|jsx|ts|tsx)$ ]]; then cd {{ project_root }} && npx prettier --write \"${file_path}\" 2>/dev/null || true; fi"
          }
        ]
      },
{% endif %}
      {
        "matcher": "BashTool",
        "hooks": [
          {
            "type": "command",
            "command": "{{ python_path }} {{ project_root }}/.quaestor/hooks/file-change-tracker.py"
          }
        ]
      },
      {
        "matcher": ".*",
        "hooks": [
          {
            "type": "command",
            "command": "{{ python_path }} {{ project_root }}/.quaestor/hooks/comprehensive-compliance-check.py {{ project_root }}"
          }
        ]
      }
    ]
  }
}