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

Function appendCappedMessage

src/tasks/InProcessTeammateTask/types.ts:108–121  ·  view source on GitHub ↗
(
  prev: readonly T[] | undefined,
  item: T,
)

Source from the content-addressed store, hash-verified

106 * a new array (AppState immutability).
107 */
108export function appendCappedMessage<T>(
109 prev: readonly T[] | undefined,
110 item: T,
111): T[] {
112 if (prev === undefined || prev.length === 0) {
113 return [item]
114 }
115 if (prev.length >= TEAMMATE_MESSAGES_UI_CAP) {
116 const next = prev.slice(-(TEAMMATE_MESSAGES_UI_CAP - 1))
117 next.push(item)
118 return next
119 }
120 return [...prev, item]
121}
122

Callers 3

runInProcessTeammateFunction · 0.85
appendTeammateMessageFunction · 0.85

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected