#!/usr/bin/env bash # AI & Things: Arabic film studio setup. # # What this script does, in order. It never uses sudo and installs no system packages. # 1. Checks for Node 22+, npm, ffmpeg, ffprobe, curl and unzip. If one is missing it prints how to get it and stops. # 2. Installs the "cinetic" agent skill (MIT, by Leonxlnx) from its own GitHub release into the skills folder, # unless it is already there. # 3. Creates a studio folder with the AI & Things files: AGENT.md, a brand template, the Arabic type guide and # the checkers (letter cuts, safe area, Latin text, loudness). # 4. With --film : scaffolds a first Remotion film project inside the studio (runs npm install, a few minutes) # and installs the letter-cut checker into it. # # Usage: # bash setup.sh [folder] [--film ] [--skills-dir ] # folder where the studio goes (default: ~/arabic-film-studio) # --film also create films/ from the cinetic kit # --skills-dir where agent skills live (default: ~/.claude/skills) # # Sources: https://github.com/Leonxlnx/cinetic | https://aiandthings-film-method.vercel.app set -euo pipefail BASE="${AIAT_BASE:-https://aiandthings-film-method.vercel.app/kit}" SKILL_URL="https://github.com/Leonxlnx/cinetic/releases/latest/download/cinetic.skill" DIR="$HOME/arabic-film-studio" SKILLS_DIR="$HOME/.claude/skills" FILM="" while [ $# -gt 0 ]; do case "$1" in --film) FILM="${2:-}"; shift 2 ;; --skills-dir) SKILLS_DIR="${2:-}"; shift 2 ;; -h|--help) sed -n '2,20p' "$0"; exit 0 ;; -*) echo "unknown option: $1" >&2; exit 64 ;; *) DIR="$1"; shift ;; esac done say() { printf '\n== %s\n' "$1"; } missing=0 need() { # need if ! command -v "$1" >/dev/null 2>&1; then echo " missing: $1 -> $2"; missing=1; else echo " ok: $1"; fi } say "1/4 Checking what the studio needs" need node "https://nodejs.org (version 22 or newer; on macOS: brew install node)" need npm "comes with Node" need ffmpeg "https://ffmpeg.org/download.html (on macOS: brew install ffmpeg)" need ffprobe "comes with ffmpeg" need curl "your system's package manager" need unzip "your system's package manager" if [ "$missing" = 1 ]; then echo; echo "Install what is missing, then run this script again."; exit 1; fi NODE_MAJOR="$(node -p 'process.versions.node.split(".")[0]')" if [ "$NODE_MAJOR" -lt 22 ]; then echo " Node $NODE_MAJOR found, but 22 or newer is needed: https://nodejs.org"; exit 1; fi say "2/4 The cinetic skill" if [ -f "$SKILLS_DIR/cinetic/SKILL.md" ]; then echo " already installed: $SKILLS_DIR/cinetic (left as it is)" else tmp="$(mktemp -d)"; trap 'rm -rf "$tmp"' EXIT echo " downloading from $SKILL_URL" curl -fsSL -o "$tmp/cinetic.skill" "$SKILL_URL" mkdir -p "$SKILLS_DIR" unzip -q "$tmp/cinetic.skill" -d "$SKILLS_DIR/" [ -f "$SKILLS_DIR/cinetic/SKILL.md" ] || { echo " the skill did not unpack as expected"; exit 1; } echo " installed: $SKILLS_DIR/cinetic" fi say "3/4 The studio folder: $DIR" mkdir -p "$DIR/brand" "$DIR/fonts" "$DIR/films" "$DIR/checks" "$DIR/guides" get() { # get ; never overwrites a file you already have if [ -e "$DIR/$1" ]; then echo " kept: $1"; else curl -fsSL -o "$DIR/$1" "$BASE/$1"; echo " added: $1"; fi } get AGENT.md get brand/BRAND.template.md get guides/arabic-type.md get checks/SafeAudit.tsx get checks/find-latin.swift get checks/loudness.sh get checks/inkaudit.tsx get checks/ink.mjs get checks/add-ink-check.mjs chmod +x "$DIR/checks/loudness.sh" [ -e "$DIR/brand/BRAND.md" ] || cp "$DIR/brand/BRAND.template.md" "$DIR/brand/BRAND.md" if [ ! -e "$DIR/fonts/README.md" ]; then cat > "$DIR/fonts/README.md" <<'EOF' # Fonts Put your font files here. This setup does not download fonts: each has its own licence, so get them from the source and read the terms. - Thmanyah (Arabic): https://font.thmanyah.com - Barlow Condensed (Latin headlines, SIL Open Font License): https://fonts.google.com/specimen/Barlow+Condensed Before a film uses a font, test it on the film's own words (guides/arabic-type.md, "Test the font"). EOF echo " added: fonts/README.md"; fi say "4/4 A first film" if [ -n "$FILM" ]; then if [ -e "$DIR/films/$FILM" ]; then echo " films/$FILM exists already (left as it is)" else node "$SKILLS_DIR/cinetic/kit/scripts/new-film.mjs" "$DIR/films/$FILM" --name "$FILM" node "$DIR/checks/add-ink-check.mjs" "$DIR/films/$FILM" fi else echo " skipped. To create one later:" echo " node \"$SKILLS_DIR/cinetic/kit/scripts/new-film.mjs\" \"$DIR/films/my-film\" --name \"My film\"" echo " node \"$DIR/checks/add-ink-check.mjs\" \"$DIR/films/my-film\"" fi cat <