MCPcopy
hub / github.com/claude-code-best/claude-code / formatLogMetadata

Function formatLogMetadata

src/utils/format.ts:203–236  ·  view source on GitHub ↗
(log: {
  modified: Date
  messageCount: number
  fileSize?: number
  gitBranch?: string
  tag?: string
  agentSetting?: string
  prNumber?: number
  prRepository?: string
})

Source from the content-addressed store, hash-verified

201 * Formats log metadata for display (time, size or message count, branch, tag, PR)
202 */
203export function formatLogMetadata(log: {
204 modified: Date
205 messageCount: number
206 fileSize?: number
207 gitBranch?: string
208 tag?: string
209 agentSetting?: string
210 prNumber?: number
211 prRepository?: string
212}): string {
213 const sizeOrCount =
214 log.fileSize !== undefined
215 ? formatFileSize(log.fileSize)
216 : `${log.messageCount} messages`
217 const parts = [
218 formatRelativeTimeAgo(log.modified, { style: 'short' }),
219 ...(log.gitBranch ? [log.gitBranch] : []),
220 sizeOrCount,
221 ]
222 if (log.tag) {
223 parts.push(`#${log.tag}`)
224 }
225 if (log.agentSetting) {
226 parts.push(`@${log.agentSetting}`)
227 }
228 if (log.prNumber) {
229 parts.push(
230 log.prRepository
231 ? `${log.prRepository}#${log.prNumber}`
232 : `#${log.prNumber}`,
233 )
234 }
235 return parts.join(' · ')
236}
237
238export function formatResetTime(
239 timestampInSeconds: number | undefined,

Callers 4

format.test.tsFile · 0.90
buildLogMetadataFunction · 0.85
LogSelectorFunction · 0.85
useTypeaheadFunction · 0.85

Calls 3

formatFileSizeFunction · 0.85
formatRelativeTimeAgoFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected