-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·79 lines (69 loc) · 2.82 KB
/
install.sh
File metadata and controls
executable file
·79 lines (69 loc) · 2.82 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
#!/usr/bin/env bash
# Markdown skill installer.
#
# Installs the markdown SKILL.md (GFM + emacs markdown-mode
# compatibility rules) into every detected coding agent. For Claude
# Code this lands as a proper plugin at ~/.claude/plugins/markdown/;
# for Codex and OpenCode it lands as a user-level skill because those
# agents don't have Claude Code's plugin/skill distinction.
#
# Re-running the script is the canonical way to sync edits from
# plugins/skills/markdown/SKILL.md into whichever agent caches expect
# the file to live on disk.
set -e
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
SRC_SKILL="$SCRIPT_DIR/plugins/skills/markdown"
SRC_CC_PLUGIN="$SCRIPT_DIR/plugins/claude-code"
if [ ! -f "$SRC_SKILL/SKILL.md" ]; then
echo "✗ Missing $SRC_SKILL/SKILL.md" >&2
exit 1
fi
# --- Claude Code ---
# Installs as a proper plugin: plugin manifest + skills subdir under
# ~/.claude/plugins/markdown/. If an old user-level copy exists at
# ~/.claude/skills/markdown/ (from before this project was split out),
# remove it — the plugin version supersedes it.
CLAUDE_PLUGIN_DIR="$HOME/.claude/plugins/markdown"
CLAUDE_CACHE_DIR="$HOME/.claude/plugins/cache/local/markdown/0.1.0"
CLAUDE_OLD_SKILL="$HOME/.claude/skills/markdown"
if [ -d "$HOME/.claude" ]; then
echo "→ Installing Claude Code plugin at $CLAUDE_PLUGIN_DIR..."
rm -rf "$CLAUDE_PLUGIN_DIR"
mkdir -p "$CLAUDE_PLUGIN_DIR"
cp -r "$SRC_CC_PLUGIN/.claude-plugin" "$CLAUDE_PLUGIN_DIR/"
mkdir -p "$CLAUDE_PLUGIN_DIR/skills"
cp -r "$SRC_SKILL" "$CLAUDE_PLUGIN_DIR/skills/markdown"
# Final structure: ~/.claude/plugins/markdown/skills/markdown/SKILL.md
# (plugin manifest "skills": "./skills/" points at the skills dir;
# each skill lives in its own named subdirectory with SKILL.md.)
if [ -d "$CLAUDE_CACHE_DIR" ]; then
echo " → syncing plugin cache..."
rm -rf "$CLAUDE_CACHE_DIR"
mkdir -p "$(dirname "$CLAUDE_CACHE_DIR")"
cp -r "$CLAUDE_PLUGIN_DIR" "$CLAUDE_CACHE_DIR"
fi
if [ -d "$CLAUDE_OLD_SKILL" ]; then
echo " → removing legacy user-skill copy at $CLAUDE_OLD_SKILL..."
rm -rf "$CLAUDE_OLD_SKILL"
fi
fi
# --- Codex ---
# No plugin concept — install as a user-level skill directory.
if [ -d "$HOME/.codex" ]; then
CODEX_DEST="$HOME/.codex/skills/markdown"
echo "→ Installing Codex skill at $CODEX_DEST..."
mkdir -p "$(dirname "$CODEX_DEST")"
rm -rf "$CODEX_DEST"
cp -r "$SRC_SKILL" "$CODEX_DEST"
fi
# --- OpenCode ---
# Loaded from the path declared in opencode.json (skills.paths).
if [ -d "$HOME/.config/opencode" ]; then
OPENCODE_DEST="$HOME/.config/opencode/skills/markdown"
echo "→ Installing OpenCode skill at $OPENCODE_DEST..."
mkdir -p "$(dirname "$OPENCODE_DEST")"
rm -rf "$OPENCODE_DEST"
cp -r "$SRC_SKILL" "$OPENCODE_DEST"
fi
echo ""
echo "✓ Done. Re-run install.sh whenever you edit plugins/skills/markdown/SKILL.md."