Skip to content

Commit 00bd879

Browse files
committed
feat(browser): add system browser detection for Playwright
This change allows mycoder to detect and use system-installed browsers instead of requiring Playwright's bundled browsers to be installed. It improves the experience when mycoder is installed globally via npm. - Add BrowserDetector module for cross-platform browser detection - Update SessionManager to use detected system browsers - Add configuration options for browser preferences - Update documentation in README.md - Maintain compatibility with headless mode and clean sessions Fixes #333
1 parent cbd6e5e commit 00bd879

File tree

9 files changed

+995
-50
lines changed

9 files changed

+995
-50
lines changed

README.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,18 @@ export default {
8181
userSession: false,
8282
pageFilter: 'none', // 'simple', 'none', or 'readability'
8383

84+
// System browser detection settings
85+
browser: {
86+
// Whether to use system browsers or Playwright's bundled browsers
87+
useSystemBrowsers: true,
88+
89+
// Preferred browser type (chromium, firefox, webkit)
90+
preferredType: 'chromium',
91+
92+
// Custom browser executable path (overrides automatic detection)
93+
// executablePath: null, // e.g., '/path/to/chrome'
94+
},
95+
8496
// Model settings
8597
provider: 'anthropic',
8698
model: 'claude-3-7-sonnet-20250219',
@@ -209,6 +221,43 @@ MyCoder follows the [Conventional Commits](https://www.conventionalcommits.org/)
209221

210222
For more details, see the [Contributing Guide](CONTRIBUTING.md).
211223

224+
## Browser Automation
225+
226+
MyCoder uses Playwright for browser automation, which is used by the `sessionStart` and `sessionMessage` tools. By default, Playwright requires browsers to be installed separately via `npx playwright install`.
227+
228+
### System Browser Detection
229+
230+
MyCoder now includes a system browser detection feature that allows it to use your existing installed browsers instead of requiring separate Playwright browser installations. This is particularly useful when MyCoder is installed globally.
231+
232+
The system browser detection:
233+
234+
1. Automatically detects installed browsers on Windows, macOS, and Linux
235+
2. Supports Chrome, Edge, Firefox, and other browsers
236+
3. Maintains headless mode and clean session capabilities
237+
4. Falls back to Playwright's bundled browsers if no system browser is found
238+
239+
### Configuration
240+
241+
You can configure the browser detection in your `mycoder.config.js`:
242+
243+
```js
244+
export default {
245+
// Other configuration...
246+
247+
// System browser detection settings
248+
browser: {
249+
// Whether to use system browsers or Playwright's bundled browsers
250+
useSystemBrowsers: true,
251+
252+
// Preferred browser type (chromium, firefox, webkit)
253+
preferredType: 'chromium',
254+
255+
// Custom browser executable path (overrides automatic detection)
256+
// executablePath: null, // e.g., '/path/to/chrome'
257+
},
258+
};
259+
```
260+
212261
## Contributing
213262

214263
Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to this project.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy