| 1 | package store |
| 2 | |
| 3 | import ( |
| 4 | "fmt" |
| 5 | "regexp" |
| 6 | |
| 7 | "example.com/curator/internal/git" |
| 8 | ) |
| 9 | |
| 10 | // VerifyModule checks that a git repository is accessible. |
| 11 | func VerifyModule(repo string) error { |
| 12 | if err := git.LsRemote(repo); err != nil { |
| 13 | return fmt.Errorf("git ls-remote failed for %s: %w", repo, err) |
| 14 | } |
| 15 | return nil |
| 16 | } |
| 17 | |
| 18 | // VerifyPattern checks that a regex pattern compiles. |
| 19 | func VerifyPattern(pattern string) error { |
| 20 | _, err := regexp.Compile("^" + pattern + "$") |
| 21 | if err != nil { |
| 22 | return fmt.Errorf("invalid regex pattern %q: %w", pattern, err) |
| 23 | } |
| 24 | return nil |
| 25 | } |
| 26 | |