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,226 @@
1
+ // sk social and sk identities: who speaks, and where a repo stands in public (wiki build/shipkit/social.md, `sk
2
+ // social`). Every module loads inside execute: the cli registers this file on every `sk` call
3
+ import { Command, Option } from 'clipanion'
4
+
5
+ type Ctx = { stdout: NodeJS.WritableStream; stderr: NodeJS.WritableStream }
6
+
7
+ const say = (c: Ctx) => (l: string): void => void c.stdout.write(`${l}\n`)
8
+
9
+ /** the desk of the repo the command runs in, and its model for one identity */
10
+ async function model(as: string | undefined) {
11
+ const { findRepoRoot } = await import('../ts/config.ts')
12
+ const { openDesk } = await import('../social/open.ts')
13
+ const { socialModel } = await import('../social/text.ts')
14
+ const { dayOf } = await import('../social/presence.ts')
15
+ const { desk } = await openDesk(findRepoRoot(process.cwd()))
16
+ if (as != null && !desk.identities.some((i) => i.id === as)) throw new Error(`no identity ${as} (${desk.identities.map((i) => i.id).join(', ')})`)
17
+ return { desk, m: socialModel(desk, as ?? desk.speaksAs), today: dayOf(Date.now()) }
18
+ }
19
+
20
+ async function guarded(c: Ctx, body: () => Promise<number>): Promise<number> {
21
+ try {
22
+ return await body()
23
+ } catch (e) {
24
+ c.stderr.write(`FAIL: social: ${e instanceof Error ? e.message : String(e)}\n`)
25
+ return 1
26
+ }
27
+ }
28
+
29
+ const asOpt = (): string | undefined => Option.String('--as', { description: "the identity, by id (default: the one this repo speaks as)" })
30
+
31
+ class SocialCommand extends Command {
32
+ static override paths = [['social']]
33
+ static override usage = Command.Usage({
34
+ category: 'Social',
35
+ description: 'where the repo stands in public: posts per account, the rhythm, kinds, topics, hashtags, what waits',
36
+ details:
37
+ 'Every posted line of .shipkit/social/drafts as one post, dated from its id, else from the commit that recorded it. The public numbers come from the free reads (Bluesky, Mastodon, a Discord invite), cached 30 minutes; every other account says unknown. --offline skips them. Page: wiki build/shipkit/social.md',
38
+ examples: [
39
+ ['the overview', 'sk social'],
40
+ ['with no network', 'sk social --offline'],
41
+ ['as another identity', 'sk social --as studio'],
42
+ ],
43
+ })
44
+ offline = Option.Boolean('--offline', false, { description: 'no public read' })
45
+ as = asOpt()
46
+ override async execute(): Promise<number> {
47
+ return guarded(this.context, async () => {
48
+ const { m, today } = await model(this.as)
49
+ const { overviewText } = await import('../social/text.ts')
50
+ const { socialStatsEntries, STATS_PLATFORMS } = await import('../social/stats.ts')
51
+ const stats = this.offline ? null : await socialStatsEntries(m.social.accounts)
52
+ for (const l of overviewText(m, today, stats, STATS_PLATFORMS)) say(this.context)(l)
53
+ return m.social.errors.length ? 1 : 0
54
+ })
55
+ }
56
+ }
57
+
58
+ class SocialTimelineCommand extends Command {
59
+ static override paths = [['social', 'timeline']]
60
+ static override usage = Command.Usage({
61
+ category: 'Social',
62
+ description: 'one row an account, one column a day: the posts of each cell',
63
+ examples: [
64
+ ['the last two weeks', 'sk social timeline'],
65
+ ['the last month', 'sk social timeline --days 30'],
66
+ ],
67
+ })
68
+ days = Option.String('--days', '14', { description: 'how many days, ending today' })
69
+ as = asOpt()
70
+ override async execute(): Promise<number> {
71
+ return guarded(this.context, async () => {
72
+ const { m, today } = await model(this.as)
73
+ const { timelineText } = await import('../social/text.ts')
74
+ const n = Math.max(1, Number(this.days) || 14)
75
+ const from = new Date(Date.parse(`${today}T00:00:00Z`) - (n - 1) * 86_400_000).toISOString().slice(0, 10)
76
+ for (const l of timelineText(m, from, today)) say(this.context)(l)
77
+ return 0
78
+ })
79
+ }
80
+ }
81
+
82
+ class SocialCoverageCommand extends Command {
83
+ static override paths = [['social', 'coverage']]
84
+ static override usage = Command.Usage({ category: 'Social', description: 'the topics against the families: the drafts posted in each, the gaps named', examples: [['what we never talk about', 'sk social coverage']] })
85
+ as = asOpt()
86
+ override async execute(): Promise<number> {
87
+ return guarded(this.context, async () => {
88
+ const { m } = await model(this.as)
89
+ const { coverageText } = await import('../social/text.ts')
90
+ for (const l of coverageText(m)) say(this.context)(l)
91
+ return 0
92
+ })
93
+ }
94
+ }
95
+
96
+ class SocialPostCommand extends Command {
97
+ static override paths = [['social', 'post']]
98
+ static override usage = Command.Usage({
99
+ category: 'Social',
100
+ description: 'one draft across every account of its headings: posted with its date and link, or waiting',
101
+ examples: [
102
+ ['by its topic', 'sk social post arena-face-lift'],
103
+ ['by its whole name', 'sk social post 20261025-131139-arena-face-lift'],
104
+ ],
105
+ })
106
+ draft = Option.String({ required: true })
107
+ override async execute(): Promise<number> {
108
+ return guarded(this.context, async () => {
109
+ const { desk } = await model(undefined)
110
+ const d = desk.drafts.find((x) => x.slug === this.draft || x.slug.replace(/^\d{8}-\d{6}-/, '') === this.draft)
111
+ if (d == null) throw new Error(`no draft "${this.draft}" in .shipkit/social/drafts/: give its folder's name or its topic`)
112
+ const { socialModel, postText } = await import('../social/text.ts')
113
+ for (const l of postText(socialModel(desk, d.identity), d.slug)) say(this.context)(l)
114
+ return 0
115
+ })
116
+ }
117
+ }
118
+
119
+ class SocialPlanCommand extends Command {
120
+ static override paths = [['social', 'plan']]
121
+ static override usage = Command.Usage({
122
+ category: 'Social',
123
+ description: 'the week ahead: each slot of the rhythm with its draft or empty, the late ones, the ready ones',
124
+ details:
125
+ 'The next 7 days from today, Paris. The slots come from .shipkit/social/rhythm.md; a draft takes one with `slot: <YYYY-MM-DD> <tag>` in its front matter. Then the slotted drafts whose day passed with nothing posted, then every draft posted nowhere with no slot, the picked first.',
126
+ examples: [['the week ahead', 'sk social plan']],
127
+ })
128
+ as = asOpt()
129
+ override async execute(): Promise<number> {
130
+ return guarded(this.context, async () => {
131
+ const { m, today } = await model(this.as)
132
+ const { planText } = await import('../social/text.ts')
133
+ for (const l of planText(m, today)) say(this.context)(l)
134
+ for (const e of m.social.errors) say(this.context)(e)
135
+ return m.social.errors.length ? 1 : 0
136
+ })
137
+ }
138
+ }
139
+
140
+ class SocialStateCommand extends Command {
141
+ static override paths = [['social', 'state']]
142
+ static override usage = Command.Usage({
143
+ category: 'Social',
144
+ description: 'where the repo stands in public as a markdown page, with no number that moves with the clock',
145
+ details: 'For a page a repo keeps beside its own voice page. --write <file> writes it, --check <file> exits 1 when it is stale.',
146
+ examples: [['print it', 'sk social state'], ['keep it fresh', 'sk social state --write agent/social-state.md']],
147
+ })
148
+ write = Option.String('--write', { description: 'the file to write' })
149
+ check = Option.String('--check', { description: 'the file to compare' })
150
+ as = asOpt()
151
+ override async execute(): Promise<number> {
152
+ return guarded(this.context, async () => {
153
+ const { m, desk } = await model(this.as)
154
+ const { socialStateText } = await import('../social/text.ts')
155
+ const page = socialStateText(m)
156
+ const { join } = await import('node:path')
157
+ const { readFileSync, writeFileSync } = await import('node:fs')
158
+ if (this.write != null) writeFileSync(join(desk.root, this.write), page)
159
+ else if (this.check != null) {
160
+ const now = (() => { try { return readFileSync(join(desk.root, this.check!), 'utf8') } catch { return '' } })()
161
+ if (now !== page) throw new Error(`${this.check} is stale: sk social state --write ${this.check}`)
162
+ say(this.context)(`ok: ${this.check} is current`)
163
+ } else this.context.stdout.write(page)
164
+ return 0
165
+ })
166
+ }
167
+ }
168
+
169
+ class SocialMigrateCommand extends Command {
170
+ static override paths = [['social', 'migrate']]
171
+ static override usage = Command.Usage({
172
+ category: 'Social',
173
+ description: "the repo's v2 channel files become drafts, once: one draft a slug, a heading a channel",
174
+ details:
175
+ 'Each `.shipkit/social/<channel>/<slug>[.<variant>].md` becomes `.shipkit/social/drafts/<moment>-<slug>/draft.md`: its picked or posted variant (else the first) is the text of `## <channel>`, the other variants are kept word for word under `## Angle`, a posted URL becomes its `## Posted` line. The v2 files are removed once their draft is written. --dry prints the plan and writes nothing.',
176
+ examples: [['the plan', 'sk social migrate --dry'], ['do it', 'sk social migrate']],
177
+ })
178
+ dry = Option.Boolean('--dry', false, { description: 'print the plan, write nothing' })
179
+ override async execute(): Promise<number> {
180
+ return guarded(this.context, async () => {
181
+ const { findRepoRoot } = await import('../ts/config.ts')
182
+ const { migrateV2 } = await import('../social/migrate.ts')
183
+ const r = migrateV2(findRepoRoot(process.cwd()), { dry: this.dry })
184
+ for (const l of r.lines) say(this.context)(l)
185
+ return 0
186
+ })
187
+ }
188
+ }
189
+
190
+ class IdentitiesCommand extends Command {
191
+ static override paths = [['identities']]
192
+ static override usage = Command.Usage({
193
+ category: 'Social',
194
+ description: 'every identity of the machine: its accounts online over its accounts, and the repos speaking as it',
195
+ details: "One folder an identity in the house repo's .shipkit/identities/. A repo names its own with speaksAs in repo.config.ts; the default identity speaks for a repo that names none. Page: wiki build/shipkit/social.md",
196
+ examples: [['every identity', 'sk identities'], ['as json', 'sk identities --json']],
197
+ })
198
+ json = Option.Boolean('--json', false, { description: 'one json object' })
199
+ override async execute(): Promise<number> {
200
+ return guarded(this.context, async () => {
201
+ const { loadIdentities, speakerOf } = await import('../identities/identities.ts')
202
+ const { houseRepoRoots } = await import('../social/house.ts')
203
+ const ids = await loadIdentities()
204
+ const repos = await houseRepoRoots()
205
+ const by = new Map<string, string[]>()
206
+ for (const r of repos) {
207
+ const id = speakerOf(r.speaksAs, ids)?.id ?? '(none)'
208
+ by.set(id, [...(by.get(id) ?? []), r.name])
209
+ }
210
+ if (this.json) {
211
+ say(this.context)(JSON.stringify({ dir: ids.dir, identities: ids.identities.map((i) => ({ id: i.id, name: i.name, default: i.default, site: i.site, accounts: i.accounts.map((a) => ({ id: a.id, handle: a.handle, live: a.live })), repos: by.get(i.id) ?? [] })), errors: ids.errors }))
212
+ return ids.errors.length ? 1 : 0
213
+ }
214
+ for (const i of ids.identities) {
215
+ const online = i.accounts.filter((a) => a.live !== '')
216
+ say(this.context)(`${i.id}${i.default ? ' (default)' : ''} ${i.name} ${online.length}/${i.accounts.length} accounts online${i.site ? ` ${i.site}` : ''}`)
217
+ say(this.context)(` online: ${online.map((a) => `${a.id} ${a.handle}`).join(', ') || 'none'}`)
218
+ say(this.context)(` repos: ${(by.get(i.id) ?? []).join(', ') || 'none'}`)
219
+ }
220
+ for (const e of ids.errors) say(this.context)(`FAIL: ${e}`)
221
+ return ids.errors.length ? 1 : 0
222
+ })
223
+ }
224
+ }
225
+
226
+ export const SOCIAL_COMMANDS = [SocialCommand, SocialTimelineCommand, SocialCoverageCommand, SocialPostCommand, SocialPlanCommand, SocialStateCommand, SocialMigrateCommand, IdentitiesCommand]
@@ -24,7 +24,7 @@ export class StartCommand extends Command {
24
24
  root = Option.String('--root', { description: 'parent dir for repos (default ~/dev)' })
25
25
  include = Option.Array('--include', { description: 'line CLAUDE.md must carry, repeatable, order kept. Omitted: the house template (HOUSE_INCLUDE in src/start-repo.ts), the base wiki include then `@./agent/index.md`, and on a machine without that wiki the agent route alone' })
26
26
  alsoOk = Option.Array('--also-ok', { description: 'alternative lines satisfying the first --include — never double-add. Omitted: `@./CLAUDE.local.md`, the public-repo indirection' })
27
- skip = Option.Array('--skip', { description: 'repo names shipkit never touches: no CLAUDE.md include, no wiring. Omitted: the house list (HOUSE_SKIP in src/start-repo.ts)' })
27
+ skip = Option.Array('--skip', { description: 'repo names shipkit never touches: no CLAUDE.md include, no wiring. Omitted: start.skip in the house config' })
28
28
  github = Option.Boolean('--github', { description: 'ON by default when a repo is being STARTED (a dir this run created, or one with a package.json): it gets a PRIVATE github repo wired as origin, and the first commit is pushed to it. Pass --github to force it for a pre-existing folder, --no-github to keep everything local, the first commit included (SHIPKIT_NO_GITHUB=1 does it for every run)' })
29
29
 
30
30
  withCli = Option.Boolean('--cli', false, { description: 'on a repo with history: write the project CLI skeleton (src/cli.ts on the kit, an example family, package.json cli and bin), refused when the repo already has a CLI. A started repo always gets it' })
@@ -26,7 +26,7 @@ export class TimeCommand extends Command {
26
26
  ['every command shape, 30 days', 'sk time commands --since 30d'],
27
27
  ['what he said while it ran', 'sk time feedback --since all'],
28
28
  ['the runs by their turns, and what the reads cost', 'sk time turns --since 30d'],
29
- ['two repos, every recorded session', 'sk time ~/dev/pkm-multi ~/dev/procedural-creatures --since all'],
29
+ ['two repos, every recorded session', 'sk time ~/dev/game ~/dev/site --since all'],
30
30
  ['every repo on the machine', 'sk time --all'],
31
31
  ['for a script', 'sk time --json'],
32
32
  ],
@@ -236,8 +236,11 @@ export class TrailerKeepCommand extends Command {
236
236
  static override usage = Command.Usage({
237
237
  category: 'Trailer',
238
238
  description: 'keep the built cut as a version: versions/v<n>.trailer, its video, strip and takes',
239
- details: `${DETAILS}. Refuses a version already kept; prints the index row, commit and tag left to do`,
240
- examples: [['keep the one cut', 'sk trailer keep v4']],
239
+ details: `${DETAILS}. main.trailer keeps v<n>, another cut of the folder <stem>-v<n> (tease.trailer: versions/tease-v1.trailer). Refuses a version already kept; prints the index row, commit and tag left to do`,
240
+ examples: [
241
+ ['keep the one cut', 'sk trailer keep v4'],
242
+ ['keep a second cut of the folder, as tease-v1', 'sk trailer keep v1 trailer/launch/tease.trailer'],
243
+ ],
241
244
  })
242
245
 
243
246
  version = Option.String({ required: true })
@@ -0,0 +1,173 @@
1
+ // sk veille: an identity's Veille for agents (veille/, wiki build/shipkit/veille.md, For agents: never the raw log): the
2
+ // feed as compact lines, one reply's brief or its draft, a pass with its reason, an older log brought in. Every module
3
+ // loads inside execute: the cli registers this file on every `sk` call
4
+ import { Command, Option } from 'clipanion'
5
+
6
+ type Ctx = { stdout: NodeJS.WritableStream; stderr: NodeJS.WritableStream }
7
+ type Identity = import('../veille/identity.ts').VeilleIdentity
8
+
9
+ interface Here {
10
+ out: (l: string) => void
11
+ identity: Identity
12
+ /** the repo the command runs in, null outside one */
13
+ root: string | null
14
+ asksDir: string | null
15
+ }
16
+
17
+ /** the identity named, else the one the current repo's Veille is */
18
+ async function run(context: Ctx, as: string | undefined, body: (h: Here) => Promise<number>): Promise<number> {
19
+ const out = (l: string): void => void context.stdout.write(`${l}\n`)
20
+ try {
21
+ const { identityOf, hasVeille } = await import('../veille/identity.ts')
22
+ const { veilleAt } = await import('../veille/routes.ts')
23
+ const { storeDir } = await import('../review/store.ts')
24
+ const { findRepoRoot } = await import('../ts/config.ts')
25
+ let root: string | null = null
26
+ try {
27
+ root = findRepoRoot(process.cwd())
28
+ } catch {
29
+ root = null
30
+ }
31
+ const here = root == null ? null : veilleAt(root)
32
+ const identity = as === undefined ? here?.identity : identityOf(as)
33
+ if (identity == null) throw new Error(as === undefined ? 'this repo shows no Veille: name the identity with --as <id>' : `no identity ${as}`)
34
+ if (!hasVeille(identity)) throw new Error(`${identity.id} has no watch list (${identity.watchFile})`)
35
+ const asksDir = here != null && here.identity.id === identity.id ? storeDir(here.asks.root) : null
36
+ return await body({ out, identity, root, asksDir })
37
+ } catch (e) {
38
+ context.stderr.write(`FAIL: veille: ${e instanceof Error ? e.message : String(e)}\n`)
39
+ return 1
40
+ }
41
+ }
42
+
43
+ const asOpt = (): string | undefined => Option.String('--as', { description: "the identity, by id (default: the one this repo's Veille is)" })
44
+
45
+ export class VeilleFeedCommand extends Command {
46
+ static override paths = [['veille', 'feed']]
47
+ static override usage = Command.Usage({
48
+ category: 'Veille',
49
+ description: 'the posts an identity scrolled past, ranked by the worth of a reply: one compact line each',
50
+ details:
51
+ "From the identity's log in shipkit's home: platform, author, their followers, age, likes, reposts, replies, views, the worth of a reply (w0 to w100), the subreddit, about 100 characters of text, its key. Only the active posts (worth at or over the rule maybe, not handled) unless --all; a platform switched off is left out unless --platform names it. Page: wiki build/shipkit/veille.md",
52
+ examples: [
53
+ ['the best twenty of the last day', 'sk veille feed'],
54
+ ['X only, the last three days', 'sk veille feed --platform x --since 3d'],
55
+ ],
56
+ })
57
+ as = asOpt()
58
+ platform = Option.String('--platform', { description: 'one platform: x, threads, bluesky, mastodon, instagram, tiktok, reddit' })
59
+ top = Option.String('--top', '20', { description: 'how many lines' })
60
+ since = Option.String('--since', '24h', { description: 'the window: 90m, 24h, 3d, 7d' })
61
+ all = Option.Boolean('--all', false, { description: 'the expired and handled posts too' })
62
+ async execute(): Promise<number> {
63
+ return run(this.context, this.as, async (h) => {
64
+ const { feedLine } = await import('../veille/desk.ts')
65
+ const { isPlatform } = await import('../veille/platforms.ts')
66
+ const { interactions } = await import('../veille/asks.ts')
67
+ const { oursOf, veilleOf } = await import('../veille/service.ts')
68
+ const m = /^(\d+)\s*([mhd])$/.exec(this.since.trim())
69
+ if (m == null) throw new Error(`--since ${this.since}? like 90m, 24h or 3d`)
70
+ if (this.platform !== undefined && !isPlatform(this.platform)) throw new Error(`--platform ${this.platform}?`)
71
+ const { desk } = veilleOf(h.identity)
72
+ const off = this.platform === undefined ? desk.off() : []
73
+ const rows = desk
74
+ .feed({ ...(this.platform && isPlatform(this.platform) ? { platform: this.platform } : {}), sinceMs: Number(m[1]) * { m: 60_000, h: 3600_000, d: 86_400_000 }[m[2] as 'm' | 'h' | 'd'], all: this.all, ours: oursOf(h.identity), ...(h.asksDir ? { asks: interactions(h.asksDir).posts } : {}) })
75
+ .filter((r) => !off.includes(r.platform))
76
+ .slice(0, Number(this.top))
77
+ if (rows.length === 0) h.out(`no post in that window: the extension sends what ${h.identity.id}'s Chrome profile scrolls past`)
78
+ for (const r of rows) h.out(feedLine(r))
79
+ return 0
80
+ })
81
+ }
82
+ }
83
+
84
+ export class VeilleReplyCommand extends Command {
85
+ static override paths = [['veille', 'reply']]
86
+ static override usage = Command.Usage({
87
+ category: 'Veille',
88
+ description: "a reply to one post of the Veille: its brief, or with --text the draft the hub's page shows",
89
+ details: "The brief holds everything one reply needs: the post, the identity's voice pages, the media the project's drafts could lend. With --text: the draft written, shown at once on the Veille page, where he posts it himself.",
90
+ examples: [
91
+ ['the brief for one', 'sk veille reply x:1849000000000000001'],
92
+ ['the draft', 'sk veille reply x:1849000000000000001 --text "Love the silhouettes!"'],
93
+ ],
94
+ })
95
+ key = Option.String({ name: 'key' })
96
+ as = asOpt()
97
+ text = Option.String('--text', { description: 'the reply' })
98
+ media = Option.String('--media', { description: 'a media file of the drafts it lends, repo relative' })
99
+ async execute(): Promise<number> {
100
+ return run(this.context, this.as, async (h) => {
101
+ const { brief, mediaFor } = await import('../veille/desk.ts')
102
+ const { draftMedia } = await import('../social/media-of.ts')
103
+ const { oursOf, veilleOf } = await import('../veille/service.ts')
104
+ const { desk } = veilleOf(h.identity)
105
+ const row = desk.feed({ all: true, ours: oursOf(h.identity) }).find((r) => r.key === this.key)
106
+ if (row == null) throw new Error(`no post ${this.key} in the log: sk veille feed gives the keys`)
107
+ if (this.text === undefined) {
108
+ h.out(brief(row, h.root == null ? [] : mediaFor(row.text, draftMedia(h.root), h.root), { as: h.identity.id, pages: desk.watch().voice }))
109
+ return 0
110
+ }
111
+ desk.writeReply(row.key, { text: this.text, media: this.media ?? null, at: Date.now(), by: 'agent' })
112
+ h.out(`ok: the draft of ${row.key}, on the Veille page of ${h.identity.id}`)
113
+ return 0
114
+ })
115
+ }
116
+ }
117
+
118
+ export class VeillePassCommand extends Command {
119
+ static override paths = [['veille', 'pass']]
120
+ static override usage = Command.Usage({
121
+ category: 'Veille',
122
+ description: 'a post of the Veille not worth a reply: passed with its one line reason',
123
+ details: 'The post leaves the active groups for « vus ou expirés », its reason on its row (the identity\'s voice pages say when to pass).',
124
+ examples: [['pass one', 'sk veille pass x:1849000000000000001 --why "nothing specific to add"']],
125
+ })
126
+ key = Option.String({ name: 'key' })
127
+ as = asOpt()
128
+ why = Option.String('--why', { required: true, description: 'the real reason, one line' })
129
+ async execute(): Promise<number> {
130
+ return run(this.context, this.as, async (h) => {
131
+ const { oursOf, veilleOf } = await import('../veille/service.ts')
132
+ const { desk } = veilleOf(h.identity)
133
+ if (desk.feed({ all: true, ours: oursOf(h.identity) }).every((r) => r.key !== this.key)) throw new Error(`no post ${this.key} in the log: sk veille feed gives the keys`)
134
+ if (this.why.trim() === '') throw new Error('--why is empty')
135
+ desk.pass(this.key, this.why.trim())
136
+ h.out(`ok: ${this.key} passed`)
137
+ return 0
138
+ })
139
+ }
140
+ }
141
+
142
+ export class VeilleImportCommand extends Command {
143
+ static override paths = [['veille', 'import']]
144
+ static override usage = Command.Usage({
145
+ category: 'Veille',
146
+ description: "an older Veille log brought into an identity's: every day and mark kept, the posts counted",
147
+ details: "Merges a log folder (a repo's .shipkit/veille/) into the identity's in shipkit's home: each day's lines in the order they were seen, the marks (handled, passed, replied), the authors, the platforms off, the reply drafts. Prints the posts before and after, and fails when a post of either side is missing. The source is left as it is.",
148
+ examples: [['an older log', 'sk veille import ~/dev/my-game/.shipkit/veille --as studio']],
149
+ })
150
+ from = Option.String({ name: 'dir' })
151
+ as = Option.String('--as', { required: true, description: 'the identity, by id' })
152
+ async execute(): Promise<number> {
153
+ const out = (l: string): void => void this.context.stdout.write(`${l}\n`)
154
+ try {
155
+ const { identityOf } = await import('../veille/identity.ts')
156
+ const { importLog } = await import('../veille/import.ts')
157
+ const x = identityOf(this.as)
158
+ if (x == null) throw new Error(`no identity ${this.as}`)
159
+ const r = importLog(this.from, x.logDir)
160
+ out(`${this.from}: ${r.source} posts in ${r.days} days`)
161
+ out(`${x.logDir}: ${r.targetBefore} posts before, ${r.targetAfter} after`)
162
+ out(`marks ${Object.entries(r.marks).map(([k, n]) => `${k.replace('.json', '')} ${n}`).join(', ')}, reply drafts ${r.replies}`)
163
+ if (r.missing.length > 0) throw new Error(`${r.missing.length} posts missing after the import: ${r.missing.slice(0, 5).join(', ')}`)
164
+ out(`ok: every post of both logs is in ${x.id}'s`)
165
+ return 0
166
+ } catch (e) {
167
+ this.context.stderr.write(`FAIL: veille import: ${e instanceof Error ? e.message : String(e)}\n`)
168
+ return 1
169
+ }
170
+ }
171
+ }
172
+
173
+ export const VEILLE_COMMANDS = [VeilleFeedCommand, VeilleReplyCommand, VeillePassCommand, VeilleImportCommand]
@@ -7,6 +7,7 @@ import { join } from 'path'
7
7
  export const FAMILY_PAGES: Readonly<Record<string, string>> = {
8
8
  Asks: 'world/human-loop.md',
9
9
  Assets: 'build/generate-assets.md',
10
+ Drill: 'build/speed-up-agents.md',
10
11
  Gate: 'build/shipkit.md',
11
12
  Health: 'build/shipkit.md',
12
13
  Home: 'build/shipkit/home.md',
@@ -16,8 +17,10 @@ export const FAMILY_PAGES: Readonly<Record<string, string>> = {
16
17
  Scaffold: 'build/pocketbase.md',
17
18
  Serve: 'build/shipkit/home.md',
18
19
  Setup: 'meta/rv-conventions.md',
20
+ Social: 'build/shipkit/social.md',
19
21
  Sound: 'build/trailer.md',
20
22
  Trailer: 'build/trailer.md',
23
+ Veille: 'build/shipkit/veille.md',
21
24
  Wiki: 'build/mdwiki.md',
22
25
  }
23
26
 
@@ -9,10 +9,11 @@ import { AssetsAddCommand, AssetsCheckCommand, AssetsFillCommand, AssetsGenComma
9
9
  import { BumpCommand } from './cmd_Bump.ts'
10
10
  import { CallsCommand } from './cmd_Calls.ts'
11
11
  import { TimeCommand } from './cmd_Time.ts'
12
+ import { DrillCompareCommand, DrillReportCommand, DrillVerdictCommand } from './cmd_Drill.ts'
12
13
  import { CheckCommand } from './cmd_Check.ts'
13
14
  import { CommandsCommand } from './cmd_Commands.ts'
14
15
  import { withFamilyPage } from './family-pages.ts'
15
- import { aliasArgs, CrossRepoActivityCommand } from './cmd_CrossRepoActivity.ts'
16
+ import { CrossRepoActivityCommand } from './cmd_CrossRepoActivity.ts'
16
17
  import { ConfigKeysCommand } from './cmd_ConfigKeys.ts'
17
18
  import { GlobalProcessesCommand, GlobalProcessOpenCommand, GlobalProcessRestartCommand, GlobalProcessStartCommand, GlobalProcessStopCommand } from './cmd_GlobalProcesses.ts'
18
19
  import { PlannedCommand } from './cmd_Planned.ts'
@@ -23,7 +24,7 @@ import { CiCommand } from './cmd_Ci.ts'
23
24
  import { ContractsCommand } from './cmd_Contracts.ts'
24
25
  import { FleetCommand } from './cmd_Fleet.ts'
25
26
  import { FleetPushCommand } from './cmd_FleetPush.ts'
26
- import { DaemonCommand, GuiCommand, PmCommand, PmInstallCommand, PmUninstallCommand, WebCommand } from './cmd_Home.ts'
27
+ import { DaemonCommand, DaemonJobCommand, GuiCommand, PmCommand, PmInstallCommand, PmUninstallCommand, WebCommand } from './cmd_Home.ts'
27
28
  import { HooksCommitMsgCommand, HooksInstallCommand, HooksListCommand, HooksPreCommitCommand } from './cmd_Hooks.ts'
28
29
  import { InitCommand } from './cmd_Init.ts'
29
30
  import { KeysCommand } from './cmd_Keys.ts'
@@ -45,7 +46,10 @@ import { StartCommand } from './cmd_Start.ts'
45
46
  import { TRAILER_COMMANDS } from './cmd_Trailer.ts'
46
47
  import { SOUND_COMMANDS } from './cmd_Sound.ts'
47
48
  import { REVIEW_COMMANDS } from './cmd_Review.ts'
49
+ import { SOCIAL_COMMANDS } from './cmd_Social.ts'
48
50
  import { MEDIA_COMMANDS } from './cmd_Media.ts'
51
+ import { BACKUP_COMMANDS } from './cmd_Backup.ts'
52
+ import { VEILLE_COMMANDS } from './cmd_Veille.ts'
49
53
  import { TuiCommand } from './cmd_Tui.ts'
50
54
  import { WikiLintCommand, WikiServeCommand } from './cmd_Wiki.ts'
51
55
 
@@ -86,10 +90,14 @@ export function buildCli(): Cli {
86
90
  for (const c of TRAILER_COMMANDS) cli.register(c)
87
91
  for (const c of SOUND_COMMANDS) cli.register(c)
88
92
  for (const c of REVIEW_COMMANDS) cli.register(c)
93
+ for (const c of SOCIAL_COMMANDS) cli.register(c)
89
94
  for (const c of MEDIA_COMMANDS) cli.register(c)
95
+ for (const c of BACKUP_COMMANDS) cli.register(c)
96
+ for (const c of VEILLE_COMMANDS) cli.register(c)
90
97
  cli.register(ServeCommand)
91
98
  cli.register(PmCommand)
92
99
  cli.register(DaemonCommand)
100
+ cli.register(DaemonJobCommand)
93
101
  cli.register(WebCommand)
94
102
  cli.register(PmInstallCommand)
95
103
  cli.register(PmUninstallCommand)
@@ -133,6 +141,9 @@ export function buildCli(): Cli {
133
141
  cli.register(CommandsCommand)
134
142
  cli.register(CallsCommand)
135
143
  cli.register(TimeCommand)
144
+ cli.register(DrillReportCommand)
145
+ cli.register(DrillVerdictCommand)
146
+ cli.register(DrillCompareCommand)
136
147
  cli.register(ConfigKeysCommand)
137
148
 
138
149
  return cli
package/src/cli.ts CHANGED
@@ -30,12 +30,14 @@ export const loadBoot = (cmd?: string) =>
30
30
  import('./core/one-lib.ts'),
31
31
  import('./cli/kit/calls.ts'),
32
32
  import('./home/autostart.ts'),
33
+ import('./core/machine-link.ts'),
33
34
  loadRole(cmd),
34
35
  ])
35
36
 
36
37
  // only when this file IS the process. A repo's installed copy first hands the
37
38
  // command to the house source (handoff.ts). One copy of the lib per process:
38
- // a repo config that imports its own install lands on this one (one-lib.ts).
39
+ // a repo config that imports its own install lands on this one (one-lib.ts),
40
+ // and a house repo's install becomes a link to it (machine-link.ts).
39
41
  // The run is logged (cli/kit/calls.ts, read back by `sk calls`). Then pm is
40
42
  // started when it is down (autostart.ts), before the command runs
41
43
  if (import.meta.main) {
@@ -48,10 +50,11 @@ if (import.meta.main) {
48
50
  throw e
49
51
  }
50
52
  bootLoaded()
51
- const [{ buildCli }, { aliasArgs }, { handoff }, { installOneLib }, { callsFile, logCall }, { autostart }] = m
53
+ const [{ buildCli }, { aliasArgs }, { handoff }, { installOneLib }, { callsFile, logCall }, { autostart }, { linkMachineCopy }] = m
52
54
  const argv = aliasArgs(raw)
53
55
  handoff(argv)
54
56
  installOneLib()
57
+ await linkMachineCopy()
55
58
  logCall(callsFile((await import('os')).homedir(), 'sk'), 'sk', argv)
56
59
  await autostart(argv)
57
60
  void buildCli().runExit(argv)
@@ -1,60 +1,12 @@
1
1
  // Act-in-place verbs behind the hub feed — every mutation targets a
2
2
  // git-tracked truth file (studio pick-flow precedent: the hub writes, the
3
3
  // repo's diff shows it; Feedback appends are append-only, never destructive).
4
- import { existsSync, readFileSync, readdirSync, writeFileSync } from 'fs'
4
+ import { existsSync, readFileSync, writeFileSync } from 'fs'
5
5
  import { join } from 'path'
6
6
  import { archiveAsk, proofAsk } from '../asks/asks-queue.ts'
7
- import { parsePostFile } from './posts.ts'
8
7
 
9
8
  const today = (): string => new Date().toISOString().slice(0, 10)
10
9
 
11
- const postPath = (root: string, channel: string, file: string): string => {
12
- if (channel.includes('/') || channel.includes('..') || file.includes('/') || file.includes('..')) throw new Error('bad path')
13
- const p = join(root, '.shipkit/social', channel, file)
14
- if (!existsSync(p)) throw new Error(`no such post: ${channel}/${file}`)
15
- return p
16
- }
17
-
18
- const setStatus = (p: string, status: string): void => {
19
- const md = readFileSync(p, 'utf8')
20
- if (!/^status:/m.test(md)) throw new Error('post has no status: frontmatter')
21
- writeFileSync(p, md.replace(/^status:.*$/m, `status: ${status}`))
22
- }
23
-
24
- /** pick one draft variant: it flips to picked, sibling drafts to rejected
25
- * (files KEPT — rejections are training data for the next generation) */
26
- export function pickPostVariant(root: string, channel: string, file: string): void {
27
- const p = postPath(root, channel, file)
28
- const dir = join(root, '.shipkit/social', channel)
29
- const slug = parsePostFile(dir, channel, file).slug
30
- setStatus(p, 'picked')
31
- for (const f of readdirSync(dir).filter((x) => x.endsWith('.md') && x !== file)) {
32
- const sib = parsePostFile(dir, channel, f)
33
- if (sib.slug === slug && sib.status === 'draft') setStatus(join(dir, f), 'rejected')
34
- }
35
- }
36
-
37
- /** the posted-URL proof: status → posted, `posted:` frontmatter carries the URL */
38
- export function markPosted(root: string, channel: string, file: string, url: string, rating?: number): void {
39
- const p = postPath(root, channel, file)
40
- setStatus(p, 'posted')
41
- const md = readFileSync(p, 'utf8')
42
- const withUrl = /^posted:/m.test(md) ? md.replace(/^posted:.*$/m, `posted: ${url}`) : md.replace(/^status:.*$/m, (s) => `${s}\nposted: ${url}`)
43
- const withRating = rating != null
44
- ? (/^rating:/m.test(withUrl) ? withUrl.replace(/^rating:.*$/m, `rating: ${rating}`) : withUrl.replace(/^posted:.*$/m, (s) => `${s}\nrating: ${rating}`))
45
- : withUrl
46
- writeFileSync(p, withRating)
47
- }
48
-
49
- /** append a dated remark under ## Feedback (created if absent) — NEVER
50
- * destructive; future generations re-read these before drafting */
51
- export function appendPostFeedback(root: string, channel: string, file: string, text: string): void {
52
- const p = postPath(root, channel, file)
53
- const md = readFileSync(p, 'utf8')
54
- const line = `- ${today()}: ${text.replace(/\n+/g, ' ').trim()}`
55
- writeFileSync(p, /^## Feedback\s*$/m.test(md) ? `${md.trimEnd()}\n${line}\n` : `${md.trimEnd()}\n\n## Feedback\n${line}\n`)
56
- }
57
-
58
10
  /** an asset remark → `.shipkit/assets/notes.md` (git-tracked; the studio
59
11
  * workspace is gitignored, so notes live beside kit.ts) */
60
12
  export function appendAssetNote(root: string, assetId: string, text: string): void {
@@ -21,7 +21,7 @@ import { FLOOR_IDS } from '../core/floor.ts'
21
21
  import { FOREVER_MS, formatLine, ttlMsOf } from '../core/wire.ts'
22
22
  import { gateInventory, type CheckRow } from '../ledger/gate-checks.ts'
23
23
  import { runsCellsOf } from '../core/runs-matrix.ts'
24
- import { readLastLines, readRuns, runsPath, type LastLine, type RunRow } from '../ledger/run-log.ts'
24
+ import { readLastLines, readRuns, runsPath, warmRuns, type LastLine, type RunRow } from '../ledger/run-log.ts'
25
25
  import { checkStatsFor, type CheckStat } from '../ledger/check-stats.ts'
26
26
  import { NEGATIVE_TTL_CAP_MS } from '../ledger/world-cache.ts'
27
27
  import type { RepoConfig } from '../repo-config.ts'
@@ -66,6 +66,7 @@ export function checksCollection(root: string, c: RepoConfig, o: ChecksOpts = {}
66
66
  kind: 'check',
67
67
  media: 'health',
68
68
  list: async () => {
69
+ if (o.runs == null) await warmRuns(runsPath(root))
69
70
  const rows = await gateInventory(root, c)
70
71
  const stats = o.stats ?? checkStatsFor(root, rows.map((r) => ({ id: r.decl.id })))
71
72
  const lines = o.lastLines ?? readLastLines(runsPath(root))