-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
137 lines (115 loc) · 4.98 KB
/
Copy pathMakefile
File metadata and controls
137 lines (115 loc) · 4.98 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# EdgeTable
#
# `make` on its own lists what you can do. The short version is:
#
# make install # once
# make run
#
# Everything below is either one of those two, or a way to check that they still
# work. Targets are named for what you want, not for what they call.
APP_ID := ai.sqlite.edgetable
VENDOR ?= vendor
# Tauri's per-user data directory, which is where the app keeps its database.
# Platform-dependent, and worth deriving rather than hardcoding: the npm script
# this replaced had the macOS path baked in and silently did nothing elsewhere.
ifeq ($(shell uname -s),Darwin)
APP_DATA ?= $(HOME)/Library/Application Support/$(APP_ID)
else
APP_DATA ?= $(HOME)/.local/share/$(APP_ID)
endif
# Where the second device keeps its data. Anywhere will do -- the point is only
# that it is not the first device's file.
DEVICE_B_DB ?= target/device-b.db
.DEFAULT_GOAL := help
.PHONY: help install run run-second reset test selftest synccheck spike \
extensions models clean clean-all prereqs check device-b
help:
@echo "EdgeTable -- an Airtable-shaped app whose AI columns run on this machine."
@echo
@echo "Getting started"
@echo " make install everything needed to run: dependencies, extensions, models"
@echo " make run start the app"
@echo " make run-second a second window with its own database -- the sync demo"
@echo " make reset forget this device's data and start from an empty grid"
@echo
@echo "Checking it still works"
@echo " make test lint, types and UI tests. No models, no network, ~30s"
@echo " make selftest the engine end to end against real models, ~1 min"
@echo " make synccheck one sync against SQLite Cloud, from a throwaway database"
@echo " make spike measures label accuracy, latency and sync semantics"
@echo
@echo "Pieces, if you need them individually"
@echo " make extensions the three SQLite extensions (6 MB, pinned in extensions.lock)"
@echo " make models the two GGUF models (~1 GB, resumable)"
@echo " make clean remove build output"
@echo " make clean-all also remove the downloaded extensions and models"
# ---------------------------------------------------------------- getting started
## Everything a clone needs before it can run. Safe to re-run: each step skips
## what is already there.
install: extensions models
@echo
@echo "Installing web dependencies..."
@npm install --silent
@echo
@echo "Ready. Start the app with: make run"
run: guard-prereqs
@npm run tauri dev
## A second device on this machine, for demonstrating sync without a second laptop.
##
## Its own database file is the whole trick: the site id sqlite-sync identifies a
## device by lives in the database, not in the app, so two files are two devices.
## Run `make run` first -- this attaches to the dev server that starts, and its
## window would be blank without one.
run-second: guard-prereqs
@cargo build -p edgetable
@echo "second device -> $(DEVICE_B_DB)"
@EDGETABLE_DB=$(DEVICE_B_DB) ./target/debug/edgetable
## Delete both devices' databases. Rows that reached the cloud come back on the
## next sync; rows that never did are gone.
reset:
@rm -f "$(APP_DATA)/edgetable.db" "$(APP_DATA)/edgetable.db-wal" "$(APP_DATA)/edgetable.db-shm"
@rm -f $(DEVICE_B_DB) $(DEVICE_B_DB)-wal $(DEVICE_B_DB)-shm
@echo "Cleared:"
@echo " $(APP_DATA)/edgetable.db"
@echo " $(DEVICE_B_DB)"
@echo "Anything that had synced will come back on the next sync."
# Fail early and legibly rather than inside a model load. Extensions are the cheap
# half of `make install`, so checking for them catches the common "cloned and ran"
# case without stat-ing a gigabyte.
guard-prereqs:
@test -d "$(VENDOR)/extensions" || { \
echo "No extensions in $(VENDOR)/extensions."; \
echo "Run: make install"; exit 1; }
@test -d node_modules || { \
echo "No node_modules."; \
echo "Run: make install"; exit 1; }
# ------------------------------------------------------------------- checking
## Everything that needs neither a model nor a network -- the pre-commit check.
test:
cargo clippy --all-targets -- -D warnings
npx tsc --noEmit
npx playwright test
selftest:
cargo run --release -p edgetable-core --bin selftest
## Pulls only; it never inserts, so it cannot leave anything in the cloud database.
synccheck:
cargo run --release -p edgetable-core --bin synccheck
## `.env` is sourced so `make spike SPIKE_ARGS=--cloud` sees the credentials, the
## same way the Rust side picks them up through dotenvy. Without it the spike would
## silently skip its cloud step while looking like it ran everything.
spike:
@set -a; [ -f .env ] && . ./.env; set +a; python3 examples/spike.py $(SPIKE_ARGS)
# ---------------------------------------------------------------------- pieces
extensions:
@scripts/fetch-extensions.sh
models:
@scripts/fetch-models.sh
clean:
cargo clean
rm -rf dist
clean-all: clean
rm -rf $(VENDOR)
# Older names, kept so anything that already refers to them keeps working.
prereqs: extensions models
check: test
device-b: run-second