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/dev.js CHANGED
@@ -1787,6 +1787,9 @@ function generateDashboardHtml(options) {
1787
1787
  document.getElementById('step-' + i).style.display = 'none';
1788
1788
  }
1789
1789
  document.getElementById('setup-done').style.display = 'none';
1790
+ // Reset login UI state from previous interactions
1791
+ document.getElementById('login-waiting').style.display = 'none';
1792
+ document.getElementById('login-result').style.display = 'none';
1790
1793
 
1791
1794
  if (status.nextStep === 'done') {
1792
1795
  // All done!
@@ -1950,7 +1953,12 @@ function generateDashboardHtml(options) {
1950
1953
  var result = document.getElementById('login-result');
1951
1954
  result.textContent = 'Login successful! Logged in as ' + status.auth.user;
1952
1955
  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;';
1953
- setTimeout(refreshSetupStatus, 1500);
1956
+ // Wait for token to fully settle, then refresh wizard + force-load projects
1957
+ setTimeout(function() {
1958
+ refreshSetupStatus();
1959
+ // Extra delay for project list \u2014 Firebase CLI needs time after fresh login
1960
+ setTimeout(function() { loadProjectList(''); }, 2500);
1961
+ }, 2000);
1954
1962
  }
1955
1963
  })
1956
1964
  .catch(function() {});
@@ -1958,7 +1966,8 @@ function generateDashboardHtml(options) {
1958
1966
  }
1959
1967
 
1960
1968
  // \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
1961
- function loadProjectList(currentProjectId) {
1969
+ function loadProjectList(currentProjectId, retryCount) {
1970
+ retryCount = retryCount || 0;
1962
1971
  var select = document.getElementById('project-select');
1963
1972
  select.innerHTML = '<option value="">Loading projects...</option>';
1964
1973
  select.disabled = true;
@@ -1968,10 +1977,21 @@ function generateDashboardHtml(options) {
1968
1977
  .then(function(data) {
1969
1978
  select.innerHTML = '';
1970
1979
  if (data.error) {
1980
+ // Auto-retry up to 2 times on error (token might not be ready yet after fresh login)
1981
+ if (retryCount < 2) {
1982
+ select.innerHTML = '<option value="">Loading projects... (retry)</option>';
1983
+ setTimeout(function() { loadProjectList(currentProjectId, retryCount + 1); }, 3000);
1984
+ return;
1985
+ }
1971
1986
  select.innerHTML = '<option value="">Error: ' + escHtml(data.error) + '</option>';
1972
1987
  return;
1973
1988
  }
1974
1989
  if (!data.projects || data.projects.length === 0) {
1990
+ if (retryCount < 2) {
1991
+ select.innerHTML = '<option value="">Loading projects... (retry)</option>';
1992
+ setTimeout(function() { loadProjectList(currentProjectId, retryCount + 1); }, 3000);
1993
+ return;
1994
+ }
1975
1995
  select.innerHTML = '<option value="">No projects found</option>';
1976
1996
  return;
1977
1997
  }
@@ -1987,6 +2007,11 @@ function generateDashboardHtml(options) {
1987
2007
  select.disabled = false;
1988
2008
  })
1989
2009
  .catch(function(err) {
2010
+ if (retryCount < 2) {
2011
+ select.innerHTML = '<option value="">Loading projects... (retry)</option>';
2012
+ setTimeout(function() { loadProjectList(currentProjectId, retryCount + 1); }, 3000);
2013
+ return;
2014
+ }
1990
2015
  select.innerHTML = '<option value="">Failed to load</option>';
1991
2016
  });
1992
2017
  }
@@ -2528,13 +2553,16 @@ var FirebaseSetup = class {
2528
2553
  `cd "${this.projectDir}"`,
2529
2554
  cmd,
2530
2555
  'echo ""',
2531
- 'echo "Login complete! You can close this window."',
2532
- 'read -p "Press Enter to close..."'
2556
+ 'echo "Login complete! Closing in 3 seconds..."',
2557
+ "sleep 3",
2558
+ // Spawn osascript in background to close this specific terminal window, then exit
2559
+ `(sleep 1 && osascript -e 'tell application "Terminal" to close (every window whose name contains "clawfire-firebase-login")' 2>/dev/null) &`,
2560
+ "exit 0"
2533
2561
  ].join("\n"), { mode: 493 });
2534
2562
  const child = spawn("open", [scriptPath], { detached: true, stdio: "ignore" });
2535
2563
  child.unref();
2536
2564
  } else if (os === "win32") {
2537
- const child = spawn("cmd", ["/c", "start", "cmd", "/k", cmd], {
2565
+ const child = spawn("cmd", ["/c", "start", "cmd", "/c", `${cmd} && timeout /t 3 >nul`], {
2538
2566
  cwd: this.projectDir,
2539
2567
  detached: true,
2540
2568
  stdio: "ignore"
@@ -2547,8 +2575,9 @@ var FirebaseSetup = class {
2547
2575
  `cd "${this.projectDir}"`,
2548
2576
  cmd,
2549
2577
  'echo ""',
2550
- 'echo "Login complete! You can close this window."',
2551
- 'read -p "Press Enter to close..."'
2578
+ 'echo "Login complete! Closing in 3 seconds..."',
2579
+ "sleep 3",
2580
+ "exit 0"
2552
2581
  ].join("\n"), { mode: 493 });
2553
2582
  const terminals = [
2554
2583
  { cmd: "x-terminal-emulator", args: ["-e", scriptPath] },