From d961de44d72793e0915e0ba9a48ff5d2a610be56 Mon Sep 17 00:00:00 2001 From: sammorrowdrums Date: Thu, 23 Apr 2026 10:23:26 +0200 Subject: [PATCH] fix(skills): include --allow-hidden-dirs in preview hint from install The review hint printed after `gh skill install --allow-hidden-dirs` suggests `gh skill preview` commands. Those commands would fail for hidden-dir skills because preview would filter them out. Pass the flag through so the suggested commands work as-is. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- pkg/cmd/skills/install/install.go | 18 ++++++++++------ pkg/cmd/skills/install/install_test.go | 29 ++++++++++++++++++++------ 2 files changed, 35 insertions(+), 12 deletions(-) diff --git a/pkg/cmd/skills/install/install.go b/pkg/cmd/skills/install/install.go index cca960a88..32c1e4035 100644 --- a/pkg/cmd/skills/install/install.go +++ b/pkg/cmd/skills/install/install.go @@ -391,7 +391,7 @@ func installRun(opts *InstallOptions) error { } printFileTree(opts.IO.ErrOut, cs, result.Dir, result.Installed) - printReviewHint(opts.IO.ErrOut, cs, repoSource, resolved.SHA, result.Installed) + printReviewHint(opts.IO.ErrOut, cs, repoSource, resolved.SHA, result.Installed, opts.AllowHiddenDirs) printHostHints(opts.IO.ErrOut, cs, plan.hosts, result.Installed, result.Dir, gitRoot) } @@ -536,7 +536,7 @@ func runLocalInstall(opts *InstallOptions) error { } printFileTree(opts.IO.ErrOut, cs, result.Dir, result.Installed) - printReviewHint(opts.IO.ErrOut, cs, "", "", result.Installed) + printReviewHint(opts.IO.ErrOut, cs, "", "", result.Installed, false) printHostHints(opts.IO.ErrOut, cs, plan.hosts, result.Installed, result.Dir, gitRoot) } @@ -1118,8 +1118,10 @@ func printPreInstallDisclaimer(w io.Writer, cs *iostreams.ColorScheme) { // printReviewHint warns the user to review installed skills and suggests preview commands. // When sha is non-empty the suggested commands include @SHA so the user previews -// exactly the version that was installed. -func printReviewHint(w io.Writer, cs *iostreams.ColorScheme, repo, sha string, skillNames []string) { +// exactly the version that was installed. When allowHiddenDirs is true, the +// suggested commands include --allow-hidden-dirs so previewing hidden-dir +// skills works without an extra manual step. +func printReviewHint(w io.Writer, cs *iostreams.ColorScheme, repo, sha string, skillNames []string, allowHiddenDirs bool) { if len(skillNames) == 0 { return } @@ -1130,11 +1132,15 @@ func printReviewHint(w io.Writer, cs *iostreams.ColorScheme, repo, sha string, s } fmt.Fprintln(w, " Review installed content before use:") fmt.Fprintln(w) + hiddenFlag := "" + if allowHiddenDirs { + hiddenFlag = " --allow-hidden-dirs" + } for _, name := range skillNames { if sha != "" { - fmt.Fprintf(w, " gh skill preview %s %s@%s\n", repo, name, sha) + fmt.Fprintf(w, " gh skill preview %s %s@%s%s\n", repo, name, sha, hiddenFlag) } else { - fmt.Fprintf(w, " gh skill preview %s %s\n", repo, name) + fmt.Fprintf(w, " gh skill preview %s %s%s\n", repo, name, hiddenFlag) } } fmt.Fprintln(w) diff --git a/pkg/cmd/skills/install/install_test.go b/pkg/cmd/skills/install/install_test.go index b7aa956c5..db3192292 100644 --- a/pkg/cmd/skills/install/install_test.go +++ b/pkg/cmd/skills/install/install_test.go @@ -2141,11 +2141,12 @@ func Test_isSkillPath(t *testing.T) { func Test_printReviewHint(t *testing.T) { tests := []struct { - name string - repo string - sha string - skillNames []string - wantOutput string + name string + repo string + sha string + skillNames []string + allowHiddenDirs bool + wantOutput string }{ { name: "remote install with SHA includes SHA in preview command", @@ -2182,6 +2183,22 @@ func Test_printReviewHint(t *testing.T) { skillNames: []string{}, wantOutput: "", }, + { + name: "allow-hidden-dirs appends flag to preview command", + repo: "owner/repo", + sha: "abc123", + skillNames: []string{"hidden-skill"}, + allowHiddenDirs: true, + wantOutput: "gh skill preview owner/repo hidden-skill@abc123 --allow-hidden-dirs", + }, + { + name: "allow-hidden-dirs without SHA", + repo: "owner/repo", + sha: "", + skillNames: []string{"hidden-skill"}, + allowHiddenDirs: true, + wantOutput: "gh skill preview owner/repo hidden-skill --allow-hidden-dirs", + }, } for _, tt := range tests { @@ -2189,7 +2206,7 @@ func Test_printReviewHint(t *testing.T) { ios, _, _, _ := iostreams.Test() cs := ios.ColorScheme() var buf strings.Builder - printReviewHint(&buf, cs, tt.repo, tt.sha, tt.skillNames) + printReviewHint(&buf, cs, tt.repo, tt.sha, tt.skillNames, tt.allowHiddenDirs) if tt.wantOutput == "" { assert.Empty(t, buf.String()) } else {