终结者:再会了,贝壳
Terminator: Hasta La Vista, Shell

原始链接: https://github.com/steipete/Terminator

Terminator,一个基于 AppleScript 的终端会话管理器,解决了像 Cursor 这样的 AI 编码助手因命令挂起而中断执行循环的问题。它通过在单独的终端会话中运行命令来隔离命令,确保循环连续性、更快的执行速度和更好的控制。 AI 助手不应直接执行可能挂起的命令,而应使用 Terminator。它通过创建和管理按项目分组的持久终端会话来保留上下文,并在需要时智能地中断繁忙的进程。 重要功能包括模糊目标分组、渐进式进程终止(INT -> KILL -> Ctrl-C)、实时会话监控和错误报告。该脚本提供可配置的属性,例如超时持续时间和默认输出行数。 使用方法:训练您的 AI 助手通过调用 `terminator.scpt` 的 AppleScript 来执行命令,并指定项目路径、任务标签和命令。这可以防止助手无响应并保持高效的工作流程。确保终端和系统事件具有自动化权限。

Hacker News users are discussing a new project called "Terminator: Hasta La Vista, Shell" on GitHub. Several users expressed confusion regarding the name, noting its potential conflict with the popular terminal emulator also named "Terminator". Some initially thought the project referenced the "Terminator" movie. One user commented on the readme using emojis and suggests it was written by an LLM. Another user questions whether the functionality of "Terminator: Hasta La Vista, Shell" might be better implemented within coding assistants, as they are the parent processes and could detect hung subprocesses more effectively.

原文

AppleScript CI

Terminator Logo

Keep Cursor, Windsurf, and other AI coding assistants working without disruption.

"I'll be back... to manage your Terminal sessions."


Terminator is an advanced AppleScript-powered Terminal session manager designed to hunt down inefficient workflows and terminate them with extreme prejudice. This cybernetic organism solves a critical problem in AI coding assistants: the dreaded hanging command loop break.

The Problem: Loop Termination

When AI coding assistants like Cursor execute commands that hang or run indefinitely, they break their execution loop and become unresponsive. This forces developers to:

  • Manually intervene and kill processes
  • Restart the AI assistant
  • Lose context and momentum
  • Experience frustrating workflow interruptions

The result? Productivity crashes harder than Skynet's network.

The Solution: Process Isolation

Terminator implements process isolation by running commands in separate Terminal sessions. This means:

  • Loop Continuity: AI assistant stays responsive even with hanging commands
  • Faster Execution: Commands run asynchronously in dedicated processes
  • Better Control: Intelligent process termination when needed
  • Context Preservation: Session state persists across operations

Just like the T-800's mission to protect, Terminator's primary objective is to protect your development loop by:

  • Creating and managing persistent Terminal sessions
  • Isolating command execution from AI assistant processes
  • Grouping related tasks by project
  • Intelligently interrupting busy processes when needed
  • Providing reliable session state management

Training Your AI Assistant

To maximize loop performance, train your AI coding assistant (Cursor, Claude Code, etc.) to use Terminator instead of direct shell execution:

❌ Instead of this (loop-breaking):

# Direct execution - can hang and break the loop
npm run build

✅ Use this (loop-preserving):

# Terminator execution - keeps the loop alive
osascript terminator.scpt "/path/to/project" "build" "npm run build"
osascript terminator.scpt ["/project/path"] "task_tag" ["command"] [lines]
  • Project Path (optional): Absolute path for project grouping
  • Task Tag (required): Unique identifier for the terminal session
  • Command (optional): Shell command to execute
  • Lines (optional): Number of output lines to return (default: 30)

🎯 Target Acquisition (New Project)

Establish a new project perimeter and execute reconnaissance:

osascript terminator.scpt "/Users/connor/Projects/SkyNet" "build_defense" "cd /Users/connor/Projects/SkyNet && npm run build"

🔄 Continuous Operations (Existing Project)

Execute follow-up commands in the same tactical session:

osascript terminator.scpt "/Users/connor/Projects/SkyNet" "build_defense" "npm run test"

🆕 Multiple Fronts (Additional Tasks)

Open new operational theaters within the same project:

osascript terminator.scpt "/Users/connor/Projects/SkyNet" "api_surveillance" "cd backend && python manage.py runserver"

👁️ Intelligence Gathering (Read-Only)

Retrieve status reports from active sessions:

osascript terminator.scpt "build_defense" 50

🛠️ Base Preparation (Session Setup)

Establish a session without immediate deployment:

osascript terminator.scpt "/Users/connor/Projects/SkyNet" "standby_mode" "" 1

Advanced Tactical Features

🎯 Fuzzy Target Grouping

  • Automatically groups related tasks in the same project window
  • Uses intelligent pattern matching for session organization
  • Configurable via enableFuzzyTagGrouping property

Process Termination Protocol

  • Automatically interrupts busy processes when reusing sessions
  • Uses progressive termination: INT signal → KILL signal → Control-C
  • Tracks process states and provides detailed status reports

📊 Session Intelligence

  • Real-time monitoring of terminal session states
  • TTY tracking for precise process management
  • Comprehensive error reporting and status updates
  • Handles edge cases and terminal state conflicts
  • Provides fallback mechanisms for session recovery
  • Timeout protection for long-running commands

Key properties that can be modified in the script:

property maxCommandWaitTime : 10.0          -- Command timeout (seconds)
property defaultTailLines : 30               -- Default output lines
property tabTitlePrefix : "Terminator 🤖💥 " -- Session identifier prefix
property enableFuzzyTagGrouping : true       -- Smart grouping enabled

Ensure these applications have Automation permissions:

  • Terminal.app - Primary target application
  • System Events.app - System control interface

Access via: System Preferences → Security & Privacy → Privacy → Automation


"Terminal session not found"

  • Provide a command or empty command with lines to create the session
  • Ensure project path is absolute when establishing new contexts

"Process may still be running"

  • Terminator attempted to interrupt but the process resisted termination
  • Check terminal manually or wait for natural process completion

"Permission denied"

  • Verify Automation permissions for Terminal.app and System Events.app
  • Restart Terminal.app after granting permissions

All AppleScript files are automatically validated on every push using GitHub Actions:

  • Syntax Check: osacompile -c validation on macOS runners
  • Compilation Test: Full compilation to .scptd bundles
  • Quality Check: Common AppleScript best practices validation

Note: CI cannot run actual script execution due to macOS automation permission requirements. Full testing must be done locally.

# Run comprehensive test suite
osascript test_terminator.scpt

# Manual cleanup if needed
osascript cleanup_terminator_tests.scpt

# Syntax check
osacompile -c terminator.scpt

Enhanced Automation Arsenal

🔗 Useful MCP Servers to Increase the Loop

Supercharge your development loop with these Model Context Protocol servers:

These MCPs work seamlessly with Terminator to maximize your development loop efficiency and keep your AI assistant running smoothly.


"Come with me if you want to live... productively with organized Terminal sessions."

Terminator will be your faithful cybernetic companion, tirelessly managing your Terminal workflows until the very last command is executed. No process left behind, no session unmanaged.


Terminator is future-proof and designed to adapt to your evolving development workflows. Resistance is futile.

联系我们 contact @ memedata.com