connectbase-client 0.9.2 → 0.10.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/dist/cli.js +228 -78
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -302,11 +302,66 @@ function prompt(question) {
|
|
|
302
302
|
});
|
|
303
303
|
});
|
|
304
304
|
}
|
|
305
|
+
function promptSecret(question) {
|
|
306
|
+
return new Promise((resolve2) => {
|
|
307
|
+
process.stdout.write(question);
|
|
308
|
+
const input = [];
|
|
309
|
+
if (!process.stdin.isTTY) {
|
|
310
|
+
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
311
|
+
rl.question("", (answer) => {
|
|
312
|
+
rl.close();
|
|
313
|
+
resolve2(answer.trim());
|
|
314
|
+
});
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
317
|
+
process.stdin.setRawMode(true);
|
|
318
|
+
process.stdin.resume();
|
|
319
|
+
process.stdin.setEncoding("utf-8");
|
|
320
|
+
const onData = (data) => {
|
|
321
|
+
for (const char of data) {
|
|
322
|
+
const code = char.charCodeAt(0);
|
|
323
|
+
if (char === "\r" || char === "\n") {
|
|
324
|
+
process.stdin.setRawMode(false);
|
|
325
|
+
process.stdin.pause();
|
|
326
|
+
process.stdin.removeListener("data", onData);
|
|
327
|
+
process.stdout.write("\n");
|
|
328
|
+
resolve2(input.join("").trim());
|
|
329
|
+
return;
|
|
330
|
+
} else if (code === 3) {
|
|
331
|
+
process.stdin.setRawMode(false);
|
|
332
|
+
process.stdin.pause();
|
|
333
|
+
process.stdout.write("\n");
|
|
334
|
+
process.exit(0);
|
|
335
|
+
} else if (code === 127 || code === 8) {
|
|
336
|
+
if (input.length > 0) {
|
|
337
|
+
input.pop();
|
|
338
|
+
process.stdout.write("\b \b");
|
|
339
|
+
}
|
|
340
|
+
} else if (code >= 32) {
|
|
341
|
+
input.push(char);
|
|
342
|
+
process.stdout.write("*");
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
};
|
|
346
|
+
process.stdin.on("data", onData);
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
function getProjectRoot() {
|
|
350
|
+
const gitRoot = getGitRoot();
|
|
351
|
+
return gitRoot || process.cwd();
|
|
352
|
+
}
|
|
305
353
|
async function init() {
|
|
306
354
|
log(`
|
|
307
355
|
${colors.cyan}Connect Base \uD504\uB85C\uC81D\uD2B8 \uCD08\uAE30\uD654${colors.reset}
|
|
308
356
|
`);
|
|
309
|
-
const
|
|
357
|
+
const cwd = process.cwd();
|
|
358
|
+
const projectRoot = getProjectRoot();
|
|
359
|
+
if (cwd !== projectRoot) {
|
|
360
|
+
info(`\uD504\uB85C\uC81D\uD2B8 \uB8E8\uD2B8 \uAC10\uC9C0: ${projectRoot}`);
|
|
361
|
+
info(`MCP/\uBB38\uC11C\uB294 \uD504\uB85C\uC81D\uD2B8 \uB8E8\uD2B8\uC5D0, \uBC30\uD3EC \uC124\uC815\uC740 \uD604\uC7AC \uB514\uB809\uD1A0\uB9AC\uC5D0 \uC0DD\uC131\uB429\uB2C8\uB2E4
|
|
362
|
+
`);
|
|
363
|
+
}
|
|
364
|
+
const rcPath = path.join(cwd, ".connectbaserc");
|
|
310
365
|
if (fs.existsSync(rcPath)) {
|
|
311
366
|
const overwrite = await prompt(`${colors.yellow}\u26A0${colors.reset} .connectbaserc\uAC00 \uC774\uBBF8 \uC874\uC7AC\uD569\uB2C8\uB2E4. \uB36E\uC5B4\uC4F0\uC2DC\uACA0\uC2B5\uB2C8\uAE4C? (y/N): `);
|
|
312
367
|
if (overwrite.toLowerCase() !== "y") {
|
|
@@ -314,65 +369,155 @@ ${colors.cyan}Connect Base \uD504\uB85C\uC81D\uD2B8 \uCD08\uAE30\uD654${colors.r
|
|
|
314
369
|
return;
|
|
315
370
|
}
|
|
316
371
|
}
|
|
317
|
-
log(`${colors.dim}
|
|
318
|
-
log(`${colors.dim}Secret Key (cb_sk_): MCP/\uAD00\uB9AC\uC790\uC6A9 \u2014 \uC808\uB300 \uB178\uCD9C \uAE08\uC9C0${colors.reset}
|
|
372
|
+
log(`${colors.dim}Secret Key (cb_sk_): \uCF58\uC194 > \uD504\uB85C\uD544 > MCP Key \uD0ED\uC5D0\uC11C \uBC1C\uAE09${colors.reset}
|
|
319
373
|
`);
|
|
320
|
-
const
|
|
321
|
-
if (!
|
|
322
|
-
error("
|
|
374
|
+
const secretKey = await promptSecret(`${colors.blue}?${colors.reset} Secret Key: `);
|
|
375
|
+
if (!secretKey) {
|
|
376
|
+
error("Secret Key\uB294 \uD544\uC218\uC785\uB2C8\uB2E4");
|
|
323
377
|
process.exit(1);
|
|
324
378
|
}
|
|
325
|
-
if (
|
|
326
|
-
|
|
327
|
-
|
|
379
|
+
if (secretKey.startsWith("cb_pk_")) {
|
|
380
|
+
error("Public Key\uAC00 \uC544\uB2CC Secret Key(cb_sk_)\uB97C \uC785\uB825\uD558\uC138\uC694");
|
|
381
|
+
info("Secret Key\uB294 \uCF58\uC194 > \uD504\uB85C\uD544 > MCP Key \uD0ED\uC5D0\uC11C \uC0DD\uC131\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4");
|
|
382
|
+
process.exit(1);
|
|
328
383
|
}
|
|
329
|
-
|
|
384
|
+
if (!secretKey.startsWith("cb_sk_")) {
|
|
385
|
+
error("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 \uD0A4 \uD615\uC2DD\uC785\uB2C8\uB2E4. cb_sk_\uB85C \uC2DC\uC791\uD558\uB294 Secret Key\uB97C \uC785\uB825\uD558\uC138\uC694");
|
|
386
|
+
process.exit(1);
|
|
387
|
+
}
|
|
388
|
+
let appId = "";
|
|
389
|
+
let publicKey = "";
|
|
330
390
|
try {
|
|
331
|
-
info("\
|
|
332
|
-
const
|
|
333
|
-
`${DEFAULT_BASE_URL}/v1/public/
|
|
391
|
+
info("\uC571 \uBAA9\uB85D \uC870\uD68C \uC911...");
|
|
392
|
+
const appsRes = await makeRequest(
|
|
393
|
+
`${DEFAULT_BASE_URL}/v1/public/cli/apps`,
|
|
334
394
|
"GET",
|
|
335
|
-
{ "X-API-Key":
|
|
395
|
+
{ "X-API-Key": secretKey }
|
|
336
396
|
);
|
|
337
|
-
if (
|
|
338
|
-
error(
|
|
397
|
+
if (appsRes.status === 401) {
|
|
398
|
+
error("Secret Key\uAC00 \uC720\uD6A8\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4. \uCF58\uC194\uC5D0\uC11C \uD0A4\uB97C \uD655\uC778\uD558\uC138\uC694");
|
|
339
399
|
process.exit(1);
|
|
340
400
|
}
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
401
|
+
if (appsRes.status !== 200) {
|
|
402
|
+
throw new Error(`HTTP ${appsRes.status}`);
|
|
403
|
+
}
|
|
404
|
+
const appsData = appsRes.data;
|
|
405
|
+
const apps = appsData.apps || [];
|
|
406
|
+
if (apps.length > 0) {
|
|
344
407
|
log(`
|
|
345
|
-
${colors.dim}\
|
|
346
|
-
|
|
347
|
-
|
|
408
|
+
${colors.dim}\uB0B4 \uC571 \uBAA9\uB85D:${colors.reset}`);
|
|
409
|
+
apps.forEach((a, i) => {
|
|
410
|
+
const date = a.created_at ? a.created_at.substring(0, 10) : "";
|
|
411
|
+
log(` ${colors.cyan}${i + 1}${colors.reset}) ${a.name} ${colors.dim}(${date})${colors.reset}`);
|
|
348
412
|
});
|
|
349
|
-
log(` ${colors.cyan}0${colors.reset}) \uC0C8\
|
|
413
|
+
log(` ${colors.cyan}0${colors.reset}) \uC0C8 \uC571 \uB9CC\uB4E4\uAE30`);
|
|
350
414
|
const choice = await prompt(`
|
|
351
415
|
${colors.blue}?${colors.reset} \uC120\uD0DD (\uBC88\uD638): `);
|
|
352
416
|
const num = parseInt(choice, 10);
|
|
353
|
-
if (num > 0 && num <=
|
|
354
|
-
|
|
355
|
-
success(`\uC120\uD0DD\uB428: ${
|
|
417
|
+
if (num > 0 && num <= apps.length) {
|
|
418
|
+
appId = apps[num - 1].id;
|
|
419
|
+
success(`\uC120\uD0DD\uB428: ${apps[num - 1].name}`);
|
|
420
|
+
info("Public Key \uC0DD\uC131 \uC911...");
|
|
421
|
+
const newKeyRes = await makeRequest(
|
|
422
|
+
`${DEFAULT_BASE_URL}/v1/public/cli/apps/${appId}/api-keys/public`,
|
|
423
|
+
"POST",
|
|
424
|
+
{ "X-API-Key": secretKey },
|
|
425
|
+
JSON.stringify({})
|
|
426
|
+
);
|
|
427
|
+
if (newKeyRes.status === 201) {
|
|
428
|
+
const keyData = newKeyRes.data;
|
|
429
|
+
publicKey = keyData.key;
|
|
430
|
+
success("Public Key \uBC1C\uAE09 \uC644\uB8CC");
|
|
431
|
+
} else {
|
|
432
|
+
warn("Public Key \uC790\uB3D9 \uC0DD\uC131 \uC2E4\uD328. \uC218\uB3D9\uC73C\uB85C \uC0DD\uC131\uD558\uC138\uC694");
|
|
433
|
+
}
|
|
356
434
|
}
|
|
357
435
|
}
|
|
358
|
-
if (!
|
|
359
|
-
const projectName = path.basename(
|
|
360
|
-
const
|
|
361
|
-
info("\
|
|
436
|
+
if (!appId) {
|
|
437
|
+
const projectName = path.basename(cwd);
|
|
438
|
+
const appName = await prompt(`${colors.blue}?${colors.reset} \uC571 \uC774\uB984 (${projectName}): `) || projectName;
|
|
439
|
+
info("\uC571 \uC0DD\uC131 \uC911...");
|
|
362
440
|
const createRes = await makeRequest(
|
|
363
|
-
`${DEFAULT_BASE_URL}/v1/public/
|
|
441
|
+
`${DEFAULT_BASE_URL}/v1/public/cli/apps`,
|
|
364
442
|
"POST",
|
|
365
|
-
{ "X-API-Key":
|
|
366
|
-
JSON.stringify({ name })
|
|
443
|
+
{ "X-API-Key": secretKey },
|
|
444
|
+
JSON.stringify({ name: appName })
|
|
367
445
|
);
|
|
368
|
-
if (createRes.status
|
|
446
|
+
if (createRes.status === 402) {
|
|
447
|
+
error("\uC571 \uC0DD\uC131 \uD55C\uB3C4 \uCD08\uACFC. \uD50C\uB79C \uC5C5\uADF8\uB808\uC774\uB4DC\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
|
|
448
|
+
process.exit(1);
|
|
449
|
+
}
|
|
450
|
+
if (createRes.status !== 201) {
|
|
369
451
|
const data = createRes.data;
|
|
370
|
-
error(`\uC0DD\uC131 \uC2E4\uD328: ${data?.error ||
|
|
452
|
+
error(`\uC571 \uC0DD\uC131 \uC2E4\uD328: ${data?.error || `HTTP ${createRes.status}`}`);
|
|
371
453
|
process.exit(1);
|
|
372
454
|
}
|
|
373
455
|
const createData = createRes.data;
|
|
374
|
-
|
|
375
|
-
|
|
456
|
+
appId = createData.app_id;
|
|
457
|
+
publicKey = createData.public_key;
|
|
458
|
+
success(`\uC571 \uC0DD\uC131 \uC644\uB8CC: ${createData.app_name}`);
|
|
459
|
+
if (publicKey) {
|
|
460
|
+
success("Public Key \uC790\uB3D9 \uBC1C\uAE09 \uC644\uB8CC");
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
} catch (err) {
|
|
464
|
+
error(`\uB124\uD2B8\uC6CC\uD06C \uC624\uB958: ${err instanceof Error ? err.message : err}`);
|
|
465
|
+
log(`${colors.dim}\uC218\uB3D9\uC73C\uB85C \uC785\uB825\uD558\uC138\uC694${colors.reset}`);
|
|
466
|
+
appId = await prompt(`${colors.blue}?${colors.reset} App ID: `);
|
|
467
|
+
publicKey = await prompt(`${colors.blue}?${colors.reset} Public Key (cb_pk_): `);
|
|
468
|
+
if (!appId || !publicKey) {
|
|
469
|
+
error("App ID\uC640 Public Key\uB294 \uD544\uC218\uC785\uB2C8\uB2E4");
|
|
470
|
+
process.exit(1);
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
const apiKeyForSdk = publicKey || secretKey;
|
|
474
|
+
let storageId = "";
|
|
475
|
+
try {
|
|
476
|
+
info("\uC6F9 \uC2A4\uD1A0\uB9AC\uC9C0 \uC870\uD68C \uC911...");
|
|
477
|
+
const listRes = await makeRequest(
|
|
478
|
+
`${DEFAULT_BASE_URL}/v1/public/storages/webs`,
|
|
479
|
+
"GET",
|
|
480
|
+
{ "X-API-Key": apiKeyForSdk }
|
|
481
|
+
);
|
|
482
|
+
if (listRes.status === 200) {
|
|
483
|
+
const listData = listRes.data;
|
|
484
|
+
const storages = listData.storages || [];
|
|
485
|
+
if (storages.length > 0) {
|
|
486
|
+
log(`
|
|
487
|
+
${colors.dim}\uAE30\uC874 \uC6F9 \uC2A4\uD1A0\uB9AC\uC9C0:${colors.reset}`);
|
|
488
|
+
storages.forEach((s, i) => {
|
|
489
|
+
log(` ${colors.cyan}${i + 1}${colors.reset}) ${s.name} (${colors.dim}${s.id}${colors.reset})`);
|
|
490
|
+
});
|
|
491
|
+
log(` ${colors.cyan}0${colors.reset}) \uC0C8\uB85C \uC0DD\uC131`);
|
|
492
|
+
const choice = await prompt(`
|
|
493
|
+
${colors.blue}?${colors.reset} \uC120\uD0DD (\uBC88\uD638): `);
|
|
494
|
+
const num = parseInt(choice, 10);
|
|
495
|
+
if (num > 0 && num <= storages.length) {
|
|
496
|
+
storageId = storages[num - 1].id;
|
|
497
|
+
success(`\uC120\uD0DD\uB428: ${storages[num - 1].name}`);
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
if (!storageId) {
|
|
501
|
+
const projectName = path.basename(cwd);
|
|
502
|
+
const name = await prompt(`${colors.blue}?${colors.reset} \uC2A4\uD1A0\uB9AC\uC9C0 \uC774\uB984 (${projectName}): `) || projectName;
|
|
503
|
+
info("\uC6F9 \uC2A4\uD1A0\uB9AC\uC9C0 \uC0DD\uC131 \uC911...");
|
|
504
|
+
const createRes = await makeRequest(
|
|
505
|
+
`${DEFAULT_BASE_URL}/v1/public/storages/webs`,
|
|
506
|
+
"POST",
|
|
507
|
+
{ "X-API-Key": apiKeyForSdk },
|
|
508
|
+
JSON.stringify({ name })
|
|
509
|
+
);
|
|
510
|
+
if (createRes.status !== 200) {
|
|
511
|
+
const data = createRes.data;
|
|
512
|
+
error(`\uC0DD\uC131 \uC2E4\uD328: ${data?.error || data?.message || `HTTP ${createRes.status}`}`);
|
|
513
|
+
process.exit(1);
|
|
514
|
+
}
|
|
515
|
+
const createData = createRes.data;
|
|
516
|
+
storageId = createData.storage_web_id;
|
|
517
|
+
success(`\uC6F9 \uC2A4\uD1A0\uB9AC\uC9C0 \uC0DD\uC131 \uC644\uB8CC: ${createData.name}`);
|
|
518
|
+
}
|
|
519
|
+
} else {
|
|
520
|
+
throw new Error(`HTTP ${listRes.status}`);
|
|
376
521
|
}
|
|
377
522
|
} catch (err) {
|
|
378
523
|
error(`\uB124\uD2B8\uC6CC\uD06C \uC624\uB958: ${err instanceof Error ? err.message : err}`);
|
|
@@ -386,7 +531,7 @@ ${colors.blue}?${colors.reset} \uC120\uD0DD (\uBC88\uD638): `);
|
|
|
386
531
|
const defaultDir = detectBuildDir();
|
|
387
532
|
const deployDir = await prompt(`${colors.blue}?${colors.reset} \uBC30\uD3EC \uB514\uB809\uD1A0\uB9AC (${defaultDir}): `) || defaultDir;
|
|
388
533
|
const config = {
|
|
389
|
-
apiKey,
|
|
534
|
+
apiKey: publicKey || "",
|
|
390
535
|
storageId,
|
|
391
536
|
deployDir
|
|
392
537
|
};
|
|
@@ -394,16 +539,14 @@ ${colors.blue}?${colors.reset} \uC120\uD0DD (\uBC88\uD638): `);
|
|
|
394
539
|
success(".connectbaserc \uC0DD\uC131 \uC644\uB8CC");
|
|
395
540
|
addToGitignore(".connectbaserc");
|
|
396
541
|
addDeployScript(deployDir);
|
|
397
|
-
|
|
398
|
-
${colors.blue}?${colors.reset} Claude Code \uC124\uC815\uC744 \uCD94\uAC00\uD560\uAE4C\uC694? (CLAUDE.md, MCP \uC124\uC815) (Y/n): `);
|
|
399
|
-
if (setupClaude.toLowerCase() !== "n") {
|
|
400
|
-
await setupClaudeCode(apiKey);
|
|
401
|
-
}
|
|
542
|
+
await setupClaudeCode(apiKeyForSdk, secretKey, projectRoot);
|
|
402
543
|
log(`
|
|
403
544
|
${colors.green}\uCD08\uAE30\uD654 \uC644\uB8CC!${colors.reset}
|
|
404
545
|
`);
|
|
405
546
|
log(`${colors.dim}\uBC30\uD3EC\uD558\uB824\uBA74:${colors.reset}`);
|
|
406
|
-
log(` ${colors.cyan}npm run deploy${colors.reset}
|
|
547
|
+
log(` ${colors.cyan}npm run deploy${colors.reset}`);
|
|
548
|
+
log(`
|
|
549
|
+
${colors.dim}Claude Code\uC5D0\uC11C MCP\uAC00 \uC790\uB3D9 \uC5F0\uACB0\uB429\uB2C8\uB2E4${colors.reset}
|
|
407
550
|
`);
|
|
408
551
|
}
|
|
409
552
|
function detectBuildDir() {
|
|
@@ -415,8 +558,9 @@ function detectBuildDir() {
|
|
|
415
558
|
if (fs.existsSync(path.join(process.cwd(), "next.config.js")) || fs.existsSync(path.join(process.cwd(), "next.config.mjs"))) return "./out";
|
|
416
559
|
return "./dist";
|
|
417
560
|
}
|
|
418
|
-
function addToGitignore(entry) {
|
|
419
|
-
const
|
|
561
|
+
function addToGitignore(entry, basePath) {
|
|
562
|
+
const dir = basePath || process.cwd();
|
|
563
|
+
const gitignorePath = path.join(dir, ".gitignore");
|
|
420
564
|
if (fs.existsSync(gitignorePath)) {
|
|
421
565
|
const content = fs.readFileSync(gitignorePath, "utf-8");
|
|
422
566
|
if (!content.includes(entry)) {
|
|
@@ -464,16 +608,9 @@ function getGitRoot() {
|
|
|
464
608
|
return null;
|
|
465
609
|
}
|
|
466
610
|
}
|
|
467
|
-
async function downloadDocs(apiKey, templates,
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
const gitRoot = getGitRoot();
|
|
471
|
-
if (gitRoot) {
|
|
472
|
-
baseDir = gitRoot;
|
|
473
|
-
info(`\uBAA8\uB178\uB808\uD3EC \uB8E8\uD2B8 \uAC10\uC9C0: ${gitRoot}`);
|
|
474
|
-
} else {
|
|
475
|
-
warn("git root\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. \uD604\uC7AC \uB514\uB809\uD1A0\uB9AC\uB97C \uC0AC\uC6A9\uD569\uB2C8\uB2E4.");
|
|
476
|
-
}
|
|
611
|
+
async function downloadDocs(apiKey, templates, baseDir) {
|
|
612
|
+
if (!baseDir) {
|
|
613
|
+
baseDir = getProjectRoot();
|
|
477
614
|
}
|
|
478
615
|
const docsDir = path.join(baseDir, ".claude", "docs");
|
|
479
616
|
const rootClaudeMd = path.join(baseDir, "CLAUDE.md");
|
|
@@ -558,26 +695,41 @@ ${sdkBlock}
|
|
|
558
695
|
success("CLAUDE.md \uC0DD\uC131 \uC644\uB8CC");
|
|
559
696
|
}
|
|
560
697
|
}
|
|
561
|
-
async function setupClaudeCode(apiKey) {
|
|
562
|
-
const
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
Authorization: "Bearer YOUR_SECRET_KEY_HERE"
|
|
571
|
-
}
|
|
572
|
-
}
|
|
698
|
+
async function setupClaudeCode(apiKey, secretKey, projectRoot) {
|
|
699
|
+
const root = projectRoot || getProjectRoot();
|
|
700
|
+
const mcpConfigPath = path.join(root, ".mcp.json");
|
|
701
|
+
await downloadDocs(apiKey, void 0, root);
|
|
702
|
+
const mcpEntry = {
|
|
703
|
+
type: "http",
|
|
704
|
+
url: "https://mcp.connectbase.world/mcp",
|
|
705
|
+
headers: {
|
|
706
|
+
Authorization: `Bearer ${secretKey || "YOUR_SECRET_KEY_HERE"}`
|
|
573
707
|
}
|
|
574
708
|
};
|
|
709
|
+
let mcpConfig = { mcpServers: {} };
|
|
710
|
+
if (fs.existsSync(mcpConfigPath)) {
|
|
711
|
+
try {
|
|
712
|
+
mcpConfig = JSON.parse(fs.readFileSync(mcpConfigPath, "utf-8"));
|
|
713
|
+
if (!mcpConfig.mcpServers || typeof mcpConfig.mcpServers !== "object") {
|
|
714
|
+
mcpConfig.mcpServers = {};
|
|
715
|
+
}
|
|
716
|
+
} catch {
|
|
717
|
+
const backupPath = mcpConfigPath + ".backup";
|
|
718
|
+
fs.copyFileSync(mcpConfigPath, backupPath);
|
|
719
|
+
warn(`.mcp.json \uD30C\uC2F1 \uC2E4\uD328, \uBC31\uC5C5 \uC0DD\uC131: ${backupPath}`);
|
|
720
|
+
mcpConfig = { mcpServers: {} };
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
mcpConfig.mcpServers["connect-base"] = mcpEntry;
|
|
575
724
|
fs.writeFileSync(mcpConfigPath, JSON.stringify(mcpConfig, null, 2) + "\n");
|
|
576
725
|
success(".mcp.json \uC0DD\uC131 \uC644\uB8CC");
|
|
577
|
-
addToGitignore(".mcp.json");
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
726
|
+
addToGitignore(".mcp.json", root);
|
|
727
|
+
if (secretKey) {
|
|
728
|
+
success("MCP \uC11C\uBC84 \uC790\uB3D9 \uC124\uC815 \uC644\uB8CC (Secret Key \uC801\uC6A9\uB428)");
|
|
729
|
+
} else {
|
|
730
|
+
warn("MCP \uC11C\uBC84\uB294 Secret Key (cb_sk_)\uB9CC \uD5C8\uC6A9\uD569\uB2C8\uB2E4.");
|
|
731
|
+
info(".mcp.json \uD30C\uC77C\uC758 YOUR_SECRET_KEY_HERE\uB97C Secret Key\uB85C \uAD50\uCCB4\uD558\uC138\uC694.");
|
|
732
|
+
}
|
|
581
733
|
}
|
|
582
734
|
function createWsTextFrame(payload) {
|
|
583
735
|
const data = Buffer.from(payload, "utf-8");
|
|
@@ -928,8 +1080,8 @@ ${colors.yellow}\uC0AC\uC6A9\uBC95:${colors.reset}
|
|
|
928
1080
|
npx connectbase-client <command> [options]
|
|
929
1081
|
|
|
930
1082
|
${colors.yellow}\uBA85\uB839\uC5B4:${colors.reset}
|
|
931
|
-
init \uD504\uB85C\uC81D\uD2B8 \uCD08\uAE30\uD654 (\uC124\uC815 \
|
|
932
|
-
docs SDK \uBB38\uC11C \uB2E4\uC6B4\uB85C\uB4DC/\uC5C5\uB370\uC774\uD2B8 (
|
|
1083
|
+
init \uD504\uB85C\uC81D\uD2B8 \uCD08\uAE30\uD654 (\uC571 \uC0DD\uC131, MCP \uC124\uC815, SDK \uBB38\uC11C \uB2E4\uC6B4\uB85C\uB4DC)
|
|
1084
|
+
docs SDK \uBB38\uC11C \uB2E4\uC6B4\uB85C\uB4DC/\uC5C5\uB370\uC774\uD2B8 (\uC790\uB3D9\uC73C\uB85C git root\uC5D0 \uC0DD\uC131)
|
|
933
1085
|
deploy <directory> \uC6F9 \uC2A4\uD1A0\uB9AC\uC9C0\uC5D0 \uD30C\uC77C \uBC30\uD3EC (--dev: Dev \uD658\uACBD)
|
|
934
1086
|
tunnel <port> \uB85C\uCEEC \uC11C\uBE44\uC2A4\uB97C \uC778\uD130\uB137\uC5D0 \uB178\uCD9C
|
|
935
1087
|
|
|
@@ -947,7 +1099,7 @@ ${colors.yellow}\uC635\uC158:${colors.reset}
|
|
|
947
1099
|
-t, --timeout <sec> \uD130\uB110 \uC694\uCCAD \uD0C0\uC784\uC544\uC6C3 (\uCD08, tunnel \uC804\uC6A9)
|
|
948
1100
|
--max-body <MB> \uD130\uB110 \uCD5C\uB300 \uBC14\uB514 \uD06C\uAE30 (MB, tunnel \uC804\uC6A9)
|
|
949
1101
|
-d, --dev Dev \uD658\uACBD\uC5D0 \uBC30\uD3EC (deploy \uC804\uC6A9)
|
|
950
|
-
|
|
1102
|
+
(docs\uB294 \uC790\uB3D9\uC73C\uB85C git root\uB97C \uAC10\uC9C0\uD558\uC5EC \uD504\uB85C\uC81D\uD2B8 \uB8E8\uD2B8\uC5D0 \uC0DD\uC131)
|
|
951
1103
|
-h, --help \uB3C4\uC6C0\uB9D0 \uD45C\uC2DC
|
|
952
1104
|
-v, --version \uBC84\uC804 \uD45C\uC2DC
|
|
953
1105
|
|
|
@@ -1003,8 +1155,6 @@ function parseArgs(args) {
|
|
|
1003
1155
|
result.options.maxBody = args[++i];
|
|
1004
1156
|
} else if (arg === "-d" || arg === "--dev") {
|
|
1005
1157
|
result.options.dev = "true";
|
|
1006
|
-
} else if (arg === "--monorepo") {
|
|
1007
|
-
result.options.monorepo = "true";
|
|
1008
1158
|
} else if (arg === "-h" || arg === "--help") {
|
|
1009
1159
|
result.options.help = "true";
|
|
1010
1160
|
} else if (arg === "-v" || arg === "--version") {
|
|
@@ -1047,7 +1197,7 @@ async function main() {
|
|
|
1047
1197
|
process.exit(1);
|
|
1048
1198
|
}
|
|
1049
1199
|
}
|
|
1050
|
-
await downloadDocs(docsApiKey
|
|
1200
|
+
await downloadDocs(docsApiKey);
|
|
1051
1201
|
} else if (parsed.command === "deploy") {
|
|
1052
1202
|
const directory = parsed.args[0] || fileConfig.deployDir || ".";
|
|
1053
1203
|
if (!config.apiKey) {
|