@hasna/hooks 0.0.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.
Files changed (110) hide show
  1. package/.npmrc.example +2 -0
  2. package/AGENTS.md +54 -0
  3. package/CLAUDE.md +70 -0
  4. package/CONTRIBUTING.md +45 -0
  5. package/README.md +232 -0
  6. package/bin/index.js +5171 -0
  7. package/hooks/hook-agentmessages/CLAUDE.md +79 -0
  8. package/hooks/hook-agentmessages/LICENSE +21 -0
  9. package/hooks/hook-agentmessages/README.md +107 -0
  10. package/hooks/hook-agentmessages/package.json +31 -0
  11. package/hooks/hook-agentmessages/src/check-messages.ts +151 -0
  12. package/hooks/hook-agentmessages/src/install.ts +126 -0
  13. package/hooks/hook-agentmessages/src/session-start.ts +255 -0
  14. package/hooks/hook-agentmessages/src/uninstall.ts +89 -0
  15. package/hooks/hook-branchprotect/CLAUDE.md +23 -0
  16. package/hooks/hook-branchprotect/README.md +25 -0
  17. package/hooks/hook-branchprotect/package.json +42 -0
  18. package/hooks/hook-branchprotect/src/cli.ts +126 -0
  19. package/hooks/hook-branchprotect/src/hook.ts +88 -0
  20. package/hooks/hook-branchprotect/tsconfig.json +25 -0
  21. package/hooks/hook-checkbugs/LICENSE +21 -0
  22. package/hooks/hook-checkbugs/README.md +140 -0
  23. package/hooks/hook-checkbugs/package.json +58 -0
  24. package/hooks/hook-checkbugs/src/cli.ts +628 -0
  25. package/hooks/hook-checkbugs/src/hook.ts +335 -0
  26. package/hooks/hook-checkbugs/tsconfig.json +15 -0
  27. package/hooks/hook-checkdocs/README.md +137 -0
  28. package/hooks/hook-checkdocs/package.json +57 -0
  29. package/hooks/hook-checkdocs/src/cli.ts +628 -0
  30. package/hooks/hook-checkdocs/src/hook.ts +310 -0
  31. package/hooks/hook-checkdocs/tsconfig.json +15 -0
  32. package/hooks/hook-checkfiles/LICENSE +21 -0
  33. package/hooks/hook-checkfiles/README.md +141 -0
  34. package/hooks/hook-checkfiles/package.json +56 -0
  35. package/hooks/hook-checkfiles/src/cli.ts +545 -0
  36. package/hooks/hook-checkfiles/src/hook.ts +321 -0
  37. package/hooks/hook-checkfiles/tsconfig.json +15 -0
  38. package/hooks/hook-checklint/LICENSE +21 -0
  39. package/hooks/hook-checklint/README.md +147 -0
  40. package/hooks/hook-checklint/package.json +57 -0
  41. package/hooks/hook-checklint/src/cli-patch.ts +32 -0
  42. package/hooks/hook-checklint/src/cli.ts +667 -0
  43. package/hooks/hook-checklint/src/hook.ts +473 -0
  44. package/hooks/hook-checklint/tsconfig.json +15 -0
  45. package/hooks/hook-checkpoint/CLAUDE.md +23 -0
  46. package/hooks/hook-checkpoint/README.md +37 -0
  47. package/hooks/hook-checkpoint/package.json +58 -0
  48. package/hooks/hook-checkpoint/src/cli.ts +191 -0
  49. package/hooks/hook-checkpoint/src/hook.ts +207 -0
  50. package/hooks/hook-checkpoint/tsconfig.json +25 -0
  51. package/hooks/hook-checksecurity/LICENSE +21 -0
  52. package/hooks/hook-checksecurity/README.md +158 -0
  53. package/hooks/hook-checksecurity/package.json +57 -0
  54. package/hooks/hook-checksecurity/src/cli.ts +601 -0
  55. package/hooks/hook-checksecurity/src/hook.ts +334 -0
  56. package/hooks/hook-checksecurity/tsconfig.json +15 -0
  57. package/hooks/hook-checktasks/README.md +144 -0
  58. package/hooks/hook-checktasks/package.json +55 -0
  59. package/hooks/hook-checktasks/src/cli.ts +578 -0
  60. package/hooks/hook-checktasks/src/hook.ts +308 -0
  61. package/hooks/hook-checktasks/tsconfig.json +20 -0
  62. package/hooks/hook-checktests/LICENSE +21 -0
  63. package/hooks/hook-checktests/README.md +137 -0
  64. package/hooks/hook-checktests/package.json +57 -0
  65. package/hooks/hook-checktests/src/cli.ts +627 -0
  66. package/hooks/hook-checktests/src/hook.ts +334 -0
  67. package/hooks/hook-checktests/tsconfig.json +15 -0
  68. package/hooks/hook-contextrefresh/CLAUDE.md +23 -0
  69. package/hooks/hook-contextrefresh/README.md +42 -0
  70. package/hooks/hook-contextrefresh/package.json +42 -0
  71. package/hooks/hook-contextrefresh/src/cli.ts +152 -0
  72. package/hooks/hook-contextrefresh/src/hook.ts +148 -0
  73. package/hooks/hook-contextrefresh/tsconfig.json +25 -0
  74. package/hooks/hook-gitguard/CLAUDE.md +22 -0
  75. package/hooks/hook-gitguard/README.md +30 -0
  76. package/hooks/hook-gitguard/package.json +57 -0
  77. package/hooks/hook-gitguard/src/cli.ts +159 -0
  78. package/hooks/hook-gitguard/src/hook.ts +129 -0
  79. package/hooks/hook-gitguard/tsconfig.json +25 -0
  80. package/hooks/hook-packageage/CLAUDE.md +23 -0
  81. package/hooks/hook-packageage/README.md +33 -0
  82. package/hooks/hook-packageage/package.json +42 -0
  83. package/hooks/hook-packageage/src/cli.ts +165 -0
  84. package/hooks/hook-packageage/src/hook.ts +177 -0
  85. package/hooks/hook-packageage/tsconfig.json +25 -0
  86. package/hooks/hook-phonenotify/CLAUDE.md +25 -0
  87. package/hooks/hook-phonenotify/README.md +44 -0
  88. package/hooks/hook-phonenotify/package.json +42 -0
  89. package/hooks/hook-phonenotify/src/cli.ts +196 -0
  90. package/hooks/hook-phonenotify/src/hook.ts +139 -0
  91. package/hooks/hook-phonenotify/tsconfig.json +25 -0
  92. package/hooks/hook-precompact/CLAUDE.md +23 -0
  93. package/hooks/hook-precompact/README.md +36 -0
  94. package/hooks/hook-precompact/package.json +42 -0
  95. package/hooks/hook-precompact/src/cli.ts +168 -0
  96. package/hooks/hook-precompact/src/hook.ts +122 -0
  97. package/hooks/hook-precompact/tsconfig.json +25 -0
  98. package/package.json +61 -0
  99. package/src/cli/components/App.tsx +191 -0
  100. package/src/cli/components/CategorySelect.tsx +37 -0
  101. package/src/cli/components/DataTable.tsx +133 -0
  102. package/src/cli/components/Header.tsx +18 -0
  103. package/src/cli/components/HookSelect.tsx +29 -0
  104. package/src/cli/components/InstallProgress.tsx +105 -0
  105. package/src/cli/components/SearchView.tsx +86 -0
  106. package/src/cli/index.tsx +218 -0
  107. package/src/index.ts +31 -0
  108. package/src/lib/installer.ts +288 -0
  109. package/src/lib/registry.ts +205 -0
  110. package/tsconfig.json +17 -0
