Thank you for your interest in contributing to dotmask!
# Clone the repository
git clone https://github.com/ducnmm/dotmask.git
cd dotmask
# Install dependencies
npm install
# Build TypeScript
npm run build
# Run tests
npm test
# Run with debug logging
DOTMASK_DEBUG=1 node dist/proxy/server.js --port 18787dotmask/
├── src/
│ ├── cli.ts # CLI entry point
│ ├── utils.ts # Utilities (colors, logging, platform checks)
│ ├── commands/
│ │ ├── install.ts # install/uninstall/status/doctor commands
│ │ └── hosts.ts # allow/disallow/hosts commands
│ └── proxy/
│ ├── server.ts # Main MITM HTTPS proxy server
│ ├── masker.ts # Core masking/unmasking logic
│ ├── config.ts # Host configuration management
│ ├── cert.ts # CA certificate generation
│ ├── daemon.ts # launchd daemon management
│ ├── sse.ts # SSE streaming handling
│ └── http.ts # HTTP request parsing
├── bin/
│ └── dotmask.js # Entry point for npm bin
└── test/
└── *.test.js # Test files
Edit src/proxy/masker.ts:
- Add pattern to
KNOWN_TOKEN_PARTSarray - Add corresponding prefix to
KNOWN_PREFIXES - Add charset detection in
detectCharset()if needed - Test with the new pattern
// Example: adding a new API key pattern
String.raw`sk-newprovider-[A-Za-z0-9\-_+/]{20,}`,
// Add to KNOWN_PREFIXES
/^(sk-newprovider-)/,Edit src/proxy/masker.ts:
export const AI_DOMAINS = new Set([
// existing domains...
"api.newprovider.com",
]);- TypeScript with strict mode
- 2 spaces indentation
- No semicolons
- Single quotes for strings
- Trailing commas
# Run all tests
npm test
# Run specific test
node --test test/masker.test.js- Fork the repository
- Create a feature branch:
git checkout -b feature/my-feature - Make changes with tests
- Ensure all tests pass:
npm test - Build:
npm run build - Commit with clear message:
git commit -m "Add support for X" - Push and create PR
Please include:
- macOS version
- Node.js version (
node --version) - dotmask version (
dotmask --version) - Steps to reproduce
- Expected vs actual behavior
- Relevant log output (
~/.dotmask/proxy.err.log)
See SECURITY.md for responsible disclosure guidelines.