( state: StopHookExecutionState, isLoading: boolean, )
| 369 | } |
| 370 | |
| 371 | function formatStopHookSpinnerSuffix( |
| 372 | state: StopHookExecutionState, |
| 373 | isLoading: boolean, |
| 374 | ): string | null { |
| 375 | if (!isLoading || !state.toolUseID || state.total === 0 || state.hasSummary) { |
| 376 | return null |
| 377 | } |
| 378 | |
| 379 | if (state.customMessage) { |
| 380 | return state.total === 1 |
| 381 | ? `${state.customMessage}…` |
| 382 | : `${state.customMessage}… ${state.completedCount}/${state.total}` |
| 383 | } |
| 384 | |
| 385 | const hookType = state.hookEvent === 'SubagentStop' ? 'subagent stop' : 'stop' |
| 386 | |
| 387 | if (isInternalBuild()) { |
| 388 | const cmd = state.commands[state.completedCount] |
| 389 | const label = cmd ? ` '${truncateToWidth(cmd, 40)}'` : '' |
| 390 | |
| 391 | return state.total === 1 |
| 392 | ? `running ${hookType} hook${label}` |
| 393 | : `running ${hookType} hook${label}… ${state.completedCount}/${state.total}` |
| 394 | } |
| 395 | |
| 396 | return state.total === 1 |
| 397 | ? `running ${hookType} hook` |
| 398 | : `running stop hooks… ${state.completedCount}/${state.total}` |
| 399 | } |
| 400 | |
| 401 | function isStopHookProgressMessage( |
| 402 | message: Message, |
no test coverage detected