Repository navigation
Clarify skill publish error for nested skill directories - #14259
tommaso-moro wants to merge 2 commits into
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: d7cfd21b-8317-42d4-aba0-2b0ac2d7bb87
There was a problem hiding this comment.
Pull request overview
Requires gh skill publish to target a repository root, preventing partial skill validation before tagging and releasing.
Changes:
- Adds repository-root validation.
- Documents the restriction and adds regression coverage for nested directories.
Show a summary per file
| File | Description |
|---|---|
pkg/cmd/skills/publish/publish.go |
Adds root validation and help text. |
pkg/cmd/skills/publish/publish_test.go |
Tests nested-directory rejection and updates Git stubs. |
Review details
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Balanced
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: d7cfd21b-8317-42d4-aba0-2b0ac2d7bb87
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The early return masks existing validation diagnostics and changes non-interactive output behavior beyond the stated scope.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review tier: Balanced
Findings: 1
New issues introduced by this change (2)
| Severity | Finding |
|---|---|
pkg/cmd/skills/publish/publish_test.go — 🛑 Requirement: Cover the preserved diagnostic contract and the false branch. This test discards… |
|
pkg/cmd/skills/publish/publish.go — 🛑 Requirement: Keep this in the validation-diagnostic path instead of returning early. This… |
Issues resolved since last review (1)
| Severity | Finding |
|---|---|
pkg/cmd/skills/publish/publish.go — 💭 Commentary: This overstates the new restriction. git.Client.PathFromRoot returns an empty… View resolved comment |
| ios, _, _, _ := iostreams.Test() | ||
| err := publishRun(&PublishOptions{ | ||
| IO: ios, | ||
| Dir: skillDir, | ||
| GitClient: newTestGitClient(), |
| if len(skills) == 1 && skills[0].Path == "." && opts.GitClient != nil { | ||
| dirGitClient := opts.GitClient.Copy() | ||
| dirGitClient.RepoDir = dir | ||
| if dirGitClient.PathFromRoot(context.Background()) != "" { | ||
| return fmt.Errorf("%s is a skill directory within a repository; gh skill publish must target the repository root", dir) |
|
@tommaso-moro I moved this to a draft for now just to make it easier to see at a glance in our PR list what the state is. Hoping for a passing copilot review / all copilot comments addressed before it gets a human review 🙏 Copilot reviews now contain code base specific instructions and requirements 👍 |


Closes #14134
Description
When
gh skill publishis given a skill directory containingSKILL.mddirectly, shared discovery represents that skill's path as.. Publish then compares the skill name with.and reports the misleading errorname "reskill" does not match directory name ".".This change recognizes only that already-failing case when the selected skill directory is inside a Git repository and replaces the name-mismatch error with an explanation that
gh skill publishmust target the repository root. It does not add general repository-root enforcement or change successful publishing behavior.How did you test this change?
Given this checkout contains
skills/gh-skill, when I rango run ./cmd/gh skill publish skills/gh-skill --dry-run, then the command still exited unsuccessfully but explained that the selected path is a skill directory within a repository and that publishing must target the repository root.Key points
..Notes for reviewers
Start with the targeted check in
publishRun, followed byTestPublishRun_ExplainsSkillDirectoryWithinRepository. #14134 contains the original misleading diagnostic.Authorship and follow-up
Who wrote this:
Who answers review comments: