clipbait 1.0.0 → 1.1.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.
- package/README.md +12 -2
- package/index.js +42 -0
- 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
|
-
##
|
|
5
|
+
## Fastest start — wire it into Claude Code in one command
|
|
6
6
|
```bash
|
|
7
|
-
npx clipbait
|
|
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,47 @@ 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 a video into viral clips with Clipbait
|
|
79
|
+
argument-hint: <video-url>
|
|
80
|
+
---
|
|
81
|
+
Use the \`clipbait\` MCP tools to turn this into viral clips: $ARGUMENTS
|
|
82
|
+
|
|
83
|
+
1. Call \`generate_clips\` with videoUrl set to the URL above (aspectRatio "9:16", maxClips 9).
|
|
84
|
+
2. Poll \`get_job\` with the returned jobId every 30 seconds until status is "complete".
|
|
85
|
+
3. Show me the finished clip URLs.
|
|
86
|
+
|
|
87
|
+
If no URL is provided above, ask me for the video URL first.
|
|
88
|
+
`;
|
|
89
|
+
fs.writeFileSync(path.join(cmdDir, "clipbait.md"), slash);
|
|
90
|
+
console.log("✓ Installed /clipbait command → " + path.join(cmdDir, "clipbait.md"));
|
|
91
|
+
|
|
92
|
+
// 2) Register the MCP server with Claude Code (if the `claude` CLI exists).
|
|
93
|
+
const { spawnSync } = require("child_process");
|
|
94
|
+
const r = spawnSync("claude", ["mcp", "add", "--transport", "http", "clipbait", mcpUrl], { stdio: "ignore" });
|
|
95
|
+
if (!r.error && r.status === 0) {
|
|
96
|
+
console.log("✓ Connected the Clipbait MCP server to Claude Code");
|
|
97
|
+
} else {
|
|
98
|
+
console.log("• Couldn't auto-connect the MCP server (Claude Code CLI not found). Run this once:");
|
|
99
|
+
console.log(" claude mcp add --transport http clipbait " + mcpUrl);
|
|
100
|
+
}
|
|
101
|
+
console.log("\nDone. Restart Claude Code, then try:\n /clipbait https://youtube.com/watch?v=...");
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
62
104
|
if (!cmd || cmd === "help" || cmd === "--help" || cmd === "-h") { console.log(HELP); return; }
|
|
63
105
|
if (!loadKey()) {
|
|
64
106
|
console.error("No API key. Run: clipbait login <key> (get it at clipbait.ai → Me → API key)");
|
package/package.json
CHANGED