From d2b1bef686fd6c22a6303c13829f88bdd110fa7b Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sat, 18 Jul 2026 20:08:56 -0500 Subject: 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). --- scripts/tests/install-ai.bats | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'scripts') diff --git a/scripts/tests/install-ai.bats b/scripts/tests/install-ai.bats index a7eb3c0..9c6040c 100644 --- a/scripts/tests/install-ai.bats +++ b/scripts/tests/install-ai.bats @@ -172,3 +172,31 @@ EOF grep -q "project-owned entry file" "$TEST_HOME/code/fresh/AGENTS.md" ! grep -q "protocols.org" "$TEST_HOME/code/fresh/AGENTS.md" } + +# --- claude-templates/bin/install-ai launcher -------------------------------- +# +# The launcher is the PATH-facing front door (make install symlinks it into +# ~/.local/bin/install-ai, same loop as `ai` and `agent-page`). It resolves its +# own real path through the symlink and execs scripts/install-ai.sh, so the +# repo-root computation survives being invoked as a symlink from anywhere. + +LAUNCHER="$REAL_REPO/claude-templates/bin/install-ai" + +@test "install-ai launcher: exists and is executable" { + [ -x "$LAUNCHER" ] +} + +@test "install-ai launcher: --help reaches install-ai.sh through the launcher" { + run bash "$LAUNCHER" --help + [ "$status" -eq 0 ] + [[ "$output" == *"Bootstrap .ai/"* ]] +} + +@test "install-ai launcher: works when invoked as a symlink from another dir" { + # Reproduces the ~/.local/bin symlink: a link elsewhere must still resolve + # the repo root, not break on dirname of the link path. + ln -s "$LAUNCHER" "$TEST_HOME/install-ai" + run bash "$TEST_HOME/install-ai" --help + [ "$status" -eq 0 ] + [[ "$output" == *"Bootstrap .ai/"* ]] +} -- cgit v1.2.3