firebase-campaign-copy
Copy production Firebase campaigns across users for testing with Admin SDK.
- License 许可
- MIT
- 最近更新
- 2026-11-14
- Stars
- ★ 6
- Forks
- 0
01 前言 Front Matter
- name
- firebase-campaign-copy
- description
- Copy production Firebase campaigns across users for testing with Admin SDK.
02 资源文件 4
- 参考文档manifest.json152 B
- 参考文档references/bindings-and-controls.md4.5 KB
- 参考文档references/official-docs-index.md5.4 KB
- 参考文档references/platforms-and-publishing.md4.3 KB
03 SKILL.md 正文
Firebase Campaign Copy - Production Data for Testing
Overview
Copy production campaigns across users for testing without auth bypass, using Firebase Admin SDK.
Prerequisites
export WORLDAI_DEV_MODE=true
export WORLDAI_GOOGLE_APPLICATION_CREDENTIALS=~/serviceAccountKey.json
Copy Campaign Script
Location: scripts/copy_campaign.py
Features:
- Cross-user campaign copying
- Auto-find source user by campaign ID
- Search campaigns by title
- Copies all subcollections (story, game_states, notes, characters)
- No auth bypass needed (uses service account)
Usage Patterns
1. Copy by Campaign ID (Recommended)
# Auto-finds source user, copies to destination user
WORLDAI_DEV_MODE=true \
WORLDAI_GOOGLE_APPLICATION_CREDENTIALS=~/serviceAccountKey.json \
python scripts/copy_campaign.py \
--find-by-id JXXNfJpdqNtH60HN942q \
--dest-user-id 0wf6sCREyLcgynidU5LjyZEfm7D2 \
--suffix "(test copy)"
2. Copy by Title
# Searches all users for matching title
WORLDAI_DEV_MODE=true \
WORLDAI_GOOGLE_APPLICATION_CREDENTIALS=~/serviceAccountKey.json \
python scripts/copy_campaign.py \
--find-by-title "gaia julia v2" \
--dest-user-id 0wf6sCREyLcgynidU5LjyZEfm7D2
3. Direct Copy (If You Know Source User)
WORLDAI_DEV_MODE=true \
WORLDAI_GOOGLE_APPLICATION_CREDENTIALS=~/serviceAccountKey.json \
python scripts/copy_campaign.py \
SOURCE_UID \
SOURCE_CAMPAIGN_ID \
--dest-user-id DEST_UID
Find User UID by Email
Use campaign_manager.py:
WORLDAI_DEV_MODE=true \
WORLDAI_GOOGLE_APPLICATION_CREDENTIALS=~/serviceAccountKey.json \
python scripts/campaign_manager.py find-user <your-email@gmail.com>
Output:
✅ Found user: <your-email@gmail.com>
? Firebase UID: 0wf6sCREyLcgynidU5LjyZEfm7D2
Example: Copy Production Campaign for Testing
Scenario: Copy campaign JXXNfJpdqNtH60HN942q from $USER@gmail.com to your-email@gmail.com
Steps:
# 1. Find destination user UID
WORLDAI_DEV_MODE=true python scripts/campaign_manager.py find-user <your-email@gmail.com>
# Output: 0wf6sCREyLcgynidU5LjyZEfm7D2
# 2. Copy campaign (auto-finds source user)
WORLDAI_DEV_MODE=true python scripts/copy_campaign.py \
--find-by-id JXXNfJpdqNtH60HN942q \
--dest-user-id 0wf6sCREyLcgynidU5LjyZEfm7D2 \
--suffix "(test copy)"
# Output:
# ✅ Created new campaign: qwN7EwNqbJXnl5y3Npjj
# ? Name: gaia julia v2 (test copy)
# ✅ Copied 362 documents from story
# ✅ Copied 1 documents from game_states
Script Output
Success:
✅ Created new campaign: qwN7EwNqbJXnl5y3Npjj
? Name: gaia julia v2 (test copy)
✅ Copied 362 documents from story
✅ Copied 1 documents from game_states
✅ Campaign copied successfully!
? Campaign ID: qwN7EwNqbJXnl5y3Npjj
? To access: Use your environment's base URL + /game/qwN7EwNqbJXnl5y3Npjj
Repro: Copy Exact State at Bug-Report Time
When a bug is reported, copy the campaign immediately so the reproduction uses the exact state at the time of report (not a later mutated state).
Required Inputs
- Campaign ID from the report
- Report timestamp (UTC)
- Destination user UID (test account)
Step-by-step
# 1) Copy the campaign immediately (preserves all fields + subcollections).
# Use a timestamped suffix so we can trace the report state later.
WORLDAI_DEV_MODE=true \
WORLDAI_GOOGLE_APPLICATION_CREDENTIALS=~/serviceAccountKey.json \
python scripts/copy_campaign.py \
--find-by-id <CAMPAIGN_ID> \
--dest-user-id <DEST_UID> \
--suffix "(bug report 2026-02-02T02:03Z)"
# Output includes the new campaign ID:
# ✅ Created new campaign: <NEW_CAMPAIGN_ID>
# 2) Capture the copied game state for reproducibility.
WORLDAI_DEV_MODE=true \
WORLDAI_GOOGLE_APPLICATION_CREDENTIALS=~/serviceAccountKey.json \
python scripts/fetch_campaign_gamestate.py <NEW_CAMPAIGN_ID>
# 3) Export the story log for context (optional but recommended).
WORLDAI_DEV_MODE=true \
WORLDAI_GOOGLE_APPLICATION_CREDENTIALS=~/serviceAccountKey.json \
python scripts/download_campaign.py --uid <DEST_UID> \
--campaign-id <NEW_CAMPAIGN_ID> --output-dir /tmp/your-project.com/bug_repros
Notes
- Timing matters: copying later will lose the exact report state.
- Title suffix should include the report timestamp for traceability.
- Use the copied campaign ID for all repro tests to avoid mutating the original.
Use Cases
-
Testing with Production Data
- Copy large campaigns to test accounts
- Validate caching behavior with real story history
- Test payload equivalence across servers
-
User Data Migration
- Move campaigns between accounts
- Backup campaigns before testing
-
Campaign Duplication
- Create campaign variants for testing
- Preserve original while experimenting
Technical Notes
- Collection Group Query: Uses efficient Firestore collection group query to find campaigns across all users
- Subcollections: Automatically copies all subcollections (story, game_states, notes, characters)
- Field Preservation: Copies all fields including timestamps without modification
- Document IDs: Preserves original document IDs in subcollections for ordering
- No Auth Bypass: Uses Firebase Admin SDK service account (no testing shortcuts)
Reference
See also:
scripts/campaign_manager.py- Query campaigns, analytics, deletionscripts/CLAUDE.md- Full Firebase operations documentation.claude/skills/firebase-prod-campaigns.md- Production campaign queries
04 同仓库更多 Skills
instinct
Use when the user invokes /instinct or /in, or asks to "message Instinct", "ask Instinct", "tell Instinct", "check Instinct", or read replies from the configured peer assistant. iMessage first, WhatsApp Web as fallback.
hr
Compatibility alias for history-resume; produce the same fresh-state, provenance-aware resume briefing.
history-resume
Resume briefing for the current repository branch or worktree using fresh state and admitted history sources.
grok
Alias for the canonical grokbot browser conversation workflow; /grok talks to the Grok bot the same way /dot talks to Dot.
codexa-bench
Compare `codexa` and normal `codex` on a fair split of comparable work by default; use `--strict` for duplicate runs of the exact same task.
frontend-design
Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, artifacts, posters, or applications (examples include websites, landing pages, dashboards, React components, HTML/CSS layouts, or when styling/beautifying any web UI). Generates creative, polished code and UI design that avoids generic AI aesthetics.