Skip to content

Conversation

@konard
Copy link
Collaborator

@konard konard commented Dec 28, 2025

Summary

This PR integrates the browser-commander library for all browser operations, as requested in issue #24.

Full Integration with browser-commander

With browser-commander v0.4.0 now supporting custom Chrome args via the args option (see issue #11), we can now fully use its launchBrowser function for both Puppeteer and Playwright operations.

Key changes:

  • Uses launchBrowser from browser-commander for all browser launches
  • Passes server-specific args (--no-sandbox, --disable-setuid-sandbox, --disable-dev-shm-usage) via the args option
  • Configures headless: true for server environments
  • Uses unique userDataDir per session to avoid conflicts
  • Maintains the existing browser abstraction layer for compatibility with the rest of the codebase

Changes

File Change
package.json Updated browser-commander from ^0.3.0 to ^0.4.0
src/browser.js - Import only launchBrowser from browser-commander
- Use launchBrowser for both Puppeteer and Playwright
- Pass custom args, headless mode, and unique userDataDir
- Removed direct puppeteer/playwright imports

Test Results

All relevant tests pass:

  • ✅ Unit tests for getBrowserEngine function
  • ✅ Mock tests for endpoints (including /image which uses Puppeteer)
  • ✅ Unit tests for HTML to Markdown conversion
  • ✅ CLI tests

Playwright tests require Playwright browsers to be installed, which is expected for CI environments without Playwright binaries.

Related Issues


🤖 Generated with Claude Code

Adding CLAUDE.md with task information for AI processing.
This file will be removed when the task is complete.

Issue: #24
Use browser-commander library utilities (CHROME_ARGS) for browser operations.
Currently using browser-commander's CHROME_ARGS constants combined with
server-specific args until browser-commander adds support for custom args
in headless server environments.

- Add browser-commander as a dependency
- Import and use CHROME_ARGS from browser-commander
- Maintain server-specific args (--no-sandbox, etc.) separately
- Reference browser-commander issue #11 for future improvements

Relates to #24

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@konard konard changed the title [WIP] Use https://github.com/link-foundation/browser-commander feat: integrate browser-commander for browser operations Dec 28, 2025
@konard konard marked this pull request as ready for review December 28, 2025 04:44
@konard
Copy link
Collaborator Author

konard commented Dec 28, 2025

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Public pricing estimate: $5.324421 USD
  • Calculated by Anthropic: $3.651000 USD
  • Difference: $-1.673421 (-31.43%)
    📎 Log file uploaded as GitHub Gist (661KB)
    🔗 View complete solution draft log

Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard
Copy link
Collaborator Author

konard commented Dec 28, 2025

link-foundation/browser-commander#11 was closed, we can now continue.

@konard konard marked this pull request as draft December 28, 2025 05:17
@konard
Copy link
Collaborator Author

konard commented Dec 28, 2025

🤖 AI Work Session Started

Starting automated work session at 2025-12-28T05:17:31.858Z

The PR has been converted to draft mode while work is in progress.

This comment marks the beginning of an AI work session. Please wait working session to finish, and provide your feedback.

konard and others added 2 commits December 28, 2025 06:22
Now that browser-commander v0.4.0 supports custom Chrome args via the
`args` option, we can use its `launchBrowser` function directly instead
of maintaining our own browser launch code.

Changes:
- Update browser-commander dependency from ^0.3.0 to ^0.4.0
- Use launchBrowser from browser-commander for both Puppeteer and Playwright
- Pass server-specific args (--no-sandbox, etc.) via the args option
- Configure headless: true for server environments
- Use unique userDataDir per session to avoid conflicts

This fully integrates browser-commander as requested in issue #24.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@konard konard marked this pull request as ready for review December 28, 2025 05:28
@konard
Copy link
Collaborator Author

konard commented Dec 28, 2025

Full Integration Complete 🎉

Now that browser-commander issue #11 has been resolved and v0.4.0 is released, I've updated this PR to fully integrate browser-commander for all browser operations.

Changes in this update:

  • Updated browser-commander from ^0.3.0 to ^0.4.0
  • Refactored src/browser.js to use launchBrowser from browser-commander instead of direct puppeteer/playwright imports
  • Configured server-specific args (--no-sandbox, --disable-setuid-sandbox, --disable-dev-shm-usage) via the args option
  • Set headless: true for server environments
  • Use unique userDataDir per session to avoid conflicts

Tests

All CI checks are passing:

  • ✅ Unit tests for getBrowserEngine function
  • ✅ Mock endpoint tests (including /image which uses Puppeteer)
  • ✅ Changeset validation

The PR is now ready for review.

@konard
Copy link
Collaborator Author

konard commented Dec 28, 2025

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Public pricing estimate: $3.385254 USD
  • Calculated by Anthropic: $2.051862 USD
  • Difference: $-1.333392 (-39.39%)
    📎 Log file uploaded as GitHub Gist (454KB)
    🔗 View complete solution draft log

Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard konard merged commit 75f054a into main Dec 28, 2025
6 checks passed
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.

Use https://github.com/link-foundation/browser-commander

2 participants