Install
openclaw skills install claude-code-controlProgrammatically control Claude Code in visible macOS Terminal windows via AppleScript for command input, screenshots, session logging, and terminal management.
openclaw skills install claude-code-controlControl Claude Code programmatically through visible Terminal.app windows on macOS.
Uses AppleScript to:
claude code in a project directoryconst cc = require('./index');
// Launch Claude Code visibly
const session = await cc.launch('/path/to/project');
// Send a command (types it + presses Enter)
const result = await cc.send(session, 'write tests for app.py', 30);
// result.screenshot → path to Terminal window screenshot
// Save session recording
await cc.saveSession(session, './recording.json');
// Close
await cc.close(session);
| Function | Description |
|---|---|
launch(path, opts?) | Open Terminal + start Claude Code. Returns session ID |
send(id, command, waitSec?) | Type command, wait, screenshot. Returns {screenshot, duration_ms} |
verifyScreen(id, desc) | Take a verification screenshot |
approveSecurity(id) | Handle "trust this folder" prompt |
handleLogin(id) | Send /login command |
saveSession(id, path) | Save session log to JSON |
close(id) / closeAll() | Exit Claude Code gracefully |
takeScreenshot(path?) | Capture Terminal window |
focusTerminal() | Bring Terminal to front |