rvlib-shipkit 2.20.0 → 2.22.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 +35 -0
- package/package.json +1 -1
- package/src/asks/asks-queue.ts +8 -7
- package/src/assets/kits/identity-kit.ts +158 -2
- package/src/checks/SK004-gitignore-policy.check.ts +6 -3
- package/src/cli/cmd_Bump.ts +3 -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_Rec.ts +349 -0
- package/src/cli/cmd_Releases.ts +42 -3
- package/src/cli/cmd_Review.ts +22 -13
- package/src/cli/cmd_Secret.ts +10 -3
- package/src/cli/cmd_Sign.ts +24 -0
- package/src/cli/cmd_Social.ts +57 -8
- package/src/cli/cmd_Sound.ts +17 -4
- package/src/cli/cmd_Trailer.ts +67 -1
- package/src/cli/family-pages.ts +1 -0
- package/src/cli/registry.ts +6 -1
- package/src/collections/collection-types.ts +1 -1
- package/src/collections/review.ts +23 -4
- package/src/core/agent-spawn.ts +4 -17
- package/src/core/code-lines.ts +49 -0
- package/src/core/discover-checks.ts +27 -3
- package/src/core/hard-reset.ts +34 -0
- package/src/core/layout.ts +6 -0
- package/src/core/raw-access.ts +3 -13
- package/src/core/throwaway-worktree.ts +72 -0
- package/src/home/app-sign.ts +98 -0
- package/src/home/gui-app/ShipkitGui.swift +35 -0
- package/src/home/gui-app.ts +31 -11
- package/src/home/home-routes.ts +6 -0
- package/src/home/pm-switch.ts +112 -0
- package/src/home/serve-web.ts +1 -1
- package/src/identities/identities.ts +17 -6
- package/src/media-kinds.ts +5 -3
- package/src/media-store/forget.ts +54 -0
- package/src/media-store/put.ts +4 -3
- package/src/media-store/space.ts +63 -24
- package/src/messages/brief.ts +3 -3
- package/src/messages/score.ts +2 -0
- package/src/recordings/delete.ts +19 -0
- package/src/recordings/edit.ts +231 -0
- package/src/recordings/load.ts +37 -0
- package/src/recordings/marks-draw.ts +111 -0
- package/src/recordings/marks-png.ts +25 -0
- package/src/recordings/marks.ts +138 -0
- package/src/recordings/media-kind.ts +67 -0
- package/src/recordings/model.ts +170 -0
- package/src/recordings/open.ts +33 -0
- package/src/recordings/place.ts +89 -0
- package/src/recordings/presets.ts +99 -0
- package/src/recordings/recorder-app/Capture.swift +510 -0
- package/src/recordings/recorder-app/Clip.swift +107 -0
- package/src/recordings/recorder-app/Editor.swift +39 -0
- package/src/recordings/recorder-app/Tray.swift +298 -0
- package/src/recordings/recorder-app/main.swift +859 -0
- package/src/recordings/recorder-app.ts +46 -0
- package/src/recordings/recorder.shipkit.ts +11 -0
- package/src/recordings/routes.ts +140 -0
- package/src/recordings/run-recorder.ts +40 -0
- package/src/recordings/share.ts +107 -0
- package/src/recordings/take.ts +146 -0
- package/src/recordings/view.ts +40 -0
- package/src/release/gate-checkout.ts +74 -0
- package/src/release/release-scope.ts +35 -26
- package/src/release/run-bump.ts +79 -37
- package/src/release/run-release.ts +67 -53
- package/src/releases/add.ts +38 -5
- package/src/releases/before.ts +31 -0
- package/src/releases/from-card.ts +105 -20
- package/src/releases/model.ts +100 -18
- package/src/releases/pictures.ts +29 -8
- package/src/repo-config.ts +7 -3
- 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 +20 -0
- package/src/review/trailer-model.ts +67 -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/secrets/manager.ts +18 -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 +23 -5
- package/src/serve/hub-app/home.html +1 -0
- package/src/serve/hub-app/hub-app.tsx +8 -1
- package/src/serve/hub-app/icons.tsx +2 -0
- package/src/serve/hub-app/palette-st.ts +1 -0
- package/src/serve/hub-app/project-list.css +7 -2
- package/src/serve/hub-app/project-list.tsx +10 -0
- package/src/serve/hub-app/projects-svc.ts +17 -7
- package/src/serve/hub-app/recordings-st.ts +641 -0
- package/src/serve/hub-app/recordings-view.tsx +504 -0
- package/src/serve/hub-app/recordings.css +82 -0
- 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 +16 -11
- 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 +32 -6
- package/src/serve/hub-app/review/trailer-st.ts +184 -8
- package/src/serve/hub-app/review/trailer-timeline.tsx +39 -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 +90 -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/post-card.tsx +31 -3
- package/src/serve/hub-app/social/social-model.ts +6 -0
- package/src/serve/hub-app/social/social-st.ts +50 -1
- package/src/serve/hub-app/social.css +12 -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/shipkit.ts +2 -2
- package/src/shot/box.ts +49 -22
- package/src/shot/browser-slot.ts +13 -3
- package/src/shot/client.ts +1 -1
- package/src/shot/film-box.ts +193 -117
- package/src/shot/shooter.ts +20 -8
- package/src/smoke/run-smoke.ts +8 -6
- package/src/social/compose.ts +14 -0
- 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 +42 -9
- package/src/social/publish/index.ts +27 -10
- package/src/social/publish/secret.ts +12 -4
- package/src/social/release-card.ts +69 -0
- package/src/social/release-stage.ts +173 -30
- package/src/social/routes.ts +7 -1
- package/src/social/stage.ts +45 -22
- package/src/trailer/bed.ts +111 -0
- package/src/trailer/build.ts +81 -38
- package/src/trailer/ffmpeg.ts +14 -0
- package/src/trailer/grammar.ts +32 -4
- package/src/trailer/graph.ts +12 -1
- package/src/trailer/look.ts +7 -0
- 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
- package/src/veille/chrome.ts +6 -3
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
// a change written from a review card (wiki tools/shipkit/review.md, A change for the release): the card carries its
|
|
2
|
-
// public line (`--changelog "<category>: <line>"`), and the owner's approval adds it to next.md with the card's
|
|
3
|
-
//
|
|
4
|
-
//
|
|
2
|
+
// public line (`--changelog "<category>: <line>"`), and the owner's approval adds it to next.md with the card's media
|
|
3
|
+
// (a pair of images as its after and its before, two stills, never a video; a clip as it is, else its image), kept
|
|
4
|
+
// private in the Space. The card named is the thread's first version, so a later version approved again replaces its
|
|
5
|
+
// change instead of adding a second
|
|
5
6
|
import { ensureLocal } from '../review/media-read.ts'
|
|
6
7
|
import { isApproved, verdictOf, type Item, type ReviewItem } from '../review/model.ts'
|
|
7
8
|
import { stageablesOf } from '../review/stage-card.ts'
|
|
8
|
-
import { readItem, storeDir } from '../review/store.ts'
|
|
9
|
+
import { readAll, readItem, storeDir } from '../review/store.ts'
|
|
10
|
+
import { threadOfItem, threadsOf } from '../review/threads.ts'
|
|
9
11
|
import { commitPaths } from '../social/writes.ts'
|
|
10
|
-
import {
|
|
12
|
+
import { idleBefore } from './before.ts'
|
|
13
|
+
import type { PostRating } from '../identities/rating.ts'
|
|
14
|
+
import { changesOf, isClip, NEXT, ratingOf, type Change, type Picture, type Shot } from './model.ts'
|
|
11
15
|
import { keepPicture } from './pictures.ts'
|
|
12
|
-
import { addChange, readRelease, undeclaredReleases } from './store.ts'
|
|
16
|
+
import { addChange, readRelease, undeclaredReleases, writeRelease } from './store.ts'
|
|
13
17
|
|
|
14
18
|
/** the versions of a card, newest first, following `supersedes` */
|
|
15
19
|
export function versionsOf(dir: string, x: ReviewItem): Item[] {
|
|
@@ -23,30 +27,65 @@ export function versionsOf(dir: string, x: ReviewItem): Item[] {
|
|
|
23
27
|
return out
|
|
24
28
|
}
|
|
25
29
|
|
|
26
|
-
/**
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
+
/** a card's first media is a pair of images, the one shape that lends a change a before */
|
|
31
|
+
const isImagePair = (i: Item): boolean => stageablesOf(i, 1).some((s) => s.side === 'before' && s.kind === 'image')
|
|
32
|
+
|
|
33
|
+
/** the files that stand for the change: a pair of images as its after and its before (null when blank or the same as
|
|
34
|
+
* the after, `idle` says which), a clip or a pair of clips' after as it is, else the first image */
|
|
35
|
+
async function mediaOf(dir: string, i: Item): Promise<{ after: string; before: string | null; idle: 'blank' | 'same' | null } | null> {
|
|
36
|
+
const all = stageablesOf(i, 1)
|
|
37
|
+
const pick = all.find((s) => s.side !== 'before' && s.side !== 'wipe')
|
|
38
|
+
if (!pick) return null
|
|
39
|
+
const after = await ensureLocal(dir, i.id, pick.file)
|
|
40
|
+
if (!after) return null
|
|
41
|
+
const b = pick.side === 'after' && pick.kind === 'image' ? all.find((s) => s.side === 'before' && s.view === pick.view) : undefined
|
|
42
|
+
const before = b ? await ensureLocal(dir, i.id, b.file) : null
|
|
43
|
+
if (!before) return { after, before: null, idle: null }
|
|
44
|
+
const idle = await idleBefore(before, after)
|
|
45
|
+
return { after, before: idle ? null : before, idle }
|
|
30
46
|
}
|
|
31
47
|
|
|
32
|
-
/**
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
48
|
+
/** a card's media kept private in the Space, as one shot of a change rated `rating` (null: unrated) */
|
|
49
|
+
async function keptMedia(root: string, i: Item, alt: string, rating: PostRating | null): Promise<{ shot: Shot | null; idle: 'blank' | 'same' | null }> {
|
|
50
|
+
const m = await mediaOf(storeDir(root), i)
|
|
51
|
+
if (!m) return { shot: null, idle: null }
|
|
52
|
+
const picture: Picture = { url: await keepPicture(root, m.after), alt, rating }
|
|
53
|
+
return { shot: { picture, before: m.before ? { url: await keepPicture(root, m.before), alt, rating } : null }, idle: m.idle }
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** the rating a card's media lands with: its changelog line's `--rating`, else unrated */
|
|
57
|
+
const cardRating = (root: string, x: ReviewItem): PostRating | null => versionsOf(storeDir(root), x).find((v) => v.changelog)?.changelog?.rating ?? null
|
|
58
|
+
|
|
59
|
+
/** what a card lends a change whatever its line: its newest version's shot kept private, rated `rating` when a hand
|
|
60
|
+
* gives one, else as the card says, the thread's first id, its commit */
|
|
61
|
+
export async function cardParts(root: string, x: ReviewItem, alt: string, rating: PostRating | null = null): Promise<{ shot: Shot | null; card: string; commit: string | null }> {
|
|
62
|
+
const { shot } = await keptMedia(root, x.item, alt, rating ?? cardRating(root, x))
|
|
63
|
+
return { shot, card: versionsOf(storeDir(root), x).at(-1)!.id, commit: x.item.commit ?? null }
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** a change's shots once a card's shot comes in: it takes the place of the shot it reads the same rating as, the others
|
|
67
|
+
* stay (a safe retake beside an nsfw card, by hand); an unrated card picture whose file did not change keeps the
|
|
68
|
+
* rating it had */
|
|
69
|
+
export function withShot(had: readonly Shot[], shot: Shot | null): Shot[] {
|
|
70
|
+
if (!shot) return [...had]
|
|
71
|
+
const same = had.find((s) => s.picture.url === shot.picture.url)
|
|
72
|
+
const rated: Shot =
|
|
73
|
+
shot.picture.rating == null && same?.picture.rating != null
|
|
74
|
+
? { picture: { ...shot.picture, rating: same.picture.rating }, before: shot.before && { ...shot.before, rating: shot.before.rating ?? (shot.before.url === same.before?.url ? same.before.rating : null) } }
|
|
75
|
+
: shot
|
|
76
|
+
return [rated, ...had.filter((s) => s.picture.url !== rated.picture.url && ratingOf(s.picture) !== ratingOf(rated.picture))]
|
|
39
77
|
}
|
|
40
78
|
|
|
41
79
|
/** the change a card adds to next: its line and its parts; null for a card with no changelog line */
|
|
42
80
|
export async function changeOfCard(root: string, x: ReviewItem): Promise<{ category: string; change: Change } | null> {
|
|
43
81
|
const line = versionsOf(storeDir(root), x).find((v) => v.changelog)?.changelog
|
|
44
82
|
if (!line) return null
|
|
45
|
-
|
|
83
|
+
const { shot, card, commit } = await cardParts(root, x, line.line)
|
|
84
|
+
return { category: line.category, change: { title: line.line, text: '', bullets: [], shots: shot ? [shot] : [], card, commit, weight: null } }
|
|
46
85
|
}
|
|
47
86
|
|
|
48
87
|
/** after the owner's verdict: an approved card with a changelog line goes into next.md, committed; the next.md path,
|
|
49
|
-
* or null when the verdict adds nothing. The description and
|
|
88
|
+
* or null when the verdict adds nothing. The description, bullets and weight a hand wrote for that change stay. A repo that
|
|
50
89
|
* declares no release files throws, so the card's thread says why its line went nowhere */
|
|
51
90
|
export async function onVerdict(root: string, id: string): Promise<string | null> {
|
|
52
91
|
const x = readItem(storeDir(root), id)
|
|
@@ -59,8 +98,54 @@ export async function onVerdict(root: string, id: string): Promise<string | null
|
|
|
59
98
|
const had = readRelease(root, NEXT)
|
|
60
99
|
?.categories.flatMap((k) => k.changes)
|
|
61
100
|
.find((ch) => ch.card === c.change.card)
|
|
62
|
-
const change = had ? { ...c.change, text: had.text, bullets: had.bullets } : c.change
|
|
101
|
+
const change = had ? { ...c.change, text: had.text, bullets: had.bullets, weight: had.weight, shots: withShot(had.shots, c.change.shots[0] ?? null) } : c.change
|
|
63
102
|
const { file } = addChange(root, c.category, change)
|
|
64
103
|
commitPaths([file], `releases: next takes the change of the card ${c.change.card}`)
|
|
65
104
|
return file
|
|
66
105
|
}
|
|
106
|
+
|
|
107
|
+
/** the version of a card's thread a change stands for: its newest approved one, else its newest */
|
|
108
|
+
function approvedOf(dir: string, id: string): ReviewItem | null {
|
|
109
|
+
const t = threadOfItem(id, threadsOf(readAll(dir).items))
|
|
110
|
+
if (!t) return readItem(dir, id)
|
|
111
|
+
return t.versions.find((v) => isApproved(verdictOf(v)?.status ?? 'rejected')) ?? t.head
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/** what a refresh did to one change: its stills, and its before dropped as blank or the same as the after */
|
|
115
|
+
export interface Refreshed {
|
|
116
|
+
title: string
|
|
117
|
+
before: 'kept' | 'blank' | 'same' | 'none'
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/** every change of next.md still showing a pair's wipe (a clip, from a card whose media is two images) takes that
|
|
121
|
+
* card's stills, its after and its before; any other picture stays, a retake by hand included. The changes moved, and
|
|
122
|
+
* the file written and committed unless `dry` (null when nothing moved) */
|
|
123
|
+
export async function refreshFromCards(root: string, o: { dry?: boolean } = {}): Promise<{ file: string | null; moved: Refreshed[] }> {
|
|
124
|
+
const why = await undeclaredReleases(root)
|
|
125
|
+
if (why) throw new Error(why)
|
|
126
|
+
const next = readRelease(root, NEXT)
|
|
127
|
+
if (!next) return { file: null, moved: [] }
|
|
128
|
+
const dir = storeDir(root)
|
|
129
|
+
const done = new Map<Change, Change>()
|
|
130
|
+
const moved: Refreshed[] = []
|
|
131
|
+
for (const ch of changesOf(next)) {
|
|
132
|
+
const wipe = ch.shots.find((s) => isClip(s.picture.url))
|
|
133
|
+
if (ch.card == null || !wipe) continue
|
|
134
|
+
const x = approvedOf(dir, ch.card)
|
|
135
|
+
if (!x) throw new Error(`"${ch.title}": its card ${ch.card} is not in the store`)
|
|
136
|
+
if (!isImagePair(x.item)) continue
|
|
137
|
+
if (o.dry) {
|
|
138
|
+
moved.push({ title: ch.title, before: 'none' })
|
|
139
|
+
continue
|
|
140
|
+
}
|
|
141
|
+
// the stills show what the wipe showed: its rating stays
|
|
142
|
+
const m = await keptMedia(root, x.item, wipe.picture.alt, wipe.picture.rating)
|
|
143
|
+
done.set(ch, { ...ch, shots: ch.shots.flatMap((s) => (s !== wipe ? [s] : m.shot ? [m.shot] : [])) })
|
|
144
|
+
moved.push({ title: ch.title, before: m.shot?.before ? 'kept' : (m.idle ?? 'none') })
|
|
145
|
+
}
|
|
146
|
+
if (o.dry || moved.length === 0) return { file: null, moved }
|
|
147
|
+
const release = { ...next, categories: next.categories.map((c) => ({ ...c, changes: c.changes.map((ch) => done.get(ch) ?? ch) })) }
|
|
148
|
+
const file = writeRelease(root, release)
|
|
149
|
+
commitPaths([file], `releases: next shows its cards' stills, not their wipes (${moved.length} changes)`)
|
|
150
|
+
return { file, moved }
|
|
151
|
+
}
|
package/src/releases/model.ts
CHANGED
|
@@ -1,27 +1,57 @@
|
|
|
1
1
|
// a release as one markdown file (wiki tools/shipkit/units.md, The release files): `# <version>: <title>`, its date,
|
|
2
|
-
// `## <category>`, `### <change>`, its description, its
|
|
3
|
-
// comment. `next.md` is the version being filled. No fs: store.ts reads the files, the hub page imports this too.
|
|
4
|
-
// A picture is `space:<key>` (private, signed for the hub) until the release makes it a public URL
|
|
2
|
+
// `## <category>`, `### <change>`, its description, its shots, its bullets, the card it came from and its weight in a
|
|
3
|
+
// hidden comment. `next.md` is the version being filled. No fs: store.ts reads the files, the hub page imports this too.
|
|
4
|
+
// A picture is `space:<key>` (private, signed for the hub) until the release makes it a public URL. Every picture
|
|
5
|
+
// carries its rating, and a venue shows only what its ceiling takes: `shotFor`, the one function every venue calls
|
|
6
|
+
import { POST_RATINGS, takes, type PostRating } from '../identities/rating.ts'
|
|
5
7
|
|
|
6
8
|
export const NEXT = 'next'
|
|
7
9
|
|
|
8
10
|
export type ReleaseKind = 'major' | 'minor' | 'patch'
|
|
9
11
|
|
|
12
|
+
/** how much a change weighs to the people who use it: major, a new capability that changes how they work; feature, a
|
|
13
|
+
* new thing they can do; improvement, a better version of something they had */
|
|
14
|
+
export type ChangeWeight = 'major' | 'feature' | 'improvement'
|
|
15
|
+
|
|
16
|
+
/** THE words and rank of each weight: a reader that shows a weight (a site, a post) shows these, never its own */
|
|
17
|
+
export const WEIGHTS = {
|
|
18
|
+
major: { rank: 3, en: 'Major', fr: 'Majeur' },
|
|
19
|
+
feature: { rank: 2, en: 'New', fr: 'Nouveau' },
|
|
20
|
+
improvement: { rank: 1, en: 'Improved', fr: 'Amélioré' },
|
|
21
|
+
} as const satisfies Record<ChangeWeight, { rank: number; en: string; fr: string }>
|
|
22
|
+
|
|
23
|
+
export const CHANGE_WEIGHTS: readonly ChangeWeight[] = ['major', 'feature', 'improvement']
|
|
24
|
+
export const isChangeWeight = (w: string): w is ChangeWeight => Object.hasOwn(WEIGHTS, w)
|
|
25
|
+
|
|
26
|
+
/** heaviest first, the file's order kept within one weight; an unweighted change (a file older than the field) last */
|
|
27
|
+
export const byWeight = <T extends Pick<Change, 'weight'>>(changes: readonly T[]): T[] => [...changes].sort((a, b) => (b.weight ? WEIGHTS[b.weight].rank : 0) - (a.weight ? WEIGHTS[a.weight].rank : 0))
|
|
28
|
+
|
|
10
29
|
export interface Picture {
|
|
11
30
|
/** `space:<key>` while private, the public URL once released */
|
|
12
31
|
url: string
|
|
13
32
|
alt: string
|
|
33
|
+
/** what it shows; null when unrated, which reads explicit (`ratingOf`) */
|
|
34
|
+
rating: PostRating | null
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** one picture of a change and the still of what it looked like before, `` right under it */
|
|
38
|
+
export interface Shot {
|
|
39
|
+
picture: Picture
|
|
40
|
+
before: Picture | null
|
|
14
41
|
}
|
|
15
42
|
|
|
16
43
|
export interface Change {
|
|
17
44
|
title: string
|
|
18
45
|
/** its description, markdown, empty when the title says it all */
|
|
19
46
|
text: string
|
|
20
|
-
|
|
47
|
+
/** one a rating at most, in the file's order: a safe one for every venue, an nsfw one for those that take it */
|
|
48
|
+
shots: Shot[]
|
|
21
49
|
bullets: string[]
|
|
22
50
|
/** the review card it came from, and the commit that card shows */
|
|
23
51
|
card: string | null
|
|
24
52
|
commit: string | null
|
|
53
|
+
/** null only in a file older than the field, never a default */
|
|
54
|
+
weight: ChangeWeight | null
|
|
25
55
|
}
|
|
26
56
|
|
|
27
57
|
export interface Category {
|
|
@@ -44,6 +74,33 @@ export const SPACE = 'space:'
|
|
|
44
74
|
export const isPrivate = (p: Picture): boolean => p.url.startsWith(SPACE)
|
|
45
75
|
export const spaceKey = (p: Picture): string | null => (isPrivate(p) ? p.url.slice(SPACE.length) : null)
|
|
46
76
|
|
|
77
|
+
/** a change's pictures, each shot's after then its before: what bump makes public and the guard reads */
|
|
78
|
+
export const picturesOf = (ch: Pick<Change, 'shots'>): Picture[] => ch.shots.flatMap((s) => (s.before ? [s.picture, s.before] : [s.picture]))
|
|
79
|
+
|
|
80
|
+
/** a picture's rating as a venue reads it: unrated is explicit, fail closed */
|
|
81
|
+
export const ratingOf = (p: Pick<Picture, 'rating'>): PostRating => p.rating ?? 'explicit'
|
|
82
|
+
|
|
83
|
+
/** what a venue whose ceiling is `ceiling` shows of a change: the shot of the highest rating it takes, its before only
|
|
84
|
+
* when the venue takes that too; null, its words alone. THE function every venue calls, never a filter of its own */
|
|
85
|
+
export function shotFor(ch: Pick<Change, 'shots'>, ceiling: PostRating): Shot | null {
|
|
86
|
+
const rank = (s: Shot): number => POST_RATINGS.indexOf(ratingOf(s.picture))
|
|
87
|
+
const fit = ch.shots.filter((s) => takes(ceiling, ratingOf(s.picture))).sort((a, b) => rank(b) - rank(a))[0]
|
|
88
|
+
if (!fit) return null
|
|
89
|
+
return { picture: fit.picture, before: fit.before && takes(ceiling, ratingOf(fit.before)) ? fit.before : null }
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** the change holds a picture this venue may not show and none it may: the venue says where it is instead */
|
|
93
|
+
export const withheldFrom = (ch: Pick<Change, 'shots'>, ceiling: PostRating): boolean => ch.shots.length > 0 && shotFor(ch, ceiling) == null
|
|
94
|
+
|
|
95
|
+
/** a picture line's title: its rating, a before's `before <rating>`; an unrated one says none */
|
|
96
|
+
const titleOf = (p: Picture, before: boolean): string => {
|
|
97
|
+
const t = [before ? 'before' : '', p.rating ?? ''].filter((w) => w !== '').join(' ')
|
|
98
|
+
return t === '' ? '' : ` "${t}"`
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/** a change's media is a clip (a card's clip), not a still */
|
|
102
|
+
export const isClip = (url: string): boolean => /\.(mp4|webm|mov)(\?|$)/i.test(url)
|
|
103
|
+
|
|
47
104
|
/** where the hub serves a private picture, its key after it */
|
|
48
105
|
export const PICTURE_ROUTE = '/api/releases/picture/'
|
|
49
106
|
/** the hub path a picture shows by: a private one through the hub, a public one as it is */
|
|
@@ -52,8 +109,10 @@ export const pictureRoute = (url: string): string => (url.startsWith(SPACE) ? `$
|
|
|
52
109
|
const VERSION = /^\d+\.\d+\.\d+$/
|
|
53
110
|
const HEAD = /^# (next|\d+\.\d+\.\d+)(?: \((major|minor|patch)\))?(?:: (.*))?$/
|
|
54
111
|
const DATE = /^\d{4}-\d{2}-\d{2}$/
|
|
55
|
-
const PICTURE = /^!\[([^\]]*)\]\((\S+)
|
|
56
|
-
|
|
112
|
+
const PICTURE = /^!\[([^\]]*)\]\((\S+)(?: "([^"]*)")?\)$/
|
|
113
|
+
/** a picture line's title: `<rating>`, `before`, `before <rating>`, or none */
|
|
114
|
+
const TITLE = /^(before)?\s*(safe|mild|explicit)?$/
|
|
115
|
+
const MARK = /^<!--\s*(?:card:\s*(\S+))?\s*(?:commit:\s*([0-9a-f]{7,40}))?\s*(?:weight:\s*(\S+))?\s*-->$/
|
|
57
116
|
const BULLET = /^[-*] (.*)$/
|
|
58
117
|
|
|
59
118
|
export const isVersion = (v: string): boolean => v === NEXT || VERSION.test(v)
|
|
@@ -68,6 +127,7 @@ export function parseRelease(md: string, name = 'release'): Release {
|
|
|
68
127
|
let cat: Category | null = null
|
|
69
128
|
let ch: Change | null = null
|
|
70
129
|
let comment = false
|
|
130
|
+
let pictureAt = -1
|
|
71
131
|
let text: string[] = []
|
|
72
132
|
const close = (): void => {
|
|
73
133
|
if (ch) ch.text = text.join('\n').trim()
|
|
@@ -102,7 +162,7 @@ export function parseRelease(md: string, name = 'release'): Release {
|
|
|
102
162
|
if (line.startsWith('### ')) {
|
|
103
163
|
if (!cat) throw at(i, `a change sits under a "## <category>": ${line}`)
|
|
104
164
|
close()
|
|
105
|
-
ch = { title: line.slice(4).trim(), text: '',
|
|
165
|
+
ch = { title: line.slice(4).trim(), text: '', shots: [], bullets: [], card: null, commit: null, weight: null }
|
|
106
166
|
cat.changes.push(ch)
|
|
107
167
|
continue
|
|
108
168
|
}
|
|
@@ -120,16 +180,30 @@ export function parseRelease(md: string, name = 'release'): Release {
|
|
|
120
180
|
throw at(i, `under "## ${cat.name}" every line belongs to a "### <change>": ${line}`)
|
|
121
181
|
}
|
|
122
182
|
const m = MARK.exec(line)
|
|
123
|
-
if (m && (m[1] || m[2])) {
|
|
183
|
+
if (m && (m[1] || m[2] || m[3])) {
|
|
184
|
+
const w = m[3]
|
|
185
|
+
if (w !== undefined && !isChangeWeight(w)) throw at(i, `"${ch.title}": a weight is ${CHANGE_WEIGHTS.join(', ')}, not ${w}`)
|
|
124
186
|
ch.card = m[1] ?? ch.card
|
|
125
187
|
ch.commit = m[2] ?? ch.commit
|
|
188
|
+
ch.weight = w ?? ch.weight
|
|
126
189
|
continue
|
|
127
190
|
}
|
|
128
|
-
if (line.startsWith('<!--')) throw at(i, `a hidden line of a change is "<!-- card: <id> commit: <sha> -->": ${line}`)
|
|
191
|
+
if (line.startsWith('<!--')) throw at(i, `a hidden line of a change is "<!-- card: <id> commit: <sha> weight: <${CHANGE_WEIGHTS.join('|')}> -->", each part optional, in that order: ${line}`)
|
|
129
192
|
const p = PICTURE.exec(line)
|
|
130
193
|
if (p) {
|
|
131
|
-
|
|
132
|
-
ch.picture
|
|
194
|
+
const t = TITLE.exec((p[3] ?? '').trim())
|
|
195
|
+
if (!t) throw at(i, `"${ch.title}": a picture's title is its rating (safe, mild, explicit), a before's "before <rating>": "${p[3]}"`)
|
|
196
|
+
const pic: Picture = { alt: p[1]!.trim(), url: p[2]!, rating: (t[2] as PostRating | undefined) ?? null }
|
|
197
|
+
const last = ch.shots.at(-1)
|
|
198
|
+
if (t[1]) {
|
|
199
|
+
if (pictureAt !== i - 1 || !last || last.before) throw at(i, `"${ch.title}": one before a picture, on the line right under it`)
|
|
200
|
+
if (isClip(pic.url)) throw at(i, `"${ch.title}": a before is a still (png, jpg, webp), not a clip`)
|
|
201
|
+
last.before = pic
|
|
202
|
+
continue
|
|
203
|
+
}
|
|
204
|
+
if (ch.shots.some((s) => ratingOf(s.picture) === ratingOf(pic))) throw at(i, `"${ch.title}" has one picture a rating, and two read ${ratingOf(pic)} (an unrated one reads explicit)`)
|
|
205
|
+
ch.shots.push({ picture: pic, before: null })
|
|
206
|
+
pictureAt = i
|
|
133
207
|
continue
|
|
134
208
|
}
|
|
135
209
|
const b = BULLET.exec(line)
|
|
@@ -155,9 +229,12 @@ export function renderRelease(r: Release): string {
|
|
|
155
229
|
out.push('', `## ${c.name}`)
|
|
156
230
|
for (const ch of c.changes) {
|
|
157
231
|
out.push('', `### ${ch.title}`)
|
|
158
|
-
if (ch.card || ch.commit) out.push(`<!--${ch.card ? ` card: ${ch.card}` : ''}${ch.commit ? ` commit: ${ch.commit}` : ''} -->`)
|
|
232
|
+
if (ch.card || ch.commit || ch.weight) out.push(`<!--${ch.card ? ` card: ${ch.card}` : ''}${ch.commit ? ` commit: ${ch.commit}` : ''}${ch.weight ? ` weight: ${ch.weight}` : ''} -->`)
|
|
159
233
|
if (ch.text) out.push(ch.text)
|
|
160
|
-
|
|
234
|
+
for (const s of ch.shots) {
|
|
235
|
+
out.push(`})`)
|
|
236
|
+
if (s.before) out.push(`})`)
|
|
237
|
+
}
|
|
161
238
|
for (const b of ch.bullets) out.push(`- ${b}`)
|
|
162
239
|
}
|
|
163
240
|
}
|
|
@@ -191,13 +268,16 @@ export function upsertChange(r: Release, category: string, change: Change): Rele
|
|
|
191
268
|
|
|
192
269
|
export const changesOf = (r: Release): Change[] => r.categories.flatMap((c) => c.changes)
|
|
193
270
|
|
|
271
|
+
/** a change's key on a page: its card, else its title */
|
|
272
|
+
export const changeKey = (ch: Pick<Change, 'card' | 'title'>): string => `${ch.card ?? ''}${ch.title}`
|
|
273
|
+
|
|
194
274
|
/** a card id's words: its slug, made from the card's title, which a public repo's file carries in its hidden comment */
|
|
195
275
|
const cardWords = (id: string | null): string => (id ?? '').replace(/^\d{8}-\d{6}-?/, '').replace(/-/g, ' ')
|
|
196
276
|
|
|
197
277
|
/** every word of a release that a stranger reads, each a text the repo's guard runs on. The card ids' slugs only when
|
|
198
278
|
* the file itself is public (a declared public repo): the notes, the post and the page never show the hidden comment */
|
|
199
279
|
export const publicTexts = (r: Release, o: { fileIsPublic?: boolean } = {}): string[] =>
|
|
200
|
-
[r.title, ...r.categories.flatMap((c) => [c.name, ...c.changes.flatMap((ch) => [ch.title, ch.text, ch.
|
|
280
|
+
[r.title, ...r.categories.flatMap((c) => [c.name, ...c.changes.flatMap((ch) => [ch.title, ch.text, ...picturesOf(ch).map((p) => p.alt), ...ch.bullets, o.fileIsPublic ? cardWords(ch.card) : ''])])].filter((t) => t.trim() !== '')
|
|
201
281
|
|
|
202
282
|
/** next named as a version, dated */
|
|
203
283
|
export function promoted(r: Release, version: string, date: string): Release {
|
|
@@ -215,15 +295,17 @@ const newer = (a: string, b: string): number => {
|
|
|
215
295
|
/** versions newest first, next on top */
|
|
216
296
|
export const byVersion = (a: string, b: string): number => (a === NEXT ? -1 : b === NEXT ? 1 : newer(a, b))
|
|
217
297
|
|
|
218
|
-
/** one release as notes: each category a `### `, each change a bullet of its title and description,
|
|
219
|
-
* own bullets under it. A GitHub release, the staged
|
|
220
|
-
|
|
298
|
+
/** one release as notes: each category a `### `, each change a bullet of its title and description, the picture the
|
|
299
|
+
* ceiling takes (a clip as a link: markdown shows no video), its own bullets under it. A GitHub release, the staged
|
|
300
|
+
* post and CHANGELOG.md read this, all public: safe */
|
|
301
|
+
export function notesOf(r: Release, ceiling: PostRating = 'safe'): string {
|
|
221
302
|
const out: string[] = []
|
|
222
303
|
for (const c of r.categories) {
|
|
223
304
|
out.push(`### ${c.name}`, '')
|
|
224
305
|
for (const ch of c.changes) {
|
|
225
306
|
out.push(`- **${ch.title}**${ch.text ? `: ${ch.text.replace(/\s*\n\s*/g, ' ')}` : ''}`)
|
|
226
|
-
|
|
307
|
+
const pic = shotFor(ch, ceiling)?.picture
|
|
308
|
+
if (pic && !isPrivate(pic)) out.push(isClip(pic.url) ? ` [▶ ${pic.alt}](${pic.url})` : ` `)
|
|
227
309
|
for (const b of ch.bullets) out.push(` - ${b}`)
|
|
228
310
|
}
|
|
229
311
|
out.push('')
|
package/src/releases/pictures.ts
CHANGED
|
@@ -9,7 +9,7 @@ import { shaOf, shaOfKey } from '../media-store/content.ts'
|
|
|
9
9
|
import { linkMedia, putMedia } from '../media-store/put.ts'
|
|
10
10
|
import { stripCopy } from '../social/strip.ts'
|
|
11
11
|
import { guardWith, type SocialUnit } from '../social/unit.ts'
|
|
12
|
-
import { isPrivate, SPACE, spaceKey, type Release } from './model.ts'
|
|
12
|
+
import { isPrivate, ratingOf, SPACE, spaceKey, type Picture, type Release } from './model.ts'
|
|
13
13
|
|
|
14
14
|
/** the media store's label of every release picture, private and public */
|
|
15
15
|
export const RELEASE_KIND = 'release'
|
|
@@ -48,6 +48,21 @@ export async function pictureFile(root: string, key: string): Promise<string> {
|
|
|
48
48
|
return at
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
/** the local file of any release picture: a private one's (`pictureFile`), a public one's scratch copy by its sha,
|
|
52
|
+
* else fetched once into it */
|
|
53
|
+
export async function localPicture(root: string, url: string): Promise<string> {
|
|
54
|
+
if (url.startsWith(SPACE)) return pictureFile(root, url.slice(SPACE.length))
|
|
55
|
+
const m = /([0-9a-f]{64})(\.[a-z0-9]+)(?:\?|$)/i.exec(url)
|
|
56
|
+
if (!m) throw new Error(`${url}: no release picture (its name is its sha)`)
|
|
57
|
+
const at = copyOf(root, m[1]!.toLowerCase(), m[2]!.toLowerCase())
|
|
58
|
+
if (existsSync(at)) return at
|
|
59
|
+
const r = await fetch(url)
|
|
60
|
+
if (!r.ok) throw new Error(`${url}: answered ${r.status}`)
|
|
61
|
+
mkdirSync(picturesDir(root), { recursive: true })
|
|
62
|
+
writeFileSync(at, Buffer.from(await r.arrayBuffer()))
|
|
63
|
+
return at
|
|
64
|
+
}
|
|
65
|
+
|
|
51
66
|
/** a signed link for the hub to show a private picture, or its public URL as it is */
|
|
52
67
|
export async function shownUrl(url: string): Promise<string> {
|
|
53
68
|
const key = url.startsWith(SPACE) ? url.slice(SPACE.length) : null
|
|
@@ -57,13 +72,16 @@ export async function shownUrl(url: string): Promise<string> {
|
|
|
57
72
|
/** every private picture of a release made public, each after the repo's guard read its bytes: the release with its
|
|
58
73
|
* public URLs. A refusal throws naming the change, and nothing is made public before every picture passed */
|
|
59
74
|
export async function publishPictures(root: string, r: Release, unit: SocialUnit | null): Promise<{ release: Release; published: number }> {
|
|
60
|
-
|
|
75
|
+
// only a safe picture gets a public URL: an nsfw one goes to its venues as a file, so it stays private
|
|
76
|
+
const todo = r.categories
|
|
77
|
+
.flatMap((c) => c.changes)
|
|
78
|
+
.flatMap((ch) => ch.shots.flatMap((s) => [s.picture, s.before].filter((p): p is Picture => p != null && isPrivate(p) && ratingOf(p) === 'safe').map((p) => ({ ch, p, before: p === s.before }))))
|
|
61
79
|
const files = new Map<string, string>()
|
|
62
|
-
for (const ch of todo) {
|
|
63
|
-
const key = spaceKey(
|
|
80
|
+
for (const { ch, p, before } of todo) {
|
|
81
|
+
const key = spaceKey(p)!
|
|
64
82
|
const file = await pictureFile(root, key)
|
|
65
|
-
const problems = guardWith(unit, { title: ch.title, alt:
|
|
66
|
-
if (problems.length > 0) throw new Error(`"${ch.title}": the repo's guard refuses its picture: ${problems.join('; ')}`)
|
|
83
|
+
const problems = guardWith(unit, { title: ch.title, alt: p.alt, files: [file] })
|
|
84
|
+
if (problems.length > 0) throw new Error(`"${ch.title}": the repo's guard refuses its ${before ? 'before' : 'picture'}: ${problems.join('; ')}`)
|
|
67
85
|
files.set(key, file)
|
|
68
86
|
}
|
|
69
87
|
const urls = new Map<string, string>()
|
|
@@ -80,8 +98,11 @@ export async function publishPictures(root: string, r: Release, unit: SocialUnit
|
|
|
80
98
|
categories: r.categories.map((c) => ({
|
|
81
99
|
...c,
|
|
82
100
|
changes: c.changes.map((ch) => {
|
|
83
|
-
const
|
|
84
|
-
|
|
101
|
+
const pub = (p: Picture | null): Picture | null => {
|
|
102
|
+
const key = p ? spaceKey(p) : null
|
|
103
|
+
return key && urls.has(key) ? { ...p!, url: urls.get(key)! } : p
|
|
104
|
+
}
|
|
105
|
+
return { ...ch, shots: ch.shots.map((s) => ({ picture: pub(s.picture)!, before: pub(s.before) })) }
|
|
85
106
|
}),
|
|
86
107
|
})),
|
|
87
108
|
}
|
package/src/repo-config.ts
CHANGED
|
@@ -334,8 +334,9 @@ export type RepoConfig = {
|
|
|
334
334
|
/** how many at once, a whole number of 1 or more. Default 2 */
|
|
335
335
|
max?: number
|
|
336
336
|
/** the box that films for this repo from a Mac, like { host: 'wm', max: 5 }: there every browser start goes to
|
|
337
|
-
* that ssh host
|
|
338
|
-
* browserSlot refuses any other start. SK_FILM_HERE=1 films on
|
|
337
|
+
* that ssh host, to the warm browser of the slot it holds (shot/box.ts, one browser per slot), at most `max` at
|
|
338
|
+
* once (default 2, a pool apart from `max`), and browserSlot refuses any other start. SK_FILM_HERE=1 films on
|
|
339
|
+
* the Mac for one run, under `max` */
|
|
339
340
|
box?: {
|
|
340
341
|
/** the ssh host, as ~/.ssh/config names it */
|
|
341
342
|
host: string
|
|
@@ -354,6 +355,9 @@ export type RepoConfig = {
|
|
|
354
355
|
}
|
|
355
356
|
/** the `shipkit serve` hub: port + optional graph hooks */
|
|
356
357
|
serve?: ServeConfig
|
|
358
|
+
/** the screen recorder (`sk rec`, wiki tools/shipkit/recordings.md): where takes go, read only in the house
|
|
359
|
+
* config, and the presets a hotkey runs; a repo's own presets join the house's in its menu */
|
|
360
|
+
recorder?: import('./recordings/presets.ts').RecorderConfig
|
|
357
361
|
/** the repo's own colours, one #rrggbb hex each: colorLight reads on a
|
|
358
362
|
* light background, colorDark on a dark one. Every page that shows the
|
|
359
363
|
* repo draws its name and its rail tile in them. Rule SK024 warns when
|
|
@@ -370,7 +374,7 @@ export type RepoConfig = {
|
|
|
370
374
|
logDir?: string
|
|
371
375
|
}
|
|
372
376
|
|
|
373
|
-
const KNOWN_KEYS = new Set(['name', 'venues', 'social', 'speaksAs', 'backup', 'docsBase', 'defaults', 'tasks', 'asks', 'creds', 'credsCommand', 'credsReadCommand', 'notifyCommand', 'contracts', 'gitignore', 'ignoredInputs', 'untrackGenerated', 'nested', 'off', 'when', 'budgets', 'ruleExempt', 'visibility', 'archived', 'reviewer', 'oneWayIn', 'rules', 'release', 'units', 'notReleasable', 'vendored', 'hooks', 'checkDefaults', 'tui', 'serve', 'identity', 'logDir', 'smoke', 'tests', 'browsers', 'start'])
|
|
377
|
+
const KNOWN_KEYS = new Set(['name', 'venues', 'social', 'speaksAs', 'backup', 'docsBase', 'defaults', 'tasks', 'asks', 'creds', 'credsCommand', 'credsReadCommand', 'notifyCommand', 'contracts', 'gitignore', 'ignoredInputs', 'untrackGenerated', 'nested', 'off', 'when', 'budgets', 'ruleExempt', 'visibility', 'archived', 'reviewer', 'oneWayIn', 'rules', 'release', 'units', 'notReleasable', 'vendored', 'hooks', 'checkDefaults', 'tui', 'serve', 'recorder', 'identity', 'logDir', 'smoke', 'tests', 'browsers', 'start'])
|
|
374
378
|
|
|
375
379
|
export function defineRepo(c: RepoConfig): RepoConfig {
|
|
376
380
|
if (typeof c.name !== 'string' || c.name === '') throw new Error('defineRepo: name is required')
|
package/src/review/http.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// answer under its ETag, a file with byte ranges
|
|
3
3
|
import { extname } from 'node:path'
|
|
4
4
|
|
|
5
|
-
export const TYPES: Record<string, string> = { '.png': 'image/png', '.jpg': 'image/jpeg', '.jpeg': 'image/jpeg', '.webp': 'image/webp', '.svg': 'image/svg+xml', '.webm': 'video/webm', '.mp4': 'video/mp4', '.ico': 'image/x-icon' }
|
|
5
|
+
export const TYPES: Record<string, string> = { '.png': 'image/png', '.jpg': 'image/jpeg', '.jpeg': 'image/jpeg', '.webp': 'image/webp', '.svg': 'image/svg+xml', '.webm': 'video/webm', '.mp4': 'video/mp4', '.ico': 'image/x-icon', '.wav': 'audio/wav', '.m4a': 'audio/mp4' }
|
|
6
6
|
export const NO_STORE = { 'Cache-Control': 'no-store' }
|
|
7
7
|
/** an item's files never change once written, nor a kept render under its version: a phone keeps what it fetched */
|
|
8
8
|
export const KEEP = { 'Cache-Control': 'private, max-age=86400' }
|
package/src/review/model.ts
CHANGED
|
@@ -179,6 +179,8 @@ export const SHA_RE = /^[0-9a-f]{64}$/
|
|
|
179
179
|
export interface CardChangelog {
|
|
180
180
|
category: string
|
|
181
181
|
line: string
|
|
182
|
+
/** what its media shows (`--rating`): the rating its picture lands with; absent, unrated (it reads explicit) */
|
|
183
|
+
rating?: 'safe' | 'mild' | 'explicit'
|
|
182
184
|
}
|
|
183
185
|
|
|
184
186
|
/** `--changelog "<category>: <line>"` read; a line with no category throws saying the shape */
|
|
@@ -712,6 +714,14 @@ export const coversCard = (f: WatchFilter, x: ReviewItem): boolean =>
|
|
|
712
714
|
/** the live watchers that will read his answer on any of these cards */
|
|
713
715
|
export const listenersOf = (cards: readonly ReviewItem[], watchers: readonly Watcher[]): Watcher[] => watchers.filter((w) => cards.some((x) => coversCard(w, x)))
|
|
714
716
|
|
|
717
|
+
/** who listens, in plain words: one lane's watch by its lane, any other by « an agent », several by their count */
|
|
718
|
+
export function listenWords(ws: readonly Watcher[]): string {
|
|
719
|
+
const [w] = ws
|
|
720
|
+
if (w === undefined) return 'nobody listens'
|
|
721
|
+
if (ws.length > 1) return `${ws.length} agents listening`
|
|
722
|
+
return w.lane ? `the ${w.lane} lane is listening` : 'an agent is listening'
|
|
723
|
+
}
|
|
724
|
+
|
|
715
725
|
/** what `review add` says when no live watch of the card's own session or lane will read his answer, else null: an
|
|
716
726
|
* unfiltered watch (a dispatcher, another session) hears it for someone else */
|
|
717
727
|
export function unheardLine(item: Item, watchers: readonly Watcher[]): string | null {
|
|
@@ -866,8 +876,8 @@ export function itemProblems(v: unknown): string[] {
|
|
|
866
876
|
if (v.answers !== undefined && !(Array.isArray(v.answers) && v.answers.length > 0 && v.answers.every((a) => typeof a === 'string' && ID_RE.test(a))))
|
|
867
877
|
out.push('answers: a list of item ids')
|
|
868
878
|
for (const k of ['what', 'post', 'commit', 'supersedes', 'why', 'keeps']) if (v[k] !== undefined && typeof v[k] !== 'string') out.push(`${k}: a text`)
|
|
869
|
-
if (v.changelog !== undefined && !(obj(v.changelog) && typeof v.changelog.category === 'string' && v.changelog.category.trim() !== '' && typeof v.changelog.line === 'string' && v.changelog.line.trim() !== ''))
|
|
870
|
-
out.push('changelog: { category, line }, or absent')
|
|
879
|
+
if (v.changelog !== undefined && !(obj(v.changelog) && typeof v.changelog.category === 'string' && v.changelog.category.trim() !== '' && typeof v.changelog.line === 'string' && v.changelog.line.trim() !== '' && (v.changelog.rating === undefined || ['safe', 'mild', 'explicit'].includes(v.changelog.rating as string))))
|
|
880
|
+
out.push('changelog: { category, line, rating? }, or absent')
|
|
871
881
|
if (v.light !== undefined && v.light !== 'review') out.push('light: review, or absent')
|
|
872
882
|
if (v.wip !== undefined && !(obj(v.wip) && typeof v.wip.live === 'string' && v.wip.live !== '' && Number.isInteger(v.wip.frame))) out.push('wip: { live, frame }, or absent')
|
|
873
883
|
if (v.trailer !== undefined) out.push(...trailerCardProblems(v.trailer))
|
package/src/review/stage-card.ts
CHANGED
|
@@ -123,7 +123,7 @@ export type StageAsk = {
|
|
|
123
123
|
pick?: string
|
|
124
124
|
text: string
|
|
125
125
|
rating: PostRating
|
|
126
|
-
/** what the post is for (wiki guides/post-kinds/index.md); unset, a card's `
|
|
126
|
+
/** what the post is for (wiki guides/post-kinds/index.md); unset, a card's `iteration` */
|
|
127
127
|
kind?: string
|
|
128
128
|
/** a `custom` kind's one line on why no kind fits */
|
|
129
129
|
kindWhy?: string
|
package/src/review/store.ts
CHANGED
|
@@ -380,7 +380,7 @@ export async function addItem(dir: string, input: AddInput): Promise<Item> {
|
|
|
380
380
|
title: input.title.trim(),
|
|
381
381
|
what: input.what.trim(),
|
|
382
382
|
...(input.post?.trim() ? { post: input.post.trim() } : {}),
|
|
383
|
-
...(input.changelog ? { changelog: { category: input.changelog.category.trim(), line: input.changelog.line.trim() } } : {}),
|
|
383
|
+
...(input.changelog ? { changelog: { category: input.changelog.category.trim(), line: input.changelog.line.trim(), ...(input.changelog.rating ? { rating: input.changelog.rating } : {}) } } : {}),
|
|
384
384
|
...(topic ? { topic } : {}),
|
|
385
385
|
...(input.commit ? { commit: input.commit } : {}),
|
|
386
386
|
views: loaded.map((v, n) => viewOf(v, n, input.marks?.[n], given[n]?.note)),
|
|
@@ -966,7 +966,7 @@ export function deleteReport(dir: string, id: string): void {
|
|
|
966
966
|
* after it (`…-live-3`): its name first, the whole store only when no name holds it */
|
|
967
967
|
export function itemOfRef(dir: string, ref: string): ReviewItem | null {
|
|
968
968
|
const m = /^([a-z][a-z0-9-]*)#(\d+)$/.exec(ref.trim())
|
|
969
|
-
if (!m) return ID_RE.test(ref) ? readItem(dir, ref) :
|
|
969
|
+
if (!m) return ID_RE.test(ref) ? readItem(dir, ref) : itemOfPrefix(dir, ref)
|
|
970
970
|
const holds = (x: ReviewItem | null): x is ReviewItem => x !== null && x.item.origin.by === 'player' && x.item.origin.server === m[1] && x.item.origin.serverId === Number(m[2])
|
|
971
971
|
const tail = `-${m[1]}-${m[2]}`
|
|
972
972
|
for (const n of existsSync(dir) ? readdirSync(dir).filter((n) => n.endsWith(tail)).sort() : []) {
|
|
@@ -980,6 +980,16 @@ export function itemOfRef(dir: string, ref: string): ReviewItem | null {
|
|
|
980
980
|
return readAll(dir).items.find(holds) ?? null
|
|
981
981
|
}
|
|
982
982
|
|
|
983
|
+
/** an item by its moment alone (`20261108-194005`): the one id of that second; two of them is an error naming both, so
|
|
984
|
+
* a short id never picks one by chance. A longer ref is an exact id: a gone item's id never lands on one it starts */
|
|
985
|
+
function itemOfPrefix(dir: string, ref: string): ReviewItem | null {
|
|
986
|
+
const p = ref.trim()
|
|
987
|
+
if (!/^\d{8}-\d{6}$/.test(p) || !existsSync(dir)) return null
|
|
988
|
+
const hits = readdirSync(dir).filter((n) => n.startsWith(`${p}-`))
|
|
989
|
+
if (hits.length > 1) throw new Error(`${p} starts ${hits.length} items: ${hits.sort().join(', ')}; give more of the id`)
|
|
990
|
+
return hits.length === 1 ? readItem(dir, hits[0]!) : null
|
|
991
|
+
}
|
|
992
|
+
|
|
983
993
|
/** a player's report as the owner names it: `live#85`; any other item by its id */
|
|
984
994
|
export const refOf = (x: ReviewItem): string => (x.item.origin.by === 'player' ? `${x.item.origin.server}#${x.item.origin.serverId}` : x.item.id)
|
|
985
995
|
|
|
@@ -11,6 +11,8 @@ import { fetchBack, signedUrl } from '../media-store/remote.ts'
|
|
|
11
11
|
import { parseTrailer, starts, total, type Trailer } from '../trailer/grammar.ts'
|
|
12
12
|
import { THUMB_W } from '../trailer/graph.ts'
|
|
13
13
|
import { ffmpeg } from '../trailer/ffmpeg.ts'
|
|
14
|
+
import { answerOf, readFacts, readPlan } from '../trailer/shot-plan.ts'
|
|
15
|
+
import { cutStates, planCutOf, type CutPlan, type CutStates } from '../trailer/shot-state.ts'
|
|
14
16
|
import { probe, stillAt } from './media.ts'
|
|
15
17
|
import type { FrameSubject } from './model.ts'
|
|
16
18
|
import { readAllCached, storeDir } from './store.ts'
|
|
@@ -34,6 +36,7 @@ export function timelineOf(t: Pick<Trailer, 'shots' | 'fps' | 'size'>): Timeline
|
|
|
34
36
|
length: s.length,
|
|
35
37
|
section,
|
|
36
38
|
captions: s.titles.map((ti) => ({ text: ti.text, style: ti.style, start: round(start + ti.at), end: round(start + (ti.for === null ? s.length : ti.at + ti.for)) })),
|
|
39
|
+
...(s.film?.kind === 'clip' && s.film.recording !== undefined ? { recording: s.film.recording } : {}),
|
|
37
40
|
}
|
|
38
41
|
})
|
|
39
42
|
const sections: SectionSpan[] = []
|
|
@@ -371,9 +374,26 @@ export function cutInfo(root: string, dir: string, id: string, c: CutFiles): Cut
|
|
|
371
374
|
strip: timeline && view ? stripInfo(viewStrip(root, id, c.cut, view.mtime), view, timeline) : null,
|
|
372
375
|
fileMtime,
|
|
373
376
|
version: c.version === true,
|
|
377
|
+
shots: timeline ? shotStates(root, id, c, timeline, errors) : null,
|
|
374
378
|
}
|
|
375
379
|
}
|
|
376
380
|
|
|
381
|
+
/** the cut's shots in plain words: its plan (a kept version reads its cut's), its takes as the last check or build read
|
|
382
|
+
* them (a version's takes are kept with it: none read), the answers on the cards a plan names. A plan that does not
|
|
383
|
+
* parse is said in the cut's errors */
|
|
384
|
+
function shotStates(root: string, id: string, c: CutFiles, tl: Timeline, errors: string[]): CutStates {
|
|
385
|
+
const planCut = planCutOf(c.cut, c.version === true)
|
|
386
|
+
let plan: CutPlan = { shots: {} }
|
|
387
|
+
try {
|
|
388
|
+
plan = readPlan(root, id, planCut)
|
|
389
|
+
} catch (e) {
|
|
390
|
+
errors.push((e as Error).message)
|
|
391
|
+
}
|
|
392
|
+
const cards = Object.values(plan.shots).some((e) => e.card) ? readAllCached(storeDir(root)).items : []
|
|
393
|
+
const answer = (card: string) => answerOf(cards.find((x) => x.item.id === card) ?? null)
|
|
394
|
+
return cutStates(tl.shots.map((s) => s.name), plan, planCut, c.version ? null : readFacts(root, id, c.cut), answer)
|
|
395
|
+
}
|
|
396
|
+
|
|
377
397
|
export function trailerInfo(root: string, id: string): TrailerInfo | null {
|
|
378
398
|
const dir = trailerDir(root, id)
|
|
379
399
|
if (!dir) return null
|