@@ -0,0 +1,205 @@
1
+ /**
2
+ * Hook registry - metadata about all available hooks
3
+ */
4
+
5
+ export interface HookMeta {
6
+ name: string;
7
+ displayName: string;
8
+ description: string;
9
+ version: string;
10
+ category: string;
11
+ event: "PreToolUse" | "PostToolUse" | "Stop" | "Notification";
12
+ matcher: string;
13
+ tags: string[];
14
+ }
15
+
16
+ export const CATEGORIES = [
17
+ "Git Safety",
18
+ "Code Quality",
19
+ "Security",
20
+ "Notifications",
21
+ "Context Management",
22
+ ] as const;
23
+
24
+ export type Category = (typeof CATEGORIES)[number];
25
+
26
+ export const HOOKS: HookMeta[] = [
27
+ // Git Safety
28
+ {
29
+ name: "gitguard",
30
+ displayName: "Git Guard",
31
+ description: "Blocks destructive git operations like reset --hard, push --force, clean -f",
32
+ version: "0.1.0",
33
+ category: "Git Safety",
34
+ event: "PreToolUse",
35
+ matcher: "Bash",
36
+ tags: ["git", "safety", "destructive", "guard"],
37
+ },
38
+ {
39
+ name: "branchprotect",
40
+ displayName: "Branch Protect",
41
+ description: "Prevents editing files directly on main/master branch",
42
+ version: "0.1.0",
43
+ category: "Git Safety",
44
+ event: "PreToolUse",
45
+ matcher: "Write|Edit|NotebookEdit",
46
+ tags: ["git", "branch", "protection", "main"],
47
+ },
48
+ {
49
+ name: "checkpoint",
50
+ displayName: "Checkpoint",
51
+ description: "Creates shadow git snapshots before file modifications for easy rollback",
52
+ version: "0.1.0",
53
+ category: "Git Safety",
54
+ event: "PreToolUse",
55
+ matcher: "Write|Edit|NotebookEdit",
56
+ tags: ["git", "snapshot", "rollback", "backup"],
57
+ },
58
+
59
+ // Code Quality
60
+ {
61
+ name: "checktests",
62
+ displayName: "Check Tests",
63
+ description: "Checks for missing tests after file edits",
64
+ version: "0.1.6",
65
+ category: "Code Quality",
66
+ event: "PostToolUse",
67
+ matcher: "Edit|Write|NotebookEdit",
68
+ tags: ["tests", "coverage", "quality"],
69
+ },
70
+ {
71
+ name: "checklint",
72
+ displayName: "Check Lint",
73
+ description: "Runs linting after file edits and creates tasks for errors",
74
+ version: "0.1.7",
75
+ category: "Code Quality",
76
+ event: "PostToolUse",
77
+ matcher: "Edit|Write|NotebookEdit",
78
+ tags: ["lint", "style", "quality"],
79
+ },
80
+ {
81
+ name: "checkfiles",
82
+ displayName: "Check Files",
83
+ description: "Runs headless agent to review files and create tasks",
84
+ version: "0.1.4",
85
+ category: "Code Quality",
86
+ event: "PostToolUse",
87
+ matcher: "Edit|Write|NotebookEdit",
88
+ tags: ["review", "files", "quality"],
89
+ },
90
+ {
91
+ name: "checkbugs",
92
+ displayName: "Check Bugs",
93
+ description: "Checks for bugs via Codex headless agent",
94
+ version: "0.1.6",
95
+ category: "Code Quality",
96
+ event: "PostToolUse",
97
+ matcher: "Edit|Write|NotebookEdit",
98
+ tags: ["bugs", "analysis", "quality"],
99
+ },
100
+ {
101
+ name: "checkdocs",
102
+ displayName: "Check Docs",
103
+ description: "Checks for missing documentation and creates tasks",
104
+ version: "0.2.1",
105
+ category: "Code Quality",
106
+ event: "PostToolUse",
107
+ matcher: "Edit|Write|NotebookEdit",
108
+ tags: ["docs", "documentation", "quality"],
109
+ },
110
+ {
111
+ name: "checktasks",
112
+ displayName: "Check Tasks",
113
+ description: "Validates task completion and tracks progress",
114
+ version: "1.0.8",
115
+ category: "Code Quality",
116
+ event: "PostToolUse",
117
+ matcher: "Edit|Write|NotebookEdit",
118
+ tags: ["tasks", "tracking", "quality"],
119
+ },
120
+
121
+ // Security
122
+ {
123
+ name: "checksecurity",
124
+ displayName: "Check Security",
125
+ description: "Runs security checks via Claude and Codex headless agents",
126
+ version: "0.1.6",
127
+ category: "Security",
128
+ event: "PostToolUse",
129
+ matcher: "Edit|Write|NotebookEdit",
130
+ tags: ["security", "audit", "vulnerabilities"],
131
+ },
132
+ {
133
+ name: "packageage",
134
+ displayName: "Package Age",
135
+ description: "Checks package age before install to prevent typosquatting",
136
+ version: "0.1.1",
137
+ category: "Security",
138
+ event: "PreToolUse",
139
+ matcher: "Bash",
140
+ tags: ["npm", "packages", "typosquatting", "supply-chain"],
141
+ },
142
+
143
+ // Notifications
144
+ {
145
+ name: "phonenotify",
146
+ displayName: "Phone Notify",
147
+ description: "Sends push notifications to phone via ntfy.sh",
148
+ version: "0.1.0",
149
+ category: "Notifications",
150
+ event: "Stop",
151
+ matcher: "",
152
+ tags: ["notification", "phone", "push", "ntfy"],
153
+ },
154
+ {
155
+ name: "agentmessages",
156
+ displayName: "Agent Messages",
157
+ description: "Inter-agent messaging integration for service-message",
158
+ version: "0.1.0",
159
+ category: "Notifications",
160
+ event: "Stop",
161
+ matcher: "",
162
+ tags: ["messaging", "agents", "inter-agent"],
163
+ },
164
+
165
+ // Context Management
166
+ {
167
+ name: "contextrefresh",
168
+ displayName: "Context Refresh",
169
+ description: "Re-injects important context every N prompts to prevent drift",
170
+ version: "0.1.0",
171
+ category: "Context Management",
172
+ event: "Notification",
173
+ matcher: "",
174
+ tags: ["context", "memory", "prompts", "refresh"],
175
+ },
176
+ {
177
+ name: "precompact",
178
+ displayName: "Pre-Compact",
179
+ description: "Saves session state before context compaction",
180
+ version: "0.1.0",
181
+ category: "Context Management",
182
+ event: "Notification",
183
+ matcher: "",
184
+ tags: ["context", "compaction", "state", "backup"],
185
+ },
186
+ ];
187
+
188
+ export function getHooksByCategory(category: Category): HookMeta[] {
189
+ return HOOKS.filter((h) => h.category === category);
190
+ }
191
+
192
+ export function searchHooks(query: string): HookMeta[] {
193
+ const q = query.toLowerCase();
194
+ return HOOKS.filter(
195
+ (h) =>
196
+ h.name.toLowerCase().includes(q) ||
197
+ h.displayName.toLowerCase().includes(q) ||
198
+ h.description.toLowerCase().includes(q) ||
199
+ h.tags.some((t) => t.includes(q))
200
+ );
201
+ }
202
+
203
+ export function getHook(name: string): HookMeta | undefined {
204
+ return HOOKS.find((h) => h.name === name);
205
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,17 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "ESNext",
5
+ "moduleResolution": "bundler",
6
+ "esModuleInterop": true,
7
+ "strict": true,
8
+ "skipLibCheck": true,
9
+ "declaration": true,
10
+ "outDir": "./dist",
11
+ "rootDir": "./src",
12
+ "jsx": "react-jsx",
13
+ "types": ["bun-types", "react"]
14
+ },
15
+ "include": ["src/**/*"],
16
+ "exclude": ["node_modules", "dist", "bin", "hooks", "temp"]
17
+ }