@baryonlabs/cli 0.1.0 → 0.1.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.
- package/bin/baryon.js +4 -0
- package/package.json +1 -1
- package/src/commands.js +33 -0
- package/src/constants.js +8 -0
package/bin/baryon.js
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
doctor,
|
|
7
7
|
models,
|
|
8
8
|
configCmd,
|
|
9
|
+
keys,
|
|
9
10
|
update,
|
|
10
11
|
help,
|
|
11
12
|
welcome,
|
|
@@ -47,6 +48,9 @@ async function main() {
|
|
|
47
48
|
return models(rest);
|
|
48
49
|
case "config":
|
|
49
50
|
return configCmd(rest);
|
|
51
|
+
case "keys":
|
|
52
|
+
case "key":
|
|
53
|
+
return keys();
|
|
50
54
|
case "update":
|
|
51
55
|
case "upgrade":
|
|
52
56
|
return update();
|
package/package.json
CHANGED
package/src/commands.js
CHANGED
|
@@ -14,6 +14,8 @@ import {
|
|
|
14
14
|
DEFAULT_BASE_URL,
|
|
15
15
|
DEFAULT_MODELS,
|
|
16
16
|
HOMEPAGE,
|
|
17
|
+
KEYS_URL,
|
|
18
|
+
KEY_PREFIX,
|
|
17
19
|
PI_PACKAGE,
|
|
18
20
|
PROVIDER,
|
|
19
21
|
SUPPORT_EMAIL,
|
|
@@ -47,10 +49,15 @@ export async function setup(args) {
|
|
|
47
49
|
|
|
48
50
|
let apiKey = flags.key || flags["api-key"] || process.env.BARYON_API_KEY || "";
|
|
49
51
|
if (!apiKey) {
|
|
52
|
+
// Tell the user where keys come from before asking for one.
|
|
53
|
+
log(` ${sym.info} 키 발급·관리: ${c.lime(KEYS_URL)}`);
|
|
54
|
+
log(` ${c.dim(` (vibecamp.us 대시보드에서 발급/회수 · 형식 ${KEY_PREFIX}…)`)}\n`);
|
|
50
55
|
apiKey = await promptHidden(` ${sym.info} baryon.ai API key: `);
|
|
51
56
|
}
|
|
52
57
|
if (!apiKey) {
|
|
53
58
|
warn("API 키 없이 저장합니다. 나중에 `baryon setup --key <KEY>` 로 추가하세요.");
|
|
59
|
+
} else if (!apiKey.startsWith(KEY_PREFIX)) {
|
|
60
|
+
warn(`키 형식이 ${KEY_PREFIX}… 가 아닙니다. 로컬/상용 키라면 무시하세요.`);
|
|
54
61
|
}
|
|
55
62
|
|
|
56
63
|
saveConfig({ apiKey, baseUrl });
|
|
@@ -154,12 +161,37 @@ export async function configCmd(args) {
|
|
|
154
161
|
info(`base URL ${c.lime(cfg.baseUrl)}`);
|
|
155
162
|
info(`default ${c.lime(cfg.defaultModel)}`);
|
|
156
163
|
info(`API key ${cfg.apiKey ? cfg.apiKey.slice(0, 4) + "•".repeat(6) : c.dim("(없음)")}`);
|
|
164
|
+
info(`키 관리 ${c.lime(KEYS_URL)}`);
|
|
157
165
|
info(`config 파일 ${c.dim(BARYON_CONFIG)}`);
|
|
158
166
|
info(`pi models ${c.dim(PI_MODELS_JSON)}`);
|
|
159
167
|
log("");
|
|
160
168
|
return 0;
|
|
161
169
|
}
|
|
162
170
|
|
|
171
|
+
export function keys() {
|
|
172
|
+
log(` ${sym.info} 키 발급·관리 (vibecamp.us 대시보드):`);
|
|
173
|
+
log(` ${c.lime(KEYS_URL)}`);
|
|
174
|
+
log(` ${c.dim(` 발급/회수/쿼터는 vibecamp.us 가 관리 · 형식 ${KEY_PREFIX}…`)}`);
|
|
175
|
+
log(` ${c.dim(" 발급 후:")} ${c.lime("baryon setup")} ${c.dim("또는")} ${c.lime("baryon config --key vc_live_…")}`);
|
|
176
|
+
// best-effort open in browser
|
|
177
|
+
const opener =
|
|
178
|
+
process.platform === "darwin"
|
|
179
|
+
? "open"
|
|
180
|
+
: process.platform === "win32"
|
|
181
|
+
? "start"
|
|
182
|
+
: "xdg-open";
|
|
183
|
+
try {
|
|
184
|
+
spawn(opener, [KEYS_URL], {
|
|
185
|
+
stdio: "ignore",
|
|
186
|
+
detached: true,
|
|
187
|
+
shell: process.platform === "win32",
|
|
188
|
+
}).unref();
|
|
189
|
+
} catch {
|
|
190
|
+
/* headless / no browser — link above is enough */
|
|
191
|
+
}
|
|
192
|
+
return 0;
|
|
193
|
+
}
|
|
194
|
+
|
|
163
195
|
export function update() {
|
|
164
196
|
return new Promise((resolve) => {
|
|
165
197
|
log(` ${sym.info} 업데이트: ${c.lime(`npm install -g @baryonlabs/cli ${PI_PACKAGE}`)}\n`);
|
|
@@ -183,6 +215,7 @@ export function help() {
|
|
|
183
215
|
|
|
184
216
|
${c.bold("COMMANDS")}
|
|
185
217
|
${c.lime("baryon setup")} baryon.ai API 키 등록 + pi 프로바이더 구성
|
|
218
|
+
${c.lime("baryon keys")} 키 발급·관리 대시보드 열기 ${c.dim("(vibecamp.us)")}
|
|
186
219
|
${c.lime("baryon config")} 현재 설정 보기 ${c.dim("(--key/--base-url/--model 로 변경)")}
|
|
187
220
|
${c.lime("baryon models")} 사용 가능한 모델 목록
|
|
188
221
|
${c.lime("baryon doctor")} 설치·연결 진단
|
package/src/constants.js
CHANGED
|
@@ -49,3 +49,11 @@ export const DEFAULT_MODELS = [
|
|
|
49
49
|
|
|
50
50
|
export const HOMEPAGE = "https://cli.baryon.ai";
|
|
51
51
|
export const SUPPORT_EMAIL = "support@baryon.ai";
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Where end users issue / rotate / revoke their baryon.ai key.
|
|
55
|
+
* vibecamp.us is the source of truth for key issuance, scope, quota and
|
|
56
|
+
* revocation. Keys look like `vc_live_…`. Override with BARYON_KEYS_URL.
|
|
57
|
+
*/
|
|
58
|
+
export const KEYS_URL = process.env.BARYON_KEYS_URL || "https://vibecamp.us/dashboard";
|
|
59
|
+
export const KEY_PREFIX = "vc_live_";
|