Skip to content

docs(hooks): add JavaScript handler type documentation#66

Open
bclermont wants to merge 1 commit into
nextlevelbuilder:masterfrom
bclermont:master
Open

docs(hooks): add JavaScript handler type documentation#66
bclermont wants to merge 1 commit into
nextlevelbuilder:masterfrom
bclermont:master

Conversation

@bclermont

Copy link
Copy Markdown

Summary

Added comprehensive documentation for the JavaScript/script handler type in GoClaw hooks system — a previously undocumented feature that executes sandboxed ES5.1 JavaScript for real-time event interception and transformation.

Changes

  • New doc: advanced/hooks-javascript.md (349 lines)

    • Handler signature and API
    • Event payload structures per event type
    • 4 practical examples (command blocking, PII redaction, auditing, rate limiting)
    • ES5.1 runtime capabilities and limitations
    • Safety limits (32 KiB source, 4 KiB stdout, concurrency caps, circuit breaker)
    • Matcher/filtering for performance optimization
    • Configuration via WebSocket and Web UI
    • Testing guide
    • Troubleshooting table
    • Best practices
  • Updated: advanced/hooks-quality-gates.md

    • Added script handler to the handler types table with link to new doc
  • Updated triple-sync (README.md, js/docs-app.js, index.html)

    • Added JavaScript Hooks entry in Advanced section
    • Added DOC_MAP entry with EN/VI/ZH titles
    • Added sidebar link

Test Plan

  • Documentation follows existing style and tone
  • Triple-sync completed (README, docs-app.js, index.html all updated)
  • Examples are ES5.1 compliant and tested against actual code
  • Cross-references to hooks-quality-gates.md work
  • No orphaned links (all 4 files synchronized)

Context

The script handler (handler_type: "script") is fully implemented in GoClaw (internal/hooks/handlers/script.go, internal/hooks/handlers/script_sandbox.go) but had no user documentation. This PR fills that gap with a complete guide.

🤖 Generated with Claude Code

- New doc: hooks-javascript.md with ES5.1 JS handler guide
- Covers sandboxed runtime, event payloads, examples, safety limits
- Update triple-sync: README.md, js/docs-app.js, index.html
- Add reference to script handler in hooks-quality-gates.md
- JavaScript hooks execute in-process via goja ES5.1 runtime

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant