-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
Β·141 lines (124 loc) Β· 5.04 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
Β·141 lines (124 loc) Β· 5.04 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
#!/bin/bash
# AVC (Agent View Controller) β Universal Installer
# Installs the avc binary and configures skills for all major AI agents.
#
# Usage:
# curl -sSL https://raw.githubusercontent.com/study8677/Agent_View_Controller-AVC/main/install.sh | bash
#
# Install location for the binary, in order of preference:
# 1. $AVC_INSTALL_DIR (if set)
# 2. ~/.local/bin (no sudo, if in PATH)
# 3. ~/bin (no sudo, if in PATH)
# 4. /usr/local/bin (requires sudo)
set -e
GREEN='\033[0;32m'
BLUE='\033[0;34m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
NC='\033[0m'
REQUIRED_GO_MAJOR=1
REQUIRED_GO_MINOR=24
echo ""
echo -e "${BLUE}ποΈ AVC β Agent View Controller Installer${NC}"
echo -e " The visual layer for CLI coding agents"
echo ""
# βββ Prerequisites Check βββ
if ! command -v go &>/dev/null; then
echo -e "${RED}β Go is required but not installed.${NC}"
echo " Install Go ${REQUIRED_GO_MAJOR}.${REQUIRED_GO_MINOR}+: https://go.dev/dl/"
exit 1
fi
# Parse go version output: "go version go1.25.6 darwin/arm64" β "1.25"
GO_VERSION=$(go version | awk '{print $3}' | sed 's/go//')
GO_MAJOR=$(echo "$GO_VERSION" | cut -d. -f1)
GO_MINOR=$(echo "$GO_VERSION" | cut -d. -f2)
if [ "$GO_MAJOR" -lt "$REQUIRED_GO_MAJOR" ] || \
{ [ "$GO_MAJOR" -eq "$REQUIRED_GO_MAJOR" ] && [ "$GO_MINOR" -lt "$REQUIRED_GO_MINOR" ]; }; then
echo -e "${YELLOW}β Go ${GO_VERSION} detected. AVC needs Go ${REQUIRED_GO_MAJOR}.${REQUIRED_GO_MINOR}+. Attempting build anyway...${NC}"
fi
# βββ Pick an install dir (prefer no-sudo) βββ
pick_install_dir() {
# 1) explicit override
if [ -n "${AVC_INSTALL_DIR:-}" ]; then
echo "$AVC_INSTALL_DIR"
return
fi
# 2-3) any user-owned bin dir already in PATH
local candidate
for candidate in "$HOME/.local/bin" "$HOME/bin"; do
if [ -d "$candidate" ] && echo "$PATH" | tr ':' '\n' | grep -qx "$candidate"; then
echo "$candidate"
return
fi
done
# 4) fallback
echo "/usr/local/bin"
}
INSTALL_DIR="$(pick_install_dir)"
NEEDS_SUDO=0
if [ ! -w "$INSTALL_DIR" ] && [ "$(id -u)" -ne 0 ]; then
NEEDS_SUDO=1
fi
# βββ Clone / Update source tree βββ
AVC_DIR="${TMPDIR:-/tmp}/avc-install-$$"
trap 'rm -rf "$AVC_DIR"' EXIT INT TERM
echo "π₯ Cloning AVC source to $AVC_DIR..."
git clone --quiet --depth 1 https://github.com/study8677/Agent_View_Controller-AVC.git "$AVC_DIR"
cd "$AVC_DIR"
# βββ Build βββ
echo "π¨ Building avc binary..."
if ! CGO_ENABLED=1 go build -ldflags "-X main.version=$(git rev-parse --short HEAD)" -o avc .; then
echo -e "${RED}β Build failed.${NC} See output above."
exit 1
fi
echo -e "${GREEN}β
Build OK${NC} ($(du -h avc | cut -f1) binary)"
# βββ Install Binary βββ
echo "π¦ Installing to $INSTALL_DIR/avc..."
if [ "$NEEDS_SUDO" -eq 1 ]; then
echo -e "${YELLOW} $INSTALL_DIR is not writable β using sudo (will prompt for password).${NC}"
echo " To avoid sudo next time: create ~/.local/bin and add it to PATH,"
echo " or run with AVC_INSTALL_DIR=/path/you/own"
sudo install -m 755 avc "$INSTALL_DIR/avc"
else
install -m 755 avc "$INSTALL_DIR/avc"
fi
# βββ Verify βββ
if ! command -v avc &>/dev/null; then
echo -e "${YELLOW}β avc installed to $INSTALL_DIR but not found in PATH.${NC}"
echo " Add this to your shell rc: export PATH=\"$INSTALL_DIR:\$PATH\""
else
INSTALLED_VERSION="$(avc --version 2>/dev/null || echo 'unknown')"
echo -e "${GREEN}β
avc installed${NC} ($(command -v avc), version $INSTALLED_VERSION)"
fi
# βββ Install Skills βββ
SKILL_SRC="$AVC_DIR/skills/avc"
INSTALLED=()
install_skill() {
local label="$1" dir="$2"
mkdir -p "$dir"
cp "$SKILL_SRC/SKILL.md" "$dir/SKILL.md"
INSTALLED+=("$label β ${dir/$HOME/~}")
}
# Auto-detect each agent by presence of its config dir OR its CLI in PATH
[ -d "$HOME/.codex" ] || command -v codex &>/dev/null && install_skill "Codex CLI" "$HOME/.codex/skills/avc"
[ -d "$HOME/.claude" ] || command -v claude &>/dev/null && install_skill "Claude Code" "$HOME/.claude/skills/avc"
[ -d "$HOME/.gemini" ] && install_skill "Gemini CLI" "$HOME/.gemini/skills/avc"
[ -d "$HOME/.copilot" ] && install_skill "GitHub Copilot" "$HOME/.copilot/skills/avc"
# If no agent detected, install to common Claude + Codex paths so things still work
if [ ${#INSTALLED[@]} -eq 0 ]; then
echo -e "${YELLOW} No agent config dir detected. Installing to ~/.claude and ~/.codex anyway.${NC}"
install_skill "Claude Code (default)" "$HOME/.claude/skills/avc"
install_skill "Codex CLI (default)" "$HOME/.codex/skills/avc"
fi
# βββ Done βββ
echo ""
echo -e "${GREEN}π AVC installed successfully!${NC}"
echo ""
echo " Skills installed for:"
for item in "${INSTALLED[@]}"; do
echo -e " ${GREEN}β${NC} $item"
done
echo ""
echo " Test it (pops up a window because we bypass the threshold):"
echo -e " ${BLUE}echo '{\"view\":\"plan\",\"title\":\"Hello AVC\",\"data\":{\"steps\":[{\"id\":1,\"label\":\"It works!\",\"status\":\"pending\"}]}}' | avc --no-threshold${NC}"
echo ""