feat(install): fix hidden-dir discovery, add fuzzy search, and improve install UX

discoverSkills() skipped all dot-prefixed dirs, causing repos like
openai/skills (which use .curated/ and .system/) to find 0 skills.
Fix: only skip .git, traverse all other hidden dirs.

CLI --skill flag now falls back to fuzzy matching (via lithammer/fuzzysearch)
when exact match fails. Single fuzzy match auto-selects; ambiguous matches
show "did you mean" suggestions.

UI SkillPickerModal gains a filter input (autofocus, substring on name+path)
that appears for >5 skills. Select All toggles only filtered skills.

Batch install toast fix: always show summary toast even when some skills
are blocked by security audit (previously early-returned with no feedback).
Audit dialog now targets only blocked skills for force-retry.

CLI output for mixed results: use warning banner instead of success,
show failures first, condense >10 successes into a single line.
This commit is contained in:
Willie
2026-02-10 02:23:16 +08:00
parent 4d17ff5d57
commit 8ec53065b5
14 changed files with 367 additions and 149 deletions
+4 -4
View File
@@ -1,4 +1,4 @@
.PHONY: help build build-meta run test test-unit test-int test-cover test-install test-docker test-docker-online sandbox-up sandbox-shell sandbox-down lint fmt fmt-check check install clean ui-install ui-build ui-dev build-ui
.PHONY: help build build-meta run test test-unit test-int test-cover test-install test-docker test-docker-online sandbox-up sandbox-shell sandbox-down lint fmt fmt-check check install clean ui-install ui-build ui-dev build-all
help:
@echo "Common tasks:"
@@ -21,13 +21,13 @@ help:
@echo " make ui-install # install frontend dependencies"
@echo " make ui-build # build frontend + copy to embed"
@echo " make ui-dev # Go API server + Vite dev server"
@echo " make build-ui # ui-build + build (full binary)"
@echo " make build-all # ui-build + build (full binary)"
@echo " make clean # remove build artifacts"
build:
@if [ ! -f internal/server/dist/index.html ]; then \
mkdir -p internal/server/dist && \
printf '<!DOCTYPE html><html><body><h1>UI not built</h1><p>Run: make build-ui</p></body></html>' > internal/server/dist/index.html; \
printf '<!DOCTYPE html><html><body><h1>UI not built</h1><p>Run: make build-all</p></body></html>' > internal/server/dist/index.html; \
fi
mkdir -p bin && go build -o bin/skillshare ./cmd/skillshare
@@ -94,7 +94,7 @@ ui-dev:
go run -tags dev ./cmd/skillshare ui --no-open & \
cd ui && pnpm run dev
build-ui: ui-build build
build-all: ui-build build
clean:
rm -rf bin coverage.out
+2 -2
View File
@@ -43,9 +43,9 @@
> **Recent Updates**
> | Version | Highlights |
> |---------|------------|
> | [0.11.0](https://github.com/runkids/skillshare/releases/tag/v0.11.0) | Security Audit — scan skills for threats, auto-block on install, web UI audit page |
> | [0.10.0](https://github.com/runkids/skillshare/releases/tag/v0.10.0) | Web Dashboard — visual skill management via `skillshare ui` |
> | [0.9.0](https://github.com/runkids/skillshare/releases/tag/v0.9.0) | Project-level skills — scope skills to a single repo, share via git |
> | [0.8.0](https://github.com/runkids/skillshare/releases/tag/v0.8.0) | `pull` → `collect` rename, clearer command symmetry, refactoring |
## Why skillshare
@@ -337,7 +337,7 @@ UI development helpers:
make ui-install
make ui-build
make ui-dev
make build-ui
make build-all
```
## Documentation
+58 -19
View File
@@ -4,9 +4,11 @@ import (
"fmt"
"os"
"path/filepath"
"sort"
"strings"
"github.com/AlecAivazis/survey/v2"
"github.com/lithammer/fuzzysearch/fuzzy"
"skillshare/internal/config"
"skillshare/internal/install"
@@ -415,19 +417,38 @@ func selectSkills(skills []install.SkillInfo, opts install.InstallOptions) ([]in
}
// filterSkillsByName matches requested names against discovered skills.
// It tries exact match first, then falls back to fuzzy matching.
func filterSkillsByName(skills []install.SkillInfo, names []string) (matched []install.SkillInfo, notFound []string) {
nameSet := make(map[string]bool, len(names))
for _, n := range names {
nameSet[n] = true
skillNames := make([]string, len(skills))
for i, s := range skills {
skillNames[i] = s.Name
}
for _, skill := range skills {
if nameSet[skill.Name] {
matched = append(matched, skill)
delete(nameSet, skill.Name)
skillByName := make(map[string]install.SkillInfo, len(skills))
for _, s := range skills {
skillByName[s.Name] = s
}
for _, name := range names {
// Try exact match first
if s, ok := skillByName[name]; ok {
matched = append(matched, s)
continue
}
// Fall back to fuzzy match
ranks := fuzzy.RankFindNormalizedFold(name, skillNames)
sort.Sort(ranks)
if len(ranks) == 1 {
matched = append(matched, skillByName[ranks[0].Target])
} else if len(ranks) > 1 {
suggestions := make([]string, len(ranks))
for i, r := range ranks {
suggestions[i] = r.Target
}
notFound = append(notFound, fmt.Sprintf("%s (did you mean: %s?)", name, strings.Join(suggestions, ", ")))
} else {
notFound = append(notFound, name)
}
}
for n := range nameSet {
notFound = append(notFound, n)
}
return
}
@@ -609,32 +630,50 @@ func installSelectedSkills(selected []install.SkillInfo, discovery *install.Disc
// displayInstallResults shows the final install results
func displayInstallResults(results []skillInstallResult, spinner *ui.Spinner) {
var installed, failed int
var successes, failures []skillInstallResult
for _, r := range results {
if r.success {
installed++
successes = append(successes, r)
} else {
failed++
failures = append(failures, r)
}
}
installed := len(successes)
failed := len(failures)
if failed > 0 && installed == 0 {
spinner.Fail(fmt.Sprintf("Failed to install %d skill(s)", failed))
} else if failed > 0 {
spinner.Success(fmt.Sprintf("Installed %d, failed %d", installed, failed))
spinner.Warn(fmt.Sprintf("Installed %d, failed %d", installed, failed))
} else {
spinner.Success(fmt.Sprintf("Installed %d skill(s)", installed))
}
fmt.Println()
for _, r := range results {
if r.success {
ui.StepDone(r.skill.Name, "installed")
} else {
// Show failures first with details
if failed > 0 {
fmt.Println()
for _, r := range failures {
ui.StepFail(r.skill.Name, r.message)
}
}
// Show successes — condensed when many
if installed > 0 {
fmt.Println()
if installed > 10 {
names := make([]string, installed)
for i, r := range successes {
names[i] = r.skill.Name
}
ui.StepDone(fmt.Sprintf("%d skills installed", installed), strings.Join(names, ", "))
} else {
for _, r := range successes {
ui.StepDone(r.skill.Name, r.message)
}
}
}
if installed > 0 {
fmt.Println()
ui.Info("Run 'skillshare sync' to distribute to all targets")
+88
View File
@@ -0,0 +1,88 @@
package main
import (
"testing"
"skillshare/internal/install"
)
func TestFilterSkillsByName_ExactMatch(t *testing.T) {
skills := []install.SkillInfo{
{Name: "figma", Path: "figma"},
{Name: "pdf", Path: "pdf"},
{Name: "github-actions", Path: "github-actions"},
}
matched, notFound := filterSkillsByName(skills, []string{"pdf"})
if len(notFound) > 0 {
t.Errorf("unexpected notFound: %v", notFound)
}
if len(matched) != 1 || matched[0].Name != "pdf" {
t.Errorf("expected [pdf], got %v", matched)
}
}
func TestFilterSkillsByName_FuzzyMatchSingle(t *testing.T) {
skills := []install.SkillInfo{
{Name: "figma", Path: "figma"},
{Name: "pdf", Path: "pdf"},
{Name: "github-actions", Path: "github-actions"},
}
matched, notFound := filterSkillsByName(skills, []string{"fig"})
if len(notFound) > 0 {
t.Errorf("unexpected notFound: %v", notFound)
}
if len(matched) != 1 || matched[0].Name != "figma" {
t.Errorf("expected fuzzy match [figma], got %v", matched)
}
}
func TestFilterSkillsByName_FuzzyMatchAmbiguous(t *testing.T) {
skills := []install.SkillInfo{
{Name: "github-actions", Path: "github-actions"},
{Name: "github-pr", Path: "github-pr"},
{Name: "pdf", Path: "pdf"},
}
matched, notFound := filterSkillsByName(skills, []string{"github"})
if len(matched) != 0 {
t.Errorf("expected no match for ambiguous query, got %v", matched)
}
if len(notFound) != 1 {
t.Fatalf("expected 1 notFound, got %d", len(notFound))
}
if notFound[0] == "github" {
t.Error("notFound should contain 'did you mean' suggestions, got plain name")
}
}
func TestFilterSkillsByName_NotFound(t *testing.T) {
skills := []install.SkillInfo{
{Name: "figma", Path: "figma"},
{Name: "pdf", Path: "pdf"},
}
matched, notFound := filterSkillsByName(skills, []string{"zzzzz"})
if len(matched) != 0 {
t.Errorf("expected no matches, got %v", matched)
}
if len(notFound) != 1 || notFound[0] != "zzzzz" {
t.Errorf("expected notFound=[zzzzz], got %v", notFound)
}
}
func TestFilterSkillsByName_ExactTakesPriority(t *testing.T) {
skills := []install.SkillInfo{
{Name: "fig", Path: "fig"},
{Name: "figma", Path: "figma"},
}
matched, notFound := filterSkillsByName(skills, []string{"fig"})
if len(notFound) > 0 {
t.Errorf("unexpected notFound: %v", notFound)
}
if len(matched) != 1 || matched[0].Name != "fig" {
t.Errorf("exact match should take priority, got %v", matched)
}
}
+9 -26
View File
@@ -2,45 +2,28 @@ module skillshare
go 1.25.5
require gopkg.in/yaml.v3 v3.0.1
require (
github.com/AlecAivazis/survey/v2 v2.3.7
github.com/lithammer/fuzzysearch v1.1.8
github.com/mattn/go-runewidth v0.0.16
github.com/pterm/pterm v0.12.82
gopkg.in/yaml.v3 v3.0.1
)
require (
atomicgo.dev/cursor v0.2.0 // indirect
atomicgo.dev/keyboard v0.2.9 // indirect
atomicgo.dev/schedule v0.1.0 // indirect
github.com/AlecAivazis/survey/v2 v2.3.7 // indirect
github.com/atotto/clipboard v0.1.4 // indirect
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
github.com/catppuccin/go v0.3.0 // indirect
github.com/charmbracelet/bubbles v0.21.1-0.20250623103423-23b8fd6302d7 // indirect
github.com/charmbracelet/bubbletea v1.3.6 // indirect
github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc // indirect
github.com/charmbracelet/huh v0.8.0 // indirect
github.com/charmbracelet/lipgloss v1.1.0 // indirect
github.com/charmbracelet/x/ansi v0.9.3 // indirect
github.com/charmbracelet/x/cellbuf v0.0.13 // indirect
github.com/charmbracelet/x/exp/strings v0.0.0-20240722160745-212f7b056ed0 // indirect
github.com/charmbracelet/x/term v0.2.1 // indirect
github.com/containerd/console v1.0.5 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect
github.com/creack/pty v1.1.24 // indirect
github.com/gookit/color v1.5.4 // indirect
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
github.com/lithammer/fuzzysearch v1.1.8 // indirect
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
github.com/mattn/go-colorable v0.1.2 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-localereader v0.0.1 // indirect
github.com/mattn/go-runewidth v0.0.16 // indirect
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect
github.com/mitchellh/hashstructure/v2 v2.0.2 // indirect
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect
github.com/muesli/cancelreader v0.2.2 // indirect
github.com/muesli/termenv v0.16.0 // indirect
github.com/pterm/pterm v0.12.82 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
golang.org/x/sync v0.15.0 // indirect
golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect
golang.org/x/sys v0.33.0 // indirect
golang.org/x/term v0.32.0 // indirect
golang.org/x/text v0.26.0 // indirect
+20 -48
View File
@@ -1,3 +1,5 @@
atomicgo.dev/assert v0.0.2 h1:FiKeMiZSgRrZsPo9qn/7vmr7mCsh5SZyXY4YGYiYwrg=
atomicgo.dev/assert v0.0.2/go.mod h1:ut4NcI3QDdJtlmAxQULOmA13Gz6e2DWbSAS8RUOmNYQ=
atomicgo.dev/cursor v0.2.0 h1:H6XN5alUJ52FZZUkI7AlJbUc1aW38GWZalpYRPpoPOw=
atomicgo.dev/cursor v0.2.0/go.mod h1:Lr4ZJB3U7DfPPOkbH7/6TOtJ4vFGHlgj1nc+n900IpU=
atomicgo.dev/keyboard v0.2.9 h1:tOsIid3nlPLZ3lwgG8KZMp/SFmr7P0ssEN5JUsm78K8=
@@ -13,80 +15,51 @@ github.com/MarvinJWendt/testza v0.2.10/go.mod h1:pd+VWsoGUiFtq+hRKSU1Bktnn+DMCSr
github.com/MarvinJWendt/testza v0.2.12/go.mod h1:JOIegYyV7rX+7VZ9r77L/eH6CfJHHzXjB69adAhzZkI=
github.com/MarvinJWendt/testza v0.3.0/go.mod h1:eFcL4I0idjtIx8P9C6KkAuLgATNKpX4/2oUqKc6bF2c=
github.com/MarvinJWendt/testza v0.4.2/go.mod h1:mSdhXiKH8sg/gQehJ63bINcCKp7RtYewEjXsvsVUPbE=
github.com/MarvinJWendt/testza v0.5.2 h1:53KDo64C1z/h/d/stCYCPY69bt/OSwjq5KpFNwi+zB4=
github.com/MarvinJWendt/testza v0.5.2/go.mod h1:xu53QFE5sCdjtMCKk8YMQ2MnymimEctc4n3EjyIYvEY=
github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2 h1:+vx7roKuyA63nhn5WAunQHLTznkw5W8b1Xc0dNjp83s=
github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2/go.mod h1:HBCaDeC1lPdgDeDbhX8XFpy1jqjK0IBG8W5K+xYqA0w=
github.com/atomicgo/cursor v0.0.1/go.mod h1:cBON2QmmrysudxNBFthvMtN32r3jxVRIvzkUiF/RuIk=
github.com/atotto/clipboard v0.1.4 h1:EH0zSVneZPSuFR11BlR9YppQTVDbh5+16AmcJi4g1z4=
github.com/atotto/clipboard v0.1.4/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI=
github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k=
github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8=
github.com/catppuccin/go v0.3.0 h1:d+0/YicIq+hSTo5oPuRi5kOpqkVA5tAsU6dNhvRu+aY=
github.com/catppuccin/go v0.3.0/go.mod h1:8IHJuMGaUUjQM82qBrGNBv7LFq6JI3NnQCF6MOlZjpc=
github.com/charmbracelet/bubbles v0.21.1-0.20250623103423-23b8fd6302d7 h1:JFgG/xnwFfbezlUnFMJy0nusZvytYysV4SCS2cYbvws=
github.com/charmbracelet/bubbles v0.21.1-0.20250623103423-23b8fd6302d7/go.mod h1:ISC1gtLcVilLOf23wvTfoQuYbW2q0JevFxPfUzZ9Ybw=
github.com/charmbracelet/bubbletea v1.3.6 h1:VkHIxPJQeDt0aFJIsVxw8BQdh/F/L2KKZGsK6et5taU=
github.com/charmbracelet/bubbletea v1.3.6/go.mod h1:oQD9VCRQFF8KplacJLo28/jofOI2ToOfGYeFgBBxHOc=
github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc h1:4pZI35227imm7yK2bGPcfpFEmuY1gc2YSTShr4iJBfs=
github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc/go.mod h1:X4/0JoqgTIPSFcRA/P6INZzIuyqdFY5rm8tb41s9okk=
github.com/charmbracelet/huh v0.8.0 h1:Xz/Pm2h64cXQZn/Jvele4J3r7DDiqFCNIVteYukxDvY=
github.com/charmbracelet/huh v0.8.0/go.mod h1:5YVc+SlZ1IhQALxRPpkGwwEKftN/+OlJlnJYlDRFqN4=
github.com/charmbracelet/lipgloss v1.1.0 h1:vYXsiLHVkK7fp74RkV7b2kq9+zDLoEU4MZoFqR/noCY=
github.com/charmbracelet/lipgloss v1.1.0/go.mod h1:/6Q8FR2o+kj8rz4Dq0zQc3vYf7X+B0binUUBwA0aL30=
github.com/charmbracelet/x/ansi v0.9.3 h1:BXt5DHS/MKF+LjuK4huWrC6NCvHtexww7dMayh6GXd0=
github.com/charmbracelet/x/ansi v0.9.3/go.mod h1:3RQDQ6lDnROptfpWuUVIUG64bD2g2BgntdxH0Ya5TeE=
github.com/charmbracelet/x/cellbuf v0.0.13 h1:/KBBKHuVRbq1lYx5BzEHBAFBP8VcQzJejZ/IA3iR28k=
github.com/charmbracelet/x/cellbuf v0.0.13/go.mod h1:xe0nKWGd3eJgtqZRaN9RjMtK7xUYchjzPr7q6kcvCCs=
github.com/charmbracelet/x/exp/strings v0.0.0-20240722160745-212f7b056ed0 h1:qko3AQ4gK1MTS/de7F5hPGx6/k1u0w4TeYmBFwzYVP4=
github.com/charmbracelet/x/exp/strings v0.0.0-20240722160745-212f7b056ed0/go.mod h1:pBhA0ybfXv6hDjQUZ7hk1lVxBiUbupdw5R31yPUViVQ=
github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ=
github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg=
github.com/containerd/console v1.0.3/go.mod h1:7LqA/THxQ86k76b8c/EMSiaJ3h1eZkMkXar0TQ1gf3U=
github.com/containerd/console v1.0.5 h1:R0ymNeydRqH2DmakFNdmjR2k0t7UPuiOV/N/27/qqsc=
github.com/containerd/console v1.0.5/go.mod h1:YynlIjWYF8myEu6sdkwKIvGQq+cOckRm6So2avqoYAk=
github.com/creack/pty v1.1.17/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4=
github.com/creack/pty v1.1.24 h1:bJrF4RRfyJnbTJqzRLHzcGaZK1NeM5kTC9jGgovnR1s=
github.com/creack/pty v1.1.24/go.mod h1:08sCNb52WyoAwi2QDyzUCTgcvVFhUzewun7wtTfvcwE=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f h1:Y/CXytFA4m6baUTXGLOoWe4PQhGxaX0KpnayAqC48p4=
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f/go.mod h1:vw97MGsxSvLiUE2X8qFplwetxpGLQrlU1Q9AUEIzCaM=
github.com/gookit/color v1.4.2/go.mod h1:fqRyamkC1W8uxl+lxCQxOT09l/vYfZ+QeiX3rKQHCoQ=
github.com/gookit/color v1.5.0/go.mod h1:43aQb+Zerm/BWh2GnrgOQm7ffz7tvQXEKV6BFMl7wAo=
github.com/gookit/color v1.5.4 h1:FZmqs7XOyGgCAxmWyPslpiok1k05wmY3SJTytgvYFs0=
github.com/gookit/color v1.5.4/go.mod h1:pZJOeOS8DM43rXbp4AZo1n9zCU2qjpcRko0b6/QJi9w=
github.com/hinshun/vt10x v0.0.0-20220119200601-820417d04eec h1:qv2VnGeEQHchGaZ/u7lxST/RaJw+cv273q79D81Xbog=
github.com/hinshun/vt10x v0.0.0-20220119200601-820417d04eec/go.mod h1:Q48J4R4DvxnHolD5P8pOtXigYlRuPLGl6moFx3ulM68=
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs=
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8=
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
github.com/klauspost/cpuid/v2 v2.0.10/go.mod h1:g2LTdtYhdyuGPqyWyv7qRAmj1WBqxuObKfj5c0PQa7c=
github.com/klauspost/cpuid/v2 v2.0.12/go.mod h1:g2LTdtYhdyuGPqyWyv7qRAmj1WBqxuObKfj5c0PQa7c=
github.com/klauspost/cpuid/v2 v2.2.3 h1:sxCkb+qR91z4vsqw4vGGZlDgPz3G7gjaLyK3V8y70BU=
github.com/klauspost/cpuid/v2 v2.2.3/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY=
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/lithammer/fuzzysearch v1.1.8 h1:/HIuJnjHuXS8bKaiTMeeDlW2/AyIWk2brx1V8LFgLN4=
github.com/lithammer/fuzzysearch v1.1.8/go.mod h1:IdqeyBClc3FFqSzYq/MXESsS4S0FsZ5ajtkr5xPLts4=
github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY=
github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
github.com/mattn/go-colorable v0.1.2 h1:/bC9yWikZXAL9uJdulbSfyVNIR3n3trXl+v8+1sx8mU=
github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
github.com/mattn/go-isatty v0.0.8 h1:HLtExJ+uU2HOZ+wI0Tt5DtUDrx8yhUqDcp7fYERX4CE=
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-localereader v0.0.1 h1:ygSAOl7ZXTx4RdPYinUpg6W99U8jWvWi9Ye2JC/oIi4=
github.com/mattn/go-localereader v0.0.1/go.mod h1:8fBrzywKY7BI3czFoHkuzRoWE9C+EiG4R1k4Cjx5p88=
github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc=
github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b h1:j7+1HpAFS1zy5+Q4qx1fWh90gTKwiN4QCGoY9TWyyO4=
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE=
github.com/mitchellh/hashstructure/v2 v2.0.2 h1:vGKWl0YJqUNxE8d+h8f6NJLcCJrgbhC4NcD46KavDd4=
github.com/mitchellh/hashstructure/v2 v2.0.2/go.mod h1:MG3aRVU/N29oo/V/IhBX8GR/zz4kQkprJgF2EVszyDE=
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 h1:ZK8zHtRHOkbHy6Mmr5D264iyp3TiX5OmNcI5cIARiQI=
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6/go.mod h1:CJlz5H+gyd6CUWT45Oy4q24RdLyn7Md9Vj2/ldJBSIo=
github.com/muesli/cancelreader v0.2.2 h1:3I4Kt4BQjOR54NavqnDogx/MIoWBFa0StPA8ELUXHmA=
github.com/muesli/cancelreader v0.2.2/go.mod h1:3XuTXfFS2VjM+HTLZY9Ak0l6eUKfijIfMUZ4EgX0QYo=
github.com/muesli/termenv v0.16.0 h1:S5AlUN9dENB57rsbnkPyfdGuWIlkmzJjbFf0Tf5FWUc=
github.com/muesli/termenv v0.16.0/go.mod h1:ZRfOIKPFDYQoDFF4Olj7/QJbW60Ol/kL1pU3VfY/Cnk=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/pterm/pterm v0.12.27/go.mod h1:PhQ89w4i95rhgE+xedAoqous6K9X+r6aSOI2eFF7DZI=
github.com/pterm/pterm v0.12.29/go.mod h1:WI3qxgvoQFFGKGjGnJR849gU0TsEOvKn5Q8LlY1U7lg=
@@ -100,17 +73,22 @@ github.com/pterm/pterm v0.12.82/go.mod h1:TyuyrPjnxfwP+ccJdBTeWHtd/e0ybQHkOS/Tak
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ=
github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778/go.mod h1:2MuV+tbUrU1zIOPMxZ5EncGwgmMJsa+9ucAQZXxsObs=
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavMF/ppJZNG9ZpyihvCd0w101no=
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM8rJBtfilJ2qTU199MI=
golang.org/x/exp v0.0.0-20231006140011-7918f672742d/go.mod h1:ldy0pHrwJyGW56pPQzzkH36rKxoZW1tw7ZJpeKx+hdo=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
@@ -120,19 +98,15 @@ golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.15.0 h1:KWH3jNZsfyT6xfAfKiz6MRNmd46ByHDYaZ7KSkCtdW8=
golang.org/x/sync v0.15.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211013075003-97ac67df715c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f h1:v4INt8xihDGvnrfjMDVXGxw9wrfxYyCjk0KbXjhR55s=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
@@ -142,7 +116,6 @@ golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
golang.org/x/term v0.32.0 h1:DR4lr0TjUs3epypdhTOkMmuF5CDFJ/8pOnbzMZPQ7bg=
@@ -150,7 +123,6 @@ golang.org/x/term v0.32.0/go.mod h1:uZG1FhGx848Sqfsq4/DlJr3xGGsYMu/L5GW4abiaEPQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.4.0 h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg=
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
@@ -161,8 +133,8 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+2 -2
View File
@@ -222,8 +222,8 @@ func discoverSkills(repoPath string, includeRoot bool) []SkillInfo {
return nil
}
// Skip hidden directories and .git
if info.IsDir() && (info.Name() == ".git" || (len(info.Name()) > 0 && info.Name()[0] == '.')) {
// Skip .git directory
if info.IsDir() && info.Name() == ".git" {
return filepath.SkipDir
}
+28 -8
View File
@@ -101,7 +101,7 @@ func TestDiscoverSkills_ChildrenOnly(t *testing.T) {
}
}
func TestDiscoverSkills_SkipsHiddenDirs(t *testing.T) {
func TestDiscoverSkills_SkipsGitDir(t *testing.T) {
repoPath := t.TempDir()
// Create .git directory with SKILL.md (should be skipped)
@@ -113,18 +113,38 @@ func TestDiscoverSkills_SkipsHiddenDirs(t *testing.T) {
t.Fatal(err)
}
// Create .hidden directory with SKILL.md (should be skipped)
hiddenDir := filepath.Join(repoPath, ".hidden")
if err := os.MkdirAll(hiddenDir, 0755); err != nil {
skills := discoverSkills(repoPath, true)
if len(skills) != 0 {
t.Errorf("expected 0 skills (.git skipped), got %d", len(skills))
}
}
func TestDiscoverSkills_FindsHiddenDirs(t *testing.T) {
repoPath := t.TempDir()
// Create hidden dirs with skills (like openai/skills .curated/, .system/)
for _, name := range []string{".curated", ".system"} {
dir := filepath.Join(repoPath, name, "skill-a")
if err := os.MkdirAll(dir, 0755); err != nil {
t.Fatal(err)
}
if err := os.WriteFile(filepath.Join(dir, "SKILL.md"), []byte("---\nname: skill-a\n---"), 0644); err != nil {
t.Fatal(err)
}
}
// Also create a .git dir (should still be skipped)
gitDir := filepath.Join(repoPath, ".git")
if err := os.MkdirAll(gitDir, 0755); err != nil {
t.Fatal(err)
}
if err := os.WriteFile(filepath.Join(hiddenDir, "SKILL.md"), []byte("---\nname: hidden\n---"), 0644); err != nil {
if err := os.WriteFile(filepath.Join(gitDir, "SKILL.md"), []byte("---\nname: git\n---"), 0644); err != nil {
t.Fatal(err)
}
skills := discoverSkills(repoPath, true)
if len(skills) != 0 {
t.Errorf("expected 0 skills (hidden dirs skipped), got %d", len(skills))
skills := discoverSkills(repoPath, false)
if len(skills) != 2 {
t.Fatalf("expected 2 skills from hidden dirs, got %d: %v", len(skills), skills)
}
}
+3 -3
View File
@@ -24,7 +24,7 @@ echo " mise run check # fmt:check + lint + test"
echo " mise run ui:install # install frontend dependencies"
echo " mise run ui:build # build frontend + copy to embed"
echo " mise run ui:dev # Go API server + Vite dev server"
echo " mise run build:ui # ui:build + build (full binary)"
echo " mise run build:all # ui:build + build (full binary)"
echo " mise run clean # remove build artifacts"
"""
@@ -33,7 +33,7 @@ description = "Build the skillshare binary"
run = """
if [ ! -f internal/server/dist/index.html ]; then
mkdir -p internal/server/dist
printf '<!DOCTYPE html><html><body><h1>UI not built</h1><p>Run: mise run build:ui</p></body></html>' > internal/server/dist/index.html
printf '<!DOCTYPE html><html><body><h1>UI not built</h1><p>Run: mise run build:all</p></body></html>' > internal/server/dist/index.html
fi
mkdir -p bin && go build -o bin/skillshare ./cmd/skillshare
"""
@@ -128,7 +128,7 @@ go run -tags dev ./cmd/skillshare ui --no-open &
cd ui && pnpm run dev
"""
[tasks."build:ui"]
[tasks."build:all"]
description = "Build frontend + Go binary (full build)"
depends = ["ui:build", "build"]
+52
View File
@@ -594,6 +594,58 @@ targets: {}
}
}
// TestInstall_Discovery_HiddenDirs_FindsSkills tests that skills inside hidden
// directories (like .curated/, .system/) are discovered, while .git is skipped.
func TestInstall_Discovery_HiddenDirs_FindsSkills(t *testing.T) {
sb := testutil.NewSandbox(t)
defer sb.Cleanup()
sb.WriteConfig(`source: ` + sb.SourcePath + `
targets: {}
`)
// Create a repo with skills inside hidden directories (like openai/skills)
gitRepoPath := filepath.Join(sb.Root, "hidden-dir-repo")
curatedSkill := filepath.Join(gitRepoPath, ".curated", "pdf")
systemSkill := filepath.Join(gitRepoPath, ".system", "figma")
os.MkdirAll(curatedSkill, 0755)
os.MkdirAll(systemSkill, 0755)
os.WriteFile(filepath.Join(curatedSkill, "SKILL.md"), []byte("# PDF"), 0644)
os.WriteFile(filepath.Join(systemSkill, "SKILL.md"), []byte("# Figma"), 0644)
// Initialize git repo
cmd := exec.Command("git", "init")
cmd.Dir = gitRepoPath
if err := cmd.Run(); err != nil {
t.Skip("git not available, skipping git test")
}
cmd = exec.Command("git", "config", "user.email", "test@test.com")
cmd.Dir = gitRepoPath
cmd.Run()
cmd = exec.Command("git", "config", "user.name", "Test")
cmd.Dir = gitRepoPath
cmd.Run()
cmd = exec.Command("git", "add", ".")
cmd.Dir = gitRepoPath
cmd.Run()
cmd = exec.Command("git", "commit", "-m", "Initial commit")
cmd.Dir = gitRepoPath
cmd.Run()
// Use file:// protocol to test git discovery with local repo
result := sb.RunCLI("install", "file://"+gitRepoPath, "--dry-run")
result.AssertSuccess(t)
result.AssertOutputContains(t, "Found")
result.AssertOutputContains(t, "pdf")
result.AssertOutputContains(t, "figma")
}
// TestInstall_OrchestratorStructure_PreservesNesting tests that when installing
// an orchestrator structure (root SKILL.md + child skills), the nested structure
// is preserved rather than flattening all skills to root.
+30 -20
View File
@@ -189,26 +189,30 @@ export default function InstallForm({
force,
});
const allWarnings: string[] = [];
let hasError = false;
const auditFindings: string[] = [];
const auditBlockedSkills: DiscoveredSkill[] = [];
for (const item of res.results) {
if (item.error) {
hasError = true;
// Check if any batch item was audit-blocked
if (isAuditBlock(item.error)) {
setAuditDialog({
findings: parseAuditError(item.error),
pending: { type: 'batch', source: trimmed, skills: disc.skills },
});
return;
auditFindings.push(`${item.name}:`, ...parseAuditError(item.error));
const skill = disc.skills.find((s) => s.name === item.name);
if (skill) auditBlockedSkills.push(skill);
} else {
toast(`${item.name}: ${item.error}`, 'error');
}
toast(`${item.name}: ${item.error}`, 'error');
}
if (item.warnings?.length) allWarnings.push(...item.warnings.map((w) => `${item.name}: ${w}`));
}
if (!hasError) toast(res.summary, 'success');
toast(res.summary, auditBlockedSkills.length > 0 ? 'warning' : 'success');
if (allWarnings.length > 0) setWarningDialog(allWarnings);
resetForm();
onSuccess?.({ action: 'installed', warnings: [], skillName: res.summary });
if (auditBlockedSkills.length > 0) {
setAuditDialog({
findings: auditFindings,
pending: { type: 'batch', source: trimmed, skills: auditBlockedSkills },
});
}
} else {
// No skills discovered — direct install
const res = await api.install({
@@ -234,27 +238,33 @@ export default function InstallForm({
force,
});
const allWarnings: string[] = [];
let hasError = false;
const auditFindings: string[] = [];
const auditBlockedSkills: DiscoveredSkill[] = [];
for (const item of res.results) {
if (item.error) {
hasError = true;
if (isAuditBlock(item.error)) {
setShowPicker(false);
setAuditDialog({
findings: parseAuditError(item.error),
pending: { type: 'batch', source: pendingSource, skills: selected },
});
return;
auditFindings.push(`${item.name}:`, ...parseAuditError(item.error));
const skill = selected.find((s) => s.name === item.name);
if (skill) auditBlockedSkills.push(skill);
} else {
toast(`${item.name}: ${item.error}`, 'error');
}
toast(`${item.name}: ${item.error}`, 'error');
}
if (item.warnings?.length) allWarnings.push(...item.warnings.map((w) => `${item.name}: ${w}`));
}
if (!hasError) toast(res.summary, 'success');
// Always show summary toast
toast(res.summary, auditBlockedSkills.length > 0 ? 'warning' : 'success');
if (allWarnings.length > 0) setWarningDialog(allWarnings);
setShowPicker(false);
resetForm();
onSuccess?.({ action: 'installed', warnings: [], skillName: res.summary });
// Show audit dialog for blocked items only (force-retry targets just those)
if (auditBlockedSkills.length > 0) {
setAuditDialog({
findings: auditFindings,
pending: { type: 'batch', source: pendingSource, skills: auditBlockedSkills },
});
}
} catch (e: unknown) {
handleError(e, { type: 'batch', source: pendingSource, skills: selected });
} finally {
+53 -11
View File
@@ -1,5 +1,5 @@
import { useState, useEffect } from 'react';
import { Download } from 'lucide-react';
import { useState, useEffect, useRef, useMemo } from 'react';
import { Download, Search } from 'lucide-react';
import Card from './Card';
import HandButton from './HandButton';
import { HandCheckbox } from './HandInput';
@@ -24,11 +24,23 @@ export default function SkillPickerModal({
installing,
}: SkillPickerModalProps) {
const [selected, setSelected] = useState<Set<string>>(new Set());
const [filter, setFilter] = useState('');
const filterRef = useRef<HTMLInputElement>(null);
// Select all by default when modal opens
const filtered = useMemo(() => {
if (!filter) return skills;
const q = filter.toLowerCase();
return skills.filter(
(s) => s.name.toLowerCase().includes(q) || s.path.toLowerCase().includes(q),
);
}, [skills, filter]);
// Select all by default when modal opens; reset filter
useEffect(() => {
if (open) {
setSelected(new Set(skills.map((s) => s.path)));
setFilter('');
setTimeout(() => filterRef.current?.focus(), 0);
}
}, [open, skills]);
@@ -44,14 +56,17 @@ export default function SkillPickerModal({
if (!open) return null;
const allSelected = selected.size === skills.length;
const filteredPaths = new Set(filtered.map((s) => s.path));
const allFilteredSelected = filtered.length > 0 && filtered.every((s) => selected.has(s.path));
const toggleAll = () => {
if (allSelected) {
setSelected(new Set());
const next = new Set(selected);
if (allFilteredSelected) {
for (const p of filteredPaths) next.delete(p);
} else {
setSelected(new Set(skills.map((s) => s.path)));
for (const p of filteredPaths) next.add(p);
}
setSelected(next);
};
const toggle = (path: string) => {
@@ -98,18 +113,45 @@ export default function SkillPickerModal({
{source}
</p>
{/* Filter */}
{skills.length > 5 && (
<div className="relative mb-3">
<Search
size={14}
className="absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-dark pointer-events-none"
/>
<input
ref={filterRef}
type="text"
placeholder="Filter skills..."
value={filter}
onChange={(e) => setFilter(e.target.value)}
className="w-full pl-8 pr-3 py-1.5 text-sm border-2 border-muted bg-paper text-pencil placeholder:text-muted-dark outline-none focus:border-pencil-light"
style={{
borderRadius: wobbly.sm,
fontFamily: "'Courier New', monospace",
}}
/>
</div>
)}
{/* Select All */}
<div className="border-b-2 border-dashed border-muted pb-2 mb-2">
<div className="flex items-center justify-between border-b-2 border-dashed border-muted pb-2 mb-2">
<HandCheckbox
label={allSelected ? 'Deselect All' : 'Select All'}
checked={allSelected}
label={allFilteredSelected ? 'Deselect All' : 'Select All'}
checked={allFilteredSelected}
onChange={toggleAll}
/>
{filter && (
<span className="text-xs text-muted-dark">
{filtered.length} of {skills.length} skills
</span>
)}
</div>
{/* Skill list */}
<div className="max-h-64 overflow-y-auto space-y-1 mb-4">
{skills.map((skill) => (
{filtered.map((skill) => (
<div key={skill.path} className="flex items-start gap-2 py-1">
<HandCheckbox
label=""
+16 -4
View File
@@ -52,15 +52,21 @@ export default function SearchPage() {
} else if (disc.skills.length === 1) {
// Single discovered skill — install via batch (uses InstallFromDiscovery)
const res = await api.installBatch({ source, skills: disc.skills });
toast(res.summary, 'success');
let hasAuditBlock = false;
for (const item of res.results) {
if (item.error) {
toast(`${item.name}: ${item.error}`, 'error');
if (item.error.includes('security audit failed')) {
hasAuditBlock = true;
toast(`${item.name}: blocked by security audit`, 'error');
} else {
toast(`${item.name}: ${item.error}`, 'error');
}
}
if (item.warnings?.length) {
item.warnings.forEach((w) => toast(`${item.name}: ${w}`, 'warning'));
}
}
toast(res.summary, hasAuditBlock ? 'warning' : 'success');
} else {
// No skills discovered (discovery failed or non-git) — direct install
const res = await api.install({ source });
@@ -86,15 +92,21 @@ export default function SearchPage() {
source: pendingSource,
skills: selected,
});
toast(res.summary, 'success');
let hasAuditBlock = false;
for (const item of res.results) {
if (item.error) {
toast(`${item.name}: ${item.error}`, 'error');
if (item.error.includes('security audit failed')) {
hasAuditBlock = true;
toast(`${item.name}: blocked by security audit — use Force to override`, 'error');
} else {
toast(`${item.name}: ${item.error}`, 'error');
}
}
if (item.warnings?.length) {
item.warnings.forEach((w) => toast(`${item.name}: ${w}`, 'warning'));
}
}
toast(res.summary, hasAuditBlock ? 'warning' : 'success');
setShowPicker(false);
} catch (e: unknown) {
toast((e as Error).message, 'error');
@@ -67,9 +67,9 @@ Command cheat sheet for skillshare.
| `make sandbox-shell` | Enter playground shell |
| `make sandbox-down` | Stop playground container |
| `mise run ui:build` | Build frontend + copy to embed |
| `mise run build:ui` | Full binary with embedded frontend |
| `mise run build:all` | Full binary with embedded frontend |
| `make ui-build` | Build frontend + copy to embed |
| `make build-ui` | Full binary with embedded frontend |
| `make build-all` | Full binary with embedded frontend |
---