@hs-x/cli 0.4.9 → 0.4.11

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.
@@ -3246,15 +3246,24 @@ async function devInvokeRemote(args) {
3246
3246
  const credentials = resolveCloudflareCredentials(argv);
3247
3247
  const { loadCloudflarePointer } = await import('../cloudflare-pointer.js');
3248
3248
  const pointer = await loadCloudflarePointer(root).catch(() => undefined);
3249
- if (!credentials.apiToken || !pointer?.cloudflareAccountId) {
3250
- return fail('HSX_E_INPUT_MISSING_API_TOKEN', 'Remote invoke needs CLOUDFLARE_API_TOKEN + a deployed pointer, or pass --url.', 'Set CLOUDFLARE_API_TOKEN, or pass --url with the deployed Worker origin.');
3249
+ const cloudflareAccountId = credentials.accountId ?? pointer?.cloudflareAccountId;
3250
+ const { resolveStoredCloudflareOAuthAccessToken } = await import('../cloudflare-workers-logs.js');
3251
+ const apiToken = credentials.apiToken ??
3252
+ (cloudflareAccountId
3253
+ ? await resolveStoredCloudflareOAuthAccessToken({ argv, cloudflareAccountId })
3254
+ : undefined);
3255
+ if (!apiToken || !cloudflareAccountId) {
3256
+ return fail('HSX_E_INPUT_MISSING_API_TOKEN', 'Remote invoke needs a connected Cloudflare account + a deployed pointer, or pass --url.', 'Run `hs-x connect cloudflare` (advanced automation may set CLOUDFLARE_API_TOKEN), or pass --url with the deployed Worker origin.');
3251
3257
  }
3252
3258
  try {
3253
3259
  url = await resolveDeployedWorkerUrl({
3254
3260
  root,
3255
3261
  workerName: mapping.workerName,
3256
- cloudflareAccountId: pointer.cloudflareAccountId,
3257
- apiToken: credentials.apiToken,
3262
+ cloudflareAccountId,
3263
+ apiToken,
3264
+ ...(process.env.HSX_CLOUDFLARE_API_BASE_URL
3265
+ ? { cloudflareApiBaseUrl: process.env.HSX_CLOUDFLARE_API_BASE_URL }
3266
+ : {}),
3258
3267
  });
3259
3268
  }
3260
3269
  catch (error) {