@hasna/hooks 0.1.1 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +191 -0
- package/README.md +41 -6
- package/bin/index.js +61 -65
- package/dist/index.js +20 -14
- package/hooks/hook-agentmessages/CLAUDE.md +1 -1
- package/hooks/hook-agentmessages/LICENSE +191 -21
- package/hooks/hook-agentmessages/README.md +3 -3
- package/hooks/hook-agentmessages/package.json +5 -5
- package/hooks/hook-autoformat/README.md +1 -1
- package/hooks/hook-autoformat/package.json +1 -1
- package/hooks/hook-autoformat/tsconfig.json +25 -0
- package/hooks/hook-autostage/README.md +1 -1
- package/hooks/hook-autostage/package.json +1 -1
- package/hooks/hook-branchprotect/README.md +2 -2
- package/hooks/hook-branchprotect/package.json +4 -4
- package/hooks/hook-branchprotect/src/cli.ts +1 -1
- package/hooks/hook-branchprotect/tsconfig.json +25 -0
- package/hooks/hook-checkbugs/LICENSE +191 -21
- package/hooks/hook-checkbugs/README.md +5 -5
- package/hooks/hook-checkbugs/package.json +4 -4
- package/hooks/hook-checkbugs/src/cli.ts +2 -2
- package/hooks/hook-checkbugs/tsconfig.json +15 -0
- package/hooks/hook-checkdocs/README.md +5 -5
- package/hooks/hook-checkdocs/package.json +4 -4
- package/hooks/hook-checkdocs/src/cli.ts +2 -2
- package/hooks/hook-checkdocs/tsconfig.json +15 -0
- package/hooks/hook-checkfiles/LICENSE +191 -21
- package/hooks/hook-checkfiles/README.md +5 -5
- package/hooks/hook-checkfiles/package.json +4 -4
- package/hooks/hook-checkfiles/src/cli.ts +2 -2
- package/hooks/hook-checkfiles/tsconfig.json +15 -0
- package/hooks/hook-checklint/LICENSE +191 -21
- package/hooks/hook-checklint/README.md +5 -5
- package/hooks/hook-checklint/package.json +4 -4
- package/hooks/hook-checklint/src/cli.ts +2 -2
- package/hooks/hook-checklint/tsconfig.json +15 -0
- package/hooks/hook-checkpoint/README.md +2 -2
- package/hooks/hook-checkpoint/package.json +4 -4
- package/hooks/hook-checkpoint/src/cli.ts +1 -1
- package/hooks/hook-checkpoint/tsconfig.json +25 -0
- package/hooks/hook-checksecurity/LICENSE +191 -21
- package/hooks/hook-checksecurity/README.md +8 -8
- package/hooks/hook-checksecurity/package.json +4 -4
- package/hooks/hook-checksecurity/src/cli.ts +2 -2
- package/hooks/hook-checksecurity/tsconfig.json +15 -0
- package/hooks/hook-checktasks/README.md +5 -5
- package/hooks/hook-checktasks/package.json +4 -4
- package/hooks/hook-checktasks/src/cli.ts +2 -2
- package/hooks/hook-checktasks/tsconfig.json +20 -0
- package/hooks/hook-checktests/LICENSE +191 -21
- package/hooks/hook-checktests/README.md +5 -5
- package/hooks/hook-checktests/package.json +4 -4
- package/hooks/hook-checktests/src/cli.ts +2 -2
- package/hooks/hook-checktests/tsconfig.json +15 -0
- package/hooks/hook-commandlog/README.md +1 -1
- package/hooks/hook-commandlog/package.json +1 -1
- package/hooks/hook-contextrefresh/README.md +2 -2
- package/hooks/hook-contextrefresh/package.json +4 -4
- package/hooks/hook-contextrefresh/src/cli.ts +1 -1
- package/hooks/hook-contextrefresh/tsconfig.json +25 -0
- package/hooks/hook-costwatch/README.md +1 -1
- package/hooks/hook-costwatch/package.json +1 -1
- package/hooks/hook-desktopnotify/README.md +1 -1
- package/hooks/hook-desktopnotify/package.json +1 -1
- package/hooks/hook-desktopnotify/tsconfig.json +25 -0
- package/hooks/hook-envsetup/README.md +1 -1
- package/hooks/hook-envsetup/package.json +1 -1
- package/hooks/hook-envsetup/tsconfig.json +25 -0
- package/hooks/hook-errornotify/README.md +1 -1
- package/hooks/hook-errornotify/package.json +1 -1
- package/hooks/hook-gitguard/README.md +2 -2
- package/hooks/hook-gitguard/package.json +4 -4
- package/hooks/hook-gitguard/src/cli.ts +1 -1
- package/hooks/hook-gitguard/tsconfig.json +25 -0
- package/hooks/hook-packageage/README.md +2 -2
- package/hooks/hook-packageage/package.json +4 -4
- package/hooks/hook-packageage/src/cli.ts +1 -1
- package/hooks/hook-packageage/tsconfig.json +25 -0
- package/hooks/hook-permissionguard/README.md +1 -1
- package/hooks/hook-permissionguard/package.json +1 -1
- package/hooks/hook-permissionguard/tsconfig.json +25 -0
- package/hooks/hook-phonenotify/README.md +2 -2
- package/hooks/hook-phonenotify/package.json +4 -4
- package/hooks/hook-phonenotify/src/cli.ts +1 -1
- package/hooks/hook-phonenotify/tsconfig.json +25 -0
- package/hooks/hook-precompact/README.md +2 -2
- package/hooks/hook-precompact/package.json +4 -4
- package/hooks/hook-precompact/src/cli.ts +1 -1
- package/hooks/hook-precompact/tsconfig.json +25 -0
- package/hooks/hook-promptguard/README.md +1 -1
- package/hooks/hook-promptguard/package.json +1 -1
- package/hooks/hook-protectfiles/README.md +1 -1
- package/hooks/hook-protectfiles/package.json +1 -1
- package/hooks/hook-protectfiles/tsconfig.json +25 -0
- package/hooks/hook-sessionlog/README.md +1 -1
- package/hooks/hook-sessionlog/package.json +1 -1
- package/hooks/hook-slacknotify/README.md +1 -1
- package/hooks/hook-slacknotify/package.json +1 -1
- package/hooks/hook-soundnotify/README.md +1 -1
- package/hooks/hook-soundnotify/package.json +1 -1
- package/hooks/hook-taskgate/README.md +1 -1
- package/hooks/hook-taskgate/package.json +1 -1
- package/hooks/hook-tddguard/README.md +1 -1
- package/hooks/hook-tddguard/package.json +1 -1
- package/package.json +17 -3
- package/.claude/settings.json +0 -24
- package/.npmrc.example +0 -2
- package/AGENTS.md +0 -54
- package/CLAUDE.md +0 -70
- package/CONTRIBUTING.md +0 -45
- package/hooks/hook-agentmessages/bin/cli.ts +0 -125
package/LICENSE
ADDED
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to the Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by the Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding any notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
Copyright 2025 Hasna
|
|
180
|
+
|
|
181
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
182
|
+
you may not use this file except in compliance with the License.
|
|
183
|
+
You may obtain a copy of the License at
|
|
184
|
+
|
|
185
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
186
|
+
|
|
187
|
+
Unless required by applicable law or agreed to in writing, software
|
|
188
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
189
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
190
|
+
See the License for the specific language governing permissions and
|
|
191
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Hooks
|
|
2
2
|
|
|
3
|
-
Open source library of
|
|
3
|
+
Open source library of 30 Claude Code hooks. Install any hook with a single command.
|
|
4
4
|
|
|
5
5
|
## Quick Start
|
|
6
6
|
|
|
@@ -87,7 +87,7 @@ hooks list --registered
|
|
|
87
87
|
hooks remove gitguard
|
|
88
88
|
```
|
|
89
89
|
|
|
90
|
-
## Available Hooks (
|
|
90
|
+
## Available Hooks (30)
|
|
91
91
|
|
|
92
92
|
### Git Safety (3)
|
|
93
93
|
| Hook | Event | Description |
|
|
@@ -102,21 +102,24 @@ hooks remove gitguard
|
|
|
102
102
|
| checktests | PostToolUse | Checks for missing tests after file edits |
|
|
103
103
|
| checklint | PostToolUse | Runs linting after file edits and creates tasks for errors |
|
|
104
104
|
| checkfiles | PostToolUse | Runs headless agent to review files and create tasks |
|
|
105
|
-
| checkbugs | PostToolUse | Checks for bugs via
|
|
105
|
+
| checkbugs | PostToolUse | Checks for bugs via headless agent |
|
|
106
106
|
| checkdocs | PostToolUse | Checks for missing documentation and creates tasks |
|
|
107
107
|
| checktasks | PostToolUse | Validates task completion and tracks progress |
|
|
108
108
|
|
|
109
109
|
### Security (2)
|
|
110
110
|
| Hook | Event | Description |
|
|
111
111
|
|------|-------|-------------|
|
|
112
|
-
| checksecurity | PostToolUse | Runs security checks via
|
|
112
|
+
| checksecurity | PostToolUse | Runs security checks via headless agents |
|
|
113
113
|
| packageage | PreToolUse | Checks package age before install to prevent typosquatting |
|
|
114
114
|
|
|
115
|
-
### Notifications (
|
|
115
|
+
### Notifications (5)
|
|
116
116
|
| Hook | Event | Description |
|
|
117
117
|
|------|-------|-------------|
|
|
118
118
|
| phonenotify | Stop | Sends push notifications to phone via ntfy.sh |
|
|
119
119
|
| agentmessages | Stop | Inter-agent messaging integration for service-message |
|
|
120
|
+
| desktopnotify | Stop | Sends native desktop notifications via osascript (macOS) or notify-send (Linux) |
|
|
121
|
+
| slacknotify | Stop | Sends Slack webhook notifications when Claude finishes |
|
|
122
|
+
| soundnotify | Stop | Plays a system sound when Claude finishes (macOS/Linux) |
|
|
120
123
|
|
|
121
124
|
### Context Management (2)
|
|
122
125
|
| Hook | Event | Description |
|
|
@@ -124,6 +127,38 @@ hooks remove gitguard
|
|
|
124
127
|
| contextrefresh | Notification | Re-injects important context every N prompts to prevent drift |
|
|
125
128
|
| precompact | Notification | Saves session state before context compaction |
|
|
126
129
|
|
|
130
|
+
### Workflow Automation (3)
|
|
131
|
+
| Hook | Event | Description |
|
|
132
|
+
|------|-------|-------------|
|
|
133
|
+
| autoformat | PostToolUse | Runs project formatter (Prettier, Biome, Ruff, Black, gofmt) after file edits |
|
|
134
|
+
| autostage | PostToolUse | Automatically git-stages files after Claude edits them |
|
|
135
|
+
| tddguard | PreToolUse | Blocks implementation edits unless corresponding test files exist |
|
|
136
|
+
|
|
137
|
+
### Environment (1)
|
|
138
|
+
| Hook | Event | Description |
|
|
139
|
+
|------|-------|-------------|
|
|
140
|
+
| envsetup | PreToolUse | Warns when nvm, virtualenv, asdf, or rbenv may need activation before commands |
|
|
141
|
+
|
|
142
|
+
### Permissions (3)
|
|
143
|
+
| Hook | Event | Description |
|
|
144
|
+
|------|-------|-------------|
|
|
145
|
+
| permissionguard | PreToolUse | Auto-approves safe read-only commands and blocks dangerous operations |
|
|
146
|
+
| protectfiles | PreToolUse | Blocks access to .env, secrets, SSH keys, and lock files |
|
|
147
|
+
| promptguard | PreToolUse | Blocks prompt injection attempts and credential access requests |
|
|
148
|
+
|
|
149
|
+
### Observability (4)
|
|
150
|
+
| Hook | Event | Description |
|
|
151
|
+
|------|-------|-------------|
|
|
152
|
+
| sessionlog | PostToolUse | Logs every tool call to .claude/session-log-\<date\>.jsonl |
|
|
153
|
+
| commandlog | PostToolUse | Logs every bash command Claude runs to .claude/commands.log |
|
|
154
|
+
| costwatch | Stop | Estimates session token usage and warns when budget threshold is exceeded |
|
|
155
|
+
| errornotify | PostToolUse | Detects tool failures and logs errors to .claude/errors.log |
|
|
156
|
+
|
|
157
|
+
### Agent Teams (1)
|
|
158
|
+
| Hook | Event | Description |
|
|
159
|
+
|------|-------|-------------|
|
|
160
|
+
| taskgate | PostToolUse | Validates task completion criteria before allowing tasks to be marked done |
|
|
161
|
+
|
|
127
162
|
## How Hooks Work
|
|
128
163
|
|
|
129
164
|
Claude Code hooks are lifecycle interceptors that run during agent sessions:
|
|
@@ -229,4 +264,4 @@ bun run typecheck
|
|
|
229
264
|
|
|
230
265
|
## License
|
|
231
266
|
|
|
232
|
-
|
|
267
|
+
Apache-2.0
|
package/bin/index.js
CHANGED
|
@@ -1957,7 +1957,7 @@ var init_registry = __esm(() => {
|
|
|
1957
1957
|
{
|
|
1958
1958
|
name: "checkbugs",
|
|
1959
1959
|
displayName: "Check Bugs",
|
|
1960
|
-
description: "Checks for bugs via
|
|
1960
|
+
description: "Checks for bugs via headless agent",
|
|
1961
1961
|
version: "0.1.6",
|
|
1962
1962
|
category: "Code Quality",
|
|
1963
1963
|
event: "PostToolUse",
|
|
@@ -1987,7 +1987,7 @@ var init_registry = __esm(() => {
|
|
|
1987
1987
|
{
|
|
1988
1988
|
name: "checksecurity",
|
|
1989
1989
|
displayName: "Check Security",
|
|
1990
|
-
description: "Runs security checks via
|
|
1990
|
+
description: "Runs security checks via headless agents",
|
|
1991
1991
|
version: "0.1.6",
|
|
1992
1992
|
category: "Security",
|
|
1993
1993
|
event: "PostToolUse",
|
|
@@ -3842,6 +3842,15 @@ import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
|
3842
3842
|
import { join, dirname } from "path";
|
|
3843
3843
|
import { homedir } from "os";
|
|
3844
3844
|
import { fileURLToPath } from "url";
|
|
3845
|
+
function normalizeHookName(name) {
|
|
3846
|
+
return name.startsWith("hook-") ? name : `hook-${name}`;
|
|
3847
|
+
}
|
|
3848
|
+
function shortHookName(name) {
|
|
3849
|
+
return normalizeHookName(name).replace("hook-", "");
|
|
3850
|
+
}
|
|
3851
|
+
function removeHookEntries(entries, hookCommand) {
|
|
3852
|
+
return entries.filter((entry) => !entry.hooks?.some((h) => h.command === hookCommand));
|
|
3853
|
+
}
|
|
3845
3854
|
function getTargetSettingsDir(target) {
|
|
3846
3855
|
if (target === "gemini")
|
|
3847
3856
|
return ".gemini";
|
|
@@ -3855,8 +3864,7 @@ function getSettingsPath(scope = "global", target = "claude") {
|
|
|
3855
3864
|
return join(homedir(), dir, "settings.json");
|
|
3856
3865
|
}
|
|
3857
3866
|
function getHookPath(name) {
|
|
3858
|
-
|
|
3859
|
-
return join(HOOKS_DIR, hookName);
|
|
3867
|
+
return join(HOOKS_DIR, normalizeHookName(name));
|
|
3860
3868
|
}
|
|
3861
3869
|
function hookExists(name) {
|
|
3862
3870
|
return existsSync(getHookPath(name));
|
|
@@ -3867,7 +3875,9 @@ function readSettings(scope = "global", target = "claude") {
|
|
|
3867
3875
|
if (existsSync(path)) {
|
|
3868
3876
|
return JSON.parse(readFileSync(path, "utf-8"));
|
|
3869
3877
|
}
|
|
3870
|
-
} catch {
|
|
3878
|
+
} catch (error) {
|
|
3879
|
+
console.warn(`[hooks] Failed to read settings at ${path}: ${error instanceof Error ? error.message : String(error)}`);
|
|
3880
|
+
}
|
|
3871
3881
|
return {};
|
|
3872
3882
|
}
|
|
3873
3883
|
function writeSettings(settings, scope = "global", target = "claude") {
|
|
@@ -3883,8 +3893,7 @@ function getTargetEventName(internalEvent, target) {
|
|
|
3883
3893
|
return EVENT_MAP[target]?.[internalEvent] || internalEvent;
|
|
3884
3894
|
}
|
|
3885
3895
|
function installForTarget(name, scope, overwrite, target) {
|
|
3886
|
-
const
|
|
3887
|
-
const shortName = hookName.replace("hook-", "");
|
|
3896
|
+
const shortName = shortHookName(name);
|
|
3888
3897
|
if (!hookExists(shortName)) {
|
|
3889
3898
|
return { hook: shortName, success: false, error: `Hook '${shortName}' not found`, target };
|
|
3890
3899
|
}
|
|
@@ -3924,7 +3933,7 @@ function registerHook(name, scope = "global", target = "claude") {
|
|
|
3924
3933
|
if (!settings.hooks[eventKey])
|
|
3925
3934
|
settings.hooks[eventKey] = [];
|
|
3926
3935
|
const hookCommand = `hooks run ${name}`;
|
|
3927
|
-
settings.hooks[eventKey] = settings.hooks[eventKey]
|
|
3936
|
+
settings.hooks[eventKey] = removeHookEntries(settings.hooks[eventKey], hookCommand);
|
|
3928
3937
|
const entry = {
|
|
3929
3938
|
hooks: [{ type: "command", command: hookCommand }]
|
|
3930
3939
|
};
|
|
@@ -3945,7 +3954,7 @@ function unregisterHook(name, scope = "global", target = "claude") {
|
|
|
3945
3954
|
if (!settings.hooks[eventKey])
|
|
3946
3955
|
return;
|
|
3947
3956
|
const hookCommand = `hooks run ${name}`;
|
|
3948
|
-
settings.hooks[eventKey] = settings.hooks[eventKey]
|
|
3957
|
+
settings.hooks[eventKey] = removeHookEntries(settings.hooks[eventKey], hookCommand);
|
|
3949
3958
|
if (settings.hooks[eventKey].length === 0) {
|
|
3950
3959
|
delete settings.hooks[eventKey];
|
|
3951
3960
|
}
|
|
@@ -3976,12 +3985,8 @@ function getRegisteredHooksForTarget(scope = "global", target = "claude") {
|
|
|
3976
3985
|
function getRegisteredHooks(scope = "global") {
|
|
3977
3986
|
return getRegisteredHooksForTarget(scope, "claude");
|
|
3978
3987
|
}
|
|
3979
|
-
function getInstalledHooks(scope = "global") {
|
|
3980
|
-
return getRegisteredHooks(scope);
|
|
3981
|
-
}
|
|
3982
3988
|
function removeHook(name, scope = "global", target = "claude") {
|
|
3983
|
-
const
|
|
3984
|
-
const shortName = hookName.replace("hook-", "");
|
|
3989
|
+
const shortName = shortHookName(name);
|
|
3985
3990
|
if (target === "all") {
|
|
3986
3991
|
const claudeRemoved = removeHookForTarget(shortName, scope, "claude");
|
|
3987
3992
|
const geminiRemoved = removeHookForTarget(shortName, scope, "gemini");
|
|
@@ -3997,7 +4002,7 @@ function removeHookForTarget(name, scope, target) {
|
|
|
3997
4002
|
unregisterHook(name, scope, target);
|
|
3998
4003
|
return true;
|
|
3999
4004
|
}
|
|
4000
|
-
var __dirname2, HOOKS_DIR, EVENT_MAP;
|
|
4005
|
+
var __dirname2, HOOKS_DIR, EVENT_MAP, getInstalledHooks;
|
|
4001
4006
|
var init_installer = __esm(() => {
|
|
4002
4007
|
init_registry();
|
|
4003
4008
|
__dirname2 = dirname(fileURLToPath(import.meta.url));
|
|
@@ -4016,6 +4021,7 @@ var init_installer = __esm(() => {
|
|
|
4016
4021
|
Notification: "Notification"
|
|
4017
4022
|
}
|
|
4018
4023
|
};
|
|
4024
|
+
getInstalledHooks = getRegisteredHooks;
|
|
4019
4025
|
});
|
|
4020
4026
|
|
|
4021
4027
|
// src/mcp/server.ts
|
|
@@ -4032,11 +4038,22 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
|
|
|
4032
4038
|
import { z } from "zod";
|
|
4033
4039
|
import { createServer } from "http";
|
|
4034
4040
|
import { existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
|
|
4035
|
-
import { join as join2 } from "path";
|
|
4041
|
+
import { join as join2, dirname as dirname2 } from "path";
|
|
4042
|
+
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
4043
|
+
function formatInstallResults(results, extra) {
|
|
4044
|
+
const installed = results.filter((r) => r.success).map((r) => r.hook);
|
|
4045
|
+
const failed = results.filter((r) => !r.success).map((r) => ({ hook: r.hook, error: r.error }));
|
|
4046
|
+
return {
|
|
4047
|
+
content: [{
|
|
4048
|
+
type: "text",
|
|
4049
|
+
text: JSON.stringify({ installed, failed, total: results.length, success: installed.length, ...extra })
|
|
4050
|
+
}]
|
|
4051
|
+
};
|
|
4052
|
+
}
|
|
4036
4053
|
function createHooksServer() {
|
|
4037
4054
|
const server = new McpServer({
|
|
4038
4055
|
name: "@hasna/hooks",
|
|
4039
|
-
version:
|
|
4056
|
+
version: pkg.version
|
|
4040
4057
|
});
|
|
4041
4058
|
server.tool("hooks_list", "List all available hooks, optionally filtered by category", { category: z.string().optional().describe("Filter by category name (e.g. 'Git Safety', 'Code Quality', 'Security', 'Notifications', 'Context Management')") }, async ({ category }) => {
|
|
4042
4059
|
if (category) {
|
|
@@ -4071,18 +4088,7 @@ function createHooksServer() {
|
|
|
4071
4088
|
overwrite: z.boolean().default(false).describe("Overwrite if already installed")
|
|
4072
4089
|
}, async ({ hooks, scope, overwrite }) => {
|
|
4073
4090
|
const results = hooks.map((name) => installHook(name, { scope, overwrite }));
|
|
4074
|
-
return {
|
|
4075
|
-
content: [{
|
|
4076
|
-
type: "text",
|
|
4077
|
-
text: JSON.stringify({
|
|
4078
|
-
installed: results.filter((r) => r.success).map((r) => r.hook),
|
|
4079
|
-
failed: results.filter((r) => !r.success).map((r) => ({ hook: r.hook, error: r.error })),
|
|
4080
|
-
total: results.length,
|
|
4081
|
-
success: results.filter((r) => r.success).length,
|
|
4082
|
-
scope
|
|
4083
|
-
})
|
|
4084
|
-
}]
|
|
4085
|
-
};
|
|
4091
|
+
return formatInstallResults(results, { scope });
|
|
4086
4092
|
});
|
|
4087
4093
|
server.tool("hooks_install_category", "Install all hooks in a category", {
|
|
4088
4094
|
category: z.string().describe("Category name"),
|
|
@@ -4095,35 +4101,14 @@ function createHooksServer() {
|
|
|
4095
4101
|
}
|
|
4096
4102
|
const hooks = getHooksByCategory(cat).map((h) => h.name);
|
|
4097
4103
|
const results = hooks.map((name) => installHook(name, { scope, overwrite }));
|
|
4098
|
-
return {
|
|
4099
|
-
content: [{
|
|
4100
|
-
type: "text",
|
|
4101
|
-
text: JSON.stringify({
|
|
4102
|
-
installed: results.filter((r) => r.success).map((r) => r.hook),
|
|
4103
|
-
failed: results.filter((r) => !r.success).map((r) => ({ hook: r.hook, error: r.error })),
|
|
4104
|
-
category: cat,
|
|
4105
|
-
scope
|
|
4106
|
-
})
|
|
4107
|
-
}]
|
|
4108
|
-
};
|
|
4104
|
+
return formatInstallResults(results, { category: cat, scope });
|
|
4109
4105
|
});
|
|
4110
4106
|
server.tool("hooks_install_all", "Install all available hooks", {
|
|
4111
4107
|
scope: z.enum(["global", "project"]).default("global").describe("Install scope"),
|
|
4112
4108
|
overwrite: z.boolean().default(false).describe("Overwrite if already installed")
|
|
4113
4109
|
}, async ({ scope, overwrite }) => {
|
|
4114
4110
|
const results = HOOKS.map((h) => installHook(h.name, { scope, overwrite }));
|
|
4115
|
-
return {
|
|
4116
|
-
content: [{
|
|
4117
|
-
type: "text",
|
|
4118
|
-
text: JSON.stringify({
|
|
4119
|
-
installed: results.filter((r) => r.success).map((r) => r.hook),
|
|
4120
|
-
failed: results.filter((r) => !r.success).map((r) => ({ hook: r.hook, error: r.error })),
|
|
4121
|
-
total: results.length,
|
|
4122
|
-
success: results.filter((r) => r.success).length,
|
|
4123
|
-
scope
|
|
4124
|
-
})
|
|
4125
|
-
}]
|
|
4126
|
-
};
|
|
4111
|
+
return formatInstallResults(results, { scope });
|
|
4127
4112
|
});
|
|
4128
4113
|
server.tool("hooks_remove", "Remove (unregister) a hook from agent settings", {
|
|
4129
4114
|
name: z.string().describe("Hook name to remove"),
|
|
@@ -4252,7 +4237,7 @@ async function startSSEServer(port = MCP_PORT) {
|
|
|
4252
4237
|
await transport.handlePostMessage(req, res, body);
|
|
4253
4238
|
} else {
|
|
4254
4239
|
res.writeHead(200, { "Content-Type": "application/json" });
|
|
4255
|
-
res.end(JSON.stringify({ name: "@hasna/hooks", version:
|
|
4240
|
+
res.end(JSON.stringify({ name: "@hasna/hooks", version: pkg.version, transport: "sse", port }));
|
|
4256
4241
|
}
|
|
4257
4242
|
});
|
|
4258
4243
|
httpServer.listen(port, () => {
|
|
@@ -4265,10 +4250,12 @@ async function startStdioServer() {
|
|
|
4265
4250
|
const transport = new StdioServerTransport;
|
|
4266
4251
|
await server.connect(transport);
|
|
4267
4252
|
}
|
|
4268
|
-
var MCP_PORT = 39427;
|
|
4253
|
+
var __dirname3, pkg, MCP_PORT = 39427;
|
|
4269
4254
|
var init_server = __esm(() => {
|
|
4270
4255
|
init_registry();
|
|
4271
4256
|
init_installer();
|
|
4257
|
+
__dirname3 = dirname2(fileURLToPath2(import.meta.url));
|
|
4258
|
+
pkg = JSON.parse(readFileSync2(join2(__dirname3, "..", "..", "package.json"), "utf-8"));
|
|
4272
4259
|
});
|
|
4273
4260
|
|
|
4274
4261
|
// src/cli/index.tsx
|
|
@@ -4293,7 +4280,8 @@ var {
|
|
|
4293
4280
|
// src/cli/index.tsx
|
|
4294
4281
|
import chalk2 from "chalk";
|
|
4295
4282
|
import { existsSync as existsSync3, readFileSync as readFileSync3 } from "fs";
|
|
4296
|
-
import { join as join3 } from "path";
|
|
4283
|
+
import { join as join3, dirname as dirname3 } from "path";
|
|
4284
|
+
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
4297
4285
|
|
|
4298
4286
|
// src/cli/components/App.tsx
|
|
4299
4287
|
import { useState as useState7 } from "react";
|
|
@@ -4745,10 +4733,12 @@ function CategorySelect({ onSelect, onBack }) {
|
|
|
4745
4733
|
return /* @__PURE__ */ jsxDEV2(Box4, {
|
|
4746
4734
|
flexDirection: "column",
|
|
4747
4735
|
children: [
|
|
4748
|
-
/* @__PURE__ */ jsxDEV2(
|
|
4749
|
-
bold: true,
|
|
4736
|
+
/* @__PURE__ */ jsxDEV2(Box4, {
|
|
4750
4737
|
marginBottom: 1,
|
|
4751
|
-
children:
|
|
4738
|
+
children: /* @__PURE__ */ jsxDEV2(Text4, {
|
|
4739
|
+
bold: true,
|
|
4740
|
+
children: "Select a category:"
|
|
4741
|
+
}, undefined, false, undefined, this)
|
|
4752
4742
|
}, undefined, false, undefined, this),
|
|
4753
4743
|
/* @__PURE__ */ jsxDEV2(SelectInput_default, {
|
|
4754
4744
|
items,
|
|
@@ -5311,9 +5301,11 @@ function App({ initialHooks, overwrite = false }) {
|
|
|
5311
5301
|
view === "main" && /* @__PURE__ */ jsxDEV7(Box8, {
|
|
5312
5302
|
flexDirection: "column",
|
|
5313
5303
|
children: [
|
|
5314
|
-
/* @__PURE__ */ jsxDEV7(
|
|
5304
|
+
/* @__PURE__ */ jsxDEV7(Box8, {
|
|
5315
5305
|
marginBottom: 1,
|
|
5316
|
-
children:
|
|
5306
|
+
children: /* @__PURE__ */ jsxDEV7(Text10, {
|
|
5307
|
+
children: "What would you like to do?"
|
|
5308
|
+
}, undefined, false, undefined, this)
|
|
5317
5309
|
}, undefined, false, undefined, this),
|
|
5318
5310
|
/* @__PURE__ */ jsxDEV7(SelectInput_default, {
|
|
5319
5311
|
items: mainMenuItems,
|
|
@@ -5359,11 +5351,13 @@ function App({ initialHooks, overwrite = false }) {
|
|
|
5359
5351
|
view === "done" && /* @__PURE__ */ jsxDEV7(Box8, {
|
|
5360
5352
|
flexDirection: "column",
|
|
5361
5353
|
children: [
|
|
5362
|
-
/* @__PURE__ */ jsxDEV7(
|
|
5363
|
-
bold: true,
|
|
5364
|
-
color: "green",
|
|
5354
|
+
/* @__PURE__ */ jsxDEV7(Box8, {
|
|
5365
5355
|
marginBottom: 1,
|
|
5366
|
-
children:
|
|
5356
|
+
children: /* @__PURE__ */ jsxDEV7(Text10, {
|
|
5357
|
+
bold: true,
|
|
5358
|
+
color: "green",
|
|
5359
|
+
children: "Installation complete!"
|
|
5360
|
+
}, undefined, false, undefined, this)
|
|
5367
5361
|
}, undefined, false, undefined, this),
|
|
5368
5362
|
results.filter((r) => r.success).length > 0 && /* @__PURE__ */ jsxDEV7(Box8, {
|
|
5369
5363
|
flexDirection: "column",
|
|
@@ -5462,13 +5456,15 @@ function App({ initialHooks, overwrite = false }) {
|
|
|
5462
5456
|
init_registry();
|
|
5463
5457
|
init_installer();
|
|
5464
5458
|
import { jsxDEV as jsxDEV8 } from "react/jsx-dev-runtime";
|
|
5459
|
+
var __dirname4 = dirname3(fileURLToPath3(import.meta.url));
|
|
5460
|
+
var pkg2 = JSON.parse(readFileSync3(join3(__dirname4, "..", "package.json"), "utf-8"));
|
|
5465
5461
|
var program2 = new Command;
|
|
5466
5462
|
function resolveScope(options) {
|
|
5467
5463
|
if (options.project)
|
|
5468
5464
|
return "project";
|
|
5469
5465
|
return "global";
|
|
5470
5466
|
}
|
|
5471
|
-
program2.name("hooks").description("Install hooks for AI coding agents").version(
|
|
5467
|
+
program2.name("hooks").description("Install hooks for AI coding agents").version(pkg2.version);
|
|
5472
5468
|
program2.command("interactive", { isDefault: true }).alias("i").description("Interactive hook browser").action(() => {
|
|
5473
5469
|
render(/* @__PURE__ */ jsxDEV8(App, {}, undefined, false, undefined, this));
|
|
5474
5470
|
});
|
package/dist/index.js
CHANGED
|
@@ -76,7 +76,7 @@ var HOOKS = [
|
|
|
76
76
|
{
|
|
77
77
|
name: "checkbugs",
|
|
78
78
|
displayName: "Check Bugs",
|
|
79
|
-
description: "Checks for bugs via
|
|
79
|
+
description: "Checks for bugs via headless agent",
|
|
80
80
|
version: "0.1.6",
|
|
81
81
|
category: "Code Quality",
|
|
82
82
|
event: "PostToolUse",
|
|
@@ -106,7 +106,7 @@ var HOOKS = [
|
|
|
106
106
|
{
|
|
107
107
|
name: "checksecurity",
|
|
108
108
|
displayName: "Check Security",
|
|
109
|
-
description: "Runs security checks via
|
|
109
|
+
description: "Runs security checks via headless agents",
|
|
110
110
|
version: "0.1.6",
|
|
111
111
|
category: "Security",
|
|
112
112
|
event: "PostToolUse",
|
|
@@ -331,6 +331,15 @@ import { homedir } from "os";
|
|
|
331
331
|
import { fileURLToPath } from "url";
|
|
332
332
|
var __dirname2 = dirname(fileURLToPath(import.meta.url));
|
|
333
333
|
var HOOKS_DIR = existsSync(join(__dirname2, "..", "..", "hooks", "hook-gitguard")) ? join(__dirname2, "..", "..", "hooks") : join(__dirname2, "..", "hooks");
|
|
334
|
+
function normalizeHookName(name) {
|
|
335
|
+
return name.startsWith("hook-") ? name : `hook-${name}`;
|
|
336
|
+
}
|
|
337
|
+
function shortHookName(name) {
|
|
338
|
+
return normalizeHookName(name).replace("hook-", "");
|
|
339
|
+
}
|
|
340
|
+
function removeHookEntries(entries, hookCommand) {
|
|
341
|
+
return entries.filter((entry) => !entry.hooks?.some((h) => h.command === hookCommand));
|
|
342
|
+
}
|
|
334
343
|
var EVENT_MAP = {
|
|
335
344
|
claude: {
|
|
336
345
|
PreToolUse: "PreToolUse",
|
|
@@ -358,8 +367,7 @@ function getSettingsPath(scope = "global", target = "claude") {
|
|
|
358
367
|
return join(homedir(), dir, "settings.json");
|
|
359
368
|
}
|
|
360
369
|
function getHookPath(name) {
|
|
361
|
-
|
|
362
|
-
return join(HOOKS_DIR, hookName);
|
|
370
|
+
return join(HOOKS_DIR, normalizeHookName(name));
|
|
363
371
|
}
|
|
364
372
|
function hookExists(name) {
|
|
365
373
|
return existsSync(getHookPath(name));
|
|
@@ -370,7 +378,9 @@ function readSettings(scope = "global", target = "claude") {
|
|
|
370
378
|
if (existsSync(path)) {
|
|
371
379
|
return JSON.parse(readFileSync(path, "utf-8"));
|
|
372
380
|
}
|
|
373
|
-
} catch {
|
|
381
|
+
} catch (error) {
|
|
382
|
+
console.warn(`[hooks] Failed to read settings at ${path}: ${error instanceof Error ? error.message : String(error)}`);
|
|
383
|
+
}
|
|
374
384
|
return {};
|
|
375
385
|
}
|
|
376
386
|
function writeSettings(settings, scope = "global", target = "claude") {
|
|
@@ -386,8 +396,7 @@ function getTargetEventName(internalEvent, target) {
|
|
|
386
396
|
return EVENT_MAP[target]?.[internalEvent] || internalEvent;
|
|
387
397
|
}
|
|
388
398
|
function installForTarget(name, scope, overwrite, target) {
|
|
389
|
-
const
|
|
390
|
-
const shortName = hookName.replace("hook-", "");
|
|
399
|
+
const shortName = shortHookName(name);
|
|
391
400
|
if (!hookExists(shortName)) {
|
|
392
401
|
return { hook: shortName, success: false, error: `Hook '${shortName}' not found`, target };
|
|
393
402
|
}
|
|
@@ -427,7 +436,7 @@ function registerHook(name, scope = "global", target = "claude") {
|
|
|
427
436
|
if (!settings.hooks[eventKey])
|
|
428
437
|
settings.hooks[eventKey] = [];
|
|
429
438
|
const hookCommand = `hooks run ${name}`;
|
|
430
|
-
settings.hooks[eventKey] = settings.hooks[eventKey]
|
|
439
|
+
settings.hooks[eventKey] = removeHookEntries(settings.hooks[eventKey], hookCommand);
|
|
431
440
|
const entry = {
|
|
432
441
|
hooks: [{ type: "command", command: hookCommand }]
|
|
433
442
|
};
|
|
@@ -448,7 +457,7 @@ function unregisterHook(name, scope = "global", target = "claude") {
|
|
|
448
457
|
if (!settings.hooks[eventKey])
|
|
449
458
|
return;
|
|
450
459
|
const hookCommand = `hooks run ${name}`;
|
|
451
|
-
settings.hooks[eventKey] = settings.hooks[eventKey]
|
|
460
|
+
settings.hooks[eventKey] = removeHookEntries(settings.hooks[eventKey], hookCommand);
|
|
452
461
|
if (settings.hooks[eventKey].length === 0) {
|
|
453
462
|
delete settings.hooks[eventKey];
|
|
454
463
|
}
|
|
@@ -482,12 +491,9 @@ function getRegisteredHooksForTarget(scope = "global", target = "claude") {
|
|
|
482
491
|
function getRegisteredHooks(scope = "global") {
|
|
483
492
|
return getRegisteredHooksForTarget(scope, "claude");
|
|
484
493
|
}
|
|
485
|
-
|
|
486
|
-
return getRegisteredHooks(scope);
|
|
487
|
-
}
|
|
494
|
+
var getInstalledHooks = getRegisteredHooks;
|
|
488
495
|
function removeHook(name, scope = "global", target = "claude") {
|
|
489
|
-
const
|
|
490
|
-
const shortName = hookName.replace("hook-", "");
|
|
496
|
+
const shortName = shortHookName(name);
|
|
491
497
|
if (target === "all") {
|
|
492
498
|
const claudeRemoved = removeHookForTarget(shortName, scope, "claude");
|
|
493
499
|
const geminiRemoved = removeHookForTarget(shortName, scope, "gemini");
|