Skip to content

armgit / orca

Public Imported from GitHub
0

Orca is the place for working with a fleet of agents (e.g. Grok Bot, Claude Code). Run any coding agent with your own subscription. Available on desktop, mobile and remote runtime.

697 B
Raw Blame
// Keep recents independent of IPC/Store so ordering can be tested directly.
import type { GitLabProjectSettings } from './gitlab-types'

export const GITLAB_RECENTS_MAX = 10

/** Return fresh, host/path-deduped recents capped at max, most recent first; caller persists via Store.updateSettings. */
export function computeNextGitLabRecents(
  existing: GitLabProjectSettings['recent'],
  host: string,
  path: string,
  now: Date = new Date(),
  max: number = GITLAB_RECENTS_MAX
): GitLabProjectSettings['recent'] {
  const filtered = existing.filter((entry) => !(entry.host === host && entry.path === path))
  return [{ host, path, lastOpenedAt: now.toISOString() }, ...filtered].slice(0, max)
}