Skip to content

feat: look up hooks by tag - #231

Merged
jaredwray merged 1 commit into
mainfrom
cursor/hook-tags-71c0
Oct 21, 2026
Merged

jaredwray merged 1 commit into
mainfrom
cursor/hook-tags-71c0

Conversation

@jaredwray

Copy link
Copy Markdown
Owner

Please check if the PR fulfills these requirements

  • Followed the Contributing and Code of Conduct guidelines.
  • Tests for the changes have been added (for bug fixes/features) with 100% code coverage.

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)

Feature. Hooks can be tagged with a string array and looked up across events.

Summary

  • IHook.tags is an optional string[]. Hook, WaterfallHook, and ParallelHook accept it as an optional fourth constructor argument.
  • Registration validates, copies, and de-duplicates tags. Invalid tags throw a TypeError and the hook is not stored.
  • getHooksByTag(tag | tags) returns hooks that have any of the given tags, in storage order.
  • getTaggedHooks() returns a Map of every tag to the hooks that have it.

Test plan

  • Biome check clean
  • Vitest: 361 tests passed, 100% statement, branch, function, and line coverage
  • Type declarations include tags, getHooksByTag, and getTaggedHooks
Open in Web Open in Cursor 

Hooks can carry a string array of tags. getHooksByTag finds hooks by one tag or any of several, and getTaggedHooks returns a map of every tag to its hooks.

Co-authored-by: Jared Wray <me@jaredwray.com>
@codecov

codecov Bot commented Oct 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (cc4302c) to head (89166d8).

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #231   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            5         5           
  Lines          434       475   +41     
  Branches       110       122   +12     
=========================================
+ Hits           434       475   +41     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jaredwray
jaredwray marked this pull request as ready for review October 21, 2026 23:27
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review 🔄 Running since 2026-10-21T23:27:28.665431Z 89166d8 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@jaredwray
jaredwray merged commit 3caf159 into main Oct 21, 2026
14 checks passed
@jaredwray
jaredwray deleted the cursor/hook-tags-71c0 branch October 21, 2026 23:28
@jaredwray jaredwray mentioned this pull request Oct 21, 2026
4 tasks done
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.

2 participants