depwire-cli 0.9.5 → 0.9.7

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.
@@ -113,6 +113,22 @@
113
113
  </main>
114
114
  </div>
115
115
 
116
+ <script>
117
+ // Catch any global errors and prevent them from breaking the page
118
+ window.addEventListener('error', (event) => {
119
+ console.error('Global error caught:', event.error);
120
+ // Prevent default error handling that might crash the page
121
+ event.preventDefault();
122
+ return true;
123
+ });
124
+
125
+ // Catch unhandled promise rejections
126
+ window.addEventListener('unhandledrejection', (event) => {
127
+ console.error('Unhandled promise rejection:', event.reason);
128
+ event.preventDefault();
129
+ return true;
130
+ });
131
+ </script>
116
132
  <script src="/temporal.js"></script>
117
133
  </body>
118
134
  </html>
@@ -10,7 +10,12 @@ let filePositions = new Map();
10
10
  async function init() {
11
11
  try {
12
12
  const response = await fetch('/api/data');
13
+ if (!response.ok) throw new Error(`HTTP ${response.status}`);
14
+
13
15
  temporalData = await response.json();
16
+ if (!temporalData || !temporalData.snapshots || temporalData.snapshots.length === 0) {
17
+ throw new Error('No snapshot data received');
18
+ }
14
19
 
15
20
  document.getElementById('projectName').textContent = temporalData.projectName;
16
21
  document.getElementById('snapshotCount').textContent = temporalData.snapshots.length;
@@ -26,7 +31,14 @@ async function init() {
26
31
  renderSnapshot(currentIndex);
27
32
  });
28
33
  } catch (error) {
29
- console.error('Failed to load temporal data:', error);
34
+ console.error('Failed to initialize temporal graph:', error);
35
+ document.body.innerHTML = `
36
+ <div style="display:flex;align-items:center;justify-content:center;height:100vh;background:#0a0f18;color:#fff;flex-direction:column;gap:20px;">
37
+ <h1 style="color:#ff4a4a;">⚠️ Failed to Load Temporal Graph</h1>
38
+ <p style="color:#888;">${error.message}</p>
39
+ <button onclick="location.reload()" style="padding:10px 20px;background:#4a9eff;border:none;color:#fff;border-radius:6px;cursor:pointer;">Reload Page</button>
40
+ </div>
41
+ `;
30
42
  }
31
43
  }
32
44
 
@@ -81,8 +93,14 @@ function setupTimeline() {
81
93
 
82
94
  function setupControls() {
83
95
  const playBtn = document.getElementById('playBtn');
96
+
97
+ if (!playBtn) {
98
+ console.error('Play button not found in DOM');
99
+ return;
100
+ }
84
101
 
85
102
  playBtn.addEventListener('click', () => {
103
+ console.log('Play button clicked, isPlaying:', isPlaying); // Debug log
86
104
  if (isPlaying) {
87
105
  pausePlayback();
88
106
  } else {
@@ -130,6 +148,18 @@ function highlightSearchResults(query) {
130
148
  }
131
149
 
132
150
  function startPlayback() {
151
+ if (!temporalData || !temporalData.snapshots || temporalData.snapshots.length === 0) {
152
+ console.error('Cannot start playback: no temporal data loaded');
153
+ return;
154
+ }
155
+
156
+ // If we're at the last snapshot, start from the beginning
157
+ if (currentIndex >= temporalData.snapshots.length - 1) {
158
+ currentIndex = 0;
159
+ goToSnapshot(0);
160
+ }
161
+
162
+ console.log(`Temporal playback started: ${temporalData.snapshots.length} snapshots at ${playSpeed}x speed`);
133
163
  isPlaying = true;
134
164
  document.getElementById('playBtn').innerHTML = `
135
165
  <svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
@@ -246,13 +276,20 @@ function renderArcDiagram(snapshot) {
246
276
  const margin = { top: 60, right: 40, bottom: 120, left: 40 };
247
277
  const plotWidth = width - margin.left - margin.right;
248
278
  const plotHeight = height - margin.top - margin.bottom;
249
- const baseline = margin.top + plotHeight;
279
+ const baseline = margin.top + plotHeight; // Position baseline at consistent percentage
250
280
 
251
281
  const totalSymbols = d3.sum(snapshot.files, (d) => d.symbols);
252
282
  const minBarWidth = 4;
253
283
  const gap = 2;
254
284
 
255
- let x = margin.left;
285
+ // Calculate total width needed for all bars
286
+ const totalBarsWidth = snapshot.files.reduce((sum, file) => {
287
+ const barWidth = Math.max(minBarWidth, (file.symbols / totalSymbols) * plotWidth * 0.8);
288
+ return sum + barWidth + gap;
289
+ }, 0) - gap; // Remove last gap
290
+
291
+ // Center the bar group horizontally
292
+ let x = margin.left + (plotWidth - totalBarsWidth) / 2;
256
293
  filePositions.clear();
257
294
 
258
295
  snapshot.files.forEach((file) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "depwire-cli",
3
- "version": "0.9.5",
3
+ "version": "0.9.7",
4
4
  "description": "Code cross-reference visualization and AI context engine for TypeScript, JavaScript, Python, Go, Rust, and C. Zero native dependencies — works on Windows, macOS, and Linux.",
5
5
  "type": "module",
6
6
  "bin": {