glad-web 1.0.46 → 2.0.2

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.
Files changed (74) hide show
  1. package/README.md +4 -192
  2. package/THIRD_PARTY_NOTICES.md +27 -0
  3. package/bin/glad.cjs +56 -0
  4. package/package.json +19 -61
  5. package/README.zh-CN.md +0 -198
  6. package/assets/logo.svg +0 -43
  7. package/bin/cli.js +0 -65
  8. package/lib/ai-tools/demo/enhanced-demo.js +0 -625
  9. package/lib/ai-tools/demo/index.js +0 -24
  10. package/lib/ai-tools/demo/responses.js +0 -88
  11. package/lib/ai-tools/detector.js +0 -76
  12. package/lib/ai-tools/registry.js +0 -300
  13. package/lib/claude/cli-usage.js +0 -95
  14. package/lib/claude/config.js +0 -82
  15. package/lib/claude/structured-session.js +0 -884
  16. package/lib/claude/transcript-repository.js +0 -216
  17. package/lib/codex/image-store.js +0 -174
  18. package/lib/codex/structured-session.js +0 -1590
  19. package/lib/commands/config.js +0 -78
  20. package/lib/commands/tools.js +0 -128
  21. package/lib/commands/web.js +0 -605
  22. package/lib/config/constants.js +0 -17
  23. package/lib/config/manager.js +0 -108
  24. package/lib/git/service.js +0 -83
  25. package/lib/notifications/message-formatter.js +0 -94
  26. package/lib/notifications/notification-service.js +0 -143
  27. package/lib/notifications/serverchan-client.js +0 -58
  28. package/lib/notifications/serverchan-settings-store.js +0 -115
  29. package/lib/schedule/job-runner.js +0 -162
  30. package/lib/schedule/job-store.js +0 -167
  31. package/lib/schedule/key-sequences.js +0 -49
  32. package/lib/schedule/scheduler-service.js +0 -39
  33. package/lib/server/routes/notifications.js +0 -52
  34. package/lib/server/routes/providers.js +0 -114
  35. package/lib/server/routes/schedules.js +0 -54
  36. package/lib/server/routes/skillhub.js +0 -104
  37. package/lib/server/routes/usage.js +0 -23
  38. package/lib/server/routes/workspace.js +0 -77
  39. package/lib/session/buffer.js +0 -102
  40. package/lib/session/file-attachment-store.js +0 -168
  41. package/lib/session/pty-manager.js +0 -255
  42. package/lib/session/rendered-history.js +0 -225
  43. package/lib/session/session-manager.js +0 -1032
  44. package/lib/session/text-history.js +0 -274
  45. package/lib/skillhub/client.js +0 -121
  46. package/lib/skillhub/settings-store.js +0 -168
  47. package/lib/skillhub/skill-installer.js +0 -320
  48. package/lib/usage/ccusage-runner.js +0 -128
  49. package/lib/usage/source-catalog.js +0 -26
  50. package/lib/usage/usage-service.js +0 -226
  51. package/lib/utils/logger.js +0 -74
  52. package/lib/utils/pid.js +0 -67
  53. package/lib/utils/validation.js +0 -53
  54. package/lib/web/bootstrap.js +0 -34
  55. package/lib/web/claude.js +0 -1150
  56. package/lib/web/codex.js +0 -1045
  57. package/lib/web/composer.js +0 -493
  58. package/lib/web/core.js +0 -385
  59. package/lib/web/git.js +0 -535
  60. package/lib/web/gitgraph.js +0 -293
  61. package/lib/web/index.html +0 -547
  62. package/lib/web/layout.js +0 -69
  63. package/lib/web/notifications.js +0 -164
  64. package/lib/web/schedules.js +0 -245
  65. package/lib/web/session.js +0 -361
  66. package/lib/web/shell.js +0 -74
  67. package/lib/web/skillhub.js +0 -197
  68. package/lib/web/styles.css +0 -932
  69. package/lib/web/terminal-scroll.js +0 -81
  70. package/lib/web/theme.js +0 -60
  71. package/lib/web/timed-inputs.js +0 -216
  72. package/lib/web/usage.js +0 -323
  73. package/lib/workspace/service.js +0 -77
  74. package/scripts/check-syntax.js +0 -26
