Commit 162abc7
committed
Implement pre-run hooks with .hooks.d support
Add pre-run hooks feature that executes scripts before main script execution.
Hooks enable environment validation, dependency checking, authentication, and setup tasks.
Implementation:
- Hook discovery from .hooks.d directory with lexicographic ordering
- Two hook types: executable (separate process) and sourced (same shell context)
- Sourced hooks use .source suffix and can modify environment variables
- Wrapper script generation for proper execution flow
- --skip-hooks flag to bypass hook execution
- Full environment variable injection (TOME_ROOT, TOME_SCRIPT_PATH, etc.)
Tests:
- 38 total tests covering unit, integration, and E2E scenarios
- Comprehensive validation of hook discovery, execution, and environment handling
- Deno E2E tests verify real-world usage with both tome-cli and wrapper
Documentation:
- Complete user guide in docs/hooks.md with examples and use cases
- Updated README.md with hooks feature section
- Example hooks in examples/.hooks.d for reference
All tests passing. Feature ready for use.1 parent b5d315d commit 162abc7
File tree
11 files changed
+2358
-3
lines changed- cmd
- docs
- examples
- .hooks.d
- test
11 files changed
+2358
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
176 | 176 | | |
177 | 177 | | |
178 | 178 | | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
179 | 199 | | |
180 | 200 | | |
181 | 201 | | |
| |||
200 | 220 | | |
201 | 221 | | |
202 | 222 | | |
| 223 | + | |
203 | 224 | | |
204 | 225 | | |
205 | 226 | | |
206 | | - | |
207 | 227 | | |
208 | 228 | | |
209 | 229 | | |
| |||
318 | 338 | | |
319 | 339 | | |
320 | 340 | | |
| 341 | + | |
321 | 342 | | |
322 | 343 | | |
323 | 344 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
83 | | - | |
84 | | - | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
85 | 121 | | |
86 | 122 | | |
87 | 123 | | |
| |||
128 | 164 | | |
129 | 165 | | |
130 | 166 | | |
| 167 | + | |
131 | 168 | | |
132 | 169 | | |
133 | 170 | | |
| 171 | + | |
134 | 172 | | |
| 173 | + | |
135 | 174 | | |
136 | 175 | | |
0 commit comments