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

Function removeByFilter

src/utils/messageQueueManager.ts:298–316  ·  view source on GitHub ↗
(
  predicate: (cmd: QueuedCommand) => boolean,
)

Source from the content-addressed store, hash-verified

296 * Returns the removed commands.
297 */
298export function removeByFilter(
299 predicate: (cmd: QueuedCommand) => boolean,
300): QueuedCommand[] {
301 const removed: QueuedCommand[] = []
302 for (let i = commandQueue.length - 1; i >= 0; i--) {
303 if (predicate(commandQueue[i]!)) {
304 removed.unshift(commandQueue.splice(i, 1)[0]!)
305 }
306 }
307
308 if (removed.length > 0) {
309 notifySubscribers()
310 for (const _cmd of removed) {
311 logOperation('remove')
312 }
313 }
314
315 return removed
316}
317
318/**
319 * Clear all commands from the queue.

Callers 1

REPLFunction · 0.85

Calls 3

notifySubscribersFunction · 0.85
logOperationFunction · 0.85
spliceMethod · 0.80

Tested by

no test coverage detected