Load loads a single instruction file by path (relative to the data directory). The path should include the file extension, e.g., "development.md" or "resources/model.md".
(path string, opts Options)
| 39 | // Load loads a single instruction file by path (relative to the data directory). |
| 40 | // The path should include the file extension, e.g., "development.md" or "resources/model.md". |
| 41 | func Load(path string, opts Options) (*Instruction, error) { |
| 42 | fullPath := filepath.Join("data", path) |
| 43 | content, err := dataFS.ReadFile(fullPath) |
| 44 | if err != nil { |
| 45 | return nil, fmt.Errorf("failed to read instruction file %q: %w", path, err) |
| 46 | } |
| 47 | |
| 48 | return parseInstruction(path, content, opts) |
| 49 | } |
| 50 | |
| 51 | // LoadAll loads all instruction files from the data directory recursively. |
| 52 | // Returns a map of file paths (relative to data directory) to their parsed instructions. |