Skip to content

A Gemini CLI extension that enables the execution of long-running shell commands in the background asynchronously using tmux.

License

Notifications You must be signed in to change notification settings

stevenAthompson/run-long-command

Repository files navigation

Gemini CLI Extension: Run Long Command

A Gemini CLI extension that enables the execution of long-running shell commands in the background without blocking the agent. It utilizes tmux to notify the agent upon command completion.

Features

  • Asynchronous Execution: Run commands like sleep, builds, or long scripts without timing out the Gemini CLI.
  • Auto-Notification: "Wakes up" the Gemini agent using tmux send-keys when the background task finishes.
  • Fail-Safe: Checks for the required tmux session environment before execution.

Prerequisites

  • Gemini CLI
  • tmux: Required for session management and notifications.
  • Node.js: Environment for running the extension.

Installation

Via Gemini CLI (Recommended)

You can install this extension directly using the Gemini CLI:

gemini extensions install https://github.com/stevenAthompson/run-long-command

Manual Installation (For Development)

  1. Clone the repository:

    git clone https://github.com/stevenAthompson/run-long-command
    cd run-long-command
  2. Install dependencies:

    npm install
  3. Build the project:

    npm run build
  4. Link the extension:

    gemini extensions link .

Usage

1. Start the Tmux Session

The extension requires running inside a tmux session named gemini-cli. A helper script is provided:

./gemini_tmux.sh

This will check for the session and create/attach to it as needed.

2. Run Gemini CLI

Inside the tmux session, start your Gemini CLI agent.

3. Use the Tool

You can now ask Gemini to run long commands:

"Run sleep 10 in the background."

Gemini will use the run_long_command tool, return immediately to let you know it started, and then receive a notification (and wake up) when the command finishes.

Development

Running Tests

npm test

Project Structure

  • run_long_command.ts: Main MCP server implementation.
  • gemini_tmux.sh: Setup script for the tmux environment.
  • run_long_command.test.ts: Unit tests.

License

MIT

About

A Gemini CLI extension that enables the execution of long-running shell commands in the background asynchronously using tmux.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published