MCPcopy Create free account
hub / github.com/arctic-cli/interface / getAllSessions

Function getAllSessions

packages/arctic/src/cli/cmd/stats.ts:656–680  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

654}
655
656async function getAllSessions(): Promise<Session.Info[]> {
657 const sessions: Session.Info[] = []
658
659 const projectKeys = await Storage.list(["project"])
660 const projects = await Promise.all(
661 projectKeys.map((key) => Storage.read<Project.Info>(key).catch(() => undefined))
662 )
663
664 for (const project of projects) {
665 if (!project) continue
666
667 const sessionKeys = await Storage.list(["session", project.id])
668 const projectSessions = await Promise.all(
669 sessionKeys.map((key) => Storage.read<Session.Info>(key).catch(() => undefined))
670 )
671
672 for (const session of projectSessions) {
673 if (session) {
674 sessions.push(session)
675 }
676 }
677 }
678
679 return sessions
680}
681
682function formatNumber(num: number): string {
683 if (num >= 1000000) {

Callers 1

aggregateStatsFunction · 0.70

Calls 3

pushMethod · 0.80
listMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected