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

Function detectSnippetSource

src/main/import/detect.ts:13–33  ·  view source on GitHub ↗
(payload: ImportPayload)

Source from the content-addressed store, hash-verified

11}
12
13function detectSnippetSource(payload: ImportPayload): ImportSource {
14 if (payload.url?.trim()) {
15 return 'github-gists'
16 }
17
18 const snippetsLab = parseSnippetsLabFiles(payload.files || [])
19 if (snippetsLab.snippets.length > 0) {
20 return 'snippetslab'
21 }
22
23 const raycast = parseRaycastSnippetFiles(payload.files || [])
24 const vscode = parseVSCodeSnippetFiles(payload.files || [])
25
26 if (raycast.snippets.length > 0 || vscode.snippets.length > 0) {
27 return raycast.snippets.length >= vscode.snippets.length
28 ? 'raycast-snippets'
29 : 'vscode-snippets'
30 }
31
32 throw new Error('Import format could not be detected')
33}
34
35export function detectImportSource(
36 source: ImportSource | undefined,

Callers 1

detectImportSourceFunction · 0.85

Calls 3

parseSnippetsLabFilesFunction · 0.90
parseRaycastSnippetFilesFunction · 0.90
parseVSCodeSnippetFilesFunction · 0.90

Tested by

no test coverage detected