Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changeset/improve-tos-guidance-project-create.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@googleworkspace/cli": patch
---

Improve `gws auth setup` project creation failures in step 3:
- Detect Google Cloud Terms of Service precondition failures and show actionable guidance (`gcloud auth list`, account verification, Console ToS URL).
- Detect invalid project ID format / already-in-use errors and show clearer guidance.
- In interactive setup, keep the wizard open and re-prompt for a new project ID instead of exiting immediately on create failures.
10 changes: 9 additions & 1 deletion src/auth_commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ pub async fn handle_auth_command(args: &[String]) -> Result<(), GwsError> {
" --scopes Comma-separated custom scopes\n",
" setup Configure GCP project + OAuth client (requires gcloud)\n",
" --project Use a specific GCP project\n",
" --login Run `gws auth login` after successful setup\n",
" status Show current authentication state\n",
" export Print decrypted credentials to stdout\n",
" logout Clear saved credentials and token cache",
Expand All @@ -135,7 +136,7 @@ pub async fn handle_auth_command(args: &[String]) -> Result<(), GwsError> {
}

match args[0].as_str() {
"login" => handle_login(&args[1..]).await,
"login" => run_login(&args[1..]).await,
"setup" => crate::setup::run_setup(&args[1..]).await,
"status" => handle_status().await,
"export" => {
Expand All @@ -148,6 +149,13 @@ pub async fn handle_auth_command(args: &[String]) -> Result<(), GwsError> {
))),
}
}

/// Run the `auth login` flow.
///
/// Exposed for internal orchestration (e.g. `auth setup --login`).
pub async fn run_login(args: &[String]) -> Result<(), GwsError> {
handle_login(args).await
}
/// Custom delegate that prints the OAuth URL on its own line for easy copying.
struct CliFlowDelegate;

Expand Down
Loading
Loading