rvlib-shipkit 2.20.0 → 2.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/package.json +1 -1
- package/src/checks/SK004-gitignore-policy.check.ts +6 -3
- package/src/cli/cmd_GlobalProcesses.ts +2 -107
- package/src/cli/cmd_Home.ts +1 -1
- package/src/cli/cmd_Overview.ts +2 -1
- package/src/cli/cmd_Releases.ts +39 -3
- package/src/cli/cmd_Review.ts +22 -13
- package/src/cli/cmd_Social.ts +13 -7
- package/src/cli/cmd_Sound.ts +17 -4
- package/src/cli/cmd_Trailer.ts +67 -1
- package/src/cli/registry.ts +2 -1
- package/src/collections/collection-types.ts +1 -1
- package/src/collections/review.ts +23 -4
- package/src/core/layout.ts +6 -0
- package/src/home/gui-app/ShipkitGui.swift +35 -0
- package/src/home/gui-app.ts +1 -0
- package/src/home/pm-switch.ts +112 -0
- package/src/identities/identities.ts +11 -6
- package/src/messages/brief.ts +3 -3
- package/src/messages/score.ts +2 -0
- package/src/releases/add.ts +33 -5
- package/src/releases/before.ts +31 -0
- package/src/releases/from-card.ts +104 -19
- package/src/releases/model.ts +73 -13
- package/src/releases/pictures.ts +29 -8
- package/src/review/http.ts +1 -1
- package/src/review/model.ts +12 -2
- package/src/review/stage-card.ts +1 -1
- package/src/review/store.ts +12 -2
- package/src/review/trailer-desk.ts +19 -0
- package/src/review/trailer-model.ts +65 -0
- package/src/review/trailer-routes.ts +98 -1
- package/src/review/trailer-voices.ts +144 -0
- package/src/review/watchers.ts +58 -1
- package/src/serve/hub-app/benign-errors.ts +22 -0
- package/src/serve/hub-app/hash-route.ts +27 -15
- package/src/serve/hub-app/home-st.ts +8 -0
- package/src/serve/hub-app/hub-app.tsx +2 -0
- package/src/serve/hub-app/project-list.css +7 -2
- package/src/serve/hub-app/project-list.tsx +9 -0
- package/src/serve/hub-app/projects-svc.ts +16 -6
- package/src/serve/hub-app/releases/releases-page.tsx +121 -28
- package/src/serve/hub-app/releases/releases-st.ts +46 -4
- package/src/serve/hub-app/releases.css +30 -3
- package/src/serve/hub-app/repo-sections.ts +1 -1
- package/src/serve/hub-app/repo-st.ts +15 -10
- package/src/serve/hub-app/review/clip-st.ts +3 -1
- package/src/serve/hub-app/review/kit.tsx +3 -3
- package/src/serve/hub-app/review/trailer-page.tsx +31 -6
- package/src/serve/hub-app/review/trailer-st.ts +168 -8
- package/src/serve/hub-app/review/trailer-timeline.tsx +36 -4
- package/src/serve/hub-app/review/trailer-voices-st.ts +370 -0
- package/src/serve/hub-app/review/trailer-voices.tsx +574 -0
- package/src/serve/hub-app/review.css +88 -0
- package/src/serve/hub-app/social/comms-page.tsx +10 -5
- package/src/serve/hub-app/social/next-release.tsx +118 -0
- package/src/serve/hub-app/social/social-model.ts +2 -0
- package/src/serve/hub-app/social/social-st.ts +38 -1
- package/src/serve/hub-app/social.css +8 -0
- package/src/serve/hub-app/tree-build.ts +2 -0
- package/src/serve/project-gutter-route.ts +8 -0
- package/src/serve/project-gutter.ts +4 -2
- package/src/shot/box.ts +33 -12
- package/src/shot/client.ts +1 -1
- package/src/shot/shooter.ts +19 -9
- package/src/social/desk-index.ts +49 -8
- package/src/social/discord-layout.ts +6 -2
- package/src/social/drafts.ts +1 -1
- package/src/social/kinds.ts +3 -2
- package/src/social/load.ts +26 -7
- package/src/social/publish/index.ts +24 -9
- package/src/social/release-stage.ts +133 -29
- package/src/social/routes.ts +2 -1
- package/src/social/stage.ts +39 -20
- package/src/trailer/bed.ts +111 -0
- package/src/trailer/build.ts +57 -38
- package/src/trailer/ffmpeg.ts +6 -0
- package/src/trailer/grammar.ts +23 -2
- package/src/trailer/graph.ts +12 -1
- package/src/trailer/shot-plan.ts +75 -0
- package/src/trailer/shot-state.ts +191 -0
- package/src/trailer/sound/audio.ts +28 -0
- package/src/trailer/sound/brand.ts +53 -3
- package/src/trailer/sound/gen.ts +61 -2
- package/src/trailer/sound/index.ts +25 -11
- package/src/trailer/sound/presets.ts +86 -5
- package/src/trailer/sound/run.ts +1 -1
- package/src/trailer/sound/takes.ts +94 -0
- package/src/trailer/titles.ts +36 -0
- package/src/trailer/url.ts +1 -1
|
@@ -13,6 +13,11 @@
|
|
|
13
13
|
.ns-wontfix{--tone:var(--dim)}
|
|
14
14
|
.hue-k1{--hue:var(--k1)}.hue-k2{--hue:var(--k2)}.hue-k3{--hue:var(--k3)}.hue-k4{--hue:var(--k4)}.hue-k5{--hue:var(--k5)}.hue-k6{--hue:var(--k6)}
|
|
15
15
|
.hue-none{--hue:var(--dim)}
|
|
16
|
+
.ss-ready{--tone:var(--ok)}
|
|
17
|
+
.ss-queued{--tone:var(--warn)}
|
|
18
|
+
.ss-filming{--tone:var(--blue)}
|
|
19
|
+
.ss-waiting{--tone:var(--review)}
|
|
20
|
+
.ss-unfilmed{--tone:var(--red)}
|
|
16
21
|
|
|
17
22
|
/* ── the columns ── */
|
|
18
23
|
.rv-cols{flex:1;min-height:0}
|
|
@@ -433,6 +438,82 @@ span.rv-pick{display:inline-block;border:1px solid;border-radius:4px;font-size:1
|
|
|
433
438
|
.tr-edited{color:var(--warn)}
|
|
434
439
|
.tr-cuterr{color:var(--red);font-weight:800}
|
|
435
440
|
.tr-opencount{flex:none;min-width:16px;padding:0 var(--s1);border-radius:8px;background:var(--warn);color:var(--bg);font-size:10px;font-weight:700;text-align:center;line-height:16px}
|
|
441
|
+
/* the Voices view: the open line in the middle, every line on the right */
|
|
442
|
+
.tv-button{margin:var(--s1) 0 var(--s2);border:1px solid var(--line)}
|
|
443
|
+
.tv-button .sp,.tv-cliphead .sp{flex:1}
|
|
444
|
+
.tv-open{display:flex;flex-direction:column;gap:var(--s2);padding:var(--s3)}
|
|
445
|
+
.tv-head{display:flex;align-items:center;gap:var(--s2);flex-wrap:wrap}
|
|
446
|
+
.tv-dim{color:var(--dim);font-size:12px}
|
|
447
|
+
.tv-pill{padding:0 var(--s2);border-radius:9px;font-size:11px;font-weight:700;background:var(--panel2);color:var(--dim)}
|
|
448
|
+
.tv-pill.waiting{background:var(--warn);color:var(--bg)}
|
|
449
|
+
.tv-pill.recorded{background:var(--ok);color:var(--bg)}
|
|
450
|
+
.tv-text{margin:0;padding:var(--s2) var(--s3);border-left:3px solid var(--accent);font-size:22px;line-height:1.35;font-weight:600}
|
|
451
|
+
.tv-tag{display:inline-block;margin:0 var(--s1);padding:0 var(--s1);border-radius:4px;background:var(--panel2);color:var(--dim);font-size:12px;font-weight:400;vertical-align:middle}
|
|
452
|
+
.tv-audio{display:flex;align-items:center;gap:var(--s2);flex-wrap:wrap}
|
|
453
|
+
.tv-audio audio{height:32px;max-width:100%}
|
|
454
|
+
.tv-label{min-width:96px;font-size:12px;font-weight:700;color:var(--dim)}
|
|
455
|
+
.tv-actions{display:flex;align-items:center;gap:var(--s2);flex-wrap:wrap}
|
|
456
|
+
.tv-actions button,.tv-small{padding:var(--s1) var(--s3);border:1px solid var(--line);border-radius:6px;background:var(--panel)}
|
|
457
|
+
.tv-small{padding:var(--s0) var(--s2);font-size:12px}
|
|
458
|
+
/* the line's sounds as waveforms on one time scale: a button and a name a lane, the shapes in one column under the
|
|
459
|
+
ruler, the cursor and the next line's mark over that column only */
|
|
460
|
+
.tv-waves{--tv-head:calc(32px + 96px + 2 * var(--s1));position:relative;display:flex;flex-direction:column;gap:var(--s1);padding:var(--s4) 0 var(--s4)}
|
|
461
|
+
.tv-lane{display:grid;grid-template-columns:32px 96px 1fr;gap:var(--s1);align-items:center}
|
|
462
|
+
.tv-lanename{font-size:12px;font-weight:700;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
463
|
+
.tv-wave{width:100%;height:56px;display:block;border-radius:4px;background:var(--panel2);color:var(--line);cursor:pointer}
|
|
464
|
+
.tv-wave.drags{cursor:ew-resize;touch-action:none}
|
|
465
|
+
/* the clip's play bar: the range between two handles, the line's start, the playhead; loop beside it */
|
|
466
|
+
.tv-range{display:flex;flex-wrap:wrap;align-items:center;gap:var(--s2)}
|
|
467
|
+
.tv-range .tv-rangebar{flex:1 1 100%;order:-1}
|
|
468
|
+
.tv-loop.on{background:var(--accent);border-color:var(--accent);color:var(--bg)}
|
|
469
|
+
.tv-volume{display:inline-flex;align-items:center;gap:var(--s1)}
|
|
470
|
+
.tv-volume input{width:80px;accent-color:var(--accent)}
|
|
471
|
+
.tv-rangebar{position:relative;flex:1;height:24px;border-radius:4px;background:var(--panel2);cursor:pointer;touch-action:none}
|
|
472
|
+
.tv-rangebar.off{opacity:.5;cursor:default}
|
|
473
|
+
.tv-rangeon{position:absolute;top:0;bottom:0;background:var(--sel);box-shadow:inset 0 0 0 1px var(--accent);border-radius:4px}
|
|
474
|
+
.tv-rangeline{position:absolute;top:0;bottom:0;border-left:2px dashed var(--warn)}
|
|
475
|
+
.tv-rangehead{position:absolute;top:0;bottom:0;width:2px;transform:translateX(-1px);background:var(--red)}
|
|
476
|
+
.tv-handle{position:absolute;top:0;bottom:0;width:8px;transform:translateX(-4px);border-radius:3px;background:var(--accent);cursor:ew-resize}
|
|
477
|
+
/* which version of the line the clip plays: one segmented switch */
|
|
478
|
+
.tv-hear{display:inline-flex;border:1px solid var(--line);border-radius:6px;overflow:hidden}
|
|
479
|
+
.tv-hear button{padding:var(--s0) var(--s2);border:0;background:var(--panel);font-size:12px}
|
|
480
|
+
.tv-hear button.on{background:var(--accent);color:var(--bg);font-weight:700}
|
|
481
|
+
.tv-brushes{display:flex;gap:var(--s1)}
|
|
482
|
+
.tv-brush{flex:1;padding:0 var(--s1);border:1px solid var(--line);border-radius:4px;background:var(--panel);font-size:11px}
|
|
483
|
+
.tv-brush.mute.on{background:var(--red);border-color:var(--red);color:var(--bg)}
|
|
484
|
+
.tv-brush.keep.on{background:var(--ok);border-color:var(--ok);color:var(--bg)}
|
|
485
|
+
.tv-maskbar{position:relative;height:16px;border-radius:4px;background:var(--panel2);box-shadow:inset 0 0 0 1px var(--ok);cursor:crosshair;touch-action:none;overflow:hidden}
|
|
486
|
+
.tv-maskbar.off{cursor:default;opacity:.5}
|
|
487
|
+
.tv-masked{position:absolute;top:0;bottom:0;background:var(--red)}
|
|
488
|
+
.tv-overlay{position:absolute;left:var(--tv-head);right:0;top:var(--s4);bottom:var(--s4);pointer-events:none}
|
|
489
|
+
.tv-cursor{position:absolute;top:0;bottom:0;width:2px;transform:translateX(-1px);background:var(--red)}
|
|
490
|
+
.tv-room{position:absolute;top:0;bottom:0;border-left:2px dashed var(--warn)}
|
|
491
|
+
.tv-room span{position:absolute;top:calc(-1 * var(--s4));left:var(--s1);font-size:10px;color:var(--warn);white-space:nowrap}
|
|
492
|
+
.tv-cliphead{flex-wrap:wrap}
|
|
493
|
+
.tv-mic{display:flex;align-items:center;gap:var(--s2);font-size:12px}
|
|
494
|
+
.tv-mic select{max-width:100%;min-width:0;flex:1}
|
|
495
|
+
.tv-tick{position:absolute;bottom:calc(-1 * var(--s4));height:var(--s2);border-left:1px solid var(--line);font-size:10px;color:var(--dim);padding-left:var(--s0);line-height:1}
|
|
496
|
+
.tv-tick.whole{height:var(--s4)}
|
|
497
|
+
.tv-rec{font-weight:700;color:var(--red)}
|
|
498
|
+
.tv-rec.on{background:var(--red);color:var(--bg);border-color:var(--red)}
|
|
499
|
+
.tv-meter{width:120px;height:8px;border-radius:4px;background:var(--panel2);overflow:hidden}
|
|
500
|
+
.tv-meter span{display:block;height:100%;background:var(--ok)}
|
|
501
|
+
.tv-time{font-variant-numeric:tabular-nums;font-size:12px}
|
|
502
|
+
.tv-clip{display:flex;flex-direction:column;gap:var(--s1)}
|
|
503
|
+
.tv-cliphead{display:flex;align-items:center;gap:var(--s2)}
|
|
504
|
+
.tv-frame{position:relative}
|
|
505
|
+
.tv-frame video{display:block;width:100%;border-radius:6px;background:var(--bg);cursor:pointer}
|
|
506
|
+
.tv-cue{position:absolute;top:var(--s3);right:var(--s3);padding:var(--s1) var(--s3);border-radius:6px;background:var(--red);color:var(--bg);font-weight:700;font-size:18px}
|
|
507
|
+
.tv-uses{display:flex;flex-direction:column;gap:var(--s0);font-size:12px}
|
|
508
|
+
.tv-uses a{color:var(--dim)}
|
|
509
|
+
.tv-list{display:flex;flex-direction:column;gap:0;padding:var(--s2)}
|
|
510
|
+
.tv-row{display:flex;align-items:center;gap:var(--s2);width:100%;padding:var(--s1) var(--s2);border:0;border-radius:4px;background:none;text-align:left;font-size:13px}
|
|
511
|
+
.tv-row:hover{background:var(--panel2)}
|
|
512
|
+
.tv-row.on{background:var(--sel);box-shadow:inset 2px 0 0 var(--accent)}
|
|
513
|
+
.tv-rowtext{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
514
|
+
.tv-dot{flex:none;width:8px;height:8px;border-radius:50%;background:var(--line)}
|
|
515
|
+
.tv-dot.waiting{background:var(--warn)}
|
|
516
|
+
.tv-dot.recorded{background:var(--ok)}
|
|
436
517
|
.tr-cutage{flex:none;font-size:11px;color:var(--dim);font-variant-numeric:tabular-nums;white-space:nowrap}
|
|
437
518
|
.tr-keys{margin-top:var(--s3);padding:var(--s2);border:1px solid var(--line);border-radius:6px;background:var(--panel);display:flex;flex-direction:column;gap:var(--s0)}
|
|
438
519
|
.tr-keyshead{font-size:11px;font-weight:700;color:var(--dim)}
|
|
@@ -490,6 +571,13 @@ span.rv-pick{display:inline-block;border:1px solid;border-radius:4px;font-size:1
|
|
|
490
571
|
.tr-shotcard{position:relative;flex:none;width:148px;padding:var(--s1);border-radius:6px;text-align:left;border:1px solid var(--line);background:var(--panel)}
|
|
491
572
|
.tr-shotcard.on{border:2px solid var(--hue);background:color-mix(in srgb,var(--hue) 12%,var(--panel))}
|
|
492
573
|
.tr-shotname{font-size:12px;font-weight:800;margin-top:var(--s1);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
574
|
+
.tr-sbar{position:absolute;left:0;right:0;bottom:0;height:5px;background:var(--tone)}
|
|
575
|
+
.tr-sdot{display:inline-block;flex:none;width:8px;height:8px;border-radius:50%;background:var(--tone);vertical-align:baseline}
|
|
576
|
+
.tr-sstate{display:flex;gap:var(--s1);align-items:center;margin-top:var(--s1);font-size:11px;font-weight:700;color:var(--tone);overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
|
|
577
|
+
.tr-sstate .tr-dim{font-weight:500}
|
|
578
|
+
.tr-summary{display:flex;flex-wrap:wrap;gap:var(--s1) var(--s3);align-items:center;font-size:12.5px;padding:var(--s1) 0}
|
|
579
|
+
.tr-summary>span{display:inline-flex;gap:var(--s1);align-items:center}
|
|
580
|
+
.tr-summary .tr-cardlink{padding:0 var(--s1);font-size:12px;font-weight:700;color:var(--tone);border:1px solid color-mix(in srgb,var(--tone) 50%,var(--line));border-radius:3px;background:transparent;line-height:18px}
|
|
493
581
|
.tr-shot.changed::after{content:'';position:absolute;left:0;right:0;bottom:0;height:3px;background:var(--accent)}
|
|
494
582
|
.tr-shotcard.changed{box-shadow:inset 0 -3px 0 var(--accent)}
|
|
495
583
|
.tr-changed{margin-left:var(--s1);font-size:10px;font-weight:700;padding:0 var(--s1);border-radius:3px;line-height:16px;color:var(--accent);border:1px solid color-mix(in srgb,var(--accent) 50%,var(--line));background:transparent}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// a repo's Communications page (`#page:comms`, wiki tools/shipkit/social.md, The desks in the hub): the calendar on top,
|
|
2
|
-
// the drafts on the left (the family, the channel, the identity, the order), the draft picked in the middle (its angle,
|
|
2
|
+
// the drafts on the left (the next release on top, the family, the channel, the identity, the order), the draft picked in the middle (its angle,
|
|
3
3
|
// his notes, a card a heading), its article and media on the right. On a phone one pane at a time
|
|
4
4
|
import { observer } from 'mobx-react-lite'
|
|
5
5
|
import { Fragment, useEffect, useRef, type CSSProperties } from 'react'
|
|
@@ -15,6 +15,7 @@ import { Problems } from './problems.tsx'
|
|
|
15
15
|
import type { SocialSt } from './social-st.ts'
|
|
16
16
|
import { Caret } from '../icons.tsx'
|
|
17
17
|
import { StagePopup } from './stage-popup.tsx'
|
|
18
|
+
import { NextPage, NextSection, NextSide } from './next-release.tsx'
|
|
18
19
|
|
|
19
20
|
export const CommsPage = observer(({ app }: { app: RepoSt }) => {
|
|
20
21
|
const so = app.social
|
|
@@ -36,10 +37,10 @@ export const CommsPage = observer(({ app }: { app: RepoSt }) => {
|
|
|
36
37
|
<button className="ghost" onClick={() => so.showPhoneList()}>
|
|
37
38
|
◂ drafts
|
|
38
39
|
</button>
|
|
39
|
-
<b className="so-ellip">{so.currentDraft?.title || so.currentDraft?.slug}</b>
|
|
40
|
+
<b className="so-ellip">{so.nextPicked ? 'Next release (unreleased)' : so.currentDraft?.title || so.currentDraft?.slug}</b>
|
|
40
41
|
</div>
|
|
41
42
|
<DraftPane so={so} />
|
|
42
|
-
<DraftSide
|
|
43
|
+
<DraftSide app={app} />
|
|
43
44
|
</>
|
|
44
45
|
)}
|
|
45
46
|
<Lightbox so={so} />
|
|
@@ -62,7 +63,7 @@ export const CommsPage = observer(({ app }: { app: RepoSt }) => {
|
|
|
62
63
|
<Separator className="rsep" />
|
|
63
64
|
<Panel id="comms-side" defaultSize="32%" minSize={280} className="rv-pane" style={PANEL}>
|
|
64
65
|
<div className="rv-scroll so-ground">
|
|
65
|
-
<DraftSide
|
|
66
|
+
<DraftSide app={app} />
|
|
66
67
|
</div>
|
|
67
68
|
</Panel>
|
|
68
69
|
</KeptCols>
|
|
@@ -135,6 +136,7 @@ const DraftsList = observer(({ so }: { so: SocialSt }) => {
|
|
|
135
136
|
</div>
|
|
136
137
|
<Problems so={so} lines={[...(so.loadError ? [so.loadError] : []), ...so.errors]} />
|
|
137
138
|
<div className="rv-listscroll so-rows">
|
|
139
|
+
<NextSection so={so} />
|
|
138
140
|
{so.desk && so.desk.drafts.length === 0 ? <div className="rv-empty">no draft: write .shipkit/social/drafts/<YYYYMMDD-HHMMSS>-<topic>/draft.md</div> : null}
|
|
139
141
|
{drafts.map((d) => (
|
|
140
142
|
<Fragment key={d.slug}>
|
|
@@ -217,6 +219,7 @@ const PartRow = observer(({ so, d, part }: { so: SocialSt; d: Draft; part: strin
|
|
|
217
219
|
})
|
|
218
220
|
|
|
219
221
|
const DraftPane = observer(({ so }: { so: SocialSt }) => {
|
|
222
|
+
if (so.nextPicked && so.next?.preview) return <NextPage so={so} p={so.next.preview} />
|
|
220
223
|
const d = so.currentDraft
|
|
221
224
|
if (!d) return <div className="rv-empty">{so.desk ? 'no draft here: the list keeps none' : so.loadError ?? so.waitText}</div>
|
|
222
225
|
return <DraftPage so={so} d={d} />
|
|
@@ -304,7 +307,9 @@ const KindLink = observer(({ so, d }: { so: SocialSt; d: Draft }) => {
|
|
|
304
307
|
)
|
|
305
308
|
})
|
|
306
309
|
|
|
307
|
-
const DraftSide = observer(({
|
|
310
|
+
const DraftSide = observer(({ app }: { app: RepoSt }) => {
|
|
311
|
+
const so = app.social
|
|
312
|
+
if (so.nextPicked && so.next?.preview) return <NextSide rs={app.releases} p={so.next.preview} />
|
|
308
313
|
const d = so.currentDraft
|
|
309
314
|
return d ? <DraftMedia so={so} d={d} /> : null
|
|
310
315
|
})
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
// the next release in Communications (wiki tools/shipkit/social-desks.md, The next release): a foldable section on top
|
|
2
|
+
// of the list, the draft a release would stage from next.md in the middle, next.md's changes on the right. Never a
|
|
3
|
+
// draft: nothing here posts, copies or opens, and its words are the stage's own (release-stage.ts previewNextRelease)
|
|
4
|
+
import { observer } from 'mobx-react-lite'
|
|
5
|
+
import { ChangeCard } from '../releases/releases-page.tsx'
|
|
6
|
+
import type { ReleasesSt } from '../releases/releases-st.ts'
|
|
7
|
+
import { Caret } from '../icons.tsx'
|
|
8
|
+
import { Count, Logo } from './kit.tsx'
|
|
9
|
+
import { AngleCards, Logos } from './post-card.tsx'
|
|
10
|
+
import { NEXT_PICK, sharing, type Send } from './social-model.ts'
|
|
11
|
+
import type { SocialSt } from './social-st.ts'
|
|
12
|
+
import type { NextRelease } from '../../../social/release-stage.ts'
|
|
13
|
+
|
|
14
|
+
const changesIn = (p: NextRelease): number => p.release.categories.reduce((n, c) => n + c.changes.length, 0)
|
|
15
|
+
const titleOf = (p: NextRelease): string => p.draft?.title || (p.release.title ? `next: ${p.release.title}` : 'next')
|
|
16
|
+
|
|
17
|
+
/** the list's section: its fold, then one row, the release as it would be staged */
|
|
18
|
+
export const NextSection = observer(({ so }: { so: SocialSt }) => {
|
|
19
|
+
const view = so.next
|
|
20
|
+
if (view == null || (view.preview == null && view.error == null)) return null
|
|
21
|
+
const p = view.preview
|
|
22
|
+
return (
|
|
23
|
+
<div className="so-nextsec">
|
|
24
|
+
<button className="so-nexthead" onClick={() => so.flipFold(NEXT_PICK, true)} title="the release being filled, .shipkit/releases/next.md: a draft is staged from it when the release is cut">
|
|
25
|
+
<Caret open={so.nextOpen} />
|
|
26
|
+
<span className="so-ellip">Next release (unreleased)</span>
|
|
27
|
+
</button>
|
|
28
|
+
{so.nextOpen && view.error ? <div className="so-kindproblem">⚠ next.md: {view.error}</div> : null}
|
|
29
|
+
{so.nextOpen && p ? (
|
|
30
|
+
<button className={`so-draftrow so-nextrow${so.nextPicked ? ' on' : ''}`} onClick={() => so.pickDraft(NEXT_PICK)} title="not staged: nothing to post until the release is cut">
|
|
31
|
+
<span className="so-day">next</span>
|
|
32
|
+
<span className="so-rowtitle">{titleOf(p)}</span>
|
|
33
|
+
{p.draft ? <Logos so={so} posts={p.draft.posts} size={14} /> : null}
|
|
34
|
+
<span className="so-frac" title="the changes of next.md">
|
|
35
|
+
{changesIn(p)}
|
|
36
|
+
</span>
|
|
37
|
+
</button>
|
|
38
|
+
) : null}
|
|
39
|
+
</div>
|
|
40
|
+
)
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
/** the middle: the draft a release would stage, each heading's text as each venue gets it, nothing to click */
|
|
44
|
+
export const NextPage = observer(({ so, p }: { so: SocialSt; p: NextRelease }) => (
|
|
45
|
+
<div className="so-colin">
|
|
46
|
+
<div className="so-pagehead">
|
|
47
|
+
<h2 className="so-h">
|
|
48
|
+
{titleOf(p)}
|
|
49
|
+
<span className="rv-dim so-light"> · release</span>
|
|
50
|
+
</h2>
|
|
51
|
+
<span className="so-badge t-warn">unreleased · not staged</span>
|
|
52
|
+
</div>
|
|
53
|
+
<div className="so-nextnote">
|
|
54
|
+
The release being filled, as it would be staged now from <code>.shipkit/releases/next.md</code>: {changesIn(p)} changes. Nothing here posts: the real draft appears in this list when the release is cut, with its polish note.
|
|
55
|
+
</div>
|
|
56
|
+
{p.release.title === '' ? (
|
|
57
|
+
<div className="so-kindproblem">
|
|
58
|
+
⚠ next.md names no title, so the post is titled « {p.ref.split('@')[0]} <version> »: <code>sk releases add --release-title "…"</code> names it
|
|
59
|
+
</div>
|
|
60
|
+
) : null}
|
|
61
|
+
{p.errors.map((e) => (
|
|
62
|
+
<div key={e} className="so-kindproblem">
|
|
63
|
+
⚠ {e}
|
|
64
|
+
</div>
|
|
65
|
+
))}
|
|
66
|
+
{p.draft ? (
|
|
67
|
+
<>
|
|
68
|
+
<AngleCards key={p.ref} angle={p.draft.angle} />
|
|
69
|
+
{sharing(p.draft.posts, (x) => so.postAccount(x)).map((sends) => (
|
|
70
|
+
<PreviewCard key={sends[0]?.post.from} so={so} sends={sends} />
|
|
71
|
+
))}
|
|
72
|
+
</>
|
|
73
|
+
) : (
|
|
74
|
+
<div className="rv-dim rv-small">no post: the repo's social unit declares no release headings, so a release stages nothing</div>
|
|
75
|
+
)}
|
|
76
|
+
</div>
|
|
77
|
+
))
|
|
78
|
+
|
|
79
|
+
/** one heading's text for its accounts, read only: their logos, where each goes, the text, its length against each max */
|
|
80
|
+
const PreviewCard = observer(({ so, sends }: { so: SocialSt; sends: readonly Send[] }) => {
|
|
81
|
+
const first = sends[0]
|
|
82
|
+
if (!first) return null
|
|
83
|
+
return (
|
|
84
|
+
<div className="so-card so-post so-preview">
|
|
85
|
+
<div className="so-posthead">
|
|
86
|
+
<span className="so-logos">
|
|
87
|
+
{sends.map(({ a }) => (
|
|
88
|
+
<Logo key={a.id} id={a.id} name={a.name} size={24} muted />
|
|
89
|
+
))}
|
|
90
|
+
</span>
|
|
91
|
+
<span className="so-posttitle">
|
|
92
|
+
<b>{sends.map(({ a, post }) => (post.place ? `${a.name} → ${so.placeName(a, post.place)}` : a.name)).join(' · ')}</b>
|
|
93
|
+
</span>
|
|
94
|
+
<span className="so-badge t-dim">preview</span>
|
|
95
|
+
</div>
|
|
96
|
+
<div className="so-nexttext">{first.post.text}</div>
|
|
97
|
+
<div className="so-postfoot">
|
|
98
|
+
{sends.map(({ a, post }) => (
|
|
99
|
+
<Count key={a.id} n={post.length} max={a.max} title={`its length on ${a.name}`} />
|
|
100
|
+
))}
|
|
101
|
+
</div>
|
|
102
|
+
</div>
|
|
103
|
+
)
|
|
104
|
+
})
|
|
105
|
+
|
|
106
|
+
/** the right: next.md's changes as the Releases page draws them, pictures through the hub */
|
|
107
|
+
export const NextSide = observer(({ rs, p }: { rs: ReleasesSt; p: NextRelease }) => (
|
|
108
|
+
<div className="so-colin">
|
|
109
|
+
{p.release.categories.map((c) => (
|
|
110
|
+
<div key={c.name} className="so-nextcat">
|
|
111
|
+
<b>{c.name}</b>
|
|
112
|
+
{c.changes.map((ch) => (
|
|
113
|
+
<ChangeCard key={`${ch.card ?? ''}${ch.title}`} rs={rs} ch={ch} />
|
|
114
|
+
))}
|
|
115
|
+
</div>
|
|
116
|
+
))}
|
|
117
|
+
</div>
|
|
118
|
+
))
|
|
@@ -16,6 +16,8 @@ export type DeskJson = Desk & { timelines: Record<string, Timeline>; statsPlatfo
|
|
|
16
16
|
|
|
17
17
|
/** the account's own profile, beside its places */
|
|
18
18
|
export const ME = 'me'
|
|
19
|
+
/** the address of the next release in Communications (`#page:comms:next-release`): no draft's slug, which opens on a date */
|
|
20
|
+
export const NEXT_PICK = 'next-release'
|
|
19
21
|
/** the company card of an identity, never an account's folder name */
|
|
20
22
|
export const LEGAL = '@legal'
|
|
21
23
|
/** YouTube's title, the one title a group heading carries (`## vertical`) */
|
|
@@ -5,6 +5,7 @@ import { makeAutoObservable, observableRef, runInAction } from 'mobx'
|
|
|
5
5
|
import { releaseSource, StageSt } from './stage-st.ts'
|
|
6
6
|
import { compose, messageLength } from '../../../social/compose.ts'
|
|
7
7
|
import { deskOfWire, type Wire } from '../../../social/desk-wire.ts'
|
|
8
|
+
import type { NextReleaseView } from '../../../social/desk-index.ts'
|
|
8
9
|
import { identityAddress } from '../identity-address.ts'
|
|
9
10
|
import { SEARCH_KEY } from '../keys.ts'
|
|
10
11
|
import { reach } from '../reach.ts'
|
|
@@ -21,6 +22,7 @@ import {
|
|
|
21
22
|
LEGAL,
|
|
22
23
|
legalLive,
|
|
23
24
|
ME,
|
|
25
|
+
NEXT_PICK,
|
|
24
26
|
partsOf,
|
|
25
27
|
readCommsQuery,
|
|
26
28
|
waiting,
|
|
@@ -137,6 +139,10 @@ export class SocialSt {
|
|
|
137
139
|
toast: string | null = null
|
|
138
140
|
/** the phone shows one pane at a time: the list, or what it opened */
|
|
139
141
|
phonePane: 'list' | 'detail' = 'list'
|
|
142
|
+
/** the release being filled, as the release that cuts it would stage it; never a draft, never posted */
|
|
143
|
+
next: NextReleaseView | null = null
|
|
144
|
+
/** its ETag: « not modified » keeps it */
|
|
145
|
+
nextTag: string | null = null
|
|
140
146
|
/** the post tracker by identity: the URLs waiting for a line, its stamp, its last steps by platform */
|
|
141
147
|
tracker: Record<string, TrackerView> = {}
|
|
142
148
|
/** the line whose « search » runs, and what each found, by `<key>/<slug>` */
|
|
@@ -191,11 +197,41 @@ export class SocialSt {
|
|
|
191
197
|
start(): void {
|
|
192
198
|
if (this.started++ === 0) {
|
|
193
199
|
window.addEventListener('focus', this.onBack)
|
|
194
|
-
this.trackerTimer = setInterval(() =>
|
|
200
|
+
this.trackerTimer = setInterval(() => {
|
|
201
|
+
void this.loadTracker()
|
|
202
|
+
void this.loadNext()
|
|
203
|
+
}, TRACKER_MS)
|
|
195
204
|
}
|
|
196
205
|
void this.load()
|
|
197
206
|
void this.loadStats()
|
|
198
207
|
void this.loadTracker()
|
|
208
|
+
void this.loadNext()
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/** next.md previewed (wiki tools/shipkit/social-desks.md, The next release): read on every tick, a 304 while it stands */
|
|
212
|
+
async loadNext(): Promise<void> {
|
|
213
|
+
try {
|
|
214
|
+
const r = await reach(this.st.url('/api/social/next-release.json'), { cache: 'no-store', headers: this.nextTag ? { 'If-None-Match': this.nextTag } : {} })
|
|
215
|
+
if (r.status === 304) return
|
|
216
|
+
const body = (await r.json()) as NextReleaseView & { error?: string }
|
|
217
|
+
const tag = r.headers.get('ETag')
|
|
218
|
+
runInAction(() => {
|
|
219
|
+
this.next = r.ok ? body : { preview: null, error: body.error ?? `HTTP ${r.status}` }
|
|
220
|
+
this.nextTag = r.ok ? tag : null
|
|
221
|
+
})
|
|
222
|
+
} catch (e) {
|
|
223
|
+
runInAction(() => (this.next = { preview: null, error: (e as Error).message }))
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/** the next release is what the middle shows */
|
|
228
|
+
get nextPicked(): boolean {
|
|
229
|
+
return this.draftSlug === NEXT_PICK && this.next?.preview != null
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/** its section in the list, open unless he folded it */
|
|
233
|
+
get nextOpen(): boolean {
|
|
234
|
+
return this.isOpen(NEXT_PICK, true)
|
|
199
235
|
}
|
|
200
236
|
|
|
201
237
|
stop(): void {
|
|
@@ -434,6 +470,7 @@ export class SocialSt {
|
|
|
434
470
|
|
|
435
471
|
/** the draft shown is always one the view keeps */
|
|
436
472
|
get currentDraft(): Draft | null {
|
|
473
|
+
if (this.nextPicked) return null
|
|
437
474
|
const kept = this.drafts.filter((d) => this.kept(d))
|
|
438
475
|
return kept.find((d) => d.slug === this.draftSlug) ?? kept[0] ?? null
|
|
439
476
|
}
|
|
@@ -105,6 +105,14 @@ a.so-icon:visited{color:var(--dim)}
|
|
|
105
105
|
.so-art{color:var(--review);margin-right:var(--s1)}
|
|
106
106
|
.so-kindwarn{color:var(--warn);margin-right:var(--s1);font-weight:700}
|
|
107
107
|
.so-kindproblem{font-size:12px;color:var(--warn);border-left:3px solid var(--warn);padding:2px var(--s2);background:color-mix(in srgb,var(--warn) 8%,transparent);border-radius:3px}
|
|
108
|
+
/* the next release (next-release.tsx): a dashed section on top of the list, never a draft */
|
|
109
|
+
.so-nextsec{display:flex;flex-direction:column;gap:2px;margin-bottom:var(--s2);padding:var(--s1);border:1px dashed var(--line);border-radius:8px}
|
|
110
|
+
.so-nexthead{display:flex;align-items:center;gap:var(--s2);border:0;background:none;padding:2px var(--s1);font:inherit;font-size:12px;font-weight:700;color:var(--ink);cursor:pointer;text-align:left;white-space:nowrap;min-width:0}
|
|
111
|
+
.so-nextrow .so-rowtitle{font-style:italic}
|
|
112
|
+
.so-nextnote{font-size:12px;color:var(--dim);border-left:3px solid var(--line);padding:2px var(--s2)}
|
|
113
|
+
.so-preview{border-style:dashed}
|
|
114
|
+
.so-nexttext{white-space:pre-wrap;font-size:13px;padding:var(--s1) 0}
|
|
115
|
+
.so-nextcat{display:flex;flex-direction:column;gap:var(--s2)}
|
|
108
116
|
.so-kind{font-weight:700;color:var(--kt,var(--accent));border:1px solid color-mix(in srgb,var(--kt,var(--accent)) 55%,var(--line));border-radius:3px;padding:0 var(--s1);line-height:18px;text-decoration:none;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
109
117
|
a.so-kind:hover{text-decoration:underline}
|
|
110
118
|
.so-frac{flex:none;font-size:11px;font-weight:700;color:var(--dim);font-variant-numeric:tabular-nums}
|
|
@@ -81,6 +81,7 @@ export const KIND_SECTION: Record<ResourceType, SectionId> = {
|
|
|
81
81
|
command: 'commands',
|
|
82
82
|
card: 'review',
|
|
83
83
|
cut: 'trailer',
|
|
84
|
+
voice: 'trailer',
|
|
84
85
|
store: 'stores',
|
|
85
86
|
release: 'releases',
|
|
86
87
|
veille: 'veille',
|
|
@@ -435,6 +436,7 @@ export const TYPE_MARK: Record<string, TypeMark> = {
|
|
|
435
436
|
command: { glyph: '$', hue: 'k6', word: "a command of the repo's project CLI: its examples, its args, run from the page with its log live" },
|
|
436
437
|
card: { glyph: '\u25a3', hue: 'k2', word: 'a review card waiting for your answer: approve, fix, reject, circle a detail' },
|
|
437
438
|
cut: { glyph: '\u25b6', hue: 'k3', word: 'a trailer cut: play it with its timeline, pin a note on any frame' },
|
|
439
|
+
voice: { glyph: '\u266a', hue: 'k2', word: 'a trailer line your own voice reads, not recorded yet: record it in the trailer page, Voices' },
|
|
438
440
|
store: { glyph: '\u25a5', hue: 'k4', word: 'a store page (Steam, itch): every text to paste, every picture to upload, a note on each' },
|
|
439
441
|
release: { glyph: '\u2691', hue: 'k5', word: 'a version of the release notes: next.md being filled, or a released one, each change with its picture' },
|
|
440
442
|
veille: { glyph: '\u25ce', hue: 'k6', word: 'the Veille: the posts an identity scrolls past, ranked by the worth of a reply' },
|
|
@@ -25,6 +25,7 @@ import { identityOfText, identityProblem, type Identity } from '../core/identity
|
|
|
25
25
|
import { writeIdentity } from '../core/identity.ts'
|
|
26
26
|
import { appIconOf, appIconPngs, identityOfRoot } from '../core/app-icon.ts'
|
|
27
27
|
import { waitingCards } from '../collections/review.ts'
|
|
28
|
+
import { voicesWaiting } from '../review/trailer-voices.ts'
|
|
28
29
|
import { storeDir, warmStore } from '../review/store.ts'
|
|
29
30
|
import { writeArchived } from '../core/archived.ts'
|
|
30
31
|
import { identitiesDir, pictureVersion } from '../identities/identities.ts'
|
|
@@ -78,6 +79,8 @@ export type ProjectRow = {
|
|
|
78
79
|
askTitles: string[]
|
|
79
80
|
/** the review cards that wait on the owner (collections/review.ts waitingCards), oldest first: read on every request */
|
|
80
81
|
cards: { id: string; title: string }[]
|
|
82
|
+
/** the trailer lines his own voice reads that he has not recorded yet (review/trailer-voices.ts), every trailer of the repo */
|
|
83
|
+
voices: number
|
|
81
84
|
/** package.json `description`, else the README's first line of prose */
|
|
82
85
|
description: string | null
|
|
83
86
|
/** package.json `version` */
|
|
@@ -356,6 +359,10 @@ export function projectGutter(d: GutterDeps) {
|
|
|
356
359
|
const ids = await loopWatch.spanned('projects: ids', readIds)
|
|
357
360
|
// each store read whole once, in steps, before the rows read its waiting cards
|
|
358
361
|
await loopWatch.spanned('projects: review stores', async () => { for (const r of repos) await warmStore(storeDir(r.path)) })
|
|
362
|
+
const voices = new Map<string, number>()
|
|
363
|
+
await loopWatch.spanned('projects: voices', async () => {
|
|
364
|
+
for (const r of repos) voices.set(r.path, Object.values(await voicesWaiting(r.path).catch(() => ({}))).reduce((a: number, b: number) => a + b, 0))
|
|
365
|
+
})
|
|
359
366
|
const projects = repos.map((r, i): ProjectRow => loopWatch.timed(`projects: row ${r.name}`, () => {
|
|
360
367
|
const config = readText(join(r.path, 'repo.config.ts'))
|
|
361
368
|
const pkg = readText(join(r.path, 'package.json'))
|
|
@@ -373,6 +380,7 @@ export function projectGutter(d: GutterDeps) {
|
|
|
373
380
|
asks: asks.length,
|
|
374
381
|
askTitles: asks,
|
|
375
382
|
cards: cardsOf(r.path),
|
|
383
|
+
voices: voices.get(r.path) ?? 0,
|
|
376
384
|
description,
|
|
377
385
|
version: versionOf(pkg),
|
|
378
386
|
branch: branchOf(readText(join(r.path, '.git', 'HEAD'))),
|
|
@@ -15,6 +15,7 @@ import { defaultHubPort } from './hub-port.ts'
|
|
|
15
15
|
import { LAYOUT } from '../core/layout.ts'
|
|
16
16
|
import { isArchived } from '../core/archived.ts'
|
|
17
17
|
import { CLAUDE_FILES } from '../home/pm-inputs.ts'
|
|
18
|
+
import { DEFAULT_AGENT_DIR } from '../core/agent-dir.ts'
|
|
18
19
|
|
|
19
20
|
export type WiredRepo = { name: string; path: string; icon: string | null }
|
|
20
21
|
|
|
@@ -40,10 +41,11 @@ export function includeTargets(repo: string, home: string): string[] {
|
|
|
40
41
|
|
|
41
42
|
/** the house wiki index this repo includes: the first include outside the
|
|
42
43
|
* repo, else (the repo that hosts the house) the first one that exists and
|
|
43
|
-
* is
|
|
44
|
+
* is neither another CLAUDE file nor the repo's own agent/ wiki */
|
|
44
45
|
export function houseIndex(repo: string, home: string): string | null {
|
|
45
46
|
const targets = includeTargets(repo, home).filter((t) => existsSync(t))
|
|
46
|
-
|
|
47
|
+
const own = join(repo, DEFAULT_AGENT_DIR, 'index.md')
|
|
48
|
+
return targets.find((t) => !inside(t, repo)) ?? targets.find((t) => t !== own && !basename(t).startsWith('CLAUDE')) ?? null
|
|
47
49
|
}
|
|
48
50
|
|
|
49
51
|
/** a repo's own icon, first hit wins. `.shipkit/identity/icon.png` is the rail
|
package/src/shot/box.ts
CHANGED
|
@@ -34,6 +34,25 @@ export type Pw = { chromium: { launch(o: { headless: boolean; args: string[] }):
|
|
|
34
34
|
* url (the box needs this Mac's localhost port forwarded); `close` ends it and frees its slot */
|
|
35
35
|
export type Opened<B> = { browser: B; where: string; reach(url: string): Promise<void>; close(): Promise<void> }
|
|
36
36
|
|
|
37
|
+
/** a browser close that has not answered in this long (a stalled box route) is left behind, so its slot frees */
|
|
38
|
+
export const CLOSE_MS = 5000
|
|
39
|
+
|
|
40
|
+
/** the close of a browser, left after CLOSE_MS, then its slot freed whatever the close did */
|
|
41
|
+
const closeThenFree = async (close: () => Promise<void>, free: () => void): Promise<void> => {
|
|
42
|
+
try {
|
|
43
|
+
await Promise.race([close().catch(() => undefined), Bun.sleep(CLOSE_MS)])
|
|
44
|
+
} finally {
|
|
45
|
+
free()
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** wait for one of the repo's browser slots where its browser would run (on its box from a Mac), and hold it until
|
|
50
|
+
* the release: a caller that waits in the queue apart from its own timed work holds it first (openBrowser `held`) */
|
|
51
|
+
export async function slotFor(o: { root?: string; who: string; say?: (l: string) => void }): Promise<() => void> {
|
|
52
|
+
const box = filmBox(await browserCap(o.root))
|
|
53
|
+
return browserSlot(o.who, { ...(o.root ? { root: o.root } : {}), ...(o.say ? { say: o.say } : {}), onBox: box != null })
|
|
54
|
+
}
|
|
55
|
+
|
|
37
56
|
const SSH = (box: string) => ['ssh', '-o', 'ConnectTimeout=5', '-o', 'BatchMode=yes', box]
|
|
38
57
|
/** where the box's devtools answer on this Mac */
|
|
39
58
|
const localCdp = (box: string): number => 40000 + (parseInt(createHash('sha1').update(box).digest('hex').slice(0, 4), 16) % 9000)
|
|
@@ -134,16 +153,15 @@ export function asLaunched(b: PwBrowser, all: PwPage[], store: BoxStore = 'job')
|
|
|
134
153
|
}
|
|
135
154
|
|
|
136
155
|
/** a browser for `who` of the repo at `root`: on its box from a Mac (filmBox), else launched here; one of the repo's
|
|
137
|
-
* browser slots held until close */
|
|
138
|
-
export async function openBrowser<B>(pw: Pw, o: { root?: string; who: string; args: string[]; say?: (l: string) => void; store?: BoxStore }): Promise<Opened<B>> {
|
|
156
|
+
* browser slots held until close (`held`: one its caller already holds from slotFor, freed here as one taken here) */
|
|
157
|
+
export async function openBrowser<B>(pw: Pw, o: { root?: string; who: string; args: string[]; say?: (l: string) => void; store?: BoxStore; held?: () => void }): Promise<Opened<B>> {
|
|
139
158
|
const say = o.say ?? ((l: string) => console.error(l))
|
|
140
|
-
const
|
|
141
|
-
const
|
|
142
|
-
const release = await browserSlot(o.who, { ...(o.root ? { root: o.root } : {}), say, onBox: box != null })
|
|
159
|
+
const box = filmBox(await browserCap(o.root))
|
|
160
|
+
const release = o.held ?? (await slotFor({ ...(o.root ? { root: o.root } : {}), who: o.who, say }))
|
|
143
161
|
try {
|
|
144
162
|
if (box == null) {
|
|
145
163
|
const b = (await pw.chromium.launch({ headless: true, args: o.args })) as B & { close(): Promise<void> }
|
|
146
|
-
return { browser: b, where: 'here', reach: async () => undefined, close: () =>
|
|
164
|
+
return { browser: b, where: 'here', reach: async () => undefined, close: () => closeThenFree(() => b.close(), release) }
|
|
147
165
|
}
|
|
148
166
|
const t = performance.now()
|
|
149
167
|
const version = (JSON.parse(readFileSync(Bun.resolveSync('playwright-core/package.json', import.meta.dir), 'utf8')) as { version: string }).version
|
|
@@ -169,12 +187,15 @@ export async function openBrowser<B>(pw: Pw, o: { root?: string; who: string; ar
|
|
|
169
187
|
await forward(box, ['-R', `${port}:127.0.0.1:${port}`], own)
|
|
170
188
|
reached.add(port)
|
|
171
189
|
},
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
190
|
+
// its pages close, the connection drops, the box's browser stays warm
|
|
191
|
+
close: () =>
|
|
192
|
+
closeThenFree(
|
|
193
|
+
() => browser.close(),
|
|
194
|
+
() => {
|
|
195
|
+
own.p?.kill()
|
|
196
|
+
release()
|
|
197
|
+
},
|
|
198
|
+
),
|
|
178
199
|
}
|
|
179
200
|
} catch (e) {
|
|
180
201
|
release()
|
package/src/shot/client.ts
CHANGED
|
@@ -99,7 +99,7 @@ async function ask(route: '/shot' | '/clip', a: ShotAsk | ClipAsk, log: (l: stri
|
|
|
99
99
|
const { pmUp, pmUrl } = await import('../home/home-paths.ts')
|
|
100
100
|
if (process.env['CI'] == null && process.env['SHIPKIT_NO_HOME'] == null && (await pmUp())) {
|
|
101
101
|
log(`shot: starting the shot service (sk gp start ${SHOT_PROCESS})`)
|
|
102
|
-
const { pmSwitchDeps, switchProcess } = await import('../
|
|
102
|
+
const { pmSwitchDeps, switchProcess } = await import('../home/pm-switch.ts')
|
|
103
103
|
const code = await switchProcess(SHOT_PROCESS, 'start', pmSwitchDeps(log, pmUrl()), 60_000)
|
|
104
104
|
if (code !== 0) throw new Error(`the shot service did not start through pm: sk gp shows where it stands`)
|
|
105
105
|
const started = await post(route, a)
|
package/src/shot/shooter.ts
CHANGED
|
@@ -26,7 +26,7 @@ import { dirname } from 'path'
|
|
|
26
26
|
import { loadPlaywright } from '../smoke/run-smoke.ts'
|
|
27
27
|
import { CLIP_INIT, CLIP_QUANTIZER, clipDone, installClip, KEY_EVERY, muxArgs, type PageClipAsk, type PageClipDone, TAKE, takeClip } from './clip-encoder.ts'
|
|
28
28
|
import { type ClipPath, clipPathOf, domEncodeArgs, FrameTimeline, largestCanvas, screencastParams } from './dom-clip.ts'
|
|
29
|
-
import { openBrowser, type PwBrowser } from './box.ts'
|
|
29
|
+
import { CLOSE_MS, openBrowser, type PwBrowser, slotFor } from './box.ts'
|
|
30
30
|
import { capMsOf, type ClipAsk, pageMove, readMark, type ShotAsk, slotKey, stillFormat, Turns, waitReady } from './shot-ask.ts'
|
|
31
31
|
|
|
32
32
|
/** the slice of playwright the shots touch, so the lib types nothing it does not ship */
|
|
@@ -82,8 +82,6 @@ export const LIVE_MS = 10_000
|
|
|
82
82
|
export const BROWSER_IDLE_MS = 60_000
|
|
83
83
|
/** the niceness of the process that launches the browser: chromium inherits it */
|
|
84
84
|
export const SHOT_NICE = 10
|
|
85
|
-
/** a browser close that has not answered in this long (a stalled box route) is left behind, so its slot frees */
|
|
86
|
-
export const CLOSE_MS = 5000
|
|
87
85
|
/** a page that paints nothing once the screencast starts is filmed from one still taken after this */
|
|
88
86
|
const FIRST_FRAME_MS = 1000
|
|
89
87
|
|
|
@@ -119,6 +117,8 @@ export class Shooter {
|
|
|
119
117
|
#browser: Browser | null = null
|
|
120
118
|
#launching: Promise<Browser> | null = null
|
|
121
119
|
#held: (() => void) | null = null
|
|
120
|
+
/** a slot taken in the queue and not yet handed to its browser's open */
|
|
121
|
+
#queued: (() => void) | null = null
|
|
122
122
|
/** before a page goes to a url: the box route forwards this machine's localhost port to the box */
|
|
123
123
|
#reach: (url: string) => Promise<void> = async () => undefined
|
|
124
124
|
#slot: Slot | null = null
|
|
@@ -141,12 +141,20 @@ export class Shooter {
|
|
|
141
141
|
|
|
142
142
|
/** a still of the url, written at `a.out`, encoded by its extension (stillFormat) */
|
|
143
143
|
shot(a: ShotAsk): Promise<ShotDone> {
|
|
144
|
-
return this.#turns.run(() =>
|
|
144
|
+
return this.#turns.run(() => this.#capped(`the shot of ${a.url}`, capMsOf(a), () => this.#shot(a)))
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
/** an mp4 of `a.seconds` of the url, written at `a.out`: its canvas when the canvas is the page, else the page */
|
|
148
148
|
clip(a: ClipAsk): Promise<ShotDone> {
|
|
149
|
-
return this.#turns.run(() =>
|
|
149
|
+
return this.#turns.run(() => this.#capped(`the clip of ${a.url}`, capMsOf(a), () => this.#clip(a)))
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/** the run capped once its browser slot is held: a wait behind the repo's other browsers is its queue, as its turn
|
|
153
|
+
* is, never part of its run (a tab of a sheet waits behind the others' browsers, it never fails at the cap) */
|
|
154
|
+
async #capped(what: string, capMs: number, run: () => Promise<ShotDone>): Promise<ShotDone> {
|
|
155
|
+
const f = this.#for
|
|
156
|
+
if (f != null && this.#held == null && this.#queued == null) this.#queued = await slotFor({ root: f.root, who: f.who, ...(f.say ? { say: f.say } : {}) })
|
|
157
|
+
return withCap(what, capMs, run()).finally(() => this.#touch())
|
|
150
158
|
}
|
|
151
159
|
|
|
152
160
|
async close(): Promise<void> {
|
|
@@ -169,9 +177,9 @@ export class Shooter {
|
|
|
169
177
|
}
|
|
170
178
|
|
|
171
179
|
#free(): void {
|
|
172
|
-
const held = this.#held
|
|
173
|
-
this.#held = null
|
|
174
|
-
held?.()
|
|
180
|
+
const held = [this.#held, this.#queued]
|
|
181
|
+
this.#held = this.#queued = null
|
|
182
|
+
for (const h of held) h?.()
|
|
175
183
|
}
|
|
176
184
|
|
|
177
185
|
#touch(): void {
|
|
@@ -201,7 +209,9 @@ export class Shooter {
|
|
|
201
209
|
let b: Browser
|
|
202
210
|
if (f != null) {
|
|
203
211
|
// the repo's browser: on its box from a Mac (box.ts), else launched here, its slot held until close
|
|
204
|
-
const
|
|
212
|
+
const held = this.#queued
|
|
213
|
+
this.#queued = null
|
|
214
|
+
const o = await openBrowser<Browser>(pw, { root: f.root, who: f.who, args: BROWSER_ARGS, ...(f.say ? { say: f.say } : {}), ...(held ? { held } : {}) })
|
|
205
215
|
b = o.browser
|
|
206
216
|
this.#reach = (url) => o.reach(url)
|
|
207
217
|
this.#held = () => void o.close()
|