rvlib-shipkit 2.12.0 → 2.13.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.
Files changed (290) hide show
  1. package/CHANGELOG.md +48 -13
  2. package/README.md +1 -1
  3. package/package.json +4 -2
  4. package/src/agent-time/store.ts +2 -2
  5. package/src/check.ts +1 -1
  6. package/src/checks/SK001-package-json-shape.check.ts +4 -0
  7. package/src/checks/SK003-claude-md-shape.check.ts +1 -1
  8. package/src/checks/SK004-gitignore-policy.check.ts +27 -2
  9. package/src/checks/SK005-rvlib-versions.check.ts +1 -1
  10. package/src/checks/SK008-reviewer-agent.check.ts +2 -2
  11. package/src/checks/SK012-config-barrel-import.check.ts +1 -1
  12. package/src/checks/SK015-nested-repo.check.ts +1 -1
  13. package/src/checks/SK035-public-clean.check.ts +46 -0
  14. package/src/checks/SK036-draft-media-size.check.ts +28 -0
  15. package/src/cli/cmd_Backup.ts +152 -0
  16. package/src/cli/cmd_Ci.ts +8 -11
  17. package/src/cli/cmd_Drill.ts +145 -0
  18. package/src/cli/cmd_Home.ts +50 -3
  19. package/src/cli/cmd_Media.ts +7 -5
  20. package/src/cli/cmd_Review.ts +4 -2
  21. package/src/cli/cmd_Shot.ts +5 -2
  22. package/src/cli/cmd_Smoke.ts +4 -1
  23. package/src/cli/cmd_Social.ts +226 -0
  24. package/src/cli/cmd_Start.ts +1 -1
  25. package/src/cli/cmd_Time.ts +1 -1
  26. package/src/cli/cmd_Trailer.ts +5 -2
  27. package/src/cli/cmd_Veille.ts +173 -0
  28. package/src/cli/family-pages.ts +3 -0
  29. package/src/cli/registry.ts +13 -2
  30. package/src/cli.ts +5 -2
  31. package/src/collections/actions.ts +1 -49
  32. package/src/collections/checks.ts +2 -1
  33. package/src/collections/collection-types.ts +11 -2
  34. package/src/collections/providers.ts +4 -4
  35. package/src/collections/review.ts +2 -1
  36. package/src/collections/tests.ts +19 -8
  37. package/src/contracts/apply-contracts.ts +1 -3
  38. package/src/contracts/contract-manifests.ts +2 -3
  39. package/src/contracts/contract-types.ts +0 -1
  40. package/src/contracts/contracts-engine.ts +0 -3
  41. package/src/core/app-icon.ts +9 -3
  42. package/src/core/bun-builtins.ts +2 -2
  43. package/src/core/discover-checks.ts +37 -5
  44. package/src/core/fix-scope.ts +4 -2
  45. package/src/core/floor-resolve.ts +68 -48
  46. package/src/core/floor.ts +9 -0
  47. package/src/core/git-root.ts +24 -0
  48. package/src/core/last-good.ts +3 -1
  49. package/src/core/layout.ts +8 -0
  50. package/src/core/log-stamp.ts +36 -0
  51. package/src/core/loop-watch.ts +93 -0
  52. package/src/core/machine-link.ts +134 -0
  53. package/src/core/memory-watch.ts +41 -0
  54. package/src/core/one-way-in-policy.ts +27 -19
  55. package/src/core/run-ci.ts +6 -8
  56. package/src/core/run-fixers.ts +9 -9
  57. package/src/core/slots.ts +21 -0
  58. package/src/core/tree-rev.ts +60 -0
  59. package/src/core/unit-files.ts +42 -0
  60. package/src/drill/render.ts +140 -0
  61. package/src/drill/run.ts +269 -0
  62. package/src/fleet/scan-fleet.ts +6 -5
  63. package/src/home/daemon-jobs.ts +201 -0
  64. package/src/home/global-context.ts +34 -1
  65. package/src/home/home-routes.ts +22 -15
  66. package/src/home/hubs.ts +10 -3
  67. package/src/home/inbox-shape.ts +53 -4
  68. package/src/home/inbox.ts +16 -1
  69. package/src/home/lib-watch.ts +10 -3
  70. package/src/home/machine-stores.ts +15 -29
  71. package/src/home/run-daemon.ts +15 -18
  72. package/src/home/run-pm.ts +2 -0
  73. package/src/home/serve-daemon.ts +4 -3
  74. package/src/home/serve-web.ts +104 -1
  75. package/src/hooks/commit-message.ts +28 -19
  76. package/src/hooks/leak-guard.ts +10 -3
  77. package/src/hooks/run-hooks.ts +2 -6
  78. package/src/identities/identities.ts +334 -0
  79. package/src/identities/machine-route.ts +126 -0
  80. package/src/identities/machine.ts +62 -0
  81. package/src/init-repo.ts +1 -1
  82. package/src/ledger/check-stats.ts +10 -9
  83. package/src/ledger/gate-checks.ts +32 -1
  84. package/src/ledger/record-kept.ts +112 -0
  85. package/src/ledger/repo-view.ts +10 -0
  86. package/src/ledger/run-log.ts +17 -12
  87. package/src/ledger/run-timeline.ts +8 -4
  88. package/src/ledger/store.ts +7 -0
  89. package/src/ledger/suite-log.ts +17 -13
  90. package/src/media-kinds.ts +2 -1
  91. package/src/media-store/backup/daemon.ts +73 -0
  92. package/src/media-store/backup/keys.ts +25 -0
  93. package/src/media-store/backup/manifest.ts +193 -0
  94. package/src/media-store/backup/restore.ts +192 -0
  95. package/src/media-store/backup/run.ts +278 -0
  96. package/src/media-store/backup/secret.ts +86 -0
  97. package/src/media-store/backup/snapshot.ts +64 -0
  98. package/src/media-store/backup/sources.ts +199 -0
  99. package/src/media-store/daemon.ts +56 -70
  100. package/src/media-store/put.ts +4 -2
  101. package/src/media-store/space.ts +23 -4
  102. package/src/pages/forward.ts +35 -0
  103. package/src/pages/frame-client.ts +118 -0
  104. package/src/pages/routes.ts +29 -0
  105. package/src/pages/unit.ts +92 -0
  106. package/src/plan/planner.ts +12 -0
  107. package/src/plan/repo-source.ts +19 -5
  108. package/src/reflect/transcript.ts +35 -10
  109. package/src/release/public-clean.ts +301 -0
  110. package/src/release/published-here.ts +22 -0
  111. package/src/release/run-bump.ts +2 -1
  112. package/src/release/run-release.ts +4 -1
  113. package/src/repo-config.ts +53 -2
  114. package/src/review/http.ts +16 -2
  115. package/src/review/model.ts +15 -4
  116. package/src/review/notes.ts +77 -0
  117. package/src/review/project.ts +6 -38
  118. package/src/review/routes.ts +4 -12
  119. package/src/review/store.ts +41 -1
  120. package/src/review/trailer-media.ts +7 -4
  121. package/src/review/trailer-shots.ts +21 -4
  122. package/src/review/unit.ts +1 -1
  123. package/src/scaffold/files/agent-handoff.md +3 -0
  124. package/src/scaffold/files/agent-index.md +4 -12
  125. package/src/scaffold/project-scaffold.ts +5 -4
  126. package/src/serve/embed.ts +1 -1
  127. package/src/serve/hub-app/col-card.tsx +3 -17
  128. package/src/serve/hub-app/col-tables-view.tsx +2 -1
  129. package/src/serve/hub-app/cols-svc.ts +0 -13
  130. package/src/serve/hub-app/dock-st.ts +4 -2
  131. package/src/serve/hub-app/dock-view.tsx +2 -0
  132. package/src/serve/hub-app/frames-st.ts +35 -0
  133. package/src/serve/hub-app/hash-route.ts +64 -1
  134. package/src/serve/hub-app/home-st.ts +31 -7
  135. package/src/serve/hub-app/home-strip.css +9 -1
  136. package/src/serve/hub-app/home-strip.tsx +7 -6
  137. package/src/serve/hub-app/home.html +5 -0
  138. package/src/serve/hub-app/hub-app.tsx +49 -5
  139. package/src/serve/hub-app/hub.css +29 -11
  140. package/src/serve/hub-app/icons.tsx +16 -1
  141. package/src/serve/hub-app/identities-st.ts +210 -0
  142. package/src/serve/hub-app/identities-view.tsx +352 -0
  143. package/src/serve/hub-app/identities.css +48 -0
  144. package/src/serve/hub-app/identity-address.ts +52 -0
  145. package/src/serve/hub-app/inbox-st.ts +59 -6
  146. package/src/serve/hub-app/inbox-view.tsx +48 -6
  147. package/src/serve/hub-app/inbox.css +12 -1
  148. package/src/serve/hub-app/index.html +3 -0
  149. package/src/serve/hub-app/keys.ts +10 -2
  150. package/src/serve/hub-app/list-walk.ts +89 -0
  151. package/src/serve/hub-app/machine-st.ts +12 -0
  152. package/src/serve/hub-app/media-view.tsx +2 -1
  153. package/src/serve/hub-app/pages-frames.tsx +134 -0
  154. package/src/serve/hub-app/pages-svc.ts +111 -0
  155. package/src/serve/hub-app/palette-st.ts +18 -3
  156. package/src/serve/hub-app/palette-view.tsx +9 -2
  157. package/src/serve/hub-app/planned-view.tsx +2 -1
  158. package/src/serve/hub-app/project-list.css +18 -14
  159. package/src/serve/hub-app/project-list.tsx +88 -49
  160. package/src/serve/hub-app/projects-svc.ts +33 -3
  161. package/src/serve/hub-app/repo-sections.ts +19 -2
  162. package/src/serve/hub-app/repo-st.ts +75 -19
  163. package/src/serve/hub-app/review/review-cells.tsx +3 -3
  164. package/src/serve/hub-app/review/review-kit.ts +30 -7
  165. package/src/serve/hub-app/review/review-page.tsx +1 -1
  166. package/src/serve/hub-app/review/review-st.ts +19 -8
  167. package/src/serve/hub-app/review/review-thread.tsx +11 -9
  168. package/src/serve/hub-app/review/review-views.tsx +84 -19
  169. package/src/serve/hub-app/review/thread-st.ts +1 -10
  170. package/src/serve/hub-app/review/trailer-page.tsx +2 -1
  171. package/src/serve/hub-app/review.css +17 -8
  172. package/src/serve/hub-app/site/site-part.tsx +173 -0
  173. package/src/serve/hub-app/site/site-st.ts +157 -0
  174. package/src/serve/hub-app/site.css +35 -0
  175. package/src/serve/hub-app/social/calendar.tsx +182 -0
  176. package/src/serve/hub-app/social/comms-page.tsx +306 -0
  177. package/src/serve/hub-app/social/kit.tsx +244 -0
  178. package/src/serve/hub-app/social/post-card.tsx +456 -0
  179. package/src/serve/hub-app/social/problems.tsx +60 -0
  180. package/src/serve/hub-app/social/social-model.ts +154 -0
  181. package/src/serve/hub-app/social/social-page.tsx +674 -0
  182. package/src/serve/hub-app/social/social-st.ts +986 -0
  183. package/src/serve/hub-app/social.css +289 -0
  184. package/src/serve/hub-app/stores/stores-page.tsx +311 -0
  185. package/src/serve/hub-app/stores/stores-st.ts +286 -0
  186. package/src/serve/hub-app/stores.css +54 -0
  187. package/src/serve/hub-app/timeline-geometry.ts +1 -1
  188. package/src/serve/hub-app/timeline-view.tsx +3 -2
  189. package/src/serve/hub-app/tree-build.ts +6 -0
  190. package/src/serve/hub-app/tree-row.tsx +27 -4
  191. package/src/serve/hub-app/tree-svc.ts +18 -49
  192. package/src/serve/hub-app/veille/veille-page.tsx +514 -0
  193. package/src/serve/hub-app/veille/veille-st.ts +443 -0
  194. package/src/serve/hub-app/veille.css +84 -0
  195. package/src/serve/hub-runtime.ts +14 -9
  196. package/src/serve/project-gutter-route.ts +44 -12
  197. package/src/serve/run-lanes.ts +7 -4
  198. package/src/serve/same-origin.ts +1 -1
  199. package/src/serve/serve-hub.ts +20 -12
  200. package/src/serve/tracked-watch.ts +24 -3
  201. package/src/serve/warm-cell.ts +5 -1
  202. package/src/shipkit-files.ts +15 -4
  203. package/src/shipkit.ts +0 -1
  204. package/src/shot/box.ts +162 -0
  205. package/src/shot/browser-slot.ts +62 -0
  206. package/src/shot/client.ts +43 -7
  207. package/src/shot/clip-encoder.ts +93 -12
  208. package/src/shot/film-box.ts +188 -0
  209. package/src/shot/shooter.ts +50 -15
  210. package/src/shot/shot-ask.ts +10 -2
  211. package/src/shot/stepped-clip.ts +5 -4
  212. package/src/site/desk.ts +242 -0
  213. package/src/site/routes.ts +66 -0
  214. package/src/site/unit.ts +62 -0
  215. package/src/social/brands.ts +22 -0
  216. package/src/social/compose.ts +97 -0
  217. package/src/social/desk-index.ts +123 -0
  218. package/src/social/desk-wire.ts +64 -0
  219. package/src/social/drafts.ts +183 -0
  220. package/src/social/house.ts +24 -0
  221. package/src/social/load.ts +319 -0
  222. package/src/social/md.ts +70 -0
  223. package/src/social/media-facts.ts +53 -0
  224. package/src/social/media-kind.ts +189 -0
  225. package/src/social/media-limit.ts +42 -0
  226. package/src/social/media-of.ts +30 -0
  227. package/src/social/migrate.ts +123 -0
  228. package/src/social/open.ts +17 -0
  229. package/src/social/post-url.ts +158 -0
  230. package/src/social/presence.ts +332 -0
  231. package/src/social/public-read.ts +53 -0
  232. package/src/social/publish/bluesky.ts +168 -0
  233. package/src/social/publish/discord.ts +76 -0
  234. package/src/social/publish/index.ts +24 -0
  235. package/src/social/publish/secret.ts +13 -0
  236. package/src/social/push.ts +31 -0
  237. package/src/social/richtext.ts +37 -0
  238. package/src/social/routes.ts +180 -0
  239. package/src/social/stats.ts +134 -0
  240. package/src/social/text.ts +267 -0
  241. package/src/social/tracker-route.ts +39 -0
  242. package/src/social/tracker.ts +255 -0
  243. package/src/social/unit.ts +53 -0
  244. package/src/social/writes.ts +130 -0
  245. package/src/start-repo.ts +14 -9
  246. package/src/stores/collection.ts +27 -0
  247. package/src/stores/desk.ts +336 -0
  248. package/src/stores/model.ts +187 -0
  249. package/src/stores/routes.ts +126 -0
  250. package/src/stores/unit.ts +57 -0
  251. package/src/suite/calibrate.ts +127 -0
  252. package/src/suite/core-counters.ts +91 -0
  253. package/src/suite/judge-suites.ts +94 -34
  254. package/src/suite/suite-cli.ts +44 -10
  255. package/src/suite/suite-cpu-preload.ts +34 -9
  256. package/src/trailer/adapter.ts +4 -0
  257. package/src/trailer/build.ts +42 -11
  258. package/src/trailer/ffmpeg.ts +11 -0
  259. package/src/trailer/footage.ts +30 -13
  260. package/src/trailer/grammar.ts +18 -2
  261. package/src/trailer/graph.ts +28 -6
  262. package/src/trailer/passage.ts +17 -5
  263. package/src/trailer/plan.ts +74 -3
  264. package/src/trailer/stitch.ts +67 -26
  265. package/src/trailer/url.ts +1 -1
  266. package/src/trailer/versions.ts +24 -0
  267. package/src/ts/gate-typecheck.ts +32 -0
  268. package/src/ts/typecheck-cli.ts +9 -11
  269. package/src/tui/tui-app.tsx +0 -1
  270. package/src/veille/asks.ts +155 -0
  271. package/src/veille/auto.ts +31 -0
  272. package/src/veille/batch.ts +27 -0
  273. package/src/veille/chrome.ts +127 -0
  274. package/src/veille/collection.ts +28 -0
  275. package/src/veille/desk.ts +242 -0
  276. package/src/veille/identity.ts +80 -0
  277. package/src/veille/import.ts +68 -0
  278. package/src/veille/log.ts +183 -0
  279. package/src/veille/platforms.ts +118 -0
  280. package/src/veille/reads.ts +66 -0
  281. package/src/veille/replied.ts +110 -0
  282. package/src/veille/routes.ts +185 -0
  283. package/src/veille/service.ts +81 -0
  284. package/src/veille/watch.ts +116 -0
  285. package/src/veille/worth.ts +46 -0
  286. package/src/wiki/scan-md.ts +18 -0
  287. package/src/collections/posts.ts +0 -142
  288. package/src/contracts/manifests/social.contract.ts +0 -20
  289. package/src/scaffold/files/agent-coding.md +0 -35
  290. package/src/ts/typecheck-cache.ts +0 -11
