diff --git a/pkg/cmd/skills/publish/publish.go b/pkg/cmd/skills/publish/publish.go index 636484684..73343f171 100644 --- a/pkg/cmd/skills/publish/publish.go +++ b/pkg/cmd/skills/publish/publish.go @@ -126,7 +126,8 @@ func NewCmdPublish(f *cmdutil.Factory, runF func(*PublishOptions) error) *cobra. Use %[1]s--dry-run%[1]s to validate without publishing. Use %[1]s--tag%[1]s to publish non-interactively with a specific tag. - Use %[1]s--fix%[1]s to automatically strip install metadata from committed files. + Use %[1]s--fix%[1]s to automatically strip install metadata from committed files + without publishing. Review and commit the changes, then run publish again. `, "`"), Example: heredoc.Doc(` # Validate and publish interactively @@ -138,7 +139,7 @@ func NewCmdPublish(f *cmdutil.Factory, runF func(*PublishOptions) error) *cobra. # Validate only (no publish) $ gh skill publish --dry-run - # Validate and strip install metadata + # Strip install metadata without publishing $ gh skills publish --fix `), Args: cobra.MaximumNArgs(1), @@ -153,7 +154,7 @@ func NewCmdPublish(f *cmdutil.Factory, runF func(*PublishOptions) error) *cobra. }, } - cmd.Flags().BoolVar(&opts.Fix, "fix", false, "Auto-fix issues where possible (e.g. strip install metadata)") + cmd.Flags().BoolVar(&opts.Fix, "fix", false, "Auto-fix issues where possible without publishing (e.g. strip install metadata)") cmd.Flags().BoolVar(&opts.DryRun, "dry-run", false, "Validate without publishing") cmd.Flags().StringVar(&opts.Tag, "tag", "", "Version tag for the release (e.g. v1.0.0)") @@ -410,6 +411,15 @@ func publishRun(opts *PublishOptions) error { return nil } + if opts.Fix { + if fixes > 0 { + fmt.Fprintf(opts.IO.ErrOut, "\nFixed %d file(s). Review and commit the changes, then run %s to publish.\n", fixes, "gh skills publish") + } else { + fmt.Fprintf(opts.IO.ErrOut, "\nNo issues to fix.\n") + } + return nil + } + if owner == "" || repo == "" { fmt.Fprintf(opts.IO.ErrOut, "\nValidation passed. Set up a GitHub remote to publish.\n") return nil diff --git a/pkg/cmd/skills/publish/publish_test.go b/pkg/cmd/skills/publish/publish_test.go index f83117b5b..2eac240bc 100644 --- a/pkg/cmd/skills/publish/publish_test.go +++ b/pkg/cmd/skills/publish/publish_test.go @@ -457,6 +457,7 @@ func TestPublishRun(t *testing.T) { return &PublishOptions{IO: ios, Dir: dir, Fix: true} }, wantStdout: "stripped install metadata", + wantStderr: "Fixed 1 file(s). Review and commit the changes", verify: func(t *testing.T, dir string) { t.Helper() fixed, err := os.ReadFile(filepath.Join(dir, "skills", "test-skill", "SKILL.md"))