bazaar.it 0.2.2 → 0.2.4
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 +121 -34
- package/dist/commands/auth.js +15 -20
- package/dist/lib/api.js +2 -2
- package/package.json +1 -5
package/README.md
CHANGED
|
@@ -16,21 +16,7 @@ Programmatic access to Bazaar video generation for external agents, automation,
|
|
|
16
16
|
## Installation
|
|
17
17
|
|
|
18
18
|
```bash
|
|
19
|
-
# From npm
|
|
20
19
|
npm install -g bazaar.it
|
|
21
|
-
|
|
22
|
-
# From repo (recommended for development)
|
|
23
|
-
cd cli
|
|
24
|
-
npm install
|
|
25
|
-
npm run build
|
|
26
|
-
|
|
27
|
-
# Link globally (optional)
|
|
28
|
-
npm link
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
Or run directly with tsx during development:
|
|
32
|
-
```bash
|
|
33
|
-
npx tsx src/index.ts <command>
|
|
34
20
|
```
|
|
35
21
|
|
|
36
22
|
## Quick Start
|
|
@@ -66,7 +52,7 @@ $ baz
|
|
|
66
52
|
██████╔╝██║ ██║███████╗
|
|
67
53
|
╚═════╝ ╚═╝ ╚═╝╚══════╝
|
|
68
54
|
|
|
69
|
-
AI-powered video generation v0.2.
|
|
55
|
+
AI-powered video generation v0.2.4
|
|
70
56
|
─────────────────────────────────────
|
|
71
57
|
Type a command or prompt. Use 'help' for commands.
|
|
72
58
|
|
|
@@ -114,6 +100,22 @@ baz project use <project-id>
|
|
|
114
100
|
|
|
115
101
|
# Show current project
|
|
116
102
|
baz project current
|
|
103
|
+
|
|
104
|
+
# Duplicate a project (optionally changing format)
|
|
105
|
+
baz project duplicate <id> --name "Copy" --format portrait
|
|
106
|
+
|
|
107
|
+
# View or change project settings
|
|
108
|
+
baz project settings
|
|
109
|
+
baz project settings --format portrait --width 1080 --height 1920
|
|
110
|
+
|
|
111
|
+
# Change format by duplicating into a new project
|
|
112
|
+
baz project format landscape
|
|
113
|
+
|
|
114
|
+
# Validate timeline structure
|
|
115
|
+
baz project validate --json
|
|
116
|
+
|
|
117
|
+
# Delete a project
|
|
118
|
+
baz project delete <id>
|
|
117
119
|
```
|
|
118
120
|
|
|
119
121
|
### Prompts
|
|
@@ -271,6 +273,109 @@ baz logs --since 24h --limit 100
|
|
|
271
273
|
baz logs --project
|
|
272
274
|
```
|
|
273
275
|
|
|
276
|
+
### Context
|
|
277
|
+
|
|
278
|
+
Attach goals, requirements, reference URLs, and files to a project. The AI agent uses this context when generating content.
|
|
279
|
+
|
|
280
|
+
```bash
|
|
281
|
+
# Add text context
|
|
282
|
+
baz context add --text "Brand colors: #FF6B00, #1A1A2E" --label "brand"
|
|
283
|
+
|
|
284
|
+
# Add a URL reference
|
|
285
|
+
baz context add --url https://example.com/brand-guide --label "brand guide"
|
|
286
|
+
|
|
287
|
+
# Add a file (uploaded to media library)
|
|
288
|
+
baz context add --file ./brief.pdf --label "creative brief"
|
|
289
|
+
|
|
290
|
+
# List all context entries
|
|
291
|
+
baz context list
|
|
292
|
+
|
|
293
|
+
# Show context (alias for list)
|
|
294
|
+
baz context show
|
|
295
|
+
|
|
296
|
+
# Remove a specific entry
|
|
297
|
+
baz context remove <context-id>
|
|
298
|
+
|
|
299
|
+
# Clear all context
|
|
300
|
+
baz context clear
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
### Recipe (Agent Handshake)
|
|
304
|
+
|
|
305
|
+
Recipes implement the REVIEW → APPROVE/EDIT → EXECUTE flow for multi-step operations like voiceovers or AI video generation.
|
|
306
|
+
|
|
307
|
+
```bash
|
|
308
|
+
# Show the current recipe for review
|
|
309
|
+
baz recipe show
|
|
310
|
+
|
|
311
|
+
# Execute (approve and run)
|
|
312
|
+
baz recipe execute
|
|
313
|
+
|
|
314
|
+
# Edit recipe before executing
|
|
315
|
+
baz recipe edit --steps '[...]'
|
|
316
|
+
|
|
317
|
+
# Clear/abandon the current recipe
|
|
318
|
+
baz recipe clear
|
|
319
|
+
|
|
320
|
+
# List assets generated by recipe execution
|
|
321
|
+
baz recipe assets
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
### Templates
|
|
325
|
+
|
|
326
|
+
```bash
|
|
327
|
+
# List available templates
|
|
328
|
+
baz template list
|
|
329
|
+
|
|
330
|
+
# Filter by category or format
|
|
331
|
+
baz template list --category "product" --format landscape
|
|
332
|
+
|
|
333
|
+
# Search templates
|
|
334
|
+
baz template list --search "intro"
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
### Review
|
|
338
|
+
|
|
339
|
+
Full project state dump for external agent evaluation. Returns scenes with code, voiceovers, timing, and AI-generated asset prompts.
|
|
340
|
+
|
|
341
|
+
```bash
|
|
342
|
+
# Get full project state for agent evaluation
|
|
343
|
+
baz review --json
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
### Share
|
|
347
|
+
|
|
348
|
+
```bash
|
|
349
|
+
# Create a share link for the active project
|
|
350
|
+
baz share create
|
|
351
|
+
|
|
352
|
+
# List all your shared projects
|
|
353
|
+
baz share list
|
|
354
|
+
|
|
355
|
+
# Delete a share link
|
|
356
|
+
baz share delete <share-id>
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
### Capabilities
|
|
360
|
+
|
|
361
|
+
```bash
|
|
362
|
+
# Describe CLI capabilities (JSON for agents)
|
|
363
|
+
baz capabilities --json
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
### Loop (Basic OODA)
|
|
367
|
+
|
|
368
|
+
```bash
|
|
369
|
+
# Iterate prompt → review with optional requirements
|
|
370
|
+
baz loop "Create a 15s intro for Acme" --requirements "logo visible, CTA present"
|
|
371
|
+
|
|
372
|
+
# Use agent mode + NDJSON for bots
|
|
373
|
+
BAZ_AGENT=1 baz loop "Create a 15s intro" --requirements "logo visible, CTA present"
|
|
374
|
+
|
|
375
|
+
# Stop on failure and set a time budget
|
|
376
|
+
baz loop "Create a 15s intro" --requirements "logo visible" --stop-on-fail --budget 90s
|
|
377
|
+
```
|
|
378
|
+
|
|
274
379
|
## Agent Capabilities
|
|
275
380
|
|
|
276
381
|
The agent has access to the same tools as the web app:
|
|
@@ -366,6 +471,7 @@ Environment variables override config file:
|
|
|
366
471
|
- `BAZ_API_KEY` — API key
|
|
367
472
|
- `BAZ_API_URL` — API URL
|
|
368
473
|
- `BAZ_PROJECT_ID` — Active project
|
|
474
|
+
- `BAZ_JSON=1` — Force JSON output (equivalent to `--json`)
|
|
369
475
|
- `BAZ_AGENT=1` — Agent auto-mode (default `--json`, `--compact`, `--events-only`, and `--stream-json` on prompt/loop)
|
|
370
476
|
|
|
371
477
|
## Examples
|
|
@@ -464,22 +570,3 @@ npm run build # Build for production
|
|
|
464
570
|
## License
|
|
465
571
|
|
|
466
572
|
Copyright © 2024 Bazaar.it. All rights reserved.
|
|
467
|
-
### Capabilities
|
|
468
|
-
|
|
469
|
-
```bash
|
|
470
|
-
# Describe CLI capabilities (JSON for agents)
|
|
471
|
-
baz capabilities --json
|
|
472
|
-
```
|
|
473
|
-
|
|
474
|
-
### Loop (Basic OODA)
|
|
475
|
-
|
|
476
|
-
```bash
|
|
477
|
-
# Iterate prompt → review with optional requirements
|
|
478
|
-
baz loop "Create a 15s intro for Acme" --requirements "logo visible, CTA present"
|
|
479
|
-
|
|
480
|
-
# Use agent mode + NDJSON for bots
|
|
481
|
-
BAZ_AGENT=1 baz loop "Create a 15s intro" --requirements "logo visible, CTA present"
|
|
482
|
-
|
|
483
|
-
# Stop on failure and set a time budget
|
|
484
|
-
baz loop "Create a 15s intro" --requirements "logo visible" --stop-on-fail --budget 90s
|
|
485
|
-
```
|
package/dist/commands/auth.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
2
|
import chalk from 'chalk';
|
|
3
3
|
import { loadConfig, saveConfig, hasAuth, getConfigPath } from '../lib/config.js';
|
|
4
|
+
import { apiRequest, ApiError } from '../lib/api.js';
|
|
4
5
|
import { success, error, info, output } from '../lib/output.js';
|
|
5
6
|
export const authCommand = new Command('auth')
|
|
6
7
|
.description('Manage authentication');
|
|
@@ -38,7 +39,7 @@ authCommand
|
|
|
38
39
|
console.log(' 1. Pass directly: baz auth login <your-api-key>');
|
|
39
40
|
console.log(' 2. Environment: export BAZ_API_KEY=<your-api-key>');
|
|
40
41
|
console.log();
|
|
41
|
-
console.log(chalk.gray('
|
|
42
|
+
console.log(chalk.gray('Sign in at bazaar.it, click your balance in the top bar, then select API Keys'));
|
|
42
43
|
process.exit(1);
|
|
43
44
|
}
|
|
44
45
|
// Validate key format
|
|
@@ -48,29 +49,23 @@ authCommand
|
|
|
48
49
|
}
|
|
49
50
|
// Save to config first (needed for the validation request)
|
|
50
51
|
saveConfig({ apiKey: key, apiUrl: config.apiUrl }, { configPath: globalOpts.config });
|
|
51
|
-
// Validate key against server
|
|
52
|
+
// Validate key against server using proper tRPC request
|
|
53
|
+
const freshConfig = loadConfig({
|
|
54
|
+
configPath: globalOpts.config,
|
|
55
|
+
apiUrl: globalOpts.apiUrl,
|
|
56
|
+
});
|
|
52
57
|
try {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
if (
|
|
59
|
-
success('Authenticated successfully');
|
|
60
|
-
console.log(` Key saved to ${chalk.gray(getConfigPath(globalOpts.config))}`);
|
|
61
|
-
}
|
|
62
|
-
else if (res.status === 401) {
|
|
58
|
+
await apiRequest(freshConfig, 'apiKey.list');
|
|
59
|
+
success('Authenticated successfully');
|
|
60
|
+
console.log(` Key saved to ${chalk.gray(getConfigPath(globalOpts.config))}`);
|
|
61
|
+
}
|
|
62
|
+
catch (err) {
|
|
63
|
+
if (err instanceof ApiError && err.category === 'auth') {
|
|
63
64
|
saveConfig({ apiKey: undefined, apiUrl: config.apiUrl }, { configPath: globalOpts.config });
|
|
64
|
-
error('Invalid API key', 'The key was not recognized by the server. Check for typos or generate a new key.');
|
|
65
|
+
error('Invalid API key', 'The key was not recognized by the server. Check for typos or generate a new key from the balance menu at bazaar.it');
|
|
65
66
|
process.exit(1);
|
|
66
67
|
}
|
|
67
|
-
|
|
68
|
-
// Non-auth error (500, network issue) — save key anyway, warn
|
|
69
|
-
info(`Key saved, but server returned ${res.status}. Run "baz auth status" to verify later.`);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
catch (err) {
|
|
73
|
-
// Network error — save key anyway, warn
|
|
68
|
+
// Non-auth error (500, network issue) — save key anyway, warn
|
|
74
69
|
info('Key saved, but could not reach the server to verify. Check your connection.');
|
|
75
70
|
}
|
|
76
71
|
});
|
package/dist/lib/api.js
CHANGED
|
@@ -181,7 +181,7 @@ function parseApiError(status, statusText, body, headers) {
|
|
|
181
181
|
const serverCode = json.error?.code || json.code;
|
|
182
182
|
if (serverCode === 'INSUFFICIENT_BALANCE') {
|
|
183
183
|
code = ErrorCodes.BALANCE;
|
|
184
|
-
suggestion = '
|
|
184
|
+
suggestion = 'Sign in at bazaar.it and click your balance in the top bar to upgrade';
|
|
185
185
|
}
|
|
186
186
|
else if (serverCode === 'CONTENT_POLICY_VIOLATION' || serverCode === 'SAFETY_FILTER') {
|
|
187
187
|
code = ErrorCodes.CONTENT_FILTER;
|
|
@@ -223,7 +223,7 @@ function parseApiError(status, statusText, body, headers) {
|
|
|
223
223
|
case 402:
|
|
224
224
|
code = ErrorCodes.BALANCE;
|
|
225
225
|
message = 'Insufficient balance';
|
|
226
|
-
suggestion = '
|
|
226
|
+
suggestion = 'Sign in at bazaar.it and click your balance in the top bar to upgrade';
|
|
227
227
|
break;
|
|
228
228
|
case 429:
|
|
229
229
|
code = ErrorCodes.RATE_LIMIT;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bazaar.it",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"description": "AI-powered motion graphics from the command line — bazaar.it",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -13,10 +13,6 @@
|
|
|
13
13
|
"README.md"
|
|
14
14
|
],
|
|
15
15
|
"homepage": "https://bazaar.it",
|
|
16
|
-
"repository": {
|
|
17
|
-
"type": "git",
|
|
18
|
-
"url": "https://github.com/bazaar-it/bazaar"
|
|
19
|
-
},
|
|
20
16
|
"keywords": [
|
|
21
17
|
"video",
|
|
22
18
|
"ai",
|