Skip to content

armgit / Ix

Public Imported from GitHub
0

Understand any codebase instantly. System intelligence for codebases, built for humans and AI.

chore(install): label installer output per host and add --help (#618)

Alot1zd3d95cb79153
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index d8df58f3..a53e8d21 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -373,7 +373,9 @@ jobs:
install_out=$(bash scripts/install-skill.sh --dry-run)
printf '%s\n' "$install_out"
- grep -Fq 'would install: /tmp/ix-harness-home/.claude/skills/ix' <<<"$install_out"
+ grep -Fq 'would install [claude]: /tmp/ix-harness-home/.claude/skills/ix' <<<"$install_out"
+ grep -Fq 'Add --json for a machine-readable report' <<<"$install_out"
+ bash scripts/install-skill.sh --help | grep -Fq 'Valid harness ids:'
test ! -e "$HOME/.claude/skills/ix"
shell_json=$(bash scripts/install-skill.sh --dry-run --json)
@@ -479,7 +481,9 @@ jobs:
install_out=$(bash scripts/install-skill.sh --dry-run)
printf '%s\n' "$install_out"
dest="$HOME/.claude/skills/ix"
- grep -Fq "would install: $dest" <<<"$install_out"
+ grep -Fq "would install [claude]: $dest" <<<"$install_out"
+ grep -Fq 'Add --json for a machine-readable report' <<<"$install_out"
+ bash scripts/install-skill.sh --help | grep -Fq 'Valid harness ids:'
test ! -e "$dest"
shell_json=$(bash scripts/install-skill.sh --dry-run --json)
diff --git a/scripts/install-skill.sh b/scripts/install-skill.sh
index fcce8d1a..5e9531c1 100644
--- a/scripts/install-skill.sh
+++ b/scripts/install-skill.sh
@@ -36,6 +36,44 @@ ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
SRC="$ROOT/skills/ix"
[ -f "$SRC/SKILL.md" ] || { echo "error: $SRC/SKILL.md not found" >&2; exit 1; }
+
+# A machine-readable report replaces the human output: one object per harness
+# with the action this run takes (would-install | would-refuse | installed |
+# refused | skip) and `detectedVia` — the probe that decided presence
+# (toolscan | path | config-dir | none), mirroring `ix mcp install`'s report.
+# CI asserts the JSON fields instead of grepping the human lines.
+
+HELPER="$ROOT/ix-cli/scripts/skill-harnesses.mjs"
+
+# --- Argument parsing --------------------------------------------------------
+#
+# BEFORE the registry read below, deliberately. Both the node requirement and
+# the probe `exit 1`, so parsing after them meant `--help` on a machine without
+# node answered
+# error: node is required to read the harness registry
+# and `--bogus` did too -- reporting the toolchain instead of the option. Usage
+# and option validation must not depend on a toolchain; someone reaching for
+# --help is often someone who has not got one yet.
+#
+# Listing the REAL registry ids is still worth having, so --help asks for them
+# separately and treats failure as silence: they enrich a help message, they are
+# never a reason to withhold one.
+usage() {
+ echo "Usage: bash scripts/install-skill.sh [options] [harness-ids...]"
+ echo " --force overwrite a same-name foreign skill"
+ echo " --dry-run show the targets, write nothing"
+ echo " --json machine-readable report (same shape as ix mcp install)"
+ echo " --help this message"
+ # Best effort. `|| true` because this runs under `set -e` and a missing node,
+ # a broken helper or an empty probe must all leave --help exiting 0.
+ local ids=""
+ if command -v node >/dev/null 2>&1; then
+ ids="$(node "$HELPER" --probe 2>/dev/null | cut -d'|' -f1 | tr '\n' ' ')" || true
+ fi
+ [ -n "${ids// /}" ] && echo "Valid harness ids: ${ids% }"
+ return 0
+}
+
FORCE=0
DRY_RUN=0
JSON=0
@@ -45,19 +83,13 @@ for arg in "$@"; do
--force) FORCE=1 ;;
--dry-run) DRY_RUN=1 ;;
--json) JSON=1 ;;
- -*) echo "error: unknown option $arg" >&2; exit 1 ;;
+ --help|-h) usage; exit 0 ;;
+ -*) echo "error: unknown option $arg" >&2; echo " try: bash scripts/install-skill.sh --help" >&2; exit 1 ;;
*) EXPLICIT+=("$arg") ;;
esac
done
-# A machine-readable report replaces the human output: one object per harness
-# with the action this run takes (would-install | would-refuse | installed |
-# refused | skip) and `detectedVia` — the probe that decided presence
-# (toolscan | path | config-dir | none), mirroring `ix mcp install`'s report.
-# CI asserts the JSON fields instead of grepping the human lines.
-
# --- Read the harness registry (hosts.ts via the helper, no built CLI) ------
-HELPER="$ROOT/ix-cli/scripts/skill-harnesses.mjs"
if [ ! -f "$HELPER" ]; then
echo "error: $HELPER not found (the harness registry helper)" >&2
exit 1
@@ -148,7 +180,7 @@ for ((i = 0; i < ${#IDS[@]}; i++)); do
continue
fi
if [ "$DRY_RUN" = "1" ]; then
- say "would install: $dest"
+ say "would install [$id]: $dest"
DECISIONS+=("$id"$'\t'"would-install"$'\t'"$dest"$'\t'"$via")
installed=$((installed + 1))
continue
@@ -158,7 +190,7 @@ for ((i = 0; i < ${#IDS[@]}; i++)); do
rm -rf "$dest"
fi
cp -R "$SRC" "$dest"
- say "Installed: $dest"
+ say "Installed [$id]: $dest"
DECISIONS+=("$id"$'\t'"installed"$'\t'"$dest"$'\t'"$via")
installed=$((installed + 1))
done
@@ -184,6 +216,7 @@ fi
if [ "$DRY_RUN" = "1" ]; then
echo
echo "Dry run: $installed harness(es) would receive the skill."
+ echo "Add --json for a machine-readable report (same shape as ix mcp install)."
# The preview and the real run must agree: a conflict in the real run
# exits 1, so a preview that predicts a refusal exits 1 too.
[ "$conflicts" = "0" ] || exit 1