feat(skills): add pdf-reader skill (#772)

Thanks @glifocat! Clean skill package — good docs, solid tests, nice intent files. Pushed a small fix for path traversal on the PDF filename before merging.
This commit is contained in:
glifocat
2026-03-06 17:47:12 +01:00
committed by GitHub
parent 1e89d61928
commit 0b260ece57
12 changed files with 2238 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
# Intent: src/channels/whatsapp.test.ts modifications
## What changed
Added mocks for downloadMediaMessage and normalizeMessageContent, and test cases for PDF attachment handling.
## Key sections
### Mocks (top of file)
- Modified: config mock to export `GROUPS_DIR: '/tmp/test-groups'`
- Modified: `fs` mock to include `writeFileSync` as vi.fn()
- Modified: Baileys mock to export `downloadMediaMessage`, `normalizeMessageContent`
- Modified: fake socket factory to include `updateMediaMessage`
### Test cases (inside "message handling" describe block)
- "downloads and injects PDF attachment path" — verifies PDF download, save, and content replacement
- "handles PDF download failure gracefully" — verifies error handling (message skipped since content remains empty)
## Invariants (must-keep)
- All existing test cases unchanged
- All existing mocks unchanged (only additive changes)
- All existing test helpers unchanged
- All describe blocks preserved