This repository was archived by the owner on Jul 4, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·106 lines (93 loc) · 3.64 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·106 lines (93 loc) · 3.64 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
#!/usr/bin/env bash
set -euo pipefail
REPO_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
CLI_SRC="$REPO_DIR/bin/devloop"
CLI_DST="$HOME/.local/bin/devloop"
info() { echo " [ .. ] $1"; }
ok() { echo " [ ok ] $1"; }
warn() { echo " [warn] $1"; }
echo ""
echo "Installing devloop"
echo "────────────────────────────────────────"
# ── Symlink CLI ──────────────────────────────────────────────────────────────
info "Linking CLI..."
mkdir -p "$HOME/.local/bin"
if [ -L "$CLI_DST" ] && [ "$(readlink "$CLI_DST")" = "$CLI_SRC" ]; then
ok "Already linked: $CLI_DST"
else
[ -L "$CLI_DST" ] && rm "$CLI_DST"
ln -sf "$CLI_SRC" "$CLI_DST"
chmod +x "$CLI_SRC"
ok "Linked: $CLI_DST → $CLI_SRC"
fi
# ── Clean up old symlinks if present ─────────────────────────────────────────
for old_name in devenv-conventions devenv-rules devloop-rules; do
OLD_DST="$HOME/.local/bin/$old_name"
if [ -L "$OLD_DST" ]; then
rm "$OLD_DST"
warn "Removed old symlink: $OLD_DST"
fi
done
# ── Create directories ──────────────────────────────────────────────────────
info "Setting up directories..."
mkdir -p "$HOME/devloop/rules"
mkdir -p "$HOME/devloop/rule-packs"
# ── Migrate old paths if present ────────────────────────────────────────────
OLD_LAYERS="${XDG_CONFIG_HOME:-$HOME/.config}/devenv/rule-layers"
OLD_PACKS="$HOME/.claude/rule-packs"
MIGRATED=false
if [ -d "$OLD_PACKS" ]; then
for entry in "$OLD_PACKS"/*/; do
[ -e "$entry" ] || continue
name="$(basename "${entry%/}")"
dst="$HOME/devloop/rule-packs/$name"
if [ -L "${entry%/}" ]; then
target="$(readlink "${entry%/}")"
if [ ! -e "$dst" ]; then
ln -sfn "$target" "$dst"
ok "Migrated pack repo: $name → $target"
MIGRATED=true
fi
elif [ -d "$entry" ]; then
if [ ! -e "$dst" ]; then
cp -R "${entry%/}" "$dst"
ok "Migrated pack repo (copy): $name"
MIGRATED=true
fi
fi
done
fi
if [ -f "$OLD_LAYERS" ]; then
while IFS= read -r line; do
[ -z "$line" ] && continue
name="$(basename "$line")"
dst="$HOME/devloop/rules/$name"
if [ -d "$line" ] && [ ! -e "$dst" ]; then
ln -sfn "$line" "$dst"
ok "Migrated active pack: $name → $line"
MIGRATED=true
fi
done <"$OLD_LAYERS"
fi
if [ "$MIGRATED" = true ]; then
if [ -f "$OLD_LAYERS" ]; then
rm "$OLD_LAYERS"
ok "Removed old layers file: $OLD_LAYERS"
rmdir "${XDG_CONFIG_HOME:-$HOME/.config}/devenv" 2>/dev/null || true
fi
if [ -d "$OLD_PACKS" ]; then
rm -rf "$OLD_PACKS"
ok "Removed old packs dir: $OLD_PACKS"
fi
echo ""
echo " Migration complete. Old paths have been cleaned up."
echo ""
fi
# ── Run install subcommand ───────────────────────────────────────────────────
info "Registering repo and setting up directories..."
"$CLI_SRC" rules install
echo ""
echo "────────────────────────────────────────"
echo " Done! Run 'devloop rules list' to see available packs."
echo " Then 'devloop rules enable <pack>' to activate one."
echo ""