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

Function renderStatusLine

src/bridge/bridgeUI.ts:188–292  ·  view source on GitHub ↗

Render and write the current status lines based on state.

()

Source from the content-addressed store, hash-verified

186
187 /** Render and write the current status lines based on state. */
188 function renderStatusLine(): void {
189 if (currentState === 'reconnecting' || currentState === 'failed') {
190 // These states are handled separately (updateReconnectingStatus /
191 // updateFailedStatus). Return before clearing so callers like toggleQr
192 // and setSpawnModeDisplay don't blank the display during these states.
193 return
194 }
195
196 clearStatusLines()
197
198 const isIdle = currentState === 'idle'
199
200 // QR code above the status line
201 if (qrVisible) {
202 for (const line of qrLines) {
203 writeStatus(`${chalk.dim(line)}\n`)
204 }
205 }
206
207 // Determine indicator and colors based on state
208 const indicator = BRIDGE_READY_INDICATOR
209 const indicatorColor = isIdle ? chalk.green : chalk.cyan
210 const baseColor = isIdle ? chalk.green : chalk.cyan
211 const stateText = baseColor(currentStateText)
212
213 // Build the suffix with repo and branch
214 let suffix = ''
215 if (repoName) {
216 suffix += chalk.dim(' \u00b7 ') + chalk.dim(repoName)
217 }
218 // In worktree mode each session gets its own branch, so showing the
219 // bridge's branch would be misleading.
220 if (branch && spawnMode !== 'worktree') {
221 suffix += chalk.dim(' \u00b7 ') + chalk.dim(branch)
222 }
223
224 if (process.env.USER_TYPE === 'ant' && debugLogPath) {
225 writeStatus(
226 `${chalk.yellow('[ANT-ONLY] Logs:')} ${chalk.dim(debugLogPath)}\n`,
227 )
228 }
229 writeStatus(`${indicatorColor(indicator)} ${stateText}${suffix}\n`)
230
231 // Session count and per-session list (multi-session mode only)
232 if (sessionMax > 1) {
233 const modeHint =
234 spawnMode === 'worktree'
235 ? 'New sessions will be created in an isolated worktree'
236 : 'New sessions will be created in the current directory'
237 writeStatus(
238 ` ${chalk.dim(`Capacity: ${sessionActive}/${sessionMax} \u00b7 ${modeHint}`)}\n`,
239 )
240 for (const [, info] of sessionDisplayInfo) {
241 const titleText = info.title
242 ? truncatePrompt(info.title, 35)
243 : chalk.dim('Attached')
244 const titleLinked = wrapWithOsc8Link(titleText, info.url)
245 const act = info.activity

Callers 7

regenerateQrFunction · 0.85
updateIdleStatusFunction · 0.85
setAttachedFunction · 0.85
updateSessionStatusFunction · 0.85
toggleQrFunction · 0.85
setSessionTitleFunction · 0.85
refreshDisplayFunction · 0.85

Calls 5

clearStatusLinesFunction · 0.85
writeStatusFunction · 0.85
buildIdleFooterTextFunction · 0.85
buildActiveFooterTextFunction · 0.85
wrapWithOsc8LinkFunction · 0.70

Tested by

no test coverage detected