Skip to content
Back to search

ai-video-marketing

MarketplaceWorks with Claude CodeGitHub

Video marketing skills for AI agents — hooks, UGC ad scripts, AI video generation, YouTube SEO, repurposing, and creative testing

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today

Check it deeper on your machine

It has changed since its scan on 17 Nov 2026.

As a Claude Code plugin, install it and then ask Claude Code:

/plugin marketplace add keithmackay/mackayi/plugin install scanskillsafety@mackayiDo a deep scan of https://github.com/matt-j-penny/ai-video-marketing with scanskillsafety

Or from a terminal, clone it and run it:

git clone https://github.com/keithmackay/scanskillsafety-skill ~/.claude/skills/scanskillsafetynode ~/.claude/skills/scanskillsafety/cli.cjs --deep 'https://github.com/matt-j-penny/ai-video-marketing'

It checks the exact commit: every file, its packages against OSV (api.osv.dev), how it compares with this page's scan (findsafeskills.com receives the repository's address), and, if you agree, Claude reading every file with your own Claude subscription. It never runs the code.

Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/matt-j-penny--ai-video-marketing/badge.svg)](/listings/matt-j-penny--ai-video-marketing)

HTML

<a href="/listings/matt-j-penny--ai-video-marketing"><img src="/api/listings/matt-j-penny--ai-video-marketing/badge.svg" alt="findsafeskills safety rating" /></a>

Install

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

Option 1: CLI Install (Recommended)

