Skip to content

Commit db62e48

Browse files
authored
Merge pull request #337 from drivecore/docs/system-browser-detection
docs: add system browser detection documentation
2 parents 4fd8b48 + 2367481 commit db62e48

File tree

5 files changed

+196
-3
lines changed

5 files changed

+196
-3
lines changed

packages/docs/docs/getting-started/linux.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ npx mycoder "Your prompt here"
136136

137137
MyCoder can use a browser for research. On Linux:
138138

139-
1. **Chromium/Chrome/Firefox**: MyCoder works with these browsers automatically
139+
1. **System Browser Detection**: MyCoder automatically detects and uses your installed browsers (Chrome, Chromium, Firefox)
140140
2. **Dependencies**: You may need to install additional dependencies for browser automation:
141141
```bash
142142
# Ubuntu/Debian
@@ -146,6 +146,18 @@ MyCoder can use a browser for research. On Linux:
146146
libgtk-3-0 libgbm1
147147
```
148148
3. **Headless Mode**: By default, browser windows are hidden (use `--headless false` to show them)
149+
4. **Browser Preferences**: You can configure which browser MyCoder should use in your configuration file:
150+
```javascript
151+
// mycoder.config.js
152+
export default {
153+
browser: {
154+
useSystemBrowsers: true,
155+
preferredType: 'chromium', // or 'firefox'
156+
}
157+
};
158+
```
159+
160+
For more details on browser detection and configuration, see [System Browser Detection](../usage/browser-detection.md).
149161

150162
## Troubleshooting
151163

packages/docs/docs/getting-started/macos.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,21 @@ npx mycoder "Your prompt here"
152152

153153
MyCoder can use a browser for research. On macOS:
154154

155-
1. **Chrome/Safari**: MyCoder works with both browsers automatically
155+
1. **System Browser Detection**: MyCoder automatically detects and uses your installed browsers (Chrome, Chrome Canary, Edge, Firefox, Firefox Developer Edition, Firefox Nightly)
156156
2. **First Run**: You may see a browser window open briefly when MyCoder is first run
157157
3. **Headless Mode**: By default, browser windows are hidden (use `--headless false` to show them)
158+
4. **Browser Preferences**: You can configure which browser MyCoder should use in your configuration file:
159+
```javascript
160+
// mycoder.config.js
161+
export default {
162+
browser: {
163+
useSystemBrowsers: true,
164+
preferredType: 'chromium', // or 'firefox'
165+
}
166+
};
167+
```
168+
169+
For more details on browser detection and configuration, see [System Browser Detection](../usage/browser-detection.md).
158170

159171
## Troubleshooting
160172

packages/docs/docs/getting-started/windows.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,21 @@ npx mycoder "Your prompt here"
129129

130130
MyCoder can use a browser for research. On Windows:
131131

132-
1. **Chrome/Edge**: MyCoder works with both browsers automatically
132+
1. **System Browser Detection**: MyCoder automatically detects and uses your installed browsers (Chrome, Edge, Firefox)
133133
2. **First Run**: You may see a browser window open briefly when MyCoder is first run
134134
3. **Headless Mode**: By default, browser windows are hidden (use `--headless false` to show them)
135+
4. **Browser Preferences**: You can configure which browser MyCoder should use in your configuration file:
136+
```javascript
137+
// mycoder.config.js
138+
export default {
139+
browser: {
140+
useSystemBrowsers: true,
141+
preferredType: 'chromium', // or 'firefox'
142+
}
143+
};
144+
```
145+
146+
For more details on browser detection and configuration, see [System Browser Detection](../usage/browser-detection.md).
135147

