opencode-agent-tmux 1.1.9 → 1.1.11
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 +7 -3
- package/dist/bin/opencode-tmux.js +26 -11
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -34,11 +34,11 @@ To install this plugin, please perform the following steps for the user:
|
|
|
34
34
|
*Note: This installer automatically configures the user's shell (Bash/Zsh/Fish/PowerShell) to use the smart wrapper.*
|
|
35
35
|
|
|
36
36
|
2. **Configure OpenCode:**
|
|
37
|
-
Add `"opencode-agent-tmux"` to the `
|
|
37
|
+
Add `"opencode-agent-tmux"` to the `plugin` array in the user's config file (usually `~/.config/opencode/opencode.json`).
|
|
38
38
|
|
|
39
39
|
```json
|
|
40
40
|
{
|
|
41
|
-
"
|
|
41
|
+
"plugin": [
|
|
42
42
|
"opencode-agent-tmux"
|
|
43
43
|
]
|
|
44
44
|
}
|
|
@@ -62,7 +62,7 @@ To install this plugin, please perform the following steps for the user:
|
|
|
62
62
|
Add `"opencode-agent-tmux"` to your `~/.config/opencode/opencode.json`:
|
|
63
63
|
```json
|
|
64
64
|
{
|
|
65
|
-
"
|
|
65
|
+
"plugin": [
|
|
66
66
|
"opencode-agent-tmux"
|
|
67
67
|
]
|
|
68
68
|
}
|
|
@@ -71,6 +71,10 @@ To install this plugin, please perform the following steps for the user:
|
|
|
71
71
|
3. **Run OpenCode:**
|
|
72
72
|
Restart your terminal and type `opencode`. The plugin handles the rest!
|
|
73
73
|
|
|
74
|
+
## 🛠️ Development
|
|
75
|
+
|
|
76
|
+
For contributors working on this plugin locally, see [LOCAL_DEVELOPMENT.md](docs/LOCAL_DEVELOPMENT.md) for setup instructions.
|
|
77
|
+
|
|
74
78
|
## ✨ Features
|
|
75
79
|
|
|
76
80
|
- **Automatic Tmux Pane Spawning**: When any agent starts, automatically spawns a tmux pane
|
|
@@ -84,29 +84,44 @@ function hasTmux() {
|
|
|
84
84
|
return false;
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
|
+
function extractLogUpdateFlag(args) {
|
|
88
|
+
let logUpdate = false;
|
|
89
|
+
const cleaned = [];
|
|
90
|
+
for (const arg of args) {
|
|
91
|
+
if (arg === "--log-update" || arg.startsWith("--log-update=")) {
|
|
92
|
+
logUpdate = true;
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
cleaned.push(arg);
|
|
96
|
+
}
|
|
97
|
+
return { args: cleaned, logUpdate };
|
|
98
|
+
}
|
|
87
99
|
async function main() {
|
|
88
|
-
spawnPluginUpdater();
|
|
89
100
|
const opencodeBin = findOpencodeBin();
|
|
90
101
|
if (!opencodeBin) {
|
|
91
|
-
console.error(
|
|
92
|
-
console.error(" Please ensure OpenCode is installed and in your PATH.");
|
|
102
|
+
console.error('Error: Could not find "opencode" binary in PATH or common locations.');
|
|
93
103
|
exit(1);
|
|
94
104
|
}
|
|
105
|
+
spawnPluginUpdater();
|
|
95
106
|
const port = await findAvailablePort();
|
|
96
107
|
if (!port) {
|
|
97
|
-
console.error("
|
|
108
|
+
console.error("Error: No available ports found in range 4096-4106.");
|
|
98
109
|
exit(1);
|
|
99
110
|
}
|
|
100
|
-
|
|
101
|
-
|
|
111
|
+
const env2 = { ...process.env };
|
|
112
|
+
env2.OPENCODE_PORT = port.toString();
|
|
113
|
+
const rawArgs = argv.slice(2);
|
|
114
|
+
const { args, logUpdate } = extractLogUpdateFlag(rawArgs);
|
|
115
|
+
if (logUpdate) {
|
|
116
|
+
env2.OPENCODE_AUTO_UPDATE_LOG_UPDATE = "true";
|
|
117
|
+
env2.OPENCODE_AUTO_UPDATE_BYPASS_THROTTLE = "true";
|
|
118
|
+
env2.OPENCODE_AUTO_UPDATE_DEBUG = "true";
|
|
102
119
|
}
|
|
103
|
-
env.OPENCODE_PORT = port.toString();
|
|
104
|
-
const args = argv.slice(2);
|
|
105
120
|
const childArgs = ["--port", port.toString(), ...args];
|
|
106
|
-
const inTmux = !!
|
|
121
|
+
const inTmux = !!env2.TMUX;
|
|
107
122
|
const tmuxAvailable = hasTmux();
|
|
108
123
|
if (inTmux || !tmuxAvailable) {
|
|
109
|
-
const child = spawn(opencodeBin, childArgs, { stdio: "inherit" });
|
|
124
|
+
const child = spawn(opencodeBin, childArgs, { stdio: "inherit", env: env2 });
|
|
110
125
|
child.on("close", (code) => exit(code ?? 0));
|
|
111
126
|
process.on("SIGINT", () => child.kill("SIGINT"));
|
|
112
127
|
process.on("SIGTERM", () => child.kill("SIGTERM"));
|
|
@@ -122,7 +137,7 @@ async function main() {
|
|
|
122
137
|
"new-session",
|
|
123
138
|
shellCommand
|
|
124
139
|
];
|
|
125
|
-
const child = spawn("tmux", tmuxArgs, { stdio: "inherit" });
|
|
140
|
+
const child = spawn("tmux", tmuxArgs, { stdio: "inherit", env: env2 });
|
|
126
141
|
child.on("close", (code) => exit(code ?? 0));
|
|
127
142
|
}
|
|
128
143
|
}
|