clawfire 0.6.13 → 0.6.15

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 CHANGED
@@ -269,7 +269,7 @@ async function runDevServer() {
269
269
  const port = portArg ? parseInt(portArg.split("=")[1], 10) : 3e3;
270
270
  const apiPort = apiPortArg ? parseInt(apiPortArg.split("=")[1], 10) : 3456;
271
271
  const noHotReload = args.includes("--no-hot-reload");
272
- const { startDevServer } = await import("./dev-server-O6MKAB6R.js");
272
+ const { startDevServer } = await import("./dev-server-3SUUU4D2.js");
273
273
  await startDevServer({
274
274
  projectDir,
275
275
  port,
@@ -1456,6 +1456,24 @@ function generateDashboardHtml(options) {
1456
1456
  <div style="font-size:11px;color:#a3a3a3;margin-bottom:4px;">Live URL</div>
1457
1457
  <a id="deploy-hosting-link" href="#" target="_blank" style="color:#22c55e;font-family:monospace;font-size:14px;text-decoration:none;word-break:break-all;"></a>
1458
1458
  </div>
1459
+ <div id="deploy-billing-note" style="display:none;margin-top:10px;padding:14px;border-radius:8px;background:#1a1400;border:1px solid #f59e0b;">
1460
+ <div style="display:flex;align-items:center;gap:6px;margin-bottom:8px;">
1461
+ <span style="font-size:16px;">&#9888;&#65039;</span>
1462
+ <span style="font-weight:700;color:#fbbf24;font-size:14px;">Blaze Plan Required for API</span>
1463
+ </div>
1464
+ <div style="font-size:13px;color:#d4d4d4;line-height:1.6;">
1465
+ <div style="margin-bottom:6px;"><strong style="color:#fbbf24;">Current Plan:</strong> <span style="color:#ef4444;">Spark (Free)</span></div>
1466
+ <div style="margin-bottom:6px;"><strong style="color:#fbbf24;">Required Plan:</strong> <span style="color:#22c55e;">Blaze (Pay-as-you-go)</span></div>
1467
+ <div style="margin-bottom:10px;color:#a3a3a3;font-size:12px;">
1468
+ Static pages (HTML/CSS/JS) are deployed and live.<br>
1469
+ API routes (<code style="background:#2a2a2a;padding:2px 6px;border-radius:3px;color:#f97316;">/api/*</code>) require Cloud Functions, which need the Blaze plan.<br>
1470
+ Blaze plan has a generous free tier \u2014 you only pay for usage beyond free limits.
1471
+ </div>
1472
+ <a id="deploy-upgrade-link" href="#" target="_blank" style="display:inline-block;padding:8px 16px;background:#f59e0b;color:#000;border-radius:6px;font-size:13px;font-weight:700;text-decoration:none;">
1473
+ Upgrade to Blaze Plan &#8594;
1474
+ </a>
1475
+ </div>
1476
+ </div>
1459
1477
  </div>
1460
1478
  </div>
1461
1479
  </div>
@@ -2336,11 +2354,13 @@ function generateDashboardHtml(options) {
2336
2354
  var btn = document.getElementById('deploy-hosting-btn');
2337
2355
  var status = document.getElementById('deploy-hosting-status');
2338
2356
  var urlBox = document.getElementById('deploy-hosting-url');
2357
+ var billingNote = document.getElementById('deploy-billing-note');
2339
2358
  btn.disabled = true;
2340
2359
  btn.textContent = 'Deploying...';
2341
- status.textContent = 'Deploying to Firebase Hosting... This may take up to 2 minutes.';
2360
+ status.textContent = 'Deploying to Firebase Hosting... This may take up to 3 minutes.';
2342
2361
  status.style.cssText = 'display:block;margin-top:10px;font-size:13px;padding:10px 14px;border-radius:6px;background:#0a0a1a;border:1px solid #3b82f6;color:#3b82f6;';
2343
2362
  urlBox.style.display = 'none';
2363
+ billingNote.style.display = 'none';
2344
2364
 
2345
2365
  fetch(API + '/__dev/deploy/hosting', { method: 'POST' })
2346
2366
  .then(function(r) { return r.json(); })
@@ -2354,9 +2374,21 @@ function generateDashboardHtml(options) {
2354
2374
  link.textContent = data.url;
2355
2375
  urlBox.style.display = 'block';
2356
2376
  }
2377
+ // Show Blaze plan notice when functions deploy failed
2378
+ if (data.blazeRequired) {
2379
+ billingNote.style.display = 'block';
2380
+ if (data.upgradeUrl) {
2381
+ document.getElementById('deploy-upgrade-link').href = data.upgradeUrl;
2382
+ }
2383
+ }
2357
2384
  } else {
2358
2385
  status.textContent = data.message;
2359
2386
  status.style.cssText = 'display:block;margin-top:10px;font-size:13px;padding:10px 14px;border-radius:6px;background:#1c0808;border:1px solid #ef4444;color:#ef4444;';
2387
+ // Also check if error is billing-related
2388
+ var errMsg = (data.message || '').toLowerCase();
2389
+ if (errMsg.indexOf('blaze') >= 0 || errMsg.indexOf('pay-as-you-go') >= 0 || errMsg.indexOf('upgrade') >= 0 || errMsg.indexOf('artifactregistry') >= 0) {
2390
+ billingNote.style.display = 'block';
2391
+ }
2360
2392
  }
2361
2393
  btn.disabled = false;
2362
2394
  btn.textContent = 'Deploy Hosting';
@@ -3387,7 +3419,8 @@ https://console.developers.google.com/apis/api/firestore.googleapis.com/overview
3387
3419
  return new Promise((resolve6, reject) => {
3388
3420
  const proc = execFile2(command, args, { cwd: cwd || this.projectDir, timeout: timeoutMs }, (err, stdout, stderr) => {
3389
3421
  if (err) {
3390
- const detail = stderr?.trim() || stdout?.trim() || "";
3422
+ const parts = [stderr?.trim(), stdout?.trim()].filter(Boolean);
3423
+ const detail = parts.join("\n");
3391
3424
  const enriched = new Error(`${err.message}${detail ? "\n" + detail : ""}`);
3392
3425
  reject(enriched);
3393
3426
  } else {
@@ -4604,22 +4637,42 @@ ${liveReloadScript}
4604
4637
  steps.push("Functions build failed \u2014 hosting only");
4605
4638
  }
4606
4639
  }
4607
- let targets = deployFunctions ? "hosting,functions" : "hosting";
4608
- console.log(` Deploying ${targets}...`);
4609
- let result = await this.firebaseSetup.deployHosting(targets);
4610
- if (!result.success && deployFunctions) {
4611
- const msg = result.message.toLowerCase();
4612
- if (msg.includes("blaze") || msg.includes("pay-as-you-go") || msg.includes("upgrade") || msg.includes("billing") || msg.includes("artifactregistry")) {
4613
- console.log(" \x1B[33m\u26A0\x1B[0m Functions require Blaze plan. Deploying hosting only...");
4614
- steps.push("Functions skipped (requires Blaze plan)");
4615
- targets = "hosting";
4616
- result = await this.firebaseSetup.deployHosting(targets);
4640
+ console.log(" Deploying hosting...");
4641
+ const hostingResult = await this.firebaseSetup.deployHosting("hosting");
4642
+ if (!hostingResult.success) {
4643
+ clearFirebaseStatusCache();
4644
+ sendJson({
4645
+ ...hostingResult,
4646
+ message: hostingResult.message + (steps.length > 0 ? ` (${steps.join(", ")})` : "")
4647
+ });
4648
+ return;
4649
+ }
4650
+ steps.push("Hosting deployed");
4651
+ let blazeRequired = false;
4652
+ if (deployFunctions) {
4653
+ console.log(" Deploying functions...");
4654
+ const funcResult = await this.firebaseSetup.deployHosting("functions");
4655
+ if (funcResult.success) {
4656
+ console.log(" \x1B[32m\u2713\x1B[0m Functions deployed");
4657
+ steps.push("Functions deployed");
4658
+ } else {
4659
+ blazeRequired = true;
4660
+ console.log(" \x1B[33m\u26A0\x1B[0m Functions deploy failed (Blaze plan likely required)");
4661
+ steps.push("Functions skipped (Blaze plan required)");
4617
4662
  }
4618
4663
  }
4619
4664
  clearFirebaseStatusCache();
4665
+ const state = this.firebaseSetup.loadState();
4666
+ const projectId = state.projectId || firebaseConfig.projectId || "";
4667
+ const upgradeUrl = projectId ? `https://console.firebase.google.com/project/${projectId}/usage/details` : "https://console.firebase.google.com";
4668
+ const stepsStr = steps.length > 0 ? ` (${steps.join(", ")})` : "";
4620
4669
  sendJson({
4621
- ...result,
4622
- message: result.message + (steps.length > 0 ? ` (${steps.join(", ")})` : "")
4670
+ success: true,
4671
+ url: hostingResult.url,
4672
+ blazeRequired,
4673
+ upgradeUrl: blazeRequired ? upgradeUrl : void 0,
4674
+ message: `Hosting deployed successfully!${stepsStr}`,
4675
+ billingNote: blazeRequired ? `Static pages are live! But API routes (/api/*) need Cloud Functions, which require the Blaze (pay-as-you-go) plan. Upgrade: ${upgradeUrl}` : void 0
4623
4676
  });
4624
4677
  } catch (err) {
4625
4678
  sendJson({ success: false, message: err instanceof Error ? err.message : "Failed" }, 500);
package/dist/dev.cjs CHANGED
@@ -1868,6 +1868,24 @@ function generateDashboardHtml(options) {
1868
1868
  <div style="font-size:11px;color:#a3a3a3;margin-bottom:4px;">Live URL</div>
1869
1869
  <a id="deploy-hosting-link" href="#" target="_blank" style="color:#22c55e;font-family:monospace;font-size:14px;text-decoration:none;word-break:break-all;"></a>
1870
1870
  </div>
1871
+ <div id="deploy-billing-note" style="display:none;margin-top:10px;padding:14px;border-radius:8px;background:#1a1400;border:1px solid #f59e0b;">
1872
+ <div style="display:flex;align-items:center;gap:6px;margin-bottom:8px;">
1873
+ <span style="font-size:16px;">&#9888;&#65039;</span>
1874
+ <span style="font-weight:700;color:#fbbf24;font-size:14px;">Blaze Plan Required for API</span>
1875
+ </div>
1876
+ <div style="font-size:13px;color:#d4d4d4;line-height:1.6;">
1877
+ <div style="margin-bottom:6px;"><strong style="color:#fbbf24;">Current Plan:</strong> <span style="color:#ef4444;">Spark (Free)</span></div>
1878
+ <div style="margin-bottom:6px;"><strong style="color:#fbbf24;">Required Plan:</strong> <span style="color:#22c55e;">Blaze (Pay-as-you-go)</span></div>
1879
+ <div style="margin-bottom:10px;color:#a3a3a3;font-size:12px;">
1880
+ Static pages (HTML/CSS/JS) are deployed and live.<br>
1881
+ API routes (<code style="background:#2a2a2a;padding:2px 6px;border-radius:3px;color:#f97316;">/api/*</code>) require Cloud Functions, which need the Blaze plan.<br>
1882
+ Blaze plan has a generous free tier \u2014 you only pay for usage beyond free limits.
1883
+ </div>
1884
+ <a id="deploy-upgrade-link" href="#" target="_blank" style="display:inline-block;padding:8px 16px;background:#f59e0b;color:#000;border-radius:6px;font-size:13px;font-weight:700;text-decoration:none;">
1885
+ Upgrade to Blaze Plan &#8594;
1886
+ </a>
1887
+ </div>
1888
+ </div>
1871
1889
  </div>
1872
1890
  </div>
1873
1891
  </div>
@@ -2748,11 +2766,13 @@ function generateDashboardHtml(options) {
2748
2766
  var btn = document.getElementById('deploy-hosting-btn');
2749
2767
  var status = document.getElementById('deploy-hosting-status');
2750
2768
  var urlBox = document.getElementById('deploy-hosting-url');
2769
+ var billingNote = document.getElementById('deploy-billing-note');
2751
2770
  btn.disabled = true;
2752
2771
  btn.textContent = 'Deploying...';
2753
- status.textContent = 'Deploying to Firebase Hosting... This may take up to 2 minutes.';
2772
+ status.textContent = 'Deploying to Firebase Hosting... This may take up to 3 minutes.';
2754
2773
  status.style.cssText = 'display:block;margin-top:10px;font-size:13px;padding:10px 14px;border-radius:6px;background:#0a0a1a;border:1px solid #3b82f6;color:#3b82f6;';
2755
2774
  urlBox.style.display = 'none';
2775
+ billingNote.style.display = 'none';
2756
2776
 
2757
2777
  fetch(API + '/__dev/deploy/hosting', { method: 'POST' })
2758
2778
  .then(function(r) { return r.json(); })
@@ -2766,9 +2786,21 @@ function generateDashboardHtml(options) {
2766
2786
  link.textContent = data.url;
2767
2787
  urlBox.style.display = 'block';
2768
2788
  }
2789
+ // Show Blaze plan notice when functions deploy failed
2790
+ if (data.blazeRequired) {
2791
+ billingNote.style.display = 'block';
2792
+ if (data.upgradeUrl) {
2793
+ document.getElementById('deploy-upgrade-link').href = data.upgradeUrl;
2794
+ }
2795
+ }
2769
2796
  } else {
2770
2797
  status.textContent = data.message;
2771
2798
  status.style.cssText = 'display:block;margin-top:10px;font-size:13px;padding:10px 14px;border-radius:6px;background:#1c0808;border:1px solid #ef4444;color:#ef4444;';
2799
+ // Also check if error is billing-related
2800
+ var errMsg = (data.message || '').toLowerCase();
2801
+ if (errMsg.indexOf('blaze') >= 0 || errMsg.indexOf('pay-as-you-go') >= 0 || errMsg.indexOf('upgrade') >= 0 || errMsg.indexOf('artifactregistry') >= 0) {
2802
+ billingNote.style.display = 'block';
2803
+ }
2772
2804
  }
2773
2805
  btn.disabled = false;
2774
2806
  btn.textContent = 'Deploy Hosting';
@@ -3799,7 +3831,8 @@ https://console.developers.google.com/apis/api/firestore.googleapis.com/overview
3799
3831
  return new Promise((resolve7, reject) => {
3800
3832
  const proc = (0, import_node_child_process2.execFile)(command, args, { cwd: cwd || this.projectDir, timeout: timeoutMs }, (err, stdout, stderr) => {
3801
3833
  if (err) {
3802
- const detail = stderr?.trim() || stdout?.trim() || "";
3834
+ const parts = [stderr?.trim(), stdout?.trim()].filter(Boolean);
3835
+ const detail = parts.join("\n");
3803
3836
  const enriched = new Error(`${err.message}${detail ? "\n" + detail : ""}`);
3804
3837
  reject(enriched);
3805
3838
  } else {
@@ -5016,22 +5049,42 @@ ${liveReloadScript}
5016
5049
  steps.push("Functions build failed \u2014 hosting only");
5017
5050
  }
5018
5051
  }
5019
- let targets = deployFunctions ? "hosting,functions" : "hosting";
5020
- console.log(` Deploying ${targets}...`);
5021
- let result = await this.firebaseSetup.deployHosting(targets);
5022
- if (!result.success && deployFunctions) {
5023
- const msg = result.message.toLowerCase();
5024
- if (msg.includes("blaze") || msg.includes("pay-as-you-go") || msg.includes("upgrade") || msg.includes("billing") || msg.includes("artifactregistry")) {
5025
- console.log(" \x1B[33m\u26A0\x1B[0m Functions require Blaze plan. Deploying hosting only...");
5026
- steps.push("Functions skipped (requires Blaze plan)");
5027
- targets = "hosting";
5028
- result = await this.firebaseSetup.deployHosting(targets);
5052
+ console.log(" Deploying hosting...");
5053
+ const hostingResult = await this.firebaseSetup.deployHosting("hosting");
5054
+ if (!hostingResult.success) {
5055
+ clearFirebaseStatusCache();
5056
+ sendJson({
5057
+ ...hostingResult,
5058
+ message: hostingResult.message + (steps.length > 0 ? ` (${steps.join(", ")})` : "")
5059
+ });
5060
+ return;
5061
+ }
5062
+ steps.push("Hosting deployed");
5063
+ let blazeRequired = false;
5064
+ if (deployFunctions) {
5065
+ console.log(" Deploying functions...");
5066
+ const funcResult = await this.firebaseSetup.deployHosting("functions");
5067
+ if (funcResult.success) {
5068
+ console.log(" \x1B[32m\u2713\x1B[0m Functions deployed");
5069
+ steps.push("Functions deployed");
5070
+ } else {
5071
+ blazeRequired = true;
5072
+ console.log(" \x1B[33m\u26A0\x1B[0m Functions deploy failed (Blaze plan likely required)");
5073
+ steps.push("Functions skipped (Blaze plan required)");
5029
5074
  }
5030
5075
  }
5031
5076
  clearFirebaseStatusCache();
5077
+ const state = this.firebaseSetup.loadState();
5078
+ const projectId = state.projectId || firebaseConfig.projectId || "";
5079
+ const upgradeUrl = projectId ? `https://console.firebase.google.com/project/${projectId}/usage/details` : "https://console.firebase.google.com";
5080
+ const stepsStr = steps.length > 0 ? ` (${steps.join(", ")})` : "";
5032
5081
  sendJson({
5033
- ...result,
5034
- message: result.message + (steps.length > 0 ? ` (${steps.join(", ")})` : "")
5082
+ success: true,
5083
+ url: hostingResult.url,
5084
+ blazeRequired,
5085
+ upgradeUrl: blazeRequired ? upgradeUrl : void 0,
5086
+ message: `Hosting deployed successfully!${stepsStr}`,
5087
+ billingNote: blazeRequired ? `Static pages are live! But API routes (/api/*) need Cloud Functions, which require the Blaze (pay-as-you-go) plan. Upgrade: ${upgradeUrl}` : void 0
5035
5088
  });
5036
5089
  } catch (err) {
5037
5090
  sendJson({ success: false, message: err instanceof Error ? err.message : "Failed" }, 500);