opencode-agent-tmux 1.0.0 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,47 +1,40 @@
1
1
  # opencode-agent-tmux
2
2
 
3
- OpenCode plugin that provides tmux integration for viewing agent execution in real-time. Automatically spawns panes, streams output, and manages your terminal workspace.
3
+ [![npm version](https://img.shields.io/npm/v/opencode-agent-tmux.svg)](https://www.npmjs.com/package/opencode-agent-tmux)
4
+ [![npm downloads](https://img.shields.io/npm/dt/opencode-agent-tmux)](https://www.npmjs.com/package/opencode-agent-tmux)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
4
6
 
5
- ## 🤖 For Humans (Quick Start)
7
+ An [OpenCode](https://opencode.ai) plugin that provides **smart tmux integration** for viewing agent execution in real-time. Automatically spawns panes, streams output, and manages your terminal workspace.
6
8
 
7
- Want to get started immediately? Just paste this prompt into your OpenCode agent (or any other agentic tool like Claude Code) and let it handle the setup for you:
9
+ - **Agent-Agnostic**: Works with oh-my-opencode, omoc-slim, or vanilla OpenCode.
10
+ - **Cross-Platform**: Full support for **macOS**, **Linux**, and **Windows** (via PowerShell or WSL).
8
11
 
9
- ```text
10
- Please install the opencode-agent-tmux plugin for me.
12
+ ![Demo](https://via.placeholder.com/800x400?text=Imagine+Cool+Tmux+Demo+Here)
11
13
 
12
- 1. Clone the repository to ~/Code/opencode-agent-tmux
13
- 2. Run 'bun install' and 'bun run build' inside the directory
14
- 3. Add the plugin path to my ~/.config/opencode/opencode.json file
15
- 4. Verify the installation by running 'opencode --version'
14
+ ## Installation
16
15
 
17
- The plugin repo is: https://github.com/AnganSamadder/opencode-agent-tmux.git
18
- ```
16
+ ### 🤖 Let an LLM do it (Recommended)
19
17
 
20
- ## Features
18
+ Paste this into any LLM agent (OpenCode, Claude Code, Cursor, etc.):
21
19
 
22
- - **Automatic Tmux Pane Spawning**: When any agent starts, automatically spawns a tmux pane
23
- - **Live Streaming**: Each pane runs `opencode attach` to show real-time agent output
24
- - **Auto-Cleanup**: Panes automatically close when agents complete
25
- - **Configurable Layout**: Support multiple tmux layouts (main-vertical, tiled, etc.)
26
- - **Multi-Port Support**: Automatically finds available ports when running multiple instances
27
- - **Agent-Agnostic**: Works with oh-my-opencode, omoc-slim, or vanilla OpenCode
28
-
29
- ## 📋 Requirements
20
+ ```text
21
+ Install the opencode-agent-tmux plugin by following: https://raw.githubusercontent.com/AnganSamadder/opencode-agent-tmux/main/README.md
22
+ ```
30
23
 
31
- - **OpenCode**
32
- - **tmux**
33
- - **Bun** (for building)
24
+ <details>
25
+ <summary><b>Instructions for LLM Agents</b></summary>
34
26
 
35
- ## 📦 Installation (Official)
27
+ To install this plugin, please perform the following steps for the user:
36
28
 
37
- 1. **Install via NPM:**
29
+ 1. **Install the NPM package globally:**
38
30
  ```bash
39
31
  npm install -g opencode-agent-tmux
40
32
  ```
41
- *Note: The installation automatically configures a shell alias to enable the smart tmux wrapper.*
33
+ *Note: This installer automatically configures the user's shell (Bash/Zsh/Fish/PowerShell) to use the smart wrapper.*
42
34
 
43
35
  2. **Configure OpenCode:**
44
- Add the plugin name to your `~/.config/opencode/opencode.json`:
36
+ Add `"opencode-agent-tmux"` to the `plugins` array in the user's config file (usually `~/.config/opencode/opencode.json`).
37
+
45
38
  ```json
46
39
  {
47
40
  "plugins": [
@@ -50,72 +43,41 @@ The plugin repo is: https://github.com/AnganSamadder/opencode-agent-tmux.git
50
43
  }
51
44
  ```
52
45
 
53
- ## 🛠 Manual Installation (Development)
46
+ 3. **Verify & Finalize:**
47
+ * Check if `tmux` is installed on the system. If not, advise the user to install it (e.g., `brew install tmux`, `sudo apt install tmux`, or `winget install tmux`).
48
+ * Tell the user: **"Installation complete! Please restart your terminal and run `opencode` to see the tmux integration in action."**
54
49
 
55
- If you prefer to install it yourself:
50
+ </details>
56
51
 
57
- 1. **Clone the repository:**
58
- ```bash
59
- git clone https://github.com/AnganSamadder/opencode-agent-tmux.git ~/Code/opencode-agent-tmux
60
- ```
52
+ ### 👤 For Humans (Manual)
61
53
 
62
- 2. **Build the plugin:**
54
+ 1. **Install via NPM:**
63
55
  ```bash
64
- cd ~/Code/opencode-agent-tmux
65
- bun install
66
- bun run build
56
+ npm install -g opencode-agent-tmux
67
57
  ```
58
+ *The installer automatically configures your shell to use the smart wrapper.*
68
59
 
69
- 3. **Configure OpenCode:**
70
- Add the plugin to your `~/.config/opencode/opencode.json`:
60
+ 2. **Enable the Plugin:**
61
+ Add `"opencode-agent-tmux"` to your `~/.config/opencode/opencode.json`:
71
62
  ```json
72
63
  {
73
64
  "plugins": [
74
- "~/Code/opencode-agent-tmux"
65
+ "opencode-agent-tmux"
75
66
  ]
76
67
  }
77
68
  ```
78
69
 
79
- ## 🚀 Usage
80
-
81
- ### Easy Mode (Recommended)
82
-
83
- After installation, just type:
70
+ 3. **Run OpenCode:**
71
+ Restart your terminal and type `opencode`. The plugin handles the rest!
84
72
 
85
- ```bash
86
- opencode
87
- ```
88
-
89
- The wrapper automatically:
90
- - Launches tmux if you're not already in it
91
- - Finds an available port (4096-4106) if default is in use
92
- - Starts OpenCode with the available port
93
- - Enables the plugin to spawn panes for agents
94
-
95
- ### Running Multiple Instances
96
-
97
- Want to run multiple OpenCode sessions? No problem:
98
-
99
- ```bash
100
- # Terminal 1
101
- opencode
102
- # → Starts on port 4096
103
-
104
- # Terminal 2
105
- opencode
106
- # → Detects 4096 in use, automatically uses port 4097
107
- ```
108
-
109
- Each instance works independently with its own tmux panes!
110
-
111
- ### Manual Mode
112
-
113
- Or start OpenCode inside tmux manually:
73
+ ## ✨ Features
114
74
 
115
- ```bash
116
- tmux
117
- opencode --port 4096
118
- ```
75
+ - **Automatic Tmux Pane Spawning**: When any agent starts, automatically spawns a tmux pane
76
+ - **Live Streaming**: Each pane runs `opencode attach` to show real-time agent output
77
+ - **Auto-Cleanup**: Panes automatically close when agents complete
78
+ - **Configurable Layout**: Support multiple tmux layouts (`main-vertical`, `tiled`, etc.)
79
+ - **Multi-Port Support**: Automatically finds available ports (4096-4106) when running multiple instances
80
+ - **Smart Wrapper**: Automatically detects if you are in tmux; if not, launches a session for you.
119
81
 
120
82
  ## ⚙️ Configuration
121
83
 
@@ -143,20 +105,15 @@ You can customize behavior by creating `~/.config/opencode/opencode-agent-tmux.j
143
105
 
144
106
  ### Panes Not Spawning
145
107
  1. Verify you're inside tmux: `echo $TMUX`
146
- 2. Check tmux is installed: `which tmux`
147
- 3. Check OpenCode server is running with port: `opencode --port 4096`
148
- 4. Check logs: `cat /tmp/opencode-agent-tmux.log`
108
+ 2. Check tmux is installed: `which tmux` (or `where tmux` on Windows)
109
+ 3. Check logs: `cat /tmp/opencode-agent-tmux.log`
149
110
 
150
111
  ### Server Not Found
151
- Make sure OpenCode is started with the `--port` flag matching your config:
152
- ```bash
153
- opencode --port 4096
154
- ```
112
+ Make sure OpenCode is started with the `--port` flag matching your config (the wrapper does this automatically).
155
113
 
156
114
  ## 📄 License
157
115
 
158
116
  MIT
159
117
 
160
118
  ## 🙏 Acknowledgements
161
-
162
119
  This project extracts and improves upon the tmux session management from [oh-my-opencode-slim](https://github.com/alvinunreal/oh-my-opencode-slim) by alvinunreal.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-agent-tmux",
3
- "version": "1.0.0",
3
+ "version": "1.0.4",
4
4
  "description": "OpenCode plugin that provides tmux integration for viewing agent execution in real-time",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -1,8 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- const fs = require('fs');
4
- const path = require('path');
5
- const os = require('os');
3
+ import fs from 'fs';
4
+ import path from 'path';
5
+ import os from 'os';
6
+ import { fileURLToPath } from 'url';
7
+
8
+ const __filename = fileURLToPath(import.meta.url);
9
+ const __dirname = path.dirname(__filename);
6
10
 
7
11
  const HOME = os.homedir();
8
12