-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathMakefile
More file actions
147 lines (129 loc) · 4.61 KB
/
Makefile
File metadata and controls
147 lines (129 loc) · 4.61 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
.PHONY: install login dev start build status clean help test test-watch test-coverage lint typecheck check pw-install pw-dev pw-build
# Default target
help:
@echo "Mini-Claw - Lightweight Telegram AI Bot"
@echo ""
@echo "Quick Start:"
@echo " make install Install dependencies"
@echo " make login Authenticate with AI provider (Claude/ChatGPT)"
@echo " make dev Start in development mode"
@echo ""
@echo "Commands:"
@echo " make install Install pnpm dependencies + pi-coding-agent"
@echo " make login Run 'pi /login' to authenticate"
@echo " make dev Start bot with hot reload"
@echo " make start Start bot in production mode"
@echo " make build Compile TypeScript"
@echo " make status Check Pi auth status"
@echo " make clean Remove build artifacts"
@echo ""
@echo "Quality:"
@echo " make test Run tests"
@echo " make lint Run ESLint"
@echo " make typecheck Run TypeScript type checking"
@echo " make check Run all checks (lint + typecheck + test)"
@echo ""
@echo "Playwright Skill:"
@echo " make pw-install Install and link pw CLI globally"
@echo " make pw-build Build Playwright skill"
@echo " make pw-dev Start Playwright skill in dev mode"
@echo ""
@echo "Setup:"
@echo " 1. make install"
@echo " 2. make login"
@echo " 3. cp .env.example .env && edit .env"
@echo " 4. make dev"
# Install dependencies
install:
@echo "Installing pnpm dependencies..."
pnpm install
@echo ""
@echo "Checking pi-coding-agent..."
@which pi > /dev/null 2>&1 || (echo "Installing pi-coding-agent globally..." && npm install -g @mariozechner/pi-coding-agent)
@echo ""
@echo "Done! Next steps:"
@echo " 1. Run 'make login' to authenticate with Claude/ChatGPT"
@echo " 2. Copy .env.example to .env and add your Telegram bot token"
@echo " 3. Run 'make dev' to start the bot"
# Login to AI provider
login:
@echo "Starting Pi login..."
@echo "Select your AI provider (Anthropic for Claude, OpenAI for ChatGPT)"
@echo ""
pi /login
# Development mode with hot reload
dev:
@test -f .env || (echo "Error: .env file not found. Copy .env.example to .env first." && exit 1)
pnpm dev
# Production start
start:
@test -f .env || (echo "Error: .env file not found." && exit 1)
pnpm build
pnpm start
# Build TypeScript
build:
pnpm build
# Check Pi status
status:
@echo "Checking Pi installation..."
@which pi > /dev/null 2>&1 && echo "Pi: installed at $$(which pi)" || echo "Pi: NOT INSTALLED"
@echo ""
@echo "Checking Pi auth..."
@pi --version 2>/dev/null && echo "Pi: OK" || echo "Pi: not authenticated or not working"
# Run tests
test:
pnpm test
# Run tests in watch mode
test-watch:
pnpm test:watch
# Run tests with coverage
test-coverage:
pnpm test:coverage
# Run ESLint
lint:
pnpm lint
# Run TypeScript type checking
typecheck:
pnpm typecheck
# Run all checks
check: lint typecheck test
# Clean build artifacts
clean:
@command -v rip > /dev/null 2>&1 && rip dist node_modules/.cache 2>/dev/null || rm -rf dist node_modules/.cache
# Install systemd service (Linux)
install-service:
@echo "Creating systemd user service..."
@mkdir -p ~/.config/systemd/user
@echo "[Unit]" > ~/.config/systemd/user/mini-claw.service
@echo "Description=Mini-Claw Telegram Bot" >> ~/.config/systemd/user/mini-claw.service
@echo "After=network.target" >> ~/.config/systemd/user/mini-claw.service
@echo "" >> ~/.config/systemd/user/mini-claw.service
@echo "[Service]" >> ~/.config/systemd/user/mini-claw.service
@echo "Type=simple" >> ~/.config/systemd/user/mini-claw.service
@echo "WorkingDirectory=$$(pwd)" >> ~/.config/systemd/user/mini-claw.service
@echo "ExecStart=$$(which node) $$(pwd)/dist/index.js" >> ~/.config/systemd/user/mini-claw.service
@echo "Restart=on-failure" >> ~/.config/systemd/user/mini-claw.service
@echo "RestartSec=5" >> ~/.config/systemd/user/mini-claw.service
@echo "" >> ~/.config/systemd/user/mini-claw.service
@echo "[Install]" >> ~/.config/systemd/user/mini-claw.service
@echo "WantedBy=default.target" >> ~/.config/systemd/user/mini-claw.service
@echo ""
@echo "Service created. Run:"
@echo " systemctl --user daemon-reload"
@echo " systemctl --user start mini-claw"
@echo " systemctl --user enable mini-claw"
# Playwright skill targets
pw-install:
@echo "Installing Playwright skill..."
cd skills/playwright && pnpm install
@echo ""
@echo "Linking pw command globally..."
cd skills/playwright && pnpm link --global
@echo ""
@echo "Done! Test with: pw --help"
pw-dev:
@echo "Starting Playwright skill in dev mode..."
cd skills/playwright && pnpm dev
pw-build:
@echo "Building Playwright skill..."
cd skills/playwright && pnpm build