Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/workflows/smoke-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Smoke Test

on:
push:
branches: [main]
pull_request:

permissions:
contents: read

jobs:
smoke-test:
name: Execute install_tool.sh and check_environment.sh
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- name: Run smoke test
run: bash scripts/smoke-test.sh
103 changes: 103 additions & 0 deletions scripts/smoke-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
#!/usr/bin/env bash
# smoke-test.sh — Executes the skill's shell scripts end-to-end.
#
# The eval suite (evals/evals.json) only checks LLM prompting behavior; it
# never actually runs install_tool.sh or check_environment.sh. That gap let a
# broken catalog path (scripts moved under skills/cli-tools/ without updating
# the relative path to catalog/) and a set -e/pipefail interaction bug ship
# for multiple releases despite being 100% reproducible. This script runs the
# real entry points against the real repo layout so path and control-flow
# regressions like those fail CI instead of shipping silently.
set -euo pipefail

DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd "$DIR/.." && pwd)"
SCRIPTS="$REPO_ROOT/skills/cli-tools/scripts"

RED="\033[0;31m"
GREEN="\033[0;32m"
NC="\033[0m"

FAILURES=0

pass() { echo -e "${GREEN}✓${NC} $1"; }

Check warning on line 23 in scripts/smoke-test.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Assign this positional parameter to a local variable.

See more on https://sonarcloud.io/project/issues?id=netresearch_cli-tools-skill&issues=AZ-EYcezLcmem6YioZJf&open=AZ-EYcezLcmem6YioZJf&pullRequest=39
fail() { echo -e "${RED}✗${NC} $1"; FAILURES=$((FAILURES + 1)); }

Check warning on line 24 in scripts/smoke-test.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Assign this positional parameter to a local variable.

See more on https://sonarcloud.io/project/issues?id=netresearch_cli-tools-skill&issues=AZ-EYcezLcmem6YioZJg&open=AZ-EYcezLcmem6YioZJg&pullRequest=39

echo "=== smoke-test: catalog resolution ==="

# Every catalog entry must resolve via install_tool.sh's own lookup, proving
# the DIR/../../../catalog (via lib/root.sh) math matches the real layout.
if [ ! -d "$REPO_ROOT/catalog" ]; then

Check failure on line 30 in scripts/smoke-test.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use '[[' instead of '[' for conditional tests. The '[[' construct is safer and more feature-rich.

See more on https://sonarcloud.io/project/issues?id=netresearch_cli-tools-skill&issues=AZ-VDnbBIgB_iDVPj2K8&open=AZ-VDnbBIgB_iDVPj2K8&pullRequest=39
fail "catalog directory missing at $REPO_ROOT/catalog"
else
catalog_count=$(find "$REPO_ROOT/catalog" -name '*.json' | wc -l)
if [ "$catalog_count" -lt 1 ]; then

Check failure on line 34 in scripts/smoke-test.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use '[[' instead of '[' for conditional tests. The '[[' construct is safer and more feature-rich.

See more on https://sonarcloud.io/project/issues?id=netresearch_cli-tools-skill&issues=AZ-EYcezLcmem6YioZJh&open=AZ-EYcezLcmem6YioZJh&pullRequest=39
fail "catalog directory empty at $REPO_ROOT/catalog"
else
pass "catalog directory found ($catalog_count entries)"
fi
fi

# A known-good tool must report a real install_method, not "No catalog entry
# found" (the exact symptom of the path bug).
if output=$(bash "$SCRIPTS/install_tool.sh" fd status 2>&1); then
pass "install_tool.sh fd status: $output"
else
fail "install_tool.sh fd status failed:"$'\n'"$output"
fi

# A genuinely unknown tool must still enumerate real catalog entries in its
# error message, not an empty list.
if output=$(bash "$SCRIPTS/install_tool.sh" __not_a_real_tool__ status 2>&1); then
fail "install_tool.sh __not_a_real_tool__ status unexpectedly succeeded"
else
if echo "$output" | grep -q "fd "; then
pass "install_tool.sh reports real available tools on unknown-tool error"
else
fail "install_tool.sh did not list real catalog entries:"$'\n'"$output"
fi
fi

echo ""
echo "=== smoke-test: full installer round-trip ==="

# Actually install a small, single-static-binary tool via the github_release_binary
# installer to prove the whole chain (catalog lookup -> installer dispatch ->
# download -> binary in place) works, not just the catalog lookup in isolation.
# PREFIX (read by lib/install_strategy.sh's get_install_dir) isolates the
# install to a scratch dir instead of touching the real ~/.local/bin.
TMP_PREFIX="$(mktemp -d)"
if PREFIX="$TMP_PREFIX" bash "$SCRIPTS/installers/github_release_binary.sh" fd >"$TMP_PREFIX/smoke-fd-install.log" 2>&1; then
if [ -x "$TMP_PREFIX/bin/fd" ] && "$TMP_PREFIX/bin/fd" --version >/dev/null 2>&1; then

