|
6 | 6 | "strings" |
7 | 7 |
|
8 | 8 | "github.com/Cloverhound/prompt-tools-cli/internal/appconfig" |
| 9 | + "github.com/Cloverhound/prompt-tools-cli/internal/gcpauth" |
9 | 10 | "github.com/Cloverhound/prompt-tools-cli/internal/keyring" |
10 | 11 | "github.com/Cloverhound/prompt-tools-cli/internal/output" |
11 | 12 | "github.com/spf13/cobra" |
@@ -57,6 +58,13 @@ var configShowCmd = &cobra.Command{ |
57 | 58 | } |
58 | 59 | } |
59 | 60 |
|
| 61 | + // Show GCP ADC status |
| 62 | + if gcpauth.HasCredentials() { |
| 63 | + display.APIKeys["google_adc"] = "configured" |
| 64 | + } else { |
| 65 | + display.APIKeys["google_adc"] = "not set" |
| 66 | + } |
| 67 | + |
60 | 68 | return output.PrintObject(display) |
61 | 69 | }, |
62 | 70 | } |
@@ -230,6 +238,26 @@ var configSetAPIKeyCmd = &cobra.Command{ |
230 | 238 | }, |
231 | 239 | } |
232 | 240 |
|
| 241 | +var configSetGCPProjectCmd = &cobra.Command{ |
| 242 | + Use: "set-gcp-project <project-id>", |
| 243 | + Short: "Set GCP project for Google API quota/billing", |
| 244 | + Args: cobra.ExactArgs(1), |
| 245 | + RunE: func(cmd *cobra.Command, args []string) error { |
| 246 | + cfg, err := appconfig.Load() |
| 247 | + if err != nil { |
| 248 | + return err |
| 249 | + } |
| 250 | + gc := cfg.Providers["google"] |
| 251 | + gc.ProjectID = args[0] |
| 252 | + cfg.Providers["google"] = gc |
| 253 | + if err := cfg.Save(); err != nil { |
| 254 | + return err |
| 255 | + } |
| 256 | + fmt.Printf("GCP project set to %s\n", args[0]) |
| 257 | + return nil |
| 258 | + }, |
| 259 | +} |
| 260 | + |
233 | 261 | var configClearAPIKeyCmd = &cobra.Command{ |
234 | 262 | Use: "clear-api-key <google|elevenlabs|assemblyai|openai>", |
235 | 263 | Short: "Remove API key from keyring", |
@@ -266,5 +294,6 @@ func init() { |
266 | 294 | configCmd.AddCommand(configSetEncodingCmd) |
267 | 295 | configCmd.AddCommand(configSetAPIKeyCmd) |
268 | 296 | configCmd.AddCommand(configClearAPIKeyCmd) |
| 297 | + configCmd.AddCommand(configSetGCPProjectCmd) |
269 | 298 | rootCmd.AddCommand(configCmd) |
270 | 299 | } |
0 commit comments