MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / extract

Method extract

src/extraction/liquid-extractor.ts:29–70  ·  view source on GitHub ↗

* Extract from Liquid source

()

Source from the content-addressed store, hash-verified

27 * Extract from Liquid source
28 */
29 extract(): ExtractionResult {
30 const startTime = Date.now();
31
32 try {
33 // Create file node
34 const fileNode = this.createFileNode();
35
36 // Shopify OS 2.0 JSON template / section group: link each section `type`
37 // to its `sections/<type>.liquid` file. (No symbol nodes are emitted — the
38 // JSON file just carries the references — so it stays out of any
39 // symbol-bearing-file metric while its sections still get their dependents.)
40 if (this.filePath.endsWith('.json')) {
41 this.extractShopifyJsonSections(fileNode.id);
42 } else {
43 // Extract render/include statements (snippet references)
44 this.extractSnippetReferences(fileNode.id);
45
46 // Extract section references
47 this.extractSectionReferences(fileNode.id);
48
49 // Extract schema block
50 this.extractSchema(fileNode.id);
51
52 // Extract assign statements as variables
53 this.extractAssignments(fileNode.id);
54 }
55 } catch (error) {
56 this.errors.push({
57 message: `Liquid extraction error: ${error instanceof Error ? error.message : String(error)}`,
58 severity: 'error',
59 code: 'parse_error',
60 });
61 }
62
63 return {
64 nodes: this.nodes,
65 edges: this.edges,
66 unresolvedReferences: this.unresolvedReferences,
67 errors: this.errors,
68 durationMs: Date.now() - startTime,
69 };
70 }
71
72 /**
73 * Create a file node for the Liquid template

Callers

nothing calls this directly

Calls 6

createFileNodeMethod · 0.95
extractSchemaMethod · 0.95
extractAssignmentsMethod · 0.95

Tested by

no test coverage detected