#!/bin/sh # TeaserKit installer for macOS and Linux. Run in a terminal: # curl -fsSL https://teaserkit.com/install.sh | sh # It asks for your licence key (or reads $TEASERKIT_KEY), downloads TeaserKit into ~/.teaserkit/app, # adds the `teaserkit` command, activates the licence and installs the director into your coding # agents. No admin rights; Node.js is fetched privately if you don't have it. set -e SITE="${TEASERKIT_SITE:-https://teaserkit.com}" ROOT="${TEASERKIT_INSTALL_ROOT:-$HOME/.teaserkit}" APP="$ROOT/app" BIN="$ROOT/bin" echo "" echo " TeaserKit installer" echo "" KEY="${TEASERKIT_KEY:-$1}" if [ -z "$KEY" ] && [ -z "$TEASERKIT_ZIP" ]; then printf " Your licence key (from your receipt email): " read -r KEY < /dev/tty fi KEY="$(printf %s "$KEY" | tr -d ' \r\n')" TMP="$(mktemp -d)" trap 'rm -rf "$TMP"' EXIT if [ -n "$TEASERKIT_ZIP" ]; then cp "$TEASERKIT_ZIP" "$TMP/teaserkit.zip" else echo " Downloading TeaserKit..." CODE=$(curl -sS -o "$TMP/teaserkit.zip" -w "%{http_code}" -X POST -H "content-type: application/json" \ -d "{\"key\":\"$KEY\"}" "$SITE/api/download") if [ "$CODE" != "200" ]; then MSG=$(sed -n 's/.*"error":"\([^"]*\)".*/\1/p' "$TMP/teaserkit.zip") echo " Download failed: ${MSG:-HTTP $CODE}"; exit 1 fi fi mkdir -p "$TMP/x" if command -v unzip >/dev/null 2>&1; then unzip -q "$TMP/teaserkit.zip" -d "$TMP/x" elif command -v python3 >/dev/null 2>&1; then python3 -m zipfile -e "$TMP/teaserkit.zip" "$TMP/x" else tar -xf "$TMP/teaserkit.zip" -C "$TMP/x"; fi SRC=$(find "$TMP/x" -maxdepth 1 -type d -name 'teaserkit-*' | head -n 1) [ -n "$SRC" ] || { echo " The download didn't look like a TeaserKit release."; exit 1; } mkdir -p "$ROOT" rm -rf "$APP" mv "$SRC" "$APP" chmod +x "$APP/launcher/start.sh" "$APP/app/cli.mjs" 2>/dev/null || true # the `teaserkit` command: a small shim that runs the launcher (which finds or fetches Node.js) mkdir -p "$BIN" printf '#!/bin/sh\nexec sh "%s/launcher/start.sh" "$@"\n' "$APP" > "$BIN/teaserkit" chmod +x "$BIN/teaserkit" if [ -z "$TEASERKIT_NO_PATH" ]; then LINE="export PATH=\"$BIN:\$PATH\"" case "${SHELL:-}" in *zsh) touch "$HOME/.zshrc" ;; *bash) [ "$(uname -s)" = Darwin ] && touch "$HOME/.bash_profile" ;; esac for RC in "$HOME/.zshrc" "$HOME/.bashrc" "$HOME/.bash_profile" "$HOME/.profile"; do if [ -f "$RC" ] || [ "$RC" = "$HOME/.profile" ]; then grep -qs "$BIN" "$RC" || printf '\n# TeaserKit\n%s\n' "$LINE" >> "$RC" fi done fi if [ -n "$KEY" ]; then "$BIN/teaserkit" login "$KEY" || echo " Run 'teaserkit login ' once you have your key."; fi "$BIN/teaserkit" setup || true VERSION=$(sed -n 's/.*"version": *"\([^"]*\)".*/\1/p' "$APP/package.json" | head -n 1) echo " TeaserKit $VERSION is installed, and your coding agents have the director." echo "" echo " Open the Studio now: $BIN/teaserkit" echo "" echo " In any project folder:" echo " teaserkit init set the project up for videos" echo " teaserkit studio . open the Studio on its films" echo " teaserkit help everything else" echo "" echo " Then ask your agent there:" echo ' /teaserkit "a 30-second launch film for this product" repo=. project=videos/launch' echo "" echo " Open a new terminal first, so it finds the teaserkit command." echo ""