-
Notifications
You must be signed in to change notification settings - Fork 8.5k
feat(skills): add --allow-hidden-dirs flag to preview command #13265
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
SamMorrowDrums
merged 2 commits into
cli:trunk
from
SamMorrowDrums:sammorrowdrums/preview-allow-hidden-dirs-flag
Apr 24, 2026
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -32,9 +32,10 @@ type PreviewOptions struct { | |||||||||
| ExecutablePath string | ||||||||||
| RenderFile func(string, string) string | ||||||||||
|
|
||||||||||
| RepoArg string | ||||||||||
| SkillName string | ||||||||||
| Version string // resolved from @suffix on SkillName | ||||||||||
| RepoArg string | ||||||||||
| SkillName string | ||||||||||
| Version string // resolved from @suffix on SkillName | ||||||||||
| AllowHiddenDirs bool // include skills in dot-prefixed directories | ||||||||||
|
|
||||||||||
| repo ghrepo.Interface | ||||||||||
| } | ||||||||||
|
|
@@ -110,6 +111,8 @@ func NewCmdPreview(f *cmdutil.Factory, telemetry ghtelemetry.CommandRecorder, ru | |||||||||
| }, | ||||||||||
| } | ||||||||||
|
|
||||||||||
| cmd.Flags().BoolVar(&opts.AllowHiddenDirs, "allow-hidden-dirs", false, "Include skills in hidden directories (e.g. .claude/skills/, .agents/skills/)") | ||||||||||
|
|
||||||||||
| return cmd | ||||||||||
| } | ||||||||||
|
|
||||||||||
|
|
@@ -151,12 +154,17 @@ func previewRun(opts *PreviewOptions) error { | |||||||||
| } | ||||||||||
|
|
||||||||||
| opts.IO.StartProgressIndicatorWithLabel("Discovering skills") | ||||||||||
| skills, err := discovery.DiscoverSkills(apiClient, hostname, owner, repoName, resolved.SHA) | ||||||||||
| allSkills, err := discovery.DiscoverSkillsWithOptions(apiClient, hostname, owner, repoName, resolved.SHA, discovery.DiscoverOptions{}) | ||||||||||
| opts.IO.StopProgressIndicator() | ||||||||||
| if err != nil { | ||||||||||
| return err | ||||||||||
| } | ||||||||||
|
|
||||||||||
| skills, err := filterHiddenDirSkills(opts, allSkills) | ||||||||||
| if err != nil { | ||||||||||
| return err | ||||||||||
| } | ||||||||||
|
|
||||||||||
| sort.Slice(skills, func(i, j int) bool { | ||||||||||
| return skills[i].DisplayName() < skills[j].DisplayName() | ||||||||||
| }) | ||||||||||
|
|
@@ -388,6 +396,39 @@ func isMarkdownFile(filePath string) bool { | |||||||||
| } | ||||||||||
| } | ||||||||||
|
|
||||||||||
| // filterHiddenDirSkills applies the --allow-hidden-dirs flag logic. When the | ||||||||||
| // flag is set, all skills are returned with a warning. Otherwise, hidden-dir | ||||||||||
| // skills are excluded with a hint or error. | ||||||||||
| func filterHiddenDirSkills(opts *PreviewOptions, allSkills []discovery.Skill) ([]discovery.Skill, error) { | ||||||||||
| cs := opts.IO.ColorScheme() | ||||||||||
|
|
||||||||||
| if opts.AllowHiddenDirs { | ||||||||||
| if discovery.HasHiddenDirSkills(allSkills) { | ||||||||||
| fmt.Fprint(opts.IO.ErrOut, heredoc.Docf(` | ||||||||||
| %[1]s Skills in hidden directories (e.g. .claude/, .agents/) may be installed | ||||||||||
| copies from another publisher. Verify the skill's origin and check for a | ||||||||||
|
Comment on lines
+408
to
+409
|
||||||||||
| %[1]s Skills in hidden directories (e.g. .claude/, .agents/) may be installed | |
| copies from another publisher. Verify the skill's origin and check for a | |
| %[1]s Skills in hidden directories (e.g. .claude/, .agents/) may be copies | |
| installed from another publisher. Verify the skill's origin and check for a |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HiddenDirFilterResultis returned byPartitionHiddenDirSkills, but the name suggests a filtering operation rather than a partition. Renaming the type to something likeHiddenDirPartitionResult(or similar) would better match the function name and reduce confusion for callers.