-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
54 lines (48 loc) · 2.11 KB
/
Makefile
File metadata and controls
54 lines (48 loc) · 2.11 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
# Makefile — shortcuts for the PhyslibSearch indexing pipeline.
#
# Before running these commands, export the following variables
# (or add them to your shell profile):
#
# export DBNAME=physlibsearch
# export INDEXED_REPO_PATH=/path/to/physlib
# export MODULE_NAMES=Physlib,QuantumInfo
# export CHROMA_PATH=chroma
check_env:
@test -n "$(DBNAME)" || (echo "Please set DBNAME" && exit 1)
@test -n "$(INDEXED_REPO_PATH)" || (echo "Please set INDEXED_REPO_PATH" && exit 1)
@test -n "$(MODULE_NAMES)" || (echo "Please set MODULE_NAMES" && exit 1)
@test -n "$(CHROMA_PATH)" || (echo "Please set CHROMA_PATH" && exit 1)
# Drop and recreate the database, clear ChromaDB, rebuild the Lean project.
reset: check_env
@echo "\n==> Dropping and recreating PostgreSQL database '$(DBNAME)'..."
-dropdb $(DBNAME)
createdb $(DBNAME)
@echo "\n==> Clearing ChromaDB files..."
rm -rf $(CHROMA_PATH)
@echo "\n==> Cleaning and rebuilding Lean project..."
cd $(INDEXED_REPO_PATH) && lake clean && lake build
cd $(INDEXED_REPO_PATH) && rm -rf ./.jixia
@echo "\n==> Creating database schema..."
python3 -m database schema
@echo "\n==> Done."
# Parse Lean source with jixia and populate PostgreSQL.
jixia: reset
@echo "\n==> Parsing project with jixia..."
python3 -m database jixia $(INDEXED_REPO_PATH) $(MODULE_NAMES)
# Generate informal (natural-language) descriptions via Gemini.
informal: jixia
@echo "\n==> Generating informal descriptions with Gemini..."
python3 -m database informal
# Create vector embeddings via Gemini and store in ChromaDB.
index: informal
@echo "\n==> Creating embeddings with Gemini..."
python3 -m database vector-db
# Deploy to Heroku via Docker container push (bypasses git large-file limits).
# chroma/ is gitignored but must be present on disk — restore with:
# git fetch heroku && git checkout heroku/main -- chroma/
deploy:
@echo "\n==> Building and pushing Docker image to Heroku..."
heroku container:push web --app physlibsearch
@echo "\n==> Releasing..."
heroku container:release web --app physlibsearch
@echo "\n==> Done. Visit https://physlibsearch.net"