Use [npx skills](https://github.com/vercel-labs/skills) to install skills directly:

# Install all skills
npx skills add matt-j-penny/ai-video-marketing

# Install a specific skill
npx skills add matt-j-penny/ai-video-marketing --skill rough-cut

# List available skills
npx skills add matt-j-penny/ai-video-marketing --list

> [!TIP] > If you run the command from **inside** an agent session, pass the agent explicitly so it installs where Claude Code reads from: > > ```bash > npx skills add matt-j-penny/ai-video-marketing -a claude-code > ```

Option 2: Claude Code Plugin

/plugin marketplace add matt-j-penny/ai-video-marketing
/plugin install ai-video-marketing

Option 3: Clone and Copy

git clone https://github.com/matt-j-penny/ai-video-marketing.git
cp -r ai-video-marketing/skills/* .agents/skills/

Option 4: Git Submodule

git submodule add https://github.com/matt-j-penny/ai-video-marketing.git .agents/ai-video-marketing

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

.claude-plugin/marketplace.json · Manifest · 18 lines
  1. {
  2. "name": "ai-video-marketing",
  3. "owner": {
  4. "name": "Matt Penny"
  5. },
  6. "metadata": {
  7. "description": "AI video marketing skills for AI agents — content research, hooks and scripts in your voice, posting, and video editing",
  8. "version": "1.0.0",
  9. "repository": "https://github.com/matt-j-penny/ai-video-marketing"
  10. },
  11. "plugins": [
  12. {
  13. "name": "ai-video-marketing",
  14. "description": "Video marketing skills for creators, marketers, and founders: competitor and feed research, hooks, scripts, carousels, posting, and rough-cut editing",
  15. "source": "./"
  16. }
  17. ]
  18. }
README.md · README · 174 lines
  1. # AI Video Marketing Skills
  2. A collection of AI agent skills for video marketing: researching what's working, writing hooks and scripts in your own voice, editing raw footage, and posting the finished cut. Built for creators, marketers, and founders who want AI coding agents to run their content pipeline. Works with Claude Code and any agent that supports the [Agent Skills spec](https://agentskills.io).
  3. **Contributions welcome!** Found a way to improve a skill or have a new one to add? Open a PR.
  4. ## What are Skills?
  5. Skills are markdown files that give AI agents specialized knowledge and workflows for specific tasks. When you add these to your project, your agent can recognize when you're working on a video editing task and apply the right workflow.
  6. ## Available Skills
  7. | Skill | Description |
  8. |-------|-------------|
  9. | [video-editing/transcribe](skills/video-editing/transcribe/) | Transcribe a video or audio file with word-level timestamps (Deepgram nova-2 → ElevenLabs → local Whisper) — the input other workflows like rough-cut build on. |
  10. | [video-editing/rough-cut](skills/video-editing/rough-cut/) | Turn a raw talking-head or narrated video into a rough cut — strip dead air and remove bad takes (false starts, repeated takes, fluffs) using a word-level-timestamp transcript. |
  11. | [video-editing/level-audio](skills/video-editing/level-audio/) | Even out a video's narration so no part is noticeably louder or quieter than the rest, using loudness-range measurement and speech-specific dynamics processing. |
  12. | [video-editing/create-design-md](skills/video-editing/create-design-md/) | Create a DESIGN.md design-system doc — from a live site, existing code, or a guided question set when there's no reference material — so motion graphics, title cards, and on-screen UI stay visually consistent. |
  13. | [video-editing/create-frames-md](skills/video-editing/create-frames-md/) | Create a frames.md motion-system doc — timing tokens, easing/springs, entrances/exits, stagger, transitions, and sync rules — from a reference video, existing animation code, or a guided question set, so every animated element moves consistently. |
  14. | [video-production/full-edit](skills/video-production/full-edit/) | Remotion version: raw talking-head clip to a finished, graphics-covered video in one pass (`/full-edit`): ffmpeg rough cut, then a Remotion composition of full-screen, overlay, and split motion graphics, run with your saved preferences and a first-time setup that checks ffmpeg, Node, Deepgram and Brave keys. |
  15. | [capcut/full-edit](skills/capcut/full-edit/) | CapCut version (`/full-edit-capcut`): same pipeline and preferences, but builds the edit as a CapCut draft with motion graphics placed on overlay tracks. |
  16. | [capcut/faceless-video](skills/capcut/faceless-video/) | Topic to finished faceless video in CapCut (`/faceless-video`): researched, de-AI'd script, Inworld voiceover, Deepgram word timings, a shot list cut on key nouns, style-consistent AI images (Topview or Kie.ai), Ken Burns zooms, and word-highlighted native captions. Saved preferences for length, aspect ratio, images vs video, and cut speed; runs all at once or step by step. |
  17. | [video-production/mograph-remix](skills/video-production/mograph-remix/) | YouTube URL to reusable HyperFrames motion-graphics templates (`/mograph-remix`): scans the video for graphics, recreates each one with editable variables and a "use when" moment card (list, emphasis, steps, stat…), writes a style guide, and saves them to a HyperFrames template library. Give it your own video too and it edits it with graphics in the same style, even on a different topic. First-time setup connects an existing library, creates a new one, or keeps templates for the session only. |
  18. | [video-production/mograph-snatcher](skills/video-production/mograph-snatcher/) | YouTube URL to HyperFrames templates (`/style-clone`): scans the video for motion graphics, captures dense frames of each one, writes a layout/style/motion-timing analysis, and rebuilds every graphic as a verified template with editable variables. Add your own video (`/style-clone <url> <your-video>`) and it hands off to mograph-remix to edit your video in that style. Needs the HyperFrames skills (`npx skills add heygen-com/hyperframes`). |
  19. | [video-production/storyboard](skills/video-production/storyboard/) | Explicit-only (`/storyboard`): turn a script or video into a finished motion-graphics video end to end — storyboard, HTML/React scenes, a Remotion composition synced to the voice-over, and a final render saved to `~/Downloads`. |
  20. | [video-production/video-tool-finder](skills/video-production/video-tool-finder/) | Pick the right stack before building a video: a researched catalog of ~58 open-source tools, libraries and agent skills (editing, motion graphics, Claude video style packs, voice/captions, 3D) with what each does best, when to use it, license flags, and a quick pick-by-job table. |
  21. | [video-analysis/transcribe-url](skills/video-analysis/transcribe-url/) | Transcribe any public video URL (YouTube, Instagram, TikTok, X, and more) with yt-dlp and local faster-whisper into a markdown transcript. |
  22. | [video-analysis/youtube-editing-style](skills/video-analysis/youtube-editing-style/) | Break down a YouTube URL or local video's editing style: sends the actual video with audio to Gemini 3.8 Flash via OpenRouter and writes a timestamped guide to cuts, pacing, graphics, captions, fonts, colour, animation, B-roll and layouts, with reusable recipes for recreating the style. |
  23. | [content-research/ig-competitor-research](skills/content-research/ig-competitor-research/) | Rank tracked Instagram competitors' last-week posts by likes and breakout score, transcribe and break down the winners, and build a visual HTML report (Apify MCP). |
  24. | [content-research/yt-competitor-research](skills/content-research/yt-competitor-research/) | Rank tracked YouTube channels' last-week uploads by views and breakout score, break down each winner's title and thumbnail, and build a visual HTML report (yt-dlp, free). |
  25. | [content-research/yt-video-research](skills/content-research/yt-video-research/) | Topic to video plan (`/yt-video-research`): finds a topic's over-performing videos in a time window (vidIQ), breaks down their titles, hooks, angles, formats and demos from transcripts, mines comments via the YouTube API, works out what viewers want, then helps pick an angle, demos, tips and an intro. |
  26. | [content-research/ig-feed-research](skills/content-research/ig-feed-research/) | Scan your logged-in Instagram home feed for on-niche ideas and hit "Not interested" on everything off-niche to tune the algorithm (Claude in Chrome). |
  27. | [content-research/yt-feed-research](skills/content-research/yt-feed-research/) | Scan your logged-in YouTube home feed for outlier ideas using VidIQ badges, dismissing off-niche tiles to tailor the feed (Claude in Chrome). |
  28. | [content-writing/hook-generator](skills/content-writing/hook-generator/) | Write 6-8 spoken hooks for a video idea, each built on a proven framework from a 404-hook bank ranked by views. |
  29. | [content-writing/scriptwriter](skills/content-writing/scriptwriter/) | Turn a research pick or raw idea into a filmable beat sheet in Notion, drafted against verbatim transcripts of your own top videos and voice-linted. |
  30. | [content-writing/yt-planning](skills/content-writing/yt-planning/) | Workshop a rough video idea into a fleshed-out premise (`/yt-planning`), one stage at a time on a call or in chat: big promise and chapters, what to show per chapter, format, flow, personal angle, offer tie-in, and a pre-shoot to-do list, applying the Content OS idea tips, then saved to your content pipeline. |
  31. | [content-writing/voice-corpus-builder](skills/content-writing/voice-corpus-builder/) | Build `voice-corpus/` from your own top YouTube and Instagram videos and draft `voice-dna.md`, the voice rulebook the writing skills use. |
  32. | [content-writing/knowledge-compile](skills/content-writing/knowledge-compile/) | Refresh `knowledge/`: short, source-linked pages summarizing your research, transcripts, and business docs for ideation and scripting. |
  33. | [content-writing/yt-description](skills/content-writing/yt-description/) | Write a finished long-form video's YouTube description in your channel's live format, with chapter timestamps indexed from the final export. |
  34. | [content-distribution/auto-poster](skills/content-distribution/auto-poster/) | Post or schedule a finished video to every connected platform through Zernio, writing a caption from the transcript if you don't give one. |
  35. | [content-distribution/carousel-generator](skills/content-distribution/carousel-generator/) | Design 4:5 Instagram carousels: an AI-generated cover plus token-locked HTML body slides rendered to PNGs, with a caption package. |
  36. | [content-distribution/dm-revival](skills/content-distribution/dm-revival/) | Work your Instagram DM inbox for lost leads and draft personalized re-openers in your voice, sending only batches you approve. |
  37. The `content-*` skills and `transcribe-url` run inside the [Content OS workspace](#content-os-workspace).
  38. ## Installation
  39. ### Option 1: CLI Install (Recommended)
  40. Use [npx skills](https://github.com/vercel-labs/skills) to install skills directly:
  41. ```bash
  42. # Install all skills
  43. npx skills add matt-j-penny/ai-video-marketing
  44. # Install a specific skill
  45. npx skills add matt-j-penny/ai-video-marketing --skill rough-cut
  46. # List available skills
  47. npx skills add matt-j-penny/ai-video-marketing --list
  48. ```
  49. > [!TIP]
  50. > If you run the command from **inside** an agent session, pass the agent explicitly so it installs where Claude Code reads from:
  51. >
  52. > ```bash
  53. > npx skills add matt-j-penny/ai-video-marketing -a claude-code
  54. > ```
  55. ### Option 2: Claude Code Plugin
  56. ```bash
  57. /plugin marketplace add matt-j-penny/ai-video-marketing
  58. /plugin install ai-video-marketing
  59. ```
  60. ### Option 3: Clone and Copy
  61. ```bash
  62. git clone https://github.com/matt-j-penny/ai-video-marketing.git
  63. cp -r ai-video-marketing/skills/* .agents/skills/
  64. ```
  65. ### Option 4: Git Submodule
  66. ```bash
  67. git submodule add https://github.com/matt-j-penny/ai-video-marketing.git .agents/ai-video-marketing
  68. ```
  69. ## Usage
  70. Once installed, just ask your agent to help with video editing tasks:
  71. ```
  72. "Transcribe this interview with word-level timestamps"
  73. → Uses video-editing/transcribe skill
  74. "Make a rough cut of this talking-head video, cut the silences and bad takes"
  75. → Uses video-editing/rough-cut skill
  76. "The voice in this video is loud in some parts and quiet in others, even it out"
  77. → Uses video-editing/level-audio skill
  78. "Build me a DESIGN.md for the title cards and lower-thirds in this explainer video"
  79. → Uses video-editing/create-design-md skill
  80. "Write a frames.md so all the animations in my explainer series move the same way"
  81. → Uses video-editing/create-frames-md skill
  82. "/storyboard turn this clip into a finished video with motion graphics"
  83. → Uses video-production/storyboard skill
  84. "What's the best tool to make a pixel-art intro with a voiceover?"
  85. → Uses video-production/video-tool-finder skill
  86. "Research my Instagram competitors"
  87. → Uses content-research/ig-competitor-research skill
  88. "Write me hooks for a video about batching a month of content"
  89. → Uses content-writing/hook-generator skill
  90. "Post this video: ~/Downloads/final.mp4"
  91. → Uses content-distribution/auto-poster skill
  92. "Let's plan my next YouTube video about AI video editing"
  93. → Uses content-writing/yt-planning skill
  94. ```
  95. You can also invoke a skill directly:
  96. ```
  97. /transcribe
  98. /rough-cut
  99. /level-audio
  100. /create-design-md
  101. /create-frames-md
  102. /storyboard
  103. /video-tool-finder
  104. /transcribe-url
  105. /ig-competitor-research
  106. /yt-competitor-research
  107. /ig-feed-research
  108. /yt-feed-research
  109. /hook-generator
  110. /scriptwriter
  111. /voice-corpus-builder
  112. /knowledge-compile
  113. /yt-description
  114. /auto-poster
  115. /carousel-generator
  116. /dm-revival
  117. /yt-planning
  118. ```
  119. ## Content OS workspace
  120. The content skills read and write files in one project folder: your creator profile (`CLAUDE.md`), `backbone/` (offer, ICP, messaging, vision), `voice-dna.md`, `voice-corpus/`, `competitor-list.md`, `notion-pipeline.md`, and output folders like `research/` and `transcripts/`. [`content-os/`](content-os/) is that folder as a template, with a one-command installer. To set it up, copy the template and install the skills into it:
  121. ```bash
  122. git clone https://github.com/matt-j-penny/ai-video-marketing.git
  123. cp -R ai-video-marketing/content-os ~/content-os
  124. mkdir -p ~/content-os/.claude/skills
  125. cp -R ai-video-marketing/skills/*/* ~/content-os/.claude/skills/
  126. ```
  127. Then open `~/content-os` in Claude Code and say **"run the setup"**. [content-os/SETUP.md](content-os/SETUP.md) has the full walkthrough.
  128. ## Contributing
  129. Found a way to improve a skill? Have a new skill to suggest? PRs and issues welcome. Follow the existing `SKILL.md` format (frontmatter with `name`/`description`, then persona, context-gathering, workflow, common mistakes, task-specific questions) and add a matching `evals/evals.json`. **Bump `metadata.last_updated` to today's date whenever you edit a `SKILL.md`** — each skill checks this against today's date and tells the user to re-pull the repo if it's more than 2 weeks stale, so an unbumped date after a real change makes that check lie.
  130. ## License
  131. [MIT](LICENSE) - Use these however you want.
content-os/check-setup.sh · Bundled script · 152 lines · 2 findings marked
  1. #!/usr/bin/env bash
  2. # check-setup.sh — verify the system tools the content-os skills need.
  3. #
  4. # Report-only: checks what's installed and prints the install command for
  5. # anything missing. Installs NOTHING and touches nothing. (./setup.sh is the
  6. # installer; it calls this at the end to verify.)
  7. #
  8. # ./check-setup.sh
  9. #
  10. # Cross-platform: macOS (Homebrew), Linux (apt + uv), Windows (Git Bash + winget —
  11. # the shell Claude Code uses on Windows). The Python side (faster-whisper) is NOT
  12. # installed here: every transcription skill shares ONE persistent venv at
  13. # ~/.cache/content-os/whisper-venv that builds itself on first use (or setup.sh
  14. # pre-builds it). Exit 0 = every core tool present.
  15. set -uo pipefail
  16. UNAME="$(uname -s 2>/dev/null || echo unknown)"
  17. case "$UNAME" in
  18. Darwin) OS=mac; OSLABEL="macOS" ;;
  19. Linux) OS=linux; OSLABEL="Linux" ;;
  20. MINGW*|MSYS*|CYGWIN*) OS=windows; OSLABEL="Windows (Git Bash)" ;;
  21. *) OS=other; OSLABEL="$UNAME" ;;
  22. esac
  23. # install hint per tool + platform (bash 3.2-safe: case, no assoc arrays)
  24. hint() {
  25. case "$OS:$1" in
  26. mac:uv) echo "brew install uv" ;;
  27. mac:ffmpeg) echo "brew install ffmpeg" ;;
  28. mac:yt-dlp) echo "brew install yt-dlp" ;;
  29. mac:jq) echo "brew install jq" ;;
  30. mac:node) echo "brew install node" ;;
  31. mac:python3) echo "brew install python" ;;
  32. mac:curl) echo "brew install curl" ;;
  33. linux:uv) echo "curl -LsSf https://astral.sh/uv/install.sh | sh" ;;
  34. linux:ffmpeg) echo "sudo apt install -y ffmpeg" ;;
  35. linux:yt-dlp) echo "uv tool install yt-dlp (apt's yt-dlp is too old)" ;;
  36. linux:jq) echo "sudo apt install -y jq" ;;
  37. linux:node) echo "curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash - && sudo apt install -y nodejs" ;;
    • Note: Pipes a downloaded script directly into a shell (curl | sh / wget | bash)
    • Line 39 on GitHub
  38. linux:python3) echo "sudo apt install -y python3" ;;
  39. linux:curl) echo "sudo apt install -y curl" ;;
  40. windows:uv) echo "winget install astral-sh.uv (then open a NEW terminal)" ;;
  41. windows:ffmpeg) echo "winget install Gyan.FFmpeg (then open a NEW terminal)" ;;
  42. windows:yt-dlp) echo "winget install yt-dlp.yt-dlp (then open a NEW terminal)" ;;
  43. windows:jq) echo "winget install jqlang.jq (then open a NEW terminal)" ;;
  44. windows:node) echo "winget install OpenJS.NodeJS.LTS (then open a NEW terminal)" ;;
  45. windows:python3) echo "winget install Python.Python.3.12 (then open a NEW terminal)" ;;
  46. windows:curl) echo "(curl ships with Windows 10+/Git Bash)" ;;
  47. *:higgsfield) echo "curl -fsSL https://raw.githubusercontent.com/higgsfield-ai/cli/main/install.sh | sh then: higgsfield auth login" ;;
    • Note: Pipes a downloaded script directly into a shell (curl | sh / wget | bash)
    • Line 49 on GitHub
  48. *) echo "install $1" ;;
  49. esac
  50. }
  51. if [ -t 1 ]; then
  52. G=$(tput setaf 2); R=$(tput setaf 1); Y=$(tput setaf 3); D=$(tput setaf 8); B=$(tput bold); N=$(tput sgr0)
  53. else
  54. G=; R=; Y=; D=; B=; N=
  55. fi
  56. REPO="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
  57. missing=0
  58. check() { # check <cmd> <label> <hint-key> <used-by>
  59. if command -v "$1" >/dev/null 2>&1; then
  60. printf " ${G}✓${N} %-11s ${D}%s${N}\n" "$2" "$4"
  61. else
  62. printf " ${R}✗${N} %-11s ${Y}%s${N} ${D}(needed by %s)${N}\n" "$2" "$(hint "$3")" "$4"
  63. missing=$((missing + 1))
  64. fi
  65. }
  66. ok() { printf " ${G}✓${N} %-11s ${D}%s${N}\n" "$1" "$2"; }
  67. note() { printf " ${Y}!${N} %-11s ${D}%s${N}\n" "$1" "$2"; }
  68. printf "\n${B}content-os — system prerequisites${N} ${D}(%s)${N}\n\n" "$OSLABEL"
  69. if [ "$OS" = other ]; then
  70. printf " ${R}Unsupported shell/OS ($UNAME).${N} On Windows run this from Git Bash (winget install Git.Git), not PowerShell.\n\n"
  71. elif [ "$OS" = mac ] && ! command -v brew >/dev/null 2>&1; then
  72. printf " ${Y}Homebrew not found${N} — the installs below use it. Install it first (needs your password):\n"
  73. printf " ${B}/bin/bash -c \"\$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)\"${N}\n\n"
  74. elif [ "$OS" = linux ]; then
  75. printf " ${D}Installs below use apt (run ${B}sudo apt update${N}${D} once first) + uv.${N}\n\n"
  76. elif [ "$OS" = windows ]; then
  77. printf " ${D}Installs below use winget. After each install open a NEW terminal (and restart Claude Code once) so PATH updates.${N}\n\n"
  78. fi
  79. printf "${B}Core${N} (the skills need these):\n"
  80. check uv uv uv "builds the shared faster-whisper venv (transcribe-url, research, auto-poster captions, voice corpus, yt-description chapters)"
  81. check ffmpeg ffmpeg ffmpeg "audio extraction for every transcription + reel keyframes"
  82. check ffprobe ffprobe ffmpeg "media probing (ig-competitor-research)"
  83. check yt-dlp yt-dlp yt-dlp "transcribe-url, yt-competitor-research, yt-description, voice-corpus-builder"
  84. check jq jq jq "ig-competitor-research + voice-corpus-builder (write the Apify dataset to disk)"
  85. check curl curl curl "media downloads (research, auto-poster, voice corpus)"
  86. check node node node "carousel-generator (Playwright renderer)"
  87. check npm npm node "carousel-generator one-time deps"
  88. # Python: probe by RUNNING it (Windows installs `python`, and its `python3` is a Store stub)
  89. PYBIN=""
  90. if python3 -c '' >/dev/null 2>&1; then PYBIN=python3
  91. elif python -c '' >/dev/null 2>&1; then PYBIN=python; fi
  92. if [ -n "$PYBIN" ]; then
  93. ok "python" "stdlib-only helper scripts in every skill (runs as \`$PYBIN\`)"
  94. else
  95. printf " ${R}✗${N} %-11s ${Y}%s${N} ${D}(needed by every skill's helper scripts)${N}\n" "python" "$(hint python3)"
  96. missing=$((missing + 1))
  97. fi
  98. printf "\n${B}Optional${N} (only if you use the feature):\n"
  99. if command -v higgsfield >/dev/null 2>&1; then
  100. if higgsfield account status >/dev/null 2>&1; then
  101. ok "higgsfield" "installed + logged in — carousel-generator AI covers"
  102. else
  103. note "higgsfield" "installed but not logged in: run \`higgsfield auth login\` (carousel-generator AI covers)"
  104. fi
  105. else
  106. note "higgsfield" "not installed; only needed for AI carousel covers: $(hint higgsfield)"
  107. fi
  108. printf "\n${B}One-time bootstraps${N} ${D}(./setup.sh does these; each skill also self-heals on first use)${N}:\n"
  109. VENV="${CONTENT_OS_WHISPER_VENV:-$HOME/.cache/content-os/whisper-venv}"
  110. if [ -e "$VENV/.deps-ok" ]; then
  111. ok "whisper venv" "$VENV (shared faster-whisper engine, ready)"
  112. else
  113. note "whisper venv" "not built yet — builds automatically on the first transcription (~200 MB + model), or run ./setup.sh"
  114. fi
  115. PVENV="${CONTENT_OS_PILLOW_VENV:-$HOME/.cache/content-os/pillow-venv}"
  116. if [ -e "$PVENV/.deps-ok" ]; then
  117. ok "report venv" "$PVENV (pillow, for the competitor-research HTML reports, ready)"
  118. else
  119. note "report venv" "not built yet — builds automatically on the first competitor-research report, or run ./setup.sh"
  120. fi
  121. CAR="$REPO/.claude/skills/carousel-generator/scripts"
  122. if [ -d "$CAR/node_modules/playwright" ]; then
  123. ok "carousel deps" "Playwright installed in the skill (run \`bash .claude/skills/carousel-generator/install.sh\` again if Chromium is missing)"
  124. else
  125. note "carousel deps" "not installed — run: bash .claude/skills/carousel-generator/install.sh (npm deps + headless Chromium, one time)"
  126. fi
  127. if [ -f "$REPO/.claude/skills/auto-poster/.env" ]; then
  128. ok "auto-poster" ".claude/skills/auto-poster/.env present (Zernio key + account IDs)"
  129. else
  130. note "auto-poster" "no .claude/skills/auto-poster/.env yet — copy .env.example there and add your Zernio API key + account IDs before posting"
  131. fi
  132. printf "\n${B}Connections${N} ${D}(set up inside Claude Code, not checkable from a shell)${N}:\n"
  133. printf " ${D}•${N} Notion MCP (scriptwriter + the pipeline DB) · Apify MCP (ig-competitor-research, voice-corpus-builder IG) · Claude in Chrome extension (feed research, dm-revival)\n"
  134. printf "\n"
  135. if [ "$missing" -eq 0 ]; then
  136. printf "${G}${B}All core tools present.${N}\n\n"
  137. else
  138. printf "${R}${B}%d core item(s) missing.${N} Run the commands shown above, then re-run this script.\n\n" "$missing"
  139. fi
  140. [ "$missing" -eq 0 ]
content-os/setup.sh · Bundled script · 251 lines · 2 findings marked
  1. #!/usr/bin/env bash
  2. # setup.sh — ONE-COMMAND auto-setup for content-os. Detects your OS (macOS, Windows
  3. # via Git Bash, or Linux), installs every system tool the skills need, pre-builds the
  4. # shared transcription engine and the carousel renderer so first use is instant,
  5. # verifies with ./check-setup.sh, and writes the .setup-complete marker.
  6. # Safe to re-run any time: it skips what's already done.
  7. #
  8. # ./setup.sh
  9. #
  10. # macOS: installs via Homebrew (if Homebrew itself is missing you run its one-liner
  11. # once, it needs your password, then re-run this).
  12. # Windows: run from Git Bash (the shell Claude Code uses on Windows); installs via
  13. # winget. Newly installed tools sometimes need a new terminal before they're
  14. # on PATH; this script pulls in their well-known install dirs so most setups
  15. # finish in ONE run; if anything is still pending it says exactly what to do.
  16. # Linux: apt for the system tools (you run the printed sudo lines), uv for the rest.
  17. #
  18. # Exit codes (Claude reads these; each prints exactly what to do):
  19. # 0 tools done (the CONNECTIONS checklist it prints is the next step)
  20. # 1 something needs fixing first; the output says what
  21. # 2 restart needed: freshly installed tools aren't on this session's PATH yet.
  22. # Restart Claude Code, then re-run ./setup.sh; it finishes the rest.
  23. #
  24. # What this does NOT do (it can't; these are your accounts): connect the Notion /
  25. # Apify / Chrome MCPs inside Claude Code, add your Zernio key, log in to Higgsfield,
  26. # or personalize the system (brand-kit.md). Claude walks you through those next.
  27. set -uo pipefail
  28. HERE="$(cd "$(dirname "$0")" && pwd)"
  29. if [ -f "$HERE/check-setup.sh" ]; then ROOT="$HERE"
  30. elif [ -f "$HERE/../../check-setup.sh" ]; then ROOT="$(cd "$HERE/../.." && pwd)"
  31. else printf 'ERROR: cannot locate the project root (check-setup.sh not found)\n' >&2; exit 1; fi
  32. cd "$ROOT"
  33. say() { printf '%s\n' "$*"; }
  34. have() { command -v "$1" >/dev/null 2>&1; }
  35. UNAME="$(uname -s 2>/dev/null || echo unknown)"
  36. case "$UNAME" in
  37. Darwin) OS=mac ;;
  38. MINGW*|MSYS*|CYGWIN*) OS=windows ;;
  39. Linux) OS=linux ;;
  40. *) OS=other ;;
  41. esac
  42. pybin() { # Windows installs `python`; its `python3` is a Store stub, so probe by running
  43. if python3 -c '' >/dev/null 2>&1; then echo python3
  44. elif python -c '' >/dev/null 2>&1; then echo python
  45. else echo ""; fi
  46. }
  47. if [ "$OS" = other ]; then
  48. say "Unrecognized shell/OS ($UNAME)."
  49. say "On Windows, run this from Git Bash (installed with Git for Windows: winget install Git.Git)."
  50. exit 1
  51. fi
  52. case "$OS" in mac) OSLBL="macOS" ;; windows) OSLBL="Windows · Git Bash" ;; *) OSLBL="Linux" ;; esac
  53. say "== content-os auto-setup ($OSLBL) =="
  54. say ""
  55. PENDING=0
  56. # ─── macOS: Homebrew ─────────────────────────────────────────────────────────
  57. if [ "$OS" = mac ]; then
  58. if ! have brew; then
  59. say "Homebrew is missing: it's the one step that needs YOUR password, so run this"
  60. say "in your terminal, then re-run ./setup.sh:"
  61. say ''
  62. say ' /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"'
  63. exit 1
  64. fi
  65. for pkg in uv ffmpeg yt-dlp jq node python; do
  66. case "$pkg" in
  67. python) [ -n "$(pybin)" ] && { say " ✓ python present"; continue; } ;;
  68. *) have "$pkg" && { say " ✓ $pkg present"; continue; } ;;
  69. esac
  70. say " ▸ installing $pkg (brew)…"
  71. brew install "$pkg" || say " ⚠ brew install $pkg failed; re-run ./setup.sh after fixing the error above"
  72. done
  73. fi
  74. # ─── Windows: winget + same-session PATH pickup ──────────────────────────────
  75. if [ "$OS" = windows ]; then
  76. if ! have winget && ! have winget.exe; then
  77. say "winget is missing. Install 'App Installer' from the Microsoft Store, then re-run ./setup.sh."
  78. exit 1
  79. fi
  80. WG_FAILED=""
  81. wg() { # wg <winget-id> <label>: install; on a real failure show winget's last lines and remember it
  82. local out rc
  83. out="$(winget install --exact --id "$1" --accept-source-agreements --accept-package-agreements --disable-interactivity 2>&1)"; rc=$?
  84. # winget returns distinct nonzero codes for "already installed" (0x8A15002B) / "no newer version";
  85. # treat only codes that also leave the tool invisible as failures (checked after refresh_path)
  86. if [ $rc -ne 0 ] && ! printf '%s' "$out" | grep -qiE 'already installed|no available upgrade|No newer package'; then
  87. say " ⚠ winget install $1 exited $rc:"; printf '%s\n' "$out" | tail -n 3 | sed 's/^/ /'
  88. WG_FAILED="$WG_FAILED $2"
  89. fi
  90. return 0
  91. }
  92. refresh_path() {
  93. local d
  94. for d in "/c/Program Files/nodejs" \
  95. "$(cygpath -u "${LOCALAPPDATA:-}" 2>/dev/null)/Programs/Python/Python312" \
  96. "$(cygpath -u "${LOCALAPPDATA:-}" 2>/dev/null)/Programs/Python/Python312/Scripts" \
  97. "$(cygpath -u "${USERPROFILE:-}" 2>/dev/null)/.local/bin" \
  98. "$(cygpath -u "${LOCALAPPDATA:-}" 2>/dev/null)/Microsoft/WinGet/Links"; do
  99. [ -d "$d" ] && PATH="$d:$PATH"
  100. done
  101. for d in "$(cygpath -u "${LOCALAPPDATA:-}" 2>/dev/null)/Microsoft/WinGet/Packages"/Gyan.FFmpeg*/ffmpeg-*/bin; do
  102. [ -d "$d" ] && PATH="$d:$PATH"
  103. done
  104. export PATH
  105. }
  106. if have uv; then say " ✓ uv present"; else say " ▸ installing uv (winget)…"; wg astral-sh.uv uv; fi
  107. if have ffmpeg; then say " ✓ ffmpeg present"; else say " ▸ installing ffmpeg (winget)…"; wg Gyan.FFmpeg ffmpeg; fi
  108. if have yt-dlp; then say " ✓ yt-dlp present"; else say " ▸ installing yt-dlp (winget)…"; wg yt-dlp.yt-dlp yt-dlp; fi
  109. if have jq; then say " ✓ jq present"; else say " ▸ installing jq (winget)…"; wg jqlang.jq jq; fi
  110. if have node; then say " ✓ node present"; else say " ▸ installing node (winget)…"; wg OpenJS.NodeJS.LTS node; fi
  111. if [ -n "$(pybin)" ]; then say " ✓ python present"; else say " ▸ installing python (winget)…"; wg Python.Python.3.12 python; fi
  112. refresh_path
  113. MISSING_WIN=""
  114. for t in uv ffmpeg yt-dlp jq node; do have "$t" || MISSING_WIN="$MISSING_WIN $t"; done
  115. [ -n "$(pybin)" ] || MISSING_WIN="$MISSING_WIN python"
  116. if [ -n "$MISSING_WIN" ]; then
  117. # a tool whose winget install actually failed is a fix-first (exit 1), not a restart (exit 2)
  118. for t in $MISSING_WIN; do
  119. case " $WG_FAILED " in *" $t "*) say " ✗ $t: the winget install failed (see above). Run ./check-setup.sh for the exact command, install it by hand, then re-run ./setup.sh"; WIN_FIX=1 ;; esac
  120. done
  121. [ "${WIN_FIX:-0}" -eq 1 ] && exit 1
  122. # installed fine but not on this session's PATH yet: one restart; a second miss means PATH is really wrong
  123. RESTARTS=0; [ -f .setup-restarts ] && RESTARTS="$(cat .setup-restarts 2>/dev/null || echo 0)"
  124. if [ "${RESTARTS:-0}" -ge 2 ]; then
  125. say " ✗ still not visible after two restarts:$MISSING_WIN"
  126. say " Open a NEW terminal, run: where $(echo $MISSING_WIN | cut -d' ' -f1) and if it prints nothing, install it by hand"
  127. say " (./check-setup.sh prints the winget line), then re-run ./setup.sh."
  128. exit 1
  129. fi
  130. echo $((RESTARTS + 1)) > .setup-restarts
  131. say " ⚠ installed but not visible yet in this session:$MISSING_WIN"
  132. PENDING=1
  133. fi
  134. fi
  135. # ─── Linux: apt lines are printed (sudo), uv installs itself + yt-dlp ───────
  136. if [ "$OS" = linux ]; then
  137. MISSING_APT=""
  138. for t in ffmpeg jq curl python3; do have "$t" || MISSING_APT="$MISSING_APT $t"; done
  139. if [ -n "$MISSING_APT" ]; then
  140. say " ▸ these need sudo, run them yourself, then re-run ./setup.sh:"
  141. say " sudo apt update && sudo apt install -y$MISSING_APT"
  142. if ! have node; then say " curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash - && sudo apt install -y nodejs"; fi
    • Note: Pipes a downloaded script directly into a shell (curl | sh / wget | bash)
    • Line 149 on GitHub
  143. exit 1
  144. fi
  145. if ! have node; then
  146. say " ▸ node is missing (needs sudo), run this then re-run ./setup.sh:"
  147. say " curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash - && sudo apt install -y nodejs"
    • Note: Pipes a downloaded script directly into a shell (curl | sh / wget | bash)
    • Line 154 on GitHub
  148. exit 1
  149. fi
  150. if have uv; then say " ✓ uv present"; else
  151. say " ▸ installing uv (astral installer, no sudo)…"
  152. curl -LsSf https://astral.sh/uv/install.sh | sh >/dev/null 2>&1 || say " ⚠ uv install failed"
  153. export PATH="$HOME/.local/bin:$PATH"
  154. fi
  155. if have yt-dlp; then say " ✓ yt-dlp present"; else
  156. say " ▸ installing yt-dlp (uv tool)…"
  157. uv tool install yt-dlp >/dev/null 2>&1 || say " ⚠ uv tool install yt-dlp failed"
  158. export PATH="$HOME/.local/bin:$PATH"
  159. fi
  160. fi
  161. # ─── Restart gate (Windows PATH) ─────────────────────────────────────────────
  162. if [ "$PENDING" -eq 1 ]; then
  163. say ""
  164. say "== Almost done: some just-installed tools need a fresh environment =="
  165. say "One step for you: quit Claude Code, open a NEW terminal window (so PATH refreshes),"
  166. say "start Claude Code in this folder again and say \"continue setup\"; it re-runs"
  167. say "./setup.sh, which skips everything already done and finishes the rest."
  168. exit 2
  169. fi
  170. # ─── Shared transcription engine (faster-whisper venv, built once) ───────────
  171. say ""
  172. VENV="${CONTENT_OS_WHISPER_VENV:-$HOME/.cache/content-os/whisper-venv}"
  173. if [ -e "$VENV/.deps-ok" ]; then
  174. say " ✓ transcription engine ready ($VENV)"
  175. elif have uv; then
  176. say " ▸ building the shared transcription engine (faster-whisper, ~200 MB, one time)…"
  177. rm -rf "$VENV"
  178. if uv venv "$VENV" --python 3.11 >/dev/null 2>&1; then
  179. PYBIN="$VENV/bin/python"; [ -e "$PYBIN" ] || PYBIN="$VENV/Scripts/python.exe"
  180. if uv pip install --quiet --python "$PYBIN" faster-whisper onnxruntime; then
  181. touch "$VENV/.deps-ok"; say " ✓ transcription engine built"
  182. else
  183. say " ⚠ faster-whisper install failed (network?); the first transcription retries it automatically"
  184. fi
  185. else
  186. say " ⚠ uv venv failed; the first transcription retries it automatically"
  187. fi
  188. else
  189. say " ⚠ uv not available; the transcription engine builds on first use instead"
  190. fi
  191. # (whisper models download from Hugging Face on first use: tiny.en ~75 MB for captions,
  192. # small.en ~460 MB for research/corpus transcripts. Needs internet once.)
  193. # ─── Report builder venv (pillow, for the two competitor-research HTML reports) ──
  194. PVENV="${CONTENT_OS_PILLOW_VENV:-$HOME/.cache/content-os/pillow-venv}"
  195. if [ -e "$PVENV/.deps-ok" ]; then
  196. say " ✓ report builder ready ($PVENV)"
  197. elif have uv; then
  198. say " ▸ building the report-builder venv (pillow, small, one time)…"
  199. rm -rf "$PVENV"
  200. if uv venv "$PVENV" --python 3.11 >/dev/null 2>&1; then
  201. PPY="$PVENV/bin/python"; [ -e "$PPY" ] || PPY="$PVENV/Scripts/python.exe"
  202. if uv pip install --quiet --python "$PPY" pillow; then touch "$PVENV/.deps-ok"; say " ✓ report builder built"
  203. else say " ⚠ pillow install failed (network?); the first research report retries it automatically"; fi
  204. else
  205. say " ⚠ uv venv failed; the first research report retries it automatically"
  206. fi
  207. fi
  208. # ─── Carousel renderer (npm deps + headless Chromium, built once) ────────────
  209. CAR="$ROOT/.claude/skills/carousel-generator"
  210. if [ -d "$CAR/scripts/node_modules/playwright" ]; then
  211. say " ✓ carousel renderer ready"
  212. elif have node && have npm; then
  213. say " ▸ installing the carousel renderer (Playwright + Chromium, ~130 MB, one time)…"
  214. if bash "$CAR/install.sh" >/dev/null 2>&1; then say " ✓ carousel renderer installed"
  215. else say " ⚠ carousel install failed; run: bash .claude/skills/carousel-generator/install.sh (read its output)"; fi
  216. else
  217. say " ⚠ node/npm not available; run bash .claude/skills/carousel-generator/install.sh later"
  218. fi
  219. # ─── Verify ──────────────────────────────────────────────────────────────────
  220. say ""
  221. say "== Verifying with check-setup.sh =="
  222. ./check-setup.sh || { say ""; say "Fix the items above, then re-run ./setup.sh"; exit 1; }
  223. touch ".setup-complete"; rm -f .setup-restarts
  224. # ─── Connections checklist (your accounts; Claude walks you through these) ───
  225. say "== Tools done. Next: CONNECTIONS (Claude checks which are already live) =="
  226. say " 1. Notion MCP (the content pipeline DB + scriptwriter):"
  227. say " claude mcp add --transport http notion https://mcp.notion.com/mcp then /mcp to sign in"
  228. say " 2. Apify MCP (Instagram competitor research + your own IG voice corpus):"
  229. say " claude mcp add --transport http apify https://mcp.apify.com then /mcp to sign in"
  230. say " 3. Claude in Chrome extension (feed research + DM revival): install it in Chrome,"
  231. say " run Claude Code from the terminal (not the desktop app) when using those skills."
  232. say " 4. Zernio (auto-poster): API key + connected accounts -> .claude/skills/auto-poster/.env"
  233. say " (copy .env.example there; Claude can fill the account IDs from the API for you)"
  234. say " 5. Higgsfield (optional, AI carousel covers): install the CLI, then higgsfield auth login"
  235. say ""
  236. say "Then personalize: fill brand-kit.md and tell Claude \"apply my brand kit\" (it builds your"
  237. say "voice corpus, backbone, competitor list, and Notion DB from that one file)."
  238. exit 0
skills/content-distribution/carousel-generator/install.sh · Bundled script · 52 lines · 1 finding marked
  1. #!/usr/bin/env bash
  2. # carousel-generator — one-shot installer (THE bootstrap for this skill).
  3. # Run once after dropping this folder into <project>/.claude/skills/, from the project root:
  4. # bash .claude/skills/carousel-generator/install.sh
  5. set -euo pipefail
  6. cd "$(dirname "$0")"
  7. SKILL_REL=".claude/skills/carousel-generator"
  8. echo "▶ carousel-generator setup"
  9. # 1. Node check
  10. if ! command -v node >/dev/null 2>&1; then
  11. echo "✗ Node.js not found. Install it (https://nodejs.org or 'brew install node'), then re-run." >&2
  12. exit 1
  13. fi
  14. echo "✓ node $(node -v)"
  15. # 2. Python check (for AI covers via cover.py). Probe by RUNNING it: on Windows
  16. # `python3` may be the Store stub that resolves but never runs, and the real
  17. # binary is `python`.
  18. PY=""
  19. if python3 -c '' >/dev/null 2>&1; then PY=python3
  20. elif python -c '' >/dev/null 2>&1; then PY=python
  21. fi
  22. if [ -n "$PY" ]; then
  23. echo "✓ $("$PY" --version 2>&1) (run cover.py with: $PY)"
  24. else
  25. echo "⚠ python3/python not found — AI cover generation (cover.py) won't work, but HTML rendering will."
  26. fi
  27. # 3. npm deps (Playwright)
  28. echo "▶ Installing npm dependencies (Playwright)…"
  29. ( cd scripts && npm install --no-audit --no-fund )
  30. # 4. Chromium for Playwright (one-time, ~130 MB)
  31. echo "▶ Installing Chromium for Playwright (one-time)…"
  32. ( cd scripts && node node_modules/playwright/cli.js install chromium )
  33. # 5. Higgsfield CLI (optional — only needed for AI cover images)
  34. if command -v higgsfield >/dev/null 2>&1; then
  35. echo "✓ higgsfield CLI found"
  36. else
  37. echo "⚠ higgsfield CLI not installed (optional — only needed for AI cover images)."
  38. echo " Install: curl -fsSL https://raw.githubusercontent.com/higgsfield-ai/cli/main/install.sh | sh"
    • Note: Pipes a downloaded script directly into a shell (curl | sh / wget | bash)
    • Line 44 on GitHub
  39. echo " Then: higgsfield auth login"
  40. fi
  41. echo
  42. echo "✓ Done. Smoke-test it (from the project root; slides land in carousel/outputs/_smoketest/):"
  43. echo " node $SKILL_REL/scripts/render.js $SKILL_REL/scripts/smoketest.json --out carousel/outputs/_smoketest --no-open"
  44. [ -n "$PY" ] && echo " AI covers: $PY $SKILL_REL/scripts/cover.py carousel/outputs/<slug>/carousel.json"
  45. echo " Or just ask Claude: \"make a carousel about <topic>\""
skills/content-distribution/carousel-generator/scripts/cover.py · Bundled script · 219 lines · 1 finding marked
  1. #!/usr/bin/env python3
  2. """
  3. Carousel cover generator — Higgsfield (Nano Banana Pro) -> 4:5 cover image(s).
  4. Reads the carousel manifest's `cover` block, generates N *textless* cover
  5. variants via the Higgsfield CLI, and downloads them next to the manifest in
  6. `cover/`. You then set slides[0].image to the one you like and render — the
  7. headline is overlaid in HTML by render.js, so text is NEVER baked into the
  8. image (crisp, editable, on-brand typography; AI glitch-text impossible).
  9. Manifest `cover` block:
  10. "cover": {
  11. "concept": "cinematic, textless, no-UI prompt for the cover background",
  12. "face_refs": false, # true => anchor with assets/face-refs/ photos
  13. "aspect": "4:5", # 1080x1350 is exactly 4:5; CSS object-fit covers anyway
  14. "variants": 3
  15. }
  16. # multiple cover directions: use "concepts": [{ "id": "...", "prompt": "..." }, ...]
  17. Usage:
  18. python3 cover.py <manifest.json> [--variants N] [--yes] [--dry-run] [--only-concept ID]
  19. """
  20. import argparse
  21. import json
  22. import os
  23. import re
  24. import shutil
  25. import subprocess
  26. import sys
  27. import urllib.request
  28. from concurrent.futures import ThreadPoolExecutor, as_completed
  29. from pathlib import Path
  30. PROJECT_ROOT = Path(__file__).resolve().parents[4]
  31. FACE_REF_DIR = PROJECT_ROOT / "assets" / "face-refs"
  32. MODEL = "nano_banana_2" # the CLI id for Nano Banana Pro
  33. RESOLUTION = "2k" # nano_banana_2 uses --resolution (2k is free vs 1k)
  34. DEFAULT_ASPECT = "4:5"
  35. DEFAULT_VARIANTS = 3
  36. WAIT_TIMEOUT = "10m"
  37. CREDITS_PER_IMG = 2.0
  38. IMG_SUFFIXES = {".png", ".jpg", ".jpeg", ".webp"}
  39. IMG_EXT_RE = re.compile(r"\.(png|jpe?g|webp)(\?|$)", re.I)
  40. def ensure_cli():
  41. if shutil.which("higgsfield") is None:
  42. sys.exit("[cover] higgsfield CLI not found. Install: "
  43. "curl -fsSL https://raw.githubusercontent.com/higgsfield-ai/cli/main/install.sh | sh")
    • Note: Pipes a downloaded script directly into a shell (curl | sh / wget | bash)
    • Line 49 on GitHub
  44. # NOTE: it's `account status` (exit 0 when logged in), NOT `auth status`.
  45. r = subprocess.run(["higgsfield", "account", "status"], capture_output=True, text=True)
  46. if r.returncode != 0:
  47. sys.exit("[cover] higgsfield CLI not authenticated. Run: higgsfield auth login")
  48. def collect_face_refs(enabled):
  49. if not enabled:
  50. return []
  51. refs = []
  52. if FACE_REF_DIR.is_dir():
  53. refs = sorted(p for p in FACE_REF_DIR.iterdir() if p.suffix.lower() in IMG_SUFFIXES)
  54. if not refs:
  55. print(f"[cover] WARNING: face_refs=true but 0 reference photos found in {FACE_REF_DIR} "
  56. "(expects <project>/assets/face-refs/ with this skill installed at "
  57. "<project>/.claude/skills/carousel-generator/). Generating WITHOUT a face anchor.",
  58. file=sys.stderr)
  59. return refs
  60. def extract_result_url(stdout):
  61. """Walk the JSON for a node with status==completed AND a string result_url.
  62. Strict (no regex fallback) so we don't grab echoed --image upload URLs."""
  63. try:
  64. data = json.loads(stdout)
  65. except (json.JSONDecodeError, ValueError):
  66. return None
  67. found = []
  68. def walk(n):
  69. if isinstance(n, dict):
  70. if n.get("status") == "completed" and isinstance(n.get("result_url"), str):
  71. found.append(n["result_url"])
  72. for v in n.values():
  73. walk(v)
  74. elif isinstance(n, list):
  75. for v in n:
  76. walk(v)
  77. walk(data)
  78. return found[0] if found else None
  79. def ext_from_url(url):
  80. m = IMG_EXT_RE.search(url)
  81. if not m:
  82. return ".png"
  83. e = m.group(1).lower()
  84. return ".jpg" if e in ("jpg", "jpeg") else f".{e}"
  85. def download(url, dest):
  86. dest.parent.mkdir(parents=True, exist_ok=True)
  87. with urllib.request.urlopen(url, timeout=180) as r, open(dest, "wb") as f:
  88. while True:
  89. chunk = r.read(1 << 16)
  90. if not chunk:
  91. break
  92. f.write(chunk)
  93. def generate_one(concept, v, aspect, refs, out_dir):
  94. cid = concept["id"]
  95. cmd = ["higgsfield", "--json", "generate", "create", MODEL,
  96. "--prompt", concept["prompt"],
  97. "--aspect_ratio", aspect,
  98. "--resolution", RESOLUTION,
  99. "--wait", "--wait-timeout", WAIT_TIMEOUT]
  100. for p in refs:
  101. cmd += ["--image", str(p)]
  102. r = subprocess.run(cmd, capture_output=True, text=True)
  103. if r.returncode != 0:
  104. return {"id": f"{cid}_v{v}", "status": "error",
  105. "error": (r.stderr or r.stdout or "cli error").strip()[:300]}
  106. url = extract_result_url(r.stdout)
  107. if not url:
  108. return {"id": f"{cid}_v{v}", "status": "error", "error": "no result_url in output"}
  109. dest = out_dir / f"{cid}_v{v}{ext_from_url(url)}"
  110. try:
  111. download(url, dest)
  112. except Exception as e: # noqa: BLE001
  113. return {"id": f"{cid}_v{v}", "status": "error", "error": f"download failed: {e}"}
  114. return {"id": f"{cid}_v{v}", "status": "ok", "path": str(dest), "source_url": url}
  115. def main():
  116. ap = argparse.ArgumentParser(description="Generate carousel cover images via Higgsfield.")
  117. ap.add_argument("manifest", help="path to carousel.json")
  118. ap.add_argument("--variants", type=int, help="override cover.variants")
  119. ap.add_argument("--yes", action="store_true", help="skip the confirm prompt")
  120. ap.add_argument("--dry-run", action="store_true", help="print the plan, submit nothing")
  121. ap.add_argument("--only-concept", help="generate just this concept id")
  122. args = ap.parse_args()
  123. mpath = Path(args.manifest).resolve()
  124. manifest = json.loads(mpath.read_text(encoding="utf-8"))
  125. cover = manifest.get("cover") or {}
  126. concepts = cover.get("concepts")
  127. if not concepts and cover.get("concept"):
  128. concepts = [{"id": "cover", "prompt": cover["concept"]}]
  129. if not concepts:
  130. sys.exit("[cover] manifest has no cover.concept (or cover.concepts[]). "
  131. "Add a textless, no-UI cinematic prompt.")
  132. for i, c in enumerate(concepts):
  133. c.setdefault("id", f"cover{i + 1}" if len(concepts) > 1 else "cover")
  134. if not c.get("prompt"):
  135. sys.exit(f"[cover] concept {c['id']} missing prompt")
  136. if args.only_concept:
  137. concepts = [c for c in concepts if c["id"] == args.only_concept]
  138. if not concepts:
  139. sys.exit(f"[cover] no concept id matches {args.only_concept}")
  140. aspect = cover.get("aspect") or DEFAULT_ASPECT
  141. # distinguish None from 0 so an explicit 0 isn't silently coerced to the default
  142. variants = args.variants if args.variants is not None else cover.get("variants")
  143. if variants is None:
  144. variants = DEFAULT_VARIANTS
  145. if variants < 1:
  146. sys.exit("[cover] variants must be >= 1")
  147. refs = collect_face_refs(bool(cover.get("face_refs", False)))
  148. out_dir = mpath.parent / "cover"
  149. jobs = [(c, v) for c in concepts for v in range(1, variants + 1)]
  150. total = len(jobs)
  151. print(f"[cover] {len(concepts)} concept(s) x {variants} variant(s) = {total} image(s) "
  152. f"~ {total * CREDITS_PER_IMG:g} credits | aspect {aspect} | refs {len(refs)} | {MODEL}",
  153. file=sys.stderr)
  154. for c in concepts:
  155. print(f" - {c['id']}: {c['prompt'][:90]}...", file=sys.stderr)
  156. if args.dry_run:
  157. print("[cover] dry-run, nothing submitted.", file=sys.stderr)
  158. return
  159. ensure_cli()
  160. # confirm only when a human is at a TTY; non-interactive runs (Claude's Bash,
  161. # CI) skip the prompt so they neither abort on EOF nor hang on a blocked stdin.
  162. if not args.yes and sys.stdin.isatty():
  163. try:
  164. ans = input("[cover] generate now? [y/N] ").strip().lower()
  165. except EOFError: # Ctrl-D at the prompt = no
  166. ans = ""
  167. if ans not in ("y", "yes"):
  168. sys.exit("[cover] aborted.")
  169. out_dir.mkdir(parents=True, exist_ok=True)
  170. results = {}
  171. with ThreadPoolExecutor(max_workers=min(6, total)) as ex:
  172. futs = {ex.submit(generate_one, c, v, aspect, refs, out_dir): (c["id"], v)
  173. for c, v in jobs}
  174. for fut in as_completed(futs):
  175. r = fut.result()
  176. results[r["id"]] = r
  177. tag = "OK " if r["status"] == "ok" else "ERR"
  178. print(f"[cover] {tag} {r['id']}: {r.get('path') or r.get('error')}", file=sys.stderr)
  179. ok = sorted((r for r in results.values() if r["status"] == "ok"), key=lambda r: r["id"])
  180. print(f"\n[cover] {len(ok)}/{total} generated -> {out_dir}")
  181. if ok:
  182. rel = os.path.relpath(ok[0]["path"], mpath.parent)
  183. print(f'[cover] pick one, then set slides[0] = '
  184. f'{{"type":"cover_image","image":"{rel}", "headline":"...", ...}}')
  185. if len(ok) < total:
  186. sys.exit(2)
  187. if __name__ == "__main__":
  188. main()

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.