MCPcopy
hub / github.com/anomalyco/opencode / touchMany

Function touchMany

packages/opencode/src/plugin/meta.ts:142–159  ·  view source on GitHub ↗
(items: Touch[])

Source from the content-addressed store, hash-verified

140}
141
142export async function touchMany(items: Touch[]): Promise<Array<{ state: State; entry: Entry }>> {
143 if (!items.length) return []
144 const file = storePath()
145 const rows = await Promise.all(items.map((item) => row(item)))
146
147 return Flock.withLock(lock(file), async () => {
148 const store = await read(file)
149 const now = Date.now()
150 const out: Array<{ state: State; entry: Entry }> = []
151 for (const item of rows) {
152 const hit = next(store[item.id], item.core, now)
153 store[item.id] = hit.entry
154 out.push(hit)
155 }
156 await Filesystem.writeJson(file, store)
157 return out
158 })
159}
160
161export async function touch(spec: string, target: string, id: string): Promise<{ state: State; entry: Entry }> {
162 return touchMany([{ spec, target, id }]).then((item) => {

Callers 1

touchFunction · 0.85

Calls 7

storePathFunction · 0.85
pushMethod · 0.80
rowFunction · 0.70
lockFunction · 0.70
readFunction · 0.70
nextFunction · 0.70
allMethod · 0.45

Tested by

no test coverage detected