@corbat-tech/coco 2.27.0 → 2.27.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli/index.js CHANGED
@@ -33836,7 +33836,7 @@ async function setupGcloudADC(provider) {
33836
33836
  if (!valid2) return null;
33837
33837
  return { type: provider.id, model: model2, apiKey: apiKey2 };
33838
33838
  }
33839
- const adc = await inspectADC();
33839
+ let adc = await inspectADC();
33840
33840
  if (adc.status === "ok" && adc.token) {
33841
33841
  console.log(chalk.green(" \u2713 gcloud ADC is already configured!"));
33842
33842
  console.log();
@@ -33859,6 +33859,36 @@ async function setupGcloudADC(provider) {
33859
33859
  console.log(chalk.dim(` ${adc.message}`));
33860
33860
  console.log();
33861
33861
  }
33862
+ const runLoginNow = await p26.confirm({
33863
+ message: "Authenticate with gcloud now from Coco?",
33864
+ initialValue: true
33865
+ });
33866
+ if (p26.isCancel(runLoginNow)) return null;
33867
+ if (runLoginNow) {
33868
+ p26.log.step("Running `gcloud auth application-default login`...");
33869
+ const loginOk = await runGcloudADCLogin();
33870
+ if (loginOk) {
33871
+ adc = await inspectADC();
33872
+ if (adc.status === "ok" && adc.token) {
33873
+ console.log(chalk.green(" \u2713 gcloud ADC is now configured."));
33874
+ console.log();
33875
+ p26.log.success("Authentication verified");
33876
+ const vertexSettings = provider.id === "vertex" ? await promptVertexSettings() : void 0;
33877
+ if (provider.id === "vertex" && !vertexSettings) return null;
33878
+ const model2 = await selectModel(provider);
33879
+ if (!model2) return null;
33880
+ return {
33881
+ type: provider.id,
33882
+ model: model2,
33883
+ apiKey: "__gcloud_adc__",
33884
+ project: vertexSettings?.project,
33885
+ location: vertexSettings?.location
33886
+ };
33887
+ }
33888
+ }
33889
+ p26.log.error("Could not complete gcloud ADC login from Coco.");
33890
+ console.log();
33891
+ }
33862
33892
  console.log(chalk.dim(" Check the current machine-wide ADC state with:"));
33863
33893
  console.log(chalk.cyan(" $ gcloud auth application-default print-access-token"));
33864
33894
  console.log();