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

Function formatSessionTable

packages/arctic/src/cli/cmd/session.ts:104–121  ·  view source on GitHub ↗
(sessions: Session.Info[])

Source from the content-addressed store, hash-verified

102})
103
104function formatSessionTable(sessions: Session.Info[]): string {
105 const lines: string[] = []
106
107 const maxIdWidth = Math.max(20, ...sessions.map((s) => s.id.length))
108 const maxTitleWidth = Math.max(25, ...sessions.map((s) => s.title.length))
109
110 const header = `Session ID${" ".repeat(maxIdWidth - 10)} Title${" ".repeat(maxTitleWidth - 5)} Updated`
111 lines.push(header)
112 lines.push("─".repeat(header.length))
113 for (const session of sessions) {
114 const truncatedTitle = Locale.truncate(session.title, maxTitleWidth)
115 const timeStr = Locale.todayTimeOrDateTime(session.time.updated)
116 const line = `${session.id.padEnd(maxIdWidth)} ${truncatedTitle.padEnd(maxTitleWidth)} ${timeStr}`
117 lines.push(line)
118 }
119
120 return lines.join(EOL)
121}
122
123function formatSessionJSON(sessions: Session.Info[]): string {
124 const jsonData = sessions.map((session) => ({

Callers 1

session.tsFile · 0.85

Calls 1

pushMethod · 0.80

Tested by

no test coverage detected