MCPcopy Index your code
hub / github.com/cli/cli / NewCmdInstall

Function NewCmdInstall

pkg/cmd/skills/install/install.go:71–248  ·  view source on GitHub ↗

NewCmdInstall creates the "skills install" command.

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

Source from the content-addressed store, hash-verified

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

Callers 2

NewCmdSkillsFunction · 0.92
TestNewCmdInstallFunction · 0.85

Calls 9

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

Tested by 1

TestNewCmdInstallFunction · 0.68