feat(skills): add --allow-hidden-dirs flag to preview command#13265
Conversation
Add support for the --allow-hidden-dirs flag in `gh skill preview`, matching the existing pattern in `gh skill install`. This allows users to preview skills located in hidden directories (e.g. .claude/skills/, .agents/skills/). Changes: - Add AllowHiddenDirs field to PreviewOptions - Register --allow-hidden-dirs flag on the preview command - Switch from DiscoverSkills to DiscoverSkillsWithOptions to get all skills including hidden-dir ones - Add filterHiddenDirSkills to exclude hidden-dir skills by default, showing a hint when they are found but excluded - Print a warning when --allow-hidden-dirs is used and hidden skills are present - Return an error when only hidden-dir skills exist without the flag Co-authored-by: Copilot <[email protected]>
|
Thanks for your pull request! Unfortunately, it doesn't meet the minimum requirements for review:
Please update your PR to address the above. Requirements:
This PR will be automatically closed in 7 days if these requirements are not met. |
There was a problem hiding this comment.
Pull request overview
Adds support for previewing skills that live under hidden (dot-prefixed) directories by introducing a shared hidden-skill partitioning helper and wiring a new --allow-hidden-dirs flag into gh skill preview.
Changes:
- Introduced
PartitionHiddenDirSkills(and result type) in the shared discovery layer to centralize hidden-dir partitioning. - Added
--allow-hidden-dirstogh skill previewand applied consistent filtering/warning/error behavior based on the flag. - Refactored
gh skill installto use the shared partition helper; expanded preview tests for flag parsing and hidden-dir behavior.
Show a summary per file
| File | Description |
|---|---|
internal/skills/discovery/discovery.go |
Adds shared helper to split discovered skills into standard vs hidden-dir buckets. |
pkg/cmd/skills/preview/preview.go |
Adds --allow-hidden-dirs flag and applies filtering/warnings when hidden-dir skills are discovered. |
pkg/cmd/skills/install/install.go |
Reuses shared partition logic to reduce duplicated hidden-dir filtering code. |
pkg/cmd/skills/preview/preview_test.go |
Adds unit + integration coverage for preview hidden-dir filtering and flag parsing. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 4/4 changed files
- Comments generated: 3
| %[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 |
There was a problem hiding this comment.
The warning text reads a bit ungrammatically: "may be installed copies from another publisher". Consider rephrasing to something like "may be copies installed from another publisher" or "may be installed as copies from another publisher" to make the message clearer.
| %[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 |
| // HiddenDirFilterResult holds the outcome of partitioning skills into standard | ||
| // and hidden-dir buckets. | ||
| type HiddenDirFilterResult struct { | ||
| Standard []Skill | ||
| HiddenCount int | ||
| } | ||
|
|
||
| // PartitionHiddenDirSkills splits skills into standard and hidden-dir groups. | ||
| func PartitionHiddenDirSkills(skills []Skill) HiddenDirFilterResult { | ||
| var r HiddenDirFilterResult |
There was a problem hiding this comment.
HiddenDirFilterResult is returned by PartitionHiddenDirSkills, but the name suggests a filtering operation rather than a partition. Renaming the type to something like HiddenDirPartitionResult (or similar) would better match the function name and reduce confusion for callers.
| // HiddenDirFilterResult holds the outcome of partitioning skills into standard | |
| // and hidden-dir buckets. | |
| type HiddenDirFilterResult struct { | |
| Standard []Skill | |
| HiddenCount int | |
| } | |
| // PartitionHiddenDirSkills splits skills into standard and hidden-dir groups. | |
| func PartitionHiddenDirSkills(skills []Skill) HiddenDirFilterResult { | |
| var r HiddenDirFilterResult | |
| // HiddenDirPartitionResult holds the outcome of partitioning skills into standard | |
| // and hidden-dir buckets. | |
| type HiddenDirPartitionResult struct { | |
| Standard []Skill | |
| HiddenCount int | |
| } | |
| // PartitionHiddenDirSkills splits skills into standard and hidden-dir groups. | |
| func PartitionHiddenDirSkills(skills []Skill) HiddenDirPartitionResult { | |
| var r HiddenDirPartitionResult |
| } | ||
|
|
||
| func TestFilterHiddenDirSkills(t *testing.T) { | ||
| standardSkill := discovery.Skill{Name: "my-skill", Convention: "standard"} |
There was a problem hiding this comment.
In this test, standardSkill uses Convention: "standard", but discovery currently produces conventions like "skills" / "skills-namespaced" / "root" / "plugins". Using a real convention string (e.g. "skills") would make the test data more representative and easier to understand.
| standardSkill := discovery.Skill{Name: "my-skill", Convention: "standard"} | |
| standardSkill := discovery.Skill{Name: "my-skill", Convention: "skills"} |
|
@copilot is this flag added to the suggested preview command after install? If not you should add it. |
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 <[email protected]>
This MR contains the following updates: | Package | Update | Change | |---|---|---| | [cli/cli](https://github.com/cli/cli) | minor | `v2.90.0` → `v2.92.0` | MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot). **Proposed changes to behavior should be submitted there as MRs.** --- ### Release Notes <details> <summary>cli/cli (cli/cli)</summary> ### [`v2.92.0`](https://github.com/cli/cli/releases/tag/v2.92.0): GitHub CLI 2.92.0 [Compare Source](cli/cli@v2.91.0...v2.92.0) #### Support GitHub Enterprise Cloud (GHEC) in `skill` commandset Now `gh skill` subcommands (`install`, `preview`, `publish`, `search`, `update`) are able to work with [GHEC](https://docs.github.com/en/enterprise-cloud@latest/admin/overview/about-github-enterprise-cloud) hosts with data residency. #### Add `--allow-hidden-dirs` flag to `skill preview` Following the addition of `--allow-hidden-dirs` to `skill install` in the previous release, now the flag is also supported in `skill preview`, allowing users to preview skills located in hidden (dot-prefixed) directories such as `.claude/skills/`, `.agents/skills/`, and `.github/skills/`. #### What's Changed ##### ✨ Features - feat(skills): add --allow-hidden-dirs flag to preview command by [@​SamMorrowDrums](https://github.com/SamMorrowDrums) in [#​13265](cli/cli#13265) - feat(skills): support GHEC with data residency hosts by [@​SamMorrowDrums](https://github.com/SamMorrowDrums) in [#​13264](cli/cli#13264) ##### 🐛 Fixes - Fix SetSampleRate not updating sample\_rate dimension by [@​williammartin](https://github.com/williammartin) in [#​13259](cli/cli#13259) - Fix log terminal injection by [@​williammartin](https://github.com/williammartin) in [#​13272](cli/cli#13272) - Add "Resource not accessible" to ProjectsV2IgnorableError by [@​maxbeizer](https://github.com/maxbeizer) in [#​13281](cli/cli#13281) ##### 📚 Docs & Chores - fix: using variable interpolation \`${{ in deployment.yml... by [@​orbisai0security](https://github.com/orbisai0security) in [#​13258](cli/cli#13258) - docs: correct typo in Linux Homebrew copy by [@​cassidyjames](https://github.com/cassidyjames) in [#​13273](cli/cli#13273) - Install skills flat by Name, not namespaced InstallName by [@​SamMorrowDrums](https://github.com/SamMorrowDrums) in [#​13266](cli/cli#13266) - chore: fix zsh completion on debian by [@​babakks](https://github.com/babakks) in [#​13274](cli/cli#13274) - Add trust disclaimer to extension help text by [@​travellertales](https://github.com/travellertales) in [#​13296](cli/cli#13296) - Bump Go to 1.26.2 by [@​github-actions](https://github.com/github-actions)\[bot] in [#​13301](cli/cli#13301) #####Dependencies - chore(deps): bump github.com/mattn/go-isatty from 0.0.20 to 0.0.21 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​13161](cli/cli#13161) - chore(deps): bump github.com/google/go-containerregistry from 0.21.4 to 0.21.5 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​13162](cli/cli#13162) - chore(deps): bump charm.land/lipgloss/v2 from 2.0.2 to 2.0.3 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​13163](cli/cli#13163) - chore(deps): bump charm.land/bubbletea/v2 from 2.0.2 to 2.0.6 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​13206](cli/cli#13206) - chore(deps): bump github.com/gdamore/tcell/v2 from 2.13.8 to 2.13.9 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​13241](cli/cli#13241) - chore(deps): bump github.com/mattn/go-isatty from 0.0.21 to 0.0.22 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​13298](cli/cli#13298) #### New Contributors - [@​orbisai0security](https://github.com/orbisai0security) made their first contribution in [#​13258](cli/cli#13258) - [@​cassidyjames](https://github.com/cassidyjames) made their first contribution in [#​13273](cli/cli#13273) - [@​travellertales](https://github.com/travellertales) made their first contribution in [#​13296](cli/cli#13296) **Full Changelog**: <cli/cli@v2.91.0...v2.92.0> ### [`v2.91.0`](https://github.com/cli/cli/releases/tag/v2.91.0): GitHub CLI 2.91.0 [Compare Source](cli/cli@v2.90.0...v2.91.0) #### GitHub CLI now collects pseudonymous telemetry To better understand how features are used in practice, especially as agentic adoption grows, GitHub CLI now sends pseudonymous telemetry. See [Telemetry](https://cli.github.com/telemetry) for more details on what's collected, why, and how to opt out. #### Support more agents in `gh skill` Thanks to community feedback, `gh` now supports a large number of agent hosts. Run `gh skill install --help` for the list of available agents. #### Improve skill discovery `gh skill install` now adds the `--allow-hidden-dirs` flag to support discovering skills in hidden (dot-prefixed) directories such as `.claude/skills/`, `.agents/skills/`, and `.github/skills/`. #### Detect skills re-published from other sources GitHut CLI now detects if the skill to be installed is re-published from an upstream source and offers the option to install it from there. The `--upstream` flag is also added for non-interactive use cases. #### What's Changed ##### ✨ Features - Add support for installation in multiple agent hosts in `gh skills install` by [@​tommaso-moro](https://github.com/tommaso-moro) in [#​13209](cli/cli#13209) - Add --allow-hidden-dirs flag to gh skill install by [@​SamMorrowDrums](https://github.com/SamMorrowDrums) in [#​13213](cli/cli#13213) - Make skill discovery less strict: support nested `skills/` directories by [@​SamMorrowDrums](https://github.com/SamMorrowDrums) in [#​13235](cli/cli#13235) - feat(skills): detect re-published skills and offer upstream install by [@​SamMorrowDrums](https://github.com/SamMorrowDrums) in [#​13236](cli/cli#13236) ##### 🐛 Fixes - Fix `skills publish --fix` to not publish by [@​SamMorrowDrums](https://github.com/SamMorrowDrums) in [#​13237](cli/cli#13237) - fix(skills): match skills by install name in preview command by [@​SamMorrowDrums](https://github.com/SamMorrowDrums) in [#​13249](cli/cli#13249) ##### 📚 Docs & Chores - Remove misleading text by [@​tommaso-moro](https://github.com/tommaso-moro) in [#​13203](cli/cli#13203) - Add sampled command telemetry by [@​williammartin](https://github.com/williammartin) in [#​13191](cli/cli#13191) - Do not send telemetry for aliases by [@​williammartin](https://github.com/williammartin) in [#​13192](cli/cli#13192) - Add skills specific telemetry by [@​williammartin](https://github.com/williammartin) in [#​13204](cli/cli#13204) - Record CI context in telemetry by [@​williammartin](https://github.com/williammartin) in [#​13210](cli/cli#13210) - Record official extension telemetry by [@​williammartin](https://github.com/williammartin) in [#​13205](cli/cli#13205) - Add telemetry command by [@​williammartin](https://github.com/williammartin) in [#​13253](cli/cli#13253) - Log when there is no telemetry by [@​williammartin](https://github.com/williammartin) in [#​13255](cli/cli#13255) - docs(skills): add gh and gh-skill agent skills by [@​BagToad](https://github.com/BagToad) in [#​13244](cli/cli#13244) - Enable telemetry without env var by [@​williammartin](https://github.com/williammartin) in [#​13254](cli/cli#13254) **Full Changelog**: <cli/cli@v2.90.0...v2.91.0> </details> --- ### Configuration 📅 **Schedule**: (UTC) - Branch creation - At any time (no schedule defined) - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this MR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box --- This MR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xNjkuNCIsInVwZGF0ZWRJblZlciI6IjQzLjE2OS40IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiLCJhdXRvbWF0aW9uOmJvdC1hdXRob3JlZCIsImRlcGVuZGVuY3ktdHlwZTo6bWlub3IiXX0=-->
Summary
The
gh skill previewcommand was missing the--allow-hidden-dirsflag thatgh skill installalready supports. This PR adds it, allowing users to preview skills located in hidden directories (e.g..claude/skills/,.agents/skills/).Changes
Shared discovery layer (
internal/skills/discovery/discovery.go)PartitionHiddenDirSkills()andHiddenDirFilterResultto extract the shared partition logic that bothinstallandpreviewneed.Preview command (
pkg/cmd/skills/preview/preview.go)AllowHiddenDirsfield toPreviewOptions--allow-hidden-dirsboolean flag on the cobra commandDiscoverSkills(which pre-filters hidden-dir skills) toDiscoverSkillsWithOptionsto retrieve all skillsfilterHiddenDirSkillsusing the sharedPartitionHiddenDirSkills:--allow-hidden-dirs--allow-hidden-dirsInstall command (
pkg/cmd/skills/install/install.go)filterHiddenDirSkillsto use the sharedPartitionHiddenDirSkills, reducing duplicationTests (
pkg/cmd/skills/preview/preview_test.go)TestNewCmdPreview: added flag parsing test case andwantAllowHiddenDirsassertionTestFilterHiddenDirSkills: 6 unit test cases covering all filter branchesTestPreviewRun_HiddenDirSkillsExcluded: 3 integration tests covering end-to-end behavior with HTTP mocks