Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

feat(cursor-cloud): use Doppler local/lcl_preview when DOPPLER_TOKEN is set (#5838)

teo1adf39b29f36
diff --git a/.cursor/cloud-lib.sh b/.cursor/cloud-lib.sh
index 914960fd68..de6074de93 100755
--- a/.cursor/cloud-lib.sh
+++ b/.cursor/cloud-lib.sh
@@ -232,6 +232,23 @@ ensure_dockerd() {
return 1
}
+# Populate `doppler_args` for `just stack up`. The doppler CLI is already on
+# PATH from `nix develop` — this only chooses whether to pass `--no-doppler`.
+# A config-scoped service token (local / lcl_preview) is enough; no login.
+# DOPPLER_PREVIEW_TOKEN is the Fly/CI name for the same token.
+stack_doppler_args() {
+ if [ -z "${DOPPLER_TOKEN:-}" ] && [ -n "${DOPPLER_PREVIEW_TOKEN:-}" ]; then
+ export DOPPLER_TOKEN="${DOPPLER_PREVIEW_TOKEN}"
+ fi
+ doppler_args=()
+ if [ -n "${DOPPLER_TOKEN:-}" ]; then
+ echo "cursor-cloud: DOPPLER_TOKEN present — pulling local/lcl_preview secrets"
+ else
+ echo "cursor-cloud: no DOPPLER_TOKEN — using --no-doppler stubs"
+ doppler_args+=(--no-doppler)
+ fi
+}
+
in_pinned_nix_shell() {
[ "${MACRO_CLOUD_PINNED_NIX:-}" = "1" ]
}
diff --git a/.cursor/install.sh b/.cursor/install.sh
index 16e8d68131..e9f6ea1e7a 100755
--- a/.cursor/install.sh
+++ b/.cursor/install.sh
@@ -65,6 +65,8 @@ echo "cursor-cloud install: bun cache ready"
build_local_stack_binaries
echo "cursor-cloud install: local stack binaries ready"
+# Bake the init snapshot on stubs. Runtime stack.sh pulls Doppler when
+# DOPPLER_TOKEN is present; secrets must not land in the durable snapshot.
just stack up --infra-only --no-doppler --build-aux-services --binaries-dir "${LOCAL_STACK_BINS}/bin" --json
cleanup_stack
trap - EXIT
diff --git a/.cursor/stack.sh b/.cursor/stack.sh
index b61db38653..831c9a1b0f 100755
--- a/.cursor/stack.sh
+++ b/.cursor/stack.sh
@@ -18,7 +18,8 @@ fi
\cd "${WORKSPACE_ROOT}"
build_local_stack_binaries
-just stack up --no-doppler --build-aux-services --binaries-dir "${LOCAL_STACK_BINS}/bin"
+stack_doppler_args
+just stack up "${doppler_args[@]}" --build-aux-services --binaries-dir "${LOCAL_STACK_BINS}/bin"
ensure_docker_bridge_forwarding
echo "cursor-cloud stack: app ready"
diff --git a/CLAUDE.md b/CLAUDE.md
index 1f5afeb01c..2e3aa1412b 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -325,10 +325,12 @@ Service binaries come from the private S3 Nix cache. A sibling workflow on push
Set `NIX_CACHE_AWS_ACCESS_KEY_ID` and `NIX_CACHE_AWS_SECRET_ACCESS_KEY` as Cursor environment secrets. The IAM credentials need read-only access to the cache bucket.
+Set `DOPPLER_TOKEN` as a Cursor environment **runtime** secret: a Doppler service token scoped to the `local` project's `lcl_preview` config (the same token CI stores as `DOPPLER_PREVIEW_TOKEN` also works). Do not paste the token into chat. When the token is present, `bash .cursor/stack.sh` pulls those secrets instead of passing `--no-doppler`. Install/bake stays on stubs so the snapshot does not embed secrets. Existing running agents do not pick up newly added secrets — start a new agent after adding the token.
+
Nothing runs after boot. Before DB-backed `cargo test -p <crate>`, run `bash .cursor/infra.sh` once — it brings up Docker, Postgres, and Redis in seconds because install baked the images and volumes. Pure-logic crate tests need nothing. Run `bash .cursor/stack.sh` for a product-ready environment.
After backend edits, run `bash .cursor/rebuild.sh`. Do not use `just stack update` with the read-only Nix binary directory.
-No seeding or OTP is needed to log in: passwordless login auto-creates a user for any email, and the stack's auth service is built with `return_passwordless_code`, so the login API returns the code in its response (codes are also visible at the proxy's `/mailpit/` UI). `just seed-scenario apply --file seed/scenarios/team-perms.json` is optional, for multi-user team/permission fixtures. The `agent_harness_service` restart loop is expected without AI provider keys.
+No seeding or OTP is needed to log in: passwordless login auto-creates a user for any email, and the stack's auth service is built with `return_passwordless_code`, so the login API returns the code in its response (codes are also visible at the proxy's `/mailpit/` UI). `just seed-scenario apply --file seed/scenarios/team-perms.json` is optional, for multi-user team/permission fixtures. The `agent_harness_service` restart loop is expected when AI provider keys are missing; with `DOPPLER_TOKEN` those keys come from `local`/`lcl_preview`.
Leave `SQLX_OFFLINE` unset for `cargo test`. If SQLx reports missing cached query data, run `just prepare_db` instead of enabling offline mode. Run crate tests from the repository root with `cargo test -p <crate>`.