readSkillFile reads a SKILL.md file only if it resolves to a regular file.
(path string)
| 367 | |
| 368 | // readSkillFile reads a SKILL.md file only if it resolves to a regular file. |
| 369 | func readSkillFile(path string) ([]byte, error) { |
| 370 | info, err := os.Stat(path) |
| 371 | if err != nil { |
| 372 | return nil, err |
| 373 | } |
| 374 | if !info.Mode().IsRegular() { |
| 375 | return nil, fmt.Errorf("SKILL.md is not a regular file: %s", path) |
| 376 | } |
| 377 | return os.ReadFile(path) |
| 378 | } |
| 379 | |
| 380 | func shouldIncludeSkill(filter scanFilter, hasInstallMetadata bool) bool { |
| 381 | switch filter { |
no test coverage detected