rvlib-shipkit 2.8.0 → 2.10.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/SK005-rvlib-versions.check.ts +17 -11
- package/src/cli/cmd_Fleet.ts +8 -5
- package/src/cli/cmd_Review.ts +2 -1
- package/src/core/update-policy.ts +6 -0
- package/src/fleet/commit-bump.ts +123 -0
- package/src/fleet/push-fleet.ts +9 -3
- package/src/fleet/update-fleet.ts +38 -9
- package/src/review/cells.ts +548 -0
- package/src/review/format.ts +1 -1
- package/src/review/model.ts +29 -4
- package/src/review/previews.ts +124 -0
- package/src/review/routes.ts +82 -45
- package/src/review/store.ts +6 -5
- package/src/serve/hub-app/auto-text.tsx +52 -0
- package/src/serve/hub-app/hub.css +2 -0
- package/src/serve/hub-app/media-view.tsx +3 -11
- package/src/serve/hub-app/review/kind-view.tsx +21 -22
- package/src/serve/hub-app/review/kit.tsx +11 -12
- package/src/serve/hub-app/review/review-board.tsx +15 -13
- package/src/serve/hub-app/review/review-cells.tsx +241 -0
- package/src/serve/hub-app/review/review-kit.ts +79 -0
- package/src/serve/hub-app/review/review-list.tsx +87 -122
- package/src/serve/hub-app/review/review-page.tsx +25 -66
- package/src/serve/hub-app/review/review-st.ts +269 -668
- package/src/serve/hub-app/review/review-thread.tsx +301 -0
- package/src/serve/hub-app/review/review-views.tsx +372 -234
- package/src/serve/hub-app/review/thread-st.ts +770 -0
- package/src/serve/hub-app/review/trailer-page.tsx +5 -4
- package/src/serve/hub-app/review.css +252 -90
- package/src/serve/hub-app/review/review-answer.tsx +0 -248
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
// the open card as one chat (wiki build/shipkit/review.md, The review page): a bar on top (the title, where it stands,
|
|
2
|
+
// fold or unfold all, the contents), the cells in time order with the newest at the bottom, the contents strip beside
|
|
3
|
+
// them (every version, view, verdict and reply: a click scrolls there and unfolds it), and his answer box pinned under
|
|
4
|
+
// them: one word, sent with a verdict or as a reply. The column opens scrolled to the newest cell
|
|
5
|
+
import { observer } from 'mobx-react-lite'
|
|
6
|
+
import { useEffect, useRef } from 'react'
|
|
7
|
+
import { MOVE_LABEL, STATUS_LABEL, subjectLabel, viewName, viewTag } from '../../../review/model.ts'
|
|
8
|
+
import { AutoText } from '../auto-text.tsx'
|
|
9
|
+
import { Icon, ICON } from '../icons.tsx'
|
|
10
|
+
import { AutoTag, Empty, keepFocus, LaneTag, Listeners, Rework, toneOf, VERDICTS } from './kit.tsx'
|
|
11
|
+
import { CellFrame, EventsLine } from './review-cells.tsx'
|
|
12
|
+
import type { ReviewSt } from './review-st.ts'
|
|
13
|
+
import { cellDom, type ThreadSt, type ViewMark } from './thread-st.ts'
|
|
14
|
+
|
|
15
|
+
export const ThreadColumn = observer(({ rv }: { rv: ReviewSt }) => {
|
|
16
|
+
const el = useRef<HTMLDivElement | null>(null)
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
const node = el.current
|
|
19
|
+
if (node == null || typeof ResizeObserver === 'undefined') return
|
|
20
|
+
// the width lands on the next frame: a relayout inside the callback is the observer's loop error
|
|
21
|
+
let raf = 0
|
|
22
|
+
const ro = new ResizeObserver(([e]) => {
|
|
23
|
+
const w = e!.contentRect.width
|
|
24
|
+
cancelAnimationFrame(raf)
|
|
25
|
+
raf = requestAnimationFrame(() => rv.fit(w))
|
|
26
|
+
})
|
|
27
|
+
ro.observe(node)
|
|
28
|
+
return () => {
|
|
29
|
+
cancelAnimationFrame(raf)
|
|
30
|
+
ro.disconnect()
|
|
31
|
+
}
|
|
32
|
+
}, [rv])
|
|
33
|
+
const card = rv.card
|
|
34
|
+
return (
|
|
35
|
+
<div ref={el} className="rv-thread">
|
|
36
|
+
{card === null ? (
|
|
37
|
+
<Empty text={rv.page ? 'No card. An agent adds one with sk review add.' : 'Reading the cards…'} />
|
|
38
|
+
) : (
|
|
39
|
+
<>
|
|
40
|
+
<TopBar rv={rv} card={card} />
|
|
41
|
+
<div className="rv-threadbody">
|
|
42
|
+
<Cells rv={rv} card={card} />
|
|
43
|
+
{rv.rail ? <Contents rv={rv} card={card} /> : rv.phone.on ? null : <Minimap rv={rv} card={card} dir="col" />}
|
|
44
|
+
{rv.sheet && !rv.rail ? (
|
|
45
|
+
<div className="rv-sheet" onClick={() => rv.closeSheet()}>
|
|
46
|
+
<div onClick={(e) => e.stopPropagation()}><Contents rv={rv} card={card} /></div>
|
|
47
|
+
</div>
|
|
48
|
+
) : null}
|
|
49
|
+
</div>
|
|
50
|
+
<Composer rv={rv} card={card} />
|
|
51
|
+
</>
|
|
52
|
+
)}
|
|
53
|
+
</div>
|
|
54
|
+
)
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
/** the card's bar: its title, where it stands, its lane, who listens, the copy for an agent, fold or unfold all, the
|
|
58
|
+
* contents; on the phone a way back to the cards */
|
|
59
|
+
const TopBar = observer(({ rv, card }: { rv: ReviewSt; card: ThreadSt }) => {
|
|
60
|
+
const v = card.data
|
|
61
|
+
const row = rv.openRow
|
|
62
|
+
return (
|
|
63
|
+
<div className="rv-top">
|
|
64
|
+
<div className="rv-topline">
|
|
65
|
+
{rv.phone.on ? <button className="ghost rv-back" onClick={() => rv.phone.show('list')}>◂</button> : null}
|
|
66
|
+
<h2 className="rv-title">{v?.title ?? row?.title ?? card.id}</h2>
|
|
67
|
+
{rv.phone.on ? null : <Waiting card={card} />}
|
|
68
|
+
<button className="rv-copyid ghost" title="copy this card for an agent (C): its title, its repo, sk review show, its link" aria-label="copy this card for an agent" onClick={() => void rv.copyCard()}>
|
|
69
|
+
<Icon d={ICON.copy} />
|
|
70
|
+
</button>
|
|
71
|
+
</div>
|
|
72
|
+
{rv.phone.on && v ? <Minimap rv={rv} card={card} dir="row" /> : null}
|
|
73
|
+
{v ? (
|
|
74
|
+
<div className="rv-meta">
|
|
75
|
+
<span className={`rv-badge ${toneOf(v.status)}`}>{STATUS_LABEL[v.status]}</span>
|
|
76
|
+
{v.lane ? <LaneTag lane={v.lane} /> : null}
|
|
77
|
+
{v.origin.by === 'auto' ? <AutoTag rule={v.origin.rule} /> : null}
|
|
78
|
+
<span>{v.versions > 1 ? `${v.versions} versions` : 'one version'} · {subjectLabel(v.subject.kind, rv.spec ?? undefined)}{v.move !== 'none' ? ` · ${MOVE_LABEL[v.move]}` : ''}</span>
|
|
79
|
+
{v.forks.length > 0 ? (
|
|
80
|
+
<span className="rv-forks" title="other cards answered the same older versions: each is its own thread">
|
|
81
|
+
· forks:
|
|
82
|
+
{v.forks.map((f) => (
|
|
83
|
+
<button key={f} className="rv-fork ghost" title={f} onMouseDown={keepFocus} onClick={() => rv.pick(f)}>⑂ {forkName(f)}</button>
|
|
84
|
+
))}
|
|
85
|
+
</span>
|
|
86
|
+
) : null}
|
|
87
|
+
<Rework r={v.rework} />
|
|
88
|
+
<span className="sp" />
|
|
89
|
+
<span className="seg">
|
|
90
|
+
<button title="fold every cell" onMouseDown={keepFocus} onClick={() => card.foldAll(false)}>fold all</button>
|
|
91
|
+
<button title="unfold every cell (it loads every image)" onMouseDown={keepFocus} onClick={() => card.foldAll(true)}>unfold all</button>
|
|
92
|
+
</span>
|
|
93
|
+
<button className={rv.rail || rv.sheet ? 'on' : ''} title="every item of the card: a click shows it" onMouseDown={keepFocus} onClick={() => rv.toggleRail()}>☰ contents</button>
|
|
94
|
+
</div>
|
|
95
|
+
) : card.error ? null : (
|
|
96
|
+
<div className="rv-meta"><span className="spin" /> reading the thread…</div>
|
|
97
|
+
)}
|
|
98
|
+
</div>
|
|
99
|
+
)
|
|
100
|
+
})
|
|
101
|
+
|
|
102
|
+
/** the cells in time order; on the first load it lands on the newest one (or the one an old link names), and a click
|
|
103
|
+
* on the contents scrolls to its target */
|
|
104
|
+
const Cells = observer(({ rv, card }: { rv: ReviewSt; card: ThreadSt }) => {
|
|
105
|
+
const el = useRef<HTMLDivElement | null>(null)
|
|
106
|
+
const landing = card.landed ? null : card.landing
|
|
107
|
+
useEffect(() => {
|
|
108
|
+
const box = el.current
|
|
109
|
+
if (!landing || !box) return
|
|
110
|
+
const raf = requestAnimationFrame(() => {
|
|
111
|
+
const target = box.querySelector<HTMLElement>(`#${landing}`)
|
|
112
|
+
if (target) box.scrollTop = Math.min(target.offsetTop - 8, box.scrollHeight - box.clientHeight)
|
|
113
|
+
card.land()
|
|
114
|
+
})
|
|
115
|
+
return () => cancelAnimationFrame(raf)
|
|
116
|
+
}, [landing, card])
|
|
117
|
+
// an agent word goes read once it shows on his screen with the tab visible: never on open, never one not drawn
|
|
118
|
+
const unread = card.unreadCells.join(' ')
|
|
119
|
+
useEffect(() => {
|
|
120
|
+
const box = el.current
|
|
121
|
+
if (!box || !unread || typeof IntersectionObserver === 'undefined') return
|
|
122
|
+
const showing = new Set<string>()
|
|
123
|
+
const send = (): void => {
|
|
124
|
+
if (document.visibilityState === 'visible' && showing.size > 0) void card.seen([...showing])
|
|
125
|
+
}
|
|
126
|
+
const io = new IntersectionObserver(
|
|
127
|
+
(es) => {
|
|
128
|
+
for (const e of es) {
|
|
129
|
+
const id = (e.target as HTMLElement).dataset.unread
|
|
130
|
+
if (!id) continue
|
|
131
|
+
if (e.isIntersecting) showing.add(id)
|
|
132
|
+
else showing.delete(id)
|
|
133
|
+
}
|
|
134
|
+
send()
|
|
135
|
+
},
|
|
136
|
+
{ root: box, threshold: 0.3 },
|
|
137
|
+
)
|
|
138
|
+
for (const n of box.querySelectorAll<HTMLElement>('[data-unread]')) io.observe(n)
|
|
139
|
+
document.addEventListener('visibilitychange', send)
|
|
140
|
+
return () => {
|
|
141
|
+
io.disconnect()
|
|
142
|
+
document.removeEventListener('visibilitychange', send)
|
|
143
|
+
}
|
|
144
|
+
}, [unread, card])
|
|
145
|
+
const jump = card.jump
|
|
146
|
+
useEffect(() => {
|
|
147
|
+
const box = el.current
|
|
148
|
+
if (!jump || !box) return
|
|
149
|
+
const raf = requestAnimationFrame(() => {
|
|
150
|
+
box.querySelector<HTMLElement>(`#${jump}`)?.scrollIntoView({ behavior: 'smooth', block: 'start' })
|
|
151
|
+
card.jumped()
|
|
152
|
+
})
|
|
153
|
+
return () => cancelAnimationFrame(raf)
|
|
154
|
+
}, [jump, card])
|
|
155
|
+
return (
|
|
156
|
+
<div ref={el} className="rv-cells">
|
|
157
|
+
{card.lines.map((l, k) =>
|
|
158
|
+
l.kind === 'day' ? (
|
|
159
|
+
<div key={`d${k}`} className="rv-day"><span>{l.day}</span></div>
|
|
160
|
+
) : l.kind === 'events' ? (
|
|
161
|
+
<EventsLine key={l.cells[0]!.id} rv={rv} cells={l.cells} />
|
|
162
|
+
) : (
|
|
163
|
+
<CellFrame key={l.cell.id} rv={rv} card={card} c={l.cell} />
|
|
164
|
+
),
|
|
165
|
+
)}
|
|
166
|
+
{card.error ? <div className="rv-err rv-pre">{card.error}</div> : null}
|
|
167
|
+
</div>
|
|
168
|
+
)
|
|
169
|
+
})
|
|
170
|
+
|
|
171
|
+
/** every item of the card, in the thread's order: each version and its views, each verdict, reply and note. A click
|
|
172
|
+
* unfolds it and scrolls there; a folded one reads dim */
|
|
173
|
+
const Contents = observer(({ rv, card }: { rv: ReviewSt; card: ThreadSt }) => (
|
|
174
|
+
<nav className="rv-contents" aria-label="every item of the card">
|
|
175
|
+
<div className="rv-contentshead">
|
|
176
|
+
<b>contents</b>
|
|
177
|
+
<span className="rv-dim">{card.contents.length}</span>
|
|
178
|
+
<span className="sp" />
|
|
179
|
+
{rv.sheet ? <button className="ghost rv-x" aria-label="close" onClick={() => rv.closeSheet()}>✕</button> : null}
|
|
180
|
+
</div>
|
|
181
|
+
<Minimap rv={rv} card={card} dir="row" />
|
|
182
|
+
<ol>
|
|
183
|
+
{card.contents.map((e) => {
|
|
184
|
+
const c = card.cells.find((x) => x.id === e.cell)
|
|
185
|
+
const shown = c !== undefined && card.isOpen(c) && (e.view === undefined || card.viewOpen(e.cell, e.view))
|
|
186
|
+
return (
|
|
187
|
+
<li key={e.key} className={`rv-entry k-${e.kind}${shown ? '' : ' folded'}${e.head ? ' head' : ''}${e.tone ? ` ${e.tone}` : ''}`}>
|
|
188
|
+
<button title={e.label} onMouseDown={keepFocus} onClick={() => { card.reveal(e.cell, e.view); rv.closeSheet() }}>
|
|
189
|
+
<span className="rv-entrybadge">{e.badge}</span>
|
|
190
|
+
<span className="rv-entrylabel">{e.label}</span>
|
|
191
|
+
</button>
|
|
192
|
+
</li>
|
|
193
|
+
)
|
|
194
|
+
})}
|
|
195
|
+
</ol>
|
|
196
|
+
</nav>
|
|
197
|
+
))
|
|
198
|
+
|
|
199
|
+
/** a fork's head named by its id's words: `20261012-111305-silhouette-des-femmes` → « silhouette des femmes » */
|
|
200
|
+
const forkName = (id: string): string => {
|
|
201
|
+
const words = id.replace(/^\d{8}-\d{6}-/, '').split('-')
|
|
202
|
+
return words.length > 4 ? `${words.slice(0, 4).join(' ')}…` : words.join(' ')
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/** « 3 of 5 views waiting for you »: the views of the version his answer goes to that have no answer yet */
|
|
206
|
+
const Waiting = observer(({ card }: { card: ThreadSt }) => {
|
|
207
|
+
const w = card.waitingViews
|
|
208
|
+
if (w === null) return null
|
|
209
|
+
return (
|
|
210
|
+
<span className={`rv-waiting${w.waiting === 0 ? ' done' : ''}`} title="a view is answered by OK, fix or no on it (a choice: scored or picked), or by the verdict; a note alone goes with the verdict">
|
|
211
|
+
{w.waiting} of {w.of} view{w.of > 1 ? 's' : ''} waiting for you
|
|
212
|
+
</span>
|
|
213
|
+
)
|
|
214
|
+
})
|
|
215
|
+
|
|
216
|
+
const ANSWER_GLYPH: Record<ViewMark['answer'], string> = { none: '', approved: '✓', 'approved-with-fix': '⚒', rejected: '✕', archived: '▤', scored: '★', picked: '✓', sent: '' }
|
|
217
|
+
|
|
218
|
+
/** the minimap: every version as a pill, the one his answer goes to ringed, under it one mark per view coloured by his
|
|
219
|
+
* answer (none yet, OK, fix, no), each answer and reply as a dot; a click shows it. Beside the cells as a strip
|
|
220
|
+
* (`col`), or one row under the card's title on a phone and on top of the contents (`row`) */
|
|
221
|
+
export const Minimap = observer(({ rv, card, dir }: { rv: ReviewSt; card: ThreadSt; dir: 'col' | 'row' }) => {
|
|
222
|
+
const target = card.head?.id
|
|
223
|
+
const marks = card.viewMarks
|
|
224
|
+
return (
|
|
225
|
+
<nav className={`rv-mini ${dir}`} aria-label="the card's versions, the views of the one you answer, the answers">
|
|
226
|
+
{dir === 'col' ? <button className="rv-miniopen" title="every item of the card" onMouseDown={keepFocus} onClick={() => rv.toggleRail()}>☰</button> : null}
|
|
227
|
+
{dir === 'row' && rv.phone.on ? <Waiting card={card} /> : null}
|
|
228
|
+
{card.contents.filter((e) => e.kind !== 'view').map((e) => (
|
|
229
|
+
<span key={e.key} className="rv-minigroup">
|
|
230
|
+
<button className={`rv-minientry k-${e.kind}${e.cell === target && e.kind === 'version' ? ' head' : ''}${e.tone ? ` ${e.tone}` : ''}`} title={e.label} onMouseDown={keepFocus} onClick={() => card.reveal(e.cell)}>
|
|
231
|
+
{e.kind === 'version' ? e.badge : ''}
|
|
232
|
+
</button>
|
|
233
|
+
{e.kind === 'version' && e.cell === target && marks.length > 0 ? (
|
|
234
|
+
<span className="rv-minimarks">
|
|
235
|
+
{marks.map((m) => (
|
|
236
|
+
<button key={m.view} className={`rv-minimark a-${m.answer}${m.noted ? ' noted' : ''}`} title={`${m.tag}: ${m.answer === 'none' ? 'waiting for you' : m.answer}${m.noted ? ', a draft note on it' : ''}`}
|
|
237
|
+
onMouseDown={keepFocus} onClick={() => card.reveal(e.cell, m.view)}>
|
|
238
|
+
{m.tag.split('.')[1]}{ANSWER_GLYPH[m.answer] ? <small>{ANSWER_GLYPH[m.answer]}</small> : null}
|
|
239
|
+
</button>
|
|
240
|
+
))}
|
|
241
|
+
</span>
|
|
242
|
+
) : null}
|
|
243
|
+
</span>
|
|
244
|
+
))}
|
|
245
|
+
</nav>
|
|
246
|
+
)
|
|
247
|
+
})
|
|
248
|
+
|
|
249
|
+
/** his answer, pinned under the cells: what goes with it (his notes, reactions, pick, each a click away), one word, then
|
|
250
|
+
* the verdicts and « reply ». A verdict sends the word with his notes; a reply sends the word alone (⌘Enter) */
|
|
251
|
+
const Composer = observer(({ rv, card }: { rv: ReviewSt; card: ThreadSt }) => {
|
|
252
|
+
const v = card.data
|
|
253
|
+
if (!v) return null
|
|
254
|
+
const d = card.draft
|
|
255
|
+
const h = card.head
|
|
256
|
+
const n = h?.kind === 'version' ? h.n : null
|
|
257
|
+
const views = card.headItem?.views ?? []
|
|
258
|
+
const reactions = card.outgoingReactions
|
|
259
|
+
const verdicts = card.takesVerdict
|
|
260
|
+
const sent = h?.kind === 'version' ? card.verdictsOn(h.id).findLast((x) => x.current)?.verdict : undefined
|
|
261
|
+
const newest = card.newest
|
|
262
|
+
return (
|
|
263
|
+
<div className="rv-composer">
|
|
264
|
+
{card.draftOn !== null && !card.keptOn && newest?.kind === 'version' && n !== null ? (
|
|
265
|
+
<div className="rv-moved" role="status">
|
|
266
|
+
<span>your draft is on v{n}; v{newest.n} landed while you wrote</span>
|
|
267
|
+
<button className="primary" onClick={() => card.moveDraft()}>move it to v{newest.n}</button>
|
|
268
|
+
<button onClick={() => card.keepDraftOn()}>keep it on v{n}</button>
|
|
269
|
+
</div>
|
|
270
|
+
) : null}
|
|
271
|
+
<div className="rv-goes">
|
|
272
|
+
<span className="rv-dim">{verdicts ? `your answer goes to v${n}` : h?.kind === 'version' ? 'a draft card: a word goes in a reply' : 'your reply goes to this item'}</span>
|
|
273
|
+
{v.lane ? <LaneTag lane={v.lane} /> : null}
|
|
274
|
+
{rv.phone.on ? null : <Listeners rv={rv} heads={[{ lane: v.lane, session: v.origin.by === 'agent' ? v.origin.session : undefined }]} />}
|
|
275
|
+
{d.pick !== undefined && n !== null ? <button className="rv-chip re-approved" onClick={() => card.reveal(h?.id ?? v.head, d.pick)}>✓ picked {viewTag(n, d.pick)} {viewName(views[d.pick], d.pick)}</button> : null}
|
|
276
|
+
{d.rects.length > 0 ? <button className="rv-chip rect" title="your draft notes: the verdict sends them" onClick={() => card.reveal(h?.id ?? v.head, d.rects[0]?.view ?? 0)}>⬚ {d.rects.length} draft note{d.rects.length > 1 ? 's' : ''}, sent with your verdict</button> : null}
|
|
277
|
+
{reactions.length > 0 ? <button className="rv-chip" onClick={() => card.reveal(h?.id ?? v.head, reactions[0]?.view)}>{reactions.length} reaction{reactions.length > 1 ? 's' : ''}</button> : null}
|
|
278
|
+
{card.dirty ? <button className="ghost rv-chip" title="drop the draft: your notes and your word" onClick={() => card.dropDraft()}>clear</button> : null}
|
|
279
|
+
</div>
|
|
280
|
+
<AutoText className="rv-reply" placeholder={rv.phone.on ? 'your word' : verdicts ? 'your word: a verdict sends it with your notes, ⌘Enter sends it alone as a reply' : 'your word (⌘Enter sends it)'} value={d.comment}
|
|
281
|
+
onText={(t) => card.setComment(t)}
|
|
282
|
+
onKeyDown={(e) => {
|
|
283
|
+
if (e.key === 'Enter' && (e.metaKey || e.ctrlKey)) {
|
|
284
|
+
e.preventDefault()
|
|
285
|
+
void card.sendReply()
|
|
286
|
+
} else if (e.key === 'Escape') e.currentTarget.blur()
|
|
287
|
+
}} />
|
|
288
|
+
<div className="rv-acts">
|
|
289
|
+
{verdicts
|
|
290
|
+
? VERDICTS.map((x) => (
|
|
291
|
+
<button key={x.status} className={`rv-verdict ${toneOf(x.status)}${sent === x.status ? ' chosen' : ''}`} disabled={card.busy} onClick={() => void card.submit(x.status)} title={`${x.label} (${x.key})`}>
|
|
292
|
+
{rv.phone.on ? x.short : <><span className="rv-vglyph">{x.glyph}</span> {x.short} ({x.key})</>}
|
|
293
|
+
</button>
|
|
294
|
+
))
|
|
295
|
+
: null}
|
|
296
|
+
<span className="sp" />
|
|
297
|
+
<button className="primary rv-send" disabled={!d.comment.trim() || card.busy} title="send your word alone, as a reply (⌘Enter)" onClick={() => void card.sendReply()}>Reply</button>
|
|
298
|
+
</div>
|
|
299
|
+
</div>
|
|
300
|
+
)
|
|
301
|
+
})
|