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 /scripts/tests/install-ai.bats | |
| 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 'scripts/tests/install-ai.bats')
| -rw-r--r-- | scripts/tests/install-ai.bats | 28 |
1 files changed, 28 insertions, 0 deletions
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/"* ]] +} |
