Skip to content

Remove spinnies dependency and add proper logging framework#135

Merged
9cb14c1ec0 merged 12 commits intomasterfrom
remove-spinnes
Dec 31, 2025
Merged

Remove spinnies dependency and add proper logging framework#135
9cb14c1ec0 merged 12 commits intomasterfrom
remove-spinnes

Conversation

@9cb14c1ec0
Copy link
Copy Markdown
Collaborator

@9cb14c1ec0 9cb14c1ec0 commented Dec 26, 2025

Fixes # .

Changes proposed in this pull request

To test (it takes a while): npm install github:<username>/venom#<branch>

Summary by CodeRabbit

  • New Features

    • Pluggable logger API with convenience helpers and a config option to supply a custom logger
    • Exposed runtime onLog event to forward runtime log messages to consumers
  • Refactor

    • Replaced spinner-based progress UI with unified logger-driven status output across init and runtime flows (QR/auth, browser, init)
  • Bug Fixes

    • Clearer "Invalid number" reporting when resolving chats for sends
  • Chores

    • Removed spinner library and related utilities/typings; simplified cleanup script
  • Style

    • Minor import/formatting cleanups

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Dec 26, 2025

Warning

Rate limit exceeded

@9cb14c1ec0 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 17 minutes and 36 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 600e350 and 6e8a6a9.

📒 Files selected for processing (1)
  • src/lib/wapi/functions/simulate-typing.js
📝 Walkthrough

Walkthrough

Replaced Spinnies-based spinners with a pluggable logger API across the codebase; removed spinnies dependency, typings, and utility; added logger module and config option; removed createWidWrapper and migrated WAPI chat lookups to WidFactory/FindOrCreateChat with updated logging and error handling.

Changes

