MCPcopy Index your code
hub / github.com/massCodeIO/massCode / createSourceDescription

Function createSourceDescription

src/main/api/routes/captures.ts:240–263  ·  view source on GitHub ↗
(body: CaptureRequest)

Source from the content-addressed store, hash-verified

238}
239
240function createSourceDescription(body: CaptureRequest): string {
241 const title
242 = trimToValue(body.sourceTitle)
243 ?? trimToValue(body.source?.title)
244 ?? trimToValue(body.pageTitle)
245 const url
246 = trimToValue(body.sourceUrl)
247 ?? trimToValue(body.source?.url)
248 ?? trimToValue(body.url)
249 const lines: string[] = []
250
251 if (url) {
252 lines.push(`Captured from: ${title ? `${title} (${url})` : url}`)
253 }
254
255 const contextLabel = trimToValue(body.contextLabel)
256 if (contextLabel) {
257 lines.push(`Context: ${contextLabel}`)
258 }
259
260 lines.push(`Captured at: ${resolveCapturedAt(body)}`)
261
262 return lines.join('\n')
263}
264
265function getCodeFence(text: string): string {
266 const matches = text.match(/`{3,}/g)

Callers 2

createCodeCaptureFunction · 0.85
createHttpCaptureFunction · 0.85

Calls 2

resolveCapturedAtFunction · 0.85
trimToValueFunction · 0.70

Tested by

no test coverage detected