-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·67 lines (59 loc) · 1.81 KB
/
install.sh
File metadata and controls
executable file
·67 lines (59 loc) · 1.81 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
#!/usr/bin/env bash
# install.sh — Set up claude-code-reminders: install deps, create .env, install cron.
set -euo pipefail
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
echo "=== claude-code-reminders setup ==="
echo ""
# 1. Check Node version
NODE_PATH=$(which node 2>/dev/null || true)
if [[ -z "$NODE_PATH" ]]; then
echo "Error: Node.js not found. Install Node.js >= 18: https://nodejs.org"
exit 1
fi
NODE_VER=$("$NODE_PATH" -e "console.log(process.versions.node.split('.')[0])")
if [[ "$NODE_VER" -lt 18 ]]; then
echo "Error: Node.js >= 18 required (found v$("$NODE_PATH" --version))"
exit 1
fi
echo "Node.js: $("$NODE_PATH" --version)"
# 2. Install dependencies
echo "Installing dependencies..."
cd "$DIR" && npm install --silent
echo "Done."
echo ""
# 3. Create .env if missing
if [[ ! -f "$DIR/.env" ]]; then
cp "$DIR/.env.example" "$DIR/.env"
echo "Created .env from template. Edit it with your Telegram token and chat ID:"
echo " $DIR/.env"
echo ""
fi
# 4. Install cron job (skip if crontab not available)
if command -v crontab &>/dev/null; then
CRON_CMD="* * * * * cd \"$DIR\" && \"$NODE_PATH\" \"$DIR/check.js\" >> \"$DIR/check.log\" 2>&1"
if crontab -l 2>/dev/null | grep -qF "claude-code-reminders/check.js"; then
echo "Cron job already installed."
else
(crontab -l 2>/dev/null || true; echo "$CRON_CMD") | crontab -
echo "Cron job installed: every minute."
fi
else
echo "Warning: crontab not found. Set up a cron job manually:"
echo " * * * * * cd \"$DIR\" && node check.js >> check.log 2>&1"
fi
echo ""
# 5. Show .mcp.json snippet
echo "Add this to your Claude Code MCP config (.mcp.json or ~/.claude/.mcp.json):"
echo ""
cat <<JSONEOF
{
"mcpServers": {
"reminders": {
"command": "node",
"args": ["$DIR/server.js"]
}
}
}
JSONEOF
echo ""
echo "Setup complete!"