MCPcopy
hub / github.com/conwnet/github1s / addRecentRepositories

Function addRecentRepositories

extensions/github1s/src/helpers/context.ts:27–32  ·  view source on GitHub ↗
(name: string, timestamp = 0)

Source from the content-addressed store, hash-verified

25};
26
27export const addRecentRepositories = (name: string, timestamp = 0) => {
28 const currentRecord = { name, timestamp: timestamp || Date.now() };
29 const restRecords = getRecentRepositories().filter((record) => record.name !== name);
30 const newRecords = [currentRecord, ...restRecords.slice(0, 49)]; // max to 50 records
31 return getExtensionContext().globalState.update(RECENT_REPOSITORIES, newRecords);
32};
33
34export const removeRecentRepository = (name: string) => {
35 const newRecords = getRecentRepositories().filter((record) => record.name !== name);

Callers 1

initialVSCodeStateFunction · 0.90

Calls 2

getRecentRepositoriesFunction · 0.85
getExtensionContextFunction · 0.85

Tested by

no test coverage detected