Contributing
This page mirrors the repo's CONTRIBUTING.md in a docs-friendly format.
Getting started
git clone https://github.com/Ilia01/hooklens.git
cd hooklens
npm installUseful local loops:
npm run devfor CLI/runtime worknpm run docs:devfor docs or homepage work
Making changes
- Open an issue first if the change is more than a typo fix
- Fork the repo and branch from
main - Make your changes
- Run the core checks:
npm test
npm run typecheck
npm run lintIf you changed docs, the homepage, or the VitePress theme, also run:
npm run docs:build- Open a PR against
main
Working in the CLI
CLI defaults live in src/cli/defaults.ts.
Shared command wrappers live in src/cli/runtime.ts:
withDefaultStorage(...)for commands that open the default SQLite databaserunCommandAction(...)for the standard terminal/error wrapper around Commander actions
Reuse those helpers instead of duplicating setup and cleanup logic in each command.
Working in the docs site
The docs site now has a custom homepage/theme layer:
- homepage entry point:
docs/index.md - custom homepage component:
docs/.vitepress/theme/components/HomePageContent.vue - shared theme styles:
docs/.vitepress/theme/style.css - site config and sidebar:
docs/.vitepress/config.ts
If you touch that layer, make npm run docs:build part of your normal loop.
Adding a provider
The verifier seam is intentionally small.
Additions usually touch four places:
src/verify/<provider>.tstests/verify/<provider>.test.tsbuildVerifier()insrc/cli/listen.ts- the relevant docs pages under
docs/verification/
See Adding Providers for the contract and expectations.
Security notes
Local binding only
The server binds to 127.0.0.1.
HookLens is a local development tool and should not silently become network-reachable.
Request smuggling defenses
The forwarding path is protected by:
- Node's default HTTP parser rejecting ambiguous framing before user code runs
- full request-body buffering after parser-level dechunking
fetch()recomputing outgoing framing
HookLens also strips hop-by-hop forwarding headers as defense in depth.
Body size
HookLens buffers the full request body in memory and currently caps it at 1 MiB. That is acceptable because the server only listens on localhost.
Forward target trust
--forward-to is provided by the CLI user, not by webhook data. If a future feature ever derives the target from request content, that will need explicit validation and allowlisting.
Commit messages
Use conventional commits:
feat:fix:docs:test:chore:
Code style
The repo uses ESLint and Prettier. Run npm run lint before you open a PR.