Parent
Summary
Remove the launchAutoTui() function and its calls from the MCP server bootstrap (main.ts),
and remove the CODINGBUDDY_AUTO_TUI environment variable from init constants.
The TuiAutoLauncher class itself is kept — it's used by restart-tui.ts for the restart_tui MCP tool.
Files to Modify
1. apps/mcp-server/src/main.ts
Delete: launchAutoTui() function (lines 107–123)
// DELETE entire function (including JSDoc)
/**
* Auto-launch TUI client in a new terminal window (non-blocking helper).
* Extracted to avoid duplication between SSE and stdio modes.
*/
async function launchAutoTui(
ipcServer: { clientCount(): number },
tuiEnabled: boolean,
): Promise<void> {
const { TuiAutoLauncher } = await import('./tui/ipc');
const codingbuddyBin = path.resolve(process.argv[1]);
const launcher = new TuiAutoLauncher({
enabled: tuiEnabled || process.env.CODINGBUDDY_AUTO_TUI === '1',
codingbuddyBin,
});
const result = await launcher.launch(ipcServer);
debugLog(`TUI auto-launch: ${result.reason}${result.pid ? ` (PID: ${result.pid})` : ''}`);
}
Delete: SSE mode auto-launch call (lines 258–261)
// DELETE these lines (inside SSE mode try block, after ipcResult)
// Auto-launch TUI client in a new terminal window (non-blocking)
launchAutoTui(ipcResult.ipcServer, tuiEnabled).catch(err => {
debugLog(`TUI auto-launch failed (non-blocking): ${err}`);
});
Delete: stdio mode auto-launch call (lines 298–301)
// DELETE these lines (inside stdio mode try block, after ipcResult)
// Auto-launch TUI client in a new terminal window (non-blocking)
launchAutoTui(ipcResult.ipcServer, tuiEnabled).catch(err => {
debugLog(`TUI auto-launch failed (non-blocking): ${err}`);
});
2. apps/mcp-server/src/cli/init/init.constants.ts
Delete: CODINGBUDDY_AUTO_TUI entry (line 17)
// BEFORE:
export const CLAUDE_SETTINGS_ENV_ENTRIES: Record<string, string> = {
ENABLE_TOOL_SEARCH: 'false',
CODINGBUDDY_AUTO_TUI: '1',
};
// AFTER:
export const CLAUDE_SETTINGS_ENV_ENTRIES: Record<string, string> = {
ENABLE_TOOL_SEARCH: 'false',
};
3. apps/mcp-server/src/cli/init/init.command.spec.ts
Update: Remove CODINGBUDDY_AUTO_TUI from assertions (lines 318, 378)
// BEFORE (two locations):
expect(mockEnsureClaudeSettingsEnv).toHaveBeenCalledWith({
ENABLE_TOOL_SEARCH: 'false',
CODINGBUDDY_AUTO_TUI: '1',
});
// AFTER (both locations):
expect(mockEnsureClaudeSettingsEnv).toHaveBeenCalledWith({
ENABLE_TOOL_SEARCH: 'false',
});
DO NOT DELETE (Preserve These)
| Item |
File |
Reason |
TuiAutoLauncher class |
tui/ipc/tui-auto-launcher.ts |
Used by restart-tui.ts |
TuiAutoLauncher export |
tui/ipc/index.ts:10-11 |
Required for restart-tui import |
tui-auto-launcher.spec.ts |
Tests for the class |
Class still exists |
initIpc() function |
main.ts |
IPC server needed for manual codingbuddy tui |
restart-tui.ts |
CLI module |
restart_tui MCP tool still functional |
restart-tui.spec.ts |
Tests for restart |
Still valid |
Verification
# 1. TypeScript compilation
yarn workspace codingbuddy build
# 2. Run affected tests
yarn workspace codingbuddy test -- --testPathPattern="init.command"
# 3. No remaining launchAutoTui references
grep -rn "launchAutoTui" apps/mcp-server/src/
# 4. CODINGBUDDY_AUTO_TUI only in restart-tui (if at all)
grep -rn "CODINGBUDDY_AUTO_TUI" apps/mcp-server/src/
Acceptance Criteria
Parent
Summary
Remove the
launchAutoTui()function and its calls from the MCP server bootstrap (main.ts),and remove the
CODINGBUDDY_AUTO_TUIenvironment variable from init constants.The
TuiAutoLauncherclass itself is kept — it's used byrestart-tui.tsfor therestart_tuiMCP tool.Files to Modify
1.
apps/mcp-server/src/main.tsDelete:
launchAutoTui()function (lines 107–123)Delete: SSE mode auto-launch call (lines 258–261)
Delete: stdio mode auto-launch call (lines 298–301)
2.
apps/mcp-server/src/cli/init/init.constants.tsDelete:
CODINGBUDDY_AUTO_TUIentry (line 17)3.
apps/mcp-server/src/cli/init/init.command.spec.tsUpdate: Remove
CODINGBUDDY_AUTO_TUIfrom assertions (lines 318, 378)DO NOT DELETE (Preserve These)
TuiAutoLauncherclasstui/ipc/tui-auto-launcher.tsrestart-tui.tsTuiAutoLauncherexporttui/ipc/index.ts:10-11tui-auto-launcher.spec.tsinitIpc()functionmain.tscodingbuddy tuirestart-tui.tsrestart_tuiMCP tool still functionalrestart-tui.spec.tsVerification
Acceptance Criteria
launchAutoTui()function removed from main.tsCODINGBUDDY_AUTO_TUI: '1'removed from init.constants.tsyarn workspace codingbuddy buildpassesyarn workspace codingbuddy test -- --testPathPattern="init.command"passesTuiAutoLauncherclass and its tests still intactrestart-tui.tsstill functional