Skip to content

Fix Claude Code hook installer: use correct settings.json schema#29

Merged
msrdic merged 2 commits intomainfrom
fix-claude-hook-schema
Apr 15, 2026
Merged

Fix Claude Code hook installer: use correct settings.json schema#29
msrdic merged 2 commits intomainfrom
fix-claude-hook-schema

Conversation

@msrdic
Copy link
Copy Markdown
Owner

@msrdic msrdic commented Apr 15, 2026

The installer was writing a flat list of {event, command} objects, which is wrong. Claude Code expects:

{
  "hooks": {
    "UserPromptSubmit": [
      {
        "hooks": [{"type": "command", "command": "..."}]
      }
    ]
  }
}

Found by actually running pretty-please install-hook — the AttributeError: 'str' object has no attribute 'get' was caused by iterating over the dict keys instead of a list of hook objects.

🤖 Generated with Claude Code

msrdic added 2 commits April 16, 2026 01:48
Our installer wrote a flat list of {event, command} objects, but Claude
Code expects hooks as a dict keyed by event name, with each entry being
a list of matcher objects containing a nested hooks array:

    {
      "hooks": {
        "UserPromptSubmit": [
          {"hooks": [{"type": "command", "command": "..."}]}
        ]
      }
    }

Updates tests to assert the correct schema.
@msrdic msrdic merged commit 8f35b26 into main Apr 15, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant