clipbait 1.0.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +12 -2
  2. package/index.js +45 -0
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -2,9 +2,18 @@
2
2
 
3
3
  Turn any video into short viral clips — and auto-clip live streams — from your terminal or an AI agent. Wraps the [Clipbait](https://clipbait.ai) API.
4
4
 
5
- ## Install / use
5
+ ## Fastest start — wire it into Claude Code in one command
6
6
  ```bash
7
- npx clipbait login <your_api_key> # get it at clipbait.ai → Me → Developers / API
7
+ npx clipbait init <your_api_key> # get it at clipbait.ai → Me → Developers / API
8
+ ```
9
+ This saves your key, installs a **`/clipbait`** slash command, and connects the Clipbait MCP server to Claude Code. Then just type in Claude:
10
+ ```
11
+ /clipbait https://youtube.com/watch?v=...
12
+ ```
13
+
14
+ ## Or use it straight from the terminal
15
+ ```bash
16
+ npx clipbait login <your_api_key>
8
17
  npx clipbait generate "https://youtube.com/watch?v=..." --aspect 9:16 --max 9
9
18
  npx clipbait status <jobId> # get finished clip URLs
10
19
  ```
@@ -12,6 +21,7 @@ npx clipbait status <jobId> # get finished clip URLs
12
21
  ## Commands
13
22
  | Command | Description |
14
23
  |---|---|
24
+ | `clipbait init <apiKey>` | One-command Claude Code setup (`/clipbait` + MCP) |
15
25
  | `clipbait login <apiKey>` | Save your API key (`~/.clipbait.json`) |
16
26
  | `clipbait generate <url> [--aspect 9:16] [--type talking_head] [--max 9]` | Generate clips |
17
27
  | `clipbait status <jobId>` | Check a job + get clip URLs |
package/index.js CHANGED
@@ -40,6 +40,7 @@ function parseFlags(args) {
40
40
 
41
41
  const HELP = `clipbait — AI clip generation
42
42
 
43
+ clipbait init <apiKey> set up Claude Code: /clipbait command + MCP
43
44
  clipbait login <apiKey> save your API key
44
45
  clipbait generate <url> [--aspect 9:16] [--type talking_head] [--max 9]
45
46
  clipbait status <jobId> check a job + get clip URLs
@@ -59,6 +60,50 @@ Auth: CLIPBAIT_API_KEY env var or ~/.clipbait.json (via 'clipbait login').`;
59
60
  console.log("✓ Saved API key to " + CFG);
60
61
  return;
61
62
  }
63
+ if (cmd === "init") {
64
+ // One-command Claude Code setup: save the key, install a /clipbait
65
+ // slash command, and register the Clipbait MCP server.
66
+ const key = args[0] && args[0].startsWith("cbk_") ? args[0] : loadKey();
67
+ if (!key) {
68
+ console.error("Usage: clipbait init <cbk_live_...>\n Get your key at clipbait.ai → Me → Developers / API");
69
+ process.exit(1);
70
+ }
71
+ fs.writeFileSync(CFG, JSON.stringify({ apiKey: key }, null, 2));
72
+ const mcpUrl = "https://app.clipbait.ai/api/mcp/" + key;
73
+
74
+ // 1) Install the /clipbait slash command for Claude Code.
75
+ const cmdDir = path.join(os.homedir(), ".claude", "commands");
76
+ fs.mkdirSync(cmdDir, { recursive: true });
77
+ const slash = `---
78
+ description: Turn any video into viral clips with Clipbait
79
+ argument-hint: <video-url> [what you want]
80
+ ---
81
+ You have the \`clipbait\` MCP tools connected. The user's request: $ARGUMENTS
82
+
83
+ Do this, conversationally and fast:
84
+ 1. If there is no video URL in the request, ask for one (YouTube, Twitch VOD, Rumble, or Ganjing World). Otherwise don't ask for confirmation, just go.
85
+ 2. Read the intent and set params for \`generate_clips\`:
86
+ - vertical / shorts / tiktok / reels, or nothing specified => aspectRatio "9:16". landscape / widescreen / youtube => "16:9".
87
+ - if they mention a number of clips, use it as maxClips (1 to 20), otherwise 9.
88
+ 3. Call \`generate_clips\`, then poll \`get_job\` with the returned jobId every 30 seconds until status is "complete". Report progress between polls.
89
+ 4. When complete, list each finished clip as a numbered list: its hook and its URL.
90
+ 5. Then offer follow-ups and act on them by calling the tools again: regenerate at a different aspect ratio, pull more clips, or probe another video with \`probe_video\`.
91
+ `;
92
+ fs.writeFileSync(path.join(cmdDir, "clipbait.md"), slash);
93
+ console.log("✓ Installed /clipbait command → " + path.join(cmdDir, "clipbait.md"));
94
+
95
+ // 2) Register the MCP server with Claude Code (if the `claude` CLI exists).
96
+ const { spawnSync } = require("child_process");
97
+ const r = spawnSync("claude", ["mcp", "add", "--transport", "http", "clipbait", mcpUrl], { stdio: "ignore" });
98
+ if (!r.error && r.status === 0) {
99
+ console.log("✓ Connected the Clipbait MCP server to Claude Code");
100
+ } else {
101
+ console.log("• Couldn't auto-connect the MCP server (Claude Code CLI not found). Run this once:");
102
+ console.log(" claude mcp add --transport http clipbait " + mcpUrl);
103
+ }
104
+ console.log("\nDone. Restart Claude Code, then try:\n /clipbait https://youtube.com/watch?v=...");
105
+ return;
106
+ }
62
107
  if (!cmd || cmd === "help" || cmd === "--help" || cmd === "-h") { console.log(HELP); return; }
63
108
  if (!loadKey()) {
64
109
  console.error("No API key. Run: clipbait login <key> (get it at clipbait.ai → Me → API key)");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clipbait",
3
- "version": "1.0.0",
3
+ "version": "1.2.0",
4
4
  "description": "Clipbait CLI — turn any video into viral clips, and auto-clip live streams, from your terminal or AI agent.",
5
5
  "bin": { "clipbait": "index.js" },
6
6
  "type": "commonjs",