connectbase-client 0.10.10 → 0.10.12

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/dist/cli.js +51 -5
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -892,7 +892,34 @@ async function setupMcp(secretKey) {
892
892
  }
893
893
  const mcpConfigPath = path.join(root, ".mcp.json");
894
894
  if (!secretKey) {
895
- secretKey = await prompt(`${colors.blue}?${colors.reset} Secret Key (cb_sk_...): `);
895
+ log(`
896
+ ${colors.dim}\uC778\uC99D \uBC29\uC2DD\uC744 \uC120\uD0DD\uD558\uC138\uC694:${colors.reset}`);
897
+ log(` ${colors.cyan}1${colors.reset}) Secret Key \uC9C1\uC811 \uC785\uB825 (cb_sk_...)`);
898
+ log(` ${colors.cyan}2${colors.reset}) \uBE0C\uB77C\uC6B0\uC800 \uB85C\uADF8\uC778\uC73C\uB85C \uC790\uB3D9 \uBC1C\uAE09
899
+ `);
900
+ const authChoice = await prompt(`${colors.blue}?${colors.reset} \uC120\uD0DD (1/2): `);
901
+ if (authChoice === "2") {
902
+ try {
903
+ secretKey = await browserAuthFlow();
904
+ const skRcPath = path.join(process.cwd(), ".connectbaserc");
905
+ let rcData = {};
906
+ if (fs.existsSync(skRcPath)) {
907
+ try {
908
+ rcData = JSON.parse(fs.readFileSync(skRcPath, "utf-8"));
909
+ } catch {
910
+ }
911
+ }
912
+ rcData.secretKey = secretKey;
913
+ fs.writeFileSync(skRcPath, JSON.stringify(rcData, null, 2) + "\n");
914
+ addToGitignore(".connectbaserc", root);
915
+ success("Secret Key \uBC1C\uAE09 \uBC0F \uC800\uC7A5 \uC644\uB8CC");
916
+ } catch (err) {
917
+ error(`\uC778\uC99D \uC2E4\uD328: ${err instanceof Error ? err.message : err}`);
918
+ process.exit(1);
919
+ }
920
+ } else {
921
+ secretKey = await promptSecret(`${colors.blue}?${colors.reset} Secret Key: `);
922
+ }
896
923
  }
897
924
  const mcpEntry = {
898
925
  type: "http",
@@ -1117,11 +1144,30 @@ ${colors.blue}?${colors.reset} \uC571 \uC120\uD0DD (\uBC88\uD638): `);
1117
1144
  async function startTunnel(port, config, tunnelOpts) {
1118
1145
  const tunnelKey = config.secretKey || (config.apiKey?.startsWith("cb_sk_") ? config.apiKey : "");
1119
1146
  if (!tunnelKey) {
1120
- error('Secret Key\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4. "npx connectbase init"\uC73C\uB85C \uC124\uC815\uD558\uAC70\uB098 -k \uC635\uC158\uC744 \uC0AC\uC6A9\uD558\uC138\uC694');
1121
- info("init \uC2DC \uBE0C\uB77C\uC6B0\uC800 \uB85C\uADF8\uC778\uC73C\uB85C Secret Key\uAC00 \uC790\uB3D9 \uBC1C\uAE09\uB429\uB2C8\uB2E4");
1122
- process.exit(1);
1147
+ info("Secret Key\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4. \uBE0C\uB77C\uC6B0\uC800 \uB85C\uADF8\uC778\uC73C\uB85C \uBC1C\uAE09\uD569\uB2C8\uB2E4...");
1148
+ try {
1149
+ const sk = await browserAuthFlow();
1150
+ const rcPath = path.join(process.cwd(), ".connectbaserc");
1151
+ let rcData = {};
1152
+ if (fs.existsSync(rcPath)) {
1153
+ try {
1154
+ rcData = JSON.parse(fs.readFileSync(rcPath, "utf-8"));
1155
+ } catch {
1156
+ }
1157
+ }
1158
+ rcData.secretKey = sk;
1159
+ fs.writeFileSync(rcPath, JSON.stringify(rcData, null, 2) + "\n");
1160
+ addToGitignore(".connectbaserc");
1161
+ success("Secret Key \uBC1C\uAE09 \uBC0F \uC800\uC7A5 \uC644\uB8CC");
1162
+ config.apiKey = sk;
1163
+ } catch (err) {
1164
+ error(`\uC778\uC99D \uC2E4\uD328: ${err instanceof Error ? err.message : err}`);
1165
+ info("-k \uC635\uC158\uC73C\uB85C Secret Key\uB97C \uC9C1\uC811 \uC804\uB2EC\uD560 \uC218\uB3C4 \uC788\uC2B5\uB2C8\uB2E4");
1166
+ process.exit(1);
1167
+ }
1168
+ } else {
1169
+ config.apiKey = tunnelKey;
1123
1170
  }
1124
- config.apiKey = tunnelKey;
1125
1171
  const appId = await resolveAppForTunnel(config.apiKey, config.baseUrl, tunnelOpts?.appId);
1126
1172
  const tunnelServerUrl = getTunnelServerUrl(config.baseUrl);
1127
1173
  const parsedUrl = new URL(tunnelServerUrl);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "connectbase-client",
3
- "version": "0.10.10",
3
+ "version": "0.10.12",
4
4
  "description": "Connect Base JavaScript/TypeScript SDK for browser and Node.js",
5
5
  "repository": {
6
6
  "type": "git",