Check failure on line 71 in scripts/smoke-test.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use '[[' instead of '[' for conditional tests. The '[[' construct is safer and more feature-rich.

See more on https://sonarcloud.io/project/issues?id=netresearch_cli-tools-skill&issues=AZ-EYcezLcmem6YioZJi&open=AZ-EYcezLcmem6YioZJi&pullRequest=39
pass "github_release_binary.sh installed a working fd: $("$TMP_PREFIX/bin/fd" --version)"
else
fail "github_release_binary.sh reported success but $TMP_PREFIX/bin/fd is missing or broken:"$'\n'"$(cat "$TMP_PREFIX/smoke-fd-install.log")"
fi
else
fail "github_release_binary.sh fd install failed:"$'\n'"$(cat "$TMP_PREFIX/smoke-fd-install.log")"
fi
rm -rf "$TMP_PREFIX"

echo ""
echo "=== smoke-test: check_environment.sh completes without aborting early ==="

# Must reach its final exit 0, not stop partway through because set -e
# aborted on a helper function's by-design nonzero "issue count" return.
if output=$(bash "$SCRIPTS/check_environment.sh" audit "$REPO_ROOT" 2>&1); then
if echo "$output" | grep -q "Core Tools Status"; then
pass "check_environment.sh audit ran to completion"
else
fail "check_environment.sh audit exited 0 but stopped before the Core Tools Status section:"$'\n'"$output"
fi
else
fail "check_environment.sh audit exited non-zero:"$'\n'"$output"
fi

echo ""
if [ "$FAILURES" -eq 0 ]; then

Check failure on line 97 in scripts/smoke-test.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use '[[' instead of '[' for conditional tests. The '[[' construct is safer and more feature-rich.

