-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·73 lines (61 loc) · 2.02 KB
/
install.sh
File metadata and controls
executable file
·73 lines (61 loc) · 2.02 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
#!/bin/bash
# ctxcraft installer — Evaluate and optimize your AI agent context
#
# Global install (default — available in all projects):
# curl -sL https://raw.githubusercontent.com/warrenth/ctxcraft/main/install.sh | bash
#
# Project-local install:
# curl -sL https://raw.githubusercontent.com/warrenth/ctxcraft/main/install.sh | bash -s -- --local
set -e
REPO_URL="https://github.com/warrenth/ctxcraft.git"
TEMP_DIR=$(mktemp -d)
# Parse flags
INSTALL_MODE="global"
for arg in "$@"; do
case "$arg" in
--local) INSTALL_MODE="local" ;;
--global) INSTALL_MODE="global" ;;
esac
done
if [ "$INSTALL_MODE" = "global" ]; then
TARGET_DIR="$HOME/.claude"
LABEL="globally (~/.claude/)"
else
TARGET_DIR=".claude"
LABEL="locally (.claude/)"
fi
echo "🔧 ctxcraft — Token Efficiency Toolkit"
echo "========================================"
echo " Install target: $LABEL"
echo ""
# Ensure target directories exist
mkdir -p "$TARGET_DIR/skills" "$TARGET_DIR/rules" "$TARGET_DIR/agents"
# Clone repo to temp
echo "📥 Downloading ctxcraft..."
git clone --quiet --depth 1 "$REPO_URL" "$TEMP_DIR/ctxcraft"
# Copy skills
echo "📦 Installing skills..."
cp -r "$TEMP_DIR/ctxcraft/skills/"* "$TARGET_DIR/skills/" 2>/dev/null || true
# Copy agents
echo "📦 Installing agents..."
cp -r "$TEMP_DIR/ctxcraft/agents/"* "$TARGET_DIR/agents/" 2>/dev/null || true
# Copy rules (ask first — rules are loaded every conversation)
echo ""
read -p "📋 Install token-efficiency rules? (loaded every conversation) [y/N] " -n 1 -r
echo ""
if [[ $REPLY =~ ^[Yy]$ ]]; then
cp "$TEMP_DIR/ctxcraft/rules/token-efficiency.md" "$TARGET_DIR/rules/" 2>/dev/null || true
echo " ✅ Rules installed"
else
echo " ⏭️ Skipped rules"
fi
# Cleanup
rm -rf "$TEMP_DIR"
echo ""
echo "✅ ctxcraft installed $LABEL"
echo ""
echo "Available commands in Claude Code:"
echo " /evaluate — Analyze token efficiency and get a score"
echo " /optimize — Apply optimization recommendations"
echo ""
echo "Start with: /evaluate"