136148
## Troubleshooting
137149

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
---
2+
sidebar_position: 7
3+
---
4+
5+
# System Browser Detection
6+
7+
MyCoder includes a system browser detection feature that allows it to use your existing installed browsers instead of requiring Playwright's bundled browsers. This is especially useful when MyCoder is installed globally via npm.
8+
9+
## How It Works
10+
11+
When you start a browser session in MyCoder, the system will:
12+
13+
1. Detect available browsers on your system (Chrome, Edge, Firefox, etc.)
14+
2. Select the most appropriate browser based on your configuration preferences
15+
3. Launch the browser using Playwright's `executablePath` option
16+
4. Fall back to Playwright's bundled browsers if no system browser is found
17+
18+
This process happens automatically and is designed to be seamless for the user.
19+
20+
## Supported Browsers
21+
22+
MyCoder can detect and use the following browsers:
23+
24+
### Windows
25+
- Google Chrome
26+
- Microsoft Edge
27+
- Mozilla Firefox
28+
29+
### macOS
30+
- Google Chrome
31+
- Google Chrome Canary
32+
- Microsoft Edge
33+
- Mozilla Firefox
34+
- Firefox Developer Edition
35+
- Firefox Nightly
36+
37+
### Linux
38+
- Google Chrome
39+
- Chromium
40+
- Mozilla Firefox
41+
42+
## Configuration Options
43+
44+
You can customize the browser detection behavior in your `mycoder.config.js` file:
45+
46+
```javascript
47+
// mycoder.config.js
48+
export default {
49+
// Other settings...
50+
51+
// System browser detection settings
52+
browser: {
53+
// Whether to use system browsers or Playwright's bundled browsers
54+
useSystemBrowsers: true,
55+
56+
// Preferred browser type (chromium, firefox, webkit)
57+
preferredType: 'chromium',
58+
59+
// Custom browser executable path (overrides automatic detection)
60+
// executablePath: null, // e.g., '/path/to/chrome'
61+
},
62+
};
63+
```
64+
65+
### Configuration Options Explained
66+
67+
| Option | Description | Default |
68+
|--------|-------------|---------|
69+
| `useSystemBrowsers` | Whether to use system-installed browsers if available | `true` |
70+
| `preferredType` | Preferred browser engine type (`chromium`, `firefox`, `webkit`) | `chromium` |
71+
| `executablePath` | Custom browser executable path (overrides automatic detection) | `null` |
72+
73+
## Browser Selection Priority
74+
75+
When selecting a browser, MyCoder follows this priority order:
76+
77+
1. Custom executable path specified in `browser.executablePath` (if provided)
78+
2. System browser matching the preferred type specified in `browser.preferredType`
79+
3. Any available system browser
80+
4. Playwright's bundled browsers (fallback)
81+
82+
## Troubleshooting
83+
84+
If you encounter issues with browser detection:
85+
86+
1. **Browser Not Found**: Ensure you have at least one supported browser installed on your system.
87+
88+
2. **Browser Compatibility Issues**: Some websites may work better with specific browser types. Try changing the `preferredType` setting if you encounter compatibility issues.
89+
90+
3. **Manual Override**: If automatic detection fails, you can manually specify the path to your browser using the `executablePath` option.
91+
92+
4. **Fallback to Bundled Browsers**: If you prefer to use Playwright's bundled browsers, set `useSystemBrowsers` to `false`.
93+
94+
## Examples
95+
96+
### Using Chrome as the Preferred Browser
97+
98+
```javascript
99+
// mycoder.config.js
100+
export default {
101+
browser: {
102+
useSystemBrowsers: true,
103+
preferredType: 'chromium',
104+
},
105+
};
106+
```
107+
108+
### Using Firefox as the Preferred Browser
109+
110+
```javascript
111+
// mycoder.config.js
112+
export default {
113+
browser: {
114+
useSystemBrowsers: true,
115+
preferredType: 'firefox',
116+
},
117+
};
118+
```
119+
120+
### Specifying a Custom Browser Path
121+
122+
```javascript
123+
// mycoder.config.js
124+
export default {
125+
browser: {
126+
useSystemBrowsers: true,
127+
executablePath: 'C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe', // Windows example
128+
// executablePath: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome', // macOS example
129+
// executablePath: '/usr/bin/google-chrome', // Linux example
130+
},
131+
};
132+
```

packages/docs/docs/usage/configuration.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,16 @@ export default {
8787
| `userSession` | Use existing browser session | `true`, `false` | `false` |
8888
| `pageFilter` | Method to process webpage content | `simple`, `none`, `readability` | `simple` |
8989

90+
#### System Browser Detection
91+
92+
MyCoder can detect and use your system-installed browsers instead of requiring Playwright's bundled browsers. This is especially useful when MyCoder is installed globally via npm.
93+
94+
| Option | Description | Possible Values | Default |
95+
| ------------------------- | ------------------------------------------------ | ------------------------------ | ---------- |
96+
| `browser.useSystemBrowsers` | Use system-installed browsers if available | `true`, `false` | `true` |
97+
| `browser.preferredType` | Preferred browser engine type | `chromium`, `firefox`, `webkit` | `chromium` |
98+
| `browser.executablePath` | Custom browser executable path (optional) | String path to browser executable | `null` |
99+
90100
Example:
91101

92102
```javascript
@@ -95,6 +105,14 @@ export default {
95105
// Show browser windows and use readability for better web content parsing
96106
headless: false,
97107
pageFilter: 'readability',
108+
109+
// System browser detection settings
110+
browser: {
111+
useSystemBrowsers: true,
112+
preferredType: 'firefox',
113+
// Optionally specify a custom browser path
114+
// executablePath: '/path/to/chrome',
115+
},
98116
};
99117
```
100118

@@ -174,6 +192,13 @@ export default {
174192
headless: false,
175193
userSession: true,
176194
pageFilter: 'readability',
195+
196+
// System browser detection settings
197+
browser: {
198+
useSystemBrowsers: true,
199+
preferredType: 'chromium',
200+
// executablePath: '/path/to/custom/browser',
201+
},
177202

178203
// GitHub integration
179204
githubMode: true,

0 commit comments

Comments
 (0)