-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapm-bump.sh
More file actions
executable file
·35 lines (30 loc) · 862 Bytes
/
Copy pathapm-bump.sh
File metadata and controls
executable file
·35 lines (30 loc) · 862 Bytes
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
#!/usr/bin/env bash
set -euo pipefail
if ! command -v git >/dev/null; then
echo "apm-bump: git not found" >&2
exit 1
fi
rm -rf ./.agents ./.claude ./.codex
if [ ! -e ./.bare ]; then
apm install --update -t codex,claude
apm compile -t codex
exit 0
fi
# worktree base dir: sources resolve from the default-branch worktree,
# outputs are written back here via --root.
branch=$(git --git-dir=.bare symbolic-ref --short HEAD 2>/dev/null || true)
if [ -n "${branch}" ] && [ -d "./${branch}" ]; then
wt=./${branch}
elif [ -d ./main ]; then
wt=./main
elif [ -d ./master ]; then
wt=./master
else
echo "apm-bump: no worktree dir found (tried '${branch:-<none>}', main, master)" >&2
exit 1
fi
pushd "${wt}" >/dev/null
apm install --update -t codex,claude --root ..
apm compile -t codex --root ..
cp ../apm.lock.yaml ./apm.lock.yaml
popd >/dev/null