Cohort / File(s) Summary
Package & typings
package.json, src/types/spinnies.d.ts
Removed spinnies dependency and its TypeScript declaration file; updated clean script from shx rm -rf session distrm -rf session dist.
Logger implementation
src/utils/logger.ts
New pluggable logger API: LogLevel, LoggerFunction, setLogger/getLogger, log, plus wrappers logInfo/logSuccess/logFail/logWarn and default console logger.
Config
src/config/create-config.ts
Replaced disableSpins?: boolean with logger?: LoggerFunction in CreateConfig; defaultOptions now use logger: null.
Spinnies utility removed
src/utils/spinnies.ts
Removed getSpinnies singleton accessor and related exports.
Host & Listener layers
src/api/layers/host.layer.ts, src/api/layers/listener.layer.ts
Replaced spinner API with protected log(text, status) on HostLayer; listener forwards onLog events; added global Window.onLog declaration.
Controllers & initializer
src/controllers/browser.ts, src/controllers/initializer.ts
Removed spinnies parameters/calls; replaced spinner updates with logInfo/logSuccess/logFail; initializer supports per-run logger via options.
Helpers
src/api/helpers/delete-file.ts, src/api/helpers/exposed.enum.ts
deleteFiles now uses logger wrappers instead of Spinnies; added onLog = 'onLog' to ExposedFn.
WAPI functions
src/lib/wapi/functions/*
src/lib/wapi/functions/get-chat.js, send-file.js, send-message.js, send-ptt.js, simulate-typing.js
Removed createWidWrapper usage; switched to window.Store.WidFactory.createWid(...) + window.Store.FindOrCreateChat.findOrCreateLatestChat(...) with try/catch paths and window.onLog usage for logging/invalid-number cases; preserved downstream behavior.
WAPI helper removal
src/lib/wapi/helper/fix-lid-migration.js, src/lib/wapi/helper/index.js
Removed createWidWrapper implementation and its re-export.
QR utility formatting
src/utils/qr-generator.ts
Reformatted dynamic import to single-line; no behavioral change.
Minor / whitespace
src/api/layers/sender.layer.ts
Non-functional whitespace change in startTyping; no behavioral change.

Sequence Diagram(s)

(Skipped — changes are cross-cutting logging and chat-resolution adjustments and do not introduce a new multi-component sequential feature per criteria.)

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • eslint upgrade #65: Overlapping edits replacing spinner usage with logger-like updates in layers and helpers.
  • Fix lid migration #128: Directly related to lid-migration / createWidWrapper usage and WAPI chat-resolution changes.

Poem

🐰
I hopped from dots to gentle notes,
Swapped whirring spinners for tiny quotes,
I log each hop both bold and small,
A quiet trail across the hall,
Carrots, cookies — watch the logs sprawl.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 5.26% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: removing the spinnies dependency from package.json and replacing it with a new logging framework throughout the codebase.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (3)
src/api/helpers/delete-file.ts (1)

25-25: Empty catch block silently swallows errors.

Consider logging the error for debugging purposes instead of silently ignoring it.

🔎 Proposed fix
-  } catch (e) {}
+  } catch (e) {
+    logFail(`Error during file deletion: ${e}`);
+  }
src/controllers/browser.ts (1)

385-414: Consider using CreateConfig type instead of inline type definition.

The inline options type duplicates most of CreateConfig. Using the existing type would reduce maintenance burden and ensure consistency.

🔎 Proposed simplification
-export async function initBrowser(options: {
-  session?: string;
-  folderNameToken?: string;
-  mkdirFolderToken?: string;
-  headless?: false | 'new' | 'old';
-  devtools?: boolean;
-  debug?: boolean;
-  browserWS?: string;
-  browserArgs?: string[];
-  addBrowserArgs?: string[];
-  puppeteerOptions?: LaunchOptions;
-  browser?: Browser | BrowserContext;
-  page?: Page;
-  logQR?: boolean;
-  disableWelcome?: boolean;
-  updatesLog?: boolean;
-  autoClose?: number;
-  createPathFileToken?: boolean;
-  waitForLogin?: boolean;
-  BrowserFetcher?: boolean;
-  forceConnect?: boolean;
-  attemptsForceConnectLoad?: number;
-  forceConnectTime?: number;
-  addProxy?: string[];
-  userProxy?: string;
-  userPass?: string;
-  browserPathExecutable?: string;
-  forceWebpack?: boolean;
-  webVersion?: boolean | string;
-}): Promise<Browser | false> {
+export async function initBrowser(
+  options: CreateConfig
+): Promise<Browser | false> {
src/utils/logger.ts (1)

5-13: Consider using console.error for failure and warning levels.

Using the appropriate console method improves debuggability as errors and warnings can be filtered separately in browser dev tools and log aggregators.

🔎 Proposed enhancement
 const defaultLogger: LoggerFunction = (message: string, level: LogLevel) => {
   const prefix = {
     info: '[INFO]',
     success: '[SUCCESS]',
     fail: '[FAIL]',
     warn: '[WARN]'
   };
-  console.log(`${prefix[level]} ${message}`);
+  const logMethod = level === 'fail' || level === 'warn' ? console.error : console.log;
+  logMethod(`${prefix[level]} ${message}`);
 };
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 42f63ce and d5db890.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (12)
  • package.json
  • src/api/helpers/delete-file.ts
  • src/api/layers/host.layer.ts
  • src/api/layers/listener.layer.ts
  • src/config/create-config.ts
  • src/controllers/browser.ts
  • src/controllers/initializer.ts
  • src/lib/wapi/functions/get-chat.js
  • src/types/spinnies.d.ts
  • src/utils/logger.ts
  • src/utils/qr-generator.ts
  • src/utils/spinnies.ts
💤 Files with no reviewable changes (3)
  • package.json
  • src/utils/spinnies.ts
  • src/types/spinnies.d.ts
🧰 Additional context used
📓 Path-based instructions (6)
src/api/layers/*.layer.ts

📄 CodeRabbit inference engine (CLAUDE.md)

Keep functionality layers in src/api/layers using the *.layer.ts naming (e.g., sender.layer.ts, listener.layer.ts, group.layer.ts, profile.layer.ts, controls.layer.ts, retriever.layer.ts)

Files:

  • src/api/layers/listener.layer.ts
  • src/api/layers/host.layer.ts
src/lib/wapi/functions/**/*.js

📄 CodeRabbit inference engine (CLAUDE.md)

WAPI functions in src/lib/wapi/functions are JavaScript files injected into the browser; after changing them, run npm run build:wapi to rebuild

Files:

  • src/lib/wapi/functions/get-chat.js
src/lib/wapi/**/*.js

📄 CodeRabbit inference engine (CLAUDE.md)

WAPI layer code is built with webpack and injected into the Puppeteer browser context

Files:

  • src/lib/wapi/functions/get-chat.js
