chore(dev): run mana-credits locally and gift sync to dev users

Two halves of the same "why is sync inactive in dev" fix:

- package.json: new dev:credits script and mana-credits added to
  the dev:mana:servers concurrently group. The service was never
  started by pnpm dev:mana:all, so the frontend's
  GET /api/v1/sync/status failed, syncBilling.load() caught the
  error and defaulted to inactive — while mana-sync (Go) was
  actually fail-open on the billing check, making the UI
  indicator lie about the backend state.
- scripts/dev/setup-dev-user.sh: after the existing
  email-verify + tier-lift UPDATE, upsert a row into
  credits.sync_subscriptions with is_gifted=true. Mirrors what
  POST /api/v1/admin/sync/:id/gift would do, so every new dev
  user gets Cloud Sync from the first login without a separate
  admin call. The credits schema lives inside mana_platform, so
  no new database needed — just a second statement in the same
  psql heredoc.

Existing dev users (tills95, tilljkb, rajiehq) were backfilled
manually with the same INSERT … ON CONFLICT DO UPDATE once;
future runs of setup-dev-user.sh stay idempotent.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Till JS 2026-04-15 18:09:26 +02:00
parent 82cf190650
commit 0ef650d94a
2 changed files with 27 additions and 2 deletions

View file

@ -221,6 +221,7 @@
"cf:projects:create": "echo 'Creating Cloudflare Pages projects...' && npx wrangler pages project create chat-landing --production-branch=main && npx wrangler pages project create picture-landing --production-branch=main && npx wrangler pages project create mana-landing --production-branch=main && npx wrangler pages project create cards-landing --production-branch=main && npx wrangler pages project create quotes-landing --production-branch=main",
"dev:search": "cd services/mana-search && go run ./cmd/server",
"dev:crawler": "cd services/mana-crawler && DATABASE_URL=postgresql://mana:devpassword@localhost:5432/mana_platform go run ./cmd/server",
"dev:credits": "cd services/mana-credits && bun run --watch src/index.ts",
"dev:notify": "cd services/mana-notify && go run ./cmd/server",
"questions:dev": "turbo run dev --filter=questions...",
"dev:questions:web": "pnpm --filter @questions/web dev",
@ -256,7 +257,7 @@
"dev:manavoxel:local": "concurrently -n sync,web -c magenta,cyan \"pnpm dev:sync\" \"pnpm dev:manavoxel:web\"",
"dev:media": "cd services/mana-media/apps/api && bun run --hot src/index.ts",
"dev:geocoding": "cd services/mana-geocoding && bun run --watch src/index.ts",
"dev:mana:servers": "concurrently -n auth,sync,api,media,crawler -c blue,magenta,yellow,green,cyan \"pnpm dev:auth\" \"pnpm dev:sync\" \"pnpm dev:api\" \"pnpm dev:media\" \"pnpm dev:crawler\""
"dev:mana:servers": "concurrently -n auth,sync,api,media,crawler,credits -c blue,magenta,yellow,green,cyan,red \"pnpm dev:auth\" \"pnpm dev:sync\" \"pnpm dev:api\" \"pnpm dev:media\" \"pnpm dev:crawler\" \"pnpm dev:credits\""
},
"devDependencies": {
"@mana/eslint-config": "workspace:*",