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

Function resolveScope

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

Source from the content-addressed store, hash-verified

946}
947
948func resolveScope(opts *InstallOptions, canPrompt bool) (registry.Scope, error) {
949 if opts.Dir != "" {
950 return registry.Scope(opts.Scope), nil
951 }
952
953 if opts.ScopeChanged || !canPrompt {
954 return registry.Scope(opts.Scope), nil
955 }
956
957 var repoName string
958 if opts.Remotes != nil {
959 if remotes, err := opts.Remotes(); err == nil && len(remotes) > 0 {
960 repoName = ghrepo.FullName(remotes[0].Repo)
961 }
962 }
963 idx, err := opts.Prompter.Select("Installation scope:", "", registry.ScopeLabels(repoName))
964 if err != nil {
965 return "", err
966 }
967 if idx == 0 {
968 return registry.ScopeProject, nil
969 }
970 return registry.ScopeUser, nil
971}
972
973func buildInstallPlans(opts *InstallOptions, selectedSkills []discovery.Skill, selectedHosts []*registry.AgentHost, scope registry.Scope, gitRoot, homeDir string, canPrompt bool) ([]installPlan, error) {
974 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