Skip to content

Publish: use shared discovery logic instead of requiring skills/ directory#13167

Merged
SamMorrowDrums merged 1 commit intosm/add-skills-commandfrom
sammorrowdrums/publish-use-shared-discovery
Apr 16, 2026
Merged

Publish: use shared discovery logic instead of requiring skills/ directory#13167
SamMorrowDrums merged 1 commit intosm/add-skills-commandfrom
sammorrowdrums/publish-use-shared-discovery

Conversation

@SamMorrowDrums
Copy link
Copy Markdown
Contributor

Summary

Replaces the hardcoded skills/ directory requirement in the publish command with the shared DiscoverLocalSkills() function already used by install and other commands.

Motivation

The publish command previously required all skills to live under a skills/ directory, but the rest of the CLI (install, search, etc.) already supports multiple discovery conventions. There's no reason for publish to be more restrictive — it's a pointless opinionated restriction that we've moved on from.

Changes

  • publish.go: Replaced manual skills/ directory enumeration with discovery.DiscoverLocalSkills(dir). All per-skill validation (frontmatter fields, spec-compliant naming, metadata stripping, license checks, body length) is preserved.
  • publish.go: Updated checkSecuritySettings and detectCodeAndManifests to accept multiple skill directories instead of a single skills/ path.
  • publish_test.go: Updated existing tests for the new behavior and added tests for root-level and namespaced skill discovery.

Supported conventions (now all discoverable by publish)

  • skills/*/SKILL.md
  • skills/{scope}/*/SKILL.md
  • */SKILL.md (root-level)
  • plugins/{scope}/skills/*/SKILL.md

Stacked on

#13165

Copilot AI review requested due to automatic review settings April 15, 2026 20:37
@SamMorrowDrums SamMorrowDrums requested a review from a team as a code owner April 15, 2026 20:37
@SamMorrowDrums SamMorrowDrums requested a review from BagToad April 15, 2026 20:37
@SamMorrowDrums SamMorrowDrums changed the base branch from trunk to sm/add-skills-command April 15, 2026 20:37
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates gh skill publish to use the shared local skill discovery logic (matching install), removing the hard requirement that skills live under a top-level skills/ directory.

Changes:

  • Switch publish to discover skills via discovery.DiscoverLocalSkills() rather than enumerating skills/.
  • Update security/code-scanning heuristics to operate over multiple discovered skill directories.
  • Update and extend publish tests to cover root-level and namespaced skill discovery.
Show a summary per file
File Description
pkg/cmd/skills/publish/publish.go Replaces hardcoded skills/ enumeration with shared discovery, updates downstream logic to handle multiple discovered directories.
pkg/cmd/skills/publish/publish_test.go Adjusts expectations for “no skills” cases and adds coverage for root-level and namespaced discovery.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 2/2 changed files
  • Comments generated: 2

Comment thread pkg/cmd/skills/publish/publish.go Outdated
Comment thread pkg/cmd/skills/publish/publish.go
@SamMorrowDrums SamMorrowDrums force-pushed the sammorrowdrums/publish-use-shared-discovery branch from 1d21aa6 to a40d072 Compare April 15, 2026 21:35
Copy link
Copy Markdown
Member

@babakks babakks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, with a few suggestions and a question.

Comment on lines +106 to +112
Skills are discovered using the same conventions as install:

- skills/*/SKILL.md
- skills/{scope}/*/SKILL.md
- */SKILL.md (root-level)
- plugins/{scope}/skills/*/SKILL.md

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a general comment, these docs will be regarded as markdown and rendered on the website (example). So, it's best to have that in mind when writing --help docs. So, please apply this comment to other skill commands.

In this particular case, let's surround verbatim text with backticks:

Suggested change
Skills are discovered using the same conventions as install:
- skills/*/SKILL.md
- skills/{scope}/*/SKILL.md
- */SKILL.md (root-level)
- plugins/{scope}/skills/*/SKILL.md
Skills are discovered using the same conventions as install:
- `skills/*/SKILL.md`
- `skills/{scope}/*/SKILL.md`
- `*/SKILL.md` (root-level)
- `plugins/{scope}/skills/*/SKILL.md`

Comment thread pkg/cmd/skills/publish/publish.go Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here too:

Suggested change
- Install metadata (`metadata.github-*`) is stripped if present

Comment thread pkg/cmd/skills/publish/publish.go Outdated
Comment on lines 120 to 129
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And also here:

Suggested change
Use `--dry-run` to validate without publishing.
Use `--tag` to publish non-interactively with a specific tag.
Use `--fix` to automatically strip install metadata from committed files.

Comment thread pkg/cmd/skills/publish/publish.go Outdated
Comment on lines +187 to +188
// Discover skills using shared discovery logic (same conventions as install)
skills, err := discovery.DiscoverLocalSkills(dir)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment is redundant.

Comment on lines +797 to +799
if hasCode && hasManifests {
return filepath.SkipAll
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has probably been discussed/clarified but just to double check.

question: returning SkipAll causes filepath.Walk to stop walking the tree and return immediately. Is that what we want? I mean, don't we want to go through all other directories under dir?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good Q. Let me dig in.

Replace the hardcoded skills/ directory requirement in the publish
command with the shared DiscoverLocalSkills() function used by install
and other commands. This removes the opinionated restriction that skills
must live under a skills/ directory and supports all discovery
conventions:

- skills/*/SKILL.md
- skills/{scope}/*/SKILL.md
- */SKILL.md (root-level)
- plugins/{scope}/skills/*/SKILL.md

All per-skill validation (frontmatter, spec-compliant naming, metadata
stripping, etc.) is preserved.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@SamMorrowDrums SamMorrowDrums force-pushed the sammorrowdrums/publish-use-shared-discovery branch from a40d072 to b63f5bf Compare April 16, 2026 13:38
@SamMorrowDrums SamMorrowDrums merged commit cf1afc9 into sm/add-skills-command Apr 16, 2026
8 checks passed
@SamMorrowDrums SamMorrowDrums deleted the sammorrowdrums/publish-use-shared-discovery branch April 16, 2026 13:48
@t72053166-eng t72053166-eng mentioned this pull request Apr 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants