clawfire 0.4.2 → 0.4.3

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
@@ -209,7 +209,7 @@ async function runDevServer() {
209
209
  const port = portArg ? parseInt(portArg.split("=")[1], 10) : 3e3;
210
210
  const apiPort = apiPortArg ? parseInt(apiPortArg.split("=")[1], 10) : 3456;
211
211
  const noHotReload = args.includes("--no-hot-reload");
212
- const { startDevServer } = await import("./dev-server-65H4AQFS.js");
212
+ const { startDevServer } = await import("./dev-server-PAI4XU2S.js");
213
213
  await startDevServer({
214
214
  projectDir,
215
215
  port,
@@ -1413,6 +1413,9 @@ function generateDashboardHtml(options) {
1413
1413
  document.getElementById('step-' + i).style.display = 'none';
1414
1414
  }
1415
1415
  document.getElementById('setup-done').style.display = 'none';
1416
+ // Reset login UI state from previous interactions
1417
+ document.getElementById('login-waiting').style.display = 'none';
1418
+ document.getElementById('login-result').style.display = 'none';
1416
1419
 
1417
1420
  if (status.nextStep === 'done') {
1418
1421
  // All done!
@@ -1576,7 +1579,12 @@ function generateDashboardHtml(options) {
1576
1579
  var result = document.getElementById('login-result');
1577
1580
  result.textContent = 'Login successful! Logged in as ' + status.auth.user;
1578
1581
  result.style.cssText = 'display:block;margin-top:8px;font-size:13px;padding:8px 12px;border-radius:6px;background:#0a1a0a;border:1px solid #22c55e;color:#22c55e;';
1579
- setTimeout(refreshSetupStatus, 1500);
1582
+ // Wait for token to fully settle, then refresh wizard + force-load projects
1583
+ setTimeout(function() {
1584
+ refreshSetupStatus();
1585
+ // Extra delay for project list \u2014 Firebase CLI needs time after fresh login
1586
+ setTimeout(function() { loadProjectList(''); }, 2500);
1587
+ }, 2000);
1580
1588
  }
1581
1589
  })
1582
1590
  .catch(function() {});
@@ -1584,7 +1592,8 @@ function generateDashboardHtml(options) {
1584
1592
  }
1585
1593
 
1586
1594
  // \u2500\u2500\u2500 Step 3: Project Selection \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
1587
- function loadProjectList(currentProjectId) {
1595
+ function loadProjectList(currentProjectId, retryCount) {
1596
+ retryCount = retryCount || 0;
1588
1597
  var select = document.getElementById('project-select');
1589
1598
  select.innerHTML = '<option value="">Loading projects...</option>';
1590
1599
  select.disabled = true;
@@ -1594,10 +1603,21 @@ function generateDashboardHtml(options) {
1594
1603
  .then(function(data) {
1595
1604
  select.innerHTML = '';
1596
1605
  if (data.error) {
1606
+ // Auto-retry up to 2 times on error (token might not be ready yet after fresh login)
1607
+ if (retryCount < 2) {
1608
+ select.innerHTML = '<option value="">Loading projects... (retry)</option>';
1609
+ setTimeout(function() { loadProjectList(currentProjectId, retryCount + 1); }, 3000);
1610
+ return;
1611
+ }
1597
1612
  select.innerHTML = '<option value="">Error: ' + escHtml(data.error) + '</option>';
1598
1613
  return;
1599
1614
  }
1600
1615
  if (!data.projects || data.projects.length === 0) {
1616
+ if (retryCount < 2) {
1617
+ select.innerHTML = '<option value="">Loading projects... (retry)</option>';
1618
+ setTimeout(function() { loadProjectList(currentProjectId, retryCount + 1); }, 3000);
1619
+ return;
1620
+ }
1601
1621
  select.innerHTML = '<option value="">No projects found</option>';
1602
1622
  return;
1603
1623
  }
@@ -1613,6 +1633,11 @@ function generateDashboardHtml(options) {
1613
1633
  select.disabled = false;
1614
1634
  })
1615
1635
  .catch(function(err) {
1636
+ if (retryCount < 2) {
1637
+ select.innerHTML = '<option value="">Loading projects... (retry)</option>';
1638
+ setTimeout(function() { loadProjectList(currentProjectId, retryCount + 1); }, 3000);
1639
+ return;
1640
+ }
1616
1641
  select.innerHTML = '<option value="">Failed to load</option>';
1617
1642
  });
1618
1643
  }
@@ -2154,13 +2179,16 @@ var FirebaseSetup = class {
2154
2179
  `cd "${this.projectDir}"`,
2155
2180
  cmd,
2156
2181
  'echo ""',
2157
- 'echo "Login complete! You can close this window."',
2158
- 'read -p "Press Enter to close..."'
2182
+ 'echo "Login complete! Closing in 3 seconds..."',
2183
+ "sleep 3",
2184
+ // Spawn osascript in background to close this specific terminal window, then exit
2185
+ `(sleep 1 && osascript -e 'tell application "Terminal" to close (every window whose name contains "clawfire-firebase-login")' 2>/dev/null) &`,
2186
+ "exit 0"
2159
2187
  ].join("\n"), { mode: 493 });
2160
2188
  const child = spawn("open", [scriptPath], { detached: true, stdio: "ignore" });
2161
2189
  child.unref();
2162
2190
  } else if (os === "win32") {
2163
- const child = spawn("cmd", ["/c", "start", "cmd", "/k", cmd], {
2191
+ const child = spawn("cmd", ["/c", "start", "cmd", "/c", `${cmd} && timeout /t 3 >nul`], {
2164
2192
  cwd: this.projectDir,
2165
2193
  detached: true,
2166
2194
  stdio: "ignore"
@@ -2173,8 +2201,9 @@ var FirebaseSetup = class {
2173
2201
  `cd "${this.projectDir}"`,
2174
2202
  cmd,
2175
2203
  'echo ""',
2176
- 'echo "Login complete! You can close this window."',
2177
- 'read -p "Press Enter to close..."'
2204
+ 'echo "Login complete! Closing in 3 seconds..."',
2205
+ "sleep 3",
2206
+ "exit 0"
2178
2207
  ].join("\n"), { mode: 493 });
2179
2208
  const terminals = [
2180
2209
  { cmd: "x-terminal-emulator", args: ["-e", scriptPath] },
package/dist/dev.cjs CHANGED
@@ -1825,6 +1825,9 @@ function generateDashboardHtml(options) {
1825
1825
  document.getElementById('step-' + i).style.display = 'none';
1826
1826
  }
1827
1827
  document.getElementById('setup-done').style.display = 'none';
1828
+ // Reset login UI state from previous interactions
1829
+ document.getElementById('login-waiting').style.display = 'none';
1830
+ document.getElementById('login-result').style.display = 'none';
1828
1831
 
1829
1832
  if (status.nextStep === 'done') {
1830
1833
  // All done!
@@ -1988,7 +1991,12 @@ function generateDashboardHtml(options) {
1988
1991
  var result = document.getElementById('login-result');
1989
1992
  result.textContent = 'Login successful! Logged in as ' + status.auth.user;
1990
1993
  result.style.cssText = 'display:block;margin-top:8px;font-size:13px;padding:8px 12px;border-radius:6px;background:#0a1a0a;border:1px solid #22c55e;color:#22c55e;';
1991
- setTimeout(refreshSetupStatus, 1500);
1994
+ // Wait for token to fully settle, then refresh wizard + force-load projects
1995
+ setTimeout(function() {
1996
+ refreshSetupStatus();
1997
+ // Extra delay for project list \u2014 Firebase CLI needs time after fresh login
1998
+ setTimeout(function() { loadProjectList(''); }, 2500);
1999
+ }, 2000);
1992
2000
  }
1993
2001
  })
1994
2002
  .catch(function() {});
@@ -1996,7 +2004,8 @@ function generateDashboardHtml(options) {
1996
2004
  }
1997
2005
 
1998
2006
  // \u2500\u2500\u2500 Step 3: Project Selection \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
1999
- function loadProjectList(currentProjectId) {
2007
+ function loadProjectList(currentProjectId, retryCount) {
2008
+ retryCount = retryCount || 0;
2000
2009
  var select = document.getElementById('project-select');
2001
2010
  select.innerHTML = '<option value="">Loading projects...</option>';
2002
2011
  select.disabled = true;
@@ -2006,10 +2015,21 @@ function generateDashboardHtml(options) {
2006
2015
  .then(function(data) {
2007
2016
  select.innerHTML = '';
2008
2017
  if (data.error) {
2018
+ // Auto-retry up to 2 times on error (token might not be ready yet after fresh login)
2019
+ if (retryCount < 2) {
2020
+ select.innerHTML = '<option value="">Loading projects... (retry)</option>';
2021
+ setTimeout(function() { loadProjectList(currentProjectId, retryCount + 1); }, 3000);
2022
+ return;
2023
+ }
2009
2024
  select.innerHTML = '<option value="">Error: ' + escHtml(data.error) + '</option>';
2010
2025
  return;
2011
2026
  }
2012
2027
  if (!data.projects || data.projects.length === 0) {
2028
+ if (retryCount < 2) {
2029
+ select.innerHTML = '<option value="">Loading projects... (retry)</option>';
2030
+ setTimeout(function() { loadProjectList(currentProjectId, retryCount + 1); }, 3000);
2031
+ return;
2032
+ }
2013
2033
  select.innerHTML = '<option value="">No projects found</option>';
2014
2034
  return;
2015
2035
  }
@@ -2025,6 +2045,11 @@ function generateDashboardHtml(options) {
2025
2045
  select.disabled = false;
2026
2046
  })
2027
2047
  .catch(function(err) {
2048
+ if (retryCount < 2) {
2049
+ select.innerHTML = '<option value="">Loading projects... (retry)</option>';
2050
+ setTimeout(function() { loadProjectList(currentProjectId, retryCount + 1); }, 3000);
2051
+ return;
2052
+ }
2028
2053
  select.innerHTML = '<option value="">Failed to load</option>';
2029
2054
  });
2030
2055
  }
@@ -2566,13 +2591,16 @@ var FirebaseSetup = class {
2566
2591
  `cd "${this.projectDir}"`,
2567
2592
  cmd,
2568
2593
  'echo ""',
2569
- 'echo "Login complete! You can close this window."',
2570
- 'read -p "Press Enter to close..."'
2594
+ 'echo "Login complete! Closing in 3 seconds..."',
2595
+ "sleep 3",
2596
+ // Spawn osascript in background to close this specific terminal window, then exit
2597
+ `(sleep 1 && osascript -e 'tell application "Terminal" to close (every window whose name contains "clawfire-firebase-login")' 2>/dev/null) &`,
2598
+ "exit 0"
2571
2599
  ].join("\n"), { mode: 493 });
2572
2600
  const child = (0, import_node_child_process2.spawn)("open", [scriptPath], { detached: true, stdio: "ignore" });
2573
2601
  child.unref();
2574
2602
  } else if (os === "win32") {
2575
- const child = (0, import_node_child_process2.spawn)("cmd", ["/c", "start", "cmd", "/k", cmd], {
2603
+ const child = (0, import_node_child_process2.spawn)("cmd", ["/c", "start", "cmd", "/c", `${cmd} && timeout /t 3 >nul`], {
2576
2604
  cwd: this.projectDir,
2577
2605
  detached: true,
2578
2606
  stdio: "ignore"
@@ -2585,8 +2613,9 @@ var FirebaseSetup = class {
2585
2613
  `cd "${this.projectDir}"`,
2586
2614
  cmd,
2587
2615
  'echo ""',
2588
- 'echo "Login complete! You can close this window."',
2589
- 'read -p "Press Enter to close..."'
2616
+ 'echo "Login complete! Closing in 3 seconds..."',
2617
+ "sleep 3",
2618
+ "exit 0"
2590
2619
  ].join("\n"), { mode: 493 });
2591
2620
  const terminals = [
2592
2621
  { cmd: "x-terminal-emulator", args: ["-e", scriptPath] },