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

Function resolveScope

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

Source from the content-addressed store, hash-verified

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