rvlib-shipkit 2.12.0 → 2.14.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 (378) hide show
  1. package/CHANGELOG.md +75 -21
  2. package/README.md +1 -1
  3. package/package.json +4 -2
  4. package/src/agent-time/store.ts +2 -2
  5. package/src/assets/run-assets.ts +2 -2
  6. package/src/assets/server/studio-server.ts +27 -23
  7. package/src/check.ts +4 -4
  8. package/src/checks/SK001-package-json-shape.check.ts +8 -4
  9. package/src/checks/SK002-contracts-fulfillness.check.ts +2 -2
  10. package/src/checks/SK003-claude-md-shape.check.ts +20 -13
  11. package/src/checks/SK004-gitignore-policy.check.ts +45 -6
  12. package/src/checks/SK005-rvlib-versions.check.ts +2 -2
  13. package/src/checks/SK006-npm-publish-safety.check.ts +3 -3
  14. package/src/checks/SK007-github-visibility.check.ts +2 -2
  15. package/src/checks/SK008-reviewer-agent.check.ts +3 -3
  16. package/src/checks/SK010-undeclared-unit.check.ts +2 -2
  17. package/src/checks/SK011-sibling-unit-ranges.check.ts +2 -2
  18. package/src/checks/SK012-config-barrel-import.check.ts +2 -2
  19. package/src/checks/SK013-one-way-in-policy.check.ts +2 -2
  20. package/src/checks/SK015-nested-repo.check.ts +3 -3
  21. package/src/checks/SK016-legacy-check-shapes.check.ts +2 -2
  22. package/src/checks/SK017-vscode-hub-task.check.ts +2 -2
  23. package/src/checks/SK018-test-files-run.check.ts +2 -2
  24. package/src/checks/SK019-tests-run-in-units.check.ts +2 -2
  25. package/src/checks/SK020-self-spawning-check.check.ts +2 -2
  26. package/src/checks/SK022-machine-runs-the-pin.check.ts +2 -2
  27. package/src/checks/SK024-identity-colors.check.ts +1 -1
  28. package/src/checks/SK025-release-drift.check.ts +2 -2
  29. package/src/checks/SK026-asks-autoclose.check.ts +2 -2
  30. package/src/checks/SK027-agent-wiki-links.check.ts +8 -2
  31. package/src/checks/SK028-readme.check.ts +2 -2
  32. package/src/checks/SK029-explicit-check-files.check.ts +3 -3
  33. package/src/checks/SK030-cache-audit.check.ts +7 -5
  34. package/src/checks/SK031-trace-audit.check.ts +7 -7
  35. package/src/checks/SK032-ignored-inputs.check.ts +3 -3
  36. package/src/checks/SK033-global-contribution.check.ts +11 -4
  37. package/src/checks/SK034-commit-gates-armed.check.ts +2 -2
  38. package/src/checks/SK035-public-clean.check.ts +46 -0
  39. package/src/checks/SK036-draft-media-size.check.ts +28 -0
  40. package/src/checks/SK037-keyword-additions.check.ts +43 -0
  41. package/src/cli/cmd_Backup.ts +152 -0
  42. package/src/cli/cmd_Ci.ts +8 -11
  43. package/src/cli/cmd_Commands.ts +4 -4
  44. package/src/cli/cmd_ConfigKeys.ts +2 -2
  45. package/src/cli/cmd_Drill.ts +145 -0
  46. package/src/cli/cmd_Home.ts +50 -3
  47. package/src/cli/cmd_Init.ts +1 -1
  48. package/src/cli/cmd_Media.ts +10 -8
  49. package/src/cli/cmd_Mv.ts +14 -7
  50. package/src/cli/cmd_Review.ts +6 -4
  51. package/src/cli/cmd_Shot.ts +5 -2
  52. package/src/cli/cmd_Smoke.ts +5 -2
  53. package/src/cli/cmd_Social.ts +226 -0
  54. package/src/cli/cmd_Sound.ts +1 -1
  55. package/src/cli/cmd_Start.ts +1 -1
  56. package/src/cli/cmd_Time.ts +1 -1
  57. package/src/cli/cmd_TraceAudit.ts +6 -6
  58. package/src/cli/cmd_Trailer.ts +7 -4
  59. package/src/cli/cmd_Veille.ts +173 -0
  60. package/src/cli/cmd_When.ts +2 -2
  61. package/src/cli/family-pages.ts +19 -16
  62. package/src/cli/registry.ts +13 -2
  63. package/src/cli.ts +5 -2
  64. package/src/collections/actions.ts +1 -49
  65. package/src/collections/checks.ts +2 -1
  66. package/src/collections/collection-types.ts +12 -3
  67. package/src/collections/providers.ts +4 -4
  68. package/src/collections/review.ts +3 -2
  69. package/src/collections/tests.ts +19 -8
  70. package/src/comfy/comfy-panel.ts +2 -2
  71. package/src/contracts/apply-contracts.ts +1 -3
  72. package/src/contracts/contract-manifests.ts +2 -3
  73. package/src/contracts/contract-types.ts +0 -1
  74. package/src/contracts/contracts-engine.ts +0 -3
  75. package/src/contracts/manifests/discord.contract.ts +1 -1
  76. package/src/contracts/manifests/identity.contract.ts +1 -1
  77. package/src/contracts/manifests/itch.contract.ts +1 -1
  78. package/src/contracts/manifests/steam.contract.ts +1 -1
  79. package/src/core/agent-dir-at.ts +12 -0
  80. package/src/core/agent-dir.ts +16 -0
  81. package/src/core/app-icon.ts +9 -3
  82. package/src/core/budget.ts +1 -1
  83. package/src/core/bun-builtins.ts +2 -2
  84. package/src/core/canonical-scripts.ts +2 -2
  85. package/src/core/discover-checks.ts +38 -6
  86. package/src/core/fix-scope.ts +4 -2
  87. package/src/core/floor-resolve.ts +68 -48
  88. package/src/core/floor.ts +9 -0
  89. package/src/core/git-root.ts +24 -0
  90. package/src/core/global-contribution.ts +4 -1
  91. package/src/core/ignored-block.ts +1 -1
  92. package/src/core/ignored-inputs.ts +3 -2
  93. package/src/core/last-good.ts +3 -1
  94. package/src/core/layout.ts +8 -0
  95. package/src/core/log-stamp.ts +36 -0
  96. package/src/core/loop-watch.ts +93 -0
  97. package/src/core/machine-link.ts +134 -0
  98. package/src/core/memory-watch.ts +41 -0
  99. package/src/core/motherhome.ts +2 -2
  100. package/src/core/one-way-in-policy.ts +34 -26
  101. package/src/core/run-ci.ts +9 -11
  102. package/src/core/run-fixers.ts +9 -9
  103. package/src/core/runs-matrix.ts +1 -1
  104. package/src/core/slots.ts +30 -0
  105. package/src/core/trace-audit.ts +50 -9
  106. package/src/core/tree-rev.ts +60 -0
  107. package/src/core/unit-files.ts +42 -0
  108. package/src/drill/render.ts +140 -0
  109. package/src/drill/run.ts +269 -0
  110. package/src/fleet/scan-fleet.ts +6 -5
  111. package/src/home/daemon-jobs.ts +201 -0
  112. package/src/home/global-context.ts +44 -8
  113. package/src/home/gui-app/ShipkitGui.swift +91 -2
  114. package/src/home/home-routes.ts +22 -15
  115. package/src/home/hubs.ts +10 -3
  116. package/src/home/inbox-shape.ts +54 -5
  117. package/src/home/inbox.ts +17 -2
  118. package/src/home/lib-watch.ts +10 -3
  119. package/src/home/machine-stores.ts +15 -29
  120. package/src/home/pm-config.ts +4 -1
  121. package/src/home/pm-inputs.ts +2 -0
  122. package/src/home/resources.ts +7 -2
  123. package/src/home/run-daemon.ts +15 -18
  124. package/src/home/run-pm.ts +3 -1
  125. package/src/home/serve-daemon.ts +4 -3
  126. package/src/home/serve-web.ts +104 -1
  127. package/src/hooks/commit-message.ts +29 -20
  128. package/src/hooks/hook-gates.ts +1 -1
  129. package/src/hooks/leak-guard.ts +69 -9
  130. package/src/hooks/run-hooks.ts +18 -22
  131. package/src/identities/identities.ts +334 -0
  132. package/src/identities/machine-route.ts +126 -0
  133. package/src/identities/machine.ts +62 -0
  134. package/src/init-repo.ts +3 -3
  135. package/src/ledger/check-stats.ts +10 -9
  136. package/src/ledger/gate-checks.ts +32 -1
  137. package/src/ledger/record-kept.ts +112 -0
  138. package/src/ledger/repo-view.ts +10 -0
  139. package/src/ledger/run-log.ts +17 -12
  140. package/src/ledger/run-timeline.ts +8 -4
  141. package/src/ledger/store.ts +7 -0
  142. package/src/ledger/suite-log.ts +17 -13
  143. package/src/media-kinds.ts +3 -2
  144. package/src/media-store/backup/daemon.ts +73 -0
  145. package/src/media-store/backup/keys.ts +25 -0
  146. package/src/media-store/backup/manifest.ts +193 -0
  147. package/src/media-store/backup/restore.ts +192 -0
  148. package/src/media-store/backup/run.ts +278 -0
  149. package/src/media-store/backup/secret.ts +86 -0
  150. package/src/media-store/backup/snapshot.ts +64 -0
  151. package/src/media-store/backup/sources.ts +199 -0
  152. package/src/media-store/content.ts +1 -1
  153. package/src/media-store/daemon.ts +56 -70
  154. package/src/media-store/db.ts +1 -1
  155. package/src/media-store/fact.ts +1 -1
  156. package/src/media-store/hand.ts +1 -1
  157. package/src/media-store/kind.ts +1 -1
  158. package/src/media-store/purge.ts +1 -1
  159. package/src/media-store/put.ts +5 -3
  160. package/src/media-store/remote.ts +1 -1
  161. package/src/media-store/space.ts +24 -5
  162. package/src/mv/mv-md.ts +63 -22
  163. package/src/pages/forward.ts +35 -0
  164. package/src/pages/frame-client.ts +118 -0
  165. package/src/pages/routes.ts +29 -0
  166. package/src/pages/unit.ts +92 -0
  167. package/src/plan/planner.ts +12 -0
  168. package/src/plan/repo-source.ts +19 -5
  169. package/src/reflect/transcript.ts +35 -10
  170. package/src/release/public-clean.ts +319 -0
  171. package/src/release/published-here.ts +22 -0
  172. package/src/release/run-bump.ts +3 -2
  173. package/src/release/run-release.ts +7 -4
  174. package/src/repo-config.ts +71 -13
  175. package/src/review/anim.ts +1 -1
  176. package/src/review/auto.ts +1 -1
  177. package/src/review/cells.ts +15 -1
  178. package/src/review/format.ts +2 -2
  179. package/src/review/http.ts +16 -2
  180. package/src/review/marks.ts +1 -1
  181. package/src/review/media-kind.ts +1 -1
  182. package/src/review/media-read.ts +1 -1
  183. package/src/review/model.ts +27 -6
  184. package/src/review/notes.ts +125 -0
  185. package/src/review/previews.ts +1 -1
  186. package/src/review/project.ts +7 -39
  187. package/src/review/role.ts +1 -1
  188. package/src/review/routes.ts +18 -14
  189. package/src/review/store.ts +42 -2
  190. package/src/review/threads.ts +1 -1
  191. package/src/review/trailer-desk.ts +3 -3
  192. package/src/review/trailer-media.ts +8 -5
  193. package/src/review/trailer-model.ts +1 -1
  194. package/src/review/trailer-routes.ts +1 -1
  195. package/src/review/trailer-shots.ts +22 -5
  196. package/src/review/unit.ts +2 -2
  197. package/src/scaffold/files/agent-handoff.md +3 -0
  198. package/src/scaffold/files/agent-index.md +4 -12
  199. package/src/scaffold/files/tsconfig.json +1 -1
  200. package/src/scaffold/project-scaffold.ts +6 -5
  201. package/src/serve/embed.ts +2 -2
  202. package/src/serve/hub-app/check-words.ts +1 -1
  203. package/src/serve/hub-app/col-card.tsx +3 -17
  204. package/src/serve/hub-app/col-tables-view.tsx +2 -1
  205. package/src/serve/hub-app/cols-svc.ts +0 -13
  206. package/src/serve/hub-app/dock-st.ts +4 -2
  207. package/src/serve/hub-app/dock-view.tsx +2 -0
  208. package/src/serve/hub-app/frames-st.ts +35 -0
  209. package/src/serve/hub-app/hash-route.ts +64 -1
  210. package/src/serve/hub-app/home-st.ts +32 -8
  211. package/src/serve/hub-app/home-strip.css +9 -1
  212. package/src/serve/hub-app/home-strip.tsx +7 -6
  213. package/src/serve/hub-app/home.html +5 -0
  214. package/src/serve/hub-app/hub-app.tsx +51 -7
  215. package/src/serve/hub-app/hub.css +29 -11
  216. package/src/serve/hub-app/icons.tsx +16 -1
  217. package/src/serve/hub-app/identities-st.ts +210 -0
  218. package/src/serve/hub-app/identities-view.tsx +353 -0
  219. package/src/serve/hub-app/identities.css +48 -0
  220. package/src/serve/hub-app/identity-address.ts +52 -0
  221. package/src/serve/hub-app/inbox-st.ts +60 -7
  222. package/src/serve/hub-app/inbox-view.tsx +49 -7
  223. package/src/serve/hub-app/inbox.css +12 -1
  224. package/src/serve/hub-app/index.html +3 -0
  225. package/src/serve/hub-app/kept-cols.tsx +30 -0
  226. package/src/serve/hub-app/keys.ts +10 -2
  227. package/src/serve/hub-app/list-walk.ts +89 -0
  228. package/src/serve/hub-app/machine-st.ts +12 -0
  229. package/src/serve/hub-app/media-svc.ts +1 -1
  230. package/src/serve/hub-app/media-view.tsx +2 -1
  231. package/src/serve/hub-app/pages-frames.tsx +134 -0
  232. package/src/serve/hub-app/pages-svc.ts +111 -0
  233. package/src/serve/hub-app/palette-st.ts +18 -3
  234. package/src/serve/hub-app/palette-view.tsx +9 -2
  235. package/src/serve/hub-app/planned-view.tsx +2 -1
  236. package/src/serve/hub-app/project-list.css +18 -14
  237. package/src/serve/hub-app/project-list.tsx +88 -49
  238. package/src/serve/hub-app/projects-svc.ts +33 -3
  239. package/src/serve/hub-app/repo-sections.ts +19 -2
  240. package/src/serve/hub-app/repo-st.ts +76 -20
  241. package/src/serve/hub-app/review/review-board.tsx +1 -1
  242. package/src/serve/hub-app/review/review-cells.tsx +6 -5
  243. package/src/serve/hub-app/review/review-kit.ts +30 -7
  244. package/src/serve/hub-app/review/review-page.tsx +6 -5
  245. package/src/serve/hub-app/review/review-st.ts +34 -15
  246. package/src/serve/hub-app/review/review-thread.tsx +63 -14
  247. package/src/serve/hub-app/review/review-views.tsx +133 -51
  248. package/src/serve/hub-app/review/thread-st.ts +80 -37
  249. package/src/serve/hub-app/review/trailer-page.tsx +7 -5
  250. package/src/serve/hub-app/review/trailer-st.ts +1 -1
  251. package/src/serve/hub-app/review.css +26 -9
  252. package/src/serve/hub-app/site/site-part.tsx +173 -0
  253. package/src/serve/hub-app/site/site-st.ts +157 -0
  254. package/src/serve/hub-app/site.css +35 -0
  255. package/src/serve/hub-app/social/calendar.tsx +182 -0
  256. package/src/serve/hub-app/social/comms-page.tsx +330 -0
  257. package/src/serve/hub-app/social/kit.tsx +244 -0
  258. package/src/serve/hub-app/social/post-card.tsx +456 -0
  259. package/src/serve/hub-app/social/problems.tsx +60 -0
  260. package/src/serve/hub-app/social/social-model.ts +154 -0
  261. package/src/serve/hub-app/social/social-page.tsx +681 -0
  262. package/src/serve/hub-app/social/social-st.ts +1014 -0
  263. package/src/serve/hub-app/social.css +289 -0
  264. package/src/serve/hub-app/stores/stores-page.tsx +312 -0
  265. package/src/serve/hub-app/stores/stores-st.ts +286 -0
  266. package/src/serve/hub-app/stores.css +54 -0
  267. package/src/serve/hub-app/timeline-geometry.ts +1 -1
  268. package/src/serve/hub-app/timeline-view.tsx +3 -2
  269. package/src/serve/hub-app/tree-build.ts +6 -0
  270. package/src/serve/hub-app/tree-row.tsx +27 -4
  271. package/src/serve/hub-app/tree-svc.ts +18 -49
  272. package/src/serve/hub-app/veille/veille-page.tsx +515 -0
  273. package/src/serve/hub-app/veille/veille-st.ts +443 -0
  274. package/src/serve/hub-app/veille.css +84 -0
  275. package/src/serve/hub-runtime.ts +20 -11
  276. package/src/serve/project-gutter-route.ts +44 -12
  277. package/src/serve/run-lanes.ts +7 -4
  278. package/src/serve/same-origin.ts +1 -1
  279. package/src/serve/serve-hub.ts +20 -12
  280. package/src/serve/tracked-watch.ts +24 -3
  281. package/src/serve/warm-cell.ts +5 -1
  282. package/src/shipkit-files.ts +15 -4
  283. package/src/shipkit.ts +0 -1
  284. package/src/shot/box.ts +160 -0
  285. package/src/shot/browser-slot.ts +74 -0
  286. package/src/shot/client.ts +42 -7
  287. package/src/shot/clip-encoder.ts +108 -24
  288. package/src/shot/film-box.ts +292 -0
  289. package/src/shot/shooter.ts +71 -17
  290. package/src/shot/shot-ask.ts +10 -2
  291. package/src/shot/stepped-clip.ts +5 -4
  292. package/src/site/desk.ts +242 -0
  293. package/src/site/routes.ts +66 -0
  294. package/src/site/unit.ts +62 -0
  295. package/src/social/brands.ts +22 -0
  296. package/src/social/card-drafts.ts +24 -0
  297. package/src/social/compose.ts +97 -0
  298. package/src/social/desk-index.ts +123 -0
  299. package/src/social/desk-wire.ts +64 -0
  300. package/src/social/drafts.ts +183 -0
  301. package/src/social/house.ts +24 -0
  302. package/src/social/load.ts +332 -0
  303. package/src/social/md.ts +70 -0
  304. package/src/social/media-facts.ts +53 -0
  305. package/src/social/media-kind.ts +189 -0
  306. package/src/social/media-limit.ts +42 -0
  307. package/src/social/media-of.ts +30 -0
  308. package/src/social/migrate.ts +123 -0
  309. package/src/social/open.ts +17 -0
  310. package/src/social/post-url.ts +158 -0
  311. package/src/social/presence.ts +332 -0
  312. package/src/social/public-read.ts +53 -0
  313. package/src/social/publish/bluesky.ts +168 -0
  314. package/src/social/publish/discord.ts +76 -0
  315. package/src/social/publish/index.ts +24 -0
  316. package/src/social/publish/secret.ts +13 -0
  317. package/src/social/push.ts +37 -0
  318. package/src/social/richtext.ts +37 -0
  319. package/src/social/routes.ts +186 -0
  320. package/src/social/stats.ts +134 -0
  321. package/src/social/text.ts +267 -0
  322. package/src/social/tracker-route.ts +39 -0
  323. package/src/social/tracker.ts +255 -0
  324. package/src/social/unit.ts +53 -0
  325. package/src/social/writes.ts +130 -0
  326. package/src/start-repo.ts +14 -9
  327. package/src/stores/collection.ts +27 -0
  328. package/src/stores/desk.ts +336 -0
  329. package/src/stores/model.ts +187 -0
  330. package/src/stores/routes.ts +126 -0
  331. package/src/stores/unit.ts +57 -0
  332. package/src/suite/calibrate.ts +127 -0
  333. package/src/suite/core-counters.ts +91 -0
  334. package/src/suite/judge-suites.ts +95 -35
  335. package/src/suite/suite-cli.ts +44 -10
  336. package/src/suite/suite-cpu-preload.ts +34 -9
  337. package/src/trace/tracer.ts +12 -5
  338. package/src/trailer/adapter.ts +5 -1
  339. package/src/trailer/build.ts +45 -12
  340. package/src/trailer/ffmpeg.ts +11 -0
  341. package/src/trailer/footage.ts +30 -13
  342. package/src/trailer/grammar.ts +18 -2
  343. package/src/trailer/graph.ts +28 -6
  344. package/src/trailer/holes.ts +1 -1
  345. package/src/trailer/passage.ts +18 -6
  346. package/src/trailer/plan.ts +74 -3
  347. package/src/trailer/prune.ts +1 -1
  348. package/src/trailer/states.ts +1 -1
  349. package/src/trailer/stitch.ts +67 -26
  350. package/src/trailer/url.ts +1 -1
  351. package/src/trailer/versions.ts +24 -0
  352. package/src/trailer/words.ts +1 -1
  353. package/src/ts/gate-typecheck.ts +32 -0
  354. package/src/ts/typecheck-cli.ts +9 -11
  355. package/src/tui/run-tui.ts +1 -1
  356. package/src/tui/tui-app.tsx +0 -1
  357. package/src/tui/tui-store.ts +1 -1
  358. package/src/veille/asks.ts +155 -0
  359. package/src/veille/auto.ts +31 -0
  360. package/src/veille/batch.ts +27 -0
  361. package/src/veille/chrome.ts +127 -0
  362. package/src/veille/collection.ts +28 -0
  363. package/src/veille/desk.ts +242 -0
  364. package/src/veille/identity.ts +80 -0
  365. package/src/veille/import.ts +68 -0
  366. package/src/veille/log.ts +183 -0
  367. package/src/veille/platforms.ts +118 -0
  368. package/src/veille/reads.ts +66 -0
  369. package/src/veille/replied.ts +110 -0
  370. package/src/veille/routes.ts +185 -0
  371. package/src/veille/service.ts +81 -0
  372. package/src/veille/watch.ts +116 -0
  373. package/src/veille/worth.ts +46 -0
  374. package/src/wiki/scan-md.ts +18 -0
  375. package/src/collections/posts.ts +0 -142
  376. package/src/contracts/manifests/social.contract.ts +0 -20
  377. package/src/scaffold/files/agent-coding.md +0 -35
  378. package/src/ts/typecheck-cache.ts +0 -11
