File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change 99 "path/filepath"
1010 "regexp"
1111 "strings"
12+
13+ "github.com/sipeed/picoclaw/pkg/logger"
1214)
1315
1416var namePattern = regexp .MustCompile (`^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$` )
@@ -251,6 +253,11 @@ func (sl *SkillsLoader) BuildSkillsSummary() string {
251253func (sl * SkillsLoader ) getSkillMetadata (skillPath string ) * SkillMetadata {
252254 content , err := os .ReadFile (skillPath )
253255 if err != nil {
256+ logger .WarnCF ("skills" , "Failed to read skill metadata" ,
257+ map [string ]interface {}{
258+ "skill_path" : skillPath ,
259+ "error" : err .Error (),
260+ })
254261 return nil
255262 }
256263
@@ -306,9 +313,9 @@ func (sl *SkillsLoader) parseSimpleYAML(content string) map[string]string {
306313}
307314
308315func (sl * SkillsLoader ) extractFrontmatter (content string ) string {
309- // (?s) enables DOTALL mode so . matches newlines
310- // Match first ---, capture everything until next --- on its own line
311- re := regexp .MustCompile (`(?s)^---\n(.*) \n---` )
316+ // Support both Unix (\n) and Windows (\r\n) line endings for frontmatter blocks
317+ // (?s) enables DOTALL so . matches newlines; ^ --- at start, then ... --- at start of line
318+ re := regexp .MustCompile (`(?s)^---\r?\ n(.*?)\r? \n---` )
312319 match := re .FindStringSubmatch (content )
313320 if len (match ) > 1 {
314321 return match [1 ]
You can’t perform that action at this time.
0 commit comments