diff options
| author | Craig Jennings <c@cjennings.net> | 2026-07-18 20:08:56 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-07-18 20:08:56 -0500 |
| commit | d2b1bef686fd6c22a6303c13829f88bdd110fa7b (patch) | |
| tree | 65254d95d52bcfb8eb26b54de96f18ff08c8284e /claude-templates/bin/install-ai | |
| parent | 2cb7c1b3957193f74b1ecd1b5e0f437e13092eb1 (diff) | |
| download | rulesets-d2b1bef686fd6c22a6303c13829f88bdd110fa7b.tar.gz rulesets-d2b1bef686fd6c22a6303c13829f88bdd110fa7b.zip | |
feat(bin): launch install-ai from PATH
Added claude-templates/bin/install-ai, a thin launcher that resolves its own path through the symlink chain and execs scripts/install-ai.sh. make install's bin loop symlinks it into ~/.local/bin/install-ai, the same mechanism that links ai and agent-page, so the fresh-project bootstrapper now runs as install-ai from anywhere. The symlink always points at the canonical, so no separate dotfiles copy is needed. Three launcher bats cover the wrapper, including invocation through a symlink from another directory (the case a naive dirname "$0"/.. would break).
Diffstat (limited to 'claude-templates/bin/install-ai')
| -rwxr-xr-x | claude-templates/bin/install-ai | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/claude-templates/bin/install-ai b/claude-templates/bin/install-ai new file mode 100755 index 0000000..88cb8e5 --- /dev/null +++ b/claude-templates/bin/install-ai @@ -0,0 +1,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-page`), 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" "$@" |
