Skip to content

Commit 8317b58

Browse files
committed
chore(cli): clean up OSC theme detection code
- Remove unused logger import from theme-system.ts - Update outdated comment in terminal-color-detection.ts - Delete unused terminal-input-guard.ts file
1 parent 0aa70dd commit 8317b58

File tree

5 files changed

+7
-57
lines changed

5 files changed

+7
-57
lines changed

cli/src/utils/terminal-color-detection.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ function buildOscQuery(oscCode: number): string {
9292
*
9393
* IMPORTANT: This function reads from stdin because OSC responses come through
9494
* the PTY which appears on stdin. This means it MUST be run BEFORE any other
95-
* stdin listeners (like OpenTUI) are attached. The subprocess approach via
96-
* --internal-osc-detect flag ensures this.
95+
* stdin listeners (like OpenTUI) are attached. OSC detection runs at the very
96+
* start of main() in index.tsx, before OpenTUI is initialized.
9797
*
9898
* @param ttyPath - Path to TTY for writing the query
9999
* @param query - The OSC query string to send
@@ -141,7 +141,7 @@ async function sendOscQuery(
141141
}
142142
}
143143

144-
// Pause stdin so the subprocess can exit cleanly
144+
// Pause stdin so we leave it non-flowing before other listeners attach
145145
try {
146146
process.stdin.pause()
147147
} catch {

cli/src/utils/terminal-input-guard.ts

Lines changed: 0 additions & 32 deletions
This file was deleted.

cli/src/utils/theme-system.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ import { existsSync, readFileSync, readdirSync, statSync, watch } from 'fs'
22
import { homedir } from 'os'
33
import { dirname, join } from 'path'
44

5-
import { logger } from './logger'
6-
75
import type { MarkdownPalette } from './markdown-renderer'
86
import type {
97
ChatTheme,

common/src/env.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,7 @@
11
import { clientEnvSchema, clientProcessEnv } from './env-schema'
22

3-
// Only log environment in non-production, and not during OSC detection
4-
// Check process.argv since it's more reliable than env vars in spawned processes
5-
const isOscDetect =
6-
typeof process !== 'undefined' &&
7-
Array.isArray(process.argv) &&
8-
process.argv.some(arg => arg.includes('--internal-osc-detect'))
9-
if (
10-
process.env.NEXT_PUBLIC_CB_ENVIRONMENT !== 'prod' &&
11-
!isOscDetect
12-
) {
3+
// Only log environment in non-production
4+
if (process.env.NEXT_PUBLIC_CB_ENVIRONMENT !== 'prod') {
135
console.log('Using environment:', process.env.NEXT_PUBLIC_CB_ENVIRONMENT)
146
}
157

packages/internal/src/env.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,8 @@
22
import { serverEnvSchema, serverProcessEnv } from './env-schema'
33

44

5-
// Only log environment in non-production, and not during OSC detection
6-
// Check process.argv since it's more reliable than env vars in spawned processes
7-
const isOscDetect =
8-
typeof process !== 'undefined' &&
9-
Array.isArray(process.argv) &&
10-
process.argv.some(arg => arg.includes('--internal-osc-detect'))
11-
if (
12-
process.env.NEXT_PUBLIC_CB_ENVIRONMENT !== 'prod' &&
13-
!isOscDetect
14-
) {
5+
// Only log environment in non-production
6+
if (process.env.NEXT_PUBLIC_CB_ENVIRONMENT !== 'prod') {
157
console.log('Using environment:', process.env.NEXT_PUBLIC_CB_ENVIRONMENT)
168
}
179

0 commit comments

Comments
 (0)