-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup
More file actions
executable file
·107 lines (97 loc) · 3.79 KB
/
setup
File metadata and controls
executable file
·107 lines (97 loc) · 3.79 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
#!/usr/bin/env bash
# mstack setup — marketing skill suite for AI agents
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd -P)"
MSTACK_DIR="$HOME/.mstack"
CONFIG_FILE="$MSTACK_DIR/config.yaml"
MSTACK_CONFIG="$SCRIPT_DIR/bin/mstack-config"
# Platform detection
PLATFORM="linux"
case "$(uname -s)" in
Darwin) PLATFORM="macos" ;;
MINGW*|MSYS*|CYGWIN*|Windows_NT) PLATFORM="windows" ;;
esac
echo "mstack setup — marketing skill suite for AI agents"
echo "Platform: $PLATFORM"; echo ""
# Init config
mkdir -p "$MSTACK_DIR"
if [ ! -f "$CONFIG_FILE" ]; then
cat > "$CONFIG_FILE" <<'EOF'
# mstack configuration
proactive: true
skill_prefix: true
auto_upgrade: false
browse_path: ""
default_language: "en"
EOF
echo "Created config at $CONFIG_FILE"
fi
# Skill prefix prompt (asks once, saves to config, touches sentinel)
PREFIX_PROMPTED="$MSTACK_DIR/.prefix-prompted"
SKILL_PREFIX=1
_saved="$("$MSTACK_CONFIG" get skill_prefix 2>/dev/null || true)"
if [ ! -f "$PREFIX_PROMPTED" ] && [ -z "$_saved" ] && [ -t 0 ]; then
echo "Skill naming: how should mstack skills appear?"
echo " A) Prefixed: /m-write, /m-edit, /m-brand (default)"
echo " B) Short: /write, /edit, /brand"
printf "Choice [A/B] (auto-selects A in 10s): "
read -t 10 -r _choice </dev/tty 2>/dev/null || _choice=""
case "$_choice" in [Bb]) SKILL_PREFIX=0 ;; *) SKILL_PREFIX=1 ;; esac
"$MSTACK_CONFIG" set skill_prefix "$([ "$SKILL_PREFIX" -eq 1 ] && echo true || echo false)" 2>/dev/null || true
elif [ "$_saved" = "false" ]; then
SKILL_PREFIX=0
fi
touch "$PREFIX_PROMPTED"
# Host detection
HOSTS=()
command -v claude >/dev/null 2>&1 && HOSTS+=("claude")
command -v codex >/dev/null 2>&1 && HOSTS+=("codex")
command -v kiro-cli >/dev/null 2>&1 && HOSTS+=("kiro")
[ "${#HOSTS[@]}" -eq 0 ] && HOSTS=("claude") && echo "No AI agent CLI detected — defaulting to claude"
echo "Detected hosts: ${HOSTS[*]}"; echo ""
# Generate skill docs (bun required; otherwise use pre-generated SKILL.md files)
if command -v bun >/dev/null 2>&1; then
for host in "${HOSTS[@]}"; do
echo "Generating skill docs for $host..."
(cd "$SCRIPT_DIR" && bun run scripts/gen-skill-docs.ts --host "$host") || true
done
else
echo "bun not found — using pre-generated SKILL.md files"
fi
# Create skill symlink directories under ~/.claude/skills/
SKILLS=(brand competitive positioning icp strategy audit
keywords brief write edit seo social threads
engage ads landing repurpose calendar report
learn mstack-upgrade)
CLAUDE_SKILLS_DIR="$HOME/.claude/skills"
mkdir -p "$CLAUDE_SKILLS_DIR"
echo ""; echo "Creating skill symlinks in $CLAUDE_SKILLS_DIR..."
for skill in "${SKILLS[@]}"; do
if [ "$SKILL_PREFIX" -eq 1 ]; then
case "$skill" in mstack-*) link_name="$skill" ;; *) link_name="m-$skill" ;; esac
else
link_name="$skill"
fi
mkdir -p "$CLAUDE_SKILLS_DIR/$link_name"
if [ -f "$SCRIPT_DIR/$skill/SKILL.md" ]; then
ln -sf "$SCRIPT_DIR/$skill/SKILL.md" "$CLAUDE_SKILLS_DIR/$link_name/SKILL.md"
echo " /$link_name"
fi
done
# Detect gstack browse binary, save path to config
GSTACK_BROWSE="$HOME/.claude/skills/gstack/browse/dist/browse"
if [ -x "$GSTACK_BROWSE" ]; then
echo ""; echo "gstack browse found: $GSTACK_BROWSE"
"$MSTACK_CONFIG" set browse_path "$GSTACK_BROWSE" 2>/dev/null || true
fi
# Marketing API key check (informational)
echo ""; echo "Marketing API keys:"
for key in SEMRUSH_API_KEY AHREFS_API_KEY GA4_CREDENTIALS SEARCH_CONSOLE_CREDENTIALS; do
[ -n "${!key:-}" ] && echo " $key: set" || echo " $key: not set"
done
# Summary
prefix_label="$([ "$SKILL_PREFIX" -eq 1 ] && echo "prefixed (/m-*)" || echo "short")"
echo ""; echo "mstack setup complete!"
echo " Config: $CONFIG_FILE"
echo " Skills: $CLAUDE_SKILLS_DIR ($prefix_label)"
echo ""; echo "Type /m-write (or /write) in Claude Code to get started."