MCPcopy Create free account
hub / github.com/ZingerLittleBee/ServerBee / recordRecentCommand

Function recordRecentCommand

scripts/make-menu.ts:536–545  ·  view source on GitHub ↗
(historyPath: string, key: string, timestamp: number)

Source from the content-addressed store, hash-verified

534}
535
536export const recordRecentCommand = async (historyPath: string, key: string, timestamp: number): Promise<void> => {
537 const recentCommands = await readRecentCommands(historyPath)
538 recentCommands[key] = timestamp
539
540 const historyLines = Object.entries(recentCommands)
541 .sort((leftEntry, rightEntry) => leftEntry[1] - rightEntry[1])
542 .map(([entryKey, entryTimestamp]) => `${entryKey}\t${entryTimestamp}`)
543
544 await writeFile(historyPath, `${historyLines.join('\n')}\n`, 'utf8')
545}
546
547export const buildMenuDisplayLabel = (
548 command: CommandDefinition,

Callers 2

make-menu.test.tsFile · 0.90
runShellCommandFunction · 0.85

Calls 1

readRecentCommandsFunction · 0.85

Tested by

no test coverage detected