Skip to content

docs: improve Puppeteer integration guide#1253

Merged
muodov merged 3 commits into
mainfrom
cursor/improve-puppeteer-docs-63dd
Apr 14, 2026
Merged

docs: improve Puppeteer integration guide#1253
muodov merged 3 commits into
mainfrom
cursor/improve-puppeteer-docs-63dd

Conversation

@muodov
Copy link
Copy Markdown
Member

@muodov muodov commented Apr 13, 2026

Follow-up to #1152

Task/Issue URL: N/A

Description:

The docs/puppeteer.md guide had several issues that would prevent users from successfully integrating autoconsent with Puppeteer. This PR fixes all of them:

Critical fix:

  • The initResp message was missing the rules field — without rules, autoconsent would never detect or handle any CMPs. Added rule loading from the shipped JSON bundles.

Accuracy fixes:

  • Updated the autoconsentConfig object to match the actual Config type in lib/types.ts:
    • Added missing fields: disabledCmps, isMainWorld, prehideTimeout, enableFilterList, enableHeuristicDetection
    • Added the full logs sub-object with all current keys (lifecycle, rulesteps, detectionsteps, evals, errors, messages, waits)
    • Removed non-existent enableHeuristicAction (the actual field is enableHeuristicDetection)
  • Fixed broken link to api.md (was pointing to root, now correctly points to docs/api.md)

Usability improvements:

  • Added handling for informational message types (cmpDetected, popupFound, optOutResult, autoconsentDone, autoconsentError) so users can monitor the consent flow
  • Modernized code from CommonJS require() to ESM import syntax, using import.meta.resolve + fileURLToPath instead of createRequire
  • Added a "Config reference" section with a table of key options
  • Added a "Rules" section explaining the two available rule bundles and how to load them

Steps to test this PR:

  1. Review docs/puppeteer.md for accuracy against lib/types.ts (Config type) and lib/messages.ts (message types)
  2. Verify npm run lint passes
  3. Verify npm run test:lib passes
Open in Web Open in Cursor 

- Fix critical bug: initResp was missing rules, making autoconsent
  non-functional (no CMPs would be detected)
- Add rule loading from shipped JSON bundles
- Update config to match current Config type (add disabledCmps,
  isMainWorld, prehideTimeout, enableFilterList, enableHeuristicDetection,
  full logs sub-object)
- Fix broken link to api.md (was at root, now points to docs/)
- Add handling for informational messages (cmpDetected, popupFound, etc.)
- Modernize from CommonJS require() to ESM imports
- Add config reference table and rules section

Co-authored-by: Maxim Tsoy <maks.tsoy@gmail.com>
@cursor
Copy link
Copy Markdown

cursor Bot commented Apr 13, 2026

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

cursoragent and others added 2 commits April 13, 2026 16:20
Co-authored-by: Maxim Tsoy <maks.tsoy@gmail.com>
Co-authored-by: Maxim Tsoy <maks.tsoy@gmail.com>
@muodov muodov added the documentation Changes only affect the documentation label Apr 13, 2026
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit bfa090c. Configure here.

Comment thread docs/puppeteer.md
@muodov muodov merged commit 9e7ffb2 into main Apr 14, 2026
8 checks passed
@muodov muodov deleted the cursor/improve-puppeteer-docs-63dd branch April 14, 2026 07:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Changes only affect the documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants