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

Function resolveScope

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

Source from the content-addressed store, hash-verified

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