MCPcopy
hub / github.com/claude-code-best/claude-code / getRecent

Method getRecent

src/utils/CircularBuffer.ts:39–50  ·  view source on GitHub ↗

* Get the most recent N items from the buffer. * Returns fewer items if the buffer contains less than N items.

(count: number)

Source from the content-addressed store, hash-verified

37 * Returns fewer items if the buffer contains less than N items.
38 */
39 getRecent(count: number): T[] {
40 const result: T[] = []
41 const start = this.size < this.capacity ? 0 : this.head
42 const available = Math.min(count, this.size)
43
44 for (let i = 0; i < available; i++) {
45 const index = (start + this.size - available + i) % this.capacity
46 result.push(this.buffer[index]!)
47 }
48
49 return result
50 }
51
52 /**
53 * Get all items currently in the buffer, in order from oldest to newest.

Callers 3

#updateProgressMethod · 0.80
getStdoutMethod · 0.80

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected