* feat(browser): add CDP remote connection support for server environments This feature enables OpenCLI to connect to a Chrome browser running on a different machine (e.g., your local computer) from a headless server environment via Chrome DevTools Protocol (CDP). Server environments (CI, cloud VMs, headless Linux) cannot run Chrome with a GUI or install the Playwright MCP Bridge extension. This makes it impossible to use OpenCLI commands that require browser authentication. Add support for the `OPENCLI_CDP_ENDPOINT` environment variable, which tells OpenCLI to connect to a remote Chrome instance via CDP instead of using the local extension mode. 1. Start Chrome with remote debugging on local machine: ``` chrome --remote-debugging-port=9222 --user-data-dir="$HOME/chrome-debug" ``` 2. Create SSH tunnel to forward port to server: ``` ssh -R 9222:localhost:9222 your-server ``` 3. Run OpenCLI on server: ``` export OPENCLI_CDP_ENDPOINT="http://localhost:9222" opencli bilibili hot --limit 5 ``` - src/browser.ts: Add CDP endpoint detection in buildMcpArgs() - src/doctor.ts: Show CDP mode status in doctor report - README.md: Add "Remote Chrome (Server/Headless)" section - README.zh-CN.md: Add corresponding Chinese documentation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * docs: extract CDP connection guide into separate files * docs: clarify CDP vs SSH/Proxy distinction in CDP guides * docs: restructure CDP guides into 3 distinct phases (preparation, tunnel, execution) --------- Co-authored-by: ByteYue <yj976240184@gmail.com> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
32 lines
1.1 KiB
TypeScript
32 lines
1.1 KiB
TypeScript
/**
|
|
* Browser module — public API re-exports.
|
|
*
|
|
* This barrel replaces the former monolithic browser.ts.
|
|
* External code should import from './browser/index.js' (or './browser.js' via Node resolution).
|
|
*/
|
|
|
|
export { Page } from './page.js';
|
|
export { PlaywrightMCP } from './mcp.js';
|
|
export { getTokenFingerprint, formatBrowserConnectError } from './errors.js';
|
|
export type { ConnectFailureKind, ConnectFailureInput } from './errors.js';
|
|
export { resolveCdpEndpoint } from './discover.js';
|
|
|
|
// Test-only helpers — exposed for unit tests
|
|
import { createJsonRpcRequest } from './mcp.js';
|
|
import { extractTabEntries, diffTabIndexes, appendLimited } from './tabs.js';
|
|
import { buildMcpArgs, buildMcpLaunchSpec, findMcpServerPath, resetMcpServerPathCache, setMcpDiscoveryTestHooks } from './discover.js';
|
|
import { withTimeoutMs } from '../runtime.js';
|
|
|
|
export const __test__ = {
|
|
createJsonRpcRequest,
|
|
extractTabEntries,
|
|
diffTabIndexes,
|
|
appendLimited,
|
|
buildMcpArgs,
|
|
buildMcpLaunchSpec,
|
|
findMcpServerPath,
|
|
resetMcpServerPathCache,
|
|
setMcpDiscoveryTestHooks,
|
|
withTimeoutMs,
|
|
};
|