clipbait 1.3.1 → 1.4.1

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 (2) hide show
  1. package/index.js +22 -5
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -14,6 +14,21 @@ const CFG = path.join(os.homedir(), ".clipbait.json");
14
14
  const BASE = (process.env.CLIPBAIT_API_URL || "https://app.clipbait.ai/api").replace(/\/$/, "");
15
15
  const KEY_PAGE = "https://app.clipbait.ai/me";
16
16
 
17
+ // Shown whenever there's no usable key. Written so an AI agent can relay it
18
+ // verbatim to the user and they'll know exactly what to do.
19
+ const NEED_KEY = [
20
+ "",
21
+ "You need your Clipbait API key (starts with cbk_live_) to continue.",
22
+ "",
23
+ ' • Already have a Clipbait account? Go to https://app.clipbait.ai/me → the',
24
+ ' "Developers / API" section and copy your key (click "Generate API key" if',
25
+ " you don't have one yet).",
26
+ " • New to Clipbait? Sign up at https://clipbait.ai, then grab your key from /me.",
27
+ "",
28
+ "Then come back here and paste your key (cbk_live_...) — I'll finish connecting you.",
29
+ "",
30
+ ].join("\n");
31
+
17
32
  function loadKey() {
18
33
  if (process.env.CLIPBAIT_API_KEY) return process.env.CLIPBAIT_API_KEY;
19
34
  try { return JSON.parse(fs.readFileSync(CFG, "utf8")).apiKey || null; } catch { return null; }
@@ -78,18 +93,20 @@ async function runSetup(providedKey) {
78
93
  let key = providedKey && providedKey.startsWith("cbk_") ? providedKey : loadKey();
79
94
 
80
95
  if (!key) {
81
- console.log("\n⚡ Let's connect Clipbait to Claude.\n");
96
+ console.log("\n⚡ Let's connect Clipbait to Claude.");
82
97
  if (!process.stdin.isTTY) {
83
- console.error(`Run this in a terminal, or pass your key: npx clipbait <cbk_live_...>\n Get your key at ${KEY_PAGE}`);
98
+ // No interactive terminal (e.g. an AI agent ran this). Print the full
99
+ // guidance so the agent can pass it straight to the user.
100
+ console.error(NEED_KEY);
84
101
  process.exit(1);
85
102
  }
86
- console.log(`Opening ${KEY_PAGE} so you can copy your API key…`);
103
+ console.log(`\nOpening ${KEY_PAGE} so you can copy your API key…`);
87
104
  openBrowser(KEY_PAGE);
88
105
  key = (await prompt("\nPaste your API key (starts with cbk_) and press Enter:\n> ")).trim();
89
106
  }
90
107
 
91
108
  if (!key || !key.startsWith("cbk_")) {
92
- console.error(`\nThat doesn't look like a Clipbait key (it should start with cbk_). Get yours at ${KEY_PAGE}`);
109
+ console.error(NEED_KEY);
93
110
  process.exit(1);
94
111
  }
95
112
 
@@ -145,7 +162,7 @@ Auth: CLIPBAIT_API_KEY env var or ~/.clipbait.json (via 'clipbait login').`;
145
162
  if (cmd === "help" || cmd === "--help" || cmd === "-h") { console.log(HELP); return; }
146
163
 
147
164
  if (!loadKey()) {
148
- console.error("No API key. Run: npx clipbait (get set up in one step)");
165
+ console.error(NEED_KEY);
149
166
  process.exit(1);
150
167
  }
151
168
  const { o, rest } = parseFlags(args);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clipbait",
3
- "version": "1.3.1",
3
+ "version": "1.4.1",
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",