-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
78 lines (67 loc) · 3.71 KB
/
Copy pathMakefile
File metadata and controls
78 lines (67 loc) · 3.71 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
# Potpie root Makefile
#
# Installs the local `potpie` CLI globally. The day-to-day dev
# stack (infra, API, worker, migrations, tests) lives in legacy/Makefile — run
# those with `make -C legacy <target>`.
#
# Quick start:
# make cli-install # build graph-explorer UI + install potpie on your PATH (editable)
# make cli-status # confirm the install is healthy
# make help # list all targets
SHELL := /bin/bash
.SHELLFLAGS := -eu -o pipefail -c
.DEFAULT_GOAL := help
.PHONY: help ui-build cli-install cli-update cli-uninstall cli-status
##@ Help
help: ## Show this help
@awk 'BEGIN {FS = ":.*?## "} \
/^##@ / {sub(/^##@ /, ""); printf "\n\033[1m%s\033[0m\n", $$0; next} \
/^[a-zA-Z_-]+:.*?## / {printf " \033[36m%-16s\033[0m %s\n", $$1, $$2}' \
$(MAKEFILE_LIST)
##@ Potpie CLI
# The `potpie` CLI installs from the root distribution in EDITABLE mode:
# the global `potpie` / `potpie-mcp` on your PATH run straight from the repo
# source, so code changes — including the in-process daemon — are live on the
# next invocation with no reinstall. The CLI also auto-loads this repo's .env
# (Neo4j/Postgres creds) regardless of which directory you run it from, so a
# global `potpie` reaches your local backends out of the box. Re-run
# `make cli-install` only when dependencies or entry points change.
CE_DIR := potpie/context-engine
UI_FRONTEND_DIR := $(CE_DIR)/adapters/inbound/http/ui/frontend
CLI_TOOL := potpie
CLI_PYTHON ?= >=3.12,<3.14
ui-build: ## Build the graph-explorer SPA (npm install + vite) into frontend/dist
@command -v npm >/dev/null 2>&1 || { echo "❌ npm not installed — see https://nodejs.org/"; exit 1; }
cd $(UI_FRONTEND_DIR) && npm install && npm run build
cli-install: ui-build ## Install potpie + potpie-mcp globally from the root package. Re-run after dep/entrypoint changes.
@command -v uv >/dev/null 2>&1 || { echo "❌ uv not installed — see https://docs.astral.sh/uv/"; exit 1; }
@# Drop the pre-rename "context-engine" tool if a stale copy is lingering.
-@uv tool uninstall context-engine >/dev/null 2>&1 || true
@# Stop any old detached daemon before replacing the tool env; otherwise the
@# fresh CLI can still talk to a daemon running the previous Python/backend.
-@if command -v potpie >/dev/null 2>&1; then potpie daemon stop >/dev/null 2>&1; fi
uv tool install --python '$(CLI_PYTHON)' --force --editable "."
@case ":$$PATH:" in \
*":$$HOME/.local/bin:"*) echo "✓ potpie installed (editable). Try: potpie --help";; \
*) echo "✓ installed, but $$HOME/.local/bin is not on PATH — run: uv tool update-shell, then restart your shell";; \
esac
cli-update: cli-install ## Refresh the global install (alias for cli-install; code is already live via editable mode)
cli-uninstall: ## Remove the global potpie CLI
-@if command -v potpie >/dev/null 2>&1; then potpie daemon stop >/dev/null 2>&1; fi
-uv tool uninstall $(CLI_TOOL)
-@uv tool uninstall context-engine >/dev/null 2>&1 || true
cli-status: ## Show the global potpie install + run a quick health check
@uv tool list 2>/dev/null | grep -A2 '^$(CLI_TOOL)' || echo "$(CLI_TOOL): not installed (run: make cli-install)"
@printf 'on PATH: '; command -v potpie || echo "potpie NOT on PATH"
@if command -v potpie >/dev/null 2>&1; then \
py="$$(head -n 1 "$$(command -v potpie)" | sed 's/^#!//')"; \
printf 'python: '; "$$py" --version; \
else \
echo "python: unknown"; \
fi
@potpie --help >/dev/null 2>&1 && echo "health: ✓ potpie runs current source" || echo "health: ✗ potpie failed (run: make cli-install)"
@if [ -f "$(UI_FRONTEND_DIR)/dist/index.html" ]; then \
echo "ui: ✓ graph explorer built ($(UI_FRONTEND_DIR)/dist)"; \
else \
echo "ui: ✗ not built (run: make ui-build)"; \
fi