bazaar.it 0.2.2 → 0.2.3
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 +1 -15
- package/dist/commands/auth.js +13 -18
- 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.3
|
|
70
56
|
─────────────────────────────────────
|
|
71
57
|
Type a command or prompt. Use 'help' for commands.
|
|
72
58
|
|
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');
|
|
@@ -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
65
|
error('Invalid API key', 'The key was not recognized by the server. Check for typos or generate a new key.');
|
|
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bazaar.it",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
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",
|