rvlib-shipkit 2.11.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 (298) hide show
  1. package/CHANGELOG.md +56 -12
  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 +96 -5
  20. package/src/cli/cmd_Review.ts +8 -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 +9 -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 +61 -6
  68. package/src/home/inbox.ts +75 -4
  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 +110 -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 +9 -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/content.ts +11 -1
  100. package/src/media-store/daemon.ts +56 -70
  101. package/src/media-store/hand.ts +58 -0
  102. package/src/media-store/put.ts +122 -0
  103. package/src/media-store/space.ts +73 -11
  104. package/src/pages/forward.ts +35 -0
  105. package/src/pages/frame-client.ts +118 -0
  106. package/src/pages/routes.ts +29 -0
  107. package/src/pages/unit.ts +92 -0
  108. package/src/plan/planner.ts +12 -0
  109. package/src/plan/repo-source.ts +19 -5
  110. package/src/reflect/transcript.ts +35 -10
  111. package/src/release/public-clean.ts +301 -0
  112. package/src/release/published-here.ts +22 -0
  113. package/src/release/run-bump.ts +2 -1
  114. package/src/release/run-release.ts +4 -1
  115. package/src/repo-config.ts +53 -2
  116. package/src/review/http.ts +16 -2
  117. package/src/review/media-kind.ts +3 -3
  118. package/src/review/media-read.ts +3 -3
  119. package/src/review/model.ts +24 -5
  120. package/src/review/notes.ts +77 -0
  121. package/src/review/project.ts +6 -38
  122. package/src/review/routes.ts +8 -13
  123. package/src/review/store.ts +46 -4
  124. package/src/review/trailer-media.ts +24 -3
  125. package/src/review/trailer-shots.ts +106 -0
  126. package/src/review/unit.ts +1 -1
  127. package/src/scaffold/files/agent-handoff.md +3 -0
  128. package/src/scaffold/files/agent-index.md +4 -12
  129. package/src/scaffold/project-scaffold.ts +5 -4
  130. package/src/serve/embed.ts +1 -1
  131. package/src/serve/hub-app/col-card.tsx +3 -17
  132. package/src/serve/hub-app/col-tables-view.tsx +2 -1
  133. package/src/serve/hub-app/cols-svc.ts +12 -14
  134. package/src/serve/hub-app/dock-st.ts +4 -2
  135. package/src/serve/hub-app/dock-view.tsx +2 -0
  136. package/src/serve/hub-app/frames-st.ts +35 -0
  137. package/src/serve/hub-app/hash-route.ts +64 -1
  138. package/src/serve/hub-app/home-st.ts +31 -7
  139. package/src/serve/hub-app/home-strip.css +9 -1
  140. package/src/serve/hub-app/home-strip.tsx +7 -6
  141. package/src/serve/hub-app/home.html +5 -0
  142. package/src/serve/hub-app/hub-app.tsx +49 -5
  143. package/src/serve/hub-app/hub.css +29 -11
  144. package/src/serve/hub-app/icons.tsx +16 -1
  145. package/src/serve/hub-app/identities-st.ts +210 -0
  146. package/src/serve/hub-app/identities-view.tsx +352 -0
  147. package/src/serve/hub-app/identities.css +48 -0
  148. package/src/serve/hub-app/identity-address.ts +52 -0
  149. package/src/serve/hub-app/inbox-st.ts +59 -6
  150. package/src/serve/hub-app/inbox-view.tsx +48 -6
  151. package/src/serve/hub-app/inbox.css +12 -1
  152. package/src/serve/hub-app/index.html +3 -0
  153. package/src/serve/hub-app/keys.ts +10 -2
  154. package/src/serve/hub-app/list-walk.ts +89 -0
  155. package/src/serve/hub-app/machine-st.ts +12 -0
  156. package/src/serve/hub-app/media-view.tsx +2 -1
  157. package/src/serve/hub-app/pages-frames.tsx +134 -0
  158. package/src/serve/hub-app/pages-svc.ts +111 -0
  159. package/src/serve/hub-app/palette-st.ts +18 -3
  160. package/src/serve/hub-app/palette-view.tsx +9 -2
  161. package/src/serve/hub-app/planned-view.tsx +2 -1
  162. package/src/serve/hub-app/project-list.css +18 -14
  163. package/src/serve/hub-app/project-list.tsx +88 -49
  164. package/src/serve/hub-app/projects-svc.ts +33 -3
  165. package/src/serve/hub-app/repo-sections.ts +19 -2
  166. package/src/serve/hub-app/repo-st.ts +75 -19
  167. package/src/serve/hub-app/review/review-cells.tsx +3 -3
  168. package/src/serve/hub-app/review/review-kit.ts +30 -7
  169. package/src/serve/hub-app/review/review-page.tsx +1 -1
  170. package/src/serve/hub-app/review/review-st.ts +33 -11
  171. package/src/serve/hub-app/review/review-thread.tsx +11 -9
  172. package/src/serve/hub-app/review/review-views.tsx +84 -19
  173. package/src/serve/hub-app/review/thread-st.ts +1 -10
  174. package/src/serve/hub-app/review/trailer-page.tsx +2 -1
  175. package/src/serve/hub-app/review.css +17 -8
  176. package/src/serve/hub-app/site/site-part.tsx +173 -0
  177. package/src/serve/hub-app/site/site-st.ts +157 -0
  178. package/src/serve/hub-app/site.css +35 -0
  179. package/src/serve/hub-app/social/calendar.tsx +182 -0
  180. package/src/serve/hub-app/social/comms-page.tsx +306 -0
  181. package/src/serve/hub-app/social/kit.tsx +244 -0
  182. package/src/serve/hub-app/social/post-card.tsx +456 -0
  183. package/src/serve/hub-app/social/problems.tsx +60 -0
  184. package/src/serve/hub-app/social/social-model.ts +154 -0
  185. package/src/serve/hub-app/social/social-page.tsx +674 -0
  186. package/src/serve/hub-app/social/social-st.ts +986 -0
  187. package/src/serve/hub-app/social.css +289 -0
  188. package/src/serve/hub-app/stores/stores-page.tsx +311 -0
  189. package/src/serve/hub-app/stores/stores-st.ts +286 -0
  190. package/src/serve/hub-app/stores.css +54 -0
  191. package/src/serve/hub-app/test-view.tsx +9 -2
  192. package/src/serve/hub-app/tests-svc.ts +16 -1
  193. package/src/serve/hub-app/timeline-geometry.ts +1 -1
  194. package/src/serve/hub-app/timeline-view.tsx +3 -2
  195. package/src/serve/hub-app/tree-build.ts +6 -0
  196. package/src/serve/hub-app/tree-row.tsx +27 -4
  197. package/src/serve/hub-app/tree-svc.ts +18 -49
  198. package/src/serve/hub-app/veille/veille-page.tsx +514 -0
  199. package/src/serve/hub-app/veille/veille-st.ts +443 -0
  200. package/src/serve/hub-app/veille.css +84 -0
  201. package/src/serve/hub-runtime.ts +14 -9
  202. package/src/serve/project-gutter-route.ts +44 -12
  203. package/src/serve/resources-wire.ts +48 -0
  204. package/src/serve/run-lanes.ts +7 -4
  205. package/src/serve/same-origin.ts +1 -1
  206. package/src/serve/serve-hub.ts +27 -18
  207. package/src/serve/tracked-watch.ts +24 -3
  208. package/src/serve/warm-cell.ts +5 -1
  209. package/src/shipkit-files.ts +15 -4
  210. package/src/shipkit.ts +0 -1
  211. package/src/shot/box.ts +162 -0
  212. package/src/shot/browser-slot.ts +62 -0
  213. package/src/shot/client.ts +43 -7
  214. package/src/shot/clip-encoder.ts +93 -12
  215. package/src/shot/film-box.ts +188 -0
  216. package/src/shot/shooter.ts +50 -15
  217. package/src/shot/shot-ask.ts +10 -2
  218. package/src/shot/stepped-clip.ts +5 -4
  219. package/src/site/desk.ts +242 -0
  220. package/src/site/routes.ts +66 -0
  221. package/src/site/unit.ts +62 -0
  222. package/src/social/brands.ts +22 -0
  223. package/src/social/compose.ts +97 -0
  224. package/src/social/desk-index.ts +123 -0
  225. package/src/social/desk-wire.ts +64 -0
  226. package/src/social/drafts.ts +183 -0
  227. package/src/social/house.ts +24 -0
  228. package/src/social/load.ts +319 -0
  229. package/src/social/md.ts +70 -0
  230. package/src/social/media-facts.ts +53 -0
  231. package/src/social/media-kind.ts +189 -0
  232. package/src/social/media-limit.ts +42 -0
  233. package/src/social/media-of.ts +30 -0
  234. package/src/social/migrate.ts +123 -0
  235. package/src/social/open.ts +17 -0
  236. package/src/social/post-url.ts +158 -0
  237. package/src/social/presence.ts +332 -0
  238. package/src/social/public-read.ts +53 -0
  239. package/src/social/publish/bluesky.ts +168 -0
  240. package/src/social/publish/discord.ts +76 -0
  241. package/src/social/publish/index.ts +24 -0
  242. package/src/social/publish/secret.ts +13 -0
  243. package/src/social/push.ts +31 -0
  244. package/src/social/richtext.ts +37 -0
  245. package/src/social/routes.ts +180 -0
  246. package/src/social/stats.ts +134 -0
  247. package/src/social/text.ts +267 -0
  248. package/src/social/tracker-route.ts +39 -0
  249. package/src/social/tracker.ts +255 -0
  250. package/src/social/unit.ts +53 -0
  251. package/src/social/writes.ts +130 -0
  252. package/src/start-repo.ts +14 -9
  253. package/src/stores/collection.ts +27 -0
  254. package/src/stores/desk.ts +336 -0
  255. package/src/stores/model.ts +187 -0
  256. package/src/stores/routes.ts +126 -0
  257. package/src/stores/unit.ts +57 -0
  258. package/src/suite/calibrate.ts +127 -0
  259. package/src/suite/core-counters.ts +91 -0
  260. package/src/suite/judge-suites.ts +94 -34
  261. package/src/suite/suite-cli.ts +44 -10
  262. package/src/suite/suite-cpu-preload.ts +34 -9
  263. package/src/trailer/adapter.ts +4 -0
  264. package/src/trailer/build.ts +42 -11
  265. package/src/trailer/ffmpeg.ts +11 -0
  266. package/src/trailer/footage.ts +30 -13
  267. package/src/trailer/grammar.ts +18 -2
  268. package/src/trailer/graph.ts +28 -6
  269. package/src/trailer/passage.ts +21 -6
  270. package/src/trailer/plan.ts +74 -3
  271. package/src/trailer/shelf.ts +16 -0
  272. package/src/trailer/stitch.ts +67 -26
  273. package/src/trailer/url.ts +1 -1
  274. package/src/trailer/versions.ts +24 -0
  275. package/src/ts/gate-typecheck.ts +32 -0
  276. package/src/ts/typecheck-cli.ts +9 -11
  277. package/src/tui/tui-app.tsx +0 -1
  278. package/src/veille/asks.ts +155 -0
  279. package/src/veille/auto.ts +31 -0
  280. package/src/veille/batch.ts +27 -0
  281. package/src/veille/chrome.ts +127 -0
  282. package/src/veille/collection.ts +28 -0
  283. package/src/veille/desk.ts +242 -0
  284. package/src/veille/identity.ts +80 -0
  285. package/src/veille/import.ts +68 -0
  286. package/src/veille/log.ts +183 -0
  287. package/src/veille/platforms.ts +118 -0
  288. package/src/veille/reads.ts +66 -0
  289. package/src/veille/replied.ts +110 -0
  290. package/src/veille/routes.ts +185 -0
  291. package/src/veille/service.ts +81 -0
  292. package/src/veille/watch.ts +116 -0
  293. package/src/veille/worth.ts +46 -0
  294. package/src/wiki/scan-md.ts +18 -0
  295. package/src/collections/posts.ts +0 -142
  296. package/src/contracts/manifests/social.contract.ts +0 -20
  297. package/src/scaffold/files/agent-coding.md +0 -35
  298. package/src/ts/typecheck-cache.ts +0 -11
