From 2e64043d55bb6b4ad6c543f95a1f781675155929 Mon Sep 17 00:00:00 2001 From: Sam Morrow Date: Mon, 20 Apr 2026 12:22:55 +0200 Subject: [PATCH 1/3] fix(skills): stop publish --fix from publishing When --fix is used, return early after applying fixes instead of continuing to the publish flow. The fixed files need to be committed before publishing, so proceeding would fail anyway since the repo would not be in sync. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- pkg/cmd/skills/publish/publish.go | 16 +++++++++++++--- pkg/cmd/skills/publish/publish_test.go | 1 + 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/pkg/cmd/skills/publish/publish.go b/pkg/cmd/skills/publish/publish.go index 6364846840f..73343f1716a 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 f83117b5b5e..2eac240bc65 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")) From c703294fbe8022e256b0b3999901efc4d785621a Mon Sep 17 00:00:00 2001 From: Sam Morrow Date: Mon, 20 Apr 2026 12:34:59 +0200 Subject: [PATCH 2/3] fix(skills): use canonical 'gh skill' not 'gh skills' alias Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- pkg/cmd/skills/publish/publish.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/cmd/skills/publish/publish.go b/pkg/cmd/skills/publish/publish.go index 73343f1716a..d7aeddd6503 100644 --- a/pkg/cmd/skills/publish/publish.go +++ b/pkg/cmd/skills/publish/publish.go @@ -140,7 +140,7 @@ func NewCmdPublish(f *cmdutil.Factory, runF func(*PublishOptions) error) *cobra. $ gh skill publish --dry-run # Strip install metadata without publishing - $ gh skills publish --fix + $ gh skill publish --fix `), Args: cobra.MaximumNArgs(1), RunE: func(cmd *cobra.Command, args []string) error { @@ -413,7 +413,7 @@ func publishRun(opts *PublishOptions) error { 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") + fmt.Fprintf(opts.IO.ErrOut, "\nFixed %d file(s). Review and commit the changes, then run %s to publish.\n", fixes, "gh skill publish") } else { fmt.Fprintf(opts.IO.ErrOut, "\nNo issues to fix.\n") } From f88a2a671c72341aaed3646c803d06f89201efa9 Mon Sep 17 00:00:00 2001 From: Sam Morrow Date: Mon, 20 Apr 2026 12:36:57 +0200 Subject: [PATCH 3/3] fix(skills): make --fix and --dry-run mutually exclusive, suppress publish prompt - --fix and --dry-run now error when combined - "Ready to publish!" is suppressed when --fix is set since user must commit first Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- pkg/cmd/skills/publish/publish.go | 5 ++++- pkg/cmd/skills/publish/publish_test.go | 14 ++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/pkg/cmd/skills/publish/publish.go b/pkg/cmd/skills/publish/publish.go index d7aeddd6503..3a27fc5a2cd 100644 --- a/pkg/cmd/skills/publish/publish.go +++ b/pkg/cmd/skills/publish/publish.go @@ -147,6 +147,9 @@ func NewCmdPublish(f *cmdutil.Factory, runF func(*PublishOptions) error) *cobra. if len(args) == 1 { opts.Dir = args[0] } + if err := cmdutil.MutuallyExclusive("specify only one of `--fix` or `--dry-run`", opts.Fix, opts.DryRun); err != nil { + return err + } if runF != nil { return runF(opts) } @@ -1069,7 +1072,7 @@ func renderDiagnosticsTTY(opts *PublishOptions, skillCount int, diagnostics []pu fmt.Fprintf(opts.IO.ErrOut, "\n%s\n", d.message) } - if errors == 0 { + if errors == 0 && !opts.Fix { if owner != "" && repo != "" { fmt.Fprintf(opts.IO.ErrOut, "\n%s Repository: %s/%s\n", cs.Green("Ready to publish!"), owner, repo) } else { diff --git a/pkg/cmd/skills/publish/publish_test.go b/pkg/cmd/skills/publish/publish_test.go index 2eac240bc65..a4f48dfe6e0 100644 --- a/pkg/cmd/skills/publish/publish_test.go +++ b/pkg/cmd/skills/publish/publish_test.go @@ -86,13 +86,15 @@ func TestNewCmdPublish(t *testing.T) { wantsOpts PublishOptions }{ { - name: "all flags", - cli: "./monalisa-skills --dry-run --fix --tag v1.0.0", + name: "fix and dry-run are mutually exclusive", + cli: "./monalisa-skills --dry-run --fix --tag v1.0.0", + wantsErr: true, + }, + { + name: "fix flag only", + cli: "--fix", wantsOpts: PublishOptions{ - Dir: "./monalisa-skills", - DryRun: true, - Fix: true, - Tag: "v1.0.0", + Fix: true, }, }, {