-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·88 lines (80 loc) · 3.76 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·88 lines (80 loc) · 3.76 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
#!/usr/bin/env bash
# StackGen Cursor Plugin — Local Installer
# Installs the plugin into Cursor without needing the Marketplace.
# Usage: bash install.sh
set -euo pipefail
command -v python3 >/dev/null || { echo "❌ python3 is required. Install it and retry."; exit 1; }
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
PLUGIN_NAME="stackgen"
PLUGIN_ID="${PLUGIN_NAME}@local"
TARGET="$HOME/.cursor/plugins/$PLUGIN_NAME"
CLAUDE_PLUGINS="$HOME/.claude/plugins/installed_plugins.json"
CLAUDE_SETTINGS="$HOME/.claude/settings.json"
echo "🔧 Installing StackGen plugin into Cursor..."
# ── Step 1: Copy plugin files ─────────────────────────────────────────────────
echo " [1/4] Copying plugin files to $TARGET"
rm -rf "$TARGET"
mkdir -p "$TARGET"
for dir in .cursor-plugin skills rules mcp.json README.md CHANGELOG.md LICENSE; do
src="$SCRIPT_DIR/$dir"
[ -e "$src" ] && cp -R "$src" "$TARGET/"
done
# ── Step 2: Register in ~/.claude/plugins/installed_plugins.json ─────────────
echo " [2/4] Registering plugin in ~/.claude/plugins/installed_plugins.json"
mkdir -p "$(dirname "$CLAUDE_PLUGINS")"
python3 - "$CLAUDE_PLUGINS" "$PLUGIN_ID" "$TARGET" <<'PY'
import json, os, sys
path, pid, ipath = sys.argv[1], sys.argv[2], sys.argv[3]
data = {}
if os.path.exists(path):
try: data = json.load(open(path))
except: data = {}
plugins = data.get("plugins", {})
entries = [e for e in plugins.get(pid, [])
if not (isinstance(e, dict) and e.get("scope") == "user")]
entries.insert(0, {"scope": "user", "installPath": ipath})
plugins[pid] = entries
data["plugins"] = plugins
os.makedirs(os.path.dirname(path), exist_ok=True)
json.dump(data, open(path, "w"), indent=2)
print(" ✓ Registered")
PY
# ── Step 3: Enable in ~/.claude/settings.json ─────────────────────────────────
echo " [3/4] Enabling plugin in ~/.claude/settings.json"
python3 - "$CLAUDE_SETTINGS" "$PLUGIN_ID" <<'PY'
import json, os, sys
path, pid = sys.argv[1], sys.argv[2]
data = {}
if os.path.exists(path):
try: data = json.load(open(path))
except: data = {}
data.setdefault("enabledPlugins", {})[pid] = True
os.makedirs(os.path.dirname(path), exist_ok=True)
json.dump(data, open(path, "w"), indent=2)
print(" ✓ Enabled")
PY
# ── Step 4: Enable third-party plugins via Cursor's sqlite DB (macOS) ─────────
echo " [4/4] Enabling third-party plugin loading in Cursor settings"
DB="$HOME/Library/Application Support/Cursor/User/globalStorage/state.vscdb"
if [ -f "$DB" ]; then
sqlite3 "$DB" \
"INSERT OR REPLACE INTO ItemTable (key, value)
VALUES ('cursor/thirdPartyExtensibilityEnabled', 'true');" 2>/dev/null \
&& echo " ✓ Third-party plugin loading enabled via sqlite" \
|| echo " ⚠ sqlite update skipped (Cursor may be open — try after closing it)"
else
echo " ⚠ Cursor DB not found at expected path. Enable manually:"
echo " Cursor Settings → Features → 'Include third-party Plugins, Skills, and other configs' → ON"
fi
echo ""
echo "✅ Done! Now:"
echo " 1. Restart Cursor completely"
echo " 2. Open any agent chat and ask something like:"
echo " 'Connect my StackGen workspace' or 'Show me my StackGen projects'"
echo " 3. The agent will ask for your StackGen URL and API key, then configure everything for you"
echo ""
echo " You can also run /stackgen-mcp-setup explicitly to start the setup wizard."
echo " After setup, use /stackgen-create-appstack to provision infra for the open repo."
echo ""
echo " If the plugin doesn't appear, go to:"
echo " Cursor Settings → Features → enable 'Include third-party Plugins, Skills, and other configs'"