@@ -0,0 +1,77 @@
1
+ // his notes on one thing a desk shows (a store page's picture or field, a draft): the first an item of the one store,
2
+ // its subject the thing, so the review page and `sk review inbox` hold it; the next ones, while that thread is open,
3
+ // his replies on it, never a second item. The one path for a note on a thing (wiki build/shipkit/stores.md)
4
+ import { stateOf, subjectKey, type Origin, type ReviewItem, type Subject } from './model.ts'
5
+ import { addMessage, raiseItem, readAll, specOf } from './store.ts'
6
+ import { membersOf, threadsOf, type Thread } from './threads.ts'
7
+
8
+ /** one note as a desk shows it: the owner's words, where it stands, the agent's last word once answered */
9
+ export type SubjectNote = { id: string; at: string; text: string; state: string; answer?: string }
10
+
11
+ const keyIn = (dir: string) => {
12
+ const spec = specOf(dir)
13
+ return (s: Subject): string | null => subjectKey(s, spec)
14
+ }
15
+
16
+ /** every word of his on the thing's threads, the first note and each reply, with the thread's state and last answer */
17
+ function notesOfThreads(threads: readonly Thread[]): SubjectNote[] {
18
+ const out: SubjectNote[] = []
19
+ for (const t of threads) {
20
+ const members = membersOf(t)
21
+ const state = stateOf(t.head, false).state
22
+ const answer = members
23
+ .flatMap((x) => x.thread)
24
+ .filter((m) => m.who !== 'owner' && m.text !== undefined && m.op === undefined)
25
+ .sort((a, b) => a.at.localeCompare(b.at))
26
+ .at(-1)?.text
27
+ for (const x of members)
28
+ for (const m of x.thread)
29
+ if (m.who === 'owner' && m.op === undefined && m.verdict === undefined && m.text !== undefined)
30
+ out.push({ id: x.item.id, at: m.at, text: m.text, state, ...(answer ? { answer } : {}) })
31
+ }
32
+ return out.sort((a, b) => b.at.localeCompare(a.at))
33
+ }
34
+
35
+ /** the notes of any thing, the threads grouped once: a desk that shows many things reads the store's threads once */
36
+ export function notesBy(dir: string, items: readonly ReviewItem[]): (subject: Subject) => SubjectNote[] {
37
+ const key = keyIn(dir)
38
+ const by = new Map<string, Thread[]>()
39
+ for (const t of threadsOf(items))
40
+ for (const k of new Set(membersOf(t).map((x) => key(x.item.subject))))
41
+ if (k !== null) by.set(k, [...(by.get(k) ?? []), t])
42
+ return (subject) => {
43
+ const k = key(subject)
44
+ if (k === null) throw new Error(`notes: a ${subject.kind} names no one thing`)
45
+ return notesOfThreads(by.get(k) ?? [])
46
+ }
47
+ }
48
+
49
+ /** his note on the thing: a reply on its thread still open, else a new item titled `<name> : <first line>` */
50
+ export async function noteOn(
51
+ dir: string,
52
+ o: { subject: Subject; origin: Extract<Origin, { by: 'owner' }>; name: string; text: string; topic?: string; image?: string },
53
+ ): Promise<{ id: string }> {
54
+ const key = keyIn(dir)
55
+ const k = key(o.subject)
56
+ const text = o.text.trim()
57
+ if (k === null) throw new Error(`note: a ${o.subject.kind} names no one thing`)
58
+ if (!text) throw new Error('note: the text is empty')
59
+ const open = threadsOf(readAll(dir).items)
60
+ .filter((t) => membersOf(t).some((x) => key(x.item.subject) === k))
61
+ .filter((t) => stateOf(t.head, false).state !== 'closed')
62
+ .sort((a, b) => b.head.item.created.localeCompare(a.head.item.created))[0]?.head.item.id
63
+ if (open) {
64
+ addMessage(dir, open, 'owner', text)
65
+ return { id: open }
66
+ }
67
+ const head = `${o.name} : ${text.split('\n')[0] ?? ''}`
68
+ const x = await raiseItem(dir, {
69
+ subject: o.subject,
70
+ origin: o.origin,
71
+ ...(o.topic ? { topic: o.topic } : {}),
72
+ title: head.length > 80 ? `${head.slice(0, 79).trimEnd()}…` : head,
73
+ text,
74
+ ...(o.image ? { image: o.image } : {}),
75
+ })
76
+ return { id: x.item.id }
77
+ }
@@ -1,48 +1,16 @@
1
1
  // a repo's review unit at work (wiki build/shipkit/review.md, A project's parts): its file found by a walk cached on the