See more on https://sonarcloud.io/project/issues?id=netresearch_cli-tools-skill&issues=AZ-EYcezLcmem6YioZJj&open=AZ-EYcezLcmem6YioZJj&pullRequest=39
echo -e "${GREEN}All smoke tests passed${NC}"
exit 0
else
echo -e "${RED}$FAILURES smoke test(s) failed${NC}"
exit 1
fi
14 changes: 11 additions & 3 deletions skills/cli-tools/scripts/check_environment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,11 @@ check_duplicates() {

for tool in "${tools[@]}"; do
local paths
paths=$(type -a "$tool" 2>/dev/null | grep -c "is" || echo 0)
# `type -p -a` prints one absolute path per executable found, so wc -l is
# the install count — locale-independent, unlike parsing `type -a`'s prose
# (which localizes "is"/"ist"/"est" and broke the count in non-English
# locales). `|| true` guards the empty-result case under set -o pipefail.
paths=$(type -p -a "$tool" 2>/dev/null | wc -l | tr -d ' ' || true)
if [ "$paths" -gt 1 ]; then
log_warn "$tool has multiple installations:"
type -a "$tool" 2>/dev/null | head -5
Expand Down Expand Up @@ -178,10 +182,14 @@ run_audit() {
echo "═══════════════════════════════════════════════"
echo ""

check_path
# check_path/check_duplicates return their issue count by design (not a
# fatal error); under `set -e` a bare call aborts run_audit at the first
# issue found instead of completing the rest of the audit, the same
# hazard the check_tool calls below are already guarded against.
check_path || true
echo ""

check_duplicates
check_duplicates || true
echo ""

check_package_managers
Expand Down
5 changes: 3 additions & 2 deletions skills/cli-tools/scripts/install_tool.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ set -euo pipefail
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

# Source reconciliation libraries
. "$DIR/lib/root.sh"
. "$DIR/lib/reconcile.sh"

TOOL="${1:-}"
Expand All @@ -17,12 +18,12 @@ if [ -z "$TOOL" ]; then
exit 1
fi

CATALOG_FILE="$DIR/../catalog/$TOOL.json"
CATALOG_FILE="$CATALOG_DIR/$TOOL.json"

# Check if tool has catalog entry
if [ ! -f "$CATALOG_FILE" ]; then
echo "[$TOOL] Error: No catalog entry found" >&2
echo "[$TOOL] Available tools: $(find "$DIR/../catalog" -name '*.json' -exec basename {} .json \; | tr '\n' ' ')" >&2
echo "[$TOOL] Available tools: $(find "$CATALOG_DIR" -name '*.json' -exec basename {} .json \; | tr '\n' ' ')" >&2
exit 1
fi

Expand Down
5 changes: 3 additions & 2 deletions skills/cli-tools/scripts/installers/aws_installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
set -euo pipefail

DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
. "$DIR/lib/root.sh"
. "$DIR/lib/install_strategy.sh"

TOOL="${1:-aws}"
CATALOG_FILE="$DIR/../catalog/$TOOL.json"
CATALOG_FILE="$CATALOG_DIR/$TOOL.json"

if [ ! -f "$CATALOG_FILE" ]; then
echo "Error: Catalog file not found: $CATALOG_FILE" >&2
Expand Down Expand Up @@ -46,4 +47,4 @@ printf "[%s] after: %s\n" "$TOOL" "${after:-<none>}"
if [ -n "$path" ]; then printf "[%s] path: %s\n" "$TOOL" "$path"; fi

# Refresh snapshot after successful installation
refresh_snapshot "$TOOL"
refresh_snapshot "$TOOL" || true
3 changes: 2 additions & 1 deletion skills/cli-tools/scripts/installers/dedicated_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@
set -euo pipefail

DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
. "$DIR/lib/root.sh"

TOOL="${1:-}"
if [ -z "$TOOL" ]; then
echo "Usage: $0 TOOL_NAME" >&2
exit 1
fi

CATALOG_FILE="$DIR/../catalog/$TOOL.json"
CATALOG_FILE="$CATALOG_DIR/$TOOL.json"
if [ ! -f "$CATALOG_FILE" ]; then
echo "Error: Catalog file not found: $CATALOG_FILE" >&2
exit 1
Expand Down
5 changes: 3 additions & 2 deletions skills/cli-tools/scripts/installers/github_clone.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
set -euo pipefail

DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
. "$DIR/lib/root.sh"
. "$DIR/lib/install_strategy.sh"

TOOL="${1:-}"
Expand All @@ -13,7 +14,7 @@ fi

ACTION="${2:-install}"

CATALOG_FILE="$DIR/../catalog/$TOOL.json"
CATALOG_FILE="$CATALOG_DIR/$TOOL.json"
if [ ! -f "$CATALOG_FILE" ]; then
echo "[$TOOL] Error: Catalog file not found: $CATALOG_FILE" >&2
exit 1
Expand Down Expand Up @@ -87,4 +88,4 @@ printf "[%s] after: %s\n" "$TOOL" "${after:-<unknown>}"
printf "[%s] path: %s\n" "$TOOL" "$CLONE_PATH"

# Refresh snapshot after successful installation
refresh_snapshot "$TOOL"
refresh_snapshot "$TOOL" || true
5 changes: 3 additions & 2 deletions skills/cli-tools/scripts/installers/github_release_binary.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
set -euo pipefail

DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
. "$DIR/lib/root.sh"
. "$DIR/lib/common.sh"
. "$DIR/lib/install_strategy.sh"

Expand All @@ -13,7 +14,7 @@ if [ -z "$TOOL" ]; then
exit 1
fi

CATALOG_FILE="$DIR/../catalog/$TOOL.json"
CATALOG_FILE="$CATALOG_DIR/$TOOL.json"
if [ ! -f "$CATALOG_FILE" ]; then
echo "Error: Catalog file not found: $CATALOG_FILE" >&2
exit 1
Expand Down Expand Up @@ -251,4 +252,4 @@ printf "[%s] after: %s\n" "$TOOL" "${after:-<none>}"
if [ -n "$path" ]; then printf "[%s] path: %s\n" "$TOOL" "$path"; fi

# Refresh snapshot after successful installation
refresh_snapshot "$TOOL"
refresh_snapshot "$TOOL" || true
5 changes: 3 additions & 2 deletions skills/cli-tools/scripts/installers/hashicorp_zip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
set -euo pipefail

DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
. "$DIR/lib/root.sh"
. "$DIR/lib/common.sh"
. "$DIR/lib/install_strategy.sh"

Expand All @@ -12,7 +13,7 @@ if [ -z "$TOOL" ]; then
exit 1
fi

CATALOG_FILE="$DIR/../catalog/$TOOL.json"
CATALOG_FILE="$CATALOG_DIR/$TOOL.json"
if [ ! -f "$CATALOG_FILE" ]; then
echo "Error: Catalog file not found: $CATALOG_FILE" >&2
exit 1
Expand Down Expand Up @@ -87,4 +88,4 @@ printf "[%s] after: %s\n" "$TOOL" "${after:-<none>}"
if [ -n "$path" ]; then printf "[%s] path: %s\n" "$TOOL" "$path"; fi

# Refresh snapshot after successful installation
refresh_snapshot "$TOOL"
refresh_snapshot "$TOOL" || true
5 changes: 3 additions & 2 deletions skills/cli-tools/scripts/installers/npm_global.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
set -euo pipefail

DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
. "$DIR/lib/root.sh"
. "$DIR/lib/install_strategy.sh"

# Load nvm if available (needed for node-based package managers)
Expand All @@ -18,7 +19,7 @@ if [ -z "$TOOL" ]; then
exit 1
fi

CATALOG_FILE="$DIR/../catalog/$TOOL.json"
CATALOG_FILE="$CATALOG_DIR/$TOOL.json"
if [ ! -f "$CATALOG_FILE" ]; then
echo "Error: Catalog file not found: $CATALOG_FILE" >&2
exit 1
Expand Down Expand Up @@ -83,4 +84,4 @@ printf "[%s] after: %s\n" "$TOOL" "${after:-<none>}"
if [ -n "$path" ]; then printf "[%s] path: %s\n" "$TOOL" "$path"; fi

# Refresh snapshot after successful installation
refresh_snapshot "$TOOL"
refresh_snapshot "$TOOL" || true
5 changes: 3 additions & 2 deletions skills/cli-tools/scripts/installers/npm_self_update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
set -euo pipefail

DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
. "$DIR/lib/root.sh"
. "$DIR/lib/common.sh"
. "$DIR/lib/install_strategy.sh"

Expand All @@ -12,7 +13,7 @@ if [ -z "$TOOL" ]; then
exit 1
fi

CATALOG_FILE="$DIR/../catalog/$TOOL.json"
CATALOG_FILE="$CATALOG_DIR/$TOOL.json"
if [ ! -f "$CATALOG_FILE" ]; then
echo "Error: Catalog file not found: $CATALOG_FILE" >&2
exit 1
Expand Down Expand Up @@ -50,4 +51,4 @@ else
fi

# Refresh snapshot after successful installation
refresh_snapshot "$TOOL"
refresh_snapshot "$TOOL" || true
7 changes: 4 additions & 3 deletions skills/cli-tools/scripts/installers/package_manager.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
set -euo pipefail

DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
. "$DIR/lib/root.sh"
. "$DIR/lib/common.sh"
. "$DIR/lib/install_strategy.sh"

Expand All @@ -13,7 +14,7 @@ if [ -z "$TOOL" ]; then
exit 1
fi

CATALOG_FILE="$DIR/../catalog/$TOOL.json"
CATALOG_FILE="$CATALOG_DIR/$TOOL.json"
if [ ! -f "$CATALOG_FILE" ]; then
echo "Error: Catalog file not found: $CATALOG_FILE" >&2
exit 1
Expand Down Expand Up @@ -116,7 +117,7 @@ if command -v "$BINARY_NAME" >/dev/null 2>&1; then
printf "[%s] note: %s\n" "$TOOL" "Already available (bundled with runtime)"

# Refresh snapshot to record current version
refresh_snapshot "$TOOL"
refresh_snapshot "$TOOL" || true
exit 0
fi
fi
Expand Down Expand Up @@ -180,4 +181,4 @@ if [ -n "$path" ]; then printf "[%s] path: %s\n" "$TOOL" "$path"; fi
# Refresh snapshot after successful installation
# Need to source install_strategy.sh for refresh_snapshot function
. "$(dirname "${BASH_SOURCE[0]}")/../lib/install_strategy.sh"
refresh_snapshot "$TOOL"
refresh_snapshot "$TOOL" || true
5 changes: 3 additions & 2 deletions skills/cli-tools/scripts/installers/uv_tool.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
set -euo pipefail

DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
. "$DIR/lib/root.sh"

TOOL="${1:-}"
if [ -z "$TOOL" ]; then
echo "Usage: $0 TOOL_NAME" >&2
exit 1
fi

CATALOG_FILE="$DIR/../catalog/$TOOL.json"
CATALOG_FILE="$CATALOG_DIR/$TOOL.json"
if [ ! -f "$CATALOG_FILE" ]; then
echo "Error: Catalog file not found: $CATALOG_FILE" >&2
exit 1
Expand Down Expand Up @@ -57,4 +58,4 @@ if [ -n "$path" ]; then printf "[%s] path: %s\n" "$TOOL" "$path"; fi
# Refresh snapshot after successful installation
# Source install_strategy.sh for refresh_snapshot function
. "$(dirname "${BASH_SOURCE[0]}")/../lib/install_strategy.sh"
refresh_snapshot "$TOOL"
refresh_snapshot "$TOOL" || true
Loading
Loading