Files
flynn/Makefile
T

131 lines
3.9 KiB
Makefile

# Flynn Makefile
# Self-hosted personal AI agent
.PHONY: build dev start stop restart status logs tui tui-fs tui-dev test test-run lint typecheck check help deps install daemon-start daemon-stop daemon-restart daemon-status daemon-logs enable disable llama-start llama-stop llama-restart llama-status llama-logs llama-enable llama-disable
# Default target
.DEFAULT_GOAL := help
# Build and development
build: ## Compile TypeScript to dist/
pnpm build
dev: ## Run daemon with watch mode
pnpm dev
start: ## Start production build (foreground)
node dist/cli/index.js start
# Systemd daemon management
daemon-start: ## Start the systemd service
systemctl --user start flynn.service
@echo "Flynn daemon started"
daemon-stop: ## Stop the systemd service
systemctl --user stop flynn.service
@echo "Flynn daemon stopped"
daemon-restart: ## Restart the systemd service
systemctl --user restart flynn.service
@echo "Flynn daemon restarted"
daemon-status: ## Check systemd service status
systemctl --user status flynn.service
daemon-logs: ## Show systemd service logs
journalctl --user -u flynn.service -f
enable: ## Enable Flynn to start on boot
systemctl --user enable flynn.service
@echo "Flynn enabled to start on boot"
disable: ## Disable Flynn from starting on boot
systemctl --user disable flynn.service
@echo "Flynn disabled from starting on boot"
# Llama-server daemon management
llama-start: ## Start the llama-server systemd service
systemctl --user start llama-server.service
@echo "Llama-server daemon started"
llama-stop: ## Stop the llama-server systemd service
systemctl --user stop llama-server.service
@echo "Llama-server daemon stopped"
llama-restart: ## Restart the llama-server systemd service
systemctl --user restart llama-server.service
@echo "Llama-server daemon restarted"
llama-status: ## Check llama-server systemd service status
systemctl --user status llama-server.service
llama-logs: ## Show llama-server systemd service logs
journalctl --user -u llama-server.service -f
llama-enable: ## Enable llama-server to start on boot
systemctl --user enable llama-server.service
@echo "Llama-server enabled to start on boot"
llama-disable: ## Disable llama-server from starting on boot
systemctl --user disable llama-server.service
@echo "Llama-server disabled from starting on boot"
# Aliases for convenience
stop: daemon-stop ## Alias for daemon-stop
restart: daemon-restart ## Alias for daemon-restart
status: daemon-status ## Alias for daemon-status
logs: daemon-logs ## Alias for daemon-logs
# TUI commands
tui: ## Run TUI in minimal mode (readline)
pnpm tui
tui-fs: ## Run TUI in fullscreen mode (React/Ink)
pnpm tui:fs
tui-dev: ## Run TUI with watch mode
pnpm tui:dev
# Testing
test: ## Run tests in watch mode
pnpm test
test-run: ## Run tests once (no watch)
pnpm test:run
# Quality checks
lint: ## Run ESLint
pnpm lint
typecheck: ## Run TypeScript compiler (no emit)
pnpm typecheck
check: lint typecheck test-run ## Run all checks (lint, typecheck, test)
# Dependencies
deps: ## Install dependencies
pnpm install
install: ## Install flynn CLI as a shell command (global link or ~/.local/bin fallback)
pnpm install
pnpm build
@set -e; \
if pnpm link --global; then \
echo "flynn installed via pnpm global link."; \
else \
echo "pnpm global bin is not configured; installing fallback shim at $$HOME/.local/bin/flynn"; \
mkdir -p "$$HOME/.local/bin"; \
chmod +x "$(CURDIR)/dist/cli/index.js"; \
ln -sf "$(CURDIR)/dist/cli/index.js" "$$HOME/.local/bin/flynn"; \
case ":$$PATH:" in \
*":$$HOME/.local/bin:"*) echo "flynn installed at $$HOME/.local/bin/flynn";; \
*) echo "flynn installed at $$HOME/.local/bin/flynn (add $$HOME/.local/bin to PATH)";; \
esac; \
fi
# Utilities
help: ## Show this help message
@echo "Flynn - Self-hosted personal AI agent"
@echo ""
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-15s\033[0m %s\n", $$1, $$2}'