MarkdownToLockFile converts a workflow markdown file path to its compiled lock file path. This is the standard transformation for agentic workflow files. The function removes the .md extension and adds .lock.yml extension. If the input already has a .lock.yml extension, it returns the path unchange
(mdPath string)
| 78 | // MarkdownToLockFile("workflow.lock.yml") // returns "workflow.lock.yml" (unchanged) |
| 79 | // MarkdownToLockFile("my.workflow.md") // returns "my.workflow.lock.yml" |
| 80 | func MarkdownToLockFile(mdPath string) string { |
| 81 | // If already a lock file, return unchanged |
| 82 | if strings.HasSuffix(mdPath, ".lock.yml") { |
| 83 | return mdPath |
| 84 | } |
| 85 | |
| 86 | cleaned := filepath.Clean(mdPath) |
| 87 | lockPath := strings.TrimSuffix(cleaned, ".md") + ".lock.yml" |
| 88 | identifiersLog.Printf("MarkdownToLockFile: %s -> %s", mdPath, lockPath) |
| 89 | return lockPath |
| 90 | } |
| 91 | |
| 92 | // LockFileToMarkdown converts a compiled lock file path back to its markdown source path. |
| 93 | // This is used when navigating from compiled workflows back to source files. |