fork 友善化部署:wrangler.toml 佔位值、去硬編、slash 後台按鈕、雙路徑 DEPLOY.md#2
Merged
Conversation
Brainstormed design for making forks easy to deploy (Sink-style Git integration) while preserving the full wrangler CLI path. Covers: wrangler.toml placeholders + owner-value cleanup, removing two hardcoded owner URLs in the frontends, a slash- command-registration admin button, Workers Builds + Pages Git deploy with migrations folded into the deploy script, secret/var layering, and a dual-path DEPLOY.md rewrite. Decisions captured from the brainstorming session; Codex-reviewed assessment incorporated.
Task-by-task TDD plan from the design spec: wrangler.toml placeholders, remove two hardcoded owner URLs (web api.ts fail-loud, admin upload-link via WEB_ORIGIN), slash-registration admin button + route, migrations folded into deploy, dual-path DEPLOY.md rewrite. Includes per-task tests, verification commands, and spec coverage check.
Make the repo fork-safe: routes/vars/database_id become placeholders with guidance comments; remove ACCESS_ALLOWED_EMAILS (the code path is disabled — Access policy is the real allowlist — so it only leaked an email). Also genericize two cosmetic panspace.dev references (index.ts comment, test title). Owner keeps real values locally via git update-index --skip-worktree.
Task 1 code review found README.md/README.zh-TW.md still reference admin.panspace.dev, and the final verification grep both missed root READMEs and would self-match the design docs. Add a README-cleanup task and scope the grep to exclude docs/superpowers and the owner-internal setup-checklist.md.
…omain The admin 'copy upload link' feature hardcoded https://pay.panspace.dev. Have the worker return a full url built from WEB_ORIGIN; the admin SPA uses it verbatim, so a fork's links point at the fork's own domain.
Remove the hardcoded fallback to the owner's worker URL. A fork that forgets to set VITE_API_BASE at build time now errors immediately instead of silently routing the public payment page to the upstream backend.
Add an Access-protected POST /admin/discord/register-commands that PUTs the three guild commands via the existing registerGuildCommands helper (app id from vars, guild id from settings, bot token from the runtime secret), plus a Settings-page button. Lets zero-CLI forkers register slash commands; the pnpm register script stays for CLI users.
deploy now runs 'wrangler d1 migrations apply chippot-db --remote && wrangler deploy' so both CLI and Workers Builds apply pending migrations before deploying (idempotent: wrangler tracks applied migrations).
Primary path: fork + edit wrangler.toml placeholders in the GitHub web editor + connect Workers Builds & two Pages projects + set secrets in the dashboard — no local toolchain. Secondary path: the existing wrangler CLI flow, preserved. Adds a secret/var layering table, migration-in-deploy notes, and same-origin route ordering.
…ructive-migration caveat Address doc-quality review: list GitHub account as a Path 1 prerequisite; drop the stray 'cd packages/worker' in the CLI slash-register step (pnpm --filter runs from root); forward-reference the destructive-migration caveat from the Path 1 update summary; clarify VITE_API_BASE persists across Pages builds.
Replace admin.panspace.dev with admin.example.com in the README architecture sections so the public repo carries no owner production domain.
- DEPLOY.md §7: document that the CLI register script needs .dev.vars (DISCORD_BOT_TOKEN/APPLICATION_ID/GUILD_ID); note the dashboard button needs discord_guild_id set (step 8) first. - README quick-ref: use 'pnpm --filter @chippot/worker deploy' (migrations+deploy) instead of the old two-step; note register prerequisites. - README: drop the removed ACCESS_ALLOWED_EMAILS from the vars list.
…up notes) It is an owner-specific build-time Q&A artifact (guild/channel ids, Access team domain) superseded by DEPLOY.md — not useful to forkers and the last owner-value leak in the public repo. Stop tracking it (local copy preserved), alongside the already-ignored docs/deploy-state.md.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
讓其他開發者 fork 後能輕鬆部署到自己的 Cloudflare,並清除 repo 內所有 owner 正式值。參考 miantiao-me/Sink 的「fork → 後台連 Git 自動部署」模式,同時 100% 保留純 CLI
wrangler deploy。設計與計畫經 Codex 獨立複核。docs/superpowers/specs/2026-06-07-fork-friendly-deploy-design.mddocs/superpowers/plans/2026-06-07-fork-friendly-deploy.md改了什麼
ACCESS_ALLOWED_EMAILS。runtime 設定維持以 wrangler.toml 為單一真相來源(後台 env var 是 build 期、到不了 runtime)。web/src/api.ts:移除VITE_API_BASE未設時靜默 fallback 到 owner worker;改 fail-loud。WEB_ORIGIN組完整 URL 回傳(WEB_ORIGIN未設回 500),admin 直接用,移除寫死的pay.panspace.dev。POST /admin/discord/register-commands(沿用既有registerGuildCommandshelper、payload 取自commands.ts、guild id 取自 settings)+ 設定頁按鈕。零 CLI forker 可用;pnpm register腳本保留給 CLI。deploy=wrangler d1 migrations apply chippot-db --remote && wrangler deploy(idempotent),CLI 與 Workers Builds 共用。example.com;docs/setup-checklist.md(owner 內部一次性建置檔)改 gitignore。驗證(CI 條件,無 .dev.vars)
pnpm -r typecheck✅pnpm -r test→ 161 passed (31 files) ✅(新增 upload-link url、WEB_ORIGIN 500、slash 註冊 ×2 等測試)pnpm -r build(web+admin)✅流程
每個 Task 經 implementer → spec 合規審查 → 程式品質審查(含修正迴圈),最後整體 review。整體 review 另抓出並修掉幾個跨任務文件一致性缺口(CLI register 的 .dev.vars 前置、README deploy 指令、過時 var 列表)。
待部署階段處理(非本 PR 阻擋項)
--remotemigration —— 需在 owner 帳號實測;不足則退回 migration 偶發手動(已記於 spec §7)。🤖 Generated with Claude Code