Skip to content

Commit 56a65a1

Browse files
committed
fix(tui): remove debug console.log calls leaking into TUI display
Remove leftover debug console.log calls that leak into the TUI terminal output due to disabled stdout interception, causing text corruption and mixing with the rendered UI. - Delete dead createEffect that only logged route.data in app.tsx - Remove debug logs in sync.tsx, route.tsx, and theme.tsx - Convert clipboard.ts diagnostic logs to structured Log.info() Closes anomalyco#6830
1 parent 2a20822 commit 56a65a1

5 files changed

Lines changed: 9 additions & 14 deletions

File tree

‎packages/opencode/src/cli/cmd/tui/app.tsx‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -257,10 +257,6 @@ function App() {
257257
}
258258
const [terminalTitleEnabled, setTerminalTitleEnabled] = createSignal(kv.get("terminal_title_enabled", true))
259259

260-
createEffect(() => {
261-
console.log(JSON.stringify(route.data))
262-
})
263-
264260
// Update terminal window title based on current route and session
265261
createEffect(() => {
266262
if (!terminalTitleEnabled() || Flag.OPENCODE_DISABLE_TERMINAL_TITLE) return

‎packages/opencode/src/cli/cmd/tui/context/route.tsx‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ export const { use: useRoute, provider: RouteProvider } = createSimpleContext({
3131
return store
3232
},
3333
navigate(route: Route) {
34-
console.log("navigate", route)
3534
setStore(route)
3635
},
3736
}

‎packages/opencode/src/cli/cmd/tui/context/sync.tsx‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,6 @@ export const { use: useSync, provider: SyncProvider } = createSimpleContext({
347347
const args = useArgs()
348348

349349
async function bootstrap() {
350-
console.log("bootstrapping")
351350
const start = Date.now() - 30 * 24 * 60 * 60 * 1000
352351
const sessionListPromise = sdk.client.session
353352
.list({ start: start })

‎packages/opencode/src/cli/cmd/tui/context/theme.tsx‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,13 +317,11 @@ export const { use: useTheme, provider: ThemeProvider } = createSimpleContext({
317317
onMount(init)
318318

319319
function resolveSystemTheme() {
320-
console.log("resolveSystemTheme")
321320
renderer
322321
.getPalette({
323322
size: 16,
324323
})
325324
.then((colors) => {
326-
console.log(colors.palette)
327325
if (!colors.palette[0]) {
328326
if (store.active === "system") {
329327
setStore(

‎packages/opencode/src/cli/cmd/tui/util/clipboard.ts‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@ import { lazy } from "../../../../util/lazy.js"
55
import { tmpdir } from "os"
66
import path from "path"
77
import { Filesystem } from "../../../../util/filesystem"
8+
import { Log } from "../../../../util/log"
89
import { Process } from "../../../../util/process"
910

11+
const log = Log.create({ service: "clipboard" })
12+
1013
/**
1114
* Writes text to clipboard via OSC 52 escape sequence.
1215
* This allows clipboard operations to work over SSH by having
@@ -77,7 +80,7 @@ export namespace Clipboard {
7780
const os = platform()
7881

7982
if (os === "darwin" && Bun.which("osascript")) {
80-
console.log("clipboard: using osascript")
83+
log.info("copy method selected", { method: "osascript" })
8184
return async (text: string) => {
8285
const escaped = text.replace(/\\/g, "\\\\").replace(/"/g, '\\"')
8386
await $`osascript -e 'set the clipboard to "${escaped}"'`.nothrow().quiet()
@@ -86,7 +89,7 @@ export namespace Clipboard {
8689

8790
if (os === "linux") {
8891
if (process.env["WAYLAND_DISPLAY"] && Bun.which("wl-copy")) {
89-
console.log("clipboard: using wl-copy")
92+
log.info("copy method selected", { method: "wl-copy" })
9093
return async (text: string) => {
9194
const proc = Process.spawn(["wl-copy"], { stdin: "pipe", stdout: "ignore", stderr: "ignore" })
9295
if (!proc.stdin) return
@@ -96,7 +99,7 @@ export namespace Clipboard {
9699
}
97100
}
98101
if (Bun.which("xclip")) {
99-
console.log("clipboard: using xclip")
102+
log.info("copy method selected", { method: "xclip" })
100103
return async (text: string) => {
101104
const proc = Process.spawn(["xclip", "-selection", "clipboard"], {
102105
stdin: "pipe",
@@ -110,7 +113,7 @@ export namespace Clipboard {
110113
}
111114
}
112115
if (Bun.which("xsel")) {
113-
console.log("clipboard: using xsel")
116+
log.info("copy method selected", { method: "xsel" })
114117
return async (text: string) => {
115118
const proc = Process.spawn(["xsel", "--clipboard", "--input"], {
116119
stdin: "pipe",
@@ -126,7 +129,7 @@ export namespace Clipboard {
126129
}
127130

128131
if (os === "win32") {
129-
console.log("clipboard: using powershell")
132+
log.info("copy method selected", { method: "powershell" })
130133
return async (text: string) => {
131134
// Pipe via stdin to avoid PowerShell string interpolation ($env:FOO, $(), etc.)
132135
const proc = Process.spawn(
@@ -151,7 +154,7 @@ export namespace Clipboard {
151154
}
152155
}
153156

154-
console.log("clipboard: no native support")
157+
log.info("copy method selected", { method: "clipboardy" })
155158
return async (text: string) => {
156159
await clipboardy.write(text).catch(() => {})
157160
}

0 commit comments

Comments
 (0)