src/controllers/*.ts

📄 CodeRabbit inference engine (CLAUDE.md)

Controllers (initializer.ts for session creation, browser.ts for Puppeteer management, auth.ts for authentication/QR) live under src/controllers

Files:

  • src/controllers/initializer.ts
  • src/controllers/browser.ts
src/api/helpers/**/*.{ts,js}

📄 CodeRabbit inference engine (CLAUDE.md)

Put utility helpers (e.g., encryption, QR code utilities) under src/api/helpers

Files:

  • src/api/helpers/delete-file.ts
src/config/**/*.ts

📄 CodeRabbit inference engine (CLAUDE.md)

Keep browser/Puppeteer and session management configuration under src/config

Files:

  • src/config/create-config.ts
🧠 Learnings (4)
📚 Learning: 2025-09-08T17:49:03.345Z
Learnt from: CR
Repo: venomlib/venom PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-09-08T17:49:03.345Z
Learning: Applies to src/api/layers/*.layer.ts : Keep functionality layers in src/api/layers using the *.layer.ts naming (e.g., sender.layer.ts, listener.layer.ts, group.layer.ts, profile.layer.ts, controls.layer.ts, retriever.layer.ts)

Applied to files:

  • src/api/layers/listener.layer.ts
  • src/api/layers/host.layer.ts
📚 Learning: 2025-09-08T17:49:03.345Z
Learnt from: CR
Repo: venomlib/venom PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-09-08T17:49:03.345Z
Learning: Applies to src/controllers/*.ts : Controllers (initializer.ts for session creation, browser.ts for Puppeteer management, auth.ts for authentication/QR) live under src/controllers

Applied to files:

  • src/api/layers/host.layer.ts
  • src/controllers/initializer.ts
  • src/controllers/browser.ts
📚 Learning: 2025-09-08T17:49:03.345Z
Learnt from: CR
Repo: venomlib/venom PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-09-08T17:49:03.345Z
Learning: Applies to src/config/**/*.ts : Keep browser/Puppeteer and session management configuration under src/config

Applied to files:

  • src/config/create-config.ts
📚 Learning: 2025-09-08T17:49:03.345Z
Learnt from: CR
Repo: venomlib/venom PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-09-08T17:49:03.345Z
Learning: Applies to src/lib/wapi/**/*.js : WAPI layer code is built with webpack and injected into the Puppeteer browser context

Applied to files:

  • src/config/create-config.ts
  • src/controllers/browser.ts
🧬 Code graph analysis (7)
src/lib/wapi/functions/get-chat.js (1)
src/lib/wapi/helper/fix-lid-migration.js (4)
  • chatWid (6-6)
  • createWidWrapper (1-42)
  • _ (25-38)
  • chat (24-24)
src/utils/logger.ts (1)
src/api/layers/host.layer.ts (1)
  • log (43-53)
src/api/layers/host.layer.ts (1)
src/utils/logger.ts (3)
  • logSuccess (33-35)
  • logFail (37-39)
  • logInfo (29-31)
src/controllers/initializer.ts (3)
src/utils/logger.ts (4)
  • setLogger (17-19)
  • logInfo (29-31)
  • logFail (37-39)
  • logSuccess (33-35)
app.js (2)
  • browser (25-25)
  • page (24-24)
src/controllers/browser.ts (3)
  • initBrowser (385-602)
  • initWhatsapp (41-122)
  • statusLog (654-684)
src/api/helpers/delete-file.ts (2)
src/api/helpers/index.ts (1)
  • deleteFiles (9-9)
src/utils/logger.ts (3)
  • logInfo (29-31)
  • logFail (37-39)
  • logSuccess (33-35)
src/config/create-config.ts (1)
src/utils/logger.ts (1)
  • LoggerFunction (3-3)
src/controllers/browser.ts (2)
src/config/options.ts (1)
  • options (5-106)
src/utils/logger.ts (3)
  • logSuccess (33-35)
  • logFail (37-39)
  • logInfo (29-31)
🔇 Additional comments (10)
src/utils/qr-generator.ts (1)

39-40: LGTM!

Minor formatting adjustment to the dynamic import. No functional changes.

src/api/layers/listener.layer.ts (1)

59-62: LGTM!

The migration from spin to log for the page close event aligns with the PR's goal of replacing spinnies with the new logger framework. The log method is properly inherited from HostLayer and handles the 'fail' status correctly.

src/config/create-config.ts (2)

62-66: LGTM!

