Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
52 lines (44 loc) · 1.79 KB
/
Copy pathMakefile
File metadata and controls
52 lines (44 loc) · 1.79 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
# FSP (Full Self Pointing) — Execution Command Management
#
# Usage: `make <target>`
# Running `make` or `make help` without arguments displays available commands.
# THRESHOLD: Coaching usefulness threshold (lower for verbose, higher for quiet)
THRESHOLD ?= 5
VENV_PY := .venv/bin/python
PID_FILE := fsp.pid
LOG_FILE := fsp.log
.DEFAULT_GOAL := help
.PHONY: help install dev start stop
help: ## Display available commands
@echo "FSP Execution Commands:"
@grep -E '^[a-zA-Z_-]+:.*## ' $(MAKEFILE_LIST) \
| awk 'BEGIN{FS=":.*## "}{printf " \033[36m%-14s\033[0m %s\n", $$1, $$2}'
@echo ""
@echo "Option Guide:"
@echo " \033[36mTHRESHOLD=N\033[0m Specify coaching usefulness threshold (Default: 5)"
@echo " - Lower values make it more verbose (e.g., THRESHOLD=3)"
@echo " - Higher values make it quieter/essential only (e.g., THRESHOLD=7)"
@echo " Usage Examples: make dev THRESHOLD=3"
@echo " make start THRESHOLD=7"
install: ## Install/Sync dependencies (uv sync)
uv sync
dev: ## Run in development mode (foreground, exit with Ctrl+C)
@test -x $(VENV_PY) || uv sync
FSP_THRESHOLD=$(THRESHOLD) $(VENV_PY) start.py
start: ## Run the coach in background (daemon mode, logs to fsp.log)
@test -x $(VENV_PY) || uv sync
@if [ -f $(PID_FILE) ]; then \
echo "FSP is already running (PID: $$(cat $(PID_FILE)))"; \
else \
FSP_THRESHOLD=$(THRESHOLD) $(VENV_PY) start.py > $(LOG_FILE) 2>&1 & echo $$! > $(PID_FILE); \
echo "FSP started in background (PID: $$(cat $(PID_FILE)), Log: $(LOG_FILE))"; \
fi
stop: ## Stop the background daemon
@if [ -f $(PID_FILE) ]; then \
PID=$$(cat $(PID_FILE)); \
kill $$PID 2>/dev/null || true; \
rm -f $(PID_FILE); \
echo "FSP stopped (PID: $$PID)."; \
else \
echo "FSP is not running (fsp.pid not found)."; \
fi