Browse Source

Tmux temporari guide (#55)

Alvin 2 months ago
parent
commit
87a7c502b0
4 changed files with 8 additions and 46 deletions
  1. 6 5
      README.md
  2. 0 29
      src/cli/config-manager.ts
  3. 0 10
      src/cli/install.ts
  4. 2 2
      src/utils/tmux.ts

+ 6 - 5
README.md

@@ -354,12 +354,13 @@ Code implementation, refactoring, testing, verification. *Execute the plan - no
 
 #### Quick Setup
 
-1. **Enable the OpenCode HTTP server** in `opencode.json` (see [OpenCode Config](#opencode-config-opencodejson)).
-2. **Enable tmux integration** in `oh-my-opencode-slim.json` (see [Plugin Config](#plugin-config-oh-my-opencode-slimjson)).
-3. **Run OpenCode inside tmux**:
+> ⚠️ **Temporary workaround:** Start OpenCode with `--port 4096` to enable tmux integration. This is required until the upstream issue is resolved.
+
+1. **Enable tmux integration** in `oh-my-opencode-slim.json` (see [Plugin Config](#plugin-config-oh-my-opencode-slimjson)).
+2. **Run OpenCode inside tmux with port 4096**:
    ```bash
    tmux
-   opencode
+   opencode --port 4096
    ```
 
 #### Layout Options
@@ -502,7 +503,7 @@ You can disable specific MCP servers by adding them to the `disabled_mcps` array
 
 | File | Purpose |
 |------|---------|
-| `~/.config/opencode/opencode.json` | OpenCode core settings (server port for tmux) |
+| `~/.config/opencode/opencode.json` | OpenCode core settings |
 | `~/.config/opencode/oh-my-opencode-slim.json` | Plugin settings (agents, tmux, MCPs) |
 | `.opencode/oh-my-opencode-slim.json` | Project-local plugin overrides (optional) |
 

+ 0 - 29
src/cli/config-manager.ts

@@ -289,35 +289,6 @@ export function addProviderConfig(installConfig: InstallConfig): ConfigMergeResu
   }
 }
 
-/**
- * Add server configuration to opencode.json for tmux integration
- */
-export function addServerConfig(installConfig: InstallConfig): ConfigMergeResult {
-  const configPath = getExistingConfigPath()
-
-  try {
-    ensureConfigDir()
-    let config = parseConfig(configPath) ?? {}
-
-    if (installConfig.hasTmux) {
-      const server = (config.server ?? {}) as Record<string, unknown>
-      // Only set port if not already configured
-      if (server.port === undefined) {
-        server.port = 4096
-      }
-      config.server = server
-    }
-
-    writeConfig(configPath, config)
-    return { success: true, configPath }
-  } catch (err) {
-    return {
-      success: false,
-      configPath,
-      error: `Failed to add server config: ${err}`,
-    }
-  }
-}
 
 // Model mappings by provider priority
 const MODEL_MAPPINGS = {

+ 0 - 10
src/cli/install.ts

@@ -7,7 +7,6 @@ import {
   getOpenCodeVersion,
   addAuthPlugins,
   addProviderConfig,
-  addServerConfig,
   disableDefaultAgents,
   detectCurrentConfig,
   isTmuxInstalled,
@@ -184,8 +183,6 @@ async function runInstall(config: InstallConfig): Promise<number> {
   // Calculate total steps dynamically
   let totalSteps = 4 // Base: check opencode, add plugin, disable default agents, write lite config
   if (config.hasAntigravity) totalSteps += 2 // auth plugins + provider config
-  // TODO: tmux has a bug, disabled for now
-  // if (config.hasTmux) totalSteps += 1 // server config
 
   let step = 1
 
@@ -211,13 +208,6 @@ async function runInstall(config: InstallConfig): Promise<number> {
     if (!handleStepResult(providerResult, "Providers configured")) return 1
   }
 
-  // TODO: tmux has a bug, disabled for now
-  // if (config.hasTmux) {
-  //   printStep(step++, totalSteps, "Configuring OpenCode HTTP server for tmux...")
-  //   const serverResult = addServerConfig(config)
-  //   if (!handleStepResult(serverResult, "Server configured")) return 1
-  // }
-
   printStep(step++, totalSteps, "Writing oh-my-opencode-slim configuration...")
   const liteResult = writeLiteConfig(config)
   if (!handleStepResult(liteResult, "Config written")) return 1

+ 2 - 2
src/utils/tmux.ts

@@ -199,9 +199,9 @@ export async function spawnTmuxPane(
   // This is needed because serverUrl may be a fallback even when no server is running
   const serverRunning = await isServerRunning(serverUrl);
   if (!serverRunning) {
-    log("[tmux] spawnTmuxPane: OpenCode server not running, skipping", { 
+    log("[tmux] spawnTmuxPane: OpenCode server not running, skipping", {
       serverUrl,
-      hint: "Add { \"server\": { \"port\": 4096 } } to your OpenCode config"
+      hint: "Start opencode with --port 4096"
     });
     return { success: false };
   }