@@ -0,0 +1,182 @@
1
+ // the calendar over Communications (wiki tools/shipkit/social.md, The desks in the hub): four weeks, a row an account,
2
+ // a dot a post coloured by its draft's kind, a hollow dot a slotted draft still to post; the slots, the topics, the
3
+ // week ahead. Drawn from the timeline the desk route sends for the identity the list keeps (social/presence.ts)
4
+ import { observer } from 'mobx-react-lite'
5
+ import type { CSSProperties } from 'react'
6
+ import { Fold, Logo } from './kit.tsx'
7
+ import { FAM_LABEL, kindTone, type Timeline } from './social-model.ts'
8
+ import type { SocialSt } from './social-st.ts'
9
+
10
+ type SlotDay = Timeline['slots'][number]
11
+ type Mark = Timeline['rows'][number]['marks'][number]
12
+
13
+ const utc = (day: string): Date => new Date(`${day}T12:00:00Z`)
14
+ const LETTER = 'SMTWTFS'
15
+ const SHORT = new Intl.DateTimeFormat('en-GB', { timeZone: 'UTC', weekday: 'short', day: 'numeric', month: '2-digit' })
16
+ /** « Wed 28/10 » */
17
+ const dayName = (day: string): string => SHORT.format(utc(day)).replace(',', '')
18
+ const isMonday = (day: string): boolean => utc(day).getUTCDay() === 1
19
+ /** a day column's kind: today, a day to come, a Monday's line */
20
+ const col = (t: Timeline, day: string): string => `${day === t.today ? ' today' : day > t.today ? ' later' : ''}${isMonday(day) ? ' monday' : ''}`
21
+
22
+ function Dot(p: { tone: string; planned?: boolean; on?: boolean }) {
23
+ return <span className={`so-dot${p.planned ? ' planned' : ''}${p.on ? ' on' : ''}`} style={{ '--tone': p.tone } as CSSProperties} />
24
+ }
25
+
26
+ export const SocialCalendar = observer(({ so }: { so: SocialSt }) => {
27
+ const t = so.timeline
28
+ const open = so.calendarOpen
29
+ const rows = t ? t.rows.filter((r) => so.family === null || r.family === so.family) : []
30
+ const kinds = [...new Set(rows.flatMap((r) => r.marks.map((m) => m.kind)))].sort()
31
+ const week = t ? new Set(t.days.slice(14, 21)) : new Set<string>()
32
+ const posted7 = rows.reduce((n, r) => n + r.marks.filter((m) => !m.planned && week.has(m.day)).length, 0)
33
+ const who = so.identityOf(so.timelineIdentity)?.name
34
+ return (
35
+ <div className="so-cal">
36
+ <div className="so-calhead">
37
+ <Fold open={open} flip={() => so.flipCalendar()} />
38
+ <b className="so-click" onClick={() => so.flipCalendar()}>
39
+ Calendar
40
+ </b>
41
+ <span className="rv-dim rv-small">
42
+ {t ? `${posted7} posts these 7 days${who ? ` · ${who}` : ''}${so.fam === null ? '' : ` · ${FAM_LABEL[so.fam]}`}` : so.desk ? 'no timeline: no draft speaks as this identity here' : so.loadError ?? so.waitText}
43
+ </span>
44
+ <span className="sp" />
45
+ <span className="so-legendkinds">
46
+ {kinds.map((k) => (
47
+ <span key={k}>
48
+ <Dot tone={kindTone(k)} /> {k}
49
+ </span>
50
+ ))}
51
+ {kinds.length > 0 ? (
52
+ <span>
53
+ <Dot tone="var(--dim)" planned /> planned
54
+ </span>
55
+ ) : null}
56
+ </span>
57
+ </div>
58
+ {open && t ? (
59
+ <>
60
+ <Grid so={so} t={t} rows={rows} />
61
+ <Topics so={so} t={t} />
62
+ <WeekAhead so={so} t={t} />
63
+ </>
64
+ ) : null}
65
+ </div>
66
+ )
67
+ })
68
+
69
+ const Grid = observer(({ so, t, rows }: { so: SocialSt; t: Timeline; rows: Timeline['rows'] }) => {
70
+ const title = (slug: string): string => so.drafts.find((d) => d.slug === slug)?.title || slug
71
+ const at = (r: Timeline['rows'][number], day: string): Mark[] => r.marks.filter((m) => m.day === day)
72
+ const current = so.currentDraft?.slug
73
+ const identity = so.timelineIdentity
74
+ return (
75
+ <div className="so-calgrid" style={{ gridTemplateColumns: `96px repeat(${t.days.length}, minmax(0, 1fr))` }}>
76
+ <div />
77
+ {t.days.map((day) => (
78
+ <div key={day} className={`so-calday${col(t, day)}`}>
79
+ <div className="so-calnum">{Number(day.slice(8))}</div>
80
+ <div className="so-calletter">{LETTER[utc(day).getUTCDay()]}</div>
81
+ </div>
82
+ ))}
83
+ <div className="so-callabel rv-dim">slots</div>
84
+ {t.days.map((day) => (
85
+ <div key={day} className={`so-calcell${col(t, day)}`}>
86
+ {t.slots
87
+ .filter((s) => s.day === day)
88
+ .map((s) => (
89
+ <SlotMark key={s.slot.tag} so={so} s={s} today={t.today} title={title} />
90
+ ))}
91
+ </div>
92
+ ))}
93
+ {rows.map((r, i) => {
94
+ const edge = rows[i + 1] && rows[i + 1]!.family !== r.family ? ' edge' : ''
95
+ const a = so.accountOf(identity, r.account)
96
+ return [
97
+ <div key={r.account} className={`so-calacct${edge}`}>
98
+ <Logo id={r.account} name={a?.name ?? r.account} size={12} />
99
+ <span className="so-ellip">{a?.name ?? r.account}</span>
100
+ </div>,
101
+ ...t.days.map((day) => (
102
+ <div key={`${r.account}/${day}`} className={`so-calcell${col(t, day)}${edge}`}>
103
+ {at(r, day).map((m, k) => (
104
+ <button
105
+ key={k}
106
+ className="so-dotbtn"
107
+ onClick={() => so.pickDraft(m.slug)}
108
+ title={`${a?.name ?? r.account} · ${dayName(day)} · ${title(m.slug)} · ${m.kind || 'no kind'}${m.planned ? ' · planned' : ''}`}
109
+ >
110
+ <Dot tone={kindTone(m.kind)} planned={m.planned} on={m.slug === current} />
111
+ </button>
112
+ ))}
113
+ </div>
114
+ )),
115
+ ]
116
+ })}
117
+ </div>
118
+ )
119
+ })
120
+
121
+ /** a slot of the rhythm on its day: filled once a draft takes it, hollow while « empty »; grey once its day passed empty */
122
+ const SlotMark = observer(({ so, s, today, title }: { so: SocialSt; s: SlotDay; today: string; title: (slug: string) => string }) => {
123
+ const taken = s.drafts.length > 0
124
+ const first = s.drafts[0]
125
+ return (
126
+ <button
127
+ className={`so-slot${taken ? ' taken' : ''}${!taken && s.day < today ? ' missed' : ''}`}
128
+ onClick={() => first && so.pickDraft(first)}
129
+ title={`${dayName(s.day)} · #${s.slot.tag}${s.slot.time ? ` ${s.slot.time}` : ''} · ${taken ? s.drafts.map(title).join(', ') : 'empty'}\n${s.slot.what}`}
130
+ />
131
+ )
132
+ })
133
+
134
+ /** the topics of the last 14 days, the family's: a chip each, its drafts posted, a topic at 0 dimmed */
135
+ const Topics = observer(({ so, t }: { so: SocialSt; t: Timeline }) => {
136
+ const topics = t.topics[so.family ?? 'all']
137
+ if (topics.length === 0) return null
138
+ return (
139
+ <div className="so-calline">
140
+ <span className="so-callabel rv-dim">topics · 14 days</span>
141
+ {topics.map((x) => (
142
+ <span key={x.topic} className={`so-topic${x.n ? ' on' : ''}`} title={`${x.topic}: ${x.n} draft${x.n === 1 ? '' : 's'} posted these 14 days`}>
143
+ {x.topic} <span className="so-num">{x.n}</span>
144
+ </span>
145
+ ))}
146
+ </div>
147
+ )
148
+ })
149
+
150
+ /** the week ahead, as `sk social plan` says it: each slot and its draft or « empty », then the drafts ready with no slot */
151
+ const WeekAhead = observer(({ so, t }: { so: SocialSt; t: Timeline }) => {
152
+ const plan = t.plan
153
+ const title = (slug: string): string => so.drafts.find((d) => d.slug === slug)?.title || slug
154
+ return (
155
+ <div className="so-calline">
156
+ <span className="so-callabel rv-dim">the week</span>
157
+ {plan.slots.map((s) => (
158
+ <span key={`${s.day}/${s.slot.tag}`} className="so-weekslot" title={s.slot.what}>
159
+ <span className="rv-dim">{s.slot.day === 'week' ? 'week' : `${dayName(s.day)}${s.slot.time ? ` ${s.slot.time}` : ''}`}</span>
160
+ <b className="so-slottag">#{s.slot.tag}</b>
161
+ {s.drafts.length === 0 ? (
162
+ <i className="rv-dim">empty</i>
163
+ ) : (
164
+ s.drafts.map((slug) => (
165
+ <button key={slug} className="so-linkbtn so-ellip" onClick={() => so.pickDraft(slug)}>
166
+ {title(slug)}
167
+ </button>
168
+ ))
169
+ )}
170
+ </span>
171
+ ))}
172
+ {plan.missed.length > 0 ? (
173
+ <span className="so-missed rv-small" title={plan.missed.map(title).join('\n')}>
174
+ {plan.missed.length} slot{plan.missed.length === 1 ? '' : 's'} passed with no post
175
+ </span>
176
+ ) : null}
177
+ <span className="rv-dim rv-small" title={plan.ready.map(title).join('\n')}>
178
+ {plan.ready.length} ready with no slot
179
+ </span>
180
+ </div>
181
+ )
182
+ })
@@ -0,0 +1,330 @@
1
+ // a repo's Communications page (`#page:comms`, wiki tools/shipkit/social.md, The desks in the hub): the calendar on top,
2
+ // the drafts on the left (the family, the channel, the identity, the order), the draft picked in the middle (its angle,
3
+ // his notes, a card a heading), its article and media on the right. On a phone one pane at a time
4
+ import { observer } from 'mobx-react-lite'
5
+ import { Fragment, useEffect, useRef } from 'react'
6
+ import { Panel, Separator } from 'react-resizable-panels'
7
+ import { KeptCols } from '../kept-cols.tsx'
8
+ import type { RepoSt } from '../repo-st.ts'
9
+ import { PANEL, PhoneTop } from '../review/review-page.tsx'
10
+ import { SocialCalendar } from './calendar.tsx'
11
+ import { CopyIcon, ErrorLine, Lightbox, NotesBox, Toast } from './kit.tsx'
12
+ import { AngleCards, Cards, Logos, MediaTile } from './post-card.tsx'
13
+ import { FAM_LABEL, madeOn, posting, STATUS, countsOf, type Draft, type Fam } from './social-model.ts'
14
+ import { Problems } from './problems.tsx'
15
+ import type { SocialSt } from './social-st.ts'
16
+ import type { AskedPost } from '../../../review/notes.ts'
17
+ import { Caret } from '../icons.tsx'
18
+
19
+ export const CommsPage = observer(({ app }: { app: RepoSt }) => {
20
+ const so = app.social
21
+ useEffect(() => {
22
+ so.start()
23
+ return () => so.stop()
24
+ }, [so])
25
+ if (so.phone)
26
+ return (
27
+ <div className="so-phone">
28
+ {so.phonePane === 'list' ? (
29
+ <>
30
+ <PhoneTop app={app} />
31
+ <DraftsList so={so} />
32
+ </>
33
+ ) : (
34
+ <>
35
+ <div className="rv-phonetop">
36
+ <button className="ghost" onClick={() => so.showPhoneList()}>
37
+ ◂ drafts
38
+ </button>
39
+ <b className="so-ellip">{so.currentDraft?.title || so.currentDraft?.slug}</b>
40
+ </div>
41
+ <DraftPane so={so} />
42
+ <DraftSide so={so} />
43
+ </>
44
+ )}
45
+ <Lightbox so={so} />
46
+ <Toast so={so} />
47
+ </div>
48
+ )
49
+ return (
50
+ <div className="so-page">
51
+ <SocialCalendar so={so} />
52
+ <KeptCols id="comms">
53
+ <Panel id="comms-list" defaultSize="22%" minSize={240} className="rv-pane" style={PANEL}>
54
+ <DraftsList so={so} />
55
+ </Panel>
56
+ <Separator className="rsep" />
57
+ <Panel id="comms-draft" defaultSize="46%" minSize={360} className="rv-pane" style={PANEL}>
58
+ <div className="rv-scroll so-ground">
59
+ <DraftPane so={so} />
60
+ </div>
61
+ </Panel>
62
+ <Separator className="rsep" />
63
+ <Panel id="comms-side" defaultSize="32%" minSize={280} className="rv-pane" style={PANEL}>
64
+ <div className="rv-scroll so-ground">
65
+ <DraftSide so={so} />
66
+ </div>
67
+ </Panel>
68
+ </KeptCols>
69
+ <Lightbox so={so} />
70
+ <Toast so={so} />
71
+ </div>
72
+ )
73
+ })
74
+
75
+ const FAM_CHOICES: (Fam | null)[] = ['feed', 'vertical', null]
76
+
77
+ /** every draft in the order asked: its day, its title, its platforms (lit once posted there), its count */
78
+ const DraftsList = observer(({ so }: { so: SocialSt }) => {
79
+ const drafts = so.visibleDrafts
80
+ const t = so.listTotals
81
+ return (
82
+ <div className="so-listcol">
83
+ <div className="so-filters">
84
+ <input ref={(el) => { so.searchEl = el }} className="rv-search" placeholder="search the drafts" value={so.draftQuery} onChange={(e) => so.setDraftQuery(e.currentTarget.value)} />
85
+ <span className="seg so-fullseg">
86
+ {FAM_CHOICES.map((f) => (
87
+ <button key={f ?? 'all'} className={so.fam === f ? 'on' : ''} onClick={() => so.setView({ fam: f })} title={f === 'feed' ? 'the drafts with a message to the feed (X, Bluesky, Threads, Mastodon, Discord)' : f === 'vertical' ? 'the drafts with a message to the vertical (TikTok, Instagram, YouTube)' : 'every draft'}>
88
+ {f ? FAM_LABEL[f] : 'All'}
89
+ </button>
90
+ ))}
91
+ </span>
92
+ <div className="so-selects">
93
+ <select value={so.channel ?? ''} onChange={(e) => so.setView({ channel: e.currentTarget.value || null })} title="only the drafts that hold a message for one platform">
94
+ <option value="">every channel</option>
95
+ {so.channels.map((id) => (
96
+ <option key={id} value={id}>
97
+ {id}
98
+ </option>
99
+ ))}
100
+ </select>
101
+ <select value={so.who ?? ''} onChange={(e) => so.setView({ who: e.currentTarget.value || null })} title="only the drafts one identity speaks">
102
+ <option value="">every identity</option>
103
+ {so.speakers.map((s) => (
104
+ <option key={s.id} value={s.id}>
105
+ {s.name} · {s.n}
106
+ </option>
107
+ ))}
108
+ </select>
109
+ </div>
110
+ <div className="so-selects">
111
+ <button className="ghost" onClick={() => so.foldAll(!so.allFolded)} title={so.allFolded ? 'unfold every series' : 'fold every series'}>
112
+ {so.allFolded ? '⇕ unfold all' : '⇳ fold all'}
113
+ </button>
114
+ <button className="ghost" onClick={() => so.setView({ newestFirst: !so.newestFirst })}>
115
+ {so.newestFirst ? '↓ newest first' : '↑ oldest first'}
116
+ </button>
117
+ </div>
118
+ <span className="rv-count">
119
+ {drafts.length < t.drafts ? `${drafts.length} of ` : ''}
120
+ {t.drafts} drafts · {t.waiting} to post{so.asked.length > 0 ? ` · ${so.asked.length} asked` : ''}
121
+ </span>
122
+ </div>
123
+ <Problems so={so} lines={[...(so.loadError ? [so.loadError] : []), ...so.errors]} />
124
+ <div className="rv-listscroll so-rows">
125
+ {so.asked.map((a) => (
126
+ <AskedRow key={a.id} so={so} a={a} />
127
+ ))}
128
+ {so.desk && so.desk.drafts.length === 0 ? <div className="rv-empty">no draft: write .shipkit/social/drafts/&lt;YYYYMMDD-HHMMSS&gt;-&lt;topic&gt;/draft.md</div> : null}
129
+ {drafts.map((d) => (
130
+ <Fragment key={d.slug}>
131
+ <DraftRow so={so} d={d} />
132
+ {so.shownParts(d).map((part) => (
133
+ <PartRow key={part} so={so} d={d} part={part} />
134
+ ))}
135
+ </Fragment>
136
+ ))}
137
+ </div>
138
+ </div>
139
+ )
140
+ })
141
+
142
+ const ASKED_STATE: Record<string, string> = { claimed: 'in work', blocked: 'blocked', question: 'a question' }
143
+
144
+ /** a post he asked from a review card, no draft yet: a click opens the request on the review page */
145
+ const AskedRow = observer(({ so, a }: { so: SocialSt; a: AskedPost }) => (
146
+ <button className="so-draftrow so-asked" onClick={() => so.openNote(a.id)} title={`asked from the review card ${a.card}: an agent writes the draft${a.text ? `\n${a.text}` : ''}`}>
147
+ <span className="so-day">{madeOn(a.id)}</span>
148
+ <span className="so-rowtitle">
149
+ 📣 {a.title}
150
+ {a.text ? <span className="rv-dim"> · {a.text.split('\n').at(-1)}</span> : null}
151
+ </span>
152
+ <span className="so-frac">{ASKED_STATE[a.state] ?? 'asked'}</span>
153
+ </button>
154
+ ))
155
+
156
+ /** the row picked stays in view, as the arrows walk the list */
157
+ function useInView(on: boolean) {
158
+ const ref = useRef<HTMLButtonElement>(null)
159
+ useEffect(() => {
160
+ if (on) ref.current?.scrollIntoView({ block: 'nearest' })
161
+ }, [on])
162
+ return ref
163
+ }
164
+
165
+ const DraftRow = observer(({ so, d }: { so: SocialSt; d: Draft }) => {
166
+ const c = so.listCounts(d)
167
+ const on = so.isDraft(d) && so.currentPart === null
168
+ const ref = useInView(on)
169
+ const other = so.desk?.speaksAs != null && d.identity !== so.desk.speaksAs
170
+ return (
171
+ <button ref={ref} className={`so-draftrow p-${posting(c)}${on ? ' on' : ''}${d.status === 'rejected' ? ' rejected' : ''}`} onClick={() => so.pickDraft(d.slug)} title={d.slug}>
172
+ {so.listParts(d).length > 0 ? (
173
+ <span
174
+ className="so-chev"
175
+ role="button"
176
+ aria-label={so.seriesFolded(d) ? 'unfold the messages' : 'fold the messages'}
177
+ onClick={(e) => {
178
+ // the fold alone: the row's own click would open the draft
179
+ e.stopPropagation()
180
+ so.flipSeries(d)
181
+ }}
182
+ >
183
+ <Caret open={!so.seriesFolded(d)} />
184
+ </span>
185
+ ) : null}
186
+ <span className="so-day">{madeOn(d.slug)}</span>
187
+ <span className="so-rowtitle">
188
+ {d.article ? <span className="so-art" title="an article: it holds a post.md">▤</span> : null}
189
+ {d.title || d.slug}
190
+ </span>
191
+ {other ? <span className="so-who" title={`spoken as ${so.identityOf(d.identity)?.name ?? d.identity}, not the repo's identity`}>{so.identityOf(d.identity)?.name ?? d.identity}</span> : null}
192
+ <Logos so={so} posts={so.familyPosts(d)} size={14} />
193
+ <span className={`so-frac${c.of > 0 && c.posted === c.of ? ' t-ok' : ''}`}>
194
+ {c.posted}/{c.of}
195
+ </span>
196
+ </button>
197
+ )
198
+ })
199
+
200
+ /** one message of a series under its draft's row: its name, its platforms, its count; a click opens it alone */
201
+ const PartRow = observer(({ so, d, part }: { so: SocialSt; d: Draft; part: string }) => {
202
+ const posts = so.familyPosts(d).filter((x) => x.name === part)
203
+ const c = so.listCounts(d, part)
204
+ const on = so.isDraft(d) && so.currentPart === part
205
+ const ref = useInView(on)
206
+ return (
207
+ <button ref={ref} className={`so-draftrow part p-${posting(c)}${on ? ' on' : ''}${d.status === 'rejected' ? ' rejected' : ''}`} onClick={() => so.pickDraft(d.slug, part)} title={posts[0]?.text}>
208
+ <span className="rv-dim">↳</span>
209
+ <span className="so-rowtitle small">{part}</span>
210
+ <Logos so={so} posts={posts} size={12} />
211
+ <span className={`so-frac${c.of > 0 && c.posted === c.of ? ' t-ok' : ''}`}>
212
+ {c.posted}/{c.of}
213
+ </span>
214
+ </button>
215
+ )
216
+ })
217
+
218
+ const DraftPane = observer(({ so }: { so: SocialSt }) => {
219
+ const d = so.currentDraft
220
+ if (!d) return <div className="rv-empty">{so.desk ? 'no draft here: the list keeps none' : so.loadError ?? so.waitText}</div>
221
+ return <DraftPage so={so} d={d} />
222
+ })
223
+
224
+ /** a draft picked: its title and state, its angle, his notes, then a card a message */
225
+ const DraftPage = observer(({ so, d }: { so: SocialSt; d: Draft }) => {
226
+ const c = countsOf(d.posts)
227
+ const all = c.posted === c.of && c.of > 0
228
+ const speaker = so.identityOf(d.identity)
229
+ const shown = so.shownMessages(d)
230
+ useEffect(() => void so.loadNotes(d.slug), [so, d.slug])
231
+ return (
232
+ <div className="so-colin">
233
+ <ErrorLine so={so} />
234
+ <div className="so-pagehead">
235
+ <h2 className="so-h">
236
+ {d.title || d.slug}
237
+ {d.kind ? <span className="rv-dim so-light"> · {d.kind}</span> : null}
238
+ </h2>
239
+ <span className={`so-badge ${all ? 't-ok' : d.status === 'picked' ? 't-warn' : 't-dim'}`}>{all ? 'posted everywhere' : `${STATUS[d.status] ?? d.status} · ${c.posted}/${c.of}`}</span>
240
+ </div>
241
+ <div className="so-meta">
242
+ {speaker ? (
243
+ <span className={`so-who${d.identity !== so.desk?.speaksAs ? '' : ' own'}`} title="the identity that speaks it">
244
+ {speaker.name}
245
+ </span>
246
+ ) : null}
247
+ <a href={so.editorUrl(d.path)}>open in VS Code ({d.file}) ↗</a>
248
+ {d.review ? (
249
+ <button className="so-linkbtn" title={`the review card it was asked from: ${d.review}`} onClick={() => so.openNote(d.review as string)}>
250
+ 📣 from its review card
251
+ </button>
252
+ ) : null}
253
+ </div>
254
+ {d.angle ? <AngleCards key={d.slug} angle={d.angle} /> : null}
255
+ <NotesBox so={so} notes={so.notes[d.slug] ?? []} placeholder="a note on this draft: it goes to the review page, an agent takes it" send={(text) => so.sendNote(d, text)} />
256
+ {so.currentPart !== null ? (
257
+ <div className="so-partline">
258
+ <span className="so-partchip">{so.currentPart}</span>
259
+ <button className="so-linkbtn" onClick={() => so.pickDraft(d.slug)}>
260
+ the whole draft
261
+ </button>
262
+ </div>
263
+ ) : null}
264
+ <Cards so={so} posts={shown.filter((x) => so.inFamilyPost(x))} />
265
+ {so.fam !== null && shown.some((x) => !so.inFamilyPost(x)) ? (
266
+ <>
267
+ <div className="rv-divider">outside {FAM_LABEL[so.fam]}</div>
268
+ <Cards so={so} posts={shown.filter((x) => !so.inFamilyPost(x))} />
269
+ </>
270
+ ) : null}
271
+ </div>
272
+ )
273
+ })
274
+
275
+ const DraftSide = observer(({ so }: { so: SocialSt }) => {
276
+ const d = so.currentDraft
277
+ return d ? <DraftMedia so={so} d={d} /> : null
278
+ })
279
+
280
+ /** the right of a draft: its article when it holds one, every media large, the picture's description */
281
+ const DraftMedia = observer(({ so, d }: { so: SocialSt; d: Draft }) => {
282
+ const art = d.article
283
+ return (
284
+ <div className="so-colin">
285
+ {art ? (
286
+ <div className="so-card so-article">
287
+ <div className="so-posthead">
288
+ <span className="so-art">▤</span>
289
+ <b className="so-grow">{art.title}</b>
290
+ <span className={`so-badge ${art.draft ? 't-dim' : 't-ok'}`}>{art.draft ? 'not online' : 'online'}</span>
291
+ </div>
292
+ <div className="rv-dim rv-small">
293
+ {art.date}
294
+ {art.url ? (
295
+ <>
296
+ {' · '}
297
+ <a href={art.url} target="_blank" rel="noreferrer">
298
+ {art.url}
299
+ </a>
300
+ </>
301
+ ) : null}
302
+ </div>
303
+ {art.description ? <div className="so-text">{art.description}</div> : null}
304
+ <div className="so-acts">
305
+ {so.desk?.article ? (
306
+ <a className="so-btn primary" href={so.previewUrl(d.slug)} target="_blank" rel="noreferrer" title="the page as the site renders it">
307
+ 👁 Preview
308
+ </a>
309
+ ) : null}
310
+ <a className="so-btn" href={so.editorUrl(d.path.replace(/draft\.md$/, 'post.md'))}>
311
+ ✎ post.md
312
+ </a>
313
+ </div>
314
+ </div>
315
+ ) : null}
316
+ <b>Media</b>
317
+ {d.media.length === 0 ? <div className="rv-dim rv-small">none: `media:` in the draft's front matter</div> : null}
318
+ {d.media.map((m) => (
319
+ <MediaTile key={m.name} so={so} slug={d.slug} m={m} size="large" />
320
+ ))}
321
+ {d.alt ? (
322
+ <div className="so-card so-row">
323
+ <span className="so-rowfield">description</span>
324
+ <span className="so-rowvalue">{d.alt}</span>
325
+ <CopyIcon so={so} text={d.alt} k={`${d.slug}/alt`} title="copy the description" />
326
+ </div>
327
+ ) : null}
328
+ </div>
329
+ )
330
+ })