@tecet/ollm 0.1.4 → 0.1.5

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 (86) hide show
  1. package/dist/cli.js +20 -14
  2. package/dist/cli.js.map +3 -3
  3. package/dist/services/documentService.d.ts.map +1 -1
  4. package/dist/services/documentService.js +12 -2
  5. package/dist/services/documentService.js.map +1 -1
  6. package/dist/ui/components/docs/DocsPanel.d.ts.map +1 -1
  7. package/dist/ui/components/docs/DocsPanel.js +1 -1
  8. package/dist/ui/components/docs/DocsPanel.js.map +1 -1
  9. package/dist/ui/components/launch/VersionBanner.js +1 -1
  10. package/dist/ui/components/launch/VersionBanner.js.map +1 -1
  11. package/dist/ui/components/layout/KeybindsLegend.d.ts.map +1 -1
  12. package/dist/ui/components/layout/KeybindsLegend.js +1 -1
  13. package/dist/ui/components/layout/KeybindsLegend.js.map +1 -1
  14. package/dist/ui/components/tabs/BugReportTab.js +1 -1
  15. package/dist/ui/components/tabs/BugReportTab.js.map +1 -1
  16. package/dist/ui/services/docsService.d.ts +12 -27
  17. package/dist/ui/services/docsService.d.ts.map +1 -1
  18. package/dist/ui/services/docsService.js +40 -67
  19. package/dist/ui/services/docsService.js.map +1 -1
  20. package/docs/README.md +3 -410
  21. package/package.json +10 -7
  22. package/scripts/copy-docs-to-user.cjs +34 -0
  23. package/docs/Context/CheckpointFlowDiagram.md +0 -673
  24. package/docs/Context/ContextArchitecture.md +0 -898
  25. package/docs/Context/ContextCompression.md +0 -1102
  26. package/docs/Context/ContextManagment.md +0 -750
  27. package/docs/Context/Index.md +0 -209
  28. package/docs/Context/README.md +0 -390
  29. package/docs/DevelopmentRoadmap/Index.md +0 -238
  30. package/docs/DevelopmentRoadmap/OLLM-CLI_Releases.md +0 -419
  31. package/docs/DevelopmentRoadmap/PlanedFeatures.md +0 -448
  32. package/docs/DevelopmentRoadmap/README.md +0 -174
  33. package/docs/DevelopmentRoadmap/Roadmap.md +0 -572
  34. package/docs/DevelopmentRoadmap/RoadmapVisual.md +0 -372
  35. package/docs/Hooks/Architecture.md +0 -885
  36. package/docs/Hooks/Index.md +0 -244
  37. package/docs/Hooks/KeyboardShortcuts.md +0 -248
  38. package/docs/Hooks/Protocol.md +0 -817
  39. package/docs/Hooks/README.md +0 -403
  40. package/docs/Hooks/UserGuide.md +0 -1483
  41. package/docs/Hooks/VisualGuide.md +0 -598
  42. package/docs/Index.md +0 -506
  43. package/docs/Installation.md +0 -586
  44. package/docs/Introduction.md +0 -367
  45. package/docs/LLM Models/Index.md +0 -239
  46. package/docs/LLM Models/LLM_GettingStarted.md +0 -748
  47. package/docs/LLM Models/LLM_Index.md +0 -701
  48. package/docs/LLM Models/LLM_MemorySystem.md +0 -337
  49. package/docs/LLM Models/LLM_ModelCompatibility.md +0 -499
  50. package/docs/LLM Models/LLM_ModelsArchitecture.md +0 -933
  51. package/docs/LLM Models/LLM_ModelsCommands.md +0 -839
  52. package/docs/LLM Models/LLM_ModelsConfiguration.md +0 -1094
  53. package/docs/LLM Models/LLM_ModelsList.md +0 -1071
  54. package/docs/LLM Models/LLM_ModelsList.md.backup +0 -400
  55. package/docs/LLM Models/README.md +0 -355
  56. package/docs/MCP/MCP_Architecture.md +0 -1086
  57. package/docs/MCP/MCP_Commands.md +0 -1111
  58. package/docs/MCP/MCP_GettingStarted.md +0 -590
  59. package/docs/MCP/MCP_Index.md +0 -524
  60. package/docs/MCP/MCP_Integration.md +0 -866
  61. package/docs/MCP/MCP_Marketplace.md +0 -160
  62. package/docs/MCP/README.md +0 -415
  63. package/docs/Prompts System/Architecture.md +0 -760
  64. package/docs/Prompts System/Index.md +0 -223
  65. package/docs/Prompts System/PromptsRouting.md +0 -1047
  66. package/docs/Prompts System/PromptsTemplates.md +0 -1102
  67. package/docs/Prompts System/README.md +0 -389
  68. package/docs/Prompts System/SystemPrompts.md +0 -856
  69. package/docs/Quickstart.md +0 -535
  70. package/docs/Tools/Architecture.md +0 -884
  71. package/docs/Tools/GettingStarted.md +0 -624
  72. package/docs/Tools/Index.md +0 -216
  73. package/docs/Tools/ManifestReference.md +0 -141
  74. package/docs/Tools/README.md +0 -440
  75. package/docs/Tools/UserGuide.md +0 -773
  76. package/docs/Troubleshooting.md +0 -1265
  77. package/docs/UI&Settings/Architecture.md +0 -729
  78. package/docs/UI&Settings/ColorASCII.md +0 -34
  79. package/docs/UI&Settings/Commands.md +0 -755
  80. package/docs/UI&Settings/Configuration.md +0 -872
  81. package/docs/UI&Settings/Index.md +0 -293
  82. package/docs/UI&Settings/Keybinds.md +0 -372
  83. package/docs/UI&Settings/README.md +0 -278
  84. package/docs/UI&Settings/Terminal.md +0 -637
  85. package/docs/UI&Settings/Themes.md +0 -604
  86. package/docs/UI&Settings/UIGuide.md +0 -550
