MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / nextFreebuffModelId

Function nextFreebuffModelId

cli/src/utils/freebuff-model-navigation.ts:12–25  ·  view source on GitHub ↗
(params: {
  modelIds: readonly string[]
  focusedId: string
  direction: FreebuffModelNavigationDirection
})

Source from the content-addressed store, hash-verified

10])
11
12export function nextFreebuffModelId(params: {
13 modelIds: readonly string[]
14 focusedId: string
15 direction: FreebuffModelNavigationDirection
16}): string | null {
17 const { modelIds, focusedId, direction } = params
18 if (modelIds.length === 0) return null
19
20 const currentIdx = modelIds.indexOf(focusedId)
21 if (currentIdx === -1) return modelIds[0] ?? null
22
23 const step = direction === 'forward' ? 1 : -1
24 return modelIds[(currentIdx + step + modelIds.length) % modelIds.length]
25}
26
27export function freebuffModelNavigationDirectionForKey(key: {
28 name?: string

Callers 2

FreebuffModelSelectorFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected