mirror of
https://github.com/runkids/skillshare.git
synced 2026-11-19 02:17:09 +00:00
## New Features
- Tracked repositories: `install --track` to clone team skill repos
- Nested skills: organize in folders, auto-flatten on sync (work/api → work__api)
- Name collision detection: warns when multiple skills share same SKILL.md name
- Auto-pruning: orphaned symlinks cleaned on sync
- Custom naming: `--name` flag for tracked repos
## Changes
- Require target path to exist when adding targets
- Add sync reminder after adding target
- Improve pruning messages (broken vs orphan symlinks)
- Add `{team}:{name}` naming convention recommendation
## Files
- New: update.go, gitignore.go, frontmatter.go
- Updated: sync.go, install.go, uninstall.go, validate.go
- Docs: README.md, SKILL.md
50 lines
1000 B
Go
50 lines
1000 B
Go
package utils
|
|
|
|
import (
|
|
"bufio"
|
|
"os"
|
|
"path/filepath"
|
|
"strings"
|
|
)
|
|
|
|
// ParseSkillName reads the SKILL.md and extracts the "name" from frontmatter.
|
|
func ParseSkillName(skillPath string) (string, error) {
|
|
skillFile := filepath.Join(skillPath, "SKILL.md")
|
|
file, err := os.Open(skillFile)
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
defer file.Close()
|
|
|
|
scanner := bufio.NewScanner(file)
|
|
inFrontmatter := false
|
|
|
|
for scanner.Scan() {
|
|
line := strings.TrimSpace(scanner.Text())
|
|
|
|
// Detect frontmatter delimiters
|
|
if line == "---" {
|
|
if inFrontmatter {
|
|
break // End of frontmatter
|
|
}
|
|
inFrontmatter = true
|
|
continue
|
|
}
|
|
|
|
if inFrontmatter {
|
|
if strings.HasPrefix(line, "name:") {
|
|
// Extract value: "name: my-skill" -> "my-skill"
|
|
parts := strings.SplitN(line, ":", 2)
|
|
if len(parts) == 2 {
|
|
name := strings.TrimSpace(parts[1])
|
|
// Remove quotes if present
|
|
name = strings.Trim(name, `"'`)
|
|
return name, nil
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
return "", nil // Name not found
|
|
}
|