@@ -30,6 +30,8 @@ func doInstallClaudeCode(c *cli.Context) error {
3030 }
3131
3232 useEnvVar := info .EnvVarName != ""
33+ scope := c .String ("scope" )
34+
3335 if useEnvVar {
3436 logger .InfoContext (ctx , "using environment variable substitution" ,
3537 slog .String ("var" , info .EnvVarName ),
@@ -38,9 +40,10 @@ func doInstallClaudeCode(c *cli.Context) error {
3840
3941 // Try to use native claude CLI with HTTP transport first
4042 if mcp .IsClaudeCLIAvailable () {
41- logger .InfoContext (ctx , "using claude CLI with native HTTP transport" )
43+ logger .InfoContext (ctx , "using claude CLI with native HTTP transport" ,
44+ slog .String ("scope" , scope ))
4245
43- if err := mcp .InstallViaClaudeCLI (info , useEnvVar ); err != nil {
46+ if err := mcp .InstallViaClaudeCLI (info , useEnvVar , scope ); err != nil {
4447 logger .WarnContext (ctx , "claude CLI installation failed, falling back to config file" ,
4548 slog .String ("error" , err .Error ()))
4649 } else {
@@ -69,10 +72,26 @@ func doInstallClaudeCode(c *cli.Context) error {
6972 if err != nil {
7073 return fmt .Errorf ("failed to get config locations: %w" , err )
7174 }
72- configPath := locations [0 ].Path
75+
76+ // Determine config path based on scope flag (already declared above)
77+ var configPath string
78+ var configDesc string
79+
80+ switch scope {
81+ case "project" :
82+ configPath = locations [0 ].Path
83+ configDesc = locations [0 ].Description
84+ case "user" :
85+ configPath = locations [1 ].Path
86+ configDesc = locations [1 ].Description
87+ default :
88+ return fmt .Errorf ("invalid scope '%s': must be 'project' or 'user'" , scope )
89+ }
90+
7391 logger .InfoContext (ctx , "using config location" ,
7492 slog .String ("path" , configPath ),
75- slog .String ("type" , locations [0 ].Description ))
93+ slog .String ("type" , configDesc ),
94+ slog .String ("scope" , scope ))
7695
7796 config , err := claudecode .ReadConfig (configPath )
7897 if err != nil {
0 commit comments