connectbase-client 0.10.11 → 0.10.13
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 +56 -6
- 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
|
-
|
|
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",
|
|
@@ -1120,16 +1147,16 @@ async function startTunnel(port, config, tunnelOpts) {
|
|
|
1120
1147
|
info("Secret Key\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4. \uBE0C\uB77C\uC6B0\uC800 \uB85C\uADF8\uC778\uC73C\uB85C \uBC1C\uAE09\uD569\uB2C8\uB2E4...");
|
|
1121
1148
|
try {
|
|
1122
1149
|
const sk = await browserAuthFlow();
|
|
1123
|
-
const
|
|
1150
|
+
const rcPath2 = path.join(process.cwd(), ".connectbaserc");
|
|
1124
1151
|
let rcData = {};
|
|
1125
|
-
if (fs.existsSync(
|
|
1152
|
+
if (fs.existsSync(rcPath2)) {
|
|
1126
1153
|
try {
|
|
1127
|
-
rcData = JSON.parse(fs.readFileSync(
|
|
1154
|
+
rcData = JSON.parse(fs.readFileSync(rcPath2, "utf-8"));
|
|
1128
1155
|
} catch {
|
|
1129
1156
|
}
|
|
1130
1157
|
}
|
|
1131
1158
|
rcData.secretKey = sk;
|
|
1132
|
-
fs.writeFileSync(
|
|
1159
|
+
fs.writeFileSync(rcPath2, JSON.stringify(rcData, null, 2) + "\n");
|
|
1133
1160
|
addToGitignore(".connectbaserc");
|
|
1134
1161
|
success("Secret Key \uBC1C\uAE09 \uBC0F \uC800\uC7A5 \uC644\uB8CC");
|
|
1135
1162
|
config.apiKey = sk;
|
|
@@ -1141,7 +1168,30 @@ async function startTunnel(port, config, tunnelOpts) {
|
|
|
1141
1168
|
} else {
|
|
1142
1169
|
config.apiKey = tunnelKey;
|
|
1143
1170
|
}
|
|
1144
|
-
const
|
|
1171
|
+
const rcPath = path.join(process.cwd(), ".connectbaserc");
|
|
1172
|
+
let savedAppId = tunnelOpts?.appId || "";
|
|
1173
|
+
if (!savedAppId) {
|
|
1174
|
+
try {
|
|
1175
|
+
const rc = JSON.parse(fs.readFileSync(rcPath, "utf-8"));
|
|
1176
|
+
if (rc.tunnelAppId) savedAppId = rc.tunnelAppId;
|
|
1177
|
+
} catch {
|
|
1178
|
+
}
|
|
1179
|
+
}
|
|
1180
|
+
const appId = await resolveAppForTunnel(config.apiKey, config.baseUrl, savedAppId);
|
|
1181
|
+
try {
|
|
1182
|
+
let rcData = {};
|
|
1183
|
+
if (fs.existsSync(rcPath)) {
|
|
1184
|
+
try {
|
|
1185
|
+
rcData = JSON.parse(fs.readFileSync(rcPath, "utf-8"));
|
|
1186
|
+
} catch {
|
|
1187
|
+
}
|
|
1188
|
+
}
|
|
1189
|
+
if (rcData.tunnelAppId !== appId) {
|
|
1190
|
+
rcData.tunnelAppId = appId;
|
|
1191
|
+
fs.writeFileSync(rcPath, JSON.stringify(rcData, null, 2) + "\n");
|
|
1192
|
+
}
|
|
1193
|
+
} catch {
|
|
1194
|
+
}
|
|
1145
1195
|
const tunnelServerUrl = getTunnelServerUrl(config.baseUrl);
|
|
1146
1196
|
const parsedUrl = new URL(tunnelServerUrl);
|
|
1147
1197
|
const isHttps = parsedUrl.protocol === "https:";
|