aboutsummaryrefslogtreecommitdiff
path: root/claude-templates/bin/install-ai
blob: 3283c4ae61a15a2bb604993e59fb496caab6de2e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env bash
# install-ai — PATH-facing launcher for the fresh-project bootstrapper.
#
# make install symlinks this into ~/.local/bin/install-ai (same bin loop that
# links `ai` and `agent-text`), so `install-ai [--track|--gitignore] [PROJECT]`
# runs from anywhere. The real logic lives in scripts/install-ai.sh; this
# resolves its own location through the ~/.local/bin symlink and execs that
# script by its true repo path, so the script's own repo-root computation
# (dirname "$0"/..) stays correct. dotfiles needs no copy — the symlink always
# points at the canonical.
set -euo pipefail

# Resolve this file through any symlink chain to its real location in the repo.
source="${BASH_SOURCE[0]}"
while [ -L "$source" ]; do
  dir="$(cd -P "$(dirname "$source")" && pwd)"
  source="$(readlink "$source")"
  [[ "$source" != /* ]] && source="$dir/$source"
done
bindir="$(cd -P "$(dirname "$source")" && pwd)"      # <repo>/claude-templates/bin
repo="$(cd -P "$bindir/../.." && pwd)"               # <repo>

exec "$repo/scripts/install-ai.sh" "$@"