MCPcopy Create free account
hub / github.com/github/gh-aw / ComputeFrontmatterHashFromParsedContent

Function ComputeFrontmatterHashFromParsedContent

pkg/parser/frontmatter_hash.go:122–136  ·  view source on GitHub ↗

ComputeFrontmatterHashFromParsedContent computes the frontmatter hash from already-parsed workflow data, avoiding a redundant file read when content has already been loaded. frontmatterText is the raw text between the --- delimiters (e.g. WorkflowData.FrontmatterYAML). markdownBody is the raw markdo

(frontmatterText, markdownBody string, parsedFrontmatter map[string]any, baseDir string, cache *ImportCache, fileReader FileReader)

Source from the content-addressed store, hash-verified

120// parsedFrontmatter is used to detect the inlined-imports flag.
121// baseDir is the directory containing the workflow file, used for resolving imports.
122func ComputeFrontmatterHashFromParsedContent(frontmatterText, markdownBody string, parsedFrontmatter map[string]any, baseDir string, cache *ImportCache, fileReader FileReader) (string, error) {
123 frontmatterHashLog.Printf("Computing hash from parsed content (baseDir=%s)", baseDir)
124
125 inlinedImports := parseBoolFromFrontmatter(parsedFrontmatter, "inlined-imports")
126
127 var relevantExpressions []string
128 var fullBody string
129 if inlinedImports {
130 fullBody = normalizeFrontmatterText(markdownBody)
131 } else {
132 relevantExpressions = extractRelevantTemplateExpressions(markdownBody)
133 }
134
135 return computeFrontmatterHashTextBasedWithReader(frontmatterText, fullBody, baseDir, cache, relevantExpressions, fileReader)
136}
137
138// ComputeFrontmatterHashFromFile computes the frontmatter hash for a workflow file
139// using text-based approach (no YAML parsing) to match JavaScript implementation

Callers 1

generateYAMLMethod · 0.92

Tested by

no test coverage detected