MCPcopy Create free account
hub / github.com/cli/cli / filterHiddenDirSkills

Function filterHiddenDirSkills

pkg/cmd/skills/install/install.go:1260–1284  ·  view source on GitHub ↗

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 an error if no standard skills remain.

(opts *InstallOptions, allSkills []discovery.Skill)

Source from the content-addressed store, hash-verified

1258// flag is set, all skills are returned with a warning. Otherwise, hidden-dir
1259// skills are excluded with an error if no standard skills remain.
1260func filterHiddenDirSkills(opts *InstallOptions, allSkills []discovery.Skill) ([]discovery.Skill, error) {
1261 cs := opts.IO.ColorScheme()
1262
1263 if opts.AllowHiddenDirs {
1264 if discovery.HasHiddenDirSkills(allSkills) {
1265 fmt.Fprint(opts.IO.ErrOut, heredoc.Docf(`
1266 %[1]s Skills in hidden directories (e.g. .claude/, .agents/) may be installed
1267 copies from another publisher. Verify the skill's origin and check for a
1268 canonical source.
1269 `, cs.WarningIcon()))
1270 }
1271 return allSkills, nil
1272 }
1273
1274 r := discovery.PartitionHiddenDirSkills(allSkills)
1275 if len(r.Standard) == 0 && r.HiddenCount > 0 {
1276 return nil, fmt.Errorf(
1277 "no standard skills found, but %d skill(s) exist in hidden directories\n"+
1278 " Use --allow-hidden-dirs to include them",
1279 r.HiddenCount,
1280 )
1281 }
1282
1283 return r.Standard, nil
1284}
1285
1286// checkUpstreamProvenance fetches the skill's SKILL.md via the contents API
1287// to check if it contains github-repo metadata pointing to a different

Callers 2

runLocalInstallFunction · 0.70
discoverSkillsFunction · 0.70

Calls 5

HasHiddenDirSkillsFunction · 0.92
PartitionHiddenDirSkillsFunction · 0.92
ColorSchemeMethod · 0.80
WarningIconMethod · 0.80
ErrorfMethod · 0.65

Tested by

no test coverage detected