-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
160 lines (146 loc) · 4.78 KB
/
Makefile
File metadata and controls
160 lines (146 loc) · 4.78 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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
AGENTS_DIR := skills
DOCS_DIR := docs
EXTENDED_DIR := extended
PERSONAL_DIR := personal
DIR_TARGETS := .claude .cursor .windsurf .agent .gemini .agents
MD_SOURCE := AGENTS.md
MD_TARGETS := CLAUDE.md GEMINI.md
STATUSLINE_SRC := $(PWD)/config/statusline-command.sh
STATUSLINE_DEST := $(HOME)/.claude/statusline-command.sh
.PHONY: link link-dirs link-md link-extended link-personal install-statusline unlink unlink-dirs unlink-md unlink-extended unlink-personal
link: link-dirs link-md link-extended link-personal
link-dirs:
@for target in $(DIR_TARGETS); do \
mkdir -p "$$target" && \
if [ -e "$$target/skills" ] || [ -L "$$target/skills" ]; then \
echo "SKIP: $$target/skills already exists"; \
else \
ln -s "../$(AGENTS_DIR)" "$$target/skills" && echo "LINKED: $(AGENTS_DIR) -> $$target/skills"; \
fi; \
if [ -e "$$target/docs" ] || [ -L "$$target/docs" ]; then \
echo "SKIP: $$target/docs already exists"; \
else \
ln -s "../$(DOCS_DIR)" "$$target/docs" && echo "LINKED: $(DOCS_DIR) -> $$target/docs"; \
fi \
done
link-md:
@for target in $(MD_TARGETS); do \
if [ -e "$$target" ] || [ -L "$$target" ]; then \
echo "SKIP: $$target already exists"; \
else \
ln -s $(MD_SOURCE) $$target && echo "LINKED: $(MD_SOURCE) -> $$target"; \
fi \
done
link-extended:
@if [ ! -d "$(EXTENDED_DIR)" ]; then \
echo "SKIP: no $(EXTENDED_DIR)/ directory found"; \
exit 0; \
fi; \
for skill_dir in $(EXTENDED_DIR)/*/; do \
skill_name=$$(basename "$$skill_dir"); \
target_dir="$$HOME/.claude/skills/$$skill_name"; \
if [ ! -d "$$target_dir" ]; then \
echo "SKIP: $$target_dir not found — install $$skill_name first"; \
continue; \
fi; \
ext_skill="$$skill_dir/SKILL.md"; \
if [ -f "$$ext_skill" ]; then \
dest="$$target_dir/SKILL.extended.md"; \
if [ -e "$$dest" ] || [ -L "$$dest" ]; then \
echo "SKIP: $$dest already exists"; \
else \
ln -s "$$(pwd)/$$ext_skill" "$$dest" && echo "LINKED: $$ext_skill -> $$dest"; \
fi; \
fi; \
ref_dir="$$skill_dir/reference"; \
if [ -d "$$ref_dir" ]; then \
dest="$$target_dir/reference"; \
if [ -e "$$dest" ] || [ -L "$$dest" ]; then \
echo "SKIP: $$dest already exists"; \
else \
ln -s "$$(pwd)/$$ref_dir" "$$dest" && echo "LINKED: $$ref_dir -> $$dest"; \
fi; \
fi; \
done
link-personal:
@if [ ! -d "$(PERSONAL_DIR)" ]; then \
echo "SKIP: no $(PERSONAL_DIR)/ directory found"; \
exit 0; \
fi; \
for skill_dir in $(PERSONAL_DIR)/*/; do \
skill_name=$$(basename "$$skill_dir"); \
if [ ! -f "$$skill_dir/SKILL.md" ]; then \
echo "SKIP: $$skill_dir has no SKILL.md"; \
continue; \
fi; \
dest="$$HOME/.claude/skills/$$skill_name"; \
if [ -e "$$dest" ] || [ -L "$$dest" ]; then \
echo "SKIP: $$dest already exists"; \
else \
ln -s "$$(pwd)/$$skill_dir" "$$dest" && echo "LINKED: $$skill_dir -> $$dest"; \
fi; \
done
install-statusline:
@dest="$(STATUSLINE_DEST)"; \
if [ -e "$$dest" ] || [ -L "$$dest" ]; then \
if [ "$(FORCE)" = "1" ]; then \
cp "$(STATUSLINE_SRC)" "$$dest" && chmod +x "$$dest" && echo "INSTALLED (forced): $(STATUSLINE_SRC) -> $$dest"; \
else \
echo "SKIP: $$dest already exists (run with FORCE=1 to override)"; \
fi; \
else \
cp "$(STATUSLINE_SRC)" "$$dest" && chmod +x "$$dest" && echo "INSTALLED: $(STATUSLINE_SRC) -> $$dest"; \
fi
unlink: unlink-dirs unlink-md unlink-extended unlink-personal
unlink-dirs:
@for target in $(DIR_TARGETS); do \
if [ -L "$$target/skills" ]; then \
rm "$$target/skills" && echo "REMOVED: $$target/skills"; \
else \
echo "SKIP: $$target/skills is not a symlink"; \
fi; \
if [ -L "$$target/docs" ]; then \
rm "$$target/docs" && echo "REMOVED: $$target/docs"; \
else \
echo "SKIP: $$target/docs is not a symlink"; \
fi \
done
unlink-md:
@for target in $(MD_TARGETS); do \
if [ -L "$$target" ]; then \
rm $$target && echo "REMOVED: $$target"; \
else \
echo "SKIP: $$target is not a symlink"; \
fi \
done
unlink-personal:
@if [ ! -d "$(PERSONAL_DIR)" ]; then \
echo "SKIP: no $(PERSONAL_DIR)/ directory found"; \
exit 0; \
fi; \
for skill_dir in $(PERSONAL_DIR)/*/; do \
skill_name=$$(basename "$$skill_dir"); \
dest="$$HOME/.claude/skills/$$skill_name"; \
if [ -L "$$dest" ]; then \
rm "$$dest" && echo "REMOVED: $$dest"; \
else \
echo "SKIP: $$dest is not a symlink"; \
fi; \
done
unlink-extended:
@if [ ! -d "$(EXTENDED_DIR)" ]; then \
echo "SKIP: no $(EXTENDED_DIR)/ directory found"; \
exit 0; \
fi; \
for skill_dir in $(EXTENDED_DIR)/*/; do \
skill_name=$$(basename "$$skill_dir"); \
target_dir="$$HOME/.claude/skills/$$skill_name"; \
for item in SKILL.extended.md reference; do \
dest="$$target_dir/$$item"; \
if [ -L "$$dest" ]; then \
rm "$$dest" && echo "REMOVED: $$dest"; \
else \
echo "SKIP: $$dest is not a symlink"; \
fi; \
done; \
done