Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
## Pull Request Checklist

Please ensure your PR follows the checklist below. This helps maintainers review and land changes quickly.

- [ ] I have installed project dependencies: `npm install` (and `cd client && npm install` if working in the UI)
- [ ] I ran TypeScript checks: `npx tsc --noEmit` — there are no new compile errors
- [ ] I installed Node types locally if touching server or scripts: `npm install --save-dev @types/node`
- [ ] I added or updated tests when applicable and ran them
- [ ] I added or updated docs (see `docs/KNOWN_ERRORS.md`) for breaking changes
- [ ] My PR description explains why the change is needed and references any related issues

If your change fixes an existing compile error listed in `docs/KNOWN_ERRORS.md`, add a short note in the PR body pointing to the doc and which lines were fixed.
15 changes: 11 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,14 @@ Thanks for your interest in this PoC!
5. Open a pull request with a short description and motivation

## Guidelines
- Keep PRs small and focused
- Prefer TypeScript and follow existing style
- Don’t commit auth/session data or secrets
- Respect the ethical / legal notes in the README (research & education only)

## Quick fixes for common TypeScript/compile errors

If you encounter TypeScript compilation errors when contributing, follow these quick steps to get a clean local environment:

- Install Node type definitions: `npm install --save-dev @types/node`
- Install any missing runtime dependencies listed in `package.json` with `npm install`.
- Run the TypeScript compiler to surface errors: `npx tsc --noEmit`.
- See `docs/KNOWN_ERRORS.md` for a curated list of current compile errors and suggested fixes.

If an imported package doesn't ship types, add a `declare module 'package-name';` fallback or contribute type declarations upstream.
46 changes: 46 additions & 0 deletions docs/KNOWN_ERRORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Known Compile / TypeScript Errors

This document lists currently observed TypeScript/compile errors and suggested fixes for contributors.

Summary of issues found (Dec 31, 2025):

- `src/index.ts`
- `Cannot find name 'process'` (used in `process.argv`, `process.stdout`, `process.stdin`).
- Fix: install Node types: `npm install --save-dev @types/node` and ensure `tsconfig.json` permits those types.
- `Cannot find module '@whiskeysockets/baileys'`.
- Fix: `npm install @whiskeysockets/baileys` and add types or `declare module` fallback if no types are published.
- `Cannot find module 'pino'` / `@hapi/boom` / `qrcode-terminal`.
- Fix: install packages: `npm install pino @hapi/boom qrcode-terminal` and add types if needed.
- `Cannot find module 'readline'`.
- Fix: builtin Node module — install `@types/node`.
- `Parameter 'update' implicitly has an 'any' type` (event handler callback).
- Fix: add an explicit type: `async (update: any) => {}` or import the event types from the package.
- `Parameter 'number' implicitly has an 'any' type` (readline callback).
- Fix: use `async (phoneNumber: string) => {}`.

- `src/scripts/init-signal.ts`
- `Cannot find module 'child_process'`, `os`, `path` — Node builtins not found.
- Fix: install `@types/node`.
- `Cannot find name 'process'` (usage of `process.exit(1)`).
- Fix: install `@types/node`.

General guidance:

- Install developer dependencies before running the TypeScript compiler:

```bash
npm install
npm install --save-dev @types/node
```

- After installing, run a compile check:

```bash
npx tsc --noEmit
```

- If a package does not ship types, either:
- add a `declare module 'name';` in a local `types/` file, or
- contribute type declarations to `@types` or the package itself.

If you fix one of the issues listed here, please update this document accordingly and open a PR.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"devDependencies": {
"@types/cors": "^2.8.19",
"@types/express": "^5.0.6",
"@types/node": "^20.0.0",
"@types/qrcode-terminal": "^0.12.2",
"@types/ws": "^8.18.1",
"tailwindcss": "^3.4.18",
Expand Down
10 changes: 5 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ async function connectToWhatsApp() {

let isConnected = false;

sock.ev.on('connection.update', async (update) => {
const { connection, lastDisconnect, qr } = update;
sock.ev.on('connection.update', async (update: any) => {
const { connection, lastDisconnect, qr } = update as any;

if (qr) {
qrcode.generate(qr, { small: true });
Expand Down Expand Up @@ -132,15 +132,15 @@ async function connectToWhatsApp() {

sock.ev.on('creds.update', saveCreds);

const askForTarget = () => {
const askForTarget = () => {
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});

rl.question('Enter target phone number (with country code, e.g., 491701234567): ', async (number) => {
rl.question('Enter target phone number (with country code, e.g., 491701234567): ', async (phoneNumber: string) => {
// Basic cleanup
const cleanNumber = number.replace(/\D/g, '');
const cleanNumber = phoneNumber.replace(/\D/g, '');

if (cleanNumber.length < 10) {
originalConsoleLog('Invalid number format. Please try again.');
Expand Down
7 changes: 7 additions & 0 deletions src/types/shims.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Local shims for third-party modules without bundled types
declare module '@whiskeysockets/baileys';
declare module 'pino';
declare module '@hapi/boom';
declare module 'qrcode-terminal';

// Allow Node globals (process, etc.) via @types/node installation
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"module": "NodeNext",
"moduleResolution": "NodeNext",
"esModuleInterop": true,
"types": ["node"],
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true,
Expand Down