@@ -0,0 +1,286 @@
1
+ // a repo's stores page as state (wiki build/shipkit/stores.md, The page): the desk read from the hub, the store
2
+ // picked, the section open in the editor, the capsules fitted or at their real size, the lightbox, a family made again
3
+ // with its log, his notes. The desk is read when the page opens, when the window comes back, and after each act
4
+ import { makeAutoObservable, runInAction } from 'mobx'
5
+ import { isStore, type StoreId } from '../../../stores/model.ts'
6
+ import type { FieldView, Picture, StoreView, StoresState } from '../../../stores/desk.ts'
7
+ import type { RenderFamily } from '../../../stores/unit.ts'
8
+ import { reach } from '../reach.ts'
9
+ import type { RepoSt } from '../repo-st.ts'
10
+ import { copyText, postJson } from '../review/review-kit.ts'
11
+
12
+ export type { FieldView, Picture, StoreView }
13
+
14
+ const FIT = 'hub:stores-fit'
15
+
16
+ const keyOf = (f: Pick<FieldView, 'file' | 'heading'>): string => `${f.file}#${f.heading}`
17
+
18
+ export class StoresSt {
19
+ desk: StoresState | null = null
20
+ loadError: string | null = null
21
+ store: StoreId | null = null
22
+ /** the capsules fitted to the column; false: one CSS pixel a pixel */
23
+ fit = false
24
+ /** the section open in the editor, by its file and heading, and its text */
25
+ editing: { key: string; text: string } | null = null
26
+ lightbox: { family: string; index: number } | null = null
27
+ /** the note boxes open, by asset, and what is typed in each */
28
+ noteOpen: Record<string, boolean> = {}
29
+ noteText: Record<string, string> = {}
30
+ render: { family: RenderFamily; log: string; running: boolean } | null = null
31
+ /** the thing a link names, scrolled to once drawn */
32
+ focus: string | null = null
33
+ busy = false
34
+ error: string | null = null
35
+ /** what the last copy put on the clipboard, a moment */
36
+ toast: string | null = null
37
+ private timer: ReturnType<typeof setTimeout> | null = null
38
+ private started = 0
39
+
40
+ constructor(private readonly st: RepoSt) {
41
+ try {
42
+ this.fit = localStorage.getItem(FIT) === '1'
43
+ } catch {
44
+ // no storage: the switch lasts for this page
45
+ }
46
+ makeAutoObservable<this, 'st' | 'timer' | 'started' | 'onBack'>(this, { st: false, timer: false, started: false, onBack: false })
47
+ }
48
+
49
+ get stores(): StoreView[] {
50
+ return this.desk?.stores ?? []
51
+ }
52
+
53
+ /** the page laid out for a phone (the review page's switch) */
54
+ get phone(): boolean {
55
+ return this.st.review.phone.on
56
+ }
57
+
58
+ get current(): StoreView | null {
59
+ return this.stores.find((s) => s.id === this.store) ?? this.stores[0] ?? null
60
+ }
61
+
62
+ /** the page shows: read the desk, and again when the window comes back */
63
+ start(): void {
64
+ if (this.started++ === 0) window.addEventListener('focus', this.onBack)
65
+ void this.load()
66
+ }
67
+
68
+ stop(): void {
69
+ if (--this.started === 0) window.removeEventListener('focus', this.onBack)
70
+ }
71
+
72
+ private readonly onBack = (): void => void this.load()
73
+
74
+ async load(): Promise<void> {
75
+ try {
76
+ const r = await reach(this.st.url('/api/stores'))
77
+ const body = (await r.json()) as StoresState & { error?: string }
78
+ if (!r.ok) throw new Error(body.error ?? `HTTP ${r.status}`)
79
+ runInAction(() => {
80
+ this.desk = body
81
+ this.loadError = null
82
+ })
83
+ } catch (e) {
84
+ runInAction(() => (this.loadError = (e as Error).message))
85
+ }
86
+ }
87
+
88
+ /** the page on a store, a thing of it scrolled to when named; its note box opened */
89
+ select(store: string | null, focus: string | null = null): void {
90
+ this.store = isStore(store) ? store : null
91
+ this.editing = null
92
+ this.focus = focus
93
+ if (focus) this.noteOpen[focus] = true
94
+ }
95
+
96
+ clearFocus(): void {
97
+ this.focus = null
98
+ }
99
+
100
+ pick(id: StoreId): void {
101
+ this.st.showStores(id)
102
+ }
103
+
104
+ /** ↑ ↓ or j k: the store before or after */
105
+ move(delta: number): void {
106
+ const ids = this.stores.map((s) => s.id)
107
+ const at = this.current ? ids.indexOf(this.current.id) : 0
108
+ const next = ids[Math.max(0, Math.min(ids.length - 1, at + delta))]
109
+ if (next && next !== this.current?.id) this.pick(next)
110
+ }
111
+
112
+ /** the page's keys: the lightbox's arrows and Escape, the store before or after */
113
+ key(e: Pick<KeyboardEvent, 'key'>): boolean {
114
+ const lb = this.lightbox
115
+ if (lb) {
116
+ if (e.key === 'Escape') this.closeLightbox()
117
+ else if (e.key === 'ArrowLeft' || e.key === 'ArrowRight') this.stepLightbox(e.key === 'ArrowLeft' ? -1 : 1)
118
+ else return false
119
+ return true
120
+ }
121
+ if (e.key === 'ArrowUp' || e.key === 'k') this.move(-1)
122
+ else if (e.key === 'ArrowDown' || e.key === 'j') this.move(1)
123
+ else return false
124
+ return true
125
+ }
126
+
127
+ clearError(): void {
128
+ this.error = null
129
+ }
130
+
131
+ setFit(on: boolean): void {
132
+ this.fit = on
133
+ try {
134
+ localStorage.setItem(FIT, on ? '1' : '0')
135
+ } catch {
136
+ // no storage
137
+ }
138
+ }
139
+
140
+ edit(f: FieldView): void {
141
+ this.editing = { key: keyOf(f), text: f.body }
142
+ }
143
+
144
+ type(text: string): void {
145
+ if (this.editing) this.editing.text = text
146
+ }
147
+
148
+ cancelEdit(): void {
149
+ this.editing = null
150
+ }
151
+
152
+ isEditing(f: FieldView): boolean {
153
+ return this.editing?.key === keyOf(f)
154
+ }
155
+
156
+ private async act(run: () => Promise<unknown>): Promise<boolean> {
157
+ if (this.busy) return false
158
+ this.busy = true
159
+ try {
160
+ await run()
161
+ runInAction(() => (this.error = null))
162
+ await this.load()
163
+ return true
164
+ } catch (e) {
165
+ runInAction(() => (this.error = (e as Error).message))
166
+ return false
167
+ } finally {
168
+ runInAction(() => (this.busy = false))
169
+ }
170
+ }
171
+
172
+ async saveEdit(f: FieldView): Promise<void> {
173
+ const s = this.current
174
+ const ed = this.editing
175
+ if (!s || !ed || ed.text.trim() === '') return
176
+ if (await this.act(() => postJson(this.st.url('/api/stores/text'), { store: s.id, file: f.file, heading: f.heading, body: ed.text }))) runInAction(() => (this.editing = null))
177
+ }
178
+
179
+ toggleNote(asset: string): void {
180
+ this.noteOpen[asset] = !this.noteOpen[asset]
181
+ }
182
+
183
+ typeNote(asset: string, text: string): void {
184
+ this.noteText[asset] = text
185
+ }
186
+
187
+ /** his note on one thing: an item of the review store, or his reply on its open thread */
188
+ async sendNote(asset: string): Promise<void> {
189
+ const s = this.current
190
+ const text = (this.noteText[asset] ?? '').trim()
191
+ if (!s || !text) return
192
+ if (await this.act(() => postJson(this.st.url('/api/stores/notes'), { store: s.id, asset, text }))) runInAction(() => (this.noteText[asset] = ''))
193
+ }
194
+
195
+ /** a note's card on the review page: the hub's own, or the host's when the page sits in another tool's frame */
196
+ openNote(id: string): void {
197
+ if (this.st.home.embedded && window.parent !== window) window.parent.postMessage({ shipkit: 'show', page: 'review', hash: `#page:review:${id}` }, location.origin)
198
+ else this.st.showReview(id)
199
+ }
200
+
201
+ openLightbox(family: string, index: number): void {
202
+ this.lightbox = { family, index }
203
+ }
204
+
205
+ closeLightbox(): void {
206
+ this.lightbox = null
207
+ }
208
+
209
+ /** the pictures of the lightbox's family that exist, each with its index in the family */
210
+ get shown(): { pic: Picture; i: number }[] {
211
+ const fam = this.current?.families.find((f) => f.id === this.lightbox?.family)
212
+ return (fam?.pictures ?? []).flatMap((pic, i) => (pic.url ? [{ pic, i }] : []))
213
+ }
214
+
215
+ stepLightbox(by: number): void {
216
+ const lb = this.lightbox
217
+ const list = this.shown
218
+ if (!lb || list.length === 0) return
219
+ const at = Math.max(0, list.findIndex((x) => x.i === lb.index))
220
+ const next = list[(at + by + list.length) % list.length]
221
+ if (next) this.lightbox = { family: lb.family, index: next.i }
222
+ }
223
+
224
+ /** a file of the desk as the hub serves it */
225
+ fileUrl(pic: Picture): string {
226
+ return pic.url ? this.st.url(`/${pic.url}`) : ''
227
+ }
228
+
229
+ private flash(text: string): void {
230
+ this.toast = text
231
+ if (this.timer) clearTimeout(this.timer)
232
+ this.timer = setTimeout(() => runInAction(() => (this.toast = null)), 1600)
233
+ }
234
+
235
+ async copy(text: string, what: string): Promise<void> {
236
+ const ok = await copyText(text)
237
+ runInAction(() => this.flash(ok ? `${what} copied` : 'the clipboard refused it'))
238
+ }
239
+
240
+ async copyImage(pic: Picture): Promise<void> {
241
+ try {
242
+ const blob = await (await fetch(this.fileUrl(pic))).blob()
243
+ const png = blob.type === 'image/png' ? blob : await toPng(blob)
244
+ await navigator.clipboard.write([new ClipboardItem({ 'image/png': png })])
245
+ runInAction(() => this.flash(`${pic.name} copied`))
246
+ } catch (e) {
247
+ runInAction(() => (this.error = `copy image: ${(e as Error).message}`))
248
+ }
249
+ }
250
+
251
+ async reveal(pic: Picture): Promise<void> {
252
+ try {
253
+ await postJson(this.st.url('/api/stores/reveal'), { path: pic.path })
254
+ } catch (e) {
255
+ runInAction(() => (this.error = (e as Error).message))
256
+ }
257
+ }
258
+
259
+ /** the unit's command for a family, asked first, its log read as it streams, the pictures read again at the end */
260
+ async regenerate(family: RenderFamily, cmd: string, about: string): Promise<void> {
261
+ if (this.render?.running) return
262
+ if (!confirm(`Make the ${family} again with « ${cmd} »${about ? ` (${about})` : ''}?`)) return
263
+ this.render = { family, log: '', running: true }
264
+ try {
265
+ const r = await reach(this.st.url('/api/stores/render'), { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ family }) })
266
+ if (!r.ok || r.body == null) throw new Error(((await r.json().catch(() => ({}))) as { error?: string }).error ?? `HTTP ${r.status}`)
267
+ const dec = new TextDecoder()
268
+ for await (const chunk of r.body as unknown as AsyncIterable<Uint8Array>) runInAction(() => this.render && (this.render.log += dec.decode(chunk, { stream: true })))
269
+ } catch (e) {
270
+ runInAction(() => this.render && (this.render.log += `\n${(e as Error).message}\n`))
271
+ } finally {
272
+ runInAction(() => this.render && (this.render.running = false))
273
+ await this.load()
274
+ }
275
+ }
276
+ }
277
+
278
+ /** a jpeg as a png: the clipboard takes png alone */
279
+ async function toPng(blob: Blob): Promise<Blob> {
280
+ const img = await createImageBitmap(blob)
281
+ const c = document.createElement('canvas')
282
+ c.width = img.width
283
+ c.height = img.height
284
+ c.getContext('2d')?.drawImage(img, 0, 0)
285
+ return await new Promise((ok, no) => c.toBlob((b) => (b ? ok(b) : no(new Error('no png'))), 'image/png'))
286
+ }
@@ -0,0 +1,54 @@
1
+ /* the stores page (hub-app/stores/, wiki build/shipkit/stores.md): white cards on the gray ground, the hub's tokens.
2
+ A tone class sets --tone and the parts read it, so no rule here writes a colour (tests/hub-css-invariants.test.ts) */
3
+ .t-ok{--tone:var(--ok)}.t-warn{--tone:var(--warn)}.t-red{--tone:var(--red)}.t-dim{--tone:var(--dim)}
4
+ .sto-wrap.t-ok,.sto-wrap.t-warn,.sto-wrap.t-red,.sto-count.t-red,.sto-picrow .t-red{color:var(--tone)}
5
+ .sto-ground{background:var(--bg)}
6
+ .sto-list,.sto-colin{display:flex;flex-direction:column;gap:var(--s3);padding:var(--s3)}
7
+ .sto-card{background:var(--panel);border:1px solid var(--line);border-radius:6px;padding:var(--s3);display:flex;flex-direction:column;gap:var(--s2);min-width:0}
8
+ .sto-pick{cursor:pointer}
9
+ .sto-pick.on{border-color:var(--accent);box-shadow:0 0 0 1px var(--accent)}
10
+ .sto-head{display:flex;align-items:center;gap:var(--s2);min-width:0}
11
+ .sto-grow{flex:1;min-width:0}
12
+ .sto-badge{font-size:11px;padding:0 var(--s2);border-radius:999px;border:1px solid var(--tone);color:var(--tone)}
13
+ .sto-facts{display:flex;flex-direction:column;gap:var(--s1);font-size:12px}
14
+ .sto-fact{display:flex;align-items:flex-start;gap:var(--s2)}
15
+ .sto-fact > .rv-dim{text-align:right;max-width:50%;overflow-wrap:anywhere}
16
+ .sto-dot{flex:none;width:8px;height:8px;border-radius:4px;margin-top:var(--s1);background:var(--tone)}
17
+ .sto-cap{font-size:11px;font-weight:700;color:var(--dim);text-transform:uppercase;letter-spacing:.04em}
18
+ .sto-cap .rv-mono{text-transform:none;letter-spacing:0;font-weight:400}
19
+ .sto-wrap{overflow-wrap:anywhere}
20
+ .sto-files{display:flex;flex-wrap:wrap;gap:var(--s2);font-size:12px}
21
+ .sto-seller{font-size:13px}
22
+ .sto-close{cursor:pointer}
23
+ .sto-aside{font-size:12px;color:var(--dim)}
24
+ .sto-md p{margin:0 0 var(--s1)}
25
+ .sto-md ul{margin:0;padding-left:var(--s4)}
26
+ .sto-copyframe{border:1px solid var(--line);border-radius:4px;padding:var(--s2);display:flex;flex-direction:column;gap:var(--s2);background:var(--panel2)}
27
+ .sto-value{font-size:13px}
28
+ .sto-acts{display:flex;align-items:center;gap:var(--s2);flex-wrap:wrap}
29
+ .sto-edit{width:100%;box-sizing:border-box;font:12px/1.45 ui-monospace,Menlo,monospace;background:var(--bg);color:var(--ink);border:1px solid var(--line);border-radius:4px;padding:var(--s2)}
30
+ .sto-count{font-size:11px}
31
+ .sto-note{font-size:11px;padding:0 var(--s2)}
32
+ .sto-note.on{color:var(--accent);border-color:var(--accent)}
33
+ .sto-notes{display:flex;flex-direction:column;gap:var(--s1)}
34
+ .sto-notes textarea{width:100%;box-sizing:border-box;background:var(--bg);color:var(--ink);border:1px solid var(--line);border-radius:4px;padding:var(--s1) var(--s2);font:12.5px/1.45 system-ui,sans-serif}
35
+ .sto-said{text-align:left;font-size:12px;padding:var(--s1) var(--s2);border-left:3px solid var(--tone);white-space:pre-wrap}
36
+ .sto-saidstate{font-size:10.5px;text-transform:uppercase;color:var(--tone)}
37
+ .sto-log{max-height:240px;overflow:auto;font:11px/1.4 ui-monospace,Menlo,monospace;white-space:pre-wrap;margin:0;padding:var(--s2);background:var(--bg);border:1px solid var(--line);border-radius:4px}
38
+ .sto-pics{display:flex;flex-direction:column;gap:var(--s4)}
39
+ .sto-scrollx{overflow-x:auto;max-width:100%}
40
+ .sto-frame{position:relative;display:inline-block;max-width:100%}
41
+ .sto-scrollx .sto-frame{max-width:none}
42
+ .sto-real{display:block;max-width:none;background:var(--panel2)}
43
+ .sto-fit{display:block;width:100%;background:var(--panel2);border-radius:4px}
44
+ .sto-clip{display:block;width:100%;max-height:420px;border-radius:6px;background:var(--solid)}
45
+ .sto-todo{border:2px dashed var(--line);border-radius:6px;width:240px;padding:var(--s4);text-align:center;color:var(--dim)}
46
+ .sto-expand{position:absolute;top:var(--s2);left:var(--s2);background:var(--panel);font-size:14px;padding:0 var(--s2)}
47
+ .sto-picrow{display:flex;align-items:center;gap:var(--s2);flex-wrap:wrap;margin-top:var(--s1)}
48
+ .sto-picrow button{font-size:11px;padding:0 var(--s2)}
49
+ .sto-lightbox{position:fixed;inset:0;z-index:50;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--s2);padding:var(--s4)}
50
+ .sto-lightbox::before{content:'';position:absolute;inset:0;background:var(--solid);opacity:.86}
51
+ .sto-lightbox > *{position:relative}
52
+ .sto-lbbar{display:flex;align-items:center;gap:var(--s3);background:var(--panel);border:1px solid var(--line);border-radius:6px;padding:var(--s1) var(--s3);font-size:13px}
53
+ .sto-lbmedia{max-width:100%;max-height:calc(100% - 48px);object-fit:contain;box-shadow:0 6px 20px var(--shadow)}
54
+ .sto-phone{height:100%;overflow-y:auto;background:var(--bg)}
@@ -135,7 +135,7 @@ export function tOf(a: Axis, x: number): number {
135
135
  /** each bar's lane: the first lane free by the time it starts, so bars that
136
136
  * ran at once stack and bars that ran one after another share a lane */
137
137
  export function packLanes(bars: Span[], cap = Number.POSITIVE_INFINITY): { lanes: number[]; count: number; hidden: number } {
138
- const order = bars.map((b, i) => i).sort((i, j) => bars[i]!.start - bars[j]!.start || bars[i]!.end - bars[j]!.end)
138
+ const order = bars.map((_, i) => i).sort((i, j) => bars[i]!.start - bars[j]!.start || bars[i]!.end - bars[j]!.end)
139
139
  const ends: number[] = []
140
140
  // -1 = past the cap: counted, never drawn over another bar
141
141
  const lanes: number[] = new Array(bars.length).fill(-1)
@@ -18,10 +18,11 @@ import { durationTone, fmtMs } from './dur.ts'
18
18
  import { Help } from './help.tsx'
19
19
  import type { RepoSt } from './repo-st.ts'
20
20
  import { TimeAgo, stampWords } from './time-ago.tsx'
21
- import { checkName, editorHref } from './check-words.ts'
21
+ import { checkName } from './check-words.ts'
22
22
  import { RUNS_TABS, runsTab, runsTabId, type RunsTab } from './runs-tabs.ts'
23
23
  export { RUNS_TABS, runsTab, runsTabId, type RunsTab }
24
24
  import type { Resource } from './hub-types.ts'
25
+ import { Caret } from './icons.tsx'
25
26
 
26
27
  export type TabBadge = { n: number; tone: 'red' | 'warn' | 'zero' }
27
28
 
@@ -109,7 +110,7 @@ const RunLine = observer(({ app, inv, n }: { app: RepoSt; inv: TimelineInvocatio
109
110
  return (
110
111
  <>
111
112
  <div className={`rline rrun${inv.reds > 0 ? ' red' : ''}`} onClick={() => app.timeline.toggle(inv.runId, n)}>
112
- <span className="rcaret">{open ? '▾' : '▸'}</span>
113
+ <span className="rcaret"><Caret open={open} /></span>
113
114
  <TimeAgo clock={app.clock} at={inv.started} />
114
115
  <Who by={inv.by} />
115
116
  <span className="rwhat">{inv.label}</span>
@@ -54,6 +54,8 @@ export type TreeRow = {
54
54
  reds: number
55
55
  checks: string[]
56
56
  page: HashSel | null
57
+ /** a row of the repo's own pages, the block under the sections: the page's id (pages-svc.ts) */
58
+ proj?: string
57
59
  }
58
60
 
59
61
  /** the sections, top to bottom */
@@ -76,6 +78,8 @@ export const KIND_SECTION: Record<ResourceType, SectionId> = {
76
78
  process: 'processes',
77
79
  card: 'review',
78
80
  cut: 'trailer',
81
+ store: 'stores',
82
+ veille: 'veille',
79
83
  }
80
84
 
81
85
  /** a process's colour: up reads green, crashed red, on its way orange,
@@ -396,6 +400,8 @@ export const TYPE_MARK: Record<string, TypeMark> = {
396
400
  process: { glyph: '\u223f', hue: 'k1', word: 'a global process this repo declares: its state, its menu, its log' },
397
401
  card: { glyph: '\u25a3', hue: 'k2', word: 'a review card waiting for your answer: approve, fix, reject, circle a detail' },
398
402
  cut: { glyph: '\u25b6', hue: 'k3', word: 'a trailer cut: play it with its timeline, pin a note on any frame' },
403
+ store: { glyph: '\u25a5', hue: 'k4', word: 'a store page (Steam, itch): every text to paste, every picture to upload, a note on each' },
404
+ veille: { glyph: '\u25ce', hue: 'k6', word: 'the Veille: the posts an identity scrolls past, ranked by the worth of a reply' },
399
405
  done: { glyph: '\u2713', hue: 'k5', word: 'a done ask: answered, filed under done, out of every count above it' },
400
406
  }
401
407
 
@@ -8,13 +8,13 @@
8
8
  import { observer } from 'mobx-react-lite'
9
9
  import { useEffect, useRef, type CSSProperties, type RefObject } from 'react'
10
10
  import { Icon, ICON } from './icons.tsx'
11
- import { sectionKeyLabel } from './keys.ts'
11
+ import { pageKeyLabel, sectionKeyLabel } from './keys.ts'
12
12
  import type { RepoSt } from './repo-st.ts'
13
13
  import { GLYPH, markOf, rowName, rowSlots, type TreeRow } from './tree-build.ts'
14
14
 
15
15
  /** the row under the cursor stays in sight while the arrows move it */
16
- const useInSight = (on: boolean): RefObject<HTMLDivElement | null> => {
17
- const el = useRef<HTMLDivElement | null>(null)
16
+ export const useInSight = <T extends HTMLElement = HTMLDivElement>(on: boolean): RefObject<T | null> => {
17
+ const el = useRef<T | null>(null)
18
18
  useEffect(() => {
19
19
  if (on) el.current?.scrollIntoView({ block: 'nearest' })
20
20
  }, [on])
@@ -56,8 +56,31 @@ export const SectionRowView = observer(({ app, row }: { app: RepoSt; row: TreeRo
56
56
  )
57
57
  })
58
58
 
59
+ /** a row of the repo's own pages (wiki build/shipkit/project-pages.md): drawn as a section, its icon its own, its
60
+ * badge the page's, its key ⌥⇧ and its letter; the first one draws the rule under shipkit's rows */
61
+ export const PageRowView = observer(({ app, row }: { app: RepoSt; row: TreeRow }) => {
62
+ const t = app.tree
63
+ const id = row.proj!
64
+ const p = app.pages.find(id)
65
+ const b = app.pages.badge(id)
66
+ const cur = app.sel?.t === 'page' && app.sel.id === id
67
+ const first = t.pageRows[0]?.key === row.key
68
+ const el = useInSight(t.cursor === row.key)
69
+ const key = p == null ? null : pageKeyLabel(p.key)
70
+ return (
71
+ <div ref={el} className={`tsec tpage${first ? ' tpfirst' : ''}${cur ? ' cur' : ''}${t.cursor === row.key ? ' on' : ''}`} aria-current={cur ? 'page' : undefined}
72
+ title={`${app.pages.title(id)}${b?.title ? `: ${b.title}` : ''}${key == null ? '' : ` (${key})`}`} onClick={() => t.click(row)}>
73
+ <span className="tw" />
74
+ {p == null ? <span /> : <Icon d={p.icon} />}
75
+ <span className="rsecl">{row.label}</span>
76
+ {b == null || b.count === 0 ? <span /> : <b className={`rsecn n${b.tone ?? 'warn'}`}>{b.count}</b>}
77
+ {key == null ? null : <kbd className="pjkey">{key}</kbd>}
78
+ </div>
79
+ )
80
+ })
81
+
59
82
  export const TreeRowView = ({ app, row }: { app: RepoSt; row: TreeRow }): React.ReactElement =>
60
- row.section != null ? <SectionRowView app={app} row={row} /> : <LeafRowView app={app} row={row} />
83
+ row.proj != null ? <PageRowView app={app} row={row} /> : row.section != null ? <SectionRowView app={app} row={row} /> : <LeafRowView app={app} row={row} />
61
84
 
62
85
  const LeafRowView = observer(({ app, row }: { app: RepoSt; row: TreeRow }) => {
63
86
  const t = app.tree
@@ -8,6 +8,7 @@ import { makeAutoObservable } from 'mobx'
8
8
  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
+ import { walkKey, type WalkHost } from './list-walk.ts'
11
12
  import { buildTree, dirKeys, flattenTree, matchesQuery, passesFilter, processResources, whenCounts, type TreeNode, type TreeRow } from './tree-build.ts'
12
13
 
13
14
  const EXPANDED_KEY = 'shipkit.tree.expanded'
@@ -30,7 +31,7 @@ const writeStore = (k: string, v: string): void => {
30
31
  }
31
32
  }
32
33
 
33
- export class TreeSvc {
34
+ export class TreeSvc implements WalkHost<TreeRow> {
34
35
  expanded = new Set<string>()
35
36
  /** the row key under the keyboard cursor */
36
37
  cursor: string | null = null
@@ -88,8 +89,16 @@ export class TreeSvc {
88
89
  return this.open.has(key)
89
90
  }
90
91
 
92
+ /** the repo's own pages, under the sections: a search keeps the ones it names */
93
+ get pageRows(): TreeRow[] {
94
+ const q = this.q
95
+ return this.st.pages.list
96
+ .filter((p) => q === '' || p.title.toLowerCase().includes(q) || p.id.includes(q))
97
+ .map((p): TreeRow => ({ key: `page:${p.id}`, label: p.title, depth: 0, dir: false, state: 'idle', res: null, kind: null, section: null, total: 0, reds: 0, checks: [], page: { t: 'page', repo: this.st.name, id: p.id }, proj: p.id }))
98
+ }
99
+
91
100
  get rows(): TreeRow[] {
92
- return flattenTree(this.nodes, this.open)
101
+ return [...flattenTree(this.nodes, this.open), ...this.pageRows]
93
102
  }
94
103
 
95
104
  /** the line at the top of the checks page: what runs always and what does not */
@@ -130,7 +139,7 @@ export class TreeSvc {
130
139
 
131
140
  /** what a row opens: a section its page, a group with a page that page,
132
141
  * a leaf its own page. Only a row with nothing to open folds */
133
- private activate(row: TreeRow): void {
142
+ activate(row: TreeRow): void {
134
143
  const sec = row.section == null ? null : this.sections.find((s) => s.id === row.section)
135
144
  if (sec != null) sec.go()
136
145
  else if (row.page != null) this.st.go(row.page)
@@ -154,66 +163,26 @@ export class TreeSvc {
154
163
  if (row.dir) this.toggle(row.key)
155
164
  }
156
165
 
157
- /** where the arrows start: the cursor, else the section of the page shown */
158
- private get from(): number {
159
- const rows = this.rows
160
- const i = rows.findIndex((r) => r.key === this.cursor)
161
- if (i !== -1) return i
166
+ /** where the arrows start with no cursor: the section of the page shown */
167
+ home(rows: readonly TreeRow[]): number {
162
168
  const on = this.sections.find((s) => s.on)?.id
163
169
  return on == null ? -1 : rows.findIndex((r) => r.section === on)
164
170
  }
165
171
 
166
172
  /** an arrow lands on a row and opens its page at once. A branch with
167
173
  * nothing to open only takes the cursor: a fold is the chevron's job */
168
- private land(row: TreeRow): void {
174
+ land(row: TreeRow): void {
169
175
  this.cursor = row.key
170
176
  if (row.section != null || row.page != null || row.res != null) this.st.walk(() => this.activate(row))
171
177
  }
172
178
 
173
179
  /** a greyed section with no page: the arrows step over it */
174
- private inert(row: TreeRow): boolean {
180
+ inert(row: TreeRow): boolean {
175
181
  return row.section != null && this.sections.find((s) => s.id === row.section)?.opens === false
176
182
  }
177
183
 
178
- move(d: number): void {
179
- const rows = this.rows
180
- if (rows.length === 0) return
181
- const i = this.from
182
- let next = i === -1 ? (d > 0 ? 0 : rows.length - 1) : i + d
183
- while (next >= 0 && next < rows.length && this.inert(rows[next]!)) next += d
184
- if (next < 0 || next >= rows.length || next === i) return
185
- this.land(rows[next]!)
186
- }
187
- /** right descends: a folded row unfolds, anything else steps down */
188
- right(): void {
189
- const r = this.cur
190
- if (r != null && r.dir && !this.isOpen(r.key)) this.toggle(r.key)
191
- else this.move(1)
192
- }
193
- /** left ascends: an unfolded row folds, anything else climbs to its parent */
194
- left(): void {
195
- const r = this.cur
196
- if (r == null) return this.move(-1)
197
- if (r.dir && this.isOpen(r.key)) return this.toggle(r.key)
198
- const rows = this.rows
199
- const i = rows.findIndex((x) => x.key === r.key)
200
- for (let n = i - 1; n >= 0; n--) {
201
- if (rows[n]!.depth < r.depth) return this.land(rows[n]!)
202
- }
203
- }
204
- enter(): void {
205
- const r = this.cur
206
- if (r != null) this.activate(r)
207
- }
208
-
209
- /** true = the key was ours, so the page must not also scroll */
184
+ /** true = the key was ours, so the page must not also scroll (list-walk.ts) */
210
185
  key(k: string): boolean {
211
- if (k === 'ArrowDown') this.move(1)
212
- else if (k === 'ArrowUp') this.move(-1)
213
- else if (k === 'ArrowRight') this.right()
214
- else if (k === 'ArrowLeft') this.left()
215
- else if (k === 'Enter' || k === ' ') this.enter()
216
- else return false
217
- return true
186
+ return walkKey(this, k)
218
187
  }
219
188
  }