Repository navigation
Share platform-neutral code through an npm workspace package - #122
Conversation
The root package lists packages/* as workspaces. packages/core is a private TypeScript-source package whose only dependency is zod at the root's range, with a tsconfig that has no DOM library. The lockfile gains only the workspace entry and the package link. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Moves the import-closed leaf modules from src/lib into packages/core/src under the same relative names: languages, URL and file validation, voice delivery and payload, the AI request and output schemas, the provider types, the crossfire schemas, reducer, prefill and draft storage, the sparring formats and the Edge Function error helper. Package files import each other relatively, and the four contract files shared with the Edge Functions are re-exported from supabase/functions/_shared, not moved. Every old src/lib path except ai/schemas/url.ts (only the moved schemas used it) keeps a one-line re-export, so importers, vi.mock targets and tests are unchanged. Crossfire draft storage now takes its storage as a parameter; the src/lib wrapper keeps the localStorage default for the web. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
ESLint rejects browser globals, import.meta and web-only imports in packages/**, and the type-aware promise rules now cover packages/core. npm run typecheck checks packages/core against its no-DOM tsconfig. knip reads the root and packages/core as workspaces. The database, live-e2e, model-matrix and agentic-e2e path filters include packages/**, and the docs check skips node_modules at any depth. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Review limit reachedEnable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. Next included review available in 7 minutes. View limit detailsLimit details: You’ve used the included review currently available. Review configuration: ⚙️ Run configuration
⛔ Files ignored due to path filters (1)
📒 Files selected for processing (60)
Note 🎁 Summarized by CodeRabbit FreeYour organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Essentials by visiting https://app.coderabbit.ai/settings/billing. Comment |
|
Review record for Codex (gpt-6.1-sol, high effort, detached snapshot at Hosted builds: both Vercel projects built |
|
Production follow-through for merge commit
|
The repository is now an npm workspace with one shared package,
packages/core, so the native iOS app planned in plans/2026-10-08-native-ios-app.md can reuse DebateLab's platform-neutral code.src/did not move, and the website behaves the same.What moved into
@debatelab/core:src/lib: languages, URL and file validation, voice delivery and payload, the AI request and output schemas, the provider types, the crossfire schemas, reducer, prefill and draft storage, the sparring formats, and the Edge Function error helper. Each has zod as its only outside dependency.contract/*, one-line re-exports of the four files the client already shares with the Edge Functions (debate-context,model-catalog,source-bounds,voice-tags). Those stay insupabase/functions/_shared, where Deno imports them.How the web keeps working:
src/libpath keeps a one-lineexport *shim, so no importer,vi.mocktarget or test changed. The one exception isai/schemas/url.ts: only the moved schemas used it, and knip flags an unused shim.src/libwrapper keeps thelocalStoragedefault, soAuthProviderand the Crossfire page are untouched.validation/file.tsaccepts any object withname,sizeandtype, which a browserFilesatisfies.Guards that keep the package platform-neutral:
packages/core/tsconfig.jsoncompiles with the ES2022 lib and no DOM types. As a side effect, the_sharedcontract files' "no Deno or DOM APIs" comments are now checked by the compiler. A smallglobals.d.tsdeclaresURLandconsole.warn, which both browsers and Hermes provide.packages/**no browser globals and errors onwindow,document, storage,import.meta, and imports of React, React Native, zustand, supabase-js and the web-only UI libraries. A probe file with each of those failed lint as expected. The type-awareno-floating-promisesrule now covers the package too.npm run typecheckincludes the package; knip runs it as a workspace;check-docsskips anynode_modulesfolder; thedatabase,live-e2e,model-matrixandagentic-e2eworkflow filters includepackages/**.Left in
src/on purpose: the stores, the AI client and streaming, the Supabase client, environment and auth wiring,src/i18n.tsand the locale catalogs. They depend on browser storage,import.meta.envor app singletons, and the catalogs are the most edited files in the repo. They become shareable in later native-app PRs through injected storage and runtime adapters.GitHub Actions still starts no jobs on this account (billing), so these checks ran locally on Node 22.23.2:
npm run verifyexit 0 at the final tree: 273 Vitest tests, 30 collaboration tests, 333 Deno Edge Function tests, the build with its boundary check, the service-worker offline test, and 30 Chromium smoke e2e tests.npm ls zod react react-domresolves exactly one copy of each.npm ci, linkednode_modules/@debatelab/core, and passed typecheck and build.verify-debatelabin fake mode:doctorall ok, including the probe that readssrc/lib/supabase/env.tsfrom the dev server. Theai-toolsrecipe (sign-in, streaming Ask with citations and web search, Attack, Brainstorm, Factoids) passed 6/6 on desktop and mobile Chromium, and thepracticerecipe (Crossfire reducer, draft storage, Sparring formats) passed 3/3 on both.Not run: the full browser suite, WebKit, the database gate (no migrations), staging, and
npm cion npm 10.🤖 Generated with Claude Code