MCPcopy Create free account
hub / github.com/cli/cli / NewCmdInstall

Function NewCmdInstall

pkg/cmd/skills/install/install.go:75–252  ·  view source on GitHub ↗

NewCmdInstall creates the "skills install" command.

(f *cmdutil.Factory, telemetry ghtelemetry.EventRecorder, runF func(*InstallOptions) error)

Source from the content-addressed store, hash-verified

73
74// NewCmdInstall creates the "skills install" command.
75func NewCmdInstall(f *cmdutil.Factory, telemetry ghtelemetry.EventRecorder, runF func(*InstallOptions) error) *cobra.Command {
76 opts := &InstallOptions{
77 IO: f.IOStreams,
78 Telemetry: telemetry,
79 Prompter: f.Prompter,
80 GitClient: f.GitClient,
81 Remotes: f.Remotes,
82 HttpClient: f.HttpClient,
83 }
84
85 cmd := &cobra.Command{
86 Use: "install <repository> [<skill[@version]>] [flags]",
87 Short: "Install agent skills from a GitHub repository (preview)",
88 Long: heredoc.Docf(`
89 Install agent skills from a GitHub repository or local directory into
90 your local environment. Skills are placed in a host-specific directory
91 at either project scope (inside the current git repository) or user
92 scope (in your home directory, available everywhere).
93
94 A wide range of AI coding agents are supported, including GitHub
95 Copilot, Claude Code, Cursor, Codex, Gemini CLI, Antigravity, Amp,
96 Devin, Goose, Grok, Junie, OpenCode, and many more.
97
98 Supported %[1]s--agent%[1]s values:
99
100 %[2]s
101
102 Use %[1]s--agent%[1]s and %[1]s--scope%[1]s to control placement, or %[1]s--dir%[1]s for a
103 custom directory. The default scope is %[1]sproject%[1]s, and the default
104 agent is %[1]sgithub-copilot%[1]s (when running non-interactively).
105
106 At project scope, several agents (including GitHub Copilot, Cursor,
107 Codex, Gemini CLI, Antigravity, Amp, Cline, OpenCode, and Warp) share
108 the %[1]s.agents/skills%[1]s directory. If you select multiple hosts that
109 resolve to the same destination, each skill is installed there only once.
110
111 The first argument is a GitHub repository in %[1]sOWNER/REPO%[1]s format.
112 Use %[1]s--from-local%[1]s to install from a local directory instead.
113 Local skills are auto-discovered using the same conventions as remote
114 repositories, and files are copied (not symlinked) with local-path
115 tracking metadata injected into frontmatter.
116
117 Skills are discovered automatically using the %[1]sskills/*/SKILL.md%[1]s convention
118 defined by the Agent Skills specification, including when the %[1]sskills/%[1]s
119 directory is nested under a prefix (e.g. %[1]sterraform/code-generation/skills/...%[1]s).
120 For more information on the specification,
121 see: https://agentskills.io/specification
122
123 The skill argument can be a name, a namespaced name (%[1]sauthor/skill%[1]s),
124 or an exact path within the repository (%[1]sskills/author/skill%[1]s,
125 %[1]spackages/agent-skills/code-review%[1]s, or any %[1]s.../SKILL.md%[1]s path).
126 Namespaced names with one slash are matched by name. Use a %[1]sSKILL.md%[1]s
127 suffix to force a one-directory path outside the standard conventions.
128
129 Performance tip: when installing from a large repository with many
130 skills, providing an exact path instead of a skill name avoids a
131 full tree traversal of the repository, making the install significantly faster.
132

Callers 3

NewCmdSkillsFunction · 0.92
TestInstallCommandArgsFunction · 0.92
TestNewCmdInstallFunction · 0.85

Calls 10

AgentHelpListFunction · 0.92
FlagErrorfFunction · 0.92
MutuallyExclusiveFunction · 0.92
StringEnumFlagFunction · 0.92
AgentIDsFunction · 0.92
DisableAuthCheckFlagFunction · 0.92
installRunFunction · 0.85
ChangedMethod · 0.80
CanPromptMethod · 0.80
ContainsMethod · 0.80

Tested by 2

TestInstallCommandArgsFunction · 0.74
TestNewCmdInstallFunction · 0.68