@@ -1,1483 +0,0 @@
1
- # Hook System User Guide
2
-
3
- **Complete Guide to Using Hooks in OLLM CLI**
4
-
5
- This guide covers everything you need to know about using hooks for workflow automation in OLLM CLI.
6
-
7
- ---
8
-
9
- ## 📋 Table of Contents
10
-
11
- 1. [Introduction](#introduction)
12
- 2. [Hook Basics](#hook-basics)
13
- 3. [Hooks Panel UI](#hooks-panel-ui)
14
- 4. [Creating Hooks](#creating-hooks)
15
- 5. [Managing Hooks](#managing-hooks)
16
- 6. [Hook Events](#hook-events)
17
- 7. [Trust and Security](#trust-and-security)
18
- 8. [Common Workflows](#common-workflows)
19
- 9. [Troubleshooting](#troubleshooting)
20
-
21
- **See Also:**
22
-
23
- - [Hook System Overview](3%20projects/OLLM%20CLI/Hooks/README.md) - Hook system introduction
24
- - [Hook Development Guide](3%20projects/OLLM%20CLI/Hooks/development-guide.md) - Creating custom hooks
25
- - [Hook Protocol](protocol.md) - Technical protocol specification
26
- - [MCP Commands](MCP_commands.md) - Hook command reference
27
-
28
- ---
29
-
30
- ## Introduction
31
-
32
- Hooks are executables that run in response to events during LLM execution. They enable:
33
-
34
- - **Workflow Automation** - Automate repetitive tasks
35
- - **Safety Gates** - Validate operations before execution
36
- - **Custom Logic** - Add custom behavior to OLLM CLI
37
- - **Integration** - Connect with external tools and services
38
-
39
- ### When to Use Hooks
40
-
41
- **Use hooks when you want to:**
42
-
43
- - Run commands before/after LLM execution
44
- - Validate tool calls before execution
45
- - Format code automatically on save
46
- - Run tests before commits
47
- - Integrate with external systems
48
- - Add custom approval logic
49
-
50
- **Don't use hooks when:**
51
-
52
- - Simple configuration would work
53
- - Performance is critical (hooks add overhead)
54
- - You need real-time interaction
55
-
56
- ---
57
-
58
- ## Hook Basics
59
-
60
- ### What is a Hook?
61
-
62
- A hook is an executable (script, binary, etc.) that:
63
-
64
- 1. Receives event data via **stdin** (JSON)
65
- 2. Processes the event
66
- 3. Returns a response via **stdout** (JSON)
67
-
68
- ### Hook Lifecycle
69
-
70
- ```
71
- Event Occurs
72
-
73
- Hook Registry Finds Matching Hooks
74
-
75
- Check Trust Level
76
-
77
- Request Approval (if needed)
78
-
79
- Execute Hook (pass event data via stdin)
80
-
81
- Hook Processes Event
82
-
83
- Hook Returns Response (via stdout)
84
-
85
- Process Response (allow/block/modify)
86
-
87
- Continue Execution
88
- ```
89
-
90
- ### Hook Response
91
-
92
- Hooks return JSON with:
93
-
94
- - `allow` (boolean) - Whether to allow the operation
95
- - `message` (string) - Message to display
96
- - `metadata` (object) - Optional metadata
97
-
98
- **Example:**
99
-
100
- ```json
101
- {
102
- "allow": true,
103
- "message": "Operation approved",
104
- "metadata": {
105
- "checked": true,
106
- "timestamp": "2026-01-16T10:00:00Z"
107
- }
108
- }
109
- ```
110
-
111
- ---
112
-
113
- ## Hooks Panel UI
114
-
115
- ### Overview
116
-
117
- The Hooks Panel provides an interactive terminal UI for viewing and managing hooks without editing JSON files. Access it by pressing **Tab** to navigate to the Hooks tab in the main navigation bar.
118
-
119
- ### Panel Layout
120
-
121
- The Hooks Panel uses a two-column layout:
122
-
123
- ```
124
- ┌─────────────────────────────────────────────────────────────┐
125
- │ 🎣 Hooks Configuration ↑↓:Nav Enter:Toggle│
126
- ├──────────────┬──────────────────────────────────────────────┤
127
- │ Left (30%) │ Right (70%) │
128
- │ │ │
129
- │ ⬅️ Exit │ Hook Details: │
130
- │ │ - Name (bold, yellow) │
131
- │ 📝 File │ - ID │
132
- │ ● Hook 1 │ - Command │
133
- │ ○ Hook 2 │ - Arguments │
134
- │ │ - Source (builtin/user/extension) │
135
- │ 💬 Prompt │ - Status (✓ Enabled / ✗ Disabled) │
136
- │ ● Hook 3 │ │
137
- │ │ │
138
- │ 👤 User │ │
139
- │ ○ Hook 4 │ │
140
- └──────────────┴──────────────────────────────────────────────┘
141
- ```
142
-
143
- **Left Column (30%):**
144
-
145
- - Exit item at the top
146
- - Hooks organized by category with icons
147
- - Visual indicators for enabled (●) and disabled (○) hooks
148
- - Selected hook highlighted in yellow
149
- - Scroll indicators (▲/▼) when list is longer than window
150
-
151
- **Right Column (70%):**
152
-
153
- - Detailed information for the selected hook
154
- - Command and arguments
155
- - Source and extension information
156
- - Current enabled/disabled status
157
-
158
- ### Keyboard Shortcuts
159
-
160
- #### Navigation
161
-
162
- | Key | Action |
163
- | ---------------- | -------------------------------------- |
164
- | **↑** | Move up to previous hook |
165
- | **↓** | Move down to next hook |
166
- | **Tab** | Enter Hooks Panel from main navigation |
167
- | **Esc** or **0** | Exit to main navigation |
168
-
169
- #### Hook Actions
170
-
171
- | Key | Action |
172
- | --------------------------- | ---------------------------- |
173
- | **Enter** or **←** or **→** | Toggle hook enabled/disabled |
174
- | **A** | Add new hook |
175
- | **E** | Edit selected hook |
176
- | **D** | Delete selected hook |
177
- | **T** | Test selected hook |
178
-
179
- ### Visual Indicators
180
-
181
- #### Hook Status
182
-
183
- - **● Green** - Hook is enabled
184
- - **○ Gray** - Hook is disabled
185
- - **Yellow highlight** - Currently selected hook (when panel has focus)
186
- - **Cyan border** - Panel has focus
187
-
188
- #### Category Icons
189
-
190
- - **📝** File Events - Hooks triggered by file changes
191
- - **💬** Prompt Events - Hooks triggered by prompt submission
192
- - **👤** User Triggered - Manually triggered hooks
193
- - **🔄** Session Events - Hooks for session lifecycle
194
- - **🤖** Agent Events - Hooks for agent operations
195
- - **🧠** Model Events - Hooks for model operations
196
- - **🔧** Tool Events - Hooks for tool execution
197
- - **📦** Compression Events - Hooks for context compression
198
- - **🔔** Notifications - Hooks for notifications
199
-
200
- #### Action Icons
201
-
202
- - **➕** Add new hook
203
- - **✏️** Edit hook
204
- - **🗑️** Delete hook
205
- - **🧪** Test hook
206
- - **🔄** Toggle hook
207
- - **⬅️** Exit panel
208
-
209
- ### Using the Hooks Panel
210
-
211
- #### Viewing Hooks
212
-
213
- 1. **Navigate to Hooks Panel:**
214
- - Press **Tab** repeatedly until "Hooks" is highlighted in the navigation bar
215
- - Press **Enter** to activate the Hooks Panel
216
-
217
- 2. **Browse Hooks:**
218
- - Use **↑** and **↓** arrow keys to navigate through hooks
219
- - Hooks are organized by category (File Events, Prompt Events, etc.)
220
- - The right panel shows detailed information for the selected hook
221
-
222
- 3. **View Hook Details:**
223
- - Select a hook to see its full details in the right panel
224
- - Details include: name, ID, command, arguments, source, and status
225
-
226
- #### Enabling/Disabling Hooks
227
-
228
- 1. **Select a Hook:**
229
- - Navigate to the hook using **↑** and **↓** keys
230
-
231
- 2. **Toggle Status:**
232
- - Press **Enter**, **←**, or **→** to toggle the hook
233
- - The indicator changes from ● (enabled) to ○ (disabled) or vice versa
234
- - Changes are saved immediately to `~/.ollm/settings.json`
235
-
236
- 3. **Visual Feedback:**
237
- - Enabled hooks show a green ● indicator
238
- - Disabled hooks show a gray ○ indicator
239
- - The status box in the right panel updates to show ✓ Enabled or ✗ Disabled
240
-
241
- #### Adding New Hooks
242
-
243
- 1. **Open Add Dialog:**
244
- - Press **A** key from anywhere in the Hooks Panel
245
-
246
- 2. **Fill in Hook Details:**
247
- - **Name:** Descriptive name for the hook
248
- - **Command:** The command to execute
249
- - **Arguments:** Command-line arguments (optional)
250
-
251
- 3. **Save Hook:**
252
- - Press **S** to save the hook
253
- - Press **C** or **Esc** to cancel
254
-
255
- 4. **Result:**
256
- - New hook appears in the list immediately
257
- - Hook is saved to `~/.ollm/hooks/` directory
258
- - Hook is enabled by default
259
-
260
- #### Editing Hooks
261
-
262
- 1. **Select a Hook:**
263
- - Navigate to the hook you want to edit
264
-
265
- 2. **Open Edit Dialog:**
266
- - Press **E** key
267
-
268
- 3. **Modify Details:**
269
- - Update name, command, or arguments
270
- - **Note:** Built-in hooks cannot be edited (only disabled)
271
-
272
- 4. **Save Changes:**
273
- - Press **S** to save changes
274
- - Press **C** or **Esc** to cancel
275
-
276
- 5. **Result:**
277
- - Hook updates immediately in the list
278
- - Changes are saved to the hook file
279
-
280
- #### Deleting Hooks
281
-
282
- 1. **Select a Hook:**
283
- - Navigate to the hook you want to delete
284
-
285
- 2. **Open Delete Dialog:**
286
- - Press **D** key
287
-
288
- 3. **Confirm Deletion:**
289
- - Review the warning message
290
- - Press **D** to confirm deletion
291
- - Press **C** or **Esc** to cancel
292
-
293
- 4. **Result:**
294
- - Hook is removed from the list immediately
295
- - Hook file is deleted from `~/.ollm/hooks/` directory
296
- - **Note:** Built-in hooks cannot be deleted (only disabled)
297
-
298
- #### Testing Hooks
299
-
300
- 1. **Select a Hook:**
301
- - Navigate to the hook you want to test
302
-
303
- 2. **Open Test Dialog:**
304
- - Press **T** key
305
-
306
- 3. **View Test Results:**
307
- - The dialog simulates the hook trigger event
308
- - Shows success/failure status
309
- - Displays any errors or warnings
310
- - Test doesn't affect actual system state
311
-
312
- 4. **Close Dialog:**
313
- - Press **Enter** or **Esc** to close
314
-
315
- ### Windowed Rendering
316
-
317
- For performance with large hook lists (> 15 hooks), the panel uses windowed rendering:
318
-
319
- - Only visible hooks are rendered (default window size: 15 items)
320
- - Scroll indicators (▲/▼) show when more hooks are available
321
- - Auto-scroll keeps the selected hook visible
322
- - Smooth navigation even with 50+ hooks
323
-
324
- ### Exit Item
325
-
326
- The Exit item at the top of the list provides a quick way to return to the main navigation:
327
-
328
- 1. **Navigate to Exit:**
329
- - Press **↑** from the first hook to reach the Exit item
330
- - Exit item is highlighted in yellow when selected
331
-
332
- 2. **Activate Exit:**
333
- - Press **Enter** on the Exit item
334
- - Or press **Esc** or **0** from anywhere in the panel
335
-
336
- 3. **Result:**
337
- - Returns to Browse Mode (main navigation bar)
338
- - Hooks Panel loses focus
339
-
340
- ### Corrupted Hooks Warning
341
-
342
- If corrupted hook files are detected, a warning banner appears at the top:
343
-
344
- ```
345
- ⚠️ 2 corrupted hook(s) found
346
- ```
347
-
348
- - Corrupted hooks are skipped during loading
349
- - Other hooks continue to work normally
350
- - Check hook files in `~/.ollm/hooks/` for JSON syntax errors
351
-
352
- ---
353
-
354
- ## Creating Hooks
355
-
356
- ### Quick Create
357
-
358
- The simplest way to create a hook:
359
-
360
- ```bash
361
- # Create a command hook
362
- /hooks create pre-execution "echo '{\"allow\":true}'"
363
-
364
- # Create a script hook
365
- /hooks create on-file-change "./scripts/format.sh {file}"
366
-
367
- # Create from file
368
- /hooks create pre-tool-call ./hooks/safety-check.js
369
- ```
370
-
371
- ### Command Hooks
372
-
373
- Simple one-line commands:
374
-
375
- ```bash
376
- # Echo a message
377
- /hooks create pre-execution "echo 'Starting execution...'"
378
-
379
- # Run a formatter
380
- /hooks create on-file-change "prettier --write {file}"
381
-
382
- # Run tests
383
- /hooks create on-git-commit "npm test"
384
- ```
385
-
386
- ### Script Hooks
387
-
388
- More complex logic in scripts:
389
-
390
- **Bash Script:**
391
-
392
- ```bash
393
- #!/bin/bash
394
- # save as: hooks/format-on-save.sh
395
-
396
- # Read input
397
- input=$(cat)
398
-
399
- # Extract file path
400
- file=$(echo "$input" | jq -r '.context.file')
401
-
402
- # Format file
403
- prettier --write "$file"
404
-
405
- # Return success
406
- echo '{"allow": true, "message": "File formatted"}'
407
- ```
408
-
409
- **Create hook:**
410
-
411
- ```bash
412
- /hooks create on-file-change ./hooks/format-on-save.sh
413
- ```
414
-
415
- ### Executable Hooks
416
-
417
- Compiled binaries or any executable:
418
-
419
- ```bash
420
- # Create from binary
421
- /hooks create pre-tool-call ./bin/safety-checker
422
-
423
- # Create from Python script
424
- /hooks create on-error ./scripts/notify.py
425
-
426
- # Create from Node.js script
427
- /hooks create post-execution ./scripts/log.js
428
- ```
429
-
430
- ---
431
-
432
- ## Managing Hooks
433
-
434
- ### Listing Hooks
435
-
436
- ```bash
437
- # List all hooks
438
- /hooks list
439
-
440
- # Output shows:
441
- # - Hook name
442
- # - Event type
443
- # - Trust level
444
- # - Enabled status
445
- ```
446
-
447
- ### Enabling/Disabling Hooks
448
-
449
- ```bash
450
- # Disable a hook
451
- /hooks disable my-hook
452
-
453
- # Enable a hook
454
- /hooks enable my-hook
455
-
456
- # Hooks can be disabled temporarily without removing them
457
- ```
458
-
459
- ### Removing Hooks
460
-
461
- ```bash
462
- # Remove a hook
463
- /hooks remove my-hook
464
-
465
- # This permanently deletes the hook
466
- ```
467
-
468
- ### Hook Information
469
-
470
- ```bash
471
- # Show hook details
472
- /hooks info my-hook
473
-
474
- # Shows:
475
- # - Name, event, command
476
- # - Trust level
477
- # - Enabled status
478
- # - Last execution time
479
- # - Execution count
480
- ```
481
-
482
- ---
483
-
484
- ## Hook Events
485
-
486
- ### Available Events
487
-
488
- OLLM CLI supports 12 hook events:
489
-
490
- #### 1. pre-execution
491
-
492
- **When:** Before LLM execution starts
493
- **Use Cases:** Validate prompts, add context, check permissions
494
- **Context:** `{ prompt, session, user }`
495
-
496
- **Example:**
497
-
498
- ```bash
499
- /hooks create pre-execution "./validate-prompt.sh"
500
- ```
501
-
502
- #### 2. post-execution
503
-
504
- **When:** After LLM execution completes
505
- **Use Cases:** Save results, trigger actions, log execution
506
- **Context:** `{ prompt, response, session, duration }`
507
-
508
- **Example:**
509
-
510
- ```bash
511
- /hooks create post-execution "./save-session.sh"
512
- ```
513
-
514
- #### 3. pre-tool-call
515
-
516
- **When:** Before a tool is executed
517
- **Use Cases:** Safety checks, validation, approval
518
- **Context:** `{ tool, args, session }`
519
-
520
- **Example:**
521
-
522
- ```bash
523
- /hooks create pre-tool-call "./safety-check.sh"
524
- ```
525
-
526
- #### 4. post-tool-call
527
-
528
- **When:** After a tool is executed
529
- **Use Cases:** Logging, cleanup, notifications
530
- **Context:** `{ tool, args, result, duration }`
531
-
532
- **Example:**
533
-
534
- ```bash
535
- /hooks create post-tool-call "./log-tool.sh"
536
- ```
537
-
538
- #### 5. on-error
539
-
540
- **When:** When an error occurs
541
- **Use Cases:** Error handling, notifications, recovery
542
- **Context:** `{ error, stack, session }`
543
-
544
- **Example:**
545
-
546
- ```bash
547
- /hooks create on-error "./notify-error.sh"
548
- ```
549
-
550
- #### 6. on-file-change
551
-
552
- **When:** When a file is modified
553
- **Use Cases:** Format code, run linters, update docs
554
- **Context:** `{ file, changes, session }`
555
-
556
- **Example:**
557
-
558
- ```bash
559
- /hooks create on-file-change "prettier --write {file}"
560
- ```
561
-
562
- #### 7. on-git-commit
563
-
564
- **When:** Before a git commit
565
- **Use Cases:** Run tests, validate code, check style
566
- **Context:** `{ files, message, session }`
567
-
568
- **Example:**
569
-
570
- ```bash
571
- /hooks create on-git-commit "npm test"
572
- ```
573
-
574
- #### 8. on-session-start
575
-
576
- **When:** When a session starts
577
- **Use Cases:** Initialize, load context, setup
578
- **Context:** `{ session, user }`
579
-
580
- **Example:**
581
-
582
- ```bash
583
- /hooks create on-session-start "./load-context.sh"
584
- ```
585
-
586
- #### 9. on-session-end
587
-
588
- **When:** When a session ends
589
- **Use Cases:** Cleanup, save state, backup
590
- **Context:** `{ session, duration, messageCount }`
591
-
592
- **Example:**
593
-
594
- ```bash
595
- /hooks create on-session-end "./save-state.sh"
596
- ```
597
-
598
- #### 10. on-context-overflow
599
-
600
- **When:** When context is full
601
- **Use Cases:** Compress, summarize, archive
602
- **Context:** `{ session, contextSize, maxSize }`
603
-
604
- **Example:**
605
-
606
- ```bash
607
- /hooks create on-context-overflow "./compress-context.sh"
608
- ```
609
-
610
- #### 11. on-approval-request
611
-
612
- **When:** When approval is needed
613
- **Use Cases:** Custom approval logic, notifications
614
- **Context:** `{ operation, details, session }`
615
-
616
- **Example:**
617
-
618
- ```bash
619
- /hooks create on-approval-request "./custom-approval.sh"
620
- ```
621
-
622
- #### 12. custom
623
-
624
- **When:** Custom events triggered by extensions
625
- **Use Cases:** Any custom automation
626
- **Context:** `{ eventName, data, session }`
627
-
628
- **Example:**
629
-
630
- ```bash
631
- /hooks create custom "./custom-handler.sh"
632
- ```
633
-
634
- ---
635
-
636
- ## Trust and Security
637
-
638
- ### Trust Levels
639
-
640
- Hooks have three trust levels:
641
-
642
- #### 1. Trusted Hooks
643
-
644
- - **Source:** System hooks, built-in
645
- - **Approval:** Never required
646
- - **Privilege:** Full access
647
- - **Use Case:** Core functionality
648
-
649
- #### 2. Workspace Hooks
650
-
651
- - **Source:** Project-specific hooks
652
- - **Approval:** Required first time
653
- - **Privilege:** Limited to workspace
654
- - **Use Case:** Project automation
655
-
656
- #### 3. Downloaded Hooks
657
-
658
- - **Source:** Extensions, external
659
- - **Approval:** Required each time
660
- - **Privilege:** Sandboxed
661
- - **Use Case:** Third-party automation
662
-
663
- ### Trusting Hooks
664
-
665
- ```bash
666
- # Trust a workspace hook
667
- /hooks trust my-hook
668
-
669
- # Now runs without approval
670
-
671
- # Untrust a hook
672
- /hooks untrust my-hook
673
-
674
- # Now requires approval again
675
- ```
676
-
677
- ### Security Best Practices
678
-
679
- **Do:**
680
-
681
- - ✅ Review hook code before trusting
682
- - ✅ Use workspace hooks for project-specific automation
683
- - ✅ Keep hooks simple and focused
684
- - ✅ Test hooks before trusting
685
- - ✅ Use version control for hooks
686
-
687
- **Don't:**
688
-
689
- - ❌ Trust hooks from unknown sources
690
- - ❌ Give hooks unnecessary permissions
691
- - ❌ Run hooks with sensitive data without review
692
- - ❌ Trust hooks that modify system files
693
- - ❌ Disable approval for downloaded hooks
694
-
695
- ---
696
-
697
- ## Common Workflows
698
-
699
- ### Quick Start with Hooks Panel
700
-
701
- **First Time Setup:**
702
-
703
- 1. Press **Tab** to navigate to Hooks tab
704
- 2. Press **Enter** to open Hooks Panel
705
- 3. Browse available hooks with **↑** and **↓**
706
- 4. Press **Enter** to enable/disable hooks
707
- 5. Press **A** to add your first custom hook
708
-
709
- ### Using the Hooks Panel for Common Tasks
710
-
711
- #### Task 1: Enable Code Formatting
712
-
713
- 1. **Navigate to Hooks Panel:**
714
- - Press **Tab** until "Hooks" is highlighted
715
- - Press **Enter** to activate
716
-
717
- 2. **Find Format Hook:**
718
- - Use **↓** to navigate to "File Events" category
719
- - Look for "format-on-save" hook
720
-
721
- 3. **Enable Hook:**
722
- - Press **Enter** to toggle to enabled (●)
723
- - Status changes to ✓ Enabled
724
-
725
- 4. **Verify:**
726
- - Edit a file to trigger formatting
727
- - File should be formatted automatically
728
-
729
- #### Task 2: Create a Custom Hook
730
-
731
- 1. **Open Add Dialog:**
732
- - Press **A** from Hooks Panel
733
-
734
- 2. **Enter Hook Details:**
735
-
736
- ```
737
- Name: lint-on-save
738
- Command: eslint
739
- Arguments: --fix {file}
740
- ```
741
-
742
- 3. **Save Hook:**
743
- - Press **S** to save
744
- - Hook appears in "File Events" category
745
-
746
- 4. **Enable Hook:**
747
- - Navigate to new hook
748
- - Press **Enter** to enable
749
-
750
- #### Task 3: Disable Unwanted Hooks
751
-
752
- 1. **Find Hook:**
753
- - Navigate through categories
754
- - Look for enabled hooks (●)
755
-
756
- 2. **Disable Hook:**
757
- - Select the hook
758
- - Press **Enter** to toggle to disabled (○)
759
-
760
- 3. **Verify:**
761
- - Status changes to ✗ Disabled
762
- - Hook won't execute anymore
763
-
764
- #### Task 4: Test Before Enabling
765
-
766
- 1. **Select Hook:**
767
- - Navigate to the hook you want to test
768
-
769
- 2. **Run Test:**
770
- - Press **T** to open Test dialog
771
- - Wait for test to complete
772
-
773
- 3. **Review Results:**
774
- - Check for success (✓) or failure (✗)
775
- - Read any error messages
776
-
777
- 4. **Enable if Successful:**
778
- - Press **Esc** to close test dialog
779
- - Press **Enter** to enable hook
780
-
781
- #### Task 5: Organize Project Hooks
782
-
783
- 1. **Review Existing Hooks:**
784
- - Browse through all categories
785
- - Note which hooks are enabled
786
-
787
- 2. **Disable Unused Hooks:**
788
- - Navigate to each unused hook
789
- - Press **Enter** to disable
790
-
791
- 3. **Add Project-Specific Hooks:**
792
- - Press **A** to add new hooks
793
- - Create hooks for your workflow
794
-
795
- 4. **Test Configuration:**
796
- - Press **T** on each new hook
797
- - Verify they work as expected
798
-
799
- ### Code Quality Workflow
800
-
801
- ```bash
802
- # Format on save
803
- /hooks create on-file-change "prettier --write {file}"
804
- /hooks trust on-file-change
805
-
806
- # Lint on save
807
- /hooks create on-file-change "eslint --fix {file}"
808
- /hooks trust on-file-change
809
-
810
- # Run tests before commit
811
- /hooks create on-git-commit "npm test"
812
- /hooks trust on-git-commit
813
- ```
814
-
815
- ### Safety Gate Workflow
816
-
817
- ```bash
818
- # Validate tool calls
819
- /hooks create pre-tool-call "./validate-tool.sh"
820
- /hooks trust pre-tool-call
821
-
822
- # Check file operations
823
- /hooks create pre-tool-call "./check-file-access.sh"
824
- /hooks trust pre-tool-call
825
-
826
- # Approve destructive operations
827
- /hooks create pre-tool-call "./approve-destructive.sh"
828
- /hooks trust pre-tool-call
829
- ```
830
-
831
- ### Integration Workflow
832
-
833
- ```bash
834
- # Notify on errors
835
- /hooks create on-error "./notify-slack.sh"
836
- /hooks trust on-error
837
-
838
- # Log executions
839
- /hooks create post-execution "./log-to-db.sh"
840
- /hooks trust post-execution
841
-
842
- # Sync with external system
843
- /hooks create post-tool-call "./sync-external.sh"
844
- /hooks trust post-tool-call
845
- ```
846
-
847
- ### Session Management Workflow
848
-
849
- ```bash
850
- # Load context on start
851
- /hooks create on-session-start "./load-context.sh"
852
- /hooks trust on-session-start
853
-
854
- # Save state on end
855
- /hooks create on-session-end "./save-state.sh"
856
- /hooks trust on-session-end
857
-
858
- # Compress context when full
859
- /hooks create on-context-overflow "./compress.sh"
860
- /hooks trust on-context-overflow
861
- ```
862
-
863
- ---
864
-
865
- ## Troubleshooting
866
-
867
- ### Hooks Panel UI Issues
868
-
869
- #### Panel Not Showing
870
-
871
- **Check if Hooks tab is available:**
872
-
873
- ```bash
874
- # Press Tab to cycle through tabs
875
- # Look for "Hooks" in the navigation bar
876
- ```
877
-
878
- **Verify installation:**
879
-
880
- - Hooks Panel UI is available in OLLM CLI v0.1.0+
881
- - Check version: `ollm --version`
882
-
883
- **Restart CLI:**
884
-
885
- ```bash
886
- # Exit and restart OLLM CLI
887
- # Press Ctrl+C to exit
888
- # Run ollm again
889
- ```
890
-
891
- #### Hooks Not Loading
892
-
893
- **Check for error messages:**
894
-
895
- - Look for error banner at top of panel
896
- - Check for corrupted hooks warning
897
-
898
- **Verify hook files:**
899
-
900
- ```bash
901
- # Check user hooks directory
902
- ls ~/.ollm/hooks/
903
-
904
- # Verify JSON syntax
905
- cat ~/.ollm/hooks/my-hook.json | jq .
906
- ```
907
-
908
- **Check permissions:**
909
-
910
- ```bash
911
- # Ensure hooks directory is readable
912
- chmod 755 ~/.ollm/hooks/
913
- chmod 644 ~/.ollm/hooks/*.json
914
- ```
915
-
916
- #### Navigation Not Working
917
-
918
- **Ensure panel has focus:**
919
-
920
- - Panel border should be cyan when focused
921
- - Selected hook should be highlighted in yellow
922
- - Press **Tab** to give focus to Hooks Panel
923
-
924
- **Check keyboard input:**
925
-
926
- - Try pressing **↑** and **↓** keys
927
- - Ensure terminal supports arrow keys
928
- - Try alternative keys: **Esc** or **0** to exit
929
-
930
- **Restart panel:**
931
-
932
- - Press **Esc** to exit panel
933
- - Press **Tab** to re-enter panel
934
-
935
- #### Toggle Not Working
936
-
937
- **Check hook editability:**
938
-
939
- - Built-in hooks can be toggled
940
- - User hooks can be toggled
941
- - Extension hooks can be toggled
942
-
943
- **Verify settings file:**
944
-
945
- ```bash
946
- # Check settings file exists
947
- cat ~/.ollm/settings.json
948
-
949
- # Verify hooks section
950
- cat ~/.ollm/settings.json | jq .hooks
951
- ```
952
-
953
- **Check file permissions:**
954
-
955
- ```bash
956
- # Ensure settings file is writable
957
- chmod 644 ~/.ollm/settings.json
958
- ```
959
-
960
- #### Dialogs Not Appearing
961
-
962
- **Check terminal size:**
963
-
964
- - Dialogs require minimum terminal size
965
- - Resize terminal if too small
966
- - Recommended: 80x24 or larger
967
-
968
- **Verify dialog trigger:**
969
-
970
- - Press **A** for Add dialog
971
- - Press **E** for Edit dialog (on user hook)
972
- - Press **D** for Delete dialog (on user hook)
973
- - Press **T** for Test dialog
974
-
975
- **Close existing dialogs:**
976
-
977
- - Press **Esc** or **C** to close any open dialog
978
- - Try opening dialog again
979
-
980
- #### Scroll Indicators Not Showing
981
-
982
- **Check hook count:**
983
-
984
- - Scroll indicators only appear with > 15 hooks
985
- - Add more hooks to test scrolling
986
-
987
- **Verify window size:**
988
-
989
- - Default window size is 15 items
990
- - Scroll indicators appear when list exceeds window
991
-
992
- **Navigate to trigger scroll:**
993
-
994
- - Use **↑** and **↓** to navigate
995
- - Scroll indicators appear automatically
996
-
997
- ### Hook Not Executing
998
-
999
- **Check if hook is enabled:**
1000
-
1001
- ```bash
1002
- /hooks list
1003
- # Look for "enabled: true"
1004
- ```
1005
-
1006
- **Check trust level:**
1007
-
1008
- ```bash
1009
- /hooks info my-hook
1010
- # If "workspace" or "downloaded", may need approval
1011
- ```
1012
-
1013
- **Enable debug mode:**
1014
-
1015
- ```bash
1016
- /hooks debug on
1017
- # Shows detailed execution logs
1018
- ```
1019
-
1020
- ### Hook Failing
1021
-
1022
- **Test hook manually:**
1023
-
1024
- ```bash
1025
- # Test with sample input
1026
- echo '{"event":"test","context":{}}' | ./my-hook.sh
1027
- ```
1028
-
1029
- **Check hook output:**
1030
-
1031
- ```bash
1032
- # Hook must output valid JSON
1033
- # Check for syntax errors
1034
- ```
1035
-
1036
- **Check permissions:**
1037
-
1038
- ```bash
1039
- # Make sure hook is executable
1040
- chmod +x ./my-hook.sh
1041
- ```
1042
-
1043
- ### Hook Approval Issues
1044
-
1045
- **Trust the hook:**
1046
-
1047
- ```bash
1048
- /hooks trust my-hook
1049
- ```
1050
-
1051
- **Check trust level:**
1052
-
1053
- ```bash
1054
- /hooks info my-hook
1055
- # Shows current trust level
1056
- ```
1057
-
1058
- **Review approval settings:**
1059
-
1060
- ```bash
1061
- # Check if approval is required
1062
- # Workspace hooks need approval first time
1063
- # Downloaded hooks need approval each time
1064
- ```
1065
-
1066
- ### Performance Issues
1067
-
1068
- **Disable slow hooks:**
1069
-
1070
- ```bash
1071
- /hooks disable slow-hook
1072
- ```
1073
-
1074
- **Optimize hook code:**
1075
-
1076
- - Reduce processing time
1077
- - Cache results
1078
- - Use async operations
1079
-
1080
- **Limit hook execution:**
1081
-
1082
- - Only run on specific events
1083
- - Add conditions in hook code
1084
- - Use event filtering
1085
-
1086
- ---
1087
-
1088
- ## Advanced Usage
1089
-
1090
- ### Conditional Execution
1091
-
1092
- Hooks can implement conditions:
1093
-
1094
- ```bash
1095
- #!/bin/bash
1096
- # Only run on TypeScript files
1097
-
1098
- input=$(cat)
1099
- file=$(echo "$input" | jq -r '.context.file')
1100
-
1101
- if [[ "$file" == *.ts ]]; then
1102
- prettier --write "$file"
1103
- echo '{"allow": true, "message": "Formatted TypeScript file"}'
1104
- else
1105
- echo '{"allow": true, "message": "Skipped non-TypeScript file"}'
1106
- fi
1107
- ```
1108
-
1109
- ### Chaining Hooks
1110
-
1111
- Multiple hooks can run for the same event:
1112
-
1113
- ```bash
1114
- # Create multiple hooks for same event
1115
- /hooks create on-file-change "./format.sh"
1116
- /hooks create on-file-change "./lint.sh"
1117
- /hooks create on-file-change "./test.sh"
1118
-
1119
- # All three will run in order
1120
- ```
1121
-
1122
- ### Hook Variables
1123
-
1124
- Hooks receive context variables:
1125
-
1126
- - `{file}` - File path (on-file-change)
1127
- - `{tool}` - Tool name (pre/post-tool-call)
1128
- - `{args}` - Tool arguments (pre/post-tool-call)
1129
- - `{error}` - Error message (on-error)
1130
- - `{session}` - Session ID (all events)
1131
-
1132
- **Example:**
1133
-
1134
- ```bash
1135
- /hooks create on-file-change "echo 'File changed: {file}'"
1136
- ```
1137
-
1138
- ---
1139
-
1140
- ## Best Practices
1141
-
1142
- ### Hooks Panel UI Best Practices
1143
-
1144
- **Organizing Hooks:**
1145
-
1146
- - Keep related hooks in the same category
1147
- - Use descriptive names for easy identification
1148
- - Disable hooks you're not currently using
1149
- - Test hooks before enabling them
1150
-
1151
- **Navigation Efficiency:**
1152
-
1153
- - Use **↑** from first hook to quickly reach Exit
1154
- - Remember keyboard shortcuts (A/E/D/T)
1155
- - Use **Esc** for quick exit to main navigation
1156
- - Navigate by category to find hooks faster
1157
-
1158
- **Hook Management:**
1159
-
1160
- - Review enabled hooks regularly
1161
- - Test hooks after editing
1162
- - Delete unused custom hooks
1163
- - Keep hook list under 50 for best performance
1164
-
1165
- **Safety:**
1166
-
1167
- - Always test hooks before enabling
1168
- - Review hook details before toggling
1169
- - Be cautious with built-in hooks
1170
- - Disable hooks if they cause issues
1171
-
1172
- ### Hook Design
1173
-
1174
- **Keep hooks simple:**
1175
-
1176
- - One responsibility per hook
1177
- - Fast execution (< 1 second)
1178
- - Clear error messages
1179
- - Idempotent operations
1180
-
1181
- **Use appropriate events:**
1182
-
1183
- - `pre-*` for validation
1184
- - `post-*` for logging
1185
- - `on-*` for automation
1186
-
1187
- **Handle errors gracefully:**
1188
-
1189
- - Return proper JSON even on error
1190
- - Include helpful error messages
1191
- - Don't crash on invalid input
1192
-
1193
- ### Hook Organization
1194
-
1195
- **Project structure:**
1196
-
1197
- ```
1198
- project/
1199
- ├── .ollm/
1200
- │ └── hooks/
1201
- │ ├── format-on-save.sh
1202
- │ ├── lint-on-save.sh
1203
- │ ├── test-pre-commit.sh
1204
- │ └── README.md
1205
- └── ...
1206
- ```
1207
-
1208
- **Document your hooks:**
1209
-
1210
- - Add comments to hook code
1211
- - Create README for hook directory
1212
- - Document required dependencies
1213
-
1214
- **Version control:**
1215
-
1216
- - Commit hooks to repository
1217
- - Share with team
1218
- - Track changes
1219
-
1220
- ---
1221
-
1222
- ## Examples
1223
-
1224
- ### Hooks Panel UI Examples
1225
-
1226
- #### Example 1: Quick Hook Toggle
1227
-
1228
- **Scenario:** You want to temporarily disable formatting while debugging.
1229
-
1230
- **Steps:**
1231
-
1232
- 1. Press **Tab** to navigate to Hooks
1233
- 2. Press **Enter** to open Hooks Panel
1234
- 3. Navigate to "format-on-save" hook with **↓**
1235
- 4. Press **Enter** to disable (○)
1236
- 5. Do your debugging work
1237
- 6. Return to Hooks Panel
1238
- 7. Press **Enter** to re-enable (●)
1239
-
1240
- **Result:** Formatting is temporarily disabled without deleting the hook.
1241
-
1242
- #### Example 2: Adding a Test Hook
1243
-
1244
- **Scenario:** You want to run tests before every commit.
1245
-
1246
- **Steps:**
1247
-
1248
- 1. Open Hooks Panel (**Tab** → **Enter**)
1249
- 2. Press **A** to open Add dialog
1250
- 3. Enter details:
1251
- ```
1252
- Name: test-before-commit
1253
- Command: npm
1254
- Arguments: test
1255
- ```
1256
- 4. Press **S** to save
1257
- 5. Navigate to new hook
1258
- 6. Press **T** to test it
1259
- 7. If successful, press **Enter** to enable
1260
-
1261
- **Result:** Tests run automatically before commits.
1262
-
1263
- #### Example 3: Reviewing All Hooks
1264
-
1265
- **Scenario:** You want to see what hooks are currently active.
1266
-
1267
- **Steps:**
1268
-
1269
- 1. Open Hooks Panel
1270
- 2. Navigate through each category with **↓**
1271
- 3. Look for ● (enabled) indicators
1272
- 4. Select each enabled hook to view details
1273
- 5. Note the command and arguments
1274
-
1275
- **Result:** You have a complete overview of active automation.
1276
-
1277
- #### Example 4: Cleaning Up Hooks
1278
-
1279
- **Scenario:** You have too many hooks and want to clean up.
1280
-
1281
- **Steps:**
1282
-
1283
- 1. Open Hooks Panel
1284
- 2. Navigate through all hooks
1285
- 3. For each unused hook:
1286
- - Press **Enter** to disable (○)
1287
- - Or press **D** to delete (user hooks only)
1288
- 4. Keep only the hooks you actively use
1289
-
1290
- **Result:** Cleaner hook list, better performance.
1291
-
1292
- #### Example 5: Testing Hook Configuration
1293
-
1294
- **Scenario:** You edited a hook file manually and want to verify it works.
1295
-
1296
- **Steps:**
1297
-
1298
- 1. Open Hooks Panel
1299
- 2. Navigate to the edited hook
1300
- 3. Press **T** to test
1301
- 4. Review test results:
1302
- - ✓ Success: Hook works correctly
1303
- - ✗ Failure: Check error message
1304
- 5. If failed, press **E** to edit and fix
1305
- 6. Test again until successful
1306
-
1307
- **Result:** Verified working hook configuration.
1308
-
1309
- ### Example 1: Format on Save
1310
-
1311
- ```bash
1312
- #!/bin/bash
1313
- # .ollm/hooks/format-on-save.sh
1314
-
1315
- input=$(cat)
1316
- file=$(echo "$input" | jq -r '.context.file')
1317
-
1318
- # Format file
1319
- prettier --write "$file" 2>&1
1320
-
1321
- if [ $? -eq 0 ]; then
1322
- echo '{"allow": true, "message": "File formatted successfully"}'
1323
- else
1324
- echo '{"allow": false, "message": "Format failed"}'
1325
- fi
1326
- ```
1327
-
1328
- **Create hook:**
1329
-
1330
- ```bash
1331
- /hooks create on-file-change ./.ollm/hooks/format-on-save.sh
1332
- /hooks trust on-file-change
1333
- ```
1334
-
1335
- ### Example 2: Safety Check
1336
-
1337
- ```bash
1338
- #!/bin/bash
1339
- # .ollm/hooks/safety-check.sh
1340
-
1341
- input=$(cat)
1342
- tool=$(echo "$input" | jq -r '.context.tool')
1343
- args=$(echo "$input" | jq -r '.context.args')
1344
-
1345
- # Block dangerous operations
1346
- if [[ "$tool" == "shell" ]] && [[ "$args" == *"rm -rf"* ]]; then
1347
- echo '{"allow": false, "message": "Dangerous operation blocked"}'
1348
- exit 0
1349
- fi
1350
-
1351
- echo '{"allow": true, "message": "Operation approved"}'
1352
- ```
1353
-
1354
- **Create hook:**
1355
-
1356
- ```bash
1357
- /hooks create pre-tool-call ./.ollm/hooks/safety-check.sh
1358
- /hooks trust pre-tool-call
1359
- ```
1360
-
1361
- ### Example 3: Test Before Commit
1362
-
1363
- ```bash
1364
- #!/bin/bash
1365
- # .ollm/hooks/test-pre-commit.sh
1366
-
1367
- # Run tests
1368
- npm test 2>&1
1369
-
1370
- if [ $? -eq 0 ]; then
1371
- echo '{"allow": true, "message": "All tests passed"}'
1372
- else
1373
- echo '{"allow": false, "message": "Tests failed, commit blocked"}'
1374
- fi
1375
- ```
1376
-
1377
- **Create hook:**
1378
-
1379
- ```bash
1380
- /hooks create on-git-commit ./.ollm/hooks/test-pre-commit.sh
1381
- /hooks trust on-git-commit
1382
- ```
1383
-
1384
- ---
1385
-
1386
- ## Frequently Asked Questions
1387
-
1388
- ### Hooks Panel UI
1389
-
1390
- **Q: How do I access the Hooks Panel?**
1391
- A: Press **Tab** repeatedly to navigate to the "Hooks" tab in the main navigation bar, then press **Enter** to activate the panel.
1392
-
1393
- **Q: What's the difference between ● and ○ indicators?**
1394
- A: ● (green) means the hook is enabled and will execute. ○ (gray) means the hook is disabled and won't execute.
1395
-
1396
- **Q: Can I edit built-in hooks?**
1397
- A: No, built-in hooks are read-only. You can disable them, but you cannot edit or delete them. Only user-created hooks can be edited or deleted.
1398
-
1399
- **Q: Why can't I delete a hook?**
1400
- A: Built-in hooks and extension hooks cannot be deleted. Only user-created hooks (stored in `~/.ollm/hooks/`) can be deleted.
1401
-
1402
- **Q: How do I know if a hook is working?**
1403
- A: Use the Test feature (press **T** on a hook) to simulate execution and see if it works correctly.
1404
-
1405
- **Q: What happens when I toggle a hook?**
1406
- A: The hook's enabled/disabled state is immediately saved to `~/.ollm/settings.json`. Enabled hooks will execute on their trigger events; disabled hooks won't.
1407
-
1408
- **Q: Can I have multiple hooks for the same event?**
1409
- A: Yes! Multiple hooks can be enabled for the same event type. They will execute in the order they appear in the list.
1410
-
1411
- **Q: Why do I see a "corrupted hooks" warning?**
1412
- A: Some hook files in `~/.ollm/hooks/` have invalid JSON syntax. Check the files and fix any syntax errors. Corrupted hooks are skipped during loading.
1413
-
1414
- **Q: How many hooks can I have?**
1415
- A: There's no hard limit, but the panel is optimized for up to 50 hooks. With more hooks, you may experience slower navigation.
1416
-
1417
- **Q: Can I import/export hooks?**
1418
- A: Not yet through the UI. You can manually copy hook files from `~/.ollm/hooks/` to share them. Import/export functionality is planned for a future release.
1419
-
1420
- **Q: What's the Exit item for?**
1421
- A: The Exit item at the top of the list provides a quick way to return to the main navigation. Press **Enter** on it, or press **Esc** or **0** from anywhere in the panel.
1422
-
1423
- **Q: Why don't I see scroll indicators?**
1424
- A: Scroll indicators (▲/▼) only appear when you have more than 15 hooks. They show automatically when the list is longer than the visible window.
1425
-
1426
- **Q: Can I search for hooks?**
1427
- A: Not yet. Hook search/filtering is planned for a future release. For now, navigate through categories to find hooks.
1428
-
1429
- **Q: How do I create a hook for a specific file type?**
1430
- A: When adding a hook, use file patterns in the arguments. For example: `prettier --write *.ts` for TypeScript files only.
1431
-
1432
- **Q: What's the difference between user and extension hooks?**
1433
- A: User hooks are created by you and stored in `~/.ollm/hooks/`. Extension hooks come from installed extensions and are managed by the extension system.
1434
-
1435
- ### General Hooks
1436
-
1437
- **Q: What are hooks?**
1438
- A: Hooks are executables that run in response to events during LLM execution. They enable workflow automation, safety gates, and custom logic.
1439
-
1440
- **Q: When should I use hooks?**
1441
- A: Use hooks for automating repetitive tasks, validating operations, formatting code, running tests, or integrating with external systems.
1442
-
1443
- **Q: Are hooks secure?**
1444
- A: Hooks have trust levels. Built-in hooks are trusted. User hooks require approval the first time. Downloaded hooks require approval each time. Always review hook code before trusting.
1445
-
1446
- **Q: Do hooks slow down execution?**
1447
- A: Hooks add some overhead. Keep hooks fast (< 1 second) and disable unused hooks for best performance.
1448
-
1449
- **Q: Can hooks modify files?**
1450
- A: Yes, hooks can modify files if they have the necessary permissions. Be careful with hooks that perform destructive operations.
1451
-
1452
- **Q: How do I debug a failing hook?**
1453
- A: Enable debug mode with `/hooks debug on`, then check the debug output with `/hooks debug status`. You can also test hooks manually from the command line.
1454
-
1455
- ---
1456
-
1457
- ## Further Reading
1458
-
1459
- ### Documentation
1460
-
1461
- - [Hook System Overview](3%20projects/OLLM%20CLI/Hooks/README.md) - Introduction to hooks
1462
- - [Hook Development Guide](3%20projects/OLLM%20CLI/Hooks/development-guide.md) - Creating custom hooks
1463
- - [Hook Protocol](protocol.md) - Technical specification
1464
- - [MCP Commands](MCP_commands.md) - Hook commands
1465
-
1466
- ### Related Features
1467
-
1468
- - [Extensions](../extensions/) - Extensions can include hooks
1469
- - [MCP Servers](../servers/) - MCP servers for tools
1470
- - [API Reference](hook-system.md) - Hook system API
1471
-
1472
- ### External Resources
1473
-
1474
- - Bash Scripting Guide (https://www.gnu.org/software/bash/manual/)
1475
- - jq Manual (https://stedolan.github.io/jq/manual/)
1476
- - JSON Specification (https://www.json.org/)
1477
-
1478
- ---
1479
-
1480
- **Last Updated:** 2026-01-18
1481
- **Version:** 0.1.0
1482
- **Features:** Hooks Panel UI added in v0.1.0
1483
- **Next:** [Hook Development Guide](3%20projects/OLLM%20CLI/Hooks/development-guide.md)