🖥️

程序化控制 Claude Code 终端会话

Claude Code Control · v1.2.0
入口已确认,内容待校验 文件树里有 SKILL.md,但正文还没采回,frontmatter 未核对。
开发 安全 B 级 作者 melichar-m 公开目录收录
3.2k 下载 1 安装 14.9k 收藏 11 浏览

简介

通过 AppleScript 在 macOS Terminal 中程序化控制 Claude Code,支持命令输入、窗口截图和会话录制,适合自动化工作流集成

原始描述

Programmatically control Claude Code in visible macOS Terminal windows via AppleScript for command input, screenshots, session logging, and terminal management.

通过你的 Agent 添加

安装目录:claude-code-control/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。

点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。

或者手动安装

Claude Code~/.claude/skills/claude-code-control/
Codex CLI~/.codex/skills/claude-code-control/
DeepSeek Harness~/.agents/skills/claude-code-control/

包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可; 目录名不用换,也不要把包直接解压到 skills 根目录。 技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。

技能正文

Claude Code Control

Control Claude Code programmatically through visible Terminal.app windows on macOS.

How It Works

Uses AppleScript to:

  1. Open Terminal.app and launch claude code in a project directory
  2. Type commands via System Events keystrokes
  3. Capture screenshots of just the Terminal window (not full screen)
  4. Record full sessions with timestamped logs

Requirements

  • macOS
  • Node.js 18+
  • Claude Code installed and authenticated
  • Accessibility permissions for Terminal.app + Script Editor (System Settings → Privacy & Security → Accessibility)

Usage

const 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);

API

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

Pro Features (Coming Soon)

  • 🎬 Video recording of sessions
  • 🤖 Multi-agent / multi-terminal orchestration
  • 📊 Session analytics
  • 🔄 Session replay
  • 🌐 Remote control via SSH

正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。

标签

automationmacosapplescriptclaude-codeterminal-controlscreenshotci-cd

同类 Skill