@@ -1,293 +0,0 @@
1
- class GitGraphRenderer {
2
- constructor(container) {
3
- this.container = container;
4
- this.colors = ['#ff5252', '#448aff', '#69f0ae', '#ffd740', '#e040fb', '#ffab40', '#18ffff'];
5
- this.rowHeight = 36;
6
- this.dotRadius = 5;
7
- this.lineWidth = 2.5;
8
- }
9
-
10
- render(commits) {
11
- this.container.innerHTML = '';
12
- if (!commits || commits.length === 0) {
13
- this.container.innerHTML = '<div style="padding: 20px; text-align: center; color: #888;">No commits found.</div>';
14
- return;
15
- }
16
-
17
- let tracks = [];
18
-
19
- for (const commit of commits) {
20
- const hash = commit.hash;
21
- const parents = commit.parents;
22
-
23
- let col = tracks.indexOf(hash);
24
- let isNewTrack = false;
25
- if (col === -1) {
26
- col = tracks.findIndex(t => t === null);
27
- if (col === -1) col = tracks.length;
28
- tracks[col] = hash;
29
- isNewTrack = true;
30
- }
31
-
32
- commit.col = col;
33
- commit.tracksBefore = [...tracks];
34
- if (isNewTrack) {
35
- commit.tracksBefore[col] = null;
36
- }
37
-
38
- if (parents.length > 0) {
39
- tracks[col] = parents[0];
40
- for (let i = 1; i < parents.length; i++) {
41
- const p = parents[i];
42
- let pCol = tracks.indexOf(p);
43
- if (pCol === -1) {
44
- let eCol = tracks.findIndex(t => t === null);
45
- if (eCol === -1) eCol = tracks.length;
46
- tracks[eCol] = p;
47
- }
48
- }
49
- } else {
50
- tracks[col] = null;
51
- }
52
-
53
- for (let i = 0; i < tracks.length; i++) {
54
- for (let j = i + 1; j < tracks.length; j++) {
55
- if (tracks[i] && tracks[i] === tracks[j]) {
56
- tracks[j] = null;
57
- }
58
- }
59
- }
60
-
61
- while (tracks.length > 0 && tracks[tracks.length - 1] === null) {
62
- tracks.pop();
63
- }
64
-
65
- commit.tracksAfter = [...tracks];
66
- }
67
-
68
- const maxTracks = Math.max(...commits.map(c => Math.max(c.tracksBefore.length, c.tracksAfter.length)));
69
- const canvasWidth = Math.max(50, maxTracks * 16 + 24);
70
-
71
- commits.forEach((commit, rowIndex) => {
72
- const rowDiv = document.createElement('div');
73
- rowDiv.className = 'gitgraph-row';
74
- rowDiv.style.display = 'flex';
75
- rowDiv.style.alignItems = 'center';
76
- rowDiv.style.height = this.rowHeight + 'px';
77
- rowDiv.style.borderBottom = '1px solid var(--line)';
78
- rowDiv.style.position = 'relative';
79
- rowDiv.style.cursor = 'pointer';
80
- rowDiv.onmouseover = () => rowDiv.style.backgroundColor = 'var(--surface-soft)';
81
- rowDiv.onmouseout = () => rowDiv.style.backgroundColor = 'transparent';
82
-
83
- const canvas = document.createElement('canvas');
84
- canvas.width = canvasWidth * 2; // HiDPI
85
- canvas.height = this.rowHeight * 2;
86
- canvas.style.flexShrink = '0';
87
- canvas.style.width = canvasWidth + 'px';
88
- canvas.style.height = this.rowHeight + 'px';
89
- rowDiv.appendChild(canvas);
90
-
91
- this.drawCanvas(canvas, commit);
92
-
93
- const contentDiv = document.createElement('div');
94
- contentDiv.className = 'gitgraph-content';
95
- contentDiv.style.flex = '1';
96
- contentDiv.style.minWidth = '0';
97
- contentDiv.style.display = 'flex';
98
- contentDiv.style.alignItems = 'center';
99
- contentDiv.style.gap = '8px';
100
- contentDiv.style.paddingRight = '14px';
101
- contentDiv.style.whiteSpace = 'nowrap';
102
- contentDiv.style.overflow = 'hidden';
103
-
104
- const msgSpan = document.createElement('span');
105
- msgSpan.style.color = 'var(--text)';
106
- msgSpan.style.fontSize = '13px';
107
- msgSpan.style.fontWeight = '500';
108
- msgSpan.style.overflow = 'hidden';
109
- msgSpan.style.textOverflow = 'ellipsis';
110
- msgSpan.textContent = commit.subject;
111
- contentDiv.appendChild(msgSpan);
112
-
113
- if (commit.refs) {
114
- const refsSpan = document.createElement('span');
115
- refsSpan.style.color = 'var(--primary)';
116
- refsSpan.style.fontSize = '11px';
117
- refsSpan.style.border = '1px solid rgba(0, 122, 255, 0.4)';
118
- refsSpan.style.background = 'rgba(0, 122, 255, 0.1)';
119
- refsSpan.style.borderRadius = '4px';
120
- refsSpan.style.padding = '1px 4px';
121
- refsSpan.style.flexShrink = '0';
122
- refsSpan.textContent = commit.refs.replace(/[()]/g, '').trim();
123
- contentDiv.appendChild(refsSpan);
124
- }
125
-
126
- const authorSpan = document.createElement('span');
127
- authorSpan.style.color = 'var(--text-dim)';
128
- authorSpan.style.fontSize = '12px';
129
- authorSpan.style.marginLeft = 'auto';
130
- authorSpan.style.flexShrink = '0';
131
- authorSpan.textContent = `${commit.author} • ${commit.time}`;
132
- contentDiv.appendChild(authorSpan);
133
-
134
- const hashSpan = document.createElement('span');
135
- hashSpan.style.color = 'var(--text-dim)';
136
- hashSpan.style.fontSize = '12px';
137
- hashSpan.style.fontFamily = 'monospace';
138
- hashSpan.style.flexShrink = '0';
139
- hashSpan.style.width = '60px';
140
- hashSpan.style.textAlign = 'right';
141
- hashSpan.textContent = commit.hash;
142
- contentDiv.appendChild(hashSpan);
143
-
144
-
145
- rowDiv.onclick = (e) => {
146
- if (e.target.closest('.gitgraph-details-view')) return;
147
-
148
- const existingDetails = rowDiv.nextElementSibling;
149
- if (existingDetails && existingDetails.classList.contains('gitgraph-details-view')) {
150
- existingDetails.remove();
151
- rowDiv.style.backgroundColor = 'transparent';
152
- return;
153
- }
154
-
155
- // Close others
156
- document.querySelectorAll('.gitgraph-details-view').forEach(el => {
157
- if (el.previousElementSibling) {
158
- el.previousElementSibling.style.backgroundColor = 'transparent';
159
- }
160
- el.remove();
161
- });
162
-
163
- rowDiv.style.backgroundColor = 'var(--surface-soft)';
164
-
165
- const detailsDiv = document.createElement('div');
166
- detailsDiv.className = 'gitgraph-details-view';
167
- detailsDiv.style.backgroundColor = 'var(--surface)';
168
- detailsDiv.style.borderLeft = '2px solid ' + this.getColor(commit.col);
169
- detailsDiv.style.padding = '16px';
170
- detailsDiv.style.margin = '4px 0 4px ' + (canvasWidth) + 'px';
171
- detailsDiv.style.borderRadius = '0 6px 6px 0';
172
- detailsDiv.style.fontSize = '13px';
173
- detailsDiv.style.color = 'var(--text)';
174
- detailsDiv.style.boxShadow = 'inset 0 0 10px rgba(0,0,0,0.12)';
175
-
176
- let detailsHTML = `
177
- <div style="display:flex; justify-content:space-between; margin-bottom:12px;">
178
- <div style="flex: 1; padding-right: 16px; min-width: 0;">
179
- <div style="font-weight:600; font-size:14px; margin-bottom:4px; word-break: break-word;">${commit.subject.replace(/</g, "&lt;").replace(/>/g, "&gt;")}</div>
180
- <div style="color:var(--text-dim);">${commit.author} commited ${commit.time}</div>
181
- <div id="branch-info-${commit.hash}" style="font-family:monospace; color:var(--primary); margin-top:6px; font-size:12px; font-weight:500;"></div>
182
- </div>
183
- <div style="text-align:right; flex-shrink: 0;">
184
- <div style="font-family:monospace; color:var(--text-dim);">Commit: ${commit.hash}</div>
185
- ${commit.parents.length > 0 ? `<div style="font-family:monospace; color:var(--text-dim); margin-top:2px;">Parents: ${commit.parents.join(', ')}</div>` : ''}
186
- </div>
187
- </div>
188
- `;
189
-
190
- // Add diff placeholder
191
- detailsHTML += `
192
- <div style="border-top:1px solid var(--line); padding-top:12px; margin-top:12px;">
193
- <button onclick="window.loadCommitDiff('${commit.hash}')" style="background:var(--primary); border:none; color:#fff; padding:6px 12px; border-radius:4px; font-size:12px; cursor:pointer;">View Full Diff</button>
194
- </div>
195
- `;
196
-
197
- detailsDiv.innerHTML = detailsHTML;
198
- rowDiv.parentNode.insertBefore(detailsDiv, rowDiv.nextSibling);
199
-
200
- // Fetch branch info
201
- if (window.activeSessionId) {
202
- const branchContainer = document.getElementById(`branch-info-${commit.hash}`);
203
- if (branchContainer) {
204
- branchContainer.textContent = 'Loading branch...';
205
- fetch(`/api/sessions/${window.activeSessionId}/git-branch/${commit.hash}`)
206
- .then(res => res.json())
207
- .then(data => {
208
- if (data.success && data.stdout && data.stdout.trim()) {
209
- branchContainer.textContent = `Branch: ${data.stdout.trim()}`;
210
- } else {
211
- branchContainer.textContent = '';
212
- }
213
- })
214
- .catch(() => {
215
- branchContainer.textContent = '';
216
- });
217
- }
218
- }
219
- };
220
-
221
- rowDiv.appendChild(contentDiv);
222
-
223
- this.container.appendChild(rowDiv);
224
- });
225
- }
226
-
227
- drawCanvas(canvas, commit) {
228
- const ctx = canvas.getContext('2d');
229
- ctx.scale(2, 2); // HiDPI
230
-
231
- const h = this.rowHeight;
232
- const w = canvas.width / 2;
233
- const midY = h / 2;
234
- const colSpacing = 16;
235
- const startX = 20;
236
-
237
- // Pass-through lines
238
- commit.tracksBefore.forEach((target, i) => {
239
- if (!target) return;
240
- const x1 = startX + i * colSpacing;
241
-
242
- if (target === commit.hash) {
243
- const x2 = startX + commit.col * colSpacing;
244
- this.drawLine(ctx, x1, 0, x2, midY, this.getColor(i));
245
- } else {
246
- const nextIdx = commit.tracksAfter.indexOf(target);
247
- if (nextIdx !== -1) {
248
- const x2 = startX + nextIdx * colSpacing;
249
- this.drawLine(ctx, x1, 0, x2, h, this.getColor(i));
250
- }
251
- }
252
- });
253
-
254
- // Lines for parents
255
- commit.parents.forEach((parent, parentIdx) => {
256
- const nextIdx = commit.tracksAfter.indexOf(parent);
257
- if (nextIdx !== -1) {
258
- const x1 = startX + commit.col * colSpacing;
259
- const x2 = startX + nextIdx * colSpacing;
260
- const color = parentIdx === 0 ? this.getColor(commit.col) : this.getColor(nextIdx);
261
- this.drawLine(ctx, x1, midY, x2, h, color);
262
- }
263
- });
264
-
265
- // Commit dot
266
- const cx = startX + commit.col * colSpacing;
267
- ctx.beginPath();
268
- ctx.arc(cx, midY, this.dotRadius, 0, 2 * Math.PI);
269
- ctx.fillStyle = this.getColor(commit.col);
270
- ctx.fill();
271
- ctx.lineWidth = 2;
272
- ctx.strokeStyle = getComputedStyle(document.documentElement).getPropertyValue('--surface').trim() || '#121212';
273
- ctx.stroke();
274
- }
275
-
276
- drawLine(ctx, x1, y1, x2, y2, color) {
277
- ctx.beginPath();
278
- ctx.moveTo(x1, y1);
279
- if (x1 === x2) {
280
- ctx.lineTo(x2, y2);
281
- } else {
282
- ctx.bezierCurveTo(x1, (y1 + y2) / 2, x2, (y1 + y2) / 2, x2, y2);
283
- }
284
- ctx.strokeStyle = color;
285
- ctx.lineWidth = this.lineWidth;
286
- ctx.stroke();
287
- }
288
-
289
- getColor(index) {
290
- return this.colors[index % this.colors.length];
291
- }
292
- }
293
- window.GitGraphRenderer = GitGraphRenderer;