Clean replacement of disableSpins with the new logger option. The JSDoc documentation clearly explains the behavior and the default fallback to console.log.


155-155: LGTM!

Default null value correctly triggers the fallback to defaultLogger in setLogger().

src/controllers/initializer.ts (2)

156-159: LGTM!

Good placement of logger initialization early in the create function, allowing all subsequent logging to use the custom logger if provided.


251-254: LGTM!

Clean callback pattern for statusLog that properly routes events through the logger while maintaining the existing statusFind callback behavior.

src/api/layers/host.layer.ts (1)

43-53: LGTM!

Well-designed helper method that:

  1. Adds session context to all log messages for easier debugging in multi-session scenarios
  2. Cleanly maps the status parameter to the appropriate logger function
  3. Uses a sensible default of 'info' for the status parameter
src/controllers/browser.ts (2)

451-551: LGTM!

Logger calls appropriately replace spinnies throughout the browser initialization flow. Status messages maintain semantic consistency (success for completions, info for progress, fail for errors).


723-757: LGTM!

The removeStoredSingletonLock function properly uses the logger for all status updates during the SingletonLock file management process.

src/utils/logger.ts (1)

1-43: LGTM!

Clean and simple pluggable logger implementation. The design allows external consumers to inject custom logging behavior while providing sensible defaults.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (1)
src/lib/wapi/functions/get-chat.js (1)

16-21: Critical: Missing return statement causes found to be undefined.

The .then() callback accesses result.chat (line 20) but doesn't return it. This causes found to be assigned undefined instead of the chat object, breaking the entire function. The ESLint disable comment on line 19 confirms this is a no-op expression.

🔎 Proposed fix
     found = await window.Store.FindOrCreateChat.findOrCreateLatestChat(
       chatWid
     ).then((result) => {
-      // eslint-disable-next-line @typescript-eslint/no-unused-expressions
-      result.chat;
+      return result.chat;
     });

Alternatively, use the simpler approach from the original past review suggestion:

-    found = await window.Store.FindOrCreateChat.findOrCreateLatestChat(
-      chatWid
-    ).then((result) => {
-      // eslint-disable-next-line @typescript-eslint/no-unused-expressions
-      result.chat;
-    });
+    const result = await window.Store.FindOrCreateChat.findOrCreateLatestChat(chatWid);
+    found = result.chat;
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d5db890 and 2168d71.

📒 Files selected for processing (3)
  • src/api/helpers/exposed.enum.ts
  • src/api/layers/listener.layer.ts
  • src/lib/wapi/functions/get-chat.js
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/api/layers/listener.layer.ts
🧰 Additional context used
📓 Path-based instructions (3)
src/lib/wapi/functions/**/*.js

📄 CodeRabbit inference engine (CLAUDE.md)

WAPI functions in src/lib/wapi/functions are JavaScript files injected into the browser; after changing them, run npm run build:wapi to rebuild

Files:

  • src/lib/wapi/functions/get-chat.js
src/lib/wapi/**/*.js

📄 CodeRabbit inference engine (CLAUDE.md)

WAPI layer code is built with webpack and injected into the Puppeteer browser context

Files:

  • src/lib/wapi/functions/get-chat.js
src/api/helpers/**/*.{ts,js}

📄 CodeRabbit inference engine (CLAUDE.md)

Put utility helpers (e.g., encryption, QR code utilities) under src/api/helpers

Files:

  • src/api/helpers/exposed.enum.ts
🔇 Additional comments (3)
src/api/helpers/exposed.enum.ts (1)

16-17: LGTM!

The new onLog enum member is correctly added and follows the existing naming convention. This properly supports the new logging framework introduced in this PR.

src/lib/wapi/functions/get-chat.js (2)

23-23: LGTM!

The logging statements have been correctly migrated from console.info/console.log to window.OnLog, aligning with the new logging framework introduced in this PR.

Also applies to: 28-28, 34-34


1-54: Reminder: Rebuild WAPI after changes.

Since this is a WAPI function file, remember to run npm run build:wapi after making changes to rebuild the injected browser code.

Based on coding guidelines for files matching src/lib/wapi/functions/**/*.js.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/lib/wapi/functions/send-file.js (1)

27-34: Copy-paste bug: wrong variable in length check.

The validation checks chatid.length === 0 but should check filename.length === 0. This means invalid filenames won't be caught. The same bug exists at lines 36 and 45 for caption and file respectively.