2
2
  // walked dirs' times and its text, imported, its spec bound to the store; its sources pulled, its kinds' facts and data
3
3
  // view computed on the server, so the hub never bundles project code
4
- import { existsSync, mkdirSync, readFileSync, renameSync, statSync, writeFileSync } from 'node:fs'
5
- import { isAbsolute, join, relative, resolve } from 'node:path'
6
- import { importFresh, repoUnitFiles } from '../core/discover-checks.ts'
7
- import { LAYOUT } from '../core/layout.ts'
4
+ import { existsSync } from 'node:fs'
5
+ import { unitFilesDeclaring } from '../core/unit-files.ts'
6
+ import { isAbsolute, relative, resolve } from 'node:path'
7
+ import { importFresh } from '../core/discover-checks.ts'
8
8
  import type { ReviewItem } from './model.ts'
9
9
  import { bindSpec, readAll, storeDir } from './store.ts'
10
10
  import { specOfUnit, type Fact, type Link, type ReviewUnit, type ViewPart, type ViewText } from './unit.ts'
11
11
 
12
- /** the walk's answer kept in the cache: the unit files and every dir it read, each with its time; a dir whose time moved
13
- * means a file came or went, so the walk runs again */
14
- interface Found {
15
- dirs: [string, number][]
16
- files: [string, number, boolean][]
17
- }
18
-
19
- const foundFile = (root: string): string => join(root, LAYOUT.cache, 'review-unit.json')
20
- const mtime = (p: string): number => statSync(p, { throwIfNoEntry: false })?.mtimeMs ?? -1
21
-
22
- /** the unit files that declare a review unit, by a text test, never an import: the walk's dirs cached on their times */
23
- export function reviewUnitFiles(root: string): string[] {
24
- const cache = foundFile(root)
25
- let found: Found | null = null
26
- try {
27
- found = JSON.parse(readFileSync(cache, 'utf8')) as Found
28
- } catch {
29
- found = null
30
- }
31
- const fresh = (f: Found): boolean => f.dirs.every(([d, t]) => mtime(d) === t) && f.files.every(([p, t]) => mtime(p) === t)
32
- if (!found || !fresh(found)) {
33
- const dirs: string[] = []
34
- const files = repoUnitFiles(root, dirs).filter((f) => !f.endsWith('.check.shipkit.ts'))
35
- found = { dirs: dirs.map((d) => [d, mtime(d)]), files: files.map((f) => [f, mtime(f), /\breview\s*\(/.test(readFileSync(f, 'utf8'))]) }
36
- try {
37
- mkdirSync(join(root, LAYOUT.cache), { recursive: true })
38
- writeFileSync(`${cache}.${process.pid}.tmp`, JSON.stringify(found))
39
- renameSync(`${cache}.${process.pid}.tmp`, cache)
40
- } catch {
41
- // a read only checkout: the next run walks again
42
- }
43
- }
44
- return found.files.filter(([, , has]) => has).map(([f]) => f)
45
- }
12
+ /** the unit files that declare a review unit (core/unit-files.ts) */
13
+ export const reviewUnitFiles = (root: string): string[] => unitFilesDeclaring(root, 'review')
46
14
 
47
15
  /** the repo's review unit, or null; two of them is an error naming both files */
48
16
  export async function loadReviewUnit(root: string): Promise<ReviewUnit | null> {
@@ -6,7 +6,7 @@ import { tmpdir } from 'node:os'
6
6
  import { dirname, extname, join } from 'node:path'
7
7
  import { isAnimFormat, isAnimLabels, isAnimMode, pairAnimation } from './anim.ts'
8
8
  import { startAuto } from './auto.ts'
9
- import { bad, KEEP, NO_STORE, ranged, TYPES } from './http.ts'
9
+ import { bad, KEEP, NO_STORE, ranged, tagged, TYPES } from './http.ts'
10
10
  import { viewFilesOf, type Rect, type ReviewItem, type Subject } from './model.ts'
11
11
  import { pasteHosts } from './paste.ts'
12
12
  import { openReview, partFile, viewOfItem } from './project.ts'
@@ -20,6 +20,7 @@ import { remoteUrl, reviewKey } from './media-read.ts'
20
20
  import { trailerRoutes } from './trailer-routes.ts'
21
21
  import { specData, type ReviewUnit } from './unit.ts'
22
22
  import { liveWatchers } from './watchers.ts'
23
+ import { autoRulesOf } from '../veille/auto.ts'
23
24
 
24
25
  // ── each repo's review unit, read again at most every 5 s; its auto rules scheduled in this server while it serves ──
25
26
 
@@ -40,7 +41,7 @@ async function project(root: string): Promise<{ dir: string; unit: ReviewUnit |
40
41
  return { dir, unit }
41
42
  }
42
43
  held?.auto?.stop()
43
- const rules = unit?.auto ?? []
44
+ const rules = autoRulesOf(root, unit)
44
45
  opened.set(root, { at: Date.now(), unit, auto: rules.length > 0 ? startAuto(dir, rules, () => readAllCached(dir).items) : null })
45
46
  return { dir, unit }
46
47
  }
@@ -113,15 +114,6 @@ function missingOf(dir: string, members: readonly ReviewItem[]): string[] {
113
114
  /** a file the disk let go, answered by the Space: the signed URL lives an hour, the browser keeps the redirect half of it */
114
115
  const toSpace = (url: string): Response => new Response(null, { status: 302, headers: { Location: url, 'Cache-Control': 'private, max-age=1800' } })
115
116
 
116
- /** a json answer with its ETag, 304 when the page holds it; gzipped when the page takes it */
117
- function tagged(req: Request, tag: string, body: () => unknown): Response {
118
- const headers = { 'Content-Type': 'application/json', ETag: tag, 'Cache-Control': 'no-cache', Vary: 'Accept-Encoding' }
119
- if (req.headers.get('If-None-Match') === tag) return new Response(null, { status: 304, headers: { ETag: tag } })
120
- const text = JSON.stringify(body())
121
- if (text.length < 4096 || !/\bgzip\b/.test(req.headers.get('Accept-Encoding') ?? '')) return new Response(text, { headers })
122
- return new Response(Bun.gzipSync(new TextEncoder().encode(text)), { headers: { ...headers, 'Content-Encoding': 'gzip' } })
123
- }
124
-
125
117
  async function reviewRoute(req: Request, path: string, dir: string, unit: ReviewUnit | null): Promise<Response | null> {
126
118
  if (path === '/api/review' && req.method === 'GET') {
127
119
  // the page polls this list: it is read from disk and sent again only when a file of it changed
@@ -162,7 +154,7 @@ async function reviewRoute(req: Request, path: string, dir: string, unit: Review
162
154
  // where a card lives, for the paste that hands it to another agent session; a config that does not load leaves it out
163
155
  const where = await pasteHosts(dirname(dirname(dir))).catch(() => null)
164
156
  return Response.json(
165
- { ...specData(specOf(dir)), role: roleOf(dir), sources: (unit?.sources ?? []).map((s) => s.id), auto: (unit?.auto ?? []).map((r) => ({ id: r.id, every: r.every })), where },
157
+ { ...specData(specOf(dir)), role: roleOf(dir), sources: (unit?.sources ?? []).map((s) => s.id), auto: autoRulesOf(dirname(dirname(dir)), unit).map((r) => ({ id: r.id, every: r.every })), where },
166
158
  { headers: NO_STORE },
167
159
  )
168
160
  }
@@ -209,7 +201,10 @@ async function reviewRoute(req: Request, path: string, dir: string, unit: Review
209
201
  const t = /^\/api\/review\/([^/]+)\/thread\/([^/]+)$/.exec(path)
210
202
  if (t && req.method === 'GET') {
211
203
  const f = threadImage(dir, t[1] ?? '', t[2] ?? '')
212
- return f ? new Response(Bun.file(f), { headers: { 'Content-Type': TYPES[extname(f)] ?? 'application/octet-stream', ...KEEP } }) : bad('no such image', 404)
204
+ if (f) return new Response(Bun.file(f), { headers: { 'Content-Type': TYPES[extname(f)] ?? 'application/octet-stream', ...KEEP } })
205
+ // a message's image the disk let go: the Space's copy
206
+ const url = await remoteUrl(dir, t[1] ?? '', `thread/${t[2] ?? ''}`)
207
+ return url ? toSpace(url) : bad('no such image', 404)
213
208
  }
214
209
  // a view's image at the size the page draws it; `thumb/<name>` is the preview's thumb size
215
210
  const pv = /^\/api\/review\/([^/]+)\/(?:preview\/([^/]+)|thumb)\/([^/]+)$/.exec(path)
@@ -1,11 +1,12 @@
1
1
  // the one feedback store on disk (wiki build/shipkit/review.md): `.shipkit/review/<id>/`, gitignored: `item.json`, the
2
2
  // media, and `thread/`, one file per message, never rewritten. An item is built in a dot folder and renamed, every file
3
- // written beside its place and renamed, so no reader sees half of one. The format is pkm-multi's verbatim. A folder of
3
+ // written beside its place and renamed, so no reader sees half of one. The format is a project's own store's, verbatim. A folder of
4
4
  // the old shape (request.json, feedback.json, a message with `seen`) fails loud
5
5
  import * as fs from 'node:fs'
6
6
  import { existsSync, readdirSync, readFileSync, statSync, watch } from 'node:fs'
7
7
  import { basename, dirname, extname, join, resolve } from 'node:path'
8
8
  import { LAYOUT } from '../core/layout.ts'
9
+ import { yieldLoop } from '../core/loop-watch.ts'
9
10
  import { ffmpeg } from '../trailer/ffmpeg.ts'
10
11
  import { probe, sizeOf, stillAt } from './media.ts'
11
12
  import { factsOf } from '../media-store/content.ts'
@@ -50,6 +51,8 @@ import {
50
51
  type Spec,
51
52
  type Subject,
52
53
  viewFilesOf,
54
+ mediaFilesOf,
55
+ threadMediaOf,
53
56
  } from './model.ts'
54
57
  import { beatRole, roleOf } from './role.ts'
55
58
  import { chainOf, coveringHead, followedIds, isFollowed } from './threads.ts'
@@ -432,7 +435,7 @@ export async function fillMedia(dir: string, id: string): Promise<Item | null> {
432
435
  if (!x) return null
433
436
  const folder = join(dir, id)
434
437
  const held = x.item.media ?? {}
435
- const names = viewFilesOf(x.item)
438
+ const names = mediaFilesOf(x)
436
439
  const size = (n: string): number | undefined => statSync(join(folder, n), { throwIfNoEntry: false })?.size
437
440
  const stale = new Set(names.filter((n) => held[n] && size(n) !== undefined && size(n) !== held[n]?.size))
438
441
  const lacks = names.filter((n) => !held[n] && existsSync(join(folder, n)))
@@ -590,8 +593,31 @@ const used = new Set<string>()
590
593
  /** a code that read no store for this long: its reads go */
591
594
  const CODE_KEEP_MS = 7 * 24 * 3600_000
592
595
 
596
+ /** items a step of a read covers before it gives the loop back (readRawsAsync) */
597
+ const READ_STEP = 250
598
+
593
599
  /** every item of the store, through the machine index (space/db.ts): an item whose stamp moved is read again */
594
600
  function readRaws(dir: string): ReadAll {
601
+ const steps = readRawsSteps(dir)
602
+ for (;;) {
603
+ const r = steps.next()
604
+ if (r.done) return r.value
605
+ }
606
+ }
607
+
608
+ /** the same read, the loop given back every READ_STEP items: a cold store of thousands of items is seconds of parsing
609
+ * (wiki build/shipkit/home.md, Nothing heavy on the daemon's loop) */
610
+ async function readRawsAsync(dir: string): Promise<ReadAll> {
611
+ const steps = readRawsSteps(dir)
612
+ for (;;) {
613
+ const r = steps.next()
614
+ if (r.done) return r.value
615
+ await yieldLoop()
616
+ }
617
+ }
618
+
619
+ /** the one read, in steps: it yields between two of them, and returns the store */
620
+ function* readRawsSteps(dir: string): Generator<void, ReadAll, void> {
595
621
  const out: ReadAll = { items: [], broken: [] }
596
622
  if (!existsSync(dir)) return out
597
623
  const store = resolve(dir)
@@ -610,8 +636,10 @@ function readRaws(dir: string): ReadAll {
610
636
  }
611
637
  const moved: { id: string; stamp: string; read: Read }[] = []
612
638
  const seen = new Set<string>()
639
+ let n = 0
613
640
  for (const id of readdirSync(dir).sort()) {
614
641
  if (id.startsWith('.')) continue
642
+ if (++n % READ_STEP === 0) yield
615
643
  seen.add(id)
616
644
  const stamp = stampOf(join(dir, id))
617
645
  const held = was.get(id)
@@ -936,7 +964,7 @@ export async function refreshDraft(dir: string, id: string, o: { image: string;
936
964
  }
937
965
  const next: Item = { ...r, views, wip: { live: r.wip.live, frame: r.wip.frame + 1 } }
938
966
  const fresh = new Set([image, ...views.flatMap((v) => ('gallery' in v ? v.gallery.map((g) => g.file) : []))])
939
- const media = await factsOf(folder, viewFilesOf(next), r.media, fresh)
967
+ const media = await factsOf(folder, [...viewFilesOf(next), ...threadMediaOf(r)], r.media, fresh)
940
968
  return updateHead(dir, id, () => ({ ...next, media }))
941
969
  }
942
970
 
@@ -961,7 +989,7 @@ export async function readyItem(dir: string, id: string, o: { image?: string; no
961
989
  const now = 'image' in files ? files.image : undefined
962
990
  if (old && old !== now) rmSync(join(folder, old), { force: true })
963
991
  item = { ...rest, views: [{ ...f0, files, size: loaded.size }, ...rest.views.slice(1)] }
964
- item = { ...item, media: await factsOf(folder, viewFilesOf(item), rest.media, new Set(Object.values(files))) }
992
+ item = { ...item, media: await factsOf(folder, [...viewFilesOf(item), ...threadMediaOf(rest)], rest.media, new Set(Object.values(files))) }
965
993
  }
966
994
  updateHead(dir, id, () => item)
967
995
  appendMessage(dir, id, { who: agentName(), op: 'ready' }, o.now ? { now: o.now } : {})
@@ -1008,6 +1036,20 @@ function watchOf(dir: string): Watched | null {
1008
1036
  }
1009
1037
  }
1010
1038
 
1039
+ /** a watched store read whole before a page asks, the loop given back between two steps: the first read after a boot
1040
+ * is the only whole one, every later one reads the items that moved */
1041
+ export async function warmStore(dir: string): Promise<void> {
1042
+ if (!existsSync(dir)) return
1043
+ const w = watchOf(dir)
1044
+ if (!w || (w.held && w.all)) return
1045
+ // what moved before the read is in it; what moves during it stays dirty, read again by the next reader
1046
+ w.dirty.clear()
1047
+ const all = await readRawsAsync(dir)
1048
+ if (w.held && w.all) return
1049
+ w.held = new Map<string, Read>([...all.items.map((x) => [x.item.id, { x }] as const), ...all.broken.map((b) => [b.id, { error: b.error }] as const)])
1050
+ w.all = all
1051
+ }
1052
+
1011
1053
  /** changes when anything the list is built from changes: watched, a count of writes; else a scan. The list's ETag */
1012
1054
  export function storeStamp(dir: string): string {
1013
1055
  if (!existsSync(dir)) return 'none'
@@ -1,7 +1,9 @@
1
1
  // the trailer renders as a kind of the media store (wiki build/trailer.md, Renders in the media store): each settled
2
- // render's clone in the view folder and a kept version's own files, by the facts its view record keeps. Kept on the
2
+ // render's clone in the view folder and a kept version's own files, by the facts its view record keeps, and the shots
3
+ // folders (trailer-shots.ts). Kept on the
3
4
  // disk: the newest render of each live cut, the render an open frame note was written on, and any render seen in the
4
- // window. A file goes only when its own bytes hash to the key. The takes and footage cache is never this kind's
5
+ // window. A file goes only when its own bytes hash to the key. A trailer's `voice/` clips go up and stay on the disk:
6
+ // they are its source. The takes and footage cache is never this kind's
5
7
  import { existsSync, readdirSync, readFileSync, statSync } from 'node:fs'
6
8
  import { basename, dirname, join, relative } from 'node:path'
7
9
  import { factOf, shaOf, shaOfKey } from '../media-store/content.ts'
@@ -12,6 +14,7 @@ import { isFrame } from './model.ts'
12
14
  import { readAllCached, storeDir } from './store.ts'
13
15
  import { cutOf, cutsOf, pngSize, stripOf, TRAILER_KIND, trailerDir, trailerIds, trailerKey, trailerStamp, videoOf, VIEW_ITEM, viewDir, viewOf, writeView, type View } from './trailer-desk.ts'
14
16
  import { noteOf } from './trailer-model.ts'
17
+ import { newestShelves, shotFolders, shotRows, voiceFolders } from './trailer-shots.ts'
15
18
 
16
19
  /** a view record's name, `<trailer>--<cut>--<mtime>` */
17
20
  const BASE_RE = /^(.+?)--(.+)--(\d+)$/
@@ -51,7 +54,7 @@ async function sameAs(root: string, file: string, f: MediaFact): Promise<string
51
54
  export const trailerMedia: MediaKind = {
52
55
  kind: TRAILER_KIND,
53
56
  storeOf: (root) => (existsSync(join(root, 'trailer')) ? root : null),
54
- stamp: (root) => `${trailerStamp(root)}#${existsSync(viewDir(root)) ? readdirSync(viewDir(root)).length : 0}`,
57
+ stamp: (root) => `${trailerStamp(root)}#${existsSync(viewDir(root)) ? readdirSync(viewDir(root)).length : 0}#shots:${shotFolders(root).map((f) => `${f.item}@${f.born}`).join(',')}#voice:${voiceFolders(root).map((f) => `${f.item}@${f.born}`).join(',')}`,
55
58
  async scan(root, o) {
56
59
  // every settled render gets its record, whether or not the page was opened since
57
60
  for (const id of trailerIds(root)) {
@@ -112,6 +115,7 @@ export const trailerMedia: MediaKind = {
112
115
  if (media.from?.video) row(join(root, media.from.video), media.video)
113
116
  if (media.from?.strip) row(join(root, media.from.strip), media.strip)
114
117
  }
118
+ for (const f of [...shotFolders(root), ...voiceFolders(root)]) rows.push(...(await shotRows(root, f, take)))
115
119
  return { rows, filled, left }
116
120
  },
117
121
  async holds(root) {
@@ -136,7 +140,24 @@ export const trailerMedia: MediaKind = {
136
140
  const at = Math.max(Date.parse(x.item.created) || 0, ...x.thread.map((m) => Date.parse(m.at) || 0))
137
141
  used.set(base, Math.max(used.get(base) ?? 0, at))
138
142
  }
143
+ // a shots folder: the shelf of each trailer's newest build stays, any other goes once quiet, unless a note is open on its cut
144
+ const folders = new Map(shotFolders(root).map((f) => [f.item, f]))
145
+ const shelves = newestShelves([...folders.values()])
146
+ const voices = new Set(voiceFolders(root).map((f) => f.item))
147
+ const cutUse = (id: string, cut: string): { open: boolean; at: number } => {
148
+ let at = 0
149
+ let isOpen = false
150
+ for (const [base, t] of used) if (base.startsWith(`${id}--${cut}--`)) at = Math.max(at, t)
151
+ for (const base of open) if (base.startsWith(`${id}--${cut}--`)) isOpen = true
152
+ return { open: isOpen, at }
153
+ }
139
154
  return (row) => {
155
+ if (voices.has(row.item)) return { pinned: true, used: undefined }
156
+ const f = folders.get(row.item)
157
+ if (f) {
158
+ const u = cutUse(f.trailer, f.cut)
159
+ return { pinned: shelves.has(f.item) || u.open, used: Math.max(f.born, u.at) }
160
+ }
140
161
  const r = owner.get(`${row.item}/${row.name}`)
141
162
  if (!r) return { pinned: false, used: undefined }
142
163
  const pinned = newest.get(`${r.id}--${r.cut}`) === r.v.mtime || open.has(r.base)
@@ -0,0 +1,106 @@
1
+ // the shots folders of the trailer kind (wiki build/trailer.md, Renders in the media store): each build's shelf
2
+ // `out/<cut>-shots/` and each kept version's `versions/<v>/shots/`. Their facts sit in the folder's own `.media.json`,
3
+ // which a build's new shelf drops with the old files. The shelf of each trailer's newest build stays on the disk. A
4
+ // trailer's `voice/` folder is its source clips (paid, never rebuilt): up the same way, never purged
5
+ import { existsSync, readdirSync, renameSync, statSync, writeFileSync } from 'node:fs'
6
+ import { join, relative } from 'node:path'
7
+ import { factOf, mediaKey } from '../media-store/content.ts'
8
+ import type { MediaRow } from '../media-store/kind.ts'
9
+ import { fetchBack } from '../media-store/remote.ts'
10
+ import { SHOT_FACTS, shotFacts } from '../trailer/shelf.ts'
11
+ import { versionOf } from '../trailer/versions.ts'
12
+ import { TRAILER_KIND, trailerIds } from './trailer-desk.ts'
13
+
14
+ const SHELF_RE = /^(.+)-shots$/
15
+
16
+ export interface ShotFolder {
17
+ /** the folder, relative to the repo: the item of its rows */
18
+ item: string
19
+ trailer: string
20
+ /** the cut it shelves, or the version it keeps */
21
+ cut: string
22
+ version: boolean
23
+ /** when it was made: a build makes its shelf anew, a keep its version's; its facts file moves no clock */
24
+ born: number
25
+ }
26
+
27
+ /** every shots folder of the repo's trailers */
28
+ export function shotFolders(root: string): ShotFolder[] {
29
+ const out: ShotFolder[] = []
30
+ for (const id of trailerIds(root)) {
31
+ const dir = join(root, 'trailer', id)
32
+ const add = (path: string, cut: string, version: boolean): void => {
33
+ const s = statSync(path, { throwIfNoEntry: false })
34
+ if (s?.isDirectory()) out.push({ item: relative(root, path), trailer: id, cut, version, born: s.birthtimeMs })
35
+ }
36
+ for (const f of existsSync(join(dir, 'out')) ? readdirSync(join(dir, 'out')) : []) {
37
+ const m = SHELF_RE.exec(f)
38
+ if (m) add(join(dir, 'out', f), m[1]!, false)
39
+ }
40
+ for (const v of existsSync(join(dir, 'versions')) ? readdirSync(join(dir, 'versions')) : []) if (versionOf(v) !== null) add(join(dir, 'versions', v, 'shots'), v, true)
41
+ }
42
+ return out
43
+ }
44
+
45
+ /** each trailer's `voice/` folder, the clips a cut names (`voice file voice/<clip>`): its source, never a render */
46
+ export function voiceFolders(root: string): ShotFolder[] {
47
+ const out: ShotFolder[] = []
48
+ for (const id of trailerIds(root)) {
49
+ const path = join(root, 'trailer', id, 'voice')
50
+ const s = statSync(path, { throwIfNoEntry: false })
51
+ if (!s?.isDirectory()) continue
52
+ // a clip recorded again under its name moves no folder time: the newest file's does
53
+ const born = Math.max(s.mtimeMs, ...readdirSync(path).map((n) => statSync(join(path, n), { throwIfNoEntry: false })?.mtimeMs ?? 0))
54
+ out.push({ item: relative(root, path), trailer: id, cut: 'voice', version: false, born })
55
+ }
56
+ return out
57
+ }
58
+
59
+ /** a folder's rows (its own files, never a folder inside): its facts filled while `take()` allows, written back when
60
+ * they moved */
61
+ export async function shotRows(root: string, f: ShotFolder, take: () => boolean): Promise<MediaRow[]> {
62
+ const folder = join(root, f.item)
63
+ const facts = shotFacts(folder)
64
+ let moved = false
65
+ const rows: MediaRow[] = []
66
+ const names = new Set([...Object.keys(facts), ...readdirSync(folder, { withFileTypes: true }).filter((d) => d.isFile() && !d.name.startsWith('.')).map((d) => d.name)])
67
+ for (const name of [...names].sort()) {
68
+ const size = statSync(join(folder, name), { throwIfNoEntry: false })?.size
69
+ let fact = facts[name]
70
+ if (size !== undefined && fact?.size !== size) {
71
+ if (!take()) continue
72
+ fact = facts[name] = await factOf(join(folder, name))
73
+ moved = true
74
+ }
75
+ if (fact) rows.push({ item: f.item, name, fact, local: size !== undefined })
76
+ }
77
+ if (moved) {
78
+ const file = join(folder, SHOT_FACTS)
79
+ writeFileSync(`${file}.${process.pid}.tmp`, JSON.stringify(facts))
80
+ renameSync(`${file}.${process.pid}.tmp`, file)
81
+ }
82
+ return rows
83
+ }
84
+
85
+ /** the shelf the purge keeps: per trailer, the one its newest build wrote */
86
+ export function newestShelves(folders: readonly ShotFolder[]): Set<string> {
87
+ const best = new Map<string, ShotFolder>()
88
+ for (const f of folders) if (!f.version && (best.get(f.trailer)?.born ?? -1) < f.born) best.set(f.trailer, f)
89
+ return new Set([...best.values()].map((f) => f.item))
90
+ }
91
+
92
+ /** every file of a shots folder on the disk, the ones the purge let go fetched back first; the names that came back
93
+ * missing are returned, never dropped in silence */
94
+ export async function shotsBack(root: string, folder: string): Promise<string[]> {
95
+ const facts = shotFacts(folder)
96
+ const item = relative(root, folder)
97
+ const lost: string[] = []
98
+ await Promise.all(
99
+ Object.entries(facts).map(async ([name, f]) => {
100
+ const path = join(folder, name)
101
+ if (!(await fetchBack(path, mediaKey(TRAILER_KIND, f, name), f, { store: root, item, name }))) lost.push(name)
102
+ }),
103
+ )
104
+ return lost.sort()
105
+ }
106
+
@@ -11,7 +11,7 @@ export interface Fact {
11
11
  value: string
12
12
  }
13
13
 
14
- /** a link the hub opens. `host`: a page of the tool that frames the hub (pkm-multi's admin), its url relative to it:
14
+ /** a link the hub opens. `host`: a page of the tool that frames the hub (a project's admin), its url relative to it:
15
15
  * in a frame it is posted to the host (`{ shipkit: 'open', url }`), alone it opens in a new tab */
16
16
  export interface Link {
17
17
  label: string
@@ -0,0 +1,3 @@
1
+ # Handoff: where the last session stopped
2
+
3
+ Read this FIRST, act on it, then delete what you acted on. A session that closes with work in flight writes it here, one `## YYYY-MM-DD` section per offload. A handoff with no dated section has nothing waiting. Nothing durable lives here: a rule goes to its page, a real-world act to `sk ask`.
@@ -7,19 +7,11 @@
7
7
  - `bun run hub` → the repo toolbox at http://localhost:{{PORT}}
8
8
  - `sk ci` → THE gate: run it to check your work, never the parts
9
9
 
10
- This folder is the project's internal wiki and its SPEC. Update the page
11
- BEFORE the change it describes.
10
+ This folder is the project's internal wiki and its SPEC. Update the page BEFORE the change it describes.
12
11
 
13
- **Always loaded every session:**
12
+ **Always loaded every session**: the `@` lines here. A page that does not load lives in a topical folder whose own `index.md` lists it on one line, and that index gets its `@<folder>/index.md` line here.{{CLI_INCLUDE}}
14
13
 
15
- @coding.md{{CLI_INCLUDE}}
16
-
17
- Read the matching page before touching a surface:
18
-
19
- | read when touching… | page |
14
+ | read when… | page |
20
15
  |---|---|
21
- | any source file | → agent/coding.md |
16
+ | a session starts: work offloaded at the last close, read FIRST | → agent/handoff.md |
22
17
  | recent changes and why | → agent/changelog.md |{{CLI_ROW}}
23
-
24
- Grow this table: a subsystem, a service, a runbook each earn their own page,
25
- cross-linked from here.
@@ -38,15 +38,16 @@ export type ScaffoldOpts = {
38
38
  projectCli?: boolean
39
39
  }
40
40
 
41
- /** every dep the house toolchain needs for the scripts below to run. The
42
- * linter and the formatter are bun's own, declared in bunfig.toml */
41
+ /** every dep the house toolchain needs. The type checker, the linter and
42
+ * the formatter are bun's own; typescript serves the editor and the gate's
43
+ * tsc fallback on a bun with no `bun check` */
43
44
  export const TOOLCHAIN = ['typescript', '@types/bun'] as const
44
45
 
45
46
  /** script bodies for a fresh repo whose only source dir is src/. A stack
46
47
  * scaffold (vite, hono) adds dev/build on top. No `lint` or `fmt`: a script
47
48
  * of either name would shadow `bun lint` and `bun fmt` */
48
49
  const SCRIPTS: Record<string, string> = {
49
- typecheck: 'tsc --noEmit',
50
+ typecheck: 'bun check',
50
51
  }
51
52
 
52
53
  /** repo-owned ignore lines, written OUTSIDE rule SK004's managed block so its
@@ -162,8 +163,8 @@ function writeHouseFiles(write: (rel: string, body: string) => void, vars: Recor
162
163
  // agent/index.md (rule SK003) needs the file to exist, and a repo with no
163
164
  // CLAUDE.md at all still gets a place for its docs to live
164
165
  write('agent/index.md', template('agent-index.md', vars))
165
- write('agent/coding.md', template('agent-coding.md', vars))
166
166
  write('agent/changelog.md', template('agent-changelog.md', vars))
167
+ write('agent/handoff.md', template('agent-handoff.md', vars))
167
168
  // gitignored by policy, so it never ships: it exists so an agent hitting
168
169
  // friction with the toolchain finds the place to write it down
169
170
  write('.shipkit/reflections/README.md', REFLECTIONS_README)
@@ -1,6 +1,6 @@
1
1
  // a repo's review or trailer page alone, for another tool to frame (wiki build/shipkit/review.md, The review page):
2
2
  // `<base>/embed/?page=review` serves the same app bundled with RELATIVE asset paths, so the page and every request it
3
- // makes work under any prefix a proxy puts in front of the hub (pkm-multi's admin frames it under its own origin). The
3
+ // makes work under any prefix a proxy puts in front of the hub (a project's admin frames it under its own origin). The
4
4
  // bundle is made once a process, in memory
5
5
  import { join } from 'node:path'
6
6
 
@@ -1,4 +1,4 @@
1
- // Collection views: the item card (asks · creds · posts), and the health/status card with the streaming
1
+ // Collection views: the item card (asks · creds), and the health/status card with the streaming
2
2
  // check runner. Every verb posts to /api/act/* and lands in a git-tracked
3
3
  // truth file; the truth chip names the file the item IS (on disagreement
4
4
  // the file wins).
@@ -28,8 +28,6 @@ export const ColCard = observer(({ app, col, id }: { app: RepoSt; col: string; i
28
28
  const i = c.find(col, id)
29
29
  if (i == null) return <div className="ph">item vanished — the truth file moved on</div>
30
30
  const askFile = col === 'asks' ? id.replace(/^ask:/, '') : null
31
- const postM = col === 'posts' ? id.match(/^post:([^/]+)\/(.+?):(pick|topost|invalid|posted|rejected)$/) : null
32
- const postFile = (i.file ?? '').split('/').pop() ?? ''
33
31
  if (col === 'creds') {
34
32
  // no remark box, no generic dump — a cred has no truth file; the
35
33
  // copy block + steps only matter while it is MISSING
@@ -70,29 +68,17 @@ export const ColCard = observer(({ app, col, id }: { app: RepoSt; col: string; i
70
68
  ) : null}
71
69
  {i.artifact?.url != null ? <div className="row"><a href={i.artifact.url} target="_blank" rel="noreferrer">mint ↗</a></div> : null}
72
70
  {i.artifact?.steps != null ? <div className="row"><div>{i.artifact.steps.map((s, n) => <span key={n}>{n + 1}. {s}<br /></span>)}</div></div> : null}
73
- {postM?.[3] === 'pick' && i.candidates != null ? i.candidates.map((cd) => (
74
- <div className="cand" key={cd.id}>
75
- <div className="row"><b>{cd.label}</b><button onClick={() => void c.postPick(postM[1]!, cd.id)}>pick</button></div>
76
- <div className="candhint">{cd.hint ?? ''}</div>
77
- </div>
78
- )) : null}
79
- {postM?.[3] === 'topost' ? (
80
- <div className="row">
81
- <input placeholder="posted URL = proof" value={c.proofDraft} onChange={(e) => runInAction(() => { c.proofDraft = e.target.value })} />
82
- <button onClick={() => void c.postPosted(postM[1]!, postFile)}>posted ✓</button>
83
- </div>
84
- ) : null}
85
71
  {askFile != null && i.severity != null ? (
86
72
  <div className="row">
87
73
  <input placeholder="proof URL (optional)" value={c.proofDraft} onChange={(e) => runInAction(() => { c.proofDraft = e.target.value })} />
88
74
  <button onClick={() => void c.askDone(askFile)}>done ✓</button>
89
75
  </div>
90
76
  ) : null}
91
- {askFile != null || postM != null ? (
77
+ {askFile != null ? (
92
78
  <div className="row">
93
79
  <input placeholder="remark → lands in the file, agents read it" value={c.remarkDraft}
94
80
  onChange={(e) => runInAction(() => { c.remarkDraft = e.target.value })} />
95
- <button className="ghost" onClick={() => void c.remark(askFile != null ? { kind: 'ask', file: askFile } : { kind: 'post', channel: postM![1], file: postFile })}>remark</button>
81
+ <button className="ghost" onClick={() => void c.remark({ kind: 'ask', file: askFile })}>remark</button>
96
82
  </div>
97
83
  ) : null}
98
84
  {c.actErr !== '' ? <div className="err">✗ {c.actErr}</div> : null}
@@ -15,6 +15,7 @@ import type { Resource } from './hub-types.ts'
15
15
  import { sectionLabel } from './keys.ts'
16
16
  import type { RepoSt } from './repo-st.ts'
17
17
  import { TimeAgo } from './time-ago.tsx'
18
+ import { Caret } from './icons.tsx'
18
19
 
19
20
  const emptyWords = (app: RepoSt): string => (app.filter === 'red' ? 'no reds here' : app.filter === 'needs' ? 'nothing here needs you' : app.query.trim() !== '' ? 'nothing matches the filter' : 'nothing here yet')
20
21
 
@@ -42,7 +43,7 @@ const Group = observer(<K extends string>({ app, col, g, span, row }: { app: Rep
42
43
  return (
43
44
  <tbody className="ctgroup">
44
45
  <tr className={`ctgrp g-${g.key}`} data-k={g.key} onClick={() => app.cols.toggleGroup(key, g.foldedByDefault)}>
45
- <td colSpan={span}><span className="ctcaret">{folded ? '▸' : '▾'}</span>{g.label}</td>
46
+ <td colSpan={span}><span className="ctcaret"><Caret open={!folded} /></span>{g.label}</td>
46
47
  </tr>
47
48
  {folded ? null : g.rows.map(row)}
48
49
  </tbody>