forked from kfastov/tgcli
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·56 lines (48 loc) · 1.52 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·56 lines (48 loc) · 1.52 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
#!/usr/bin/env bash
set -euo pipefail
SKILL_REPO="dapi/tgcli"
SKILL_NAME="tgcli"
info() { printf '\033[1;34m%s\033[0m\n' "$*"; }
ok() { printf '\033[1;32m%s\033[0m\n' "$*"; }
warn() { printf '\033[1;33m%s\033[0m\n' "$*"; }
error() { printf '\033[1;31m%s\033[0m\n' "$*" >&2; }
# Activate node version managers if npm is not already in PATH
if ! command -v npm >/dev/null 2>&1; then
set +u # version managers use unset variables
if command -v mise >/dev/null 2>&1; then
eval "$(mise activate bash 2>/dev/null)" || true
eval "$(mise env 2>/dev/null)" || true
fi
if [ -s "${HOME:-}/.nvm/nvm.sh" ]; then
. "$HOME/.nvm/nvm.sh"
fi
if command -v fnm >/dev/null 2>&1; then
eval "$(fnm env 2>/dev/null)" || true
fi
set -u
fi
if ! command -v node >/dev/null 2>&1; then
error "Node.js is required but not found. Install it first: https://nodejs.org"
exit 1
fi
if ! command -v npm >/dev/null 2>&1; then
error "npm is required but not found."
exit 1
fi
# Install or update CLI via npm
info "Installing tgcli..."
npm install -g @dapi/tgcli
ok "tgcli $(tgcli --version 2>/dev/null || echo 'installed')"
# Install or update skill
if command -v npx >/dev/null 2>&1; then
info "Installing tgcli skill for AI agents..."
npx skills add "$SKILL_REPO" --skill "$SKILL_NAME" --agent '*' -g -y
ok "Skill '$SKILL_NAME' installed"
else
warn "npx not found — skipping skill installation"
fi
echo ""
ok "Done!"
if ! tgcli auth status >/dev/null 2>&1; then
info "Next step: run 'tgcli auth' to log in to Telegram"
fi