dsh-coding-enhanced 0.5.16 → 0.6.6

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.
@@ -0,0 +1,869 @@
1
+ <!doctype html>
2
+ <html lang="zh-CN">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
6
+ <title>Coding Enhanced · Review UI Directions</title>
7
+ <style>
8
+ :root {
9
+ --bg: #f6f8fa;
10
+ --topbar: rgba(255,255,255,.92);
11
+ --panel: #ffffff;
12
+ --panel-2: #f6f8fa;
13
+ --text: #1f2328;
14
+ --muted: #656d76;
15
+ --faint: #8c959f;
16
+ --border: #d0d7de;
17
+ --border-soft: #eaeef2;
18
+ --accent: #0969da;
19
+ --accent-soft: #ddf4ff;
20
+ --green: #1a7f37;
21
+ --green-bg: #e6ffec;
22
+ --green-gutter: #ccffd8;
23
+ --red: #cf222e;
24
+ --red-bg: #ffebe9;
25
+ --red-gutter: #ffd7d5;
26
+ --purple: #8250df;
27
+ --purple-hot: #bf3989;
28
+ --cyan: #0598bc;
29
+ --radius: 9px;
30
+ --shadow: 0 1px 3px rgba(31,35,40,.08);
31
+ --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
32
+ --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
33
+ --seg-bg: #f0f3f6;
34
+ --note-bg: rgba(255,255,255,.6);
35
+ --ai-bg: linear-gradient(100deg, rgba(124,58,237,.09), rgba(217,70,239,.06) 52%, rgba(34,211,238,.05));
36
+ --ai-border: rgba(168,85,247,.22);
37
+ --ai-text: #3b235f;
38
+ --scroll: #d8dee4;
39
+ }
40
+ * { box-sizing: border-box; }
41
+ html, body { min-height: 100%; }
42
+ body {
43
+ margin: 0;
44
+ background: var(--bg);
45
+ color: var(--text);
46
+ font-family: var(--font);
47
+ font-size: 13px;
48
+ -webkit-font-smoothing: antialiased;
49
+ }
50
+ button, input, textarea { font-family: inherit; }
51
+ button { cursor: pointer; }
52
+ ::selection { background: rgba(168,85,247,.22); }
53
+
54
+ .topbar {
55
+ position: sticky; top: 0; z-index: 100;
56
+ display: flex; align-items: center; gap: 18px;
57
+ height: 58px; padding: 0 22px;
58
+ border-bottom: 1px solid var(--border);
59
+ background: var(--topbar);
60
+ backdrop-filter: blur(16px);
61
+ }
62
+ .brand { display: flex; align-items: center; gap: 9px; font-weight: 650; font-size: 13.5px; white-space: nowrap; }
63
+ .brand .mark {
64
+ width: 25px; height: 25px; border-radius: 8px;
65
+ display: grid; place-items: center;
66
+ color: #fff; font-size: 11px; font-weight: 800; letter-spacing: -.02em;
67
+ background: linear-gradient(135deg, #7c3aed, #d946ef 55%, #22d3ee);
68
+ box-shadow: 0 0 20px rgba(168,85,247,.4);
69
+ }
70
+ .brand .slash { color: var(--faint); font-weight: 400; }
71
+ .brand .subtle { color: var(--muted); font-weight: 500; }
72
+ .top-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
73
+ .paired { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border: 1px solid var(--border-soft); border-radius: 999px; background: var(--panel); }
74
+ .dot { width: 7px; height: 7px; border-radius: 50%; background: #2da44e; box-shadow: 0 0 0 3px rgba(45,164,78,.12); }
75
+ .passkey { padding: 5px 8px; border-radius: 6px; background: var(--seg-bg); color: var(--muted); font-size: 11px; }
76
+ .gh-pill { padding: 5px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 650; color: #6e40c9; background: rgba(130,80,223,.09); border: 1px solid rgba(130,80,223,.16); }
77
+ .avatar {
78
+ width: 28px; height: 28px; border-radius: 50%;
79
+ display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 11px;
80
+ background: linear-gradient(135deg, #6e40c9, #d946ef);
81
+ }
82
+
83
+ .direction-note {
84
+ display: flex; align-items: center; gap: 10px;
85
+ padding: 9px 22px; border-bottom: 1px solid var(--border-soft);
86
+ background: var(--note-bg); color: var(--muted); font-size: 12px;
87
+ }
88
+ .direction-note strong { color: var(--text); }
89
+ .direction-note .tag {
90
+ margin-left: auto; padding: 3px 8px; border-radius: 999px;
91
+ color: #6e40c9; background: rgba(130,80,223,.1); font-size: 11px; font-weight: 600;
92
+ }
93
+
94
+ .app {
95
+ display: grid; grid-template-columns: 262px minmax(0,1fr) 336px;
96
+ gap: 16px; padding: 18px; max-width: 1640px; margin: 0 auto; align-items: start;
97
+ }
98
+ .panel {
99
+ background: var(--panel); border: 1px solid var(--border);
100
+ border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
101
+ }
102
+ .panel-head {
103
+ display: flex; align-items: center; justify-content: space-between;
104
+ padding: 11px 14px; font-size: 12px; font-weight: 650;
105
+ border-bottom: 1px solid var(--border-soft);
106
+ }
107
+ .count { color: var(--muted); font-weight: 500; }
108
+ .panel-body { padding: 14px; }
109
+
110
+ /* file rail */
111
+ .file-item {
112
+ display: flex; align-items: flex-start; gap: 9px;
113
+ padding: 10px 14px; cursor: pointer;
114
+ border-left: 2px solid transparent;
115
+ transition: background .15s ease;
116
+ }
117
+ .file-item:hover { background: var(--panel-2); }
118
+ .file-item.active { background: var(--accent-soft); border-left-color: var(--accent); }
119
+ .file-icon {
120
+ flex: none; width: 15px; height: 15px; margin-top: 1px;
121
+ color: var(--faint);
122
+ }
123
+ .file-meta { min-width: 0; flex: 1; }
124
+ .file-path {
125
+ font-family: var(--mono); font-size: 11.5px; color: var(--text);
126
+ overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
127
+ }
128
+ .file-stats { display: flex; gap: 7px; margin-top: 3px; font-family: var(--mono); font-size: 11px; }
129
+ .plus { color: var(--green); }
130
+ .minus { color: var(--red); }
131
+ .file-chip {
132
+ flex: none; padding: 1px 6px; border-radius: 999px;
133
+ font-size: 10px; font-weight: 650; color: var(--muted);
134
+ background: var(--seg-bg); border: 1px solid var(--border-soft);
135
+ }
136
+ .file-chip.new { color: var(--green); background: var(--green-bg); border-color: var(--green-gutter); }
137
+ .file-chip.round2 { color: #6e40c9; background: rgba(130,80,223,.08); border-color: rgba(130,80,223,.15); }
138
+
139
+ .rail-section { padding: 13px 14px; border-top: 1px solid var(--border-soft); }
140
+ .rail-label { color: var(--muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; font-weight: 650; margin-bottom: 9px; }
141
+ .stat-row { display: flex; align-items: center; justify-content: space-between; padding: 4px 0; font-size: 12px; color: var(--muted); }
142
+ .stat-row strong { color: var(--text); font-weight: 600; }
143
+ .checks { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); }
144
+ .check { display: flex; align-items: center; gap: 7px; }
145
+ .check .ok { color: var(--green); }
146
+ .why {
147
+ margin: 12px 14px 14px; padding: 12px;
148
+ border: 1px solid var(--border-soft); border-radius: 9px;
149
+ background: var(--panel-2);
150
+ }
151
+ .why-title { font-size: 11px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
152
+ .why ul { margin: 0; padding-left: 15px; color: var(--muted); font-size: 11.5px; line-height: 1.6; }
153
+ .why .tradeoff { margin-top: 7px; color: var(--faint); font-size: 11px; line-height: 1.5; }
154
+
155
+ /* main */
156
+ .main { min-width: 0; }
157
+ .pr-head { padding: 4px 2px 14px; }
158
+ .pr-title { font-size: 24px; line-height: 1.25; letter-spacing: -.015em; font-weight: 680; color: var(--text); }
159
+ .pr-meta { margin-top: 6px; color: var(--muted); font-size: 12px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
160
+ .branch {
161
+ font-family: var(--mono); font-size: 11px; color: #6e40c9;
162
+ background: rgba(130,80,223,.09); padding: 2px 6px; border-radius: 5px;
163
+ }
164
+ .tabs { display: flex; align-items: center; gap: 4px; margin-top: 14px; border-bottom: 1px solid var(--border); }
165
+ .tab {
166
+ border: 0; background: transparent; color: var(--muted);
167
+ padding: 9px 11px; font-size: 12.5px; font-weight: 550;
168
+ border-bottom: 2px solid transparent; margin-bottom: -1px;
169
+ }
170
+ .tab.active { color: var(--text); border-bottom-color: #fd8c73; font-weight: 650; }
171
+ .tab:hover { color: var(--text); }
172
+ .tabs .spacer { flex: 1; }
173
+ .ghost {
174
+ border: 1px solid var(--border); background: var(--panel); color: var(--muted);
175
+ padding: 4px 9px; border-radius: 6px; font-size: 11px;
176
+ }
177
+ .ghost:hover { color: var(--text); background: var(--panel-2); }
178
+
179
+ .progress {
180
+ display: flex; align-items: center; gap: 10px;
181
+ margin: 4px 0 12px; padding: 9px 12px;
182
+ border: 1px solid var(--border-soft); border-radius: 8px;
183
+ background: var(--panel); color: var(--muted); font-size: 12px;
184
+ }
185
+ .progress .bar { flex: 1; height: 4px; border-radius: 999px; background: var(--seg-bg); overflow: hidden; }
186
+ .progress .bar span { display: block; height: 100%; width: 50%; background: linear-gradient(90deg,#8250df,#d946ef,#22d3ee); }
187
+ .progress strong { color: var(--text); }
188
+
189
+ .file-card {
190
+ border: 1px solid var(--border); border-radius: var(--radius);
191
+ background: var(--panel); overflow: hidden; margin-bottom: 14px;
192
+ }
193
+ .file-head {
194
+ display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
195
+ padding: 10px 12px; border-bottom: 1px solid var(--border-soft);
196
+ background: var(--panel-2);
197
+ }
198
+ .file-head .path { font-family: var(--mono); font-size: 12px; font-weight: 600; }
199
+ .file-head .stats { font-family: var(--mono); font-size: 11px; }
200
+ .file-head .spacer { flex: 1; }
201
+ .btn {
202
+ border: 1px solid var(--border); background: var(--panel); color: var(--text);
203
+ padding: 5px 10px; border-radius: 6px; font-size: 11.5px; font-weight: 550;
204
+ transition: all .15s ease;
205
+ }
206
+ .btn:hover { background: var(--panel-2); }
207
+ .btn.ok { color: #1a7f37; border-color: #a7d9b5; background: #f3fff6; }
208
+ .btn.ok:hover { background: #e6ffec; }
209
+ .btn.no { color: #cf222e; border-color: #ffb3ad; background: #fff6f5; }
210
+ .btn.no:hover { background: #ffebe9; }
211
+ .btn.primary {
212
+ color: #fff; border-color: transparent;
213
+ background: linear-gradient(90deg,#6e40c9,#a855f7 55%,#d946ef);
214
+ box-shadow: 0 4px 14px -6px rgba(130,80,223,.55);
215
+ }
216
+ .btn.primary:hover { filter: brightness(1.05); }
217
+ .btn.tiny { padding: 2px 7px; font-size: 10.5px; }
218
+ .toggle {
219
+ display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px;
220
+ user-select: none; cursor: pointer;
221
+ }
222
+ .toggle input { display: none; }
223
+ .toggle .track { width: 26px; height: 15px; border-radius: 999px; background: var(--border); position: relative; transition: background .15s ease; }
224
+ .toggle .track::after { content: ''; position: absolute; width: 11px; height: 11px; border-radius: 50%; background: #fff; top: 2px; left: 2px; transition: transform .15s ease; }
225
+ .toggle input:checked + .track { background: linear-gradient(90deg,#8250df,#d946ef); }
226
+ .toggle input:checked + .track::after { transform: translateX(11px); }
227
+ .legend { display: flex; gap: 9px; color: var(--faint); font-size: 10.5px; }
228
+ .legend i { display: inline-block; width: 7px; height: 7px; border-radius: 2px; margin-right: 4px; vertical-align: 1px; }
229
+ .legend .cur { background: var(--green-gutter); }
230
+ .legend .old { background: var(--border); }
231
+ .legend .rem { background: var(--red-gutter); }
232
+
233
+ .hunk { border-top: 1px solid var(--border-soft); }
234
+ .hunk:first-of-type { border-top: 0; }
235
+ .hunk-head {
236
+ display: flex; align-items: center; gap: 8px;
237
+ padding: 7px 12px; background: var(--accent-soft); color: var(--muted);
238
+ font-family: var(--mono); font-size: 11px; border-bottom: 1px solid var(--border-soft);
239
+ }
240
+ .hunk-head .hunk-tag {
241
+ margin-left: auto; font-family: var(--font); font-size: 9.5px; font-weight: 700;
242
+ letter-spacing: .08em; color: #6e40c9; background: rgba(130,80,223,.08);
243
+ padding: 2px 6px; border-radius: 999px;
244
+ }
245
+ .row { display: grid; grid-template-columns: 42px 42px 20px minmax(0,1fr); min-height: 24px; align-items: stretch; position: relative; }
246
+ .row .ln {
247
+ display: flex; align-items: center; justify-content: flex-end;
248
+ padding-right: 7px; color: var(--faint); font-family: var(--mono); font-size: 10.5px;
249
+ cursor: pointer; user-select: none; border-right: 1px solid var(--border-soft);
250
+ }
251
+ .row .ln:hover { background: rgba(130,80,223,.1); color: #6e40c9; }
252
+ .row .sign { display: flex; align-items: center; justify-content: center; color: var(--faint); font-family: var(--mono); font-size: 11px; }
253
+ .row .code { padding: 2px 10px; white-space: pre; overflow-x: auto; font-family: var(--mono); font-size: 12px; line-height: 20px; }
254
+ .row.add { background: var(--green-bg); }
255
+ .row.add .ln { background: var(--green-gutter); color: #1a7f37; }
256
+ .row.add .sign { color: #1a7f37; }
257
+ .row.del { background: var(--red-bg); }
258
+ .row.del .ln { background: var(--red-gutter); color: #cf222e; }
259
+ .row.del .sign { color: #cf222e; }
260
+ .row.removed { background: #ffd7d5; }
261
+ .row.removed .code { color: #a40e26; font-weight: 550; }
262
+ .row-removed {
263
+ position: absolute; right: 8px; top: 3px; padding: 1px 6px; border-radius: 999px;
264
+ background: #cf222e; color: #fff; font-size: 9px; font-weight: 700; letter-spacing: .02em;
265
+ }
266
+ .row.selected { background: rgba(130,80,223,.14) !important; box-shadow: inset 2px 0 0 #8250df; }
267
+ .row.selected .ln { color: #6e40c9; background: rgba(130,80,223,.12); }
268
+ .app[data-dim="on"] .row[data-round="1"]:not(.removed) { opacity: .42; }
269
+ .app[data-dim="on"] .row[data-round="1"]:not(.removed) .ln { opacity: .7; }
270
+
271
+ .ai-note {
272
+ display: grid; grid-template-columns: 42px 42px 20px minmax(0,1fr);
273
+ min-height: 24px; align-items: stretch; cursor: help;
274
+ background: linear-gradient(90deg, rgba(124,58,237,.10), rgba(217,70,239,.07) 55%, rgba(34,211,238,.05));
275
+ box-shadow: inset 2px 0 0 #a855f7;
276
+ }
277
+ .ai-note:hover { background: linear-gradient(90deg, rgba(124,58,237,.15), rgba(217,70,239,.10) 55%, rgba(34,211,238,.07)); }
278
+ .ai-note .ai-no { background: rgba(168,85,247,.10); border-right: 1px solid var(--border-soft); }
279
+ .ai-note .ai-sign { display: flex; align-items: center; justify-content: center; color: #7c3aed; font-size: 9px; font-weight: 800; letter-spacing: .02em; text-shadow: 0 0 8px rgba(168,85,247,.35); }
280
+ .ai-note .ai-text { display: flex; align-items: center; gap: 7px; min-width: 0; padding: 2px 10px; white-space: nowrap; overflow: hidden; font-family: var(--mono); font-size: 12px; line-height: 20px; color: #5b3f86; }
281
+ .ai-note .ai-body { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
282
+
283
+ /* review rail */
284
+ .review-summary { padding: 14px; }
285
+ .review-big { font-size: 15px; font-weight: 680; }
286
+ .review-sub { margin-top: 3px; color: var(--muted); font-size: 11.5px; }
287
+ .review-stats { display: flex; gap: 10px; margin-top: 10px; font-family: var(--mono); font-size: 12px; }
288
+ .review-actions { display: flex; flex-direction: column; gap: 7px; padding: 0 14px 14px; }
289
+ .review-actions .btn { width: 100%; padding: 7px 10px; font-size: 12px; }
290
+ .review-files { padding: 12px 14px; border-top: 1px solid var(--border-soft); display: flex; flex-direction: column; gap: 7px; }
291
+ .review-file { display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--muted); }
292
+ .review-file .state { margin-left: auto; font-size: 10px; font-weight: 650; }
293
+ .review-file .state.ok { color: var(--green); }
294
+ .review-file .state.no { color: var(--red); }
295
+ .review-file .state.pending { color: var(--faint); }
296
+ .waiter {
297
+ margin: 12px 14px; padding: 9px 10px; border: 1px dashed var(--border);
298
+ border-radius: 8px; color: var(--muted); font-size: 11px; line-height: 1.45;
299
+ display: flex; gap: 8px; align-items: flex-start;
300
+ }
301
+ .waiter .pulse { width: 7px; height: 7px; border-radius: 50%; background: #a855f7; margin-top: 3px; box-shadow: 0 0 0 3px rgba(168,85,247,.12); animation: pulse 2s ease infinite; }
302
+ @keyframes pulse { 0%,100% { opacity: .55; transform: scale(.9); } 50% { opacity: 1; transform: scale(1.1); } }
303
+
304
+ .ai-panel { border-top: 1px solid var(--border-soft); }
305
+ .ai-panel-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; font-size: 12px; font-weight: 650; }
306
+ .orb {
307
+ width: 18px; height: 18px; border-radius: 50%;
308
+ background: conic-gradient(from 210deg, #a78bfa, #e879f9, #67e8f9, #a78bfa);
309
+ box-shadow: 0 0 14px rgba(168,85,247,.55), inset 0 0 6px rgba(255,255,255,.6);
310
+ }
311
+ .ai-panel-head .sub { margin-left: auto; color: var(--faint); font-size: 10px; font-weight: 500; }
312
+ .chat { padding: 0 14px 10px; display: flex; flex-direction: column; gap: 8px; max-height: 330px; overflow: auto; }
313
+ .msg { display: flex; gap: 7px; font-size: 11.5px; line-height: 1.5; }
314
+ .msg .who { flex: none; width: 18px; height: 18px; border-radius: 6px; display: grid; place-items: center; font-size: 8px; font-weight: 800; color: #fff; background: linear-gradient(135deg,#6e40c9,#d946ef); }
315
+ .msg.user .who { background: #57606a; }
316
+ .msg .bubble { padding: 6px 8px; border-radius: 8px; background: var(--panel-2); color: var(--text); }
317
+ .msg.ai .bubble { background: var(--ai-bg); box-shadow: inset 0 0 0 1px var(--ai-border); }
318
+ .ask { display: flex; gap: 6px; padding: 0 14px 14px; }
319
+ .ask input {
320
+ flex: 1; min-width: 0; padding: 7px 9px; border: 1px solid var(--border);
321
+ border-radius: 7px; background: var(--panel); color: var(--text); font-size: 11.5px; outline: none;
322
+ }
323
+ .ask input:focus { border-color: #a78bfa; box-shadow: 0 0 0 3px rgba(168,85,247,.12); }
324
+ .ask button { border: 0; border-radius: 7px; padding: 0 10px; color: #fff; font-weight: 650; font-size: 11px; background: linear-gradient(90deg,#6e40c9,#d946ef); }
325
+
326
+ /* selection */
327
+ .selection-bar {
328
+ position: fixed; z-index: 200; display: none; align-items: center; gap: 7px;
329
+ padding: 6px 7px 6px 11px; border-radius: 10px;
330
+ background: rgba(22,22,30,.94); color: #fff; font-size: 11px;
331
+ box-shadow: 0 12px 34px rgba(0,0,0,.28), inset 0 0 0 1px rgba(255,255,255,.08);
332
+ backdrop-filter: blur(12px);
333
+ }
334
+ .selection-bar.show { display: flex; }
335
+ .selection-bar .sel-count { color: #d7c9ff; font-family: var(--mono); white-space: nowrap; }
336
+ .selection-bar .sel-btn { border: 1px solid rgba(255,255,255,.16); background: rgba(255,255,255,.06); color: #fff; padding: 4px 8px; border-radius: 6px; font-size: 10.5px; }
337
+ .selection-bar .sel-btn:hover { background: rgba(255,255,255,.12); }
338
+ .selection-bar .sel-btn.primary { border: 0; background: linear-gradient(90deg,#7c3aed,#d946ef); font-weight: 650; }
339
+ .selection-note { margin: 5px 10px 7px; }
340
+ .suggestion {
341
+ margin: 6px 10px 8px; border: 1px solid rgba(130,80,223,.22); border-radius: 8px;
342
+ overflow: hidden; background: var(--panel);
343
+ }
344
+ .suggestion-head { padding: 5px 9px; font-size: 10.5px; font-weight: 650; color: #6e40c9; background: rgba(130,80,223,.07); display: flex; align-items: center; gap: 6px; }
345
+ .suggestion-head .spacer { flex: 1; }
346
+ .suggestion pre { margin: 0; padding: 7px 9px; font-family: var(--mono); font-size: 11px; line-height: 1.5; overflow-x: auto; }
347
+ .suggestion .s-del { color: #cf222e; }
348
+ .suggestion .s-add { color: #1a7f37; }
349
+ .suggestion-foot { display: flex; gap: 6px; padding: 6px 9px 8px; }
350
+
351
+ .toast {
352
+ position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 14px);
353
+ z-index: 300; opacity: 0; pointer-events: none;
354
+ padding: 8px 13px; border-radius: 9px; font-size: 12px; color: #fff;
355
+ background: rgba(22,22,30,.95); box-shadow: 0 14px 40px rgba(0,0,0,.3);
356
+ transition: all .2s ease;
357
+ }
358
+ .toast.show { opacity: 1; transform: translate(-50%, 0); }
359
+
360
+ @media (max-width: 1200px) {
361
+ .app { grid-template-columns: 230px minmax(0,1fr); }
362
+ .review { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; }
363
+ .review > .panel-head { grid-column: 1 / -1; }
364
+ }
365
+ @media (max-width: 860px) {
366
+ .topbar { padding: 0 12px; gap: 10px; overflow-x: auto; }
367
+ .brand .subtle, .passkey { display: none; }
368
+ .app { grid-template-columns: 1fr; padding: 12px; }
369
+ .files, .review { grid-column: auto; }
370
+ .review { display: block; }
371
+ .pr-title { font-size: 21px; }
372
+ }
373
+ </style>
374
+ </head>
375
+ <body>
376
+ <header class="topbar">
377
+ <div class="brand">
378
+ <span class="mark">CE</span>
379
+ <span>Coding Enhanced</span><span class="slash">/</span><span class="subtle">Review · GitHub native</span>
380
+ </div>
381
+ <span class="gh-pill">GitHub 原生</span>
382
+ <div class="top-actions">
383
+ <span class="paired"><span class="dot"></span>Paired · @xthw</span>
384
+ <span class="passkey">Passkey</span>
385
+ <span class="avatar">X</span>
386
+ </div>
387
+ </header>
388
+
389
+ <div class="direction-note">
390
+ <strong>GitHub 原生</strong>
391
+ <span>AI 说明改成普通 diff 行:紫色底,符号列就是 AI,单行省略,不打断代码。</span>
392
+ <span class="tag">Selected direction</span>
393
+ </div>
394
+
395
+ <div class="app" id="app" data-dim="on">
396
+ <aside class="files panel">
397
+ <div class="panel-head">Files changed <span class="count">2</span></div>
398
+ <div id="fileList"></div>
399
+ <div class="rail-section">
400
+ <div class="rail-label">Review status</div>
401
+ <div class="stat-row"><span>Files</span><strong>2</strong></div>
402
+ <div class="stat-row"><span>Additions</span><strong id="statAdd" class="plus">+23</strong></div>
403
+ <div class="stat-row"><span>Deletions</span><strong id="statDel" class="minus">-2</strong></div>
404
+ <div class="stat-row"><span>AI explanations</span><strong>4</strong></div>
405
+ </div>
406
+ <div class="rail-section">
407
+ <div class="rail-label">Rounds</div>
408
+ <div class="miniramp" style="height:5px;border-radius:999px;background:linear-gradient(90deg,rgba(139,124,255,.12),rgba(217,70,239,.35),rgba(34,211,238,.3));"></div>
409
+ <div style="display:flex;justify-content:space-between;margin-top:6px;color:var(--faint);font-size:10.5px;">
410
+ <span>Round 1</span><span>Round 2 · current</span>
411
+ </div>
412
+ </div>
413
+ <div class="rail-section">
414
+ <div class="rail-label">Checks</div>
415
+ <div class="checks">
416
+ <div class="check"><span class="ok">✓</span> review-waiter / waiting</div>
417
+ <div class="check"><span class="ok">✓</span> workspace snapshot</div>
418
+ <div class="check"><span class="ok">✓</span> 2 files queued</div>
419
+ </div>
420
+ </div>
421
+ <div class="why" id="why">
422
+ <div class="why-title">Why GitHub 原生</div>
423
+ <ul><li>熟悉的分栏 + diff 语法</li><li>AI 说明只换颜色,不换节奏</li><li>实现风险最低,先落进 DSH 侧栏</li></ul>
424
+ <div class="tradeoff">AI 说明不再是大卡片:一行高度、紫色底、悬停看全文。</div>
425
+ </div>
426
+ </aside>
427
+
428
+ <main class="main">
429
+ <div class="pr-head">
430
+ <div class="pr-title" id="prTitle">Refactor bubble sort for a 100-item test</div>
431
+ <div class="pr-meta">
432
+ <span><strong>xthw</strong> wants to merge 2 files into <span class="branch">main</span></span>
433
+ <span>·</span><span>from review-demo</span>
434
+ <span>·</span><span>AI reviewed · 4 groups</span>
435
+ </div>
436
+ <div class="tabs">
437
+ <button class="tab active">Files changed</button>
438
+ <button class="tab" data-toast="Conversation view is part of the standalone web app.">Conversation</button>
439
+ <span class="spacer"></span>
440
+ <button class="ghost" data-toast="Split view is not in this static demo.">Split</button>
441
+ <button class="ghost active" data-toast="Unified view is shown.">Unified</button>
442
+ </div>
443
+ </div>
444
+
445
+ <div class="progress">
446
+ <strong id="reviewedCount">1 of 2</strong>
447
+ <span>files reviewed</span>
448
+ <div class="bar"><span id="progressBar"></span></div>
449
+ <span>AI reviewed 4 added groups · line selection enabled</span>
450
+ </div>
451
+
452
+ <div id="fileView"></div>
453
+ </main>
454
+
455
+ <aside class="review panel">
456
+ <div class="panel-head">Review</div>
457
+ <div class="review-summary">
458
+ <div class="review-big" id="reviewBig">Changes requested</div>
459
+ <div class="review-sub">2 files · +23 −2</div>
460
+ <div class="review-stats"><span class="plus">+23</span><span class="minus">−2</span><span style="color:var(--faint)">·</span><span style="color:var(--muted)">Round 2</span></div>
461
+ </div>
462
+ <div class="review-actions">
463
+ <button class="btn primary" id="finishBtn">Finish review</button>
464
+ <button class="btn ok" id="approveAll">Approve all files</button>
465
+ <button class="btn no" id="rejectAll">Reject all files</button>
466
+ </div>
467
+ <div class="review-files" id="reviewFiles"></div>
468
+ <div class="waiter"><span class="pulse"></span><span><strong style="color:var(--text);">Review waiter subagent</strong><br/>waiting — you can keep chatting or end the turn; it will wake the main agent.</span></div>
469
+ <div class="ai-panel">
470
+ <div class="ai-panel-head"><span class="orb"></span>AI reviewer <span class="sub">line-aware</span></div>
471
+ <div class="chat" id="chat"></div>
472
+ <div class="ask">
473
+ <input id="askInput" placeholder="Ask about a line range or ask for a change…" />
474
+ <button id="askSend">Send</button>
475
+ </div>
476
+ </div>
477
+ </aside>
478
+ </div>
479
+
480
+ <div class="selection-bar" id="selectionBar">
481
+ <span class="sel-count" id="selCount">3 lines</span>
482
+ <button class="sel-btn primary" id="explainBtn">Explain</button>
483
+ <button class="sel-btn" id="suggestBtn">Suggest change</button>
484
+ <button class="sel-btn" id="askBtn">Ask AI</button>
485
+ <button class="sel-btn" id="clearBtn">Clear</button>
486
+ </div>
487
+ <div class="toast" id="toast"></div>
488
+
489
+ <script>
490
+ const $ = (selector, root = document) => root.querySelector(selector);
491
+ const $$ = (selector, root = document) => [...root.querySelectorAll(selector)];
492
+ const esc = (value) => String(value ?? '').replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
493
+
494
+ const files = [
495
+ {
496
+ id: 'bubble-sort',
497
+ path: 'review-demo/bubble-sort.js',
498
+ kind: 'modified',
499
+ added: 10,
500
+ removed: 2,
501
+ state: 'pending',
502
+ notes: [
503
+ { line: 2, text: '抽出 shouldSwap,让比较规则集中到一处;说明行应插在这组绿色中间。' },
504
+ { line: 11, text: '改为调用 shouldSwap,行为不变,但后续要换比较策略只需改一个函数。' },
505
+ { line: 21, text: '新增降序版本:先反转输入再升序排序,最后反转回来,复用 bubbleSort。' },
506
+ ],
507
+ hunks: [
508
+ {
509
+ header: '@@ -1,10 +1,14 @@',
510
+ lines: [
511
+ { t: 'ctx', o: 1, n: 1, x: '// Bubble sort — ascending, stable, returns a sorted copy.' },
512
+ { t: 'add', o: null, n: 2, x: 'function shouldSwap(left, right) {', r: 1 },
513
+ { t: 'add', o: null, n: 3, x: ' return left > right', r: 1 },
514
+ { t: 'add', o: null, n: 4, x: '}', r: 1 },
515
+ { t: 'add', o: null, n: 5, x: '', r: 1 },
516
+ { t: 'ctx', o: 2, n: 6, x: 'function bubbleSort(values) {' },
517
+ { t: 'ctx', o: 3, n: 7, x: ' const result = [...values]' },
518
+ { t: 'ctx', o: 4, n: 8, x: ' for (let end = result.length - 1; end > 0; end -= 1) {' },
519
+ { t: 'ctx', o: 5, n: 9, x: ' let swapped = false' },
520
+ { t: 'ctx', o: 6, n: 10, x: ' for (let index = 0; index < end; index += 1) {' },
521
+ { t: 'del', o: 7, n: null, x: ' if (result[index] > result[index + 1]) {' },
522
+ { t: 'add', o: null, n: 11, x: ' if (shouldSwap(result[index], result[index + 1])) {', r: 1 },
523
+ { t: 'del', o: 8, n: null, x: ' // previous: const compare = (a, b) => a > b', r: 1, removed: true },
524
+ { t: 'ctx', o: 9, n: 12, x: ' ;[result[index], result[index + 1]] = [result[index + 1], result[index]]' },
525
+ { t: 'ctx', o: 10, n: 13, x: ' swapped = true' },
526
+ { t: 'ctx', o: 11, n: 14, x: ' }' },
527
+ ],
528
+ },
529
+ {
530
+ header: '@@ -14,4 +18,8 @@',
531
+ lines: [
532
+ { t: 'ctx', o: 14, n: 18, x: ' return result' },
533
+ { t: 'ctx', o: 15, n: 19, x: '}' },
534
+ { t: 'ctx', o: 16, n: 20, x: '' },
535
+ { t: 'del', o: 17, n: null, x: 'module.exports = { bubbleSort }' },
536
+ { t: 'add', o: null, n: 21, x: 'function bubbleSortDescending(values) {', r: 2 },
537
+ { t: 'add', o: null, n: 22, x: ' return bubbleSort([...values].reverse()).reverse()', r: 2 },
538
+ { t: 'add', o: null, n: 23, x: '}', r: 2 },
539
+ { t: 'add', o: null, n: 24, x: '', r: 2 },
540
+ { t: 'add', o: null, n: 25, x: 'module.exports = { bubbleSort, bubbleSortDescending, shouldSwap }', r: 2 },
541
+ ],
542
+ },
543
+ ],
544
+ },
545
+ {
546
+ id: 'bubble-sort-100',
547
+ path: 'review-demo/bubble-sort-100.js',
548
+ kind: 'added',
549
+ added: 13,
550
+ removed: 0,
551
+ state: 'pending',
552
+ notes: [
553
+ { line: 5, text: '用确定性公式生成 0..99 的 100 个元素,避免随机数导致测试不可复现。' },
554
+ ],
555
+ hunks: [
556
+ {
557
+ header: '@@ -0,0 +1,13 @@',
558
+ lines: [
559
+ { t: 'add', o: null, n: 1, x: '// Bubble sort — 100-element array test.', r: 2 },
560
+ { t: 'add', o: null, n: 2, x: "const { bubbleSort } = require('./bubble-sort')", r: 2 },
561
+ { t: 'add', o: null, n: 3, x: '', r: 2 },
562
+ { t: 'add', o: null, n: 4, x: 'function makeHundred() {', r: 2 },
563
+ { t: 'add', o: null, n: 5, x: ' return Array.from({ length: 100 }, (_, index) => (index * 37) % 100)', r: 2 },
564
+ { t: 'add', o: null, n: 6, x: '}', r: 2 },
565
+ { t: 'add', o: null, n: 7, x: '', r: 2 },
566
+ { t: 'add', o: null, n: 8, x: 'const input = makeHundred()', r: 2 },
567
+ { t: 'add', o: null, n: 9, x: 'const sorted = bubbleSort(input)', r: 2 },
568
+ { t: 'add', o: null, n: 10, x: '', r: 2 },
569
+ { t: 'add', o: null, n: 11, x: "console.log('length:', sorted.length)", r: 2 },
570
+ { t: 'add', o: null, n: 12, x: "console.log('first:', sorted[0], 'last:', sorted[sorted.length - 1])", r: 2 },
571
+ { t: 'add', o: null, n: 13, x: 'module.exports = { makeHundred, input, sorted }', r: 2 },
572
+ ],
573
+ },
574
+ ],
575
+ },
576
+ ];
577
+
578
+
579
+ let activeId = files[0].id;
580
+ let dim = true;
581
+ let selection = null;
582
+ let selecting = false;
583
+ let selStart = 0;
584
+ let selEnd = 0;
585
+ let chat = [];
586
+ let fileStates = Object.fromEntries(files.map((file) => [file.id, file.state]));
587
+
588
+ const app = $('#app');
589
+ const fileList = $('#fileList');
590
+ const fileView = $('#fileView');
591
+ const reviewFiles = $('#reviewFiles');
592
+ const chatEl = $('#chat');
593
+ const toastEl = $('#toast');
594
+ const selectionBar = $('#selectionBar');
595
+
596
+ function activeFile() { return files.find((file) => file.id === activeId); }
597
+ function toast(message) {
598
+ toastEl.textContent = message;
599
+ toastEl.classList.add('show');
600
+ clearTimeout(toastEl._timer);
601
+ toastEl._timer = setTimeout(() => toastEl.classList.remove('show'), 2200);
602
+ }
603
+
604
+ function renderFiles() {
605
+ fileList.innerHTML = files.map((file) => `
606
+ <div class="file-item ${file.id === activeId ? 'active' : ''}" data-file="${file.id}">
607
+ <svg class="file-icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.4"><path d="M4 1.8h5.2L13 5.6V14a.7.7 0 0 1-.7.7H4A.7.7 0 0 1 3.3 14V2.5A.7.7 0 0 1 4 1.8Z"/><path d="M9 2v4h4"/></svg>
608
+ <div class="file-meta">
609
+ <div class="file-path" title="${esc(file.path)}">${esc(file.path.replace('review-demo/', ''))}</div>
610
+ <div class="file-stats"><span class="plus">+${file.added}</span><span class="minus">−${file.removed}</span></div>
611
+ </div>
612
+ <span class="file-chip ${file.kind === 'added' ? 'new' : ''}">${file.kind === 'added' ? 'new' : 'modified'}</span>
613
+ ${file.id === 'bubble-sort-100' ? '<span class="file-chip round2">r2</span>' : ''}
614
+ </div>
615
+ `).join('');
616
+ }
617
+
618
+ function noteFor(line) {
619
+ const file = activeFile();
620
+ return file.notes.find((note) => note.line === line);
621
+ }
622
+
623
+ function rowHtml(line, index) {
624
+ const cls = [line.t, line.removed ? 'removed' : '', line.r ? 'r' + line.r : ''].filter(Boolean).join(' ');
625
+ const number = line.n ?? line.o ?? '';
626
+ const sign = line.t === 'add' ? '+' : line.t === 'del' ? '−' : ' ';
627
+ const note = line.n === null ? undefined : noteFor(line.n);
628
+ return `
629
+ <div class="row ${cls}" data-index="${index}" data-line="${number}" data-round="${line.r ?? ''}" data-removed="${line.removed ? '1' : '0'}">
630
+ <span class="ln old" title="Click or drag to select lines">${line.o ?? ''}</span>
631
+ <span class="ln new" title="Click or drag to select lines">${line.n ?? ''}</span>
632
+ <span class="sign">${sign}</span>
633
+ <span class="code">${esc(line.x) || ' '}</span>
634
+ ${line.removed ? '<span class="row-removed">removed this round</span>' : ''}
635
+ </div>
636
+ ${note ? `<div class="ai-note" data-note-line="${note.line}" title="${esc(note.text)}"><span class="ai-no"></span><span class="ai-no"></span><span class="ai-sign">AI</span><span class="ai-text"><span class="ai-body">${esc(note.text)}</span></span></div>` : ''}
637
+ `;
638
+ }
639
+
640
+ function renderFile() {
641
+ const file = activeFile();
642
+ const rows = [];
643
+ let index = 0;
644
+ for (const hunk of file.hunks) {
645
+ const hunkRows = [];
646
+ for (const line of hunk.lines) {
647
+ hunkRows.push(rowHtml(line, index));
648
+ index += 1;
649
+ }
650
+ rows.push(`
651
+ <div class="hunk">
652
+ <div class="hunk-head"><span>${esc(hunk.header)}</span><span class="hunk-tag">AI REVIEWED</span></div>
653
+ ${hunkRows.join('')}
654
+ </div>
655
+ `);
656
+ }
657
+ const state = fileStates[file.id];
658
+ fileView.innerHTML = `
659
+ <div class="file-card">
660
+ <div class="file-head">
661
+ <span class="path">${esc(file.path)}</span>
662
+ <span class="stats"><span class="plus">+${file.added}</span> <span class="minus">−${file.removed}</span></span>
663
+ <span class="file-chip ${file.kind === 'added' ? 'new' : ''}">${file.kind === 'added' ? 'new file' : 'modified'}</span>
664
+ <span class="spacer"></span>
665
+ <span class="legend"><span><i class="cur"></i>current</span><span><i class="old"></i>previous</span><span><i class="rem"></i>removed</span></span>
666
+ <label class="toggle" title="Dim lines from the previous round">
667
+ <input type="checkbox" id="dimToggle" ${dim ? 'checked' : ''} /><span class="track"></span>Dim previous round
668
+ </label>
669
+ <button class="btn ok tiny" data-file-approve="${file.id}">Approve</button>
670
+ <button class="btn no tiny" data-file-reject="${file.id}">Reject</button>
671
+ <span class="file-chip">${state === 'approved' ? 'approved' : state === 'rejected' ? 'rejected' : 'pending'}</span>
672
+ </div>
673
+ ${rows.join('')}
674
+ </div>
675
+ `;
676
+ const toggle = $('#dimToggle');
677
+ if (toggle) toggle.addEventListener('change', () => { dim = toggle.checked; app.dataset.dim = dim ? 'on' : 'off'; });
678
+ clearSelection();
679
+ }
680
+
681
+ function renderReviewFiles() {
682
+ reviewFiles.innerHTML = files.map((file) => {
683
+ const state = fileStates[file.id];
684
+ return `
685
+ <div class="review-file">
686
+ <span>${esc(file.path.replace('review-demo/', ''))}</span>
687
+ <span class="state ${state === 'approved' ? 'ok' : state === 'rejected' ? 'no' : 'pending'}">${state === 'approved' ? 'approved' : state === 'rejected' ? 'rejected' : 'pending'}</span>
688
+ </div>
689
+ `;
690
+ }).join('');
691
+ }
692
+
693
+ function updateSummary() {
694
+ const approved = files.filter((file) => fileStates[file.id] === 'approved').length;
695
+ const rejected = files.filter((file) => fileStates[file.id] === 'rejected').length;
696
+ $('#reviewedCount').textContent = `${approved + rejected} of ${files.length}`;
697
+ $('#progressBar').style.width = `${((approved + rejected) / files.length) * 100}%`;
698
+ $('#reviewBig').textContent = rejected > 0 ? 'Changes requested' : approved === files.length ? 'Approved' : 'In review';
699
+ $('#statAdd').textContent = '+' + files.reduce((sum, file) => sum + file.added, 0);
700
+ $('#statDel').textContent = '−' + files.reduce((sum, file) => sum + file.removed, 0);
701
+ renderReviewFiles();
702
+ }
703
+
704
+ function addChat(role, text) {
705
+ chat.push({ role, text });
706
+ chatEl.innerHTML = chat.map((message) => `
707
+ <div class="msg ${message.role}"><span class="who">${message.role === 'ai' ? 'AI' : 'X'}</span><div class="bubble">${esc(message.text)}</div></div>
708
+ `).join('');
709
+ chatEl.scrollTop = chatEl.scrollHeight;
710
+ }
711
+
712
+ function renderSelection() {
713
+ clearSelection(true);
714
+ const rows = $$('.row', fileView);
715
+ if (rows.length === 0) return;
716
+ const from = Math.min(selStart, selEnd);
717
+ const to = Math.max(selStart, selEnd);
718
+ const selected = rows.filter((row) => {
719
+ const index = Number(row.dataset.index);
720
+ return index >= from && index <= to;
721
+ });
722
+ selected.forEach((row) => row.classList.add('selected'));
723
+ const first = selected[0];
724
+ if (!first) return;
725
+ const lineNumbers = selected.map((row) => row.dataset.line).filter(Boolean);
726
+ $('#selCount').textContent = `${selected.length} line${selected.length === 1 ? '' : 's'}`;
727
+ const rect = first.getBoundingClientRect();
728
+ const left = Math.max(12, Math.min(window.innerWidth - 330, rect.left + 48));
729
+ const top = rect.top > 120 ? rect.top - 46 : rect.bottom + 10;
730
+ selectionBar.style.left = `${left}px`;
731
+ selectionBar.style.top = `${top}px`;
732
+ selectionBar.classList.add('show');
733
+ selection = { from, to, lineNumbers, rows: selected };
734
+ }
735
+
736
+ function clearSelection(preserveBar = false) {
737
+ $$('.row.selected', fileView).forEach((row) => row.classList.remove('selected'));
738
+ if (!preserveBar) {
739
+ selection = null;
740
+ selectionBar.classList.remove('show');
741
+ }
742
+ }
743
+
744
+ function explainSelection() {
745
+ if (!selection) return;
746
+ const range = selection.lineNumbers.length > 1
747
+ ? `${selection.lineNumbers[0]}–${selection.lineNumbers[selection.lineNumbers.length - 1]}`
748
+ : selection.lineNumbers[0];
749
+ const endRow = selection.rows[selection.rows.length - 1];
750
+ const text = selection.lineNumbers.includes('2') || selection.lineNumbers.includes('3')
751
+ ? '这段把比较职责抽到 shouldSwap,后续要换排序方向或比较规则时只改一处;说明行现在插在绿色组中间,而不是整组末尾。'
752
+ : '这段改动属于冒泡排序的核心通路:复制输入、相邻比较交换、swapped 提前退出。AI 解释跟着具体行走,选中范围可以直接追问。';
753
+ const note = document.createElement('div');
754
+ note.className = 'ai-note selection-note';
755
+ note.title = text;
756
+ note.innerHTML = `<span class="ai-no"></span><span class="ai-no"></span><span class="ai-sign">AI</span><span class="ai-text"><span class="ai-body">${esc(text)}</span></span>`;
757
+ endRow.insertAdjacentElement('afterend', note);
758
+ addChat('user', `Explain lines ${range}`);
759
+ addChat('ai', text);
760
+ toast(`AI explained lines ${range}`);
761
+ selectionBar.classList.remove('show');
762
+ }
763
+
764
+ function suggestSelection() {
765
+ if (!selection) return;
766
+ const endRow = selection.rows[selection.rows.length - 1];
767
+ const box = document.createElement('div');
768
+ box.className = 'suggestion';
769
+ box.innerHTML = `
770
+ <div class="suggestion-head"><span>Suggested change</span><span class="spacer"></span><span style="color:var(--faint)">AI</span></div>
771
+ <pre><span class="s-del">- function shouldSwap(left, right) {</span>
772
+ <span class="s-add">+ function shouldSwap(left, right, compare = (a, b) => a > b) {</span>
773
+ <span class="s-del">- return left > right</span>
774
+ <span class="s-add">+ return compare(left, right)</span></pre>
775
+ <div class="suggestion-foot"><button class="btn primary tiny" data-apply-suggestion>Apply suggestion</button><button class="btn tiny" data-dismiss-suggestion>Dismiss</button></div>
776
+ `;
777
+ endRow.insertAdjacentElement('afterend', box);
778
+ box.querySelector('[data-apply-suggestion]').addEventListener('click', () => { box.remove(); toast('Suggestion applied to the review'); });
779
+ box.querySelector('[data-dismiss-suggestion]').addEventListener('click', () => box.remove());
780
+ toast('Suggestion ready');
781
+ selectionBar.classList.remove('show');
782
+ }
783
+
784
+
785
+ // events
786
+
787
+ fileList.addEventListener('click', (event) => {
788
+ const item = event.target.closest('[data-file]');
789
+ if (!item) return;
790
+ activeId = item.dataset.file;
791
+ renderFiles();
792
+ renderFile();
793
+ });
794
+ fileView.addEventListener('mousedown', (event) => {
795
+ const ln = event.target.closest('.ln');
796
+ if (!ln) return;
797
+ const row = ln.closest('.row');
798
+ if (!row) return;
799
+ event.preventDefault();
800
+ selecting = true;
801
+ selStart = Number(row.dataset.index);
802
+ selEnd = selStart;
803
+ renderSelection();
804
+ });
805
+ fileView.addEventListener('mouseover', (event) => {
806
+ if (!selecting) return;
807
+ const row = event.target.closest('.row');
808
+ if (!row) return;
809
+ const index = Number(row.dataset.index);
810
+ if (index !== selEnd) {
811
+ selEnd = index;
812
+ renderSelection();
813
+ }
814
+ });
815
+ document.addEventListener('mouseup', () => { selecting = false; });
816
+ fileView.addEventListener('click', (event) => {
817
+ const approve = event.target.closest('[data-file-approve]');
818
+ if (approve) {
819
+ fileStates[approve.dataset.fileApprove] = 'approved';
820
+ renderFile(); renderFiles(); updateSummary(); toast('File approved');
821
+ return;
822
+ }
823
+ const reject = event.target.closest('[data-file-reject]');
824
+ if (reject) {
825
+ fileStates[reject.dataset.fileReject] = 'rejected';
826
+ renderFile(); renderFiles(); updateSummary(); toast('File rejected');
827
+ }
828
+ });
829
+ $('#finishBtn').addEventListener('click', () => toast('Review finished — decisions sent to the waiter subagent.'));
830
+ $('#approveAll').addEventListener('click', () => {
831
+ for (const file of files) fileStates[file.id] = 'approved';
832
+ renderFile(); renderFiles(); updateSummary(); toast('All files approved');
833
+ });
834
+ $('#rejectAll').addEventListener('click', () => {
835
+ for (const file of files) fileStates[file.id] = 'rejected';
836
+ renderFile(); renderFiles(); updateSummary(); toast('All files rejected');
837
+ });
838
+ $('#explainBtn').addEventListener('click', explainSelection);
839
+ $('#suggestBtn').addEventListener('click', suggestSelection);
840
+ $('#askBtn').addEventListener('click', () => {
841
+ $('#askInput').focus();
842
+ toast('Ask about the selected range');
843
+ });
844
+ $('#clearBtn').addEventListener('click', () => clearSelection());
845
+ $('#askSend').addEventListener('click', sendAsk);
846
+ $('#askInput').addEventListener('keydown', (event) => { if (event.key === 'Enter') sendAsk(); });
847
+ function sendAsk() {
848
+ const input = $('#askInput');
849
+ const value = input.value.trim();
850
+ if (!value) return;
851
+ addChat('user', value);
852
+ input.value = '';
853
+ setTimeout(() => {
854
+ addChat('ai', 'I can explain the selected lines or propose a patch. In the standalone web app this request goes to a line-selection subagent and comes back without blocking the main agent.');
855
+ }, 450);
856
+ }
857
+ $$('[data-toast]').forEach((button) => button.addEventListener('click', () => toast(button.dataset.toast)));
858
+
859
+ // initial
860
+ renderFiles();
861
+ renderFile();
862
+ renderReviewFiles();
863
+ updateSummary();
864
+ addChat('ai', 'I reviewed 2 files and 4 added groups. Ask about any line range, or select lines to get a focused explanation.');
865
+ addChat('ai', 'Round 2 is current: previous-round additions are dimmed; the red line was removed this round.');
866
+
867
+ </script>
868
+ </body>
869
+ </html>