Repository navigation
Expand file tree
/
Copy pathui.html
More file actions
919 lines (877 loc) · 48.6 KB
/
Copy pathui.html
File metadata and controls
919 lines (877 loc) · 48.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
<!doctype html>
<html lang="en" data-theme="light">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Skillview</title>
<style>
/* ── Apple design system ─────────────────────────────────────────────────────
Tokens from Apple's published web system (design-md/apple/DESIGN.md): one
accent (Action Blue), near-black/white/parchment surfaces, SF Pro via the
system stack, a single reserved shadow, zero decorative gradients. Apple
ships this as a light-dominant system with alternating dark *tiles*, not a
persistent dark mode — the dark set below is assembled from Apple's own
documented dark-tile tokens (surface-tile-1, on-dark, Sky Link Blue) into a
full second theme, since this app needs one.
────────────────────────────────────────────────────────────────────────── */
:root{
--canvas:#ffffff; --surface:#f5f5f7; --surface-soft:#fafafc; --raised:#ffffff;
--hairline:#f0f0f0; --hairline-soft:#f5f5f5; --hairline-strong:#e0e0e0;
--ink:#1d1d1f; --charcoal:#1d1d1f; --slate:#333333; --steel:#6e6e73;
--stone:#6e6e73; --muted:#86868b;
--primary:#0066cc; --primary-pressed:#0071e3; --on-primary:#ffffff;
--primary-wash:#e8f1fc;
--success:#1a7d3c; --warning:#b3560a; --error:#d0353a; --tag-indigo:#4b4de0;
/* --warning/--error at pill size (12px) on their own pastel tints land at
4.38:1 / 4.23:1 — just under the 4.5:1 floor WCAG AA requires for text
that small. Darkened variants for the pill only; the Activation column
keeps the original tokens since that text sits on the plain canvas,
where they already clear it (verified below). */
--tag-warning-on-tint:#9c4a09; --tag-error-on-tint:#b82e33;
--tint-lavender:#eef0fc; --tint-sky:#e8f1fc; --tint-mint:#e6f6ea;
--tint-peach:#fdefe2; --tint-rose:#fbe9ef; --tint-gray:#f5f5f7;
--on-tint:#1d1d1f;
--code-bg:#f5f5f7; --code-ink:#1d1d1f;
--scrim:rgba(0,0,0,.4);
/* Apple reserves its one shadow for product imagery, tinted rather than
pure black, tight rather than large-blur-ambient (de-slop checklist:
default-only, never a loose glow). Used sparingly below on the detail
drawer only, where elevation is a real signal, not decoration. */
--shadow-panel:0 8px 28px rgba(0,0,0,.12), 0 2px 8px rgba(0,0,0,.06);
--shadow-pop:0 2px 6px rgba(0,0,0,.08);
--r-sm:8px; --r-md:11px; --r-lg:18px; --r-full:9999px;
--sans:-apple-system,BlinkMacSystemFont,"SF Pro Text","Segoe UI",Roboto,system-ui,sans-serif;
--sans-display:-apple-system,BlinkMacSystemFont,"SF Pro Display","Segoe UI",Roboto,system-ui,sans-serif;
--mono:ui-monospace,"SF Mono",Menlo,monospace;
}
:root[data-theme="dark"]{
--canvas:#1d1d1f; --surface:#272729; --surface-soft:#2a2a2c; --raised:#2a2a2c;
--hairline:#38383a; --hairline-soft:#333335; --hairline-strong:#48484a;
--ink:#ffffff; --charcoal:#ffffff; --slate:#cccccc; --steel:#a1a1a6;
--stone:#a1a1a6; --muted:#8e8e93;
/* Action Blue "disappears against the tile background" on dark surfaces —
Apple's own documented fix is Sky Link Blue, not a darkened Action Blue. */
--primary:#2997ff; --primary-pressed:#5cb0ff; --on-primary:#ffffff;
--primary-wash:#122740;
--success:#4ad776; --warning:#f2a35c; --error:#ff6b6b; --tag-indigo:#9b96ff;
/* Already clear 4.5:1 on their tints at dark values (6.81:1 / 5.51:1) —
no separate darkening needed here, just the same tokens under the
pill-specific names so both themes define them. */
--tag-warning-on-tint:#f2a35c; --tag-error-on-tint:#ff6b6b;
--tint-lavender:#20263a; --tint-sky:#14243a; --tint-mint:#123322;
--tint-peach:#3a2814; --tint-rose:#3a1c26; --tint-gray:#2a2a2c;
--on-tint:#f2f2f4;
--code-bg:#161618; --code-ink:#e5e5e7;
--scrim:rgba(0,0,0,.6);
--shadow-panel:0 8px 32px rgba(0,0,0,.5), 0 2px 10px rgba(0,0,0,.35);
--shadow-pop:0 2px 6px rgba(0,0,0,.3);
}
*{box-sizing:border-box}
html,body{margin:0;min-height:100%}
/* html carries the real base fill. body stays transparent on top of it so
.bg-float (fixed, behind body's content) can show through — but .bg-float
itself fades to fully transparent at its own masked edges, and with
nothing opaque under that, the raw browser canvas (white) showed straight
through at the viewport corners in both themes. html's fill is what those
faded edges land on instead. */
html{background:var(--canvas)}
body{
background:transparent; color:var(--charcoal);
font:14px/1.5 var(--sans); -webkit-font-smoothing:antialiased;
}
.mono{font-family:var(--mono);font-size:12.5px}
.vh{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;
clip:rect(0 0 0 0);white-space:nowrap;border:0}
:focus-visible{outline:2px solid var(--primary);outline-offset:2px;border-radius:3px}
:focus:not(:focus-visible){outline:none}
/* ── chrome ─────────────────────────────────────────────────────────────── */
header{
position:sticky;top:0;z-index:20;
/* Translucent + blurred: the header is the one surface that still
blurs what's behind it (a small, static area, so it stays cheap) —
the table below is a plain low-opacity tint now, same treatment as
this bar minus the blur, so the two don't read as different surfaces. */
background:color-mix(in srgb, var(--canvas) 80%, transparent);
backdrop-filter:blur(20px) saturate(160%);-webkit-backdrop-filter:blur(20px) saturate(160%);
border-bottom:1px solid var(--hairline);padding:18px 24px 0;
}
.top{display:flex;align-items:flex-start;gap:14px;flex-wrap:wrap}
.brand-block{display:flex;flex-direction:column;gap:3px;min-height:44px;justify-content:center}
.brand-line{display:flex;align-items:baseline;gap:10px;flex-wrap:wrap}
/* Two-tone wordmark: the single accent that already carries every button and
link in this system also carries half the brand name, rather than adding
a new colour, a shadow, or an icon just to make the name look considered. */
.brand{font-size:23px;font-weight:700;letter-spacing:-.4px;margin:0;color:var(--ink)}
.brand .accent{color:var(--primary)}
.tagline{font-size:13px;color:var(--stone);margin:0;max-width:48ch}
.count{color:var(--stone);font-size:13px}
.spacer{flex:1}
/* Shape grammar (Apple, "shape consistency lock"): pill for anything that
acts — buttons, search, select, pills; r-lg for boxed content; r-sm for
compact inline code. No radius in between. */
button{
font:500 14px/1.3 var(--sans);color:var(--charcoal);background:transparent;
border:1px solid var(--hairline-strong);border-radius:var(--r-full);
padding:10px 18px;cursor:pointer;min-height:44px;
transition:background .12s ease,border-color .12s ease,transform .1s ease;
}
button:active:not(:disabled){transform:scale(.95)}
button:hover:not(:disabled){background:var(--surface)}
button:disabled{color:var(--muted);border-color:var(--hairline);cursor:default}
button.primary{
background:var(--primary);color:var(--on-primary);border-color:var(--primary);
}
button.primary:hover:not(:disabled){background:var(--primary-pressed);border-color:var(--primary-pressed)}
button.primary:disabled{background:var(--hairline);border-color:var(--hairline);color:var(--muted)}
.icon-btn{padding:10px;min-width:44px;display:grid;place-items:center}
svg{display:block;fill:none;stroke:currentColor;stroke-width:1.75;
stroke-linecap:round;stroke-linejoin:round}
/* ── floating background ───────────────────────────────────────────────────
A low-opacity backdrop pinned behind the whole page, not a separate
section you scroll past — a daily-use tool earns its keep by getting out
of the way, so the table stays the first thing you can act on. The table
itself is frosted glass (below), not opaque, specifically so this is
visible under every row at any viewport width, not just in a side margin
that may not exist. */
.bg-float{
position:fixed;inset:-8% -8%;z-index:-1;pointer-events:none;
background:#101012 url("assets/bg-float.jpg") center 38% / cover no-repeat;
opacity:.4;
/* Broad, not a tight pool: this layer is fixed to the viewport, so a small
pool anchored near the top would only ever be visible near the top of
the screen, no matter how far you scroll. The mask's only job is a soft
vignette so cover-cropping can never land a hard edge right at the
screen edge — everywhere inside that stays fully visible. */
-webkit-mask-image:radial-gradient(ellipse 96% 94% at 50% 46%, #000 0%, #000 78%, transparent 100%);
mask-image:radial-gradient(ellipse 96% 94% at 50% 46%, #000 0%, #000 78%, transparent 100%);
}
/* Light needs more than dark gets, not just a bump for parity: the map's
own colors are pale (cream, tan, sky blue), so against a near-white
canvas there's barely any luminance contrast even at equal opacity —
the same percentage reads as much fainter than it does over near-black.
Extra saturation compensates with color contrast where luminance can't. */
:root[data-theme="light"] .bg-float{opacity:.72;filter:saturate(1.5) contrast(1.05)}
/* Real parallax, not a fade: the layer is already pinned to the viewport
(position:fixed keeps it still while the document scrolls beneath it) —
that stillness is the classic depth trick on its own. This adds a slow
counter-drift and a gentle zoom on top of it, so it reads as receding
rather than pasted flat behind the glass. */
@supports (animation-timeline: scroll()) {
@media (prefers-reduced-motion: no-preference) {
.bg-float{animation:bg-drift linear both;animation-timeline:scroll(root);animation-range:0 100%}
@keyframes bg-drift{
from{transform:translateY(0) scale(1)}
to{transform:translateY(-20vh) scale(1.09)}
}
}
}
.views{display:flex;gap:4px;margin-top:14px;flex-wrap:wrap}
.views button{
background:none;border:none;border-bottom:2px solid transparent;border-radius:0;
color:var(--steel);padding:8px 12px;min-height:44px;font-weight:500;
}
.views button[aria-selected="true"]{color:var(--ink);border-bottom-color:var(--primary)}
.views button:hover{color:var(--ink);background:transparent}
.views .n{color:var(--stone);font-size:12px;margin-left:6px;font-variant-numeric:tabular-nums}
.filters{display:flex;gap:8px;padding:12px 0 14px;flex-wrap:wrap;align-items:center}
input[type=search],select{
font:14px var(--sans);color:var(--charcoal);background:var(--canvas);
border:1px solid var(--hairline-strong);border-radius:var(--r-full);
padding:9px 18px;min-height:44px;
}
input[type=search]{min-width:260px;flex:0 1 320px}
input[type=search]::placeholder{color:var(--steel);opacity:1}
/* The native dropdown arrow sits flush against the pill's own edge with no
breathing room — replaced with a drawn chevron that gets real clearance
instead of crowding the border. */
select{
cursor:pointer;appearance:none;-webkit-appearance:none;-moz-appearance:none;
padding-right:40px;background-repeat:no-repeat;background-position:right 16px center;
background-size:11px;
background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4' fill='none' stroke='%236e6e73' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
:root[data-theme="dark"] select{
background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4' fill='none' stroke='%23a1a1a6' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
:is(input,select).active{border-color:var(--primary);background-color:var(--primary-wash)}
#clear{display:none}
#clear.show{display:inline-flex;align-items:center;gap:6px}
/* ── table ──────────────────────────────────────────────────────────────── */
/* No horizontal padding here on purpose: main has no background of its own,
so any padding here is a gap where nothing painted over .bg-float — the
raw image showed through clean and unfiltered right beside the table's
own dimmed tint, two different textures on one page. The table paints
edge to edge instead (below); the first/last cell rules restore the
reading inset so text still isn't flush against the browser edge. */
main{padding:0 0 64px}
/* No overflow container at desktop: an overflow ancestor creates its own scroll
context, which silently breaks the sticky header row below. The horizontal
scroller is only needed where the table actually outgrows the viewport, so it
is switched on at the narrow breakpoint instead. */
.tablewrap{overscroll-behavior-x:contain}
/* A plain dark tint, not a solid fill: an opaque table only ever let the
floating art show in whatever margin happened to sit beside it, and now
that the table paints edge to edge (above), there is no margin left for
that art to hide in either way — it's visible under every row, full
width. No blur on purpose: blurring only the table made the art crisp at
the page edges and muddy under the rows, two textures on one page.
Legibility comes from the tint's own opacity, not from smearing the art
into mush. */
table{
width:100%;border-collapse:collapse;
background:color-mix(in srgb, var(--canvas) 82%, transparent);
}
thead th{
/* --head-h is measured from the real header, so this never drifts when the
filter row wraps to two lines. */
position:sticky;top:var(--head-h,0px);z-index:10;text-align:left;
background:color-mix(in srgb, var(--canvas) 92%, transparent);
font-size:12px;font-weight:600;letter-spacing:.4px;text-transform:uppercase;
color:var(--steel);border-bottom:1px solid var(--hairline-strong);
white-space:nowrap;padding:0;
}
thead th button{
width:100%;border:none;border-radius:0;background:none;font:inherit;
color:inherit;text-transform:inherit;letter-spacing:inherit;
padding:10px 12px;min-height:40px;display:flex;align-items:center;gap:6px;
}
thead th button:hover{background:var(--surface);color:var(--ink)}
thead th svg{width:12px;height:12px;opacity:.85}
/* main lost its own side padding above so the table's tint paints edge to
edge; this puts that inset back, but only on the outer cells, so it
reads as margin rather than a gap the background shows through. */
thead th:first-child button{padding-left:24px}
thead th:last-child button{padding-right:24px}
td:first-child{padding-left:24px}
td:last-child{padding-right:24px}
tbody tr{border-bottom:1px solid var(--hairline-soft);cursor:pointer}
tbody tr:hover{background:var(--surface-soft)}
tbody tr:focus-visible{outline:2px solid var(--primary);outline-offset:-2px}
td{padding:12px;vertical-align:top}
td.name{white-space:nowrap;font-weight:500;color:var(--ink)}
td.name .sub{display:block;font-weight:400;color:var(--stone);font-size:12px;margin-top:2px}
td.plain{color:var(--slate);max-width:420px;min-width:240px}
td.plain span{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;
overflow:hidden}
td.plain .raw{color:var(--steel)}
.pill{
display:inline-block;padding:3px 9px;border-radius:var(--r-full);font-size:12px;
font-weight:500;background:var(--tint-gray);color:var(--on-tint);white-space:nowrap;
}
/* Keyed on a data attribute, not a class: mechanism names contain dots
("skills.sh"), and a dot in a class attribute starts a second class.
Colored text on the tint, not neutral ink — the same move the Activation
column already uses for "needs starting", so the tag actually pops
instead of reading as another shade of the same grey against a page
that's no longer a flat opaque surface behind it. */
.pill[data-m="marketplace"]{background:var(--tint-lavender);color:var(--tag-indigo)}
.pill[data-m="skills.sh"]{background:var(--tint-sky);color:var(--primary)}
.pill[data-m="local"]{background:var(--tint-mint);color:var(--success)}
.pill[data-m="unknown"]{background:var(--tint-peach);color:var(--tag-warning-on-tint)}
.pill[data-m="mcp"]{background:var(--tint-rose);color:var(--tag-error-on-tint)}
.state{font-size:13px;white-space:nowrap;display:inline-flex;align-items:center;gap:6px}
.dot{width:6px;height:6px;border-radius:50%;background:currentColor;flex:none}
.s-rest{color:var(--stone)}
.s-act{color:var(--warning);font-weight:500}
.s-ok{color:var(--success)}
.chev{color:var(--stone)}
tbody tr:hover .chev{color:var(--primary)}
.chev svg{width:16px;height:16px}
/* Skeleton rows mirror the real row shape (name + sub, pill, two-line blurb,
author, activation, update) rather than a spinner, so the layout doesn't
jump once real data lands. */
.skel td{padding:16px 12px}
.skel-bar{
display:block;height:13px;border-radius:4px;background:var(--hairline-soft);
position:relative;overflow:hidden;
}
/* transform-only sweep (compositor, not paint) instead of an animated
background-position, which repaints every frame */
.skel-bar::after{
content:"";position:absolute;inset:0;transform:translateX(-100%);
background:linear-gradient(90deg,transparent,var(--hairline-strong),transparent);
animation:skel-shimmer 1.6s ease-in-out infinite;
}
@media (prefers-reduced-motion:reduce){.skel-bar::after{animation:none}}
@keyframes skel-shimmer{to{transform:translateX(100%)}}
.empty{padding:80px 24px;text-align:center;color:var(--stone)}
.empty b{display:block;color:var(--ink);font-size:16px;margin-bottom:6px;font-weight:600}
/* ── detail panel ───────────────────────────────────────────────────────── */
.scrim{position:fixed;inset:0;background:var(--scrim);z-index:30;opacity:0;
pointer-events:none;transition:opacity .18s ease}
.scrim.on{opacity:1;pointer-events:auto}
aside{
position:fixed;top:0;right:0;bottom:0;width:min(700px,96vw);z-index:31;
background:var(--canvas);border-left:1px solid var(--hairline);
box-shadow:var(--shadow-panel);
transform:translateX(100%);transition:transform .26s cubic-bezier(.16,1,.3,1);
overflow-y:auto;padding:24px 28px 72px;
}
aside.on{transform:none}
aside h2{margin:0 0 4px;font-size:22px;font-weight:600;letter-spacing:-.3px;color:var(--ink)}
aside .by{color:var(--stone);font-size:13px;margin-bottom:20px}
aside .x{position:absolute;top:18px;right:22px}
.blurb{
background:var(--surface);border:1px solid var(--hairline);
border-radius:var(--r-lg);padding:14px 16px;margin:0;color:var(--charcoal);
font-size:15px;line-height:1.55;
}
.blurb.rawnote{color:var(--slate)}
.fields{display:grid;grid-template-columns:minmax(96px,132px) 1fr;gap:9px 18px;
margin:20px 0 26px;font-size:14px}
.fields dt{color:var(--stone)}
.fields dd{margin:0;word-break:break-word;color:var(--charcoal)}
h3{font-size:12px;text-transform:uppercase;letter-spacing:.5px;color:var(--steel);
margin:28px 0 10px;font-weight:600}
ol.subs{margin:0;padding:0;list-style:none}
ol.subs li{
background:var(--surface-soft);border:1px solid var(--hairline);
border-radius:var(--r-lg);padding:10px 14px 10px 42px;margin-bottom:6px;position:relative;
}
ol.subs li::before{
content:attr(data-n);position:absolute;left:14px;top:10px;color:var(--stone);
font-size:12px;font-family:var(--mono);
}
ol.subs .inv{color:var(--primary);font-weight:600}
ol.subs .does{display:block;color:var(--slate);font-size:13px;margin-top:3px}
.kindhead{color:var(--steel);font-size:11px;text-transform:uppercase;
letter-spacing:.5px;margin:16px 0 7px;font-weight:600}
/* Pack catalog — what the source repo ships beyond what you took. Uninstalled
entries stay legible rather than being dimmed into unreadability: they are
the reason this section exists. */
ul.pack{margin:0;padding:0;list-style:none}
ul.pack li{
display:grid;grid-template-columns:1fr auto;gap:2px 12px;align-items:baseline;
padding:10px 0;border-bottom:1px solid var(--hairline-soft);
}
ul.pack li:last-child{border-bottom:none}
/* Every cell is placed explicitly. An item with only a definite row gets
placed before the auto-flow items and steals column 1. */
ul.pack .nm{grid-area:1/1;font-weight:500;color:var(--ink)}
ul.pack .badge{
grid-area:1/2;font-size:11px;font-weight:600;letter-spacing:.3px;text-transform:uppercase;
color:var(--success);white-space:nowrap;
}
ul.pack .d{
grid-area:2/1/3/3;color:var(--slate);font-size:13px;
display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;
}
ul.pack li.off .nm{color:var(--stone)}
ul.pack li.off .d{color:var(--steel)}
ul.pack li.off .badge{color:var(--stone);font-weight:500;text-transform:none;letter-spacing:0}
ul.pack .pack-cmd{grid-area:3/1/4/3;margin-top:6px;font-size:11.5px}
ul.pack li.installing .pack-cmd{opacity:.5}
/* min-height holds the 44px tap-target floor from the base button rule even
though the visual box is compact — confirmed a real gap by direct
measurement (was 32px), not a stylistic choice to shrink. */
ul.pack .pack-install{grid-area:4/1/5/3;margin-top:6px;justify-self:start;
padding:6px 12px;min-height:44px;font-size:12.5px}
.packnote{color:var(--stone);font-size:13px;margin:0 0 10px}
.cmd{
display:block;background:var(--code-bg);border:1px solid var(--hairline);
border-radius:var(--r-sm);padding:10px 13px;margin:6px 0;color:var(--code-ink);
font-family:var(--mono);font-size:12.5px;overflow-x:auto;white-space:pre;
}
.note{color:var(--stone);font-size:13px;margin:8px 0 0}
#mynote{
width:100%;min-height:70px;resize:vertical;font:14px/1.5 var(--sans);
color:var(--charcoal);background:var(--surface);border:1px solid var(--hairline-strong);
border-radius:var(--r-lg);padding:10px 14px;
}
#mynote:focus-visible{outline:2px solid var(--primary);outline-offset:1px}
.hasnote{color:var(--primary);margin-left:4px}
.actions{
display:flex;align-items:center;justify-content:space-between;gap:16px;flex-wrap:wrap;
background:var(--surface);border:1px solid var(--hairline);border-radius:var(--r-lg);
padding:14px 16px;margin:0 0 18px;
}
.actions .state-line{font-size:14px;font-weight:500}
.actions.readonly{color:var(--slate);font-size:13px;display:block}
.actions.readonly code{
font-family:var(--mono);font-size:12px;background:var(--code-bg);
border:1px solid var(--hairline);border-radius:4px;padding:1px 5px;
}
#uplog{margin:-8px 0 20px}
.ok-line{color:var(--success);font-weight:500;margin:10px 0 0}
.err-line{color:var(--error);font-weight:500;margin:10px 0 0}
#uplog .cmd{max-height:220px;overflow:auto;white-space:pre-wrap;font-size:12px}
a{color:var(--primary)}
.footnote{margin:14px 24px 0;font-size:12.5px;color:var(--stone);max-width:78ch}
.col-used{white-space:nowrap}
.col-used .n{font-variant-numeric:tabular-nums;font-weight:500;color:var(--ink)}
.col-used .ago{color:var(--stone);font-size:12px;margin-left:6px}
/* ── responsive ─────────────────────────────────────────────────────────── */
@media (max-width:900px){
header{padding:14px 16px 0} main{padding:0 0 64px}
thead th:first-child button,td:first-child{padding-left:16px}
thead th:last-child button,td:last-child{padding-right:16px}
thead th{top:auto;position:static}
.tablewrap{overflow-x:auto}
.col-author,.col-act,.col-used{display:none}
input[type=search]{flex:1 1 100%}
}
@media (max-width:600px){
.col-source{display:none}
table{min-width:480px}
aside{padding:20px 18px 64px}
.fields{grid-template-columns:1fr;gap:2px 0}
.fields dt{margin-top:10px}
}
@media (prefers-reduced-motion:reduce){
aside{transition:transform .01ms} .scrim{transition:opacity .01ms}
}
</style>
</head>
<body>
<div class="bg-float" aria-hidden="true"></div>
<header>
<div class="top">
<div class="brand-block">
<div class="brand-line">
<h1 class="brand">Skill<span class="accent">view</span></h1>
<span class="count" id="count" aria-live="polite"></span>
</div>
<p class="tagline">Every skill, plugin, and MCP server installed on this machine, in one table.</p>
</div>
<span class="spacer"></span>
<button id="theme" class="icon-btn" aria-label="Switch to dark theme"></button>
<button id="describe">Generate descriptions</button>
<button id="refresh" class="primary">Check for updates</button>
</div>
<nav class="views" id="views" role="tablist" aria-label="Saved views"></nav>
<div class="filters">
<label class="vh" for="q">Search skills</label>
<input type="search" id="q" placeholder="Search name, author, description…">
<label class="vh" for="fmech">Filter by source</label>
<select id="fmech"><option value="">Any source</option></select>
<label class="vh" for="fact">Filter by activation</label>
<select id="fact"><option value="">Any activation</option></select>
<label class="vh" for="fauthor">Filter by author</label>
<select id="fauthor"><option value="">Any author</option></select>
<button id="clear">Clear filters</button>
</div>
</header>
<main>
<div class="tablewrap">
<table><thead><tr id="head"></tr></thead><tbody id="rows" aria-busy="true">
<!-- Skeleton rows, replaced by real data as soon as /api/items answers. -->
</tbody></table>
</div>
<div class="empty" id="empty" hidden></div>
<p class="footnote" id="usagenote" hidden></p>
</main>
<div class="scrim" id="scrim"></div>
<aside id="panel" role="dialog" aria-modal="true" aria-labelledby="dtitle" aria-hidden="true">
<button class="x" id="close">Close</button><div id="detail"></div>
</aside>
<script>
const ICON = {
sortAsc:'<svg viewBox="0 0 16 16"><path d="M8 12V4M4.5 7.5 8 4l3.5 3.5"/></svg>',
sortDesc:'<svg viewBox="0 0 16 16"><path d="M8 4v8M4.5 8.5 8 12l3.5-3.5"/></svg>',
chev:'<svg viewBox="0 0 16 16"><path d="m6 3.5 5 4.5-5 4.5"/></svg>',
sun:'<svg viewBox="0 0 20 20" width="18" height="18"><circle cx="10" cy="10" r="3.6"/><path d="M10 1.5v2M10 16.5v2M3.5 10h-2M18.5 10h-2M5.4 5.4 4 4M16 16l-1.4-1.4M14.6 5.4 16 4M4 16l1.4-1.4"/></svg>',
moon:'<svg viewBox="0 0 20 20" width="18" height="18"><path d="M16.5 11.8A7 7 0 0 1 8.2 3.5a7 7 0 1 0 8.3 8.3Z"/></svg>',
};
const COLS = [
["name","Name",""],["mechanism","Source","col-source"],
["plain","What it does for you",""],["author","Author","col-author"],
["activation","Activation","col-act"],["usage","Used","col-used"],
["update","Update",""],
];
const VIEWS = {
"Everything": () => true,
"Plugins": r => r.mechanism === "marketplace",
"Yours": r => r.is_local,
"Needs setup": r => r.activation === "needs starting",
"Never used": r => !r.usage,
"Update available": r => r.update === "update available",
};
let ITEMS = [], VIEW = "Everything", SORT = {key:"name", dir:1}, CLI = true,
UPDATES = false, NOTES = {}, USAGE = {}, LAST_FOCUS = null, CURRENT_PACK_ROW = null;
const $ = s => document.querySelector(s);
const esc = s => String(s ?? "").replace(/[&<>"]/g, c => ({"&":"&","<":"<",">":">",'"':"""}[c]));
/* ── theme ─────────────────────────────────────────────────────────────── */
function setTheme(t) {
document.documentElement.dataset.theme = t;
const dark = t === "dark";
$("#theme").innerHTML = dark ? ICON.sun : ICON.moon;
$("#theme").setAttribute("aria-label", dark ? "Switch to light theme" : "Switch to dark theme");
try { localStorage.setItem("skillview-theme", t); } catch (e) {}
}
setTheme(( () => {
try { return localStorage.getItem("skillview-theme"); } catch (e) { return null; }
})() || (matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light"));
$("#theme").onclick = () => setTheme(document.documentElement.dataset.theme === "dark" ? "light" : "dark");
/* ── data ──────────────────────────────────────────────────────────────── */
async function load(url = "/api/items") {
const btn = $("#refresh"), was = btn.textContent;
if (url.includes("refresh")) { btn.disabled = true; btn.textContent = "Checking…"; }
try {
const d = await (await fetch(url)).json();
ITEMS = d.items || []; CLI = d.cli; UPDATES = !!d.updates; USAGE = d.usage || {};
// Independent of the inventory fetch — notes are user state, not a
// property of the row, so they're joined here rather than server-side.
try { NOTES = (await (await fetch("/api/notes")).json()).notes || {}; }
catch (e) { /* the table still works without notes */ }
} catch (e) {
ITEMS = []; $("#empty").innerHTML = "<b>Can't reach the local server</b>Is app.py still running?";
}
btn.disabled = false; btn.textContent = was;
$("#describe").disabled = !CLI;
$("#describe").title = CLI ? "" : "The claude CLI is not on PATH";
buildFilters(); render();
$("#rows").removeAttribute("aria-busy");
}
function buildFilters() {
const fill = (sel, vals, label) => {
const cur = sel.value;
sel.innerHTML = `<option value="">${label}</option>` + [...new Set(vals)].filter(Boolean).sort()
.map(v => `<option${v === cur ? " selected" : ""}>${esc(v)}</option>`).join("");
};
fill($("#fmech"), ITEMS.map(r => r.mechanism), "Any source");
fill($("#fact"), ITEMS.map(r => r.activation), "Any activation");
fill($("#fauthor"), ITEMS.map(r => r.author), "Any author");
}
function visible() {
const q = $("#q").value.trim().toLowerCase();
const mech = $("#fmech").value, act = $("#fact").value, au = $("#fauthor").value;
return ITEMS.filter(VIEWS[VIEW]).filter(r =>
(!mech || r.mechanism === mech) && (!act || r.activation === act) && (!au || r.author === au) &&
(!q || [r.name, r.author, r.plain, r.description, r.source_repo].join(" ").toLowerCase().includes(q))
).sort((a, b) => {
const k = SORT.key;
// Usage is an object, and sorting it as text would order every row by the
// string "[object Object]". Sort on the count, never-used last either way.
if (k === "usage") {
const n = r => r.usage ? r.usage.count : -1;
return (n(b) - n(a)) * SORT.dir;
}
const x = (a[k] ?? "").toString().toLowerCase(), y = (b[k] ?? "").toString().toLowerCase();
return x < y ? -SORT.dir : x > y ? SORT.dir : 0;
});
}
/* ── render ────────────────────────────────────────────────────────────── */
function renderSkeleton() {
const widths = [70, 55, 90, 60, 50, 35, 40];
$("#rows").innerHTML = Array.from({ length: 7 }, () =>
`<tr class="skel"><td class="name"><span class="skel-bar" style="width:${widths[0]}%"></span></td>
<td><span class="skel-bar" style="width:${widths[1]}%"></span></td>
<td><span class="skel-bar" style="width:${widths[2]}%"></span></td>
<td><span class="skel-bar" style="width:${widths[3]}%"></span></td>
<td><span class="skel-bar" style="width:${widths[4]}%"></span></td>
<td><span class="skel-bar" style="width:${widths[5]}%"></span></td>
<td><span class="skel-bar" style="width:${widths[6]}%"></span></td>
<td></td></tr>`).join("");
}
function render() {
$("#views").innerHTML = Object.keys(VIEWS).map(v =>
`<button role="tab" aria-selected="${v === VIEW}" data-v="${esc(v)}">${esc(v)}
<span class="n">${ITEMS.filter(VIEWS[v]).length}</span></button>`).join("");
$("#head").innerHTML = COLS.map(([k, label, cls]) =>
`<th scope="col" class="${cls}" ${SORT.key === k ? `aria-sort="${SORT.dir > 0 ? "ascending" : "descending"}"` : ""}>
<button data-k="${k}">${label}${SORT.key === k ? (SORT.dir > 0 ? ICON.sortAsc : ICON.sortDesc) : ""}</button>
</th>`).join("") + '<th scope="col"><span class="vh">Details</span></th>';
const active = ["#q", "#fmech", "#fact", "#fauthor"].filter(s => $(s).value);
["#q", "#fmech", "#fact", "#fauthor"].forEach(s => $(s).classList.toggle("active", !!$(s).value));
$("#clear").classList.toggle("show", active.length > 0);
const rows = visible();
$("#count").textContent = rows.length === ITEMS.length
? `${ITEMS.length} installed` : `${rows.length} of ${ITEMS.length}`;
$("#empty").hidden = rows.length > 0;
if (!rows.length) $("#empty").innerHTML = ITEMS.length
? "<b>Nothing matches</b>Try clearing a filter."
: "<b>Nothing installed yet</b>No plugins, skills, or packs found on this machine.";
$("#rows").innerHTML = rows.map(r => {
const i = ITEMS.indexOf(r), ships = (r.subcommands || []).length;
return `<tr tabindex="0" data-i="${i}" aria-label="${esc(r.name)}, view details">
<td class="name">${esc(r.name)}${NOTES[r.name] ? '<span class="hasnote" title="Has a note">●</span>' : ""}${ships
? `<span class="sub">plugin · ships ${ships}</span>`
: r.version ? `<span class="sub mono">${esc(r.version)}</span>` : ""}</td>
<td class="col-source"><span class="pill" data-m="${esc(r.mechanism)}">${esc(r.mechanism)}</span></td>
<td class="plain"><span class="${r.plain_generated ? "" : "raw"}">${esc(r.plain || "—")}</span></td>
<td class="col-author">${esc(r.author || "—")}</td>
<td class="col-act"><span class="state ${r.activation === "auto" ? "s-rest" : "s-act"}">
${r.activation === "auto" ? "" : '<span class="dot"></span>'}${esc(r.activation)}</span></td>
<td class="col-used">${usedCell(r.usage)}</td>
<td><span class="state ${upClass(r.update)}">${esc(r.update || "—")}</span></td>
<td class="chev">${ICON.chev}</td>
</tr>`;
}).join("");
renderUsageNote();
}
/* Invocations, from Claude Code's own transcripts. A blank is "nothing
recorded", not proof of never — the record starts at your oldest transcript
still on disk, and Claude Code deletes old ones on a schedule — so the
dash gets a title saying so rather than reading as a hard zero. */
function usedCell(u) {
if (!u) return '<span class="s-rest" title="No invocation recorded in the retained transcripts">—</span>';
return `<span class="n">${u.count}×</span><span class="ago">${esc(ago(u.last_used))}</span>`;
}
function ago(day) {
const d = Math.floor((Date.now() - Date.parse(day + "T00:00:00Z")) / 864e5);
return !isFinite(d) ? "" : d <= 0 ? "today" : d === 1 ? "yesterday"
: d < 30 ? `${d}d ago` : d < 365 ? `${Math.floor(d / 30)}mo ago` : `${Math.floor(d / 365)}y ago`;
}
function renderUsageNote() {
const el = $("#usagenote"), gone = USAGE.unmatched || [];
const bits = [];
if (USAGE.collected) bits.push(`Usage counted from Claude Code transcripts, last collected ${esc(USAGE.collected)}.`);
else bits.push("No usage tally found — run <code>~/.claude/skill-usage/collect.py</code> to build one.");
if (gone.length) bits.push(`${gone.length} recorded ${gone.length === 1 ? "skill isn't" : "skills aren't"} in this table — uninstalled since, or built into Claude Code rather than installed: ${gone.map(esc).join(", ")}.`);
el.innerHTML = bits.join(" ");
el.hidden = false;
}
const bytes = n => n >= 1e9 ? (n / 1e9).toFixed(1) + " GB"
: n >= 1e6 ? (n / 1e6).toFixed(1) + " MB"
: n >= 1e3 ? Math.round(n / 1e3) + " KB" : n + " B";
const upClass = u => u === "up to date" ? "s-ok"
: (u === "update available" || u === "update manually") ? "s-act" : "s-rest";
/* ── detail panel ──────────────────────────────────────────────────────── */
function openDetail(i) {
const r = ITEMS[i]; if (!r) return;
LAST_FOCUS = document.activeElement;
const f = [], add = (k, v) => v && f.push(`<dt>${k}</dt><dd>${v}</dd>`);
add("Kind", esc(r.kind));
add("Source", esc(r.mechanism));
add("Author", r.is_local ? "you — no upstream" : esc(r.author || "unknown"));
add("Version", r.version ? `<span class="mono">${esc(r.version)}</span>` : "");
add("Available in", esc((r.surfaces || []).join(", ")));
add("Activation", esc(r.activation));
add("Update", r.update ? esc(r.update) : "not checked yet");
add("On disk", r.size ? esc(bytes(r.size)) : "");
add("Installed", r.installed_at ? esc(r.installed_at.slice(0, 10)) : "");
add("Repository", r.source_url
? `<a href="${esc(r.source_url.replace(/\.git$/, ""))}" target="_blank" rel="noopener">${esc(r.source_repo || r.source_url)}</a>` : "");
add("Path", `<span class="mono">${esc(r.install_path || "—")}</span>`);
let html = `<h2 id="dtitle">${esc(r.name)}</h2>
<div class="by">${r.is_local ? "Written by you" : "by " + esc(r.author || "unknown")}</div>
${actionBar(r)}
<p class="blurb ${r.plain_generated ? "" : "rawnote"}">${esc(r.plain || "No description available.")}</p>
${r.plain_generated ? "" : '<p class="note">Raw description from the file. Use <b>Generate descriptions</b> for a plain-English one.</p>'}
<dl class="fields">${f.join("")}</dl>`;
if (r.needs_running?.length)
html += `<h3>Requires running</h3><p>${r.needs_running.map(esc).join(", ")} must be open before this works.</p>`;
if (r.prereqs?.length)
html += `<h3>Set up first</h3>` + r.prereqs.map(c => `<code class="cmd">${esc(c)}</code>`).join("");
if (r.update_command)
html += `<h3>The update command</h3><code class="cmd">${esc(r.update_command)}</code>
<p class="note">Run it yourself if you'd rather not use the button above.</p>`;
const subs = r.subcommands || [];
if (subs.length) {
html += `<h3>Ships ${subs.length} thing${subs.length > 1 ? "s" : ""}</h3>`;
let n = 0;
for (const kind of ["skill", "command", "agent", "hook", "mcp"]) {
const of = subs.filter(s => s.kind === kind);
if (!of.length) continue;
html += `<div class="kindhead">${kind}${of.length > 1 ? "s" : ""} (${of.length})</div><ol class="subs">` +
of.map(s => `<li data-n="${++n}"><span class="inv">${esc(s.invoke || s.name)}</span>
<span class="does">${esc(s.does || "No description provided.")}</span></li>`).join("") + "</ol>";
}
} else {
html += `<h3>Sub-commands</h3><p class="note">None — this is a single capability.</p>`;
}
if (r.readme?.endsWith(".md"))
html += `<p class="note">Full docs: <span class="mono">${esc(r.readme)}</span></p>`;
html += `<h3>Your notes</h3>
<label class="vh" for="mynote">Your notes on ${esc(r.name)}</label>
<textarea id="mynote" aria-describedby="notestatus"
placeholder="Why you're keeping this, or a reminder to remove it…"
data-name="${esc(r.name)}">${esc(NOTES[r.name] || "")}</textarea>
<p class="note" id="notestatus" aria-live="polite">Saves automatically when you click away.</p>`;
if (r.source_repo) html += `<div id="pack"></div>`;
$("#detail").innerHTML = html;
if (r.source_repo) loadPack(r);
$("#panel").classList.add("on"); $("#panel").setAttribute("aria-hidden", "false");
$("#scrim").classList.add("on");
$("#close").focus();
}
/* The primary action sits directly under the title. It was previously below the
description, the field list and the prerequisites, which is three scrolls past
the point of opening the panel. */
function actionBar(r) {
if (!r.update_command) return "";
if (!UPDATES) return `<div class="actions readonly">
<span>Running read-only — start with <code>--enable-updates</code> to update from here.</span></div>`;
const stale = r.update === "update available";
const unchecked = !r.update || r.update === "unknown";
const state = stale ? `<span class="s-act"><span class="dot"></span>Update available</span>`
: unchecked ? `<span class="s-rest">Not checked yet</span>`
: `<span class="s-ok">Up to date — nothing to download</span>`;
const label = stale ? "Run this update" : unchecked ? "Update anyway" : "Re-check and update";
return `<div class="actions">
<div class="state-line">${state}</div>
<button id="doupdate" class="${stale ? "primary" : ""}" data-name="${esc(r.name)}">${label}</button>
</div><div id="uplog" aria-live="polite"></div>`;
}
/* The pack this skill (or plugin) came from — fetched when the panel opens
rather than during refresh, because most packs are never looked at.
Two shapes share this one view: a skills.sh pack, keyed by a tree path
(source_path present, entries under d.skills), and a plugin marketplace,
keyed by repo alone (no source_path, entries under d.plugins — B2/Q9).
They install differently too, so the noun and the shown command both
follow r.mechanism rather than being hardcoded to one shape. */
async function loadPack(r) {
const box = $("#pack"); if (!box) return;
const isPlugin = r.mechanism === "marketplace";
const noun = isPlugin ? "plugin" : "skill";
box.innerHTML = `<h3>Also in this pack</h3><p class="packnote">Checking ${esc(r.source_repo)}…</p>`;
let d;
try {
const url = `/api/catalog?repo=${encodeURIComponent(r.source_repo)}`
+ (isPlugin ? "" : `&path=${encodeURIComponent(r.source_path)}`);
d = await (await fetch(url)).json();
} catch (e) { d = { error: "Could not reach the repository." }; }
if (!$("#pack")) return; // panel closed while fetching
const items = d.skills || d.plugins || [];
if (d.error || !items.length) {
box.innerHTML = `<h3>Also in this pack</h3><p class="packnote">${
esc(d.error || `Nothing else ships from this repository.`)}</p>`;
return;
}
const have = items.filter(s => s.installed).length, left = items.length - have;
const heading = left ? "Also in this pack" : "Everything in this pack";
const plural = items.length === 1 ? noun : noun + "s";
const summary = left === 0
? `You have all ${items.length} ${plural} ${esc(r.source_repo)} ships.`
: have === 0
? `${esc(r.source_repo)} ships ${items.length} ${plural}. None of the others are installed.`
: `${esc(r.source_repo)} ships ${items.length} ${plural} — you have ${have},
and ${left} ${left === 1 ? "is" : "are"} not installed.`;
// Skills.sh matches --skill against the frontmatter name, not the folder —
// Leonxlnx/taste-skill's "output-skill" folder declares itself
// "full-output-enforcement", confirmed live: the folder name 404s.
// Plugins have no such split — a marketplace's declared name is the id.
const install = isPlugin
? s => `claude plugin install ${s.name}@${r.marketplace}`
: s => `npx skills@latest add ${r.source_repo} --skill ${s.install_name || s.name} -g`;
box.innerHTML = `<h3>${heading}</h3><p class="packnote">${summary}</p>
<ul class="pack">` + items.map(s => `
<li class="${s.installed ? "" : "off"}" data-name="${esc(s.name)}">
<span class="nm">${esc(s.name)}</span>
<span class="badge">${s.installed ? "installed" : "not installed"}</span>
<span class="d">${esc(s.description || "No description upstream.")}</span>
${s.installed ? "" : `<code class="cmd pack-cmd">${esc(install(s))}</code>
${UPDATES ? `<button class="pack-install" data-kind="${isPlugin ? "plugin" : "skill"}"
data-repo="${esc(r.source_repo)}" data-name-inst="${esc(isPlugin ? s.name : (s.install_name || s.name))}"
data-marketplace="${esc(r.marketplace || "")}">Install</button>` : ""}`}
</li>`).join("") + `</ul>`;
CURRENT_PACK_ROW = r; // so a successful install can reload this same pack
}
function closeDetail() {
if (!$("#panel").classList.contains("on")) return;
$("#panel").classList.remove("on"); $("#panel").setAttribute("aria-hidden", "true");
$("#scrim").classList.remove("on");
LAST_FOCUS?.focus(); // return focus to the row that opened it
}
/* ── events ────────────────────────────────────────────────────────────── */
$("#views").onclick = e => { const b = e.target.closest("button"); if (b) { VIEW = b.dataset.v; render(); } };
$("#head").onclick = e => {
const k = e.target.closest("button")?.dataset.k; if (!k) return;
SORT = { key: k, dir: SORT.key === k ? -SORT.dir : 1 }; render();
};
$("#rows").onclick = e => { const tr = e.target.closest("tr"); if (tr) openDetail(+tr.dataset.i); };
$("#rows").onkeydown = e => {
if (e.key !== "Enter" && e.key !== " ") return;
const tr = e.target.closest("tr"); if (!tr) return;
e.preventDefault(); openDetail(+tr.dataset.i);
};
["#q", "#fmech", "#fact", "#fauthor"].forEach(s => $(s).oninput = render);
$("#clear").onclick = () => {
["#q", "#fmech", "#fact", "#fauthor"].forEach(s => $(s).value = "");
render(); $("#q").focus();
};
$("#detail").addEventListener("blur", async e => {
const t = e.target.closest("#mynote"); if (!t) return;
const name = t.dataset.name, was = NOTES[name] || "";
if (t.value === was) return; // nothing changed, no request
const status = $("#notestatus");
status.textContent = "Saving…";
try {
const d = await (await fetch("/api/notes", {
method: "POST", headers: { "Content-Type": "application/json" },
body: JSON.stringify({ name, text: t.value }),
})).json();
NOTES = d.notes || NOTES;
status.textContent = "Saved.";
} catch (err) {
status.textContent = "Could not save — check the server is still running.";
}
}, true); // capture: textarea blur does not bubble
$("#detail").onclick = async e => {
const inst = e.target.closest(".pack-install");
if (inst) return doInstall(inst);
const b = e.target.closest("#doupdate"); if (!b) return;
const log = $("#uplog"), label = b.textContent;
b.disabled = true; b.textContent = "Running…";
log.innerHTML = `<p class="note">This can take a minute.</p>`;
let d;
try {
d = await (await fetch("/api/update", {
method: "POST", headers: { "Content-Type": "application/json" },
body: JSON.stringify({ name: b.dataset.name }),
})).json();
} catch (err) { d = { ok: false, error: "The request failed." }; }
b.disabled = false; b.textContent = label;
log.innerHTML =
(d.ok ? `<p class="ok-line">Updated.</p>` : `<p class="err-line">${esc(d.error)}</p>`) +
(d.restart_required
? `<p class="note"><b>Restart Claude Code</b> for this to take effect —
the files changed on disk, but the running session still has the old copy.</p>` : "") +
(d.log ? `<code class="cmd">${esc(d.log)}</code>` : "");
if (d.ok) load("/api/refresh");
};
async function doInstall(b) {
const li = b.closest("li");
const kind = b.dataset.kind, repo = b.dataset.repo,
name = b.dataset.nameInst, marketplace = b.dataset.marketplace;
li.classList.add("installing"); b.disabled = true; b.textContent = "Installing…";
let d;
try {
d = await (await fetch("/api/install", {
method: "POST", headers: { "Content-Type": "application/json" },
body: JSON.stringify({ kind, repo, name, marketplace }),
})).json();
} catch (err) { d = { ok: false, error: "The request failed." }; }
if (d.ok) {
// Re-fetch the whole pack rather than patch one row — the source of
// truth for "installed" is the live inventory, and a fresh fetch is
// simpler than reconstructing that state on the client.
if (CURRENT_PACK_ROW) loadPack(CURRENT_PACK_ROW);
load(); // the main table's own "installed" count and rows follow too
} else {
li.classList.remove("installing"); b.disabled = false; b.textContent = "Install";
alert(d.error || "Install failed.");
}
}
$("#scrim").onclick = closeDetail;
$("#close").onclick = closeDetail;
// Must not return a value: a DOM0 handler returning false calls preventDefault(),
// which silently swallows every keystroke on the page.
document.onkeydown = e => {
if (e.key === "Escape") { closeDetail(); return; }
if (e.key !== "Tab" || !$("#panel").classList.contains("on")) return;
const f = $("#panel").querySelectorAll('button,a[href],input,select,[tabindex]:not([tabindex="-1"])');
if (!f.length) return;
const first = f[0], last = f[f.length - 1];
if (e.shiftKey && document.activeElement === first) { e.preventDefault(); last.focus(); }
else if (!e.shiftKey && document.activeElement === last) { e.preventDefault(); first.focus(); }
};
// Keep the sticky table header parked directly under the real page header,
// which changes height whenever the filter row wraps.
const syncHead = () => document.documentElement.style.setProperty(
"--head-h", $("header").getBoundingClientRect().height + "px");
addEventListener("resize", syncHead);
new ResizeObserver(syncHead).observe($("header"));
$("#refresh").onclick = () => load("/api/refresh");
$("#describe").onclick = async () => {
const b = $("#describe"); b.disabled = true; b.textContent = "Writing…";
const r = await fetch("/api/describe", { method: "POST" }).then(x => x.json()).catch(() => ({ error: "Request failed." }));
b.textContent = "Generate descriptions"; b.disabled = false;
if (r.error) alert(r.error);
load();
};
renderSkeleton();
load();
</script>
</body>
</html>