rvlib-shipkit 2.18.0 → 2.20.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 +31 -0
- package/package.json +1 -1
- package/src/annex/annex.ts +227 -0
- package/src/annex/offload.ts +279 -0
- package/src/asks/asks-queue.ts +63 -10
- package/src/checks/SK040-release-words.check.ts +43 -0
- package/src/checks/SK041-annex-links.check.ts +28 -0
- package/src/checks/SK042-post-kinds.check.ts +73 -0
- package/src/cli/cmd_Annex.ts +179 -0
- package/src/cli/cmd_Asks.ts +3 -1
- package/src/cli/cmd_Commands.ts +4 -1
- package/src/cli/cmd_GlobalProcesses.ts +34 -11
- package/src/cli/cmd_Home.ts +41 -4
- package/src/cli/cmd_Messages.ts +155 -0
- package/src/cli/cmd_Releases.ts +48 -0
- package/src/cli/cmd_Review.ts +161 -6
- package/src/cli/cmd_Secret.ts +4 -30
- package/src/cli/cmd_Shot.ts +4 -4
- package/src/cli/cmd_Social.ts +179 -3
- package/src/cli/cmd_Trailer.ts +15 -3
- package/src/cli/family-pages.ts +2 -0
- package/src/cli/kit/index.ts +1 -1
- package/src/cli/kit/verb.ts +11 -3
- package/src/cli/registry.ts +8 -2
- package/src/collections/actions.ts +29 -1
- package/src/collections/collection-types.ts +10 -1
- package/src/collections/providers.ts +5 -2
- package/src/commands/model.ts +36 -0
- package/src/commands/registry.ts +49 -0
- package/src/commands/routes.ts +59 -0
- package/src/commands/runner.ts +35 -0
- package/src/commands/runs.ts +112 -0
- package/src/core/app-icon.ts +4 -3
- package/src/core/icon-type.ts +8 -0
- package/src/core/jobs.ts +4 -3
- package/src/core/layout.ts +5 -2
- package/src/core/squircle.ts +95 -0
- package/src/home/daemon-jobs.ts +26 -2
- package/src/home/global-units.ts +3 -0
- package/src/home/gui-app/ShipkitGui.swift +302 -5
- package/src/home/gui-app.ts +63 -33
- package/src/home/hmr-keep.ts +134 -0
- package/src/home/home-paths.ts +5 -1
- package/src/home/home-start.ts +14 -14
- package/src/home/lib-watch.ts +21 -11
- package/src/home/pm.ts +1 -1
- package/src/home/process-apps.ts +181 -0
- package/src/home/resources.ts +3 -3
- package/src/home/run-daemon.ts +11 -2
- package/src/home/run-pm.ts +9 -1
- package/src/home/run-web.ts +7 -4
- package/src/home/serve-web.ts +64 -14
- package/src/home/supervise.ts +3 -1
- package/src/identities/collection.ts +49 -0
- package/src/identities/identities.ts +130 -11
- package/src/identities/machine.ts +4 -3
- package/src/identities/rating.ts +33 -0
- package/src/identities/shown.ts +170 -0
- package/src/identities/steps.ts +5 -0
- package/src/media-store/purge.ts +15 -1
- package/src/media-store/remote.ts +22 -6
- package/src/messages/brief.ts +117 -0
- package/src/messages/collection.ts +40 -0
- package/src/messages/model.ts +171 -0
- package/src/messages/routes.ts +15 -0
- package/src/messages/score.ts +180 -0
- package/src/messages/tabs.ts +13 -0
- package/src/release/notes.ts +130 -0
- package/src/release/run-bump.ts +41 -18
- package/src/release/run-release.ts +22 -4
- package/src/release/run-releases.ts +17 -15
- package/src/release/unit-resolve.ts +9 -0
- package/src/releases/add.ts +66 -0
- package/src/releases/collection.ts +36 -0
- package/src/releases/from-card.ts +66 -0
- package/src/releases/model.ts +267 -0
- package/src/releases/pictures.ts +89 -0
- package/src/releases/routes.ts +36 -0
- package/src/releases/store.ts +71 -0
- package/src/repo-config.ts +5 -0
- package/src/review/cells.ts +0 -11
- package/src/review/format.ts +10 -6
- package/src/review/http.ts +7 -2
- package/src/review/model.ts +92 -3
- package/src/review/notes.ts +2 -48
- package/src/review/routes.ts +28 -10
- package/src/review/stage-card.ts +197 -0
- package/src/review/stage-routes.ts +123 -0
- package/src/review/store.ts +117 -19
- package/src/review/trailer-card.ts +99 -0
- package/src/review/trailer-desk.ts +57 -4
- package/src/review/trailer-model.ts +41 -7
- package/src/review/trailer-notes.ts +45 -0
- package/src/review/trailer-routes.ts +22 -13
- package/src/secrets/manager.ts +59 -0
- package/src/secrets/name.ts +2 -0
- package/src/serve/hub-app/app-bridge.ts +71 -0
- package/src/serve/hub-app/col-card.tsx +10 -0
- package/src/serve/hub-app/cols-svc.ts +37 -6
- package/src/serve/hub-app/commands/commands-page.tsx +122 -0
- package/src/serve/hub-app/commands/commands-st.ts +177 -0
- package/src/serve/hub-app/commands.css +24 -0
- package/src/serve/hub-app/hash-route.ts +40 -1
- package/src/serve/hub-app/home-st.ts +11 -2
- package/src/serve/hub-app/home.html +3 -0
- package/src/serve/hub-app/hub-app.tsx +6 -0
- package/src/serve/hub-app/hub.css +1 -0
- package/src/serve/hub-app/icons.tsx +5 -0
- package/src/serve/hub-app/identities-view.tsx +4 -1
- package/src/serve/hub-app/identities.css +1 -0
- package/src/serve/hub-app/index.html +3 -0
- package/src/serve/hub-app/keys.ts +2 -2
- package/src/serve/hub-app/machine-st.ts +41 -10
- package/src/serve/hub-app/messages/messages-page.tsx +354 -0
- package/src/serve/hub-app/messages/messages-st.ts +74 -0
- package/src/serve/hub-app/messages.css +35 -0
- package/src/serve/hub-app/releases/releases-page.tsx +94 -0
- package/src/serve/hub-app/releases/releases-st.ts +69 -0
- package/src/serve/hub-app/releases.css +25 -0
- package/src/serve/hub-app/repo-sections.ts +15 -1
- package/src/serve/hub-app/repo-st.ts +56 -5
- package/src/serve/hub-app/review/clip-st.ts +31 -3
- package/src/serve/hub-app/review/note-place.ts +31 -0
- package/src/serve/hub-app/review/review-cells.tsx +27 -3
- package/src/serve/hub-app/review/review-st.ts +77 -2
- package/src/serve/hub-app/review/review-thread.tsx +9 -31
- package/src/serve/hub-app/review/review-views.tsx +164 -58
- package/src/serve/hub-app/review/thread-st.ts +108 -41
- package/src/serve/hub-app/review/trailer-card.tsx +187 -0
- package/src/serve/hub-app/review/trailer-page.tsx +62 -31
- package/src/serve/hub-app/review/trailer-st.ts +138 -26
- package/src/serve/hub-app/review/trailer-timeline.tsx +39 -26
- package/src/serve/hub-app/review.css +49 -6
- package/src/serve/hub-app/social/comms-page.tsx +55 -23
- package/src/serve/hub-app/social/identity-pictures.ts +112 -0
- package/src/serve/hub-app/social/kit.tsx +9 -6
- package/src/serve/hub-app/social/post-card.tsx +10 -2
- package/src/serve/hub-app/social/social-model.ts +37 -3
- package/src/serve/hub-app/social/social-page.tsx +236 -82
- package/src/serve/hub-app/social/social-st.ts +79 -26
- package/src/serve/hub-app/social/stage-popup.tsx +268 -0
- package/src/serve/hub-app/social/stage-st.ts +310 -0
- package/src/serve/hub-app/social/step-layout.ts +42 -0
- package/src/serve/hub-app/social.css +68 -4
- package/src/serve/hub-app/tree-build.ts +38 -1
- package/src/serve/hub-app/tree-svc.ts +10 -3
- package/src/serve/project-gutter-route.ts +4 -2
- package/src/serve/same-origin.ts +24 -1
- package/src/serve/serve-hub.ts +27 -3
- package/src/shipkit-files.ts +9 -7
- package/src/shot/shooter.ts +3 -3
- package/src/shot/shot-ask.ts +14 -3
- package/src/shot/shot.shipkit.ts +1 -1
- package/src/social/discord-layout.ts +282 -0
- package/src/social/fit.ts +84 -0
- package/src/social/identity-words.ts +74 -0
- package/src/social/kind-pages.ts +41 -0
- package/src/social/kinds.ts +92 -0
- package/src/social/load.ts +105 -9
- package/src/social/md.ts +14 -6
- package/src/social/media-limit.ts +63 -2
- package/src/social/presence.ts +1 -1
- package/src/social/publish/bluesky.ts +58 -19
- package/src/social/publish/discord.ts +3 -2
- package/src/social/publish/index.ts +31 -5
- package/src/social/reach.ts +49 -0
- package/src/social/release-stage.ts +173 -0
- package/src/social/routes.ts +44 -9
- package/src/social/stage.ts +227 -0
- package/src/social/strip.ts +85 -0
- package/src/social/text.ts +6 -2
- package/src/social/unit.ts +57 -1
- package/src/social/writes.ts +11 -0
- package/src/stores/routes.ts +2 -2
- package/src/suite/judge-suites.ts +1 -1
- package/src/suite/suite-cli.ts +5 -5
- package/src/trailer/build.ts +90 -52
- package/src/trailer/draft.ts +28 -0
- package/src/trailer/footage.ts +4 -2
- package/src/trailer/grammar.ts +25 -13
- package/src/trailer/graph.ts +32 -9
- package/src/trailer/profile.ts +35 -0
- package/src/trailer/prune.ts +15 -10
- package/src/trailer/public-words.ts +41 -0
- package/src/trailer/stitch.ts +22 -10
- package/src/trailer/titles.ts +47 -2
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
// the stage popup's state (wiki tools/shipkit/review-raised-items.md, A post staged from a card): what the card offers
|
|
2
|
+
// (its media, its words, the repo's lines), his text, the rating, where it goes; each change runs a dry stage on the
|
|
3
|
+
// server, so every count, place and problem shown is the desk's own load, never a guess of the page. Enter stages
|
|
4
|
+
import { makeAutoObservable, runInAction } from 'mobx'
|
|
5
|
+
import type { PostRating } from '../../../identities/rating.ts'
|
|
6
|
+
import type { Chip, Stageable } from '../../../review/stage-card.ts'
|
|
7
|
+
import type { StageAccount } from '../../../review/stage-routes.ts'
|
|
8
|
+
import type { DeskKind } from '../../../social/kind-pages.ts'
|
|
9
|
+
import { sourceKind } from '../../../social/kinds.ts'
|
|
10
|
+
import { postJson } from '../review/review-kit.ts'
|
|
11
|
+
import { reach } from '../reach.ts'
|
|
12
|
+
|
|
13
|
+
export type StageData = {
|
|
14
|
+
head: string
|
|
15
|
+
first: string
|
|
16
|
+
title: string
|
|
17
|
+
media: Stageable[]
|
|
18
|
+
words: Chip[]
|
|
19
|
+
identity: { id: string; name: string; adult: boolean } | null
|
|
20
|
+
ratings: PostRating[]
|
|
21
|
+
rating: PostRating | null
|
|
22
|
+
accounts: StageAccount[]
|
|
23
|
+
lines: { text: string; source: string }[]
|
|
24
|
+
slots: { value: string; what: string; taken: boolean }[]
|
|
25
|
+
tags: string[]
|
|
26
|
+
drafts: { slug: string; title: string }[]
|
|
27
|
+
/** the kinds the repo takes, each with what it is for and its rules page */
|
|
28
|
+
kinds?: DeskKind[]
|
|
29
|
+
errors: string[]
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export type DryAnswer = {
|
|
33
|
+
slug: string
|
|
34
|
+
posts: { key: string; platform: string; place: string; length: number; refused: string }[]
|
|
35
|
+
skipped: { account: string; why: string }[]
|
|
36
|
+
errors: string[]
|
|
37
|
+
polish?: string
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const DRY_MS = 180
|
|
41
|
+
|
|
42
|
+
/** what a link to the popup prefills: his text, the rating, the kind and a custom kind's reason */
|
|
43
|
+
export type StageFill = { text: string; rating: PostRating | null; kind?: string; kindWhy?: string }
|
|
44
|
+
|
|
45
|
+
/** the two urls a popup talks to, what each of its bodies carries besides his draft (a release draft's slug), and the
|
|
46
|
+
* kind a new draft takes unless he picks another; no kind, the popup writes no draft of its own and picks none */
|
|
47
|
+
export type StageSource = { get: string; post: string; extra?: Record<string, unknown>; kind?: string }
|
|
48
|
+
|
|
49
|
+
/** a card's stage popup */
|
|
50
|
+
export const cardSource = (url: (p: string) => string, card: string): StageSource => ({
|
|
51
|
+
get: url(`/api/review/${encodeURIComponent(card)}/stage`),
|
|
52
|
+
post: url(`/api/review/${encodeURIComponent(card)}/stage`),
|
|
53
|
+
kind: sourceKind({ review: card }),
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
/** a release draft's: the approved cards it ships as its media */
|
|
57
|
+
export const releaseSource = (url: (p: string) => string, slug: string): StageSource => ({ get: url(`/api/social/release-media?slug=${encodeURIComponent(slug)}`), post: url('/api/social/release-media'), extra: { slug } })
|
|
58
|
+
|
|
59
|
+
export class StageSt {
|
|
60
|
+
data: StageData | null = null
|
|
61
|
+
error: string | null = null
|
|
62
|
+
busy = false
|
|
63
|
+
pick = ''
|
|
64
|
+
text = ''
|
|
65
|
+
alt = ''
|
|
66
|
+
rating: PostRating | null = null
|
|
67
|
+
/** what the post is for, its source's kind until he picks another */
|
|
68
|
+
kind = ''
|
|
69
|
+
/** a `custom` kind's line on why no kind fits */
|
|
70
|
+
kindWhy = ''
|
|
71
|
+
tags: string[] = []
|
|
72
|
+
slot = ''
|
|
73
|
+
/** a channel he picked on an account, over its default */
|
|
74
|
+
place: { account: string; place: string } | null = null
|
|
75
|
+
polish = false
|
|
76
|
+
/** a clip's passage, his in and out on its player */
|
|
77
|
+
passage: { from: number | null; to: number | null } = { from: null, to: null }
|
|
78
|
+
/** one copy within the tightest limits of the venues it reaches */
|
|
79
|
+
fit = false
|
|
80
|
+
dry: DryAnswer | null = null
|
|
81
|
+
/** where the text box's cursor stands: a chip goes in there */
|
|
82
|
+
caret = 0
|
|
83
|
+
private timer: ReturnType<typeof setTimeout> | null = null
|
|
84
|
+
private asked = 0
|
|
85
|
+
|
|
86
|
+
constructor(
|
|
87
|
+
/** where the popup reads its data and sends his draft: a card's stage route, or a release draft's media route */
|
|
88
|
+
private readonly source: StageSource,
|
|
89
|
+
/** a pick, or the start of one (`<item>#<view>`): the first media it names */
|
|
90
|
+
want: string,
|
|
91
|
+
private readonly done: (slug: string) => void,
|
|
92
|
+
/** what a link prefills: his text, the rating, the kind */
|
|
93
|
+
private readonly fill?: StageFill,
|
|
94
|
+
) {
|
|
95
|
+
this.pick = want
|
|
96
|
+
this.kind = source.kind ?? ''
|
|
97
|
+
makeAutoObservable<this, 'source' | 'done' | 'fill' | 'timer' | 'asked'>(this, { source: false, done: false, fill: false, timer: false, asked: false })
|
|
98
|
+
void this.load()
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
async load(): Promise<void> {
|
|
102
|
+
try {
|
|
103
|
+
const r = await reach(this.source.get)
|
|
104
|
+
const d = (await r.json()) as StageData & { error?: string }
|
|
105
|
+
if (!r.ok) throw new Error(d.error ?? `HTTP ${r.status}`)
|
|
106
|
+
runInAction(() => {
|
|
107
|
+
this.data = d
|
|
108
|
+
this.rating = this.fill?.rating ?? d.rating
|
|
109
|
+
const w = this.pick
|
|
110
|
+
const m = d.media.find((x) => x.key === w) ?? d.media.find((x) => w !== '' && (x.key.startsWith(`${w}.`) || x.key.startsWith(`${w}/`))) ?? d.media[0]
|
|
111
|
+
this.pick = m?.key ?? ''
|
|
112
|
+
this.alt = m?.note ?? ''
|
|
113
|
+
this.text = this.fill?.text || (d.words.find((w) => w.from === 'post')?.text ?? '')
|
|
114
|
+
this.caret = this.text.length
|
|
115
|
+
// a kind the link names that the repo takes; any other word keeps the source's
|
|
116
|
+
const k = this.fill?.kind
|
|
117
|
+
if (k && d.kinds?.some((x) => x.id === k)) this.kind = k
|
|
118
|
+
this.kindWhy = this.fill?.kindWhy ?? ''
|
|
119
|
+
})
|
|
120
|
+
this.again()
|
|
121
|
+
} catch (e) {
|
|
122
|
+
runInAction(() => (this.error = (e as Error).message))
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
get media(): Stageable | null {
|
|
127
|
+
return this.data?.media.find((m) => m.key === this.pick) ?? null
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/** the guard's lines and the load's: Stage waits while one stands; a venue's limit stands no more once « fit » is on */
|
|
131
|
+
get problems(): string[] {
|
|
132
|
+
return (this.dry?.errors ?? []).filter((e) => !(this.fit && this.overLimit(e)))
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/** a line of a venue's media limit, which « fit » answers */
|
|
136
|
+
overLimit(e: string): boolean {
|
|
137
|
+
return e.includes('« fit » makes it a copy that fits')
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
get anyOverLimit(): boolean {
|
|
141
|
+
return (this.dry?.errors ?? []).some((e) => this.overLimit(e))
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
setIn(t: number): void {
|
|
145
|
+
this.passage = { from: Math.round(t * 100) / 100, to: this.passage.to !== null && this.passage.to > t ? this.passage.to : null }
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
setOut(t: number): void {
|
|
149
|
+
this.passage = { from: this.passage.from !== null && this.passage.from < t ? this.passage.from : 0, to: Math.round(t * 100) / 100 }
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
clearPassage(): void {
|
|
153
|
+
this.passage = { from: null, to: null }
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
setFit(on: boolean): void {
|
|
157
|
+
this.fit = on
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/** the popup offers a kind: it writes a draft of its own, and the repo lists its kinds */
|
|
161
|
+
get picksKind(): boolean {
|
|
162
|
+
return this.source.kind != null && (this.data?.kinds?.length ?? 0) > 0
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/** the kind picked, with what it is for and its rules page */
|
|
166
|
+
get kindInfo(): DeskKind | null {
|
|
167
|
+
return this.data?.kinds?.find((k) => k.id === this.kind) ?? null
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/** a custom kind still waiting for its line on why no kind fits */
|
|
171
|
+
get needsWhy(): boolean {
|
|
172
|
+
return this.picksKind && this.kind === 'custom' && this.kindWhy.trim() === ''
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
get ready(): boolean {
|
|
176
|
+
return this.data !== null && this.rating !== null && this.text.trim() !== '' && !this.needsWhy && this.dry !== null && this.problems.length === 0 && !this.busy
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/** why Stage waits, in plain words */
|
|
180
|
+
get waits(): string {
|
|
181
|
+
if (this.rating === null) return 'pick a rating: this voice is adult, so no rating is chosen for you'
|
|
182
|
+
if (this.needsWhy) return 'say why no kind fits: a custom post carries its reason'
|
|
183
|
+
if (this.text.trim() === '') return 'write the post'
|
|
184
|
+
if (this.problems.length > 0) return 'fix the line above first'
|
|
185
|
+
return ''
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
setPick(key: string): void {
|
|
189
|
+
this.pick = key
|
|
190
|
+
this.passage = { from: null, to: null }
|
|
191
|
+
const m = this.media
|
|
192
|
+
if (m && (this.alt === '' || this.data?.media.some((x) => x.note === this.alt))) this.alt = m.note
|
|
193
|
+
this.again()
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
setText(t: string, caret?: number): void {
|
|
197
|
+
this.text = t
|
|
198
|
+
if (caret !== undefined) this.caret = caret
|
|
199
|
+
this.again()
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
setCaret(n: number): void {
|
|
203
|
+
this.caret = n
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/** a chip goes in at the cursor, a space on each side where words would touch */
|
|
207
|
+
insert(words: string): void {
|
|
208
|
+
const at = Math.min(this.caret, this.text.length)
|
|
209
|
+
const before = this.text.slice(0, at)
|
|
210
|
+
const after = this.text.slice(at)
|
|
211
|
+
const lead = before === '' || /\s$/.test(before) ? '' : ' '
|
|
212
|
+
const tail = after === '' || /^\s/.test(after) ? '' : ' '
|
|
213
|
+
this.text = `${before}${lead}${words}${tail}${after}`
|
|
214
|
+
this.caret = before.length + lead.length + words.length
|
|
215
|
+
this.again()
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
setAlt(t: string): void {
|
|
219
|
+
this.alt = t
|
|
220
|
+
this.again()
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
setRating(r: PostRating): void {
|
|
224
|
+
this.rating = r
|
|
225
|
+
this.place = null
|
|
226
|
+
this.again()
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
setKind(k: string): void {
|
|
230
|
+
this.kind = k
|
|
231
|
+
this.again()
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
setKindWhy(t: string): void {
|
|
235
|
+
this.kindWhy = t
|
|
236
|
+
this.again()
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
toggleTag(t: string): void {
|
|
240
|
+
this.tags = this.tags.includes(t) ? this.tags.filter((x) => x !== t) : [...this.tags, t]
|
|
241
|
+
this.again()
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
setSlot(v: string): void {
|
|
245
|
+
this.slot = v
|
|
246
|
+
this.again()
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
setPlace(account: string, place: string, fallback: string): void {
|
|
250
|
+
this.place = place === fallback ? null : { account, place }
|
|
251
|
+
this.again()
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
setPolish(on: boolean): void {
|
|
255
|
+
this.polish = on
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
private body(dry: boolean): Record<string, unknown> {
|
|
259
|
+
return {
|
|
260
|
+
...this.source.extra,
|
|
261
|
+
pick: this.pick,
|
|
262
|
+
text: this.text,
|
|
263
|
+
rating: this.rating,
|
|
264
|
+
...(this.picksKind ? { kind: this.kind, ...(this.kind === 'custom' && this.kindWhy.trim() ? { kindWhy: this.kindWhy.trim() } : {}) } : {}),
|
|
265
|
+
alt: this.alt,
|
|
266
|
+
...(this.slot ? { slot: this.slot } : {}),
|
|
267
|
+
...(this.tags.length ? { tags: this.tags.join(' ') } : {}),
|
|
268
|
+
...(this.place ? { place: this.place } : {}),
|
|
269
|
+
...(this.polish ? { polish: true } : {}),
|
|
270
|
+
...(this.fit ? { fit: true } : {}),
|
|
271
|
+
...(this.passage.from !== null && this.passage.to !== null && this.media?.kind === 'clip' ? { passage: this.passage } : {}),
|
|
272
|
+
dry,
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/** a dry stage soon after his last change; an older answer that lands late is dropped */
|
|
277
|
+
private again(): void {
|
|
278
|
+
if (this.timer !== null) clearTimeout(this.timer)
|
|
279
|
+
if (this.rating === null || this.data === null) return
|
|
280
|
+
this.timer = setTimeout(() => void this.runDry(), DRY_MS)
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
private async runDry(): Promise<void> {
|
|
284
|
+
const n = ++this.asked
|
|
285
|
+
try {
|
|
286
|
+
const r = await postJson<DryAnswer>(this.source.post, this.body(true))
|
|
287
|
+
if (n === this.asked) runInAction(() => ((this.dry = r), (this.error = null)))
|
|
288
|
+
} catch (e) {
|
|
289
|
+
if (n === this.asked) runInAction(() => (this.error = (e as Error).message))
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/** Enter: the draft written; the popup closes on its slug */
|
|
294
|
+
async stage(): Promise<void> {
|
|
295
|
+
if (!this.ready) return
|
|
296
|
+
this.busy = true
|
|
297
|
+
try {
|
|
298
|
+
const r = await postJson<DryAnswer>(this.source.post, this.body(false))
|
|
299
|
+
this.done(r.slug)
|
|
300
|
+
} catch (e) {
|
|
301
|
+
runInAction(() => (this.error = (e as Error).message))
|
|
302
|
+
} finally {
|
|
303
|
+
runInAction(() => (this.busy = false))
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
dispose(): void {
|
|
308
|
+
if (this.timer !== null) clearTimeout(this.timer)
|
|
309
|
+
}
|
|
310
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// how a setup step reads (wiki tools/shipkit/social-identities.md, The accounts, `## Setup`): never a cut value. A
|
|
2
|
+
// step whose rows are all short keeps them as chips in its sentence; a step with a long row or a picture is its
|
|
3
|
+
// sentence, then a form of its rows in the order it names them
|
|
4
|
+
|
|
5
|
+
/** what a `[[ref]]` names: a draft, a picture row, a text row by its length, or nothing */
|
|
6
|
+
export type RefKind = 'draft' | 'picture' | 'long' | 'short' | 'bad'
|
|
7
|
+
|
|
8
|
+
/** a piece of the sentence: words, a ref drawn whole (`chip`), or a form row named by its field (`tag`) */
|
|
9
|
+
export type StepPiece = { text: string } | { ref: string; as: 'chip' | 'tag' }
|
|
10
|
+
|
|
11
|
+
export type StepLayout = { sentence: StepPiece[]; fields: string[] }
|
|
12
|
+
|
|
13
|
+
/** a text value that fits a chip: one line, 40 characters at most */
|
|
14
|
+
export const SHORT = 40
|
|
15
|
+
|
|
16
|
+
export const textKind = (value: string): 'long' | 'short' => (value.length > SHORT || value.includes('\n') ? 'long' : 'short')
|
|
17
|
+
|
|
18
|
+
const REF = /\[\[([^\]]+)\]\]/g
|
|
19
|
+
// what may sit between the rows that end a step: spaces, commas, semicolons, a colon, a period, « and »
|
|
20
|
+
const BETWEEN = /^(?:[\s,;:.]|\band\b)*$/
|
|
21
|
+
|
|
22
|
+
export function stepLayout(text: string, kindOf: (ref: string) => RefKind): StepLayout {
|
|
23
|
+
const parts = text.split(REF)
|
|
24
|
+
const pieces: StepPiece[] = parts.map((p, j) => (j % 2 === 0 ? { text: p } : { ref: p, as: 'chip' }))
|
|
25
|
+
const rowRef = (p: StepPiece): p is { ref: string; as: 'chip' | 'tag' } => 'ref' in p && ['picture', 'long', 'short'].includes(kindOf(p.ref))
|
|
26
|
+
const form = pieces.some((p) => 'ref' in p && (kindOf(p.ref) === 'picture' || kindOf(p.ref) === 'long'))
|
|
27
|
+
if (!form) return { sentence: pieces.filter((p) => !('text' in p) || p.text !== ''), fields: [] }
|
|
28
|
+
const fields = [...new Set(pieces.filter(rowRef).map((p) => p.ref))]
|
|
29
|
+
// the rows that end the step live in the form only; its last words before them stay
|
|
30
|
+
let end = pieces.length
|
|
31
|
+
for (let j = pieces.length - 1; j >= 0; j--) {
|
|
32
|
+
const p = pieces[j]!
|
|
33
|
+
if ('text' in p && BETWEEN.test(p.text)) continue
|
|
34
|
+
if (rowRef(p)) end = j
|
|
35
|
+
else break
|
|
36
|
+
}
|
|
37
|
+
const sentence = pieces
|
|
38
|
+
.slice(0, end)
|
|
39
|
+
.map((p): StepPiece => (rowRef(p) ? { ref: p.ref, as: 'tag' } : p))
|
|
40
|
+
.filter((p) => !('text' in p) || p.text !== '')
|
|
41
|
+
return { sentence, fields }
|
|
42
|
+
}
|
|
@@ -70,9 +70,18 @@ a.so-icon:visited{color:var(--dim)}
|
|
|
70
70
|
.so-rowfield{flex:none;width:88px;font-size:11.5px;font-weight:700;color:var(--dim);padding-top:var(--s0)}
|
|
71
71
|
.so-rowname{flex:none;width:96px;align-self:center}
|
|
72
72
|
.so-rowvalue{flex:1;min-width:0;overflow-wrap:anywhere}
|
|
73
|
-
.so-
|
|
74
|
-
|
|
75
|
-
.so-
|
|
73
|
+
.so-uppics{flex:1;min-width:0;display:flex;flex-direction:column;gap:var(--s1)}
|
|
74
|
+
/* a picture row the account does not show as it is now */
|
|
75
|
+
.so-stale{display:flex;flex-direction:column;gap:2px;padding:var(--s1) var(--s2);border-radius:4px;border-left:4px solid var(--tone);background:color-mix(in srgb,var(--tone) 16%,var(--panel));font-size:12px;color:var(--ink)}
|
|
76
|
+
.so-stale b{font-size:12.5px;text-transform:uppercase;letter-spacing:.04em;color:var(--tone)}
|
|
77
|
+
.so-uploaded{align-self:stretch;justify-content:center;margin:0 var(--s2) var(--s2);font-weight:700}
|
|
78
|
+
.so-upband{font-weight:700;color:var(--dim);text-transform:uppercase;letter-spacing:.04em;font-size:10.5px;background:var(--panel2)}
|
|
79
|
+
.so-shownok{align-self:flex-start;margin:0 var(--s2) var(--s2)}
|
|
80
|
+
/* a text row he pastes: its state and « Done, pasted » at the row's end; a changed one marked whole */
|
|
81
|
+
.so-paste{flex:none;display:inline-flex;flex-direction:column;align-items:flex-end;gap:2px}
|
|
82
|
+
.so-chip .so-paste{flex-direction:row;align-items:center}
|
|
83
|
+
.so-pastebtn{font-size:11px;line-height:18px;padding:0 var(--s2);font-weight:700}
|
|
84
|
+
.so-rowtone{box-shadow:inset 4px 0 0 var(--tone);background:color-mix(in srgb,var(--tone) 10%,var(--panel))}
|
|
76
85
|
|
|
77
86
|
/* the list on the left */
|
|
78
87
|
.so-listcol{height:100%;display:flex;flex-direction:column;min-height:0;background:var(--panel)}
|
|
@@ -94,6 +103,10 @@ a.so-icon:visited{color:var(--dim)}
|
|
|
94
103
|
.so-draftrow.on .so-rowtitle{font-weight:800}
|
|
95
104
|
.so-rowtitle.small{font-size:12px}
|
|
96
105
|
.so-art{color:var(--review);margin-right:var(--s1)}
|
|
106
|
+
.so-kindwarn{color:var(--warn);margin-right:var(--s1);font-weight:700}
|
|
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
|
+
.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
|
+
a.so-kind:hover{text-decoration:underline}
|
|
97
110
|
.so-frac{flex:none;font-size:11px;font-weight:700;color:var(--dim);font-variant-numeric:tabular-nums}
|
|
98
111
|
.so-frac.t-ok{color:var(--ok)}
|
|
99
112
|
.so-who{flex:none;font-size:10px;font-weight:700;line-height:16px;padding:0 var(--s1);border-radius:3px;color:var(--k2);border:1px solid color-mix(in srgb,var(--k2) 55%,var(--line));max-width:96px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
@@ -258,7 +271,15 @@ a.so-go:visited{color:var(--accent)}
|
|
|
258
271
|
.so-steptext{flex:1;min-width:0;font-size:13.5px;line-height:1.5}
|
|
259
272
|
.so-chip{display:inline-flex;align-items:center;gap:var(--s1);vertical-align:middle;margin:var(--s0)}
|
|
260
273
|
.so-chip button,.so-chip .so-btn{font-size:11px;line-height:18px;padding:0 var(--s2)}
|
|
261
|
-
.so-chipvalue{display:inline-flex;align-items:center;gap:var(--s1);max-width:
|
|
274
|
+
.so-chipvalue{display:inline-flex;align-items:center;gap:var(--s1);max-width:100%;text-align:left}
|
|
275
|
+
.so-stepform{margin-top:var(--s2);border:1px solid var(--line);border-radius:6px;background:var(--panel);overflow:hidden;line-height:1.45}
|
|
276
|
+
.so-stepform > .so-row:first-child{border-top:0}
|
|
277
|
+
.so-stepform .so-rowfield{width:132px}
|
|
278
|
+
.so-steptext:has(> .so-stepform){container-type:inline-size}
|
|
279
|
+
@container (max-width:480px){.so-stepform .so-row{flex-wrap:wrap}.so-stepform .so-rowfield{width:100%}}
|
|
280
|
+
.so-step.done .so-stepform{opacity:.7}
|
|
281
|
+
.so-steppics{flex:1;min-width:0;display:flex;flex-wrap:wrap;align-items:center;gap:var(--s1)}
|
|
282
|
+
.so-steptag{font-size:11px;font-weight:700;color:var(--dim);border:1px dashed var(--line);border-radius:4px;padding:0 var(--s1);white-space:nowrap}
|
|
262
283
|
.so-stepimg{height:34px;max-width:120px;object-fit:cover;border-radius:4px}
|
|
263
284
|
.so-badref{color:var(--red);font-size:11px}
|
|
264
285
|
.so-swatches{display:flex;gap:var(--s2);flex-wrap:wrap;padding:var(--s2) var(--s3)}
|
|
@@ -273,6 +294,13 @@ a.so-go:visited{color:var(--accent)}
|
|
|
273
294
|
.so-picframe{position:relative}
|
|
274
295
|
.so-picframe img,.so-picframe video{display:block;width:100%;border-radius:4px;background:var(--panel2)}
|
|
275
296
|
.so-picrow{display:flex;align-items:center;gap:var(--s1);min-width:0}
|
|
297
|
+
.so-picmore{flex-wrap:wrap}
|
|
298
|
+
.so-fmt{font-size:11px;font-weight:700;padding:0 var(--s1);border:1px solid var(--line);border-radius:3px;line-height:16px;text-decoration:none;color:var(--dim)}
|
|
299
|
+
.so-fmt:hover{color:var(--ink);border-color:var(--dim)}
|
|
300
|
+
.so-picgroup{display:flex;flex-direction:column;gap:var(--s1)}
|
|
301
|
+
.so-picgroup + .so-picgroup{margin-top:var(--s3)}
|
|
302
|
+
.so-picgrouptitle{color:var(--dim)}
|
|
303
|
+
.so-picgrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:var(--s2)}
|
|
276
304
|
.so-ytarea{position:absolute;border:2px dashed var(--tag);border-radius:4px;pointer-events:none}
|
|
277
305
|
.so-ytarea.phone{border-color:var(--review)}
|
|
278
306
|
.so-ytarea span{position:absolute;top:-15px;left:var(--s0);font-size:10px;font-weight:700;color:var(--tag)}
|
|
@@ -287,3 +315,39 @@ a.so-go:visited{color:var(--accent)}
|
|
|
287
315
|
.so-probrow{color:var(--ink);padding-left:calc(var(--s3) + var(--s4) + var(--s2))}
|
|
288
316
|
.so-probrow b{flex:none;max-width:55%;font-weight:600}
|
|
289
317
|
div.so-probrow{cursor:default}
|
|
318
|
+
|
|
319
|
+
/* a message refused by the repo's guard or a place, and a rated message's own switch */
|
|
320
|
+
.so-refused{font-size:12px;margin-top:var(--s1)}
|
|
321
|
+
|
|
322
|
+
/* the stage popup over a card: the media on the left, the words and where they go on the right */
|
|
323
|
+
.sg-veil{position:fixed;inset:0;z-index:60;display:flex;align-items:center;justify-content:center;background:var(--scrim);padding:var(--s3)}
|
|
324
|
+
.sg-pop{width:min(1180px,100%);max-height:100%;overflow:auto;background:var(--panel);border:1px solid var(--line);border-radius:10px;box-shadow:0 12px 40px var(--scrim);display:flex;flex-direction:column}
|
|
325
|
+
.sg-head{display:flex;align-items:center;gap:var(--s2);padding:var(--s2) var(--s3);border-bottom:1px solid var(--line)}
|
|
326
|
+
.sg-head .sp,.sg-foot .sp{flex:1}
|
|
327
|
+
.sg-body{display:flex;gap:var(--s3);padding:var(--s3);min-height:0}
|
|
328
|
+
.sg-left{flex:1 1 52%;min-width:0;display:flex;flex-direction:column;gap:var(--s2)}
|
|
329
|
+
.sg-right{flex:1 1 48%;min-width:0;display:flex;flex-direction:column;gap:var(--s2)}
|
|
330
|
+
.sg-media{background:var(--bg);border-radius:8px;display:flex;align-items:center;justify-content:center;min-height:240px;max-height:62vh;overflow:hidden}
|
|
331
|
+
.sg-media img,.sg-media video{max-width:100%;max-height:62vh;object-fit:contain;display:block}
|
|
332
|
+
.sg-none{color:var(--dim)}
|
|
333
|
+
.sg-strip,.sg-chips{display:flex;flex-wrap:wrap;gap:var(--s1);align-items:center}
|
|
334
|
+
.sg-strip .rv-chip.on,.sg-chips .rv-chip.on{outline:2px solid var(--accent)}
|
|
335
|
+
.sg-from{font-size:11px;color:var(--dim);text-transform:uppercase;letter-spacing:.04em;margin-right:var(--s1)}
|
|
336
|
+
.sg-words{display:flex;flex-direction:column;gap:var(--s1);max-height:26vh;overflow:auto}
|
|
337
|
+
.sg-words .rv-chip{text-align:left;white-space:normal}
|
|
338
|
+
.sg-field{display:flex;align-items:center;gap:var(--s2);flex-wrap:wrap}
|
|
339
|
+
.sg-field > span:first-child{font-size:11px;color:var(--dim);text-transform:uppercase;letter-spacing:.04em;min-width:58px}
|
|
340
|
+
.sg-field input:not([type]),.sg-field select{flex:1;min-width:0}
|
|
341
|
+
.sg-text{width:100%;min-height:72px;resize:vertical;font:inherit}
|
|
342
|
+
.sg-goes{display:flex;flex-wrap:wrap;gap:var(--s1) var(--s3)}
|
|
343
|
+
.sg-acc{display:inline-flex;align-items:center;gap:var(--s1)}
|
|
344
|
+
.sg-acc.skip{opacity:.5}
|
|
345
|
+
.sg-acc.bad{color:var(--red)}
|
|
346
|
+
.sg-acc select{max-width:160px}
|
|
347
|
+
.sg-polish > span:first-child{min-width:0;text-transform:none;font-size:13px;color:var(--ink);letter-spacing:0}
|
|
348
|
+
.sg-problem{font-size:13px}
|
|
349
|
+
.sg-error{padding:var(--s1) var(--s3)}
|
|
350
|
+
.sg-foot{display:flex;align-items:center;gap:var(--s2);flex-wrap:wrap}
|
|
351
|
+
.sg-note{font-size:12px}
|
|
352
|
+
.rv-stagebtn{font-size:12px;padding:0 var(--s1)}
|
|
353
|
+
@media (max-width:767px){.sg-body{flex-direction:column}.sg-veil{padding:0}.sg-pop{border-radius:0;height:100%}}
|
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
// gets its row when a resource lands in it.
|
|
7
7
|
import { type Resource, type ResourceState, type ResourceType, type TestFacts } from '../../collections/collection-types.ts'
|
|
8
8
|
import type { ProcessRow, RowDot } from '../../home/process-rows.ts'
|
|
9
|
+
import type { CommandRow } from '../../cli/cmd_Commands.ts'
|
|
10
|
+
import type { RunView } from '../../commands/model.ts'
|
|
9
11
|
import { checkVerdictWords, plural } from '../../core/outcome-words.ts'
|
|
10
12
|
import { runsWords } from '../../core/runs-matrix.ts'
|
|
11
13
|
import { checkName } from './check-words.ts'
|
|
@@ -76,10 +78,13 @@ export const KIND_SECTION: Record<ResourceType, SectionId> = {
|
|
|
76
78
|
post: 'media',
|
|
77
79
|
wiki: 'wikis',
|
|
78
80
|
process: 'processes',
|
|
81
|
+
command: 'commands',
|
|
79
82
|
card: 'review',
|
|
80
83
|
cut: 'trailer',
|
|
81
84
|
store: 'stores',
|
|
85
|
+
release: 'releases',
|
|
82
86
|
veille: 'veille',
|
|
87
|
+
message: 'messages',
|
|
83
88
|
}
|
|
84
89
|
|
|
85
90
|
/** a process's colour: up reads green, crashed red, on its way orange,
|
|
@@ -101,6 +106,30 @@ export const processResources = (rows: readonly ProcessRow[]): Resource[] =>
|
|
|
101
106
|
state: PROCESS_STATE[r.dot],
|
|
102
107
|
}))
|
|
103
108
|
|
|
109
|
+
/** the project CLI's commands as tree leaves, read from the CLI itself (commands-st.ts), never from
|
|
110
|
+
* /api/resources.json. A family of more than one command is a branch named by its first word, its leaves by the
|
|
111
|
+
* rest; a command with a run going reads orange */
|
|
112
|
+
export function commandResources(rows: readonly CommandRow[], runs: readonly RunView[]): Resource[] {
|
|
113
|
+
const size = new Map<string, number>()
|
|
114
|
+
for (const r of rows) size.set(r.path.split(' ')[0]!, (size.get(r.path.split(' ')[0]!) ?? 0) + 1)
|
|
115
|
+
const going = new Set(runs.filter((r) => r.state === 'running').map((r) => r.path))
|
|
116
|
+
return rows.map((r): Resource => {
|
|
117
|
+
const family = r.path.split(' ')[0]!
|
|
118
|
+
const grouped = (size.get(family) ?? 0) > 1 && r.path !== family
|
|
119
|
+
return {
|
|
120
|
+
id: `command:${r.path}`,
|
|
121
|
+
type: 'command',
|
|
122
|
+
collection: 'commands',
|
|
123
|
+
path: `commands/${r.path.split(' ').join('/')}`,
|
|
124
|
+
virtual: true,
|
|
125
|
+
title: grouped ? r.path.slice(family.length + 1) : r.path,
|
|
126
|
+
text: r.description,
|
|
127
|
+
state: going.has(r.path) ? 'warn' : 'idle',
|
|
128
|
+
...(grouped ? { group: family } : {}),
|
|
129
|
+
}
|
|
130
|
+
})
|
|
131
|
+
}
|
|
132
|
+
|
|
104
133
|
/** a gate check lives under WHOSE it is: shipkit ships the SK checks, a
|
|
105
134
|
* repo owns what it declared. A kind the map does not know (a newer hub)
|
|
106
135
|
* still lands somewhere */
|
|
@@ -132,6 +161,10 @@ const byLabel = (a: TreeNode, b: TreeNode): number => {
|
|
|
132
161
|
const ad = a.res == null
|
|
133
162
|
const bd = b.res == null
|
|
134
163
|
if (ad !== bd) return ad ? -1 : 1 // groups first, then leaves
|
|
164
|
+
// leaves in a declared order first (a page's tabs), then by label
|
|
165
|
+
const ao = a.res?.order ?? Infinity
|
|
166
|
+
const bo = b.res?.order ?? Infinity
|
|
167
|
+
if (ao !== bo) return ao - bo
|
|
135
168
|
return a.label.localeCompare(b.label)
|
|
136
169
|
}
|
|
137
170
|
|
|
@@ -179,7 +212,8 @@ const groupOf = (r: Resource): Seg[] => {
|
|
|
179
212
|
if (r.check != null || r.type === 'contract' || r.type === 'secret') return []
|
|
180
213
|
if (r.type === 'ask') return isDone(r) ? [{ key: 'type:ask:done', label: 'done', kind: 'done', page: null }] : []
|
|
181
214
|
if (r.type === 'asset' && r.group != null) return [{ key: `cat:${r.group}`, label: r.group, kind: 'category', page: { t: 'cat', cat: r.group } }]
|
|
182
|
-
if (r.type === '
|
|
215
|
+
if (r.type === 'command' && r.group != null) return [{ key: `cmdfam:${r.group}`, label: r.group, kind: 'command', page: null }]
|
|
216
|
+
if (r.type === 'wiki' || r.type === 'asset' || r.type === 'test' || r.type === 'process' || r.type === 'command' || r.type === 'reflection' || r.type === 'message' || r.type === 'release') return []
|
|
183
217
|
return [{ key: `type:${r.type}`, label: r.type, kind: r.type, page: { t: 'col', id: r.collection } }]
|
|
184
218
|
}
|
|
185
219
|
|
|
@@ -398,10 +432,13 @@ export const TYPE_MARK: Record<string, TypeMark> = {
|
|
|
398
432
|
test: { glyph: '\u2263', hue: 'k5', word: 'a test file: the check that runs it, its last runs against its budget, the command that runs it alone' },
|
|
399
433
|
reflection: { glyph: '\u203b', hue: 'k2', word: 'a reflection: friction this repo logged against the wiki, waiting to be folded in' },
|
|
400
434
|
process: { glyph: '\u223f', hue: 'k1', word: 'a global process this repo declares: its state, its menu, its log' },
|
|
435
|
+
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" },
|
|
401
436
|
card: { glyph: '\u25a3', hue: 'k2', word: 'a review card waiting for your answer: approve, fix, reject, circle a detail' },
|
|
402
437
|
cut: { glyph: '\u25b6', hue: 'k3', word: 'a trailer cut: play it with its timeline, pin a note on any frame' },
|
|
403
438
|
store: { glyph: '\u25a5', hue: 'k4', word: 'a store page (Steam, itch): every text to paste, every picture to upload, a note on each' },
|
|
439
|
+
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' },
|
|
404
440
|
veille: { glyph: '\u25ce', hue: 'k6', word: 'the Veille: the posts an identity scrolls past, ranked by the worth of a reply' },
|
|
441
|
+
message: { glyph: '\u275d', hue: 'k3', word: 'a tab of the messages page: the value for its cost, the personas, the page tops, the readers\u2019 notes' },
|
|
405
442
|
done: { glyph: '\u2713', hue: 'k5', word: 'a done ask: answered, filed under done, out of every count above it' },
|
|
406
443
|
}
|
|
407
444
|
|
|
@@ -9,7 +9,7 @@ import type { RepoSt } from './repo-st.ts'
|
|
|
9
9
|
import type { Resource } from './hub-types.ts'
|
|
10
10
|
import { repoSections, type RepoSection } from './repo-sections.ts'
|
|
11
11
|
import { walkKey, type WalkHost } from './list-walk.ts'
|
|
12
|
-
import { buildTree, dirKeys, flattenTree, matchesQuery, passesFilter, processResources, whenCounts, type TreeNode, type TreeRow } from './tree-build.ts'
|
|
12
|
+
import { buildTree, commandResources, dirKeys, flattenTree, matchesQuery, passesFilter, processResources, whenCounts, type TreeNode, type TreeRow } from './tree-build.ts'
|
|
13
13
|
|
|
14
14
|
const EXPANDED_KEY = 'shipkit.tree.expanded'
|
|
15
15
|
|
|
@@ -49,9 +49,10 @@ export class TreeSvc implements WalkHost<TreeRow> {
|
|
|
49
49
|
* branches that still hold something. A search names a thing to find,
|
|
50
50
|
* so it reads every row: the severity group applies only while it is empty */
|
|
51
51
|
/** every row the tree can show: the hub's resources, then the repo's
|
|
52
|
-
* global processes, which pm reports and the hub never lists
|
|
52
|
+
* global processes, which pm reports and the hub never lists, then the
|
|
53
|
+
* commands of its project CLI, which the CLI itself lists */
|
|
53
54
|
private get all(): Resource[] {
|
|
54
|
-
return [...this.st.cols.resources, ...processResources(this.st.globalProcesses)]
|
|
55
|
+
return [...this.st.cols.resources, ...processResources(this.st.globalProcesses), ...commandResources(this.st.commands.rows, this.st.commands.runs)]
|
|
55
56
|
}
|
|
56
57
|
|
|
57
58
|
get visible(): Resource[] {
|
|
@@ -121,6 +122,12 @@ export class TreeSvc implements WalkHost<TreeRow> {
|
|
|
121
122
|
this.expanded.has(key) ? this.expanded.delete(key) : this.expanded.add(key)
|
|
122
123
|
this.save()
|
|
123
124
|
}
|
|
125
|
+
/** unfold a branch the page shown lives in, so its rows are in sight (a page's tab rows); kept like a fold */
|
|
126
|
+
reveal(key: string): void {
|
|
127
|
+
if (this.expanded.has(key)) return
|
|
128
|
+
this.expanded.add(key)
|
|
129
|
+
this.save()
|
|
130
|
+
}
|
|
124
131
|
expandAll(): void {
|
|
125
132
|
for (const k of dirKeys(this.nodes)) this.expanded.add(k)
|
|
126
133
|
this.save()
|
|
@@ -27,7 +27,7 @@ import { appIconOf, appIconPngs, identityOfRoot } from '../core/app-icon.ts'
|
|
|
27
27
|
import { waitingCards } from '../collections/review.ts'
|
|
28
28
|
import { storeDir, warmStore } from '../review/store.ts'
|
|
29
29
|
import { writeArchived } from '../core/archived.ts'
|
|
30
|
-
import { identitiesDir } from '../identities/identities.ts'
|
|
30
|
+
import { identitiesDir, pictureVersion } from '../identities/identities.ts'
|
|
31
31
|
import { identityCache, markFile, railOf, speakerIdOf, type RailIdentity } from '../identities/machine.ts'
|
|
32
32
|
import { speaksAsOfText } from '../social/house.ts'
|
|
33
33
|
|
|
@@ -441,7 +441,9 @@ export function projectGutter(d: GutterDeps) {
|
|
|
441
441
|
const i = (await readIds()).identities.find((x) => x.id === id)
|
|
442
442
|
const file = i == null ? null : markFile(i)
|
|
443
443
|
if (file == null || !existsSync(file)) return new Response(`no mark for the identity ${JSON.stringify(id)}`, { status: 404 })
|
|
444
|
-
|
|
444
|
+
// the url names the file's version (markUrl): kept for good while it is the current one, else asked again
|
|
445
|
+
const v = new URL(req.url).searchParams.get('v')
|
|
446
|
+
return new Response(Bun.file(file), { headers: { 'cache-control': v != null && v !== '' && v === pictureVersion(file) ? 'public, max-age=31536000, immutable' : 'no-cache' } })
|
|
445
447
|
}
|
|
446
448
|
if (path.startsWith('/api/projects/app-icon/')) {
|
|
447
449
|
if (repos.length === 0) await answer()
|
package/src/serve/same-origin.ts
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
// the one guard on a request that changes something, shared by the hub and
|
|
2
|
-
// the standalone graph server.
|
|
2
|
+
// the standalone graph server, and where a request came from.
|
|
3
|
+
|
|
4
|
+
/** a Host header's name: its port, brackets and trailing dot gone, lowercase */
|
|
5
|
+
export function hostName(host: string): string {
|
|
6
|
+
const h = host.trim().toLowerCase()
|
|
7
|
+
const name = h.startsWith('[') ? h.slice(1, h.indexOf(']') < 0 ? undefined : h.indexOf(']')) : h.replace(/:\d+$/, '')
|
|
8
|
+
return name.replace(/\.$/, '')
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/** a name only this machine resolves to itself */
|
|
12
|
+
export const loopbackName = (n: string): boolean => n === 'localhost' || n.endsWith('.localhost') || n === '::1' || /^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(n)
|
|
13
|
+
|
|
14
|
+
/** where a request came from: this machine, or another one over the tailnet (his phone) */
|
|
15
|
+
export type Reach = 'local' | 'tailnet'
|
|
16
|
+
/** the web's tag on what it forwards to the daemon, which never sees the browser's Host */
|
|
17
|
+
export const REACH_HEADER = 'x-shipkit-reach'
|
|
18
|
+
|
|
19
|
+
export const reachOfHost = (host: string | null): Reach => (host != null && host !== '' && loopbackName(hostName(host)) ? 'local' : 'tailnet')
|
|
20
|
+
|
|
21
|
+
/** the web's tag when it forwarded the request, else this server's own Host */
|
|
22
|
+
export function reachOf(req: Request): Reach {
|
|
23
|
+
const tag = req.headers.get(REACH_HEADER)
|
|
24
|
+
return tag === 'local' || tag === 'tailnet' ? tag : reachOfHost(req.headers.get('host') ?? new URL(req.url).host)
|
|
25
|
+
}
|
|
3
26
|
/** 127.0.0.1 keeps other machines out, not other sites: any page open in the
|
|
4
27
|
* browser can POST to localhost. A request that changes something passes
|
|
5
28
|
* only from the hub's own page, or from a client that is not a browser at
|