-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
117 lines (78 loc) · 4.43 KB
/
Copy pathMakefile
File metadata and controls
117 lines (78 loc) · 4.43 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
# Dev commands for timeplus-knowledge. Run `make` (or `make help`) to list.
.DEFAULT_GOAL := help
TIMEPLUS_HOST ?= localhost
IMAGE ?= timeplus/tpk:dev
DB_CONTAINER ?= timeplusd
REPO ?=
help: ## Show available targets
@grep -E '^[a-zA-Z][a-zA-Z0-9_-]*:.*?## ' $(MAKEFILE_LIST) \
| awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-16s\033[0m %s\n", $$1, $$2}'
# --- environment -------------------------------------------------------------
sync: ## Install/sync Python dependencies (uv)
uv sync
db-up: ## Start local timeplusd with the dev small-segments override
docker run -d --name $(DB_CONTAINER) -p 8123:8123 -p 3218:3218 \
-v $(PWD)/deploy/timeplusd-dev/small-segments.yaml:/etc/timeplusd-server/config.d/small-segments.yaml:ro \
docker.timeplus.com/timeplus/timeplusd:latest
db-down: ## Stop and remove local timeplusd (DELETES its data volume)
docker rm -f -v $(DB_CONTAINER)
db-logs: ## Tail local timeplusd logs
docker logs -f $(DB_CONTAINER)
# --- tests -------------------------------------------------------------------
test: ## Run the full test suite against local Timeplus
TIMEPLUS_HOST=$(TIMEPLUS_HOST) uv run pytest -q
test-unit: ## Run only unit tests (integration tests skip without TIMEPLUS_HOST)
uv run pytest -q
# --- knowledge graph ---------------------------------------------------------
ingest: ## Ingest all repos from repos.toml
TIMEPLUS_HOST=$(TIMEPLUS_HOST) uv run tpk ingest
ingest-repo: ## Ingest one repo: make ingest-repo REPO=docs
@test -n "$(REPO)" || { echo "usage: make ingest-repo REPO=<name>"; exit 1; }
TIMEPLUS_HOST=$(TIMEPLUS_HOST) uv run tpk ingest --repo $(REPO)
status: ## Show the last ingest run per repo
TIMEPLUS_HOST=$(TIMEPLUS_HOST) uv run tpk status
# --- MCP ---------------------------------------------------------------------
mcp: ## Run the MCP server on stdio (Ctrl-D to exit)
TIMEPLUS_HOST=$(TIMEPLUS_HOST) uv run python -m tpk.mcp_server
mcp-register: ## Register the MCP server with Claude Code (this checkout)
claude mcp add timeplus-knowledge -- uv --directory $(PWD) run python -m tpk.mcp_server
# --- chat agent & web UI ------------------------------------------------------
serve: ## Run the chat server locally (needs agent env + populated graph)
TIMEPLUS_HOST=$(TIMEPLUS_HOST) uv run tpk serve
web-build: ## Build the React UI into web/dist
cd web && npm install && npm run build
web-dev: ## Run the Vite dev server (proxies /chat to :8000)
cd web && npm install && npm run dev
# --- docker compose: DB + App (production-shaped) ----------------------------
up: ## Start the DB + App stack via docker compose (.env for API keys)
docker compose up -d --build
down: ## Stop the DB + App stack (named data volumes are kept)
docker compose down
compose-ingest: ## Ingest inside the running app container
docker compose exec app tpk ingest
compose-status: ## tpk status inside the running app container
docker compose exec app tpk status
# --- docker compose: all-in-one (single container, test/local) ---------------
ALLINONE ?= docker-compose.allinone.yml
up-allinone: ## Start the single-container all-in-one stack
docker compose -f $(ALLINONE) up -d --build
down-allinone: ## Stop the all-in-one stack (named data volumes are kept)
docker compose -f $(ALLINONE) down
# --- docker image builds -----------------------------------------------------
# Two images map to the two deployment modes:
# all-in-one image -> all-in-one mode (timeplusd + tpk in one container)
# app image -> DB + App mode (the db service uses stock timeplusd)
APP_IMAGE ?= timeplus/tpk-app:dev
docker-build-allinone: ## Build the all-in-one image (timeplusd + tpk)
docker build -f deploy/docker/Dockerfile --target allinone -t $(IMAGE) .
docker-build-app: ## Build the tpk app-only image (pure-Python; no timeplusd)
docker build -f deploy/docker/Dockerfile --target app -t $(APP_IMAGE) .
docker-build: docker-build-allinone docker-build-app ## Build both deployable images
# --- hygiene -----------------------------------------------------------------
clean: ## Remove local scratch (graphify output, __pycache__)
rm -rf .graphify_out
find . -name __pycache__ -type d -not -path './.venv/*' -prune -exec rm -rf {} +
.PHONY: help sync db-up db-down db-logs test test-unit ingest ingest-repo \
status mcp mcp-register serve web-build web-dev up down compose-ingest \
compose-status up-allinone down-allinone docker-build-allinone \
docker-build-app docker-build clean