MCPcopy Create free account
hub / github.com/github/copilot-sdk / install

Function install

go/internal/embeddedcli/embeddedcli.go:71–104  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

69)
70
71func install() (path string) {
72 verbose := os.Getenv("COPILOT_CLI_INSTALL_VERBOSE") == "1"
73 logError := func(msg string, err error) {
74 if verbose {
75 fmt.Printf("embedded CLI installation error: %s: %v\n", msg, err)
76 }
77 }
78 if verbose {
79 start := time.Now()
80 defer func() {
81 duration := time.Since(start)
82 fmt.Printf("installing embedded CLI at %s installation took %s\n", path, duration)
83 }()
84 }
85 installDir := config.Dir
86 if installDir == "" {
87 if copilotHome := os.Getenv("COPILOT_HOME"); copilotHome != "" {
88 installDir = filepath.Join(copilotHome, "cache", "copilot-sdk")
89 } else {
90 var err error
91 if installDir, err = os.UserCacheDir(); err != nil {
92 // Fall back to temp dir if UserCacheDir is unavailable
93 installDir = os.TempDir()
94 }
95 installDir = filepath.Join(installDir, "copilot-sdk")
96 }
97 }
98 path, err := installAt(installDir)
99 if err != nil {
100 logError("installing in configured directory", err)
101 return ""
102 }
103 return path
104}
105
106func installAt(installDir string) (string, error) {
107 if err := os.MkdirAll(installDir, 0755); err != nil {

Callers 1

embeddedcli.goFile · 0.85

Calls 1

installAtFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…