[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-108470":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":14,"contributorsCount":14,"subscribersCount":14,"size":14,"stars1d":14,"stars7d":14,"stars30d":15,"stars90d":14,"forks30d":14,"starsTrendScore":14,"compositeScore":16,"rankGlobal":9,"rankLanguage":9,"license":17,"archived":18,"fork":18,"defaultBranch":19,"hasWiki":20,"hasPages":18,"topics":21,"createdAt":9,"pushedAt":22,"updatedAt":23,"readmeContent":24,"aiSummary":25,"trendingCount":14,"starSnapshotCount":14,"syncStatus":15,"lastSyncTime":26,"discoverSource":27},108470,"potion-calendar","joelhooks\u002Fpotion-calendar","joelhooks","🧪 Potion Calendar: a clean-room Google Calendar app. Effect 4, Alchemy and Foldkit on Cloudflare Workers.",null,"TypeScript",57,1,52,0,2,41.1,"MIT License",false,"main",true,[],"2026-10-28 15:44:32","2026-11-09 01:10:45","# 🧪 Potion Calendar\n\nA personal Google Calendar app for Joel: one week view over every linked Google account, behind an allowlisted Google sign-in. Calendar behavior comes from the read-only `spec\u002F` corpus.\n\n![The week view with two linked fake Google accounts](docs\u002Fweek-view.png)\n\nThe screenshot is the development build against the in-process Google fake. The accounts and events are fixtures.\n\n## Run locally\n\n```sh\npnpm install\npnpm dev\n```\n\nDevelopment runs the actual Worker, D1 migrations, and per-person Durable Objects in Miniflare. An in-process Google fake checks state, one-use codes, callback URLs, and PKCE. Outbound requests terminate in that fake; no live Google connection or application secrets are needed.\n\nThe first session starts with `joel@example.test` and linked `second@example.test`. Each account has two calendars. Sign out to exercise sign-in again. Use **Add Google account** to link an account, or choose `refused@example.test` to exercise refusal. D1 and Durable Object data reset when the dev server restarts.\n\n`portless list` shows the named route for this checkout. If no shared proxy is running, use the loopback-only fallback:\n\n```sh\nPORTLESS=0 pnpm dev\n```\n\nDo not start or reconfigure a shared proxy just to run this checkout. Client HMR stays enabled. Restart `pnpm dev` after changing server code, development adapters, or SQL migrations; the Worker bundle is built once at startup.\n\n### Simulate an external Google change\n\nOpen the signed-in calendar first so its live connection registers Google watches. Send this request to the same development origin printed by Vite, or to its existing Portless route:\n\n```sh\ncurl -X POST http:\u002F\u002F127.0.0.1:5173\u002F__fake-google\u002Fchange \\\n  -H 'content-type: application\u002Fjson' \\\n  -d '{\"email\":\"joel@example.test\",\"calendarId\":\"joel@example.test\",\"eventId\":\"overlap\",\"summary\":\"Changed outside Calendar\"}'\n```\n\nThe fake patches its provider event, then sends a Google-shaped notification through `\u002Fgoogle\u002Fpush`. The real Durable Object drains the job and publishes a calendar invalidation after the cursor\u002Fversion commit. The response reports accepted notifications and HTTP statuses. Expect `{\"delivered\":1,\"statuses\":[200]}` once watches are registered. This endpoint exists only in development.\n\n## What is in the stack\n\n| Component                    | Pin              |\n| ---------------------------- | ---------------- |\n| Node                         | `>=24.18.0`      |\n| pnpm                         | `11.3.0`         |\n| Effect and platform packages | `4.0.0`          |\n| XState                       | `6.0.0-alpha.69` |\n| `@xstate\u002Feffect`             | `1.0.0-alpha.8`  |\n| Alchemy                      | `2.0.0-beta.83`  |\n| Better Auth                  | `1.6.2`          |\n| Foldkit                      | `0.167.0`        |\n| TypeScript                   | `7.0.2`          |\n| `@effect\u002Ftsgo`               | `0.51.1`         |\n| Oxlint                       | `1.88.0`         |\n| Oxfmt                        | `0.68.0`         |\n| Ultracite                    | `7.12.0`         |\n| Turborepo                    | `2.11.2`         |\n| varlock                      | `1.23.0`         |\n\nDependencies stay exact. The compiler, typed lint, behavioral tests, and Git hooks form the fence.\n\n## Modules\n\n| Path | Job |\n| --- | --- |\n| `apps\u002Fweb` | Foldkit account shell and its single Worker |\n| `apps\u002Finfra` | `Calendar` Alchemy Stack, production stage `CalendarProd` |\n| `packages\u002Fcore` | Shared session contract and fence tests |\n| `packages\u002Fauth` | Google OAuth, allowlist, encrypted tokens, person-scoped token adapter, dev-only fakes |\n| `packages\u002Fdatabase` | D1 migrations and database ports |\n| `packages\u002Fcapability` | Contracts and their projections |\n| `packages\u002Fdevtools` | Development-only capability and actor inspection |\n| `packages\u002Fcheck-harness` | Typed check verdicts |\n| `packages\u002Fdeploy` | Profile-only plan, apply, watch, and approved rollback |\n\nThe calendar-core lane owns `packages\u002Fcalendar`. This scaffold does not edit it.\n\n## Authentication\n\nProduction enables only Google OAuth. Better Auth's generic OAuth plugin gates both sign-in and explicit linking at userinfo, before account writes. Google must return a verified, allowlisted email.\n\nThe authorization request uses `openid email profile https:\u002F\u002Fwww.googleapis.com\u002Fauth\u002Fcalendar`, offline access, consent, and PKCE.\n\nConfigure Google's authorized redirect URI as:\n\n```text\nhttps:\u002F\u002Fcalendar.wzrrd.sh\u002Fauth\u002Foauth2\u002Fcallback\u002Fgoogle\n```\n\nBetter Auth encrypts access and refresh tokens. We discard ID tokens after the callback; the installed encryption option does not encrypt those. Keep `BETTER_AUTH_SECRET` stable across deployments. Changing it invalidates sessions and encrypted credentials.\n\n`@calendar\u002Fauth\u002Fgoogle-tokens` exports `googleTokensFor(auth, userId, config)`. It returns `accounts()` and `accessToken(accountId, options)`. Tokens are `Redacted\u003Cstring>` and never enter the browser Model. A Google `invalid_grant` clears the stored tokens and marks that account disconnected. Other provider and storage faults remain errors.\n\n## Checks\n\n```sh\npnpm env:check\npnpm turbo run check test build --concurrency=1\n```\n\n`spec\u002F**` is source corpus, not application code. Lint and formatting exclude it. No application rule or severity is relaxed.\n\n## Deployment\n\nThe desk deploys from the operator machine. Workers do not contact live Google or deploy Cloudflare resources.\n\nThe Stack declares one Worker, D1, a per-person Durable Object namespace, and the Worker's `calendar.wzrrd.sh` custom domain. The custom domain resolves `wzrrd.sh` by name. The Stack owns no Zone, standalone DNS record, DNSSEC setting, or mail resource. It must never reconcile the existing wildcard or any other record.\n\nSupply these application keys through `.env.schema`:\n\n- `GOOGLE_CLIENT_ID`\n- `GOOGLE_CLIENT_SECRET`\n- `BETTER_AUTH_SECRET`\n- `ALLOWED_EMAILS`, a comma-separated list\n\nAlchemy credentials come only from a named profile. Set `ALCHEMY_PROFILE` to the same profile passed to the driver.\n\n```sh\npnpm deploy:plan --profile wzrrd\npnpm deploy:prod --profile wzrrd --yes\n```\n\nInspect and explicitly allow the initial creates. Deploy checks prove the served release, anonymous session isolation, refusal page, and absence of development and retired public endpoints. Google consent still needs a live owner check.\n\nRollback requires explicit approval: revert the code, then use `pnpm deploy:rollback --profile wzrrd --yes` with the prior receipt. Receipts live in gitignored `.rat\u002Fdeploy\u002F`.\n\n## About `spec\u002F`\n\nThe product description this app is built from (`spec\u002F`) is kept private and is not part of this repository. Agent instructions that mention it refer to that private corpus.\n","Potion Calendar 是一个轻量级、本地可运行的 Google 日历替代客户端，提供单周视图与多账户日历聚合功能。项目采用 Clean-room 设计，不依赖真实 Google API，而是通过内置的模拟 Google 服务（fake Google）实现认证、事件同步与推送通知模拟；核心基于 Effect 4 函数式编程模型、Alchemy 状态管理及 Foldkit 构建，全部运行在 Cloudflare Workers 上。适用于个人开发者学习日历协议集成、验证前端状态机设计、或在无生产密钥环境下快速演示多账户日历交互流程。","2026-11-24 04:34:19","CREATED_QUERY"]