Skip to content

feat(cli): add native agent hook installer#452

Open
aidenybai wants to merge 5 commits into
mainfrom
feat/agent-hooks
Open

feat(cli): add native agent hook installer#452
aidenybai wants to merge 5 commits into
mainfrom
feat/agent-hooks

Conversation

@aidenybai
Copy link
Copy Markdown
Member

@aidenybai aidenybai commented May 23, 2026

Summary

  • Add react-doctor install --agent-hooks for project-level Claude Code and Cursor hooks that surface React Doctor findings after agent edits.
  • Keep the existing skill install flow and non-blocking Git pre-commit hook support, with docs covering agent hooks and CI setup.
  • Add focused installer tests for CLI option forwarding, hook config merging, executable scripts, and Git hook installation.

Test plan

  • nr test -- tests/install-agent-hooks.test.ts tests/install-skill.test.ts tests/install-action.test.ts
  • nr typecheck
  • nr lint

Note

Medium Risk
Adds file-writing installers for Git hooks and agent hook configs/scripts, which can affect developer workflows if paths/merging logic misbehaves. Changes are localized to the install command and are covered by new integration-style tests.

Overview
Extends react-doctor install with an --agent-hooks option that installs native, non-blocking post-edit hooks for Claude Code and Cursor, generating a react-doctor runner script and updating each agent’s hook config without duplicating entries.

Adds an optional dependency-free Git pre-commit hook installer: detects the correct hook location (including core.hooksPath), writes a managed .react-doctor/hooks/pre-commit runner that scans staged files with --fail-on none, and merges/updates a managed block into an existing hook while preserving user content.

Updates README/CLI help and expands test coverage to validate option forwarding, hook config merging, executable permissions, Git target detection, and real git commit behavior.

Reviewed by Cursor Bugbot for commit 089d024. Bugbot is set up for automated code reviews on this repo. Configure here.

Adds opt-in Claude Code and Cursor lifecycle hooks alongside the existing skill and Git hook installer so agents can surface React Doctor regressions after edits.
@reactreview
Copy link
Copy Markdown

reactreview Bot commented May 23, 2026

No new issues

Reviewed by reactreview for commit 089d024. Configure here.

Comment thread packages/react-doctor/src/cli/utils/install-git-hook.ts
Adds a regression test showing Git's relative hook path resolves to the repository hook directory when install runs below the repo root.
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit b3c6b2e. Configure here.

Comment thread packages/react-doctor/src/cli/utils/install-agent-hooks.ts
aidenybai added 3 commits May 23, 2026 02:47
Applies repository formatting so CI format checks pass for the new agent hook utility.
Anchors generated Claude Code and Cursor hooks to the project root before resolving the local React Doctor binary or running diff scans.
Covers real Git hook execution paths, CI install behavior, generated agent hook fallbacks, and hardens malformed hook input handling.
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