diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..83d89d9 --- /dev/null +++ b/Makefile @@ -0,0 +1,23 @@ +.PHONY: setup ingest server agent up down logs + +setup: + uv sync + uv run pip install -e . + +ingest: + .venv/bin/python -m tracker.ingest -v + +agent: + ./scripts/install-launchagent.sh + +server: + ./scripts/run-server.sh + +# Ensure the periodic-ingest launchd agent is loaded, then serve the UI. +up: agent server + +down: + ./scripts/uninstall-launchagent.sh + +logs: + tail -f ~/Library/Logs/token-tracker.log diff --git a/README.md b/README.md index 85c4db2..585520c 100644 --- a/README.md +++ b/README.md @@ -25,18 +25,22 @@ Requires [uv](https://docs.astral.sh/uv/). ```sh uv sync # create .venv + install deps -uv run python -m tracker.ingest -v # first run -./scripts/run-server.sh # http://127.0.0.1:8732 +make ingest # first run +make server # http://127.0.0.1:8732 ``` ## Periodic ingest (macOS launchd) ```sh -./scripts/install-launchagent.sh # ingests every 5 minutes -tail -f ~/Library/Logs/token-tracker.log -./scripts/uninstall-launchagent.sh +make agent # ingests every 5 minutes +make logs # tail ~/Library/Logs/token-tracker.log +make down # uninstall the agent ``` +`make up` loads the launchd agent and then starts the server in one step. +The raw scripts (`scripts/run-server.sh`, `scripts/install-launchagent.sh`, +`scripts/uninstall-launchagent.sh`) still work if you'd rather skip make. + The web UI also has a **re-ingest** button that triggers `POST /api/reingest` if you don't want to wait.