Thanks for contributing. This repo is a Bun + Turborepo monorepo with a
zero-dependency core library (packages/webgpu-search), a product site
(apps/site), a benchmark harness (apps/benchmark), framework recipes
(examples/), and headless test/benchmark scripts (scripts/).
- Be kind. The Code of Conduct applies everywhere.
- Security issues: follow SECURITY.md, do not open public issues for vulnerabilities.
- Library code must stay portable across browser main thread, Web Workers,
Node.js, and SSR: no unguarded
window/document/navigatoraccess. - Route WebGPU device acquisition through
GpuDevicePool/WebGPUContextManageror an injectedoptions.device. Never callnavigator.gpu.requestDevice()per index. - Keep WebGPU and CPU scoring symmetric (
SearchResultItemdescending normalized integer scores, deterministic tie-breakers insrc/ranking.ts). - Every WGSL change must keep
.wgslsources and inlined export strings in sync and passbun run check:shaders.
- Bun
>= 1.1(repo pinsbun@1.4.2; CI usesoven-sh/setup-bun@v2). - Node
>= 18(engines field; used for release publishing). - Chrome/Chromium only if you run the browser gate (
bun run test:browser).
git clone https://github.com/codewarnab/webgpu-search.git
cd webgpu-search
bun install
# Workspace dev servers (site on :5178, benchmark on :5173)
bun run devOpen the site at http://localhost:5178. The #benchmark section runs a
live in-browser WebGPU-vs-CPU comparison over generated data.
packages/webgpu-search: publishedwebgpu-searchlibrary (index+workerentries, ESM + CJS).filesshipsdist+README.md+LICENSE.apps/site: product homepage + embedded#benchmarkquick comparison. Published output isapps/site/dist(seevercel.json).apps/benchmark: full local benchmark harness (dev server:5173).examples/react|vue|svelte|vanilla: framework integration recipes.scripts/: headless suites (test-*.ts), benchmark matrix (bench-snapshot-matrix.ts,benchmark-fixtures.ts,bench-data/generators), and repo gates (check-*.ts).docs/: frozen1.xcontracts (public-api.md,snapshot-format.md,support-matrix.md,text-normalization.md,benchmarks.md,packaging.md,diagnostics.md,reliability.md,security-privacy.md).
# Validate WGSL shader syntax + uniform alignment
bun run check:shaders
# Typecheck all workspaces + framework examples
bun run typecheck
# Production build (Turborepo)
bun run build
# Headless WebGPU-mock tests (no GPU/browser needed)
bun run test:headless
# Targeted suites
bun run test:contracts
bun run test:parity
bun run test:search-modes
bun run test:cpu-baseline
bun run test:reliability
bun run test:benchmarks
# Headless compatibility set (no GPU/browser)
bun run test:compatibility
# Full headless gate (compatibility + records/highlight/mutations/worker/
# snapshot/observability/normalization/filtering/faceting/diagnostics)
bun run test:all
# Browser regression gate (needs Chrome; starts apps/benchmark dev server)
bun run test:browser
# Bundle + public-surface gates
bun run check:bundle-size
bun run check:public-api
bun run lint:naming
bun run lint:parityThe browser gate needs a Chrome binary (CHROME_BIN). CI installs stable
Chrome via browser-actions/setup-chrome@v1 and serves apps/benchmark
on 127.0.0.1:5173 before running scripts/test-regression.ts.
- Create a focused branch from
main. - For public-surface changes, update
docs/public-api.mdand the allowlist inscripts/check-public-api.tsin the same PR (CI fails otherwise). Scoring, storage, ordering, or echo changes require a major perdocs/public-api.md§7. - For snapshot changes, update
docs/snapshot-format.mdand cover legacy restore, CRC, caps, getters, hooks, and profile guards inbun run test:snapshot. - For benchmark fixture changes, bump
BENCHMARK_FIXTURE_VERSION, regeneratedocs/benchmarks/benchmark_snapshot_matrix.json+.md, and updatedocs/benchmarks.md§3. - Run the relevant gates before opening a PR (at minimum
check:shaders,typecheck,build,test:mock, plus any suite covering your area).
- Fill out
.github/PULL_REQUEST_TEMPLATE.md(what changed, tests run, contract impact). - Keep diffs clean: no temporary test files, debug logs, or dead scripts.
- File bug reports with
.github/ISSUE_TEMPLATE/webgpu-search-issue.md(header/stats/timings metadata, never PII record text).
Changesets govern versioning (@changesets/cli):
bun run changeset # add a changeset for your change
bun run version-packages # apply versions (CI release job consumes this)
bun run release # turbo build + changeset publishPre-publish verification:
bun run prepublish:checkattw --pack ./packages/webgpu-search must pass on every release (both
webgpu-search and webgpu-search/worker entries × ESM/CJS).