cloudflare-mcp-smart-proxy 1.5.2 → 1.5.4
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/connector-cli.js +20 -3
- package/package.json +1 -1
package/connector-cli.js
CHANGED
|
@@ -133,6 +133,10 @@ function defaultConnectorId(ecosystem, workspaceRoot) {
|
|
|
133
133
|
return `connector.${ecosystem}.${workspaceName}`;
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
+
function shouldInstallExistingCredential({ credentialExists, reapply, approvalCode }) {
|
|
137
|
+
return credentialExists && !reapply && !approvalCode;
|
|
138
|
+
}
|
|
139
|
+
|
|
136
140
|
async function activationFetch(url, options = {}) {
|
|
137
141
|
const response = await fetch(url, options);
|
|
138
142
|
const data = await response.json().catch(() => ({}));
|
|
@@ -225,7 +229,11 @@ async function runActivation(options) {
|
|
|
225
229
|
console.error('After approval, rerun this command with --approval-code <code>.');
|
|
226
230
|
};
|
|
227
231
|
|
|
228
|
-
if (
|
|
232
|
+
if (shouldInstallExistingCredential({
|
|
233
|
+
credentialExists: fs.existsSync(paths.credentialPath),
|
|
234
|
+
reapply,
|
|
235
|
+
approvalCode
|
|
236
|
+
})) {
|
|
229
237
|
const connection = JSON.parse(fs.readFileSync(paths.credentialPath, 'utf8'));
|
|
230
238
|
await installClaimedConnection(connection);
|
|
231
239
|
return;
|
|
@@ -380,8 +388,17 @@ async function main() {
|
|
|
380
388
|
}
|
|
381
389
|
}
|
|
382
390
|
|
|
383
|
-
|
|
391
|
+
function isMainEntrypoint(entrypoint = process.argv[1]) {
|
|
392
|
+
if (!entrypoint) return false;
|
|
393
|
+
try {
|
|
394
|
+
return fs.realpathSync(entrypoint) === fs.realpathSync(__filename);
|
|
395
|
+
} catch {
|
|
396
|
+
return path.resolve(entrypoint) === __filename;
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
if (isMainEntrypoint()) {
|
|
384
401
|
main();
|
|
385
402
|
}
|
|
386
403
|
|
|
387
|
-
export { parseArgs };
|
|
404
|
+
export { isMainEntrypoint, parseArgs, shouldInstallExistingCredential };
|