Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions pkg/cmd/skills/update/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ func NewCmdUpdate(f *cmdutil.Factory, runF func(*UpdateOptions) error) *cobra.Co

Skills without GitHub metadata (e.g. installed manually or by another
tool) are prompted for their source repository in interactive mode.
With %[1]s--all%[1]s or in non-interactive mode, they are skipped with a notice.
The update re-downloads the skill with metadata injected, so future
updates work automatically.

Expand Down Expand Up @@ -221,7 +222,7 @@ func updateRun(opts *UpdateOptions) error {
if s.owner != "" && s.repo != "" {
continue
}
if !canPrompt {
if !canPrompt || opts.All {
noMeta = append(noMeta, s.name)
continue
}
Expand Down Expand Up @@ -337,7 +338,7 @@ func updateRun(opts *UpdateOptions) error {
fmt.Fprintf(opts.IO.ErrOut, "%s %s is pinned to %s (skipped)\n", cs.Muted("⊘"), s.name, s.pinned)
}
for _, name := range noMeta {
fmt.Fprintf(opts.IO.ErrOut, "%s %s has no GitHub metadata. Reinstall to enable updates\n", cs.WarningIcon(), name)
fmt.Fprintf(opts.IO.ErrOut, "%s %s has no GitHub metadata. Run `gh skill update %s` interactively to add metadata, or reinstall to enable updates\n", cs.WarningIcon(), name, name)
}

if len(updates) == 0 {
Expand Down
36 changes: 36 additions & 0 deletions pkg/cmd/skills/update/update_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,42 @@ func TestUpdateRun(t *testing.T) {
},
wantStderr: "no GitHub metadata",
},
{
name: "all skips no-metadata skill without prompting",
setup: func(t *testing.T, dir string) {
t.Helper()
skillDir := filepath.Join(dir, "manual-skill")
require.NoError(t, os.MkdirAll(skillDir, 0o755))
require.NoError(t, os.WriteFile(filepath.Join(skillDir, "SKILL.md"), []byte(heredoc.Doc(`
---
name: manual-skill
---
No metadata
`)), 0o644))
},
stubs: func(reg *httpmock.Registry) {},
opts: func(ios *iostreams.IOStreams, dir string, reg *httpmock.Registry) *UpdateOptions {
ios.SetStdoutTTY(true)
ios.SetStdinTTY(true)
ios.SetStderrTTY(true)
return &UpdateOptions{
IO: ios,
Config: func() (gh.Config, error) { return config.NewBlankConfig(), nil },
HttpClient: func() (*http.Client, error) {
return &http.Client{Transport: reg}, nil
},
Prompter: &prompter.PrompterMock{
InputFunc: func(prompt string, defaultValue string) (string, error) {
return "", fmt.Errorf("unexpected prompt")
},
},
GitClient: &git.Client{RepoDir: dir},
Dir: dir,
All: true,
}
},
wantStderr: "Run `gh skill update manual-skill` interactively",
},
{
name: "all up to date",
setup: func(t *testing.T, dir string) {
Expand Down
Loading