Files
opencli/src/clis/chatgpt/README.md
T
jackwener beda0b714c docs: remove all remaining Playwright references from docs
Updated 6 files:
- CDP.md, CDP.zh-CN.md: Browser Bridge instead of Playwright MCP Bridge
- CLI-ELECTRON.md: Browser Bridge / IPage abstraction wording
- CLI-EXPLORER.md: browser tools instead of Playwright MCP tools
- TESTING.md: Browser Bridge extension mode, removed token references
- src/clis/chatgpt/README{,.zh-CN}.md: CDP instead of Playwright

Zero Playwright references remaining across all .md files.
2026-03-19 16:55:20 +08:00

1.9 KiB

ChatGPT Desktop Adapter for OpenCLI

Control the ChatGPT macOS Desktop App directly from the terminal. OpenCLI supports two automation approaches for ChatGPT.

Approach 1: AppleScript (Default, No Setup)

The current built-in commands use native AppleScript automation — no extra launch flags needed.

Prerequisites

  1. Install the official ChatGPT Desktop App from OpenAI.
  2. Grant Accessibility permissions to your terminal app (Terminal / iTerm / Warp) in System Settings → Privacy & Security → Accessibility. This is required for System Events keystroke simulation.

Commands

  • opencli chatgpt status: Check if the ChatGPT app is currently running.
  • opencli chatgpt new: Activate ChatGPT and press Cmd+N to start a new conversation.
  • opencli chatgpt send "message": Copy your message to clipboard, activate ChatGPT, paste, and submit.
  • opencli chatgpt read: Copy the last AI response via Cmd+Shift+C and return it as text.

Approach 2: CDP (Advanced, Electron Debug Mode)

ChatGPT Desktop is also an Electron app and can be launched with a remote debugging port for deeper automation via CDP:

/Applications/ChatGPT.app/Contents/MacOS/ChatGPT \
  --remote-debugging-port=9224

Then set the endpoint:

export OPENCLI_CDP_ENDPOINT="http://127.0.0.1:9224"

Note

: The CDP approach enables future advanced commands like DOM inspection, model switching, and code extraction — similar to the Cursor and Codex adapters.

How It Works

  • AppleScript mode: Uses osascript and pbcopy/pbpaste for clipboard-based text transfer. No remote debugging port needed.
  • CDP mode: Connects via Chrome DevTools Protocol to the Electron renderer process for direct DOM manipulation.

Limitations

  • macOS only (AppleScript dependency)
  • AppleScript mode requires Accessibility permissions
  • read command copies the last response — earlier messages need manual scroll