Borg/pkg
google-labs-jules[bot] 07de6d5877 feat: Implement collection hooks/plugins system
Adds a flexible hook system to the `borg collect` commands, allowing users to run custom scripts at various stages of the collection lifecycle.

This feature introduces a new `pkg/hooks` package that encapsulates the core logic for parsing a `.borg-hooks.yaml` configuration file and executing external scripts.

Key features:
- Four hook events are supported: `on_file_collected`, `on_url_found`, `on_collection_complete`, and `on_error`.
- A `--hooks` flag has been added to the `collect website` and `collect pwa` commands.
- The system automatically detects and loads a `.borg-hooks.yaml` file from the current directory if the `--hooks` flag is not provided.
- File-based hooks (`on_file_collected`) support glob pattern matching against the base filename.
- Hook scripts receive a JSON payload on stdin with relevant event context.
- Commands with arguments are correctly handled by executing them through `sh -c`.

The implementation includes a comprehensive test suite with both unit tests for the new `hooks` package and integration tests to validate the end-to-end functionality. All existing tests and examples have been updated to reflect the necessary function signature changes.

Co-authored-by: Snider <631881+Snider@users.noreply.github.com>
2026-02-02 00:49:08 +00:00
..
compress feat: Add _Good, _Bad, and _Ugly tests 2025-11-14 10:36:35 +00:00
console feat: Add Borg Console and release workflow 2025-12-27 02:32:31 +00:00
datanode Improve test coverage for datanode and tim packages, and fix cmd tests 2025-11-23 18:58:32 +00:00
github feat: Add _Good, _Bad, and _Ugly tests 2025-11-14 10:36:35 +00:00
hooks feat: Implement collection hooks/plugins system 2026-02-02 00:49:08 +00:00
logger feat: Improve test coverage and refactor for testability 2025-11-03 18:25:04 +00:00
mocks feat: Improve test coverage and refactor for testability 2025-11-03 16:31:26 +00:00
player feat: v3 streaming with LTHN rolling keys and configurable cadence 2026-01-12 16:01:59 +00:00
pwa feat: Implement collection hooks/plugins system 2026-02-02 00:49:08 +00:00
smsg feat: adaptive bitrate streaming (ABR) for HLS-style encrypted video 2026-01-13 15:40:15 +00:00
stmf feat: Add STMF form encryption and SMSG secure message packages 2025-12-27 00:49:07 +00:00
tarfs feat: Add ChaCha20-Poly1305 encryption and decryption for TIM files (.stim), enhance CLI for encryption format handling (stim), and include metadata inspection support 2025-12-26 01:25:03 +00:00
tim feat: Add ChaCha20-Poly1305 encryption and decryption for TIM files (.stim), enhance CLI for encryption format handling (stim), and include metadata inspection support 2025-12-26 01:25:03 +00:00
trix feat: Add ChaCha20-Poly1305 encryption and decryption for TIM files (.stim), enhance CLI for encryption format handling (stim), and include metadata inspection support 2025-12-26 01:25:03 +00:00
ui feat: Improve test coverage and refactor for testability 2025-11-03 18:25:04 +00:00
vcs feat: Add _Good, _Bad, and _Ugly tests 2025-11-14 10:36:35 +00:00
wasm/stmf feat: adaptive bitrate streaming (ABR) for HLS-style encrypted video 2026-01-13 15:40:15 +00:00
website feat: Implement collection hooks/plugins system 2026-02-02 00:49:08 +00:00