Derive and write this repo's local-only GCP settings into `.karl/local.env` using the `gcloud` CLI. Use when the user asks to set up local GCP config, populate or repair `.karl/local.env`, choose the project, bucket, region, or zone for this repo, or verify the repo's GCP wiring.
.karl/local.envRead these first:
docs/agent/gcp-connection.mddocs/agent/app-service.mddocs/agent/makefile.mdThis repo keeps real infra identifiers out of version control. The committed template is config/local.env.example; the live local file is .karl/local.env.
Write or update:
.karl/local.envExpected keys:
GOOGLE_CLOUD_PROJECTGCS_BUCKETGCP_REGIONGCP_ZONESERVICE_NAMEgcloud.gcloud.gcloud..karl/local.env.GOOGLE_CLOUD_PROJECTPrefer, in order:
gcloud config get-value core/project if it is set and the user has not said otherwise.gcloud.If multiple plausible projects exist and the correct one is unclear, ask the user instead of guessing.
GCS_BUCKETUse gcloud storage buckets list --project="$GOOGLE_CLOUD_PROJECT" to discover candidates.
Prefer, in order:
corpus/, index/, synth/, rollouts/, training/, models/, or eval/.If there are multiple plausible buckets and no clear winner, ask the user.
If no bucket exists yet, it is acceptable to propose the repo's standard bootstrap path and use a planned bucket name, but tell the user that the bucket is a chosen local value rather than a discovered one.
GCP_REGIONPrefer, in order:
gcloud config get-value compute/regionus-central1 if nothing else is discoverableGCP_ZONEPrefer, in order:
gcloud config get-value compute/zone<GCP_REGION>-a if nothing else is discoverableSERVICE_NAMEThis is not reliably discoverable from gcloud for this repo's local setup. It is acceptable to invent a concise, stable name such as karl-api unless the user provided one or an existing Cloud Run service clearly should be reused.
config/local.env.example if it helps, but write the real local file at .karl/local.env.KEY=value lines with no extra quoting unless needed..karl/local.env.gcloud commands: --project="$GOOGLE_CLOUD_PROJECT".After writing .karl/local.env, run:
uv run python scripts/verify_gcp_setup.py
If the user wants a fuller smoke test, the next repo-native checks are:
make gcp-check
make bucket
SERVICE_NAME can be invented when needed.gcloud is unavailable or unauthenticated, explain what is missing and stop before writing misleading values.