NewCmdUpdate creates the "skills update" command.
(f *cmdutil.Factory, runF func(*UpdateOptions) error)
| 67 | |
| 68 | // NewCmdUpdate creates the "skills update" command. |
| 69 | func NewCmdUpdate(f *cmdutil.Factory, runF func(*UpdateOptions) error) *cobra.Command { |
| 70 | opts := &UpdateOptions{ |
| 71 | IO: f.IOStreams, |
| 72 | Prompter: f.Prompter, |
| 73 | Config: f.Config, |
| 74 | GitClient: f.GitClient, |
| 75 | HttpClient: f.HttpClient, |
| 76 | } |
| 77 | |
| 78 | cmd := &cobra.Command{ |
| 79 | Use: "update [<skill>...] [flags]", |
| 80 | Short: "Update installed skills to their latest versions (preview)", |
| 81 | Long: heredoc.Docf(` |
| 82 | Checks installed skills for available updates by comparing the local |
| 83 | tree SHA (from %[1]sSKILL.md%[1]s frontmatter) against the remote repository. |
| 84 | |
| 85 | Scans all known agent host directories (including Copilot, Claude, Cursor, |
| 86 | Gemini, Antigravity, Grok, and others) in both project and user scope automatically. |
| 87 | |
| 88 | Without arguments, checks all installed skills. With skill names, |
| 89 | checks only those specific skills. |
| 90 | |
| 91 | Pinned skills (installed with %[1]s--pin%[1]s) are skipped with a notice. |
| 92 | Use %[1]s--unpin%[1]s to clear the pinned version and include those skills |
| 93 | in the update. |
| 94 | |
| 95 | A skill is only updated from the repository it was installed from. If |
| 96 | its owner and name now belong to a different repository, for example |
| 97 | after the original owner was renamed and someone else took the old name, |
| 98 | the skill is not updated. Reinstall it to use the new repository. |
| 99 | Skills installed by an earlier version of GitHub CLI have no recorded |
| 100 | repository, so they are updated with a warning. |
| 101 | |
| 102 | Skills without GitHub metadata (e.g. installed manually or by another |
| 103 | tool) are prompted for their source repository in interactive mode. |
| 104 | With %[1]s--all%[1]s or in non-interactive mode, they are skipped with a notice. |
| 105 | The update re-downloads the skill with metadata injected, so future |
| 106 | updates work automatically. |
| 107 | |
| 108 | With %[1]s--force%[1]s, re-downloads skills even when the remote version matches |
| 109 | the local tree SHA. This overwrites locally modified skill files with |
| 110 | their original content, but does not remove extra files added locally. |
| 111 | |
| 112 | In interactive mode, shows which skills have updates and asks for |
| 113 | confirmation before proceeding. With %[1]s--all%[1]s, updates without prompting. |
| 114 | With %[1]s--dry-run%[1]s, reports available updates without modifying any files. |
| 115 | `, "`"), |
| 116 | Example: heredoc.Doc(` |
| 117 | # Check and update all skills interactively |
| 118 | $ gh skill update |
| 119 | |
| 120 | # Update specific skills |
| 121 | $ gh skill update mcp-cli git-commit |
| 122 | |
| 123 | # Update all without prompting |
| 124 | $ gh skill update --all |
| 125 | |
| 126 | # Re-download all skills (restore locally modified files) |