clawfire 0.6.14 → 0.6.16

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clawfire",
3
- "version": "0.6.14",
3
+ "version": "0.6.16",
4
4
  "description": "AI-First Firebase app framework — Speak. Build. Deploy.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -7,7 +7,7 @@
7
7
  <a href="/" class="px-3 py-1.5 text-sm text-zinc-400 hover:text-zinc-200 border-b-2 border-transparent transition-colors">Home</a>
8
8
  <a href="/todos" class="px-3 py-1.5 text-sm text-zinc-400 hover:text-zinc-200 border-b-2 border-transparent transition-colors">Todos</a>
9
9
  <a href="/about" class="px-3 py-1.5 text-sm text-zinc-400 hover:text-zinc-200 border-b-2 border-transparent transition-colors">About</a>
10
- <a href="http://localhost:3456" target="_blank" class="ml-2 px-3 py-1.5 text-xs bg-zinc-800 text-zinc-400 rounded-md hover:bg-zinc-700 hover:text-zinc-200 transition-colors">API Playground &#8599;</a>
10
+ <!-- dev-only:start --><a href="http://localhost:3456" target="_blank" class="ml-2 px-3 py-1.5 text-xs bg-zinc-800 text-zinc-400 rounded-md hover:bg-zinc-700 hover:text-zinc-200 transition-colors">API Playground &#8599;</a><!-- dev-only:end -->
11
11
  <a href="https://www.npmjs.com/package/clawfire" target="_blank" class="ml-1 px-2 py-1 text-xs text-zinc-500 hover:text-brand-400 transition-colors" title="npm package">npm &#8599;</a>
12
12
  </div>
13
13
  </div>
@@ -13,7 +13,7 @@
13
13
  </a>
14
14
  </div>
15
15
 
16
- <!-- You're looking at it -->
16
+ <!-- dev-only:start -->
17
17
  <div class="bg-brand-500/5 border border-brand-500/20 rounded-xl p-5 mb-8">
18
18
  <div class="flex items-start gap-3">
19
19
  <span class="text-brand-400 text-xl mt-0.5">&#128161;</span>
@@ -28,6 +28,7 @@
28
28
  </div>
29
29
  </div>
30
30
  </div>
31
+ <!-- dev-only:end -->
31
32
 
32
33
  <!-- Quick Actions -->
33
34
  <div class="grid grid-cols-2 md:grid-cols-4 gap-3 mb-10">
@@ -128,9 +129,9 @@
128
129
  <div class="pl-4">handler: <span class="text-purple-400">async</span> (input) =&gt; { <span class="text-zinc-600">/* ... */</span> },</div>
129
130
  <div>});</div>
130
131
  </div>
131
- <a href="http://localhost:3456" target="_blank" class="inline-flex items-center gap-2 px-4 py-2 bg-brand-500 text-white rounded-lg hover:bg-brand-600 transition-colors font-medium text-sm">
132
+ <!-- dev-only:start --><a href="http://localhost:3456" target="_blank" class="inline-flex items-center gap-2 px-4 py-2 bg-brand-500 text-white rounded-lg hover:bg-brand-600 transition-colors font-medium text-sm">
132
133
  Open Playground &#8599;
133
- </a>
134
+ </a><!-- dev-only:end -->
134
135
  </div>
135
136
 
136
137
  <!-- Firebase Stack -->
@@ -189,5 +190,5 @@
189
190
  <span class="text-zinc-700">|</span>
190
191
  <a href="https://github.com/nohsangwoo/autofire" target="_blank" class="text-zinc-500 hover:text-brand-400 transition-colors">GitHub &#8599;</a>
191
192
  <span class="text-zinc-700">|</span>
192
- <a href="http://localhost:3456" target="_blank" class="text-zinc-500 hover:text-brand-400 transition-colors">API Playground &#8599;</a>
193
+ <!-- dev-only:start --><a href="http://localhost:3456" target="_blank" class="text-zinc-500 hover:text-brand-400 transition-colors">API Playground &#8599;</a><!-- dev-only:end -->
193
194
  </div>
@@ -52,8 +52,13 @@
52
52
  headers: { 'Content-Type': 'application/json' },
53
53
  body: JSON.stringify(body),
54
54
  });
55
+ var ct = res.headers.get('content-type') || '';
56
+ if (!ct.includes('application/json')) {
57
+ if (res.status === 404) throw new Error('API not available. Cloud Functions may not be deployed yet.');
58
+ throw new Error('Server returned non-JSON response (status ' + res.status + ')');
59
+ }
55
60
  const json = await res.json();
56
- if (!res.ok) throw new Error(json.error || 'Request failed');
61
+ if (!res.ok) throw new Error(json.error?.message || json.error || 'Request failed');
57
62
  return json.data;
58
63
  }
59
64
 
@@ -63,7 +68,20 @@
63
68
  todos = data.todos;
64
69
  render();
65
70
  } catch (e) {
66
- showError('Failed to load todos: ' + e.message);
71
+ var list = document.getElementById('todo-list');
72
+ if (list) {
73
+ var isApiUnavailable = e.message.includes('not available') || e.message.includes('non-JSON');
74
+ if (isApiUnavailable) {
75
+ list.innerHTML = '<div class="text-center py-12">'
76
+ + '<svg class="mx-auto mb-3 text-zinc-600" width="48" height="48" fill="none" stroke="currentColor" stroke-width="1.5" viewBox="0 0 24 24"><path d="M12 9v3.75m9-.75a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9 3.75h.008v.008H12v-.008Z"/></svg>'
77
+ + '<p class="text-zinc-400 text-sm font-medium mb-1">API Not Available</p>'
78
+ + '<p class="text-zinc-600 text-xs">Cloud Functions need to be deployed for the API to work.</p>'
79
+ + '<p class="text-zinc-600 text-xs mt-1">Run <code class="text-brand-400 bg-zinc-800 px-1.5 py-0.5 rounded">/clawfire-deploy</code> in Claude Code.</p>'
80
+ + '</div>';
81
+ } else {
82
+ showError('Failed to load todos: ' + e.message);
83
+ }
84
+ }
67
85
  }
68
86
  }
69
87