Skip to content

chore: adapt Claude Code setup from event-database-imports - #28

Merged
turegjorup merged 3 commits into
developfrom
feature/adapt-claude-setup-from-imports
Jul 7, 2026
Merged

chore: adapt Claude Code setup from event-database-imports#28
turegjorup merged 3 commits into
developfrom
feature/adapt-claude-setup-from-imports

Conversation

@turegjorup

Copy link
Copy Markdown
Contributor

Adapt the Claude Code tooling from the sibling event-database-imports PR #81 to this repo, scoped to the parts that apply to a read-only API.

Changes

  • .claude/settings.json
    • Fix the Edit/Write hooks: read the edited file path from the tool payload via jq (.tool_input.file_path) instead of $CLAUDE_FILE_PATH. Claude Code never sets that env var, so the previous formatting/blocking hooks silently no-oped.
    • SessionStart: warn when jq is missing on the host (the hooks now depend on it).
    • PreToolUse: widen the blocklist (symfony.lock, config/reference.php, vendor/, node_modules/, var/cache/), add the MultiEdit matcher, and use exit 2 so a blocked edit is actually rejected.
    • Stop: run scripts/claude-hook-check-index-contract.sh in addition to lint:container.
  • scripts/claude-hook-check-index-contract.sh — Stop-hook helper (mirror of the importer's, from the consumer side) that warns when src/Model/IndexName.php changes, since the importer duplicates the index-name contract by hand.
  • CLAUDE.md — add a "Works with event-database-imports" section (shared Elasticsearch contract, index lifecycle, hand-duplicated names/mappings) and a "Claude Code automation" reference.
  • CHANGELOG.md[Unreleased] entry.

Why

The repo's Claude hooks were carried over from an earlier setup that keyed on $CLAUDE_FILE_PATH; that variable isn't populated by Claude Code, so single-file auto-formatting and the lock-file guard never actually ran. The importer PR verified the jq-from-stdin mechanism, so this brings the same working approach here. The index-contract guard matters more on this side: the API has no mapping definitions of its own and trusts the fields/types the importer writes, so a contract change elsewhere can silently break filters/providers here.

Out of scope (deliberately not adapted)

  • Symfony AI Mate MCP — needs composer dev deps + generated files (mate/, AGENTS.md, bin/codex); low value for a read-only API with no service graph to introspect. Easy to add later if wanted.
  • create-migration / messenger-handler-reviewer / authorization-reviewer subagents — no Doctrine migrations, no Messenger pipeline, and only trivial API-key auth here.

Fix the Edit/Write hooks to read the file path from the tool payload via
jq instead of the unset CLAUDE_FILE_PATH env var (the previous hooks
silently no-oped), add a SessionStart jq prerequisite check, widen the
PreToolUse blocklist (symfony.lock, config/reference.php, vendor,
node_modules, var/cache), and add a Stop hook that warns when the shared
Elasticsearch index contract (src/Model/IndexName.php) changes. Document
the cross-repo relationship and the automation in CLAUDE.md.
@github-actions

Copy link
Copy Markdown

No changes detected in API specification

…de-setup-from-imports
# Conflicts:
#	CHANGELOG.md
@turegjorup
turegjorup merged commit 7074e11 into developJul 7, 2026
12 checks passed
@turegjorup
turegjorup deleted the feature/adapt-claude-setup-from-imports branch July 7, 2026 09:25
Sign up for freeto 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

@turegjorup