MCPcopy Index your code
hub / github.com/codeaashu/claude-code / handleAutoModeTransition

Function handleAutoModeTransition

src/bootstrap/state.ts:1373–1399  ·  view source on GitHub ↗
(
  fromMode: string,
  toMode: string,
)

Source from the content-addressed store, hash-verified

1371}
1372
1373export function handleAutoModeTransition(
1374 fromMode: string,
1375 toMode: string,
1376): void {
1377 // Auto↔plan transitions are handled by prepareContextForPlanMode (auto may
1378 // stay active through plan if opted in) and ExitPlanMode (restores mode).
1379 // Skip both directions so this function only handles direct auto transitions.
1380 if (
1381 (fromMode === 'auto' && toMode === 'plan') ||
1382 (fromMode === 'plan' && toMode === 'auto')
1383 ) {
1384 return
1385 }
1386 const fromIsAuto = fromMode === 'auto'
1387 const toIsAuto = toMode === 'auto'
1388
1389 // If switching TO auto mode, clear any pending exit attachment
1390 // This prevents sending both auto_mode and auto_mode_exit when user toggles quickly
1391 if (toIsAuto && !fromIsAuto) {
1392 STATE.needsAutoModeExitAttachment = false
1393 }
1394
1395 // If switching out of auto mode, trigger the auto_mode_exit attachment
1396 if (fromIsAuto && !toIsAuto) {
1397 STATE.needsAutoModeExitAttachment = true
1398 }
1399}
1400
1401// LSP plugin recommendation session tracking
1402export function hasShownLspRecommendationThisSession(): boolean {

Callers 1

transitionPermissionModeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected