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

Function resolveScope

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

Source from the content-addressed store, hash-verified

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