🔎 Proposed fix for all three validations
-  if (typeof filename !== 'string' || chatid.length === 0) {
+  if (typeof filename !== 'string' || filename.length === 0) {
     return WAPI.scope(
       chatid,
       true,
       null,
       'incorrect parameter filename, insert an string'
     );
   }

-  if (typeof caption !== 'string' || chatid.length === 0) {
+  if (typeof caption !== 'string' || caption.length === 0) {
     return WAPI.scope(
       chatid,
       true,
       null,
       'incorrect parameter caption, insert an string'
     );
   }

-  if (typeof file !== 'string' || chatid.length === 0) {
+  if (typeof file !== 'string' || file.length === 0) {
     return WAPI.scope(
       chatid,
       true,
       null,
       'incorrect parameter file, insert an string'
     );
   }
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5407d44 and 39fec3d.

📒 Files selected for processing (7)
  • src/lib/wapi/functions/get-chat.js
  • src/lib/wapi/functions/send-file.js
  • src/lib/wapi/functions/send-message.js
  • src/lib/wapi/functions/send-ptt.js
  • src/lib/wapi/functions/simulate-typing.js
  • src/lib/wapi/helper/fix-lid-migration.js
  • src/lib/wapi/helper/index.js
💤 Files with no reviewable changes (2)
  • src/lib/wapi/helper/index.js
  • src/lib/wapi/helper/fix-lid-migration.js
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/lib/wapi/functions/get-chat.js
🧰 Additional context used
📓 Path-based instructions (2)
src/lib/wapi/functions/**/*.js

📄 CodeRabbit inference engine (CLAUDE.md)

WAPI functions in src/lib/wapi/functions are JavaScript files injected into the browser; after changing them, run npm run build:wapi to rebuild

Files:

  • src/lib/wapi/functions/simulate-typing.js
  • src/lib/wapi/functions/send-file.js
  • src/lib/wapi/functions/send-message.js
  • src/lib/wapi/functions/send-ptt.js
src/lib/wapi/**/*.js

📄 CodeRabbit inference engine (CLAUDE.md)

WAPI layer code is built with webpack and injected into the Puppeteer browser context

Files:

  • src/lib/wapi/functions/simulate-typing.js
  • src/lib/wapi/functions/send-file.js
  • src/lib/wapi/functions/send-message.js
  • src/lib/wapi/functions/send-ptt.js
🧠 Learnings (1)
📚 Learning: 2025-09-08T17:49:03.345Z
Learnt from: CR
Repo: venomlib/venom PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-09-08T17:49:03.345Z
Learning: Applies to src/lib/wapi/functions/**/*.js : WAPI functions in src/lib/wapi/functions are JavaScript files injected into the browser; after changing them, run `npm run build:wapi` to rebuild

Applied to files:

  • src/lib/wapi/functions/send-file.js
🧬 Code graph analysis (3)
src/lib/wapi/functions/send-file.js (11)
src/lib/wapi/functions/send-message.js (2)
  • wid (30-30)
  • chat (31-31)
src/lib/wapi/wapi.js (2)
  • chat (443-443)
  • chat (502-502)
src/lib/wapi/functions/send-contact-vcard-list.js (1)
  • chat (29-29)
src/lib/wapi/functions/send-sticker.js (1)
  • chat (2-2)
src/lib/wapi/functions/send-contact-vcard.js (1)
  • chat (15-15)
src/lib/wapi/functions/send-buttons.js (1)
  • chat (40-40)
src/lib/wapi/functions/reply.js (1)
  • chat (26-26)
src/lib/wapi/functions/send-list-menu.js (1)
  • chat (98-98)
src/lib/wapi/functions/send-message-scope.js (1)
  • chat (39-39)
src/lib/wapi/functions/send-type-buttons.js (1)
  • chat (2-2)
src/lib/wapi/functions/open-chat.js (4)
  • chat (7-7)
  • chat (16-16)
  • chat (18-18)
  • chat (36-36)
src/lib/wapi/functions/send-message.js (4)
src/lib/wapi/functions/send-file.js (2)
  • wid (59-59)
  • chat (60-60)
src/lib/wapi/functions/set-new-message.js (1)
  • chat (9-11)
src/lib/wapi/functions/send-buttons.js (1)
  • chat (40-40)
src/lib/wapi/functions/check-number-status.js (1)
  • err (3-3)
src/lib/wapi/functions/send-ptt.js (14)
src/lib/wapi/functions/send-message.js (2)
  • wid (30-30)
  • chat (31-31)
src/lib/wapi/functions/simulate-typing.js (1)
  • chat (4-4)
src/lib/wapi/wapi.js (3)
  • chat (443-443)
  • chat (502-502)
  • chat (511-511)
src/lib/wapi/functions/send-contact-vcard-list.js (1)
  • chat (29-29)
src/lib/wapi/functions/send-sticker.js (1)
  • chat (2-2)
src/lib/wapi/functions/send-contact-vcard.js (1)
  • chat (15-15)
src/lib/wapi/functions/send-buttons.js (1)
  • chat (40-40)
src/lib/wapi/functions/reply.js (1)
  • chat (26-26)
src/lib/wapi/functions/send-location.js (1)
  • chat (7-7)
src/lib/wapi/functions/send-list-menu.js (1)
  • chat (98-98)
src/lib/wapi/functions/send-message-scope.js (1)
  • chat (39-39)
src/lib/wapi/functions/send-type-buttons.js (1)
  • chat (2-2)
src/lib/wapi/functions/delete-messages.js (1)
  • chat (10-10)
src/lib/wapi/functions/check-number-status.js (1)
  • err (3-3)
🔇 Additional comments (2)
src/lib/wapi/functions/simulate-typing.js (2)

1-15: Reminder: Rebuild WAPI after changes.

As per coding guidelines, after modifying WAPI functions in src/lib/wapi/functions/, run npm run build:wapi to rebuild the injected browser code.


13-13: Store.ChatStates API migration is complete and consistent.

The plural form Store.ChatStates.sendChatStateComposing() is correctly used in this file and consistently applied across the codebase. No remaining references to the old singular Store.ChatState form exist, confirming the migration is fully implemented.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6fdfcd1 and cff0d50.

📒 Files selected for processing (1)
  • package.json
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: CR
Repo: venomlib/venom PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-09-08T17:49:03.345Z
Learning: Applies to src/lib/wapi/**/*.js : WAPI layer code is built with webpack and injected into the Puppeteer browser context
🔇 Additional comments (1)
package.json (1)

114-133: Spinnies dependency has been completely removed.

No references to spinnies remain in the source code.

"changelog:preview": "conventional-changelog -p angular -u",
"changelog:update": "conventional-changelog -p angular -i CHANGELOG.md -s",
"clean": "shx rm -rf session dist",
"clean": "rm -rf session dist",
Copy link
Copy Markdown

@coderabbitai coderabbitai bot Dec 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Restore shx to maintain cross-platform compatibility.

The change from shx rm -rf... to rm -rf... breaks Windows compatibility. The rm -rf command is not available natively on Windows systems. Since shx is already in devDependencies and used in other scripts (line 30: copy:vendor), it should be retained here for consistency and cross-platform support.

🔎 Proposed fix
-    "clean": "rm -rf session dist",
+    "clean": "shx rm -rf session dist",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"clean": "rm -rf session dist",
"clean": "shx rm -rf session dist",
🤖 Prompt for AI Agents
In package.json around line 37, the "clean" script uses the Unix-only command
"rm -rf session dist", which breaks Windows; change it back to use the
cross-platform shim by replacing the command with "shx rm -rf session dist" so
the script remains consistent with other scripts and works on Windows and Unix.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shx isn't available by default on all linux systems.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@9cb14c1ec0, I understand your concern. However, shx is already a devDependency in your package.json (line 77), so it will be available after npm install when developers run these scripts. The npm scripts execute in the context of installed dependencies.

The main considerations are:

  1. Cross-platform compatibility: rm -rf works on Linux/macOS but fails on Windows without WSL/Git Bash
  2. Consistency: The copy:vendor script (line 30) still uses shx cp -r vendor dist/

You have a few options:

  • Keep shx for consistency: Use shx rm -rf to match the copy:vendor script and maintain Windows compatibility
  • Remove shx entirely: Change both scripts to native commands (but Windows users would need WSL/Git Bash)
  • Platform-specific scripts: Use different commands per platform (more complex)

What's your preference? If you want to drop shx entirely, you'd need to update copy:vendor as well and note in the README that Windows users need WSL/Git Bash.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@9cb14c1ec0, how would you like to proceed? I'm here to help if you have any questions or need assistance with this change.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cff0d50 and da4fb84.

📒 Files selected for processing (1)
  • src/lib/wapi/functions/simulate-typing.js
🧰 Additional context used
📓 Path-based instructions (2)
src/lib/wapi/functions/**/*.js

📄 CodeRabbit inference engine (CLAUDE.md)

WAPI functions in src/lib/wapi/functions are JavaScript files injected into the browser; after changing them, run npm run build:wapi to rebuild

Files:

  • src/lib/wapi/functions/simulate-typing.js
src/lib/wapi/**/*.js

📄 CodeRabbit inference engine (CLAUDE.md)

WAPI layer code is built with webpack and injected into the Puppeteer browser context

Files:

  • src/lib/wapi/functions/simulate-typing.js
🧠 Learnings (1)
📓 Common learnings
Learnt from: CR
Repo: venomlib/venom PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-09-08T17:49:03.345Z
Learning: Applies to src/lib/wapi/**/*.js : WAPI layer code is built with webpack and injected into the Puppeteer browser context

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (1)
src/lib/wapi/functions/simulate-typing.js (1)

4-13: Critical: Wid vs Chat object mismatch still unresolved.

The previous review comment on this code segment remains valid. WidFactory.createWid(chatId) creates a Wid (WhatsApp ID) object, not a Chat object. The sendChatStateComposing() method expects a Chat object. Additionally, createWid() constructs and returns a Wid—it won't be falsy, making the if (!chat) check ineffective.

Follow the two-step pattern used in other WAPI functions:

🔎 Proposed fix using FindOrCreateChat pattern
 export async function startTyping(chatId) {
   console.log(`startTyping: chatId ${chatId}`);
   try {
-    let chat = window.Store.WidFactory.createWid(chatId);
-    if (!chat) {
+    const wid = window.Store.WidFactory.createWid(chatId);
+    const chat = await window.Store.FindOrCreateChat.findOrCreateLatestChat(wid);
+    if (!chat) {
       throw {
         error: true,
         code: 'chat_not_found',
         message: 'Chat not found',
         chatId: chatId
       };
     }
     await Store.ChatStates.sendChatStateComposing(chat);
🧹 Nitpick comments (1)
src/lib/wapi/functions/simulate-typing.js (1)

13-13: Inconsistent Store reference.

Line 4 uses window.Store.WidFactory but line 13 uses Store.ChatStates without the window. prefix. Use a consistent reference style throughout the function for maintainability.

🔎 Proposed fix
-    await Store.ChatStates.sendChatStateComposing(chat);
+    await window.Store.ChatStates.sendChatStateComposing(chat);
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between da4fb84 and e8c94a7.

📒 Files selected for processing (2)
  • src/api/layers/sender.layer.ts
  • src/lib/wapi/functions/simulate-typing.js
✅ Files skipped from review due to trivial changes (1)
  • src/api/layers/sender.layer.ts
🧰 Additional context used
📓 Path-based instructions (2)
src/lib/wapi/functions/**/*.js

📄 CodeRabbit inference engine (CLAUDE.md)

WAPI functions in src/lib/wapi/functions are JavaScript files injected into the browser; after changing them, run npm run build:wapi to rebuild

Files:

  • src/lib/wapi/functions/simulate-typing.js
src/lib/wapi/**/*.js

📄 CodeRabbit inference engine (CLAUDE.md)

WAPI layer code is built with webpack and injected into the Puppeteer browser context

Files:

  • src/lib/wapi/functions/simulate-typing.js
🧠 Learnings (1)
📓 Common learnings
Learnt from: CR
Repo: venomlib/venom PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-09-08T17:49:03.345Z
Learning: Applies to src/lib/wapi/**/*.js : WAPI layer code is built with webpack and injected into the Puppeteer browser context
🧬 Code graph analysis (1)
src/lib/wapi/functions/simulate-typing.js (1)
src/lib/wapi/wapi.js (3)
  • chat (443-443)
  • chat (502-502)
  • chat (511-511)

@9cb14c1ec0 9cb14c1ec0 merged commit 13ce4b3 into master Dec 31, 2025
3 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Dec 31, 2025
@9cb14c1ec0 9cb14c1ec0 deleted the remove-spinnes branch December 31, 2025 19:48
@coderabbitai coderabbitai bot mentioned this pull request Mar 9, 2026
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