MCPcopy
hub / github.com/codeaashu/claude-code / onStdinData

Function onStdinData

src/bridge/bridgeMain.ts:2611–2643  ·  view source on GitHub ↗
(data: Buffer)

Source from the content-addressed store, hash-verified

2609
2610 // Listen for keys: space toggles QR code, w toggles spawn mode
2611 const onStdinData = (data: Buffer): void => {
2612 if (data[0] === 0x03 || data[0] === 0x04) {
2613 // Ctrl+C / Ctrl+D — trigger graceful shutdown
2614 process.emit('SIGINT')
2615 return
2616 }
2617 if (data[0] === 0x20 /* space */) {
2618 logger.toggleQr()
2619 return
2620 }
2621 if (data[0] === 0x77 /* 'w' */) {
2622 if (!toggleAvailable) return
2623 const newMode: 'same-dir' | 'worktree' =
2624 config.spawnMode === 'same-dir' ? 'worktree' : 'same-dir'
2625 config.spawnMode = newMode
2626 logEvent('tengu_bridge_spawn_mode_toggled', {
2627 spawn_mode:
2628 newMode as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS,
2629 })
2630 logger.logStatus(
2631 newMode === 'worktree'
2632 ? 'Spawn mode: worktree (new sessions get isolated git worktrees)'
2633 : 'Spawn mode: same-dir (new sessions share the current directory)',
2634 )
2635 logger.setSpawnModeDisplay(newMode)
2636 logger.refreshDisplay()
2637 saveCurrentProjectConfig(current => {
2638 if (current.remoteControlSpawnMode === newMode) return current
2639 return { ...current, remoteControlSpawnMode: newMode }
2640 })
2641 return
2642 }
2643 }
2644 if (process.stdin.isTTY) {
2645 process.stdin.setRawMode(true)
2646 process.stdin.resume()

Callers

nothing calls this directly

Calls 3

logEventFunction · 0.85
saveCurrentProjectConfigFunction · 0.85
emitMethod · 0.80

Tested by

no test coverage detected