refactor: move skill to skills/inkreach-teable (from .agents/skills/)
git mv rename (history preserved); install.sh + README updated. The skill is consumed via user-level install (~/.zcode/skills), so in-repo .agents discovery was unnecessary.
This commit is contained in:
@@ -0,0 +1,87 @@
|
||||
#!/bin/bash
|
||||
# Install/upgrade the inkreach-teable CLI + agent skill from this standalone repo.
|
||||
# Run from this skill's directory (or anywhere; paths resolve from this file).
|
||||
# What it does:
|
||||
# 1. Builds the CLI (this repo's root IS the package).
|
||||
# 2. Links the `inkreach-teable` command globally.
|
||||
# 3. Installs the skill to ~/.zcode/skills/inkreach-teable (user scope —
|
||||
# available in every ZCode workspace, shadows same-named workspace skills).
|
||||
# Re-run this script after pulling changes to refresh both the command and the skill.
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
# Resolve the repo root: skill lives at <root>/skills/inkreach-teable/scripts/
|
||||
REPO_ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)"
|
||||
SKILL_DIR="$REPO_ROOT/skills/inkreach-teable"
|
||||
|
||||
echo "=== inkreach-teable CLI installation ==="
|
||||
|
||||
# Check Node.js
|
||||
if ! command -v node &> /dev/null; then
|
||||
echo "ERROR: Node.js is not installed. Install Node.js >= 18 first."
|
||||
exit 1
|
||||
fi
|
||||
NODE_VERSION=$(node -v | sed 's/v//' | cut -d. -f1)
|
||||
if [ "$NODE_VERSION" -lt 18 ]; then
|
||||
echo "ERROR: Node.js >= 18 required, found v$(node -v)"
|
||||
exit 1
|
||||
fi
|
||||
echo "✓ Node.js $(node -v)"
|
||||
|
||||
# Check repo layout
|
||||
if [ ! -f "$REPO_ROOT/package.json" ] || [ ! -d "$REPO_ROOT/src" ]; then
|
||||
echo "ERROR: CLI source not found at $REPO_ROOT"
|
||||
echo " Ensure the inkreach-teable-cli repo is checked out at $REPO_ROOT"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Build
|
||||
echo "Building CLI from $REPO_ROOT ..."
|
||||
cd "$REPO_ROOT"
|
||||
if command -v pnpm &> /dev/null; then
|
||||
pnpm install --prefer-offline 2>/dev/null || true
|
||||
pnpm build
|
||||
else
|
||||
echo "ERROR: pnpm not found. Install pnpm first: npm i -g pnpm"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Link globally. Prefer pnpm; fall back to npm link; finally create a wrapper.
|
||||
echo "Linking 'inkreach-teable' command globally ..."
|
||||
LINKED=0
|
||||
if command -v pnpm &> /dev/null && pnpm link --global 2>/dev/null; then
|
||||
LINKED=1
|
||||
elif command -v npm &> /dev/null && npm link 2>/dev/null; then
|
||||
LINKED=1
|
||||
fi
|
||||
# Ensure a usable wrapper exists on PATH even if global bin isn't configured.
|
||||
mkdir -p "$HOME/.local/bin"
|
||||
cat > "$HOME/.local/bin/inkreach-teable" <<WRAPPER
|
||||
#!/bin/bash
|
||||
exec node "$REPO_ROOT/dist/bin.js" "\$@"
|
||||
WRAPPER
|
||||
chmod +x "$HOME/.local/bin/inkreach-teable"
|
||||
|
||||
# Install the skill at user scope so it works in ANY workspace, including
|
||||
# checkouts of the inkreach-teable application repo (which no longer bundles it).
|
||||
if [ -d "$SKILL_DIR" ]; then
|
||||
mkdir -p "$HOME/.zcode/skills"
|
||||
rm -rf "$HOME/.zcode/skills/inkreach-teable"
|
||||
cp -r "$SKILL_DIR" "$HOME/.zcode/skills/inkreach-teable"
|
||||
echo "✓ skill installed to ~/.zcode/skills/inkreach-teable (user scope)"
|
||||
fi
|
||||
|
||||
# Verify
|
||||
echo ""
|
||||
echo "=== Verification ==="
|
||||
if command -v inkreach-teable &> /dev/null; then
|
||||
echo "✓ inkreach-teable CLI installed ($(inkreach-teable --version 2>/dev/null || echo 'unknown'))"
|
||||
echo ""
|
||||
echo "Next: configure endpoint + token:"
|
||||
echo " inkreach-teable auth login --endpoint http://localhost:3000 --token <PAT>"
|
||||
echo "Or create a PAT first:"
|
||||
echo " inkreach-teable auth token create --name my-cli"
|
||||
else
|
||||
echo "⚠ 'inkreach-teable' not on PATH. Add pnpm/npm global bin to your PATH, or run directly:"
|
||||
echo " node $REPO_ROOT/dist/bin.js <command>"
|
||||
fi
|
||||
Reference in New Issue
Block a user