MCPcopy
hub / github.com/cli/cli / resolveScope

Function resolveScope

pkg/cmd/skills/install/install.go:964–987  ·  view source on GitHub ↗
(opts *InstallOptions, canPrompt bool)

Source from the content-addressed store, hash-verified

962}
963
964func resolveScope(opts *InstallOptions, canPrompt bool) (registry.Scope, error) {
965 if opts.Dir != "" {
966 return registry.Scope(opts.Scope), nil
967 }
968
969 if opts.ScopeChanged || !canPrompt {
970 return registry.Scope(opts.Scope), nil
971 }
972
973 var repoName string
974 if opts.Remotes != nil {
975 if remotes, err := opts.Remotes(); err == nil && len(remotes) > 0 {
976 repoName = ghrepo.FullName(remotes[0].Repo)
977 }
978 }
979 idx, err := opts.Prompter.Select("Installation scope:", "", registry.ScopeLabels(repoName))
980 if err != nil {
981 return "", err
982 }
983 if idx == 0 {
984 return registry.ScopeProject, nil
985 }
986 return registry.ScopeUser, nil
987}
988
989func buildInstallPlans(opts *InstallOptions, selectedSkills []discovery.Skill, selectedHosts []*registry.AgentHost, scope registry.Scope, gitRoot, homeDir string, canPrompt bool) ([]installPlan, error) {
990 byDir := make(map[string]*installPlan)

Callers 2

installRunFunction · 0.85
runLocalInstallFunction · 0.85

Calls 5

ScopeTypeAlias · 0.92
FullNameFunction · 0.92
ScopeLabelsFunction · 0.92
RemotesMethod · 0.65
SelectMethod · 0.65

Tested by

no test coverage detected