1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# Build + serve the SQLRite WASM browser demo.
#
# Targets:
# make build — build the wasm-pack output into ./pkg/
# make serve — serve static demo on http://localhost:8080 (no Ask)
# make ask-demo — serve via node server.mjs (static + Ask proxy)
# make — build + serve (no Ask)
# make clean — remove the built pkg/
#
# The plain `serve` target uses Python's stdlib http.server — fine
# for the SQL console part, but the Ask demo needs a backend that
# proxies POST /api/llm/complete to Anthropic. Use `make ask-demo`
# for that flow.
:
PORT ?=
:
# Point at the sdk/wasm crate via a relative path. `wasm-pack build
# --out-dir` writes the generated JS + wasm + .d.ts files straight
# into `examples/wasm/pkg/`, which `index.html` imports directly.
:
# Simple static server so the browser can fetch the wasm file via
# HTTP (file:// loads block WebAssembly for security reasons). Uses
# Python because it's on every macOS/Linux install; any static
# server works (miniserve, `npx serve`, etc.). Note: the Ask
# section in the demo will report "couldn't reach proxy" because
# python's http.server doesn't proxy. Use `make ask-demo` for that.
:
# Static-server + Ask proxy in one process. Requires Node 18+
# (built-in fetch) and ANTHROPIC_API_KEY in the env. Zero npm
# dependencies — the server is ~70 LOC in server.mjs using only
# `node:http` and `node:fs`.
#
# After `make build`:
#
# export ANTHROPIC_API_KEY=sk-ant-…
# make ask-demo
#
# Then open http://localhost:8080/ and